Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.82 KB | None | 0 0
  1. <?php
  2.  
  3. class ffComponent_TwitterWidget_Printer extends ffBasicObject {
  4.     public function printComponent( $args, ffOptionsQuery $query) {
  5.  
  6.         wp_enqueue_script('ark-scrollbar');
  7.        
  8.         extract( $args );
  9.  
  10.         $twitterFeeder = ffContainer::getInstance()->getLibManager()->createTwitterFeeder();
  11.         ffContainer::getInstance()->getClassLoader()->loadClass('ffOptionsHolder_Twitter');
  12.  
  13.         $tweetsCollection = ($twitterFeeder->getTwitterFeed( $query->get('twitter fw_twitter')  ));
  14.  
  15.         echo  $before_widget;
  16.  
  17.         $title = trim( $query->get('twitter title') );
  18.         if( !empty($title) ){
  19.  
  20.             // Default WP text
  21.             echo  $before_title . ark_wp_kses( $title ) .  $after_title;
  22.  
  23.         }
  24.  
  25.         if( ! $tweetsCollection->valid() ){
  26.             echo '<p>';
  27.             echo ark_wp_kses(__('Bad Twitter account data!','ark'));
  28.             echo '</p>';
  29.         }else{
  30.             echo '<div';
  31.             if( $query->get('twitter height set-max-height') ){
  32.                 wp_enqueue_script( 'scrollbar' );
  33.                 echo ' class="blog-sidebar-content-height scrollbar"';
  34.                 $height = absint($query->get('twitter height height'));
  35.                 if( $height < 50 ){
  36.                     $height = 50;
  37.                 }
  38.                 echo ' style="max-height:'.$height.'px"';
  39.             }
  40.             echo '>';
  41.                 echo '<ul class="list-unstyled twitter-feed">';
  42.                 foreach( $tweetsCollection as $oneTweet ) {
  43.  
  44.                     $profileImage = $oneTweet->profileImage;
  45.                     if( is_ssl() ){ // is HTTPS
  46.                         if( 0 === strpos($profileImage, 'http://') ){
  47.                             $profileImage = 'https'.substr( $profileImage, 4 );
  48.                         }
  49.                     }else{ // is HTTP
  50.                         if( 0 === strpos($profileImage, 'https://') ){
  51.                             $profileImage = 'http' . substr( $profileImage, 5 );
  52.                         }
  53.                     }
  54.  
  55.                     echo '<li class="twitter-feed-item">';
  56.                         echo '<div class="twitter-feed-media">';
  57.                             echo '<img class="twitter-feed-media-img radius-circle mCS_img_loaded" src="'.esc_url($profileImage).'" alt="">';
  58.                         echo '</div>';
  59.  
  60.                         echo '<div class="twitter-feed-content">';
  61.                             echo '<div class="twitter-feed-info clearfix">';
  62.  
  63.                                 echo '<div class="twitter-feed-profile">';
  64.                                     echo '<strong class="twitter-feed-profile-name">'.$oneTweet->profileName.'</strong> ';
  65.                                     echo '<span class="twitter-feed-profile-nickname">';
  66.                                     echo '<a class="twitter-feed-profile-nickname-link" href="'.esc_url( 'http://twitter.com/'.( $query->get('twitter fw_twitter username') ) ).'">';
  67.                                     echo '@'.$oneTweet->profileScreenName;
  68.                                     echo '</a>';
  69.                                     echo '</span>';
  70.                                 echo '</div>';
  71.  
  72.                                 echo '<span class="twitter-feed-posted-time">';
  73.                                 echo human_time_diff( get_the_time('U'), strtotime($oneTweet->date) );
  74.                                 echo '</span>';
  75.  
  76.                             echo '</div>';
  77.  
  78.                             echo '<p class="twitter-feed-paragraph clearfix">'.$oneTweet->textWithLinks.'</p>';
  79.                         echo '</div>';
  80.                     echo '</li>';
  81.                 }
  82.                 echo '</ul>';
  83.             echo '</div>';
  84.         }
  85.  
  86.         echo  $after_widget;
  87.  
  88.  
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement