New Paste

 

Recent Pastes

Administrate




PageLines PasteBin.

PasteID: 39o
Pasted by Anonymous, 2013-05-15 22:09:22 GMT
Expires Never
Paste size 1.84 Kb
Toggle Expand   Wrap   Raw
Copy Contents   Copy URL
 
  1. <?php
  2. /*
  3. 	Section: TwitterBar
  4. 	Author: PageLines
  5. 	Author URI: http://www.pagelines.com
  6. 	Description: Loads twitter feed into the site footer
  7. 	Class Name: PageLinesTwitterBar
  8. 	Workswith: morefoot, footer
  9. 	Edition: Pro
  10. */
  11.  
  12. /**
  13.  * Twitter Feed Section
  14.  *
  15.  * Uses pagelines_get_tweets() to display the latest tweet in the morefoot area.
  16.  *
  17.  * @package PageLines Framework
  18.  * @author PageLines
  19.  */
  20. class PageLinesTwitterBar extends PageLinesSection {
  21.  
  22.  
  23. 	function section_styles() {
  24.  
  25. 		wp_enqueue_script( 'twitter', $this->base_url.'/twitter.js', array( 'pagelines-bootstrap-all' ), null, true );
  26. 	}
  27. 	/**
  28. 	* Section template.
  29. 	*/
  30. 	function section_template() {
  31.  
  32. 		if( !pagelines('twittername') ) :
  33. 			printf('<div class="tbubble"><div class="tbubble-pad">%s</div></div>', __('Set your Twitter account name in your settings to use the TwitterBar Section.', 'pagelines'));
  34.  
  35. 			return;
  36. 		endif;
  37.  
  38. 		$account = ploption('twittername');
  39.  
  40. 		$tweet_data = pagelines_get_tweets( $account, true );
  41.  
  42. 		if( ! is_array( $tweet_data ) && '' == $tweet_data )
  43. 			$tweet_data = __( 'Unknown Twitter error.', 'pagelines' );
  44.  
  45. 		if( isset( $tweet_data['text'] ) && isset( $tweet_data['user']['id'] ) )
  46. 			$twitter = sprintf(
  47. 				'<span class="twitter">%s &nbsp;&mdash;&nbsp;<a class="twitteraccount" href="http://twitter.com/#!/%s" %s>%s</a></span>',
  48. 				pagelines_tweet_clickable( $tweet_data['text'] ),
  49. 				$account,
  50. 				sprintf( 'rel="twitterpopover" data-img="https://api.twitter.com/1/users/profile_image?user_id=%s&size=bigger" data-original-title="@%s"', $tweet_data['user']['id'], $account ),
  51. 				$account
  52. 			);
  53. 		else
  54. 			$twitter = sprintf( '<span class="twitter">%s</span>', $tweet_data );
  55.  
  56. 		printf('<div class="tbubble"><div class="tbubble-pad">%s</div></div>', $twitter);
  57. 	}
  58. }
 
 
 

 
 
 
 
 
Written by Xan Manning, 2010.
YOU NEED FLASH!