WordPress.org

Plugin Directory

Changeset 1055574


Ignore:
Timestamp:
12/28/14 14:37:49 (2 years ago)
Author:
0is1
Message:

Update to version 0.2.12

Location:
twitter-account-box
Files:
7 edited
4 copied

Legend:

Unmodified
Added
Removed
  • twitter-account-box/tags/0.2.12/includes/class-create-twitter-box.php

    r988076 r1055574  
    4141      $this->plugin_slug = $plugin->get_plugin_slug(); 
    4242    } 
    43     private function process_tweet($text){ 
     43    private function process_tweet( $text ){ 
    4444      // Method to add hyperlink html tags to any urls, twitter ids or hashtags in the tweet 
    4545      $text = preg_replace_callback('@(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', 
     
    7777   */ 
    7878  public function get_tab_content() { 
    79     if (!get_transient('twitteraccountbox_transient') || null === self::$tabGetTwitterData) { 
     79    if ( ! get_transient('twitteraccountbox_transient') || null === self::$tabGetTwitterData) { 
    8080      $this->create_tab_content(); 
    8181    } 
     
    8989   */ 
    9090  public function create_tab_content() { 
    91     require_once( TAB__PLUGIN_DIR . 'includes/class-tab-get-twitter-data.php'); 
     91    require_once( TAB__PLUGIN_DIR . 'includes/class-tab-get-twitter-data.php' ); 
    9292    self::$tabGetTwitterData = TabGetTwitterData::get_instance(); 
    9393  } 
     
    9595    $data = get_transient('twitteraccountbox_transient'); 
    9696    $twitteraccountbox_data = get_option('twitteraccountbox_options'); 
    97     if (self::$tabGetTwitterData->check_error()): 
     97    if ( self::$tabGetTwitterData->check_error() ): 
    9898      return "<p class='twitteraccountbox-error'>". self::$tabGetTwitterData->get_error_message() . "</p>"; 
    9999 
    100     elseif (isset($data['errors'])): 
     100    elseif ( isset( $data['errors'] ) ): 
    101101      return "<p class='twitteraccountbox-error'>". $data['errors'][0]['message'] . "</p>"; 
    102102 
    103     elseif (gettype($data) !== 'NULL' && !self::$tabGetTwitterData->check_error()): 
     103    elseif ( gettype($data) !== 'NULL' && !self::$tabGetTwitterData->check_error()): 
    104104 
    105105      // Get user Twitter profile image 
    106       isset($data[0]["user"]["profile_image_url"]) ? self::$twitter_data['twitter_user_image'] = $data[0]["user"]["profile_image_url"] : self::$twitter_data['twitter_user_image'] = TAB__PLUGIN_URL . 'public/images/empty_image.png'; 
    107  
    108       isset($data[0]["user"]["profile_banner_url"]) ? self::$twitter_data['twitter_profile_banner_url'] = $data[0]["user"]["profile_banner_url"] . '/web' : self::$twitter_data['twitter_profile_banner_url'] = TAB__PLUGIN_URL . 'public/images/empty_header.png'; 
    109  
    110       isset($data[0]["user"]["name"]) ? self::$twitter_data['twitter_user_real_name'] = $data[0]["user"]["name"] : self::$twitter_data['twitter_user_real_name'] = self::$tabGetTwitterData->get_twitter_username(); 
    111  
    112       isset($data[0]["user"]["location"]) ? self::$twitter_data['twitter_user_location'] = $data[0]["user"]["location"] : self::$twitter_data['twitter_user_location'] = ""; 
    113  
    114       isset($data[0]["user"]["description"]) ? self::$twitter_data['twitter_user_description'] = $data[0]["user"]["description"] : self::$twitter_data['twitter_user_description'] = ""; 
    115  
    116       if(isset($data[0]["user"]["entities"]["url"]["urls"][0]["expanded_url"])) { 
     106      isset( $data[0]["user"]["profile_image_url"] ) ? self::$twitter_data['twitter_user_image'] = $data[0]["user"]["profile_image_url"] : self::$twitter_data['twitter_user_image'] = TAB__PLUGIN_URL . 'public/images/empty_image.png'; 
     107 
     108      isset( $data[0]["user"]["profile_banner_url"] ) ? self::$twitter_data['twitter_profile_banner_url'] = $data[0]["user"]["profile_banner_url"] . '/web' : self::$twitter_data['twitter_profile_banner_url'] = TAB__PLUGIN_URL . 'public/images/empty_header.png'; 
     109 
     110      isset( $data[0]["user"]["name"] ) ? self::$twitter_data['twitter_user_real_name'] = $data[0]["user"]["name"] : self::$twitter_data['twitter_user_real_name'] = self::$tabGetTwitterData->get_twitter_username(); 
     111 
     112      isset( $data[0]["user"]["location"] ) ? self::$twitter_data['twitter_user_location'] = $data[0]["user"]["location"] : self::$twitter_data['twitter_user_location'] = ""; 
     113 
     114      isset( $data[0]["user"]["description"] ) ? self::$twitter_data['twitter_user_description'] = $data[0]["user"]["description"] : self::$twitter_data['twitter_user_description'] = ""; 
     115 
     116      if( isset( $data[0]["user"]["entities"]["url"]["urls"][0]["expanded_url"] ) ) { 
    117117        self::$twitter_data['twitter_user_url'] = $data[0]["user"]["entities"]["url"]["urls"][0]["expanded_url"]; 
    118       } else if (isset($data[0]["user"]["url"])){ 
     118      } else if ( isset( $data[0]["user"]["url"] ) ){ 
    119119        self::$twitter_data['twitter_user_url'] = $data[0]["user"]["url"]; 
    120120      } else self::$twitter_data['twitter_user_url'] = ""; 
    121121 
    122       isset($data[0]["user"]["followers_count"]) ? self::$twitter_data['twitter_user_followers_count'] = $data[0]["user"]["followers_count"] : self::$twitter_data['twitter_user_followers_count'] = "?"; 
    123  
    124       isset($data[0]["user"]["friends_count"]) ? self::$twitter_data['twitter_user_friends_count'] = $data[0]["user"]["friends_count"] : self::$twitter_data['twitter_user_friends_count'] = "?"; 
    125  
    126       isset($data[0]["user"]["statuses_count"]) ? self::$twitter_data['twitter_user_statuses_count'] = $data[0]["user"]["statuses_count"] : self::$twitter_data['twitter_user_statuses_count'] = "?"; 
    127  
    128       isset($data[0]["user"]["screen_name"]) ? self::$twitter_data['twitter_user_nick'] = $data[0]["user"]["screen_name"] : self::$twitter_data['twitter_user_nick'] = self::$tabGetTwitterData->get_twitter_username(); 
     122      isset( $data[0]["user"]["followers_count"] ) ? self::$twitter_data['twitter_user_followers_count'] = $data[0]["user"]["followers_count"] : self::$twitter_data['twitter_user_followers_count'] = "?"; 
     123 
     124      isset( $data[0]["user"]["friends_count"] ) ? self::$twitter_data['twitter_user_friends_count'] = $data[0]["user"]["friends_count"] : self::$twitter_data['twitter_user_friends_count'] = "?"; 
     125 
     126      isset( $data[0]["user"]["statuses_count"] ) ? self::$twitter_data['twitter_user_statuses_count'] = $data[0]["user"]["statuses_count"] : self::$twitter_data['twitter_user_statuses_count'] = "?"; 
     127 
     128      isset( $data[0]["user"]["screen_name"] ) ? self::$twitter_data['twitter_user_nick'] = $data[0]["user"]["screen_name"] : self::$twitter_data['twitter_user_nick'] = self::$tabGetTwitterData->get_twitter_username(); 
    129129 
    130130      self::$twitter_data['twitter_user_profile_link'] = TAB__TWITTER_BASE_URL . self::$twitter_data['twitter_user_nick']; ?> 
    131       <section class="in-twitter header"> 
    132         <figure class="twitter-logo"> 
    133           <i class="tab-icon-twitter"></i> 
    134         </figure> 
    135         <p><?php echo self::$twitter_data['twitter_user_real_name'];?><?php _e(' – on Twitter', $this->plugin_slug); ?></p> 
    136       </section> 
    137       <section class="twitter-user-details" style="background-image: url(<?php echo self::$twitter_data['twitter_profile_banner_url'];?>);"> 
    138         <figure class="twitteraccountbox-img clearfix"> 
    139         <img src="<?php echo self::$twitter_data['twitter_user_image'];?>" alt="<?php echo self::$twitter_data['twitter_user_real_name'];?>" title="<?php echo self::$twitter_data['twitter_user_real_name'];?>"> 
    140         </figure> 
    141         <h1><?php echo self::$twitter_data['twitter_user_real_name']; ?></h1> 
    142         <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="<?php echo self::$twitter_data['twitter_user_nick'];?>@Twitter">@<?php echo self::$twitter_data['twitter_user_nick'];?> 
    143         </a> 
    144         <p class="twitter-user-description"><?php echo self::$twitter_data['twitter_user_description'];?></p> 
    145         <p class="twitter-user-location"><?php echo self::$twitter_data['twitter_user_location'];?> – <a href="<?php echo self::$twitter_data['twitter_user_url'];?>" title="<?php echo self::$twitter_data['twitter_user_url'];?>"><?php echo self::$twitter_data['twitter_user_url']; ?></a></p> 
    146       </section> 
    147       <section class="twitteraccountbox-details"> 
    148         <ul> 
    149           <li> 
    150             <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Tweets',$this->plugin_slug);?>"> 
    151               <strong><?php echo self::$twitter_data['twitter_user_statuses_count'];?></strong><span><?php _e('Tweets', $this->plugin_slug); ?></span> 
    152             </a> 
    153           </li> 
    154           <li> 
    155             <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/following" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Following',$this->plugin_slug);?>"> 
    156               <strong><?php echo self::$twitter_data['twitter_user_friends_count'];?></strong><span><?php _e('Following', $this->plugin_slug); ?></span> 
    157             </a> 
    158           </li> 
    159           <li> 
    160             <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/followers" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Followers',$this->plugin_slug);?>"> 
    161               <strong><?php echo self::$twitter_data['twitter_user_followers_count'];?></strong><span><?php _e('Followers', $this->plugin_slug); ?></span> 
    162             </a> 
    163           </li> 
    164         </ul> 
    165         <span class="follow-button"> 
    166           <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>" class="twitter-follow-button" data-show-count="false" data-lang="<?php echo TAB__SITE_LOCALE;?>" data-size="large" data-show-screen-name="false"><?php _e('Follow @', $this->plugin_slug); ?><?php echo self::$twitter_data['twitter_user_nick'];?></a> 
    167         </span> 
    168       </section> 
    169       <?php 
    170         // Add tweets if the option is enabled 
    171         if($twitteraccountbox_data['twitter_enable_tweets']): 
    172       ?> 
    173         <section class="twitteraccountbox-tweets"> 
    174           <?php 
    175             foreach ($data as $key => $value) { ?> 
    176               <?php 
    177               // Retweet 
    178               if($value['retweeted']): ?> 
     131      <div id="twitteraccountbox"> 
     132        <section class="in-twitter header"> 
     133          <figure class="twitter-logo"> 
     134            <i class="tab-icon-twitter"></i> 
     135          </figure> 
     136          <p><?php echo self::$twitter_data['twitter_user_real_name'];?><?php _e(' – on Twitter', $this->plugin_slug); ?></p> 
     137        </section> 
     138        <section class="twitter-user-details" style="background-image: url(<?php echo self::$twitter_data['twitter_profile_banner_url'];?>);"> 
     139          <figure class="twitteraccountbox-img clearfix"> 
     140          <img src="<?php echo self::$twitter_data['twitter_user_image'];?>" alt="<?php echo self::$twitter_data['twitter_user_real_name'];?>" title="<?php echo self::$twitter_data['twitter_user_real_name'];?>"> 
     141          </figure> 
     142          <h1><?php echo self::$twitter_data['twitter_user_real_name']; ?></h1> 
     143          <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="<?php echo self::$twitter_data['twitter_user_nick'];?>@Twitter">@<?php echo self::$twitter_data['twitter_user_nick'];?> 
     144          </a> 
     145          <p class="twitter-user-description"><?php echo self::$twitter_data['twitter_user_description'];?></p> 
     146          <p class="twitter-user-location"><?php echo self::$twitter_data['twitter_user_location'];?> – <a href="<?php echo self::$twitter_data['twitter_user_url'];?>" title="<?php echo self::$twitter_data['twitter_user_url'];?>"><?php echo self::$twitter_data['twitter_user_url']; ?></a></p> 
     147        </section> 
     148        <section class="twitteraccountbox-details"> 
     149          <ul> 
     150            <li> 
     151              <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Tweets',$this->plugin_slug);?>"> 
     152                <strong><?php echo self::$twitter_data['twitter_user_statuses_count'];?></strong><span><?php _e('Tweets', $this->plugin_slug); ?></span> 
     153              </a> 
     154            </li> 
     155            <li> 
     156              <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/following" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Following',$this->plugin_slug);?>"> 
     157                <strong><?php echo self::$twitter_data['twitter_user_friends_count'];?></strong><span><?php _e('Following', $this->plugin_slug); ?></span> 
     158              </a> 
     159            </li> 
     160            <li> 
     161              <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/followers" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Followers',$this->plugin_slug);?>"> 
     162                <strong><?php echo self::$twitter_data['twitter_user_followers_count'];?></strong><span><?php _e('Followers', $this->plugin_slug); ?></span> 
     163              </a> 
     164            </li> 
     165          </ul> 
     166          <span class="follow-button"> 
     167            <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>" class="twitter-follow-button" data-show-count="false" data-lang="<?php echo TAB__SITE_LOCALE;?>" data-size="large" data-show-screen-name="false"><?php _e('Follow @', $this->plugin_slug); ?><?php echo self::$twitter_data['twitter_user_nick'];?></a> 
     168          </span> 
     169        </section> 
     170        <?php 
     171          // Add tweets if the option is enabled 
     172          if($twitteraccountbox_data['twitter_enable_tweets']): 
     173        ?> 
     174          <section class="twitteraccountbox-tweets"> 
     175            <?php 
     176              foreach ($data as $key => $value) { ?> 
     177                <?php 
     178                // Retweet 
     179                if($value['retweeted']): ?> 
     180                  <div class="twitteraccountbox-tweet"> 
     181                    <span class="twitteraccountbox-tweet-by retweet"> 
     182                      <i class="tab-icon-retweet"></i> 
     183                      <?php _e('Retweeded by', $this->plugin_slug);?> 
     184                      <?php echo self::$twitter_data['twitter_user_real_name'];?> 
     185                    </span> 
     186                      <figure class="twitteraccountbox-img"> 
     187                        <img src="<?php echo $value['retweeted_status']['user']['profile_image_url']?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>" alt="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     188                      </figure> 
     189                    <span class="twitteraccountbox-tweet-retweet-by"> 
     190                      <a href="<?php echo TAB__TWITTER_BASE_URL . $value['retweeted_status']['user']['screen_name'];?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     191                        <span class="twitteraccountbox-tweet-username"><?php echo $value['retweeted_status']['user']['name'];?></span> 
     192                        <span>@<?php echo $value['retweeted_status']['user']['screen_name'];?></span> 
     193                      </a> 
     194                      <?php 
     195                      $datetime = new DateTime($value['retweeted_status']['created_at']); 
     196                      $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
     197                      ?> 
     198                      <span><?php echo $datetime->format('d.m.Y');?></span> 
     199                    </span> 
     200                      <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['retweeted_status']['text']);?></p> 
     201                    <?php 
     202                      if( isset( $value['retweeted_status']['entities']['media'] ) ) : 
     203                      // Add now only first image from media 
     204                     ?> 
     205                      <figure> 
     206                        <a href="<?php echo $value['retweeted_status']['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['retweeted_status']['text'];?>"> 
     207                          <img src="<?php echo $value['retweeted_status']['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     208                        </a> 
     209                      </figure> 
     210                    <?php endif; //if($value['retweeted_status']['entities']['media'] ) ?> 
     211                  </div> 
     212                  <?php 
     213                // Normal tweet 
     214                else : 
     215                ?> 
    179216                <div class="twitteraccountbox-tweet"> 
    180                   <span class="twitteraccountbox-tweet-by retweet"> 
    181                     <i class="tab-icon-retweet"></i> 
    182                     <?php _e('Retweeded by', $this->plugin_slug);?> 
    183                     <?php echo self::$twitter_data['twitter_user_real_name'];?> 
    184                   </span> 
    185                     <figure class="twitteraccountbox-img"> 
    186                       <img src="<?php echo $value['retweeted_status']['user']['profile_image_url']?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>" alt="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
    187                     </figure> 
    188                   <span class="twitteraccountbox-tweet-retweet-by"> 
    189                     <a href="<?php echo TAB__TWITTER_BASE_URL . $value['retweeted_status']['user']['screen_name'];?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
    190                       <span class="twitteraccountbox-tweet-username"><?php echo $value['retweeted_status']['user']['name'];?></span> 
    191                       <span>@<?php echo $value['retweeted_status']['user']['screen_name'];?></span> 
     217                  <figure class="twitteraccountbox-img"> 
     218                  <img src="<?php echo $value['user']['profile_image_url'];?>" alt="@<?php echo self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
     219                  </figure> 
     220                  <span class="twitteraccountbox-tweet-by"> 
     221                    <a href="<?php echo TAB__TWITTER_BASE_URL . self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
     222                      <span class="twitteraccountbox-tweet-username"><?php echo self::$twitter_data['twitter_user_real_name'];?></span> 
     223                      <span>@<?php echo self::$twitter_data['twitter_user_nick'];?></span> 
    192224                    </a> 
    193225                    <?php 
    194                     $datetime = new DateTime($value['retweeted_status']['created_at']); 
    195                     $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
    196                     ?> 
     226                      $datetime = new DateTime($value['created_at']); 
     227                      $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
     228                     ?> 
    197229                    <span><?php echo $datetime->format('d.m.Y');?></span> 
    198230                  </span> 
    199                     <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['retweeted_status']['text']);?></p> 
     231                  <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['text']);?></p> 
    200232                  <?php 
    201                     if(isset($value['retweeted_status']['entities']['media'])) : 
     233                    if( isset( $value['entities']['media'] ) ) : 
    202234                    // Add now only first image from media 
    203235                   ?> 
    204236                    <figure> 
    205                       <a href="<?php echo $value['retweeted_status']['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['retweeted_status']['text'];?>"> 
    206                         <img src="<?php echo $value['retweeted_status']['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     237                      <a href="<?php echo $value['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['text'];?>"> 
     238                        <img src="<?php echo $value['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    207239                      </a> 
    208240                    </figure> 
    209                   <?php endif; //if($value['retweeted_status']['entities']['media']) ?> 
     241                  <?php endif; //if($value['retweeted_status']['entities']['media'] ) ?> 
    210242                </div> 
    211                 <?php 
    212               // Normal tweet 
    213               else : 
     243              <?php endif; //if($value['retweeted'] ) ?> 
     244              <?php 
     245              } 
    214246              ?> 
    215               <div class="twitteraccountbox-tweet"> 
    216                 <figure class="twitteraccountbox-img"> 
    217                 <img src="<?php echo $value['user']['profile_image_url'];?>" alt="@<?php echo self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    218                 </figure> 
    219                 <span class="twitteraccountbox-tweet-by"> 
    220                   <a href="<?php echo TAB__TWITTER_BASE_URL . self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    221                     <span class="twitteraccountbox-tweet-username"><?php echo self::$twitter_data['twitter_user_real_name'];?></span> 
    222                     <span>@<?php echo self::$twitter_data['twitter_user_nick'];?></span> 
    223                   </a> 
    224                   <?php 
    225                     $datetime = new DateTime($value['created_at']); 
    226                     $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
    227                    ?> 
    228                   <span><?php echo $datetime->format('d.m.Y');?></span> 
    229                 </span> 
    230                 <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['text']);?></p> 
    231                 <?php 
    232                   if(isset($value['entities']['media'])) : 
    233                   // Add now only first image from media 
    234                  ?> 
    235                   <figure> 
    236                     <a href="<?php echo $value['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['text'];?>"> 
    237                       <img src="<?php echo $value['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    238                     </a> 
    239                   </figure> 
    240                 <?php endif; //if($value['retweeted_status']['entities']['media']) ?> 
    241               </div> 
    242             <?php endif; //if($value['retweeted']) ?> 
    243             <?php 
    244             } 
    245             ?> 
    246         </section> 
     247          </section> 
     248        </div> 
    247249        <?php endif; //if($twitteraccountbox_data['twitter_enable_tweets'])?> 
    248250    <?php else : // If Twitter data isn't available ?> 
  • twitter-account-box/tags/0.2.12/public/class-twitter-account-box-widget.php

    r931609 r1055574  
    1818        array( 'description' => __( 'Display your Twitter Account Box' , 'twitteraccountbox') ) 
    1919      ); 
     20 
    2021      $plugin = TwitterAccountBox::get_instance(); 
     22 
    2123      $this->plugin_slug = $plugin->get_plugin_slug(); 
    2224 
    2325      $createTwitterAccountBox = CreateTwitterAccountBox::get_instance(); 
     26 
    2427      $this->createTwitterAccountBox = $createTwitterAccountBox; 
    2528 
     29      add_shortcode( 'twitter_account_box', array( $this, 'get_tab_contents' ) ); 
    2630    } 
    2731 
     
    7175      } 
    7276  ?> 
    73     <div id="twitteraccountbox"> 
    7477    <?php 
    7578      echo $this->createTwitterAccountBox->get_tab_content(); 
    7679    ?> 
    77     </div> 
    7880  <?php 
    7981      echo $args['after_widget']; 
    8082    } 
     83 
     84  /** 
     85   * Return TAB content for shortcode. 
     86   * @since     0.2.12 
     87   * @return    string    TAB html content. 
     88   */ 
     89    function get_tab_contents( ) { 
     90      return $this->createTwitterAccountBox->get_tab_content(); 
     91 
     92    } 
     93 
    8194  } 
     95 
    8296} 
    8397 
  • twitter-account-box/tags/0.2.12/readme.txt

    r1044568 r1055574  
    55Requires at least: 3.9.0 
    66Tested up to: 4.1 
    7 Stable tag: 0.2.11 
     7Stable tag: 0.2.12 
    88License: GPLv2 or later 
    99 
     
    2727  * Maybe [GET friendships/exists](https://dev.twitter.com/docs/api/1/get/friendships/exists) 
    2828* Style Tweet button and load Twitter images locally if user is using any "anti social media"-plugin in browser 
    29 * Enable shortcodes 
    3029* Style admin panel options-page 
    3130* Make TAB more responsive 
     
    3433* Test with different WP-versions 
    3534 
     35#### Shortcode 
     36* You can use this shortcode in posts and pages: [twitter_account_box] 
     37 
    3638### Next version: 0.3.0 
    37 * Better error handling with tweet data 
     39* Better error handling with tweet data and code refactoring 
    3840 
    3941### Version: 0.4.0 
     
    7577== Changelog == 
    7678 
     79= 0.2.12 = 
     80 
     81* Add support to shortcode: [twitter_account_box] 
     82* Some small code refactoring 
     83 
    7784= 0.2.11 = 
    7885 
  • twitter-account-box/tags/0.2.12/twitter-account-box.php

    r994217 r1055574  
    2020Plugin URI:   http://tab.jannejuhani.net 
    2121Description:  This plugin adds your Twitter account details box in your Wordpress site. 
    22 Version:      0.2.11 
     22Version:      0.2.12 
    2323Author:       Janne Saarela 
    2424Author URI:   http://www.jannejuhani.net/ 
     
    4343?> 
    4444<?php 
    45   define( 'TAB__VERSION', '0.2.11' ); 
    46   define( 'TAB__MINIMUM_WP_VERSION', '3.0' ); 
     45  define( 'TAB__VERSION', '0.2.12' ); 
     46  define( 'TAB__MINIMUM_WP_VERSION', '3.9.0' ); 
    4747  define( 'TAB__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 
    4848  define( 'TAB__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 
  • twitter-account-box/trunk/includes/class-create-twitter-box.php

    r988076 r1055574  
    4141      $this->plugin_slug = $plugin->get_plugin_slug(); 
    4242    } 
    43     private function process_tweet($text){ 
     43    private function process_tweet( $text ){ 
    4444      // Method to add hyperlink html tags to any urls, twitter ids or hashtags in the tweet 
    4545      $text = preg_replace_callback('@(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', 
     
    7777   */ 
    7878  public function get_tab_content() { 
    79     if (!get_transient('twitteraccountbox_transient') || null === self::$tabGetTwitterData) { 
     79    if ( ! get_transient('twitteraccountbox_transient') || null === self::$tabGetTwitterData) { 
    8080      $this->create_tab_content(); 
    8181    } 
     
    8989   */ 
    9090  public function create_tab_content() { 
    91     require_once( TAB__PLUGIN_DIR . 'includes/class-tab-get-twitter-data.php'); 
     91    require_once( TAB__PLUGIN_DIR . 'includes/class-tab-get-twitter-data.php' ); 
    9292    self::$tabGetTwitterData = TabGetTwitterData::get_instance(); 
    9393  } 
     
    9595    $data = get_transient('twitteraccountbox_transient'); 
    9696    $twitteraccountbox_data = get_option('twitteraccountbox_options'); 
    97     if (self::$tabGetTwitterData->check_error()): 
     97    if ( self::$tabGetTwitterData->check_error() ): 
    9898      return "<p class='twitteraccountbox-error'>". self::$tabGetTwitterData->get_error_message() . "</p>"; 
    9999 
    100     elseif (isset($data['errors'])): 
     100    elseif ( isset( $data['errors'] ) ): 
    101101      return "<p class='twitteraccountbox-error'>". $data['errors'][0]['message'] . "</p>"; 
    102102 
    103     elseif (gettype($data) !== 'NULL' && !self::$tabGetTwitterData->check_error()): 
     103    elseif ( gettype($data) !== 'NULL' && !self::$tabGetTwitterData->check_error()): 
    104104 
    105105      // Get user Twitter profile image 
    106       isset($data[0]["user"]["profile_image_url"]) ? self::$twitter_data['twitter_user_image'] = $data[0]["user"]["profile_image_url"] : self::$twitter_data['twitter_user_image'] = TAB__PLUGIN_URL . 'public/images/empty_image.png'; 
    107  
    108       isset($data[0]["user"]["profile_banner_url"]) ? self::$twitter_data['twitter_profile_banner_url'] = $data[0]["user"]["profile_banner_url"] . '/web' : self::$twitter_data['twitter_profile_banner_url'] = TAB__PLUGIN_URL . 'public/images/empty_header.png'; 
    109  
    110       isset($data[0]["user"]["name"]) ? self::$twitter_data['twitter_user_real_name'] = $data[0]["user"]["name"] : self::$twitter_data['twitter_user_real_name'] = self::$tabGetTwitterData->get_twitter_username(); 
    111  
    112       isset($data[0]["user"]["location"]) ? self::$twitter_data['twitter_user_location'] = $data[0]["user"]["location"] : self::$twitter_data['twitter_user_location'] = ""; 
    113  
    114       isset($data[0]["user"]["description"]) ? self::$twitter_data['twitter_user_description'] = $data[0]["user"]["description"] : self::$twitter_data['twitter_user_description'] = ""; 
    115  
    116       if(isset($data[0]["user"]["entities"]["url"]["urls"][0]["expanded_url"])) { 
     106      isset( $data[0]["user"]["profile_image_url"] ) ? self::$twitter_data['twitter_user_image'] = $data[0]["user"]["profile_image_url"] : self::$twitter_data['twitter_user_image'] = TAB__PLUGIN_URL . 'public/images/empty_image.png'; 
     107 
     108      isset( $data[0]["user"]["profile_banner_url"] ) ? self::$twitter_data['twitter_profile_banner_url'] = $data[0]["user"]["profile_banner_url"] . '/web' : self::$twitter_data['twitter_profile_banner_url'] = TAB__PLUGIN_URL . 'public/images/empty_header.png'; 
     109 
     110      isset( $data[0]["user"]["name"] ) ? self::$twitter_data['twitter_user_real_name'] = $data[0]["user"]["name"] : self::$twitter_data['twitter_user_real_name'] = self::$tabGetTwitterData->get_twitter_username(); 
     111 
     112      isset( $data[0]["user"]["location"] ) ? self::$twitter_data['twitter_user_location'] = $data[0]["user"]["location"] : self::$twitter_data['twitter_user_location'] = ""; 
     113 
     114      isset( $data[0]["user"]["description"] ) ? self::$twitter_data['twitter_user_description'] = $data[0]["user"]["description"] : self::$twitter_data['twitter_user_description'] = ""; 
     115 
     116      if( isset( $data[0]["user"]["entities"]["url"]["urls"][0]["expanded_url"] ) ) { 
    117117        self::$twitter_data['twitter_user_url'] = $data[0]["user"]["entities"]["url"]["urls"][0]["expanded_url"]; 
    118       } else if (isset($data[0]["user"]["url"])){ 
     118      } else if ( isset( $data[0]["user"]["url"] ) ){ 
    119119        self::$twitter_data['twitter_user_url'] = $data[0]["user"]["url"]; 
    120120      } else self::$twitter_data['twitter_user_url'] = ""; 
    121121 
    122       isset($data[0]["user"]["followers_count"]) ? self::$twitter_data['twitter_user_followers_count'] = $data[0]["user"]["followers_count"] : self::$twitter_data['twitter_user_followers_count'] = "?"; 
    123  
    124       isset($data[0]["user"]["friends_count"]) ? self::$twitter_data['twitter_user_friends_count'] = $data[0]["user"]["friends_count"] : self::$twitter_data['twitter_user_friends_count'] = "?"; 
    125  
    126       isset($data[0]["user"]["statuses_count"]) ? self::$twitter_data['twitter_user_statuses_count'] = $data[0]["user"]["statuses_count"] : self::$twitter_data['twitter_user_statuses_count'] = "?"; 
    127  
    128       isset($data[0]["user"]["screen_name"]) ? self::$twitter_data['twitter_user_nick'] = $data[0]["user"]["screen_name"] : self::$twitter_data['twitter_user_nick'] = self::$tabGetTwitterData->get_twitter_username(); 
     122      isset( $data[0]["user"]["followers_count"] ) ? self::$twitter_data['twitter_user_followers_count'] = $data[0]["user"]["followers_count"] : self::$twitter_data['twitter_user_followers_count'] = "?"; 
     123 
     124      isset( $data[0]["user"]["friends_count"] ) ? self::$twitter_data['twitter_user_friends_count'] = $data[0]["user"]["friends_count"] : self::$twitter_data['twitter_user_friends_count'] = "?"; 
     125 
     126      isset( $data[0]["user"]["statuses_count"] ) ? self::$twitter_data['twitter_user_statuses_count'] = $data[0]["user"]["statuses_count"] : self::$twitter_data['twitter_user_statuses_count'] = "?"; 
     127 
     128      isset( $data[0]["user"]["screen_name"] ) ? self::$twitter_data['twitter_user_nick'] = $data[0]["user"]["screen_name"] : self::$twitter_data['twitter_user_nick'] = self::$tabGetTwitterData->get_twitter_username(); 
    129129 
    130130      self::$twitter_data['twitter_user_profile_link'] = TAB__TWITTER_BASE_URL . self::$twitter_data['twitter_user_nick']; ?> 
    131       <section class="in-twitter header"> 
    132         <figure class="twitter-logo"> 
    133           <i class="tab-icon-twitter"></i> 
    134         </figure> 
    135         <p><?php echo self::$twitter_data['twitter_user_real_name'];?><?php _e(' – on Twitter', $this->plugin_slug); ?></p> 
    136       </section> 
    137       <section class="twitter-user-details" style="background-image: url(<?php echo self::$twitter_data['twitter_profile_banner_url'];?>);"> 
    138         <figure class="twitteraccountbox-img clearfix"> 
    139         <img src="<?php echo self::$twitter_data['twitter_user_image'];?>" alt="<?php echo self::$twitter_data['twitter_user_real_name'];?>" title="<?php echo self::$twitter_data['twitter_user_real_name'];?>"> 
    140         </figure> 
    141         <h1><?php echo self::$twitter_data['twitter_user_real_name']; ?></h1> 
    142         <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="<?php echo self::$twitter_data['twitter_user_nick'];?>@Twitter">@<?php echo self::$twitter_data['twitter_user_nick'];?> 
    143         </a> 
    144         <p class="twitter-user-description"><?php echo self::$twitter_data['twitter_user_description'];?></p> 
    145         <p class="twitter-user-location"><?php echo self::$twitter_data['twitter_user_location'];?> – <a href="<?php echo self::$twitter_data['twitter_user_url'];?>" title="<?php echo self::$twitter_data['twitter_user_url'];?>"><?php echo self::$twitter_data['twitter_user_url']; ?></a></p> 
    146       </section> 
    147       <section class="twitteraccountbox-details"> 
    148         <ul> 
    149           <li> 
    150             <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Tweets',$this->plugin_slug);?>"> 
    151               <strong><?php echo self::$twitter_data['twitter_user_statuses_count'];?></strong><span><?php _e('Tweets', $this->plugin_slug); ?></span> 
    152             </a> 
    153           </li> 
    154           <li> 
    155             <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/following" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Following',$this->plugin_slug);?>"> 
    156               <strong><?php echo self::$twitter_data['twitter_user_friends_count'];?></strong><span><?php _e('Following', $this->plugin_slug); ?></span> 
    157             </a> 
    158           </li> 
    159           <li> 
    160             <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/followers" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Followers',$this->plugin_slug);?>"> 
    161               <strong><?php echo self::$twitter_data['twitter_user_followers_count'];?></strong><span><?php _e('Followers', $this->plugin_slug); ?></span> 
    162             </a> 
    163           </li> 
    164         </ul> 
    165         <span class="follow-button"> 
    166           <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>" class="twitter-follow-button" data-show-count="false" data-lang="<?php echo TAB__SITE_LOCALE;?>" data-size="large" data-show-screen-name="false"><?php _e('Follow @', $this->plugin_slug); ?><?php echo self::$twitter_data['twitter_user_nick'];?></a> 
    167         </span> 
    168       </section> 
    169       <?php 
    170         // Add tweets if the option is enabled 
    171         if($twitteraccountbox_data['twitter_enable_tweets']): 
    172       ?> 
    173         <section class="twitteraccountbox-tweets"> 
    174           <?php 
    175             foreach ($data as $key => $value) { ?> 
    176               <?php 
    177               // Retweet 
    178               if($value['retweeted']): ?> 
     131      <div id="twitteraccountbox"> 
     132        <section class="in-twitter header"> 
     133          <figure class="twitter-logo"> 
     134            <i class="tab-icon-twitter"></i> 
     135          </figure> 
     136          <p><?php echo self::$twitter_data['twitter_user_real_name'];?><?php _e(' – on Twitter', $this->plugin_slug); ?></p> 
     137        </section> 
     138        <section class="twitter-user-details" style="background-image: url(<?php echo self::$twitter_data['twitter_profile_banner_url'];?>);"> 
     139          <figure class="twitteraccountbox-img clearfix"> 
     140          <img src="<?php echo self::$twitter_data['twitter_user_image'];?>" alt="<?php echo self::$twitter_data['twitter_user_real_name'];?>" title="<?php echo self::$twitter_data['twitter_user_real_name'];?>"> 
     141          </figure> 
     142          <h1><?php echo self::$twitter_data['twitter_user_real_name']; ?></h1> 
     143          <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="<?php echo self::$twitter_data['twitter_user_nick'];?>@Twitter">@<?php echo self::$twitter_data['twitter_user_nick'];?> 
     144          </a> 
     145          <p class="twitter-user-description"><?php echo self::$twitter_data['twitter_user_description'];?></p> 
     146          <p class="twitter-user-location"><?php echo self::$twitter_data['twitter_user_location'];?> – <a href="<?php echo self::$twitter_data['twitter_user_url'];?>" title="<?php echo self::$twitter_data['twitter_user_url'];?>"><?php echo self::$twitter_data['twitter_user_url']; ?></a></p> 
     147        </section> 
     148        <section class="twitteraccountbox-details"> 
     149          <ul> 
     150            <li> 
     151              <a href="<?php echo self::$twitter_data['twitter_user_profile_link']; ?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Tweets',$this->plugin_slug);?>"> 
     152                <strong><?php echo self::$twitter_data['twitter_user_statuses_count'];?></strong><span><?php _e('Tweets', $this->plugin_slug); ?></span> 
     153              </a> 
     154            </li> 
     155            <li> 
     156              <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/following" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Following',$this->plugin_slug);?>"> 
     157                <strong><?php echo self::$twitter_data['twitter_user_friends_count'];?></strong><span><?php _e('Following', $this->plugin_slug); ?></span> 
     158              </a> 
     159            </li> 
     160            <li> 
     161              <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>/followers" title="@<?php echo self::$twitter_data['twitter_user_nick'];?><?php _e('– Followers',$this->plugin_slug);?>"> 
     162                <strong><?php echo self::$twitter_data['twitter_user_followers_count'];?></strong><span><?php _e('Followers', $this->plugin_slug); ?></span> 
     163              </a> 
     164            </li> 
     165          </ul> 
     166          <span class="follow-button"> 
     167            <a href="<?php echo self::$twitter_data['twitter_user_profile_link'];?>" class="twitter-follow-button" data-show-count="false" data-lang="<?php echo TAB__SITE_LOCALE;?>" data-size="large" data-show-screen-name="false"><?php _e('Follow @', $this->plugin_slug); ?><?php echo self::$twitter_data['twitter_user_nick'];?></a> 
     168          </span> 
     169        </section> 
     170        <?php 
     171          // Add tweets if the option is enabled 
     172          if($twitteraccountbox_data['twitter_enable_tweets']): 
     173        ?> 
     174          <section class="twitteraccountbox-tweets"> 
     175            <?php 
     176              foreach ($data as $key => $value) { ?> 
     177                <?php 
     178                // Retweet 
     179                if($value['retweeted']): ?> 
     180                  <div class="twitteraccountbox-tweet"> 
     181                    <span class="twitteraccountbox-tweet-by retweet"> 
     182                      <i class="tab-icon-retweet"></i> 
     183                      <?php _e('Retweeded by', $this->plugin_slug);?> 
     184                      <?php echo self::$twitter_data['twitter_user_real_name'];?> 
     185                    </span> 
     186                      <figure class="twitteraccountbox-img"> 
     187                        <img src="<?php echo $value['retweeted_status']['user']['profile_image_url']?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>" alt="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     188                      </figure> 
     189                    <span class="twitteraccountbox-tweet-retweet-by"> 
     190                      <a href="<?php echo TAB__TWITTER_BASE_URL . $value['retweeted_status']['user']['screen_name'];?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     191                        <span class="twitteraccountbox-tweet-username"><?php echo $value['retweeted_status']['user']['name'];?></span> 
     192                        <span>@<?php echo $value['retweeted_status']['user']['screen_name'];?></span> 
     193                      </a> 
     194                      <?php 
     195                      $datetime = new DateTime($value['retweeted_status']['created_at']); 
     196                      $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
     197                      ?> 
     198                      <span><?php echo $datetime->format('d.m.Y');?></span> 
     199                    </span> 
     200                      <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['retweeted_status']['text']);?></p> 
     201                    <?php 
     202                      if( isset( $value['retweeted_status']['entities']['media'] ) ) : 
     203                      // Add now only first image from media 
     204                     ?> 
     205                      <figure> 
     206                        <a href="<?php echo $value['retweeted_status']['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['retweeted_status']['text'];?>"> 
     207                          <img src="<?php echo $value['retweeted_status']['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     208                        </a> 
     209                      </figure> 
     210                    <?php endif; //if($value['retweeted_status']['entities']['media'] ) ?> 
     211                  </div> 
     212                  <?php 
     213                // Normal tweet 
     214                else : 
     215                ?> 
    179216                <div class="twitteraccountbox-tweet"> 
    180                   <span class="twitteraccountbox-tweet-by retweet"> 
    181                     <i class="tab-icon-retweet"></i> 
    182                     <?php _e('Retweeded by', $this->plugin_slug);?> 
    183                     <?php echo self::$twitter_data['twitter_user_real_name'];?> 
    184                   </span> 
    185                     <figure class="twitteraccountbox-img"> 
    186                       <img src="<?php echo $value['retweeted_status']['user']['profile_image_url']?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>" alt="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
    187                     </figure> 
    188                   <span class="twitteraccountbox-tweet-retweet-by"> 
    189                     <a href="<?php echo TAB__TWITTER_BASE_URL . $value['retweeted_status']['user']['screen_name'];?>" title="@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
    190                       <span class="twitteraccountbox-tweet-username"><?php echo $value['retweeted_status']['user']['name'];?></span> 
    191                       <span>@<?php echo $value['retweeted_status']['user']['screen_name'];?></span> 
     217                  <figure class="twitteraccountbox-img"> 
     218                  <img src="<?php echo $value['user']['profile_image_url'];?>" alt="@<?php echo self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
     219                  </figure> 
     220                  <span class="twitteraccountbox-tweet-by"> 
     221                    <a href="<?php echo TAB__TWITTER_BASE_URL . self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
     222                      <span class="twitteraccountbox-tweet-username"><?php echo self::$twitter_data['twitter_user_real_name'];?></span> 
     223                      <span>@<?php echo self::$twitter_data['twitter_user_nick'];?></span> 
    192224                    </a> 
    193225                    <?php 
    194                     $datetime = new DateTime($value['retweeted_status']['created_at']); 
    195                     $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
    196                     ?> 
     226                      $datetime = new DateTime($value['created_at']); 
     227                      $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
     228                     ?> 
    197229                    <span><?php echo $datetime->format('d.m.Y');?></span> 
    198230                  </span> 
    199                     <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['retweeted_status']['text']);?></p> 
     231                  <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['text']);?></p> 
    200232                  <?php 
    201                     if(isset($value['retweeted_status']['entities']['media'])) : 
     233                    if( isset( $value['entities']['media'] ) ) : 
    202234                    // Add now only first image from media 
    203235                   ?> 
    204236                    <figure> 
    205                       <a href="<?php echo $value['retweeted_status']['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['retweeted_status']['text'];?>"> 
    206                         <img src="<?php echo $value['retweeted_status']['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo $value['retweeted_status']['user']['screen_name'];?>"> 
     237                      <a href="<?php echo $value['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['text'];?>"> 
     238                        <img src="<?php echo $value['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    207239                      </a> 
    208240                    </figure> 
    209                   <?php endif; //if($value['retweeted_status']['entities']['media']) ?> 
     241                  <?php endif; //if($value['retweeted_status']['entities']['media'] ) ?> 
    210242                </div> 
    211                 <?php 
    212               // Normal tweet 
    213               else : 
     243              <?php endif; //if($value['retweeted'] ) ?> 
     244              <?php 
     245              } 
    214246              ?> 
    215               <div class="twitteraccountbox-tweet"> 
    216                 <figure class="twitteraccountbox-img"> 
    217                 <img src="<?php echo $value['user']['profile_image_url'];?>" alt="@<?php echo self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    218                 </figure> 
    219                 <span class="twitteraccountbox-tweet-by"> 
    220                   <a href="<?php echo TAB__TWITTER_BASE_URL . self::$twitter_data['twitter_user_nick'];?>" title="@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    221                     <span class="twitteraccountbox-tweet-username"><?php echo self::$twitter_data['twitter_user_real_name'];?></span> 
    222                     <span>@<?php echo self::$twitter_data['twitter_user_nick'];?></span> 
    223                   </a> 
    224                   <?php 
    225                     $datetime = new DateTime($value['created_at']); 
    226                     $datetime->setTimezone(new DateTimeZone('Europe/Helsinki')); 
    227                    ?> 
    228                   <span><?php echo $datetime->format('d.m.Y');?></span> 
    229                 </span> 
    230                 <p class="twitteraccountbox-tweet-text"><?php echo self::process_tweet($value['text']);?></p> 
    231                 <?php 
    232                   if(isset($value['entities']['media'])) : 
    233                   // Add now only first image from media 
    234                  ?> 
    235                   <figure> 
    236                     <a href="<?php echo $value['entities']['media'][0]['expanded_url']?>" title="<?php echo $value['text'];?>"> 
    237                       <img src="<?php echo $value['entities']['media'][0]['media_url']?>" alt="<?php _e('Image by ', $this->plugin_slug);?>@<?php echo self::$twitter_data['twitter_user_nick'];?>"> 
    238                     </a> 
    239                   </figure> 
    240                 <?php endif; //if($value['retweeted_status']['entities']['media']) ?> 
    241               </div> 
    242             <?php endif; //if($value['retweeted']) ?> 
    243             <?php 
    244             } 
    245             ?> 
    246         </section> 
     247          </section> 
     248        </div> 
    247249        <?php endif; //if($twitteraccountbox_data['twitter_enable_tweets'])?> 
    248250    <?php else : // If Twitter data isn't available ?> 
  • twitter-account-box/trunk/public/class-twitter-account-box-widget.php

    r931609 r1055574  
    1818        array( 'description' => __( 'Display your Twitter Account Box' , 'twitteraccountbox') ) 
    1919      ); 
     20 
    2021      $plugin = TwitterAccountBox::get_instance(); 
     22 
    2123      $this->plugin_slug = $plugin->get_plugin_slug(); 
    2224 
    2325      $createTwitterAccountBox = CreateTwitterAccountBox::get_instance(); 
     26 
    2427      $this->createTwitterAccountBox = $createTwitterAccountBox; 
    2528 
     29      add_shortcode( 'twitter_account_box', array( $this, 'get_tab_contents' ) ); 
    2630    } 
    2731 
     
    7175      } 
    7276  ?> 
    73     <div id="twitteraccountbox"> 
    7477    <?php 
    7578      echo $this->createTwitterAccountBox->get_tab_content(); 
    7679    ?> 
    77     </div> 
    7880  <?php 
    7981      echo $args['after_widget']; 
    8082    } 
     83 
     84  /** 
     85   * Return TAB content for shortcode. 
     86   * @since     0.2.12 
     87   * @return    string    TAB html content. 
     88   */ 
     89    function get_tab_contents( ) { 
     90      return $this->createTwitterAccountBox->get_tab_content(); 
     91 
     92    } 
     93 
    8194  } 
     95 
    8296} 
    8397 
  • twitter-account-box/trunk/readme.txt

    r1044568 r1055574  
    55Requires at least: 3.9.0 
    66Tested up to: 4.1 
    7 Stable tag: 0.2.11 
     7Stable tag: 0.2.12 
    88License: GPLv2 or later 
    99 
     
    2727  * Maybe [GET friendships/exists](https://dev.twitter.com/docs/api/1/get/friendships/exists) 
    2828* Style Tweet button and load Twitter images locally if user is using any "anti social media"-plugin in browser 
    29 * Enable shortcodes 
    3029* Style admin panel options-page 
    3130* Make TAB more responsive 
     
    3433* Test with different WP-versions 
    3534 
     35#### Shortcode 
     36* You can use this shortcode in posts and pages: [twitter_account_box] 
     37 
    3638### Next version: 0.3.0 
    37 * Better error handling with tweet data 
     39* Better error handling with tweet data and code refactoring 
    3840 
    3941### Version: 0.4.0 
     
    7577== Changelog == 
    7678 
     79= 0.2.12 = 
     80 
     81* Add support to shortcode: [twitter_account_box] 
     82* Some small code refactoring 
     83 
    7784= 0.2.11 = 
    7885 
  • twitter-account-box/trunk/twitter-account-box.php

    r994217 r1055574  
    2020Plugin URI:   http://tab.jannejuhani.net 
    2121Description:  This plugin adds your Twitter account details box in your Wordpress site. 
    22 Version:      0.2.11 
     22Version:      0.2.12 
    2323Author:       Janne Saarela 
    2424Author URI:   http://www.jannejuhani.net/ 
     
    4343?> 
    4444<?php 
    45   define( 'TAB__VERSION', '0.2.11' ); 
    46   define( 'TAB__MINIMUM_WP_VERSION', '3.0' ); 
     45  define( 'TAB__VERSION', '0.2.12' ); 
     46  define( 'TAB__MINIMUM_WP_VERSION', '3.9.0' ); 
    4747  define( 'TAB__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 
    4848  define( 'TAB__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 
Note: See TracChangeset for help on using the changeset viewer.