Skip to content
Snippets Groups Projects
Unverified Commit 089aa0b1 authored by Robb Lewis's avatar Robb Lewis
Browse files

Hide pic.twitter urls, save full urls in db - better for search, closes #1 for...

Hide pic.twitter urls, save full urls in db - better for search, closes #1 for my use case so ¯\_(ツ)_/¯
parent 16146d0a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -59,6 +59,15 @@ class Formatter {
 
$type = ($formattedTweet['text'][0] == "@") ? 1 : (preg_match("/RT @\w+/", $formattedTweet['text']) ? 2 : 0);
 
$entities = $formattedTweet['extra']['entities'];
if (is_array($entities->urls))
{
foreach ($entities->urls as $url) {
$formattedTweet['text'] = str_replace($url->url, $url->expanded_url, $formattedTweet['text']);
}
}
return [
'userid' => $formattedTweet['userid'],
'tweetid' => $formattedTweet['tweetid'],
Loading
Loading
Loading
Loading
@@ -12,22 +12,13 @@ class TweetPresenter extends Presenter {
 
if ($this->extra['entities'])
{
if (property_exists($this->extra['entities'], 'urls')) {
foreach($this->extra['entities']->urls as $url)
{
$this->text = str_replace($url->url, $url->expanded_url, $this->text);
}
}
if (property_exists($this->extra['entities'], 'media')) {
foreach( $this->extra['entities']->media as $url)
foreach($this->extra['entities']->media as $url)
{
$this->text = str_replace($url->url, $url->display_url, $this->text);
$this->text = str_replace($url->url, '', $this->text);
}
}
}
$this->text = str_replace('pic.twitter.com', 'https://pic.twitter.com', $this->text);
 
if ($this->type == '1')
$this->text = '<i class="fa fa-reply"></i> ' . $this->text;
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@ class CreateTweetsTable extends Migration
$table->string('tweetid', 100)->unique('tweetid');
$table->boolean('type')->default(0);
$table->integer('time')->unsigned();
$table->string('text')->index('text');
$table->text('text');
$table->string('source');
$table->boolean('favorite')->default(0);
$table->text('extra');
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment