Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // twitter last twitte
- switch($comic['author_name']){
- case 'Matt Melvin':
- $utweetid = 'MattMelvin';
- break;
- case 'Rob DenBleyker':
- $utweetid = 'RobDenBleyker';
- break;
- case 'Kris Wilson':
- $utweetid = 'TheKrisWilson';
- break;
- case 'Explosm':
- $utweetid = 'daveexplosm';
- break;
- }
- $tweetText = "";
- /*
- if( $app['memcached']->get('twitter-comic-'.$id) === false) {
- $app['memcached']->set('twitter-comic-'.$id, 0, 3600);
- $app['memcached']->increment('view-comic-'.$id);
- */
- $app['memcached']->set('twitter-comic-'.$id, 1, 3600);
- var_dump($app['memcached']->get('twitter-comic-'.$id));
- die();
- if(isset($utweetid)&&!empty($utweetid)):
- $connection = new TwitterOAuth('PIdfpxct8sMbu43m3E7Vprr4B', 'OGHEq6xDsyPCukJOEFSSPs6BD2u8DLCkiNPK4HBmuZVX9Vj18q', '514344270-2rbLO2Bi7RTMmWMzYrejLAhZOXHbdBm7LGdLS76h', '4cHBybTTTjI33iq8cMeG8zZriOlWk93gMp8x9YMUSqbLd');
- $tweets = $connection->get('statuses/user_timeline', array('screen_name' => $utweetid, 'count' => 1, 'exclude_replies' => 'true', 'include_rts' => 'false'));
- if(isset($tweets->errors))
- {
- echo 'Error :'. $tweets->errors[0]->code. ' - '. $$tweets->errors[0]->message;
- }
- else
- {
- foreach($tweets as $tweet) {
- # Access as an object
- $tweetText = $tweet->text;
- # Make links active
- $tweetText = preg_replace("#(http://|(www.))(([^s<]{4,68})[^s<]*)#", '<a href="http://$2$3" target="_blank">$1$2$4</a>', $tweetText);
- # Linkify user mentions
- $tweetText = preg_replace("/@(w+)/", '<a href="http://www.twitter.com/$1" target="_blank">@$1</a>', $tweetText);
- # Linkify tags
- $tweetText = preg_replace("/#(w+)/", '<a href="http://search.twitter.com/search?q=$1" target="_blank">#$1</a>', $tweetText);
- }
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement