function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        echo $before_widget;
        //Our variables from the widget settings.
        $PI_title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $PI_name = $instance['name'];
        $PI_numTweets = $instance['numTweets'];
        $PI_cacheTime = $instance['cacheTime'];
        //Setup Twitter API OAuth tokens
        $PI_consumerKey = trim($instance['consumerKey']);
        $PI_consumerSecret = trim($instance['consumerSecret']);
        $PI_accessToken = trim($instance['accessToken']);
        $PI_accessTokenSecret = trim($instance['accessTokenSecret']);
        $PI_exclude_replies = isset($instance['exclude_replies']) ? $instance['exclude_replies'] : false;
        $PI_twitterFollow = isset($instance['twitterFollow']) ? $instance['twitterFollow'] : false;
        $PI_dataShowCount = isset($instance['dataShowCount']) ? $instance['dataShowCount'] : false;
        $PI_dataShowScreenName = isset($instance['dataShowScreenName']) ? $instance['dataShowScreenName'] : false;
        $PI_dataLang = $instance['dataLang'];
        // 2.0 updates
        $PI_timeRef = isset($instance['timeRef']) ? $instance['timeRef'] : false;
        $PI_timeAgo = isset($instance['timeAgo']) ? $instance['timeAgo'] : false;
        $PI_twitterIntents = isset($instance['twitterIntents']) ? $instance['twitterIntents'] : false;
        $PI_twitterIntentsText = isset($instance['twitterIntentsText']) ? $instance['twitterIntentsText'] : false;
        $PI_intentColor = $instance['intentColor'];
        // Avatar
        $PI_showAvatar = isset($instance['showAvatar']) ? $instance['showAvatar'] : false;
        $PI_roundCorners = isset($instance['roundCorners']) ? $instance['roundCorners'] : false;
        $PI_avatarSize = $instance['avatarSize'];
        if (!empty($PI_title)) {
            echo $before_title . $PI_title . $after_title;
        }
        // START WIDGET CODE HERE
        ?>

			<ul class="tweets">
			<?php 
        /*
         * Uses:
         * Twitter API call:
         *     http://dev.twitter.com/doc/get/statuses/user_timeline
         * WP transient API ref.
         *		http://www.problogdesign.com/wordpress/use-the-transients-api-to-list-the-latest-commenter/
         * Plugin Development and Script enhancement
         *    http://www.planet-interactive.co.uk
         */
        // Configuration.
        $numTweets = $PI_numTweets;
        // Num tweets to show
        $name = $PI_name;
        // Twitter UserName
        $cacheTime = $PI_cacheTime;
        // Time in minutes between updates.
        // Get from https://dev.twitter.com/
        // Login - Create New Application, fill in details and use required data below
        $consumerKey = trim($PI_consumerKey);
        // OAuth Key
        $consumerSecret = trim($PI_consumerSecret);
        // OAuth Secret
        $accessToken = trim($PI_accessToken);
        // OAuth Access Token
        $accessTokenSecret = trim($PI_accessTokenSecret);
        // OAuth Token Secret
        $exclude_replies = $PI_exclude_replies;
        // Leave out @replies?
        $twitterFollow = $PI_twitterFollow;
        // Whether to show Twitter Follow button
        $dataShowCount = $PI_dataShowCount != "true" ? "false" : "true";
        // Whether to show Twitter Follower Count
        $dataShowScreenName = $PI_dataShowScreenName != "true" ? "false" : "true";
        // Whether to show Twitter Screen Name
        $dataLang = $PI_dataLang;
        // Tell Twitter what Language is being used
        $timeRef = $PI_timeRef;
        // Time ref: hours or short h
        $timeAgo = $PI_timeAgo;
        // Human Time: ago ref or not
        $twitterIntents = $PI_twitterIntents;
        // Intent on/off
        $twitterIntentsText = $PI_twitterIntentsText;
        // Intents Text on/off
        $intentColor = $PI_intentColor;
        // Intent icons colour
        $showAvatar = $PI_showAvatar;
        $roundCorners = $PI_roundCorners;
        $avatarSize = $PI_avatarSize;
        // COMMUNITY REQUEST! (1)
        $transName = 'list-tweets-' . $name;
        // Name of value in database. [added $name for multiple account use]
        $backupName = $transName . '-backup';
        // Name of backup value in database.
        // if(false === ($tweets = unserialize( base64_decode(get_transient( $transName ) ) ) ) ) :
        if (false === ($tweets = get_transient($transName))) {
            // Get the tweets from Twitter.
            if (!class_exists('TwitterOAuth')) {
                include 'twitteroauth/twitteroauth.php';
            }
            $connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
            // If excluding replies, we need to fetch more than requested as the
            // total is fetched first, and then replies removed.
            $totalToFetch = $exclude_replies ? max(50, $numTweets * 3) : $numTweets;
            $fetchedTweets = $connection->get('statuses/user_timeline', array('screen_name' => $name, 'count' => $totalToFetch, 'exclude_replies' => $exclude_replies));
            // Did the fetch fail?
            if ($connection->http_code != 200) {
                $tweets = get_option($backupName);
                // False if there has never been data saved.
            } else {
                // Fetch succeeded.
                // Now update the array to store just what we need.
                // (Done here instead of PHP doing this for every page load)
                $limitToDisplay = min($numTweets, count($fetchedTweets));
                for ($i = 0; $i < $limitToDisplay; $i++) {
                    $tweet = $fetchedTweets[$i];
                    // Core info.
                    $name = $tweet->user->name;
                    // COMMUNITY REQUEST !!!!!! (2)
                    $screen_name = $tweet->user->screen_name;
                    $permalink = 'http://twitter.com/' . $name . '/status/' . $tweet->id_str;
                    $tweet_id = $tweet->id_str;
                    /* Alternative image sizes method: http://dev.twitter.com/doc/get/users/profile_image/:screen_name */
                    //  Check for SSL via protocol https then display relevant image - thanks SO - this should do
                    if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
                        // $protocol = 'https://';
                        $image = $tweet->user->profile_image_url_https;
                    } else {
                        // $protocol = 'http://';
                        $image = $tweet->user->profile_image_url;
                    }
                    // $image = $tweet->user->profile_image_url;
                    // Process Tweets - Use Twitter entities for correct URL, hash and mentions
                    $text = $this->process_links($tweet);
                    // lets strip 4-byte emojis
                    $text = $this->twitter_api_strip_emoji($text);
                    // Need to get time in Unix format.
                    $time = $tweet->created_at;
                    $time = date_parse($time);
                    $uTime = mktime($time['hour'], $time['minute'], $time['second'], $time['month'], $time['day'], $time['year']);
                    // Now make the new array.
                    $tweets[] = array('text' => $text, 'name' => $name, 'permalink' => $permalink, 'image' => $image, 'time' => $uTime, 'tweet_id' => $tweet_id);
                }
                set_transient($transName, $tweets, 60 * $cacheTime);
                update_option($backupName, $tweets);
            }
        }
        if (!function_exists('twitter_time_diff')) {
            function twitter_time_diff($from, $to = '')
            {
                $diff = human_time_diff($from, $to);
                $replace = array(' hour' => 'h', ' hours' => 'h', ' day' => 'd', ' days' => 'd', ' minute' => 'm', ' minutes' => 'm', ' second' => 's', ' seconds' => 's');
                return strtr($diff, $replace);
            }
        }
        // Now display the tweets, if we can.
        if ($tweets) {
            ?>
					<?php 
            foreach ((array) $tweets as $t) {
                // casting array to array just in case it's empty - then prevents PHP warning
                ?>
							<li<?php 
                echo $showAvatar ? ' class="avatar"' : "";
                echo $showAvatar && $avatarSize ? ' style="margin-left:' . ($avatarSize + 5) . 'px"' : "";
                ?>
>
								<?php 
                if ($showAvatar) {
                    echo '<img ';
                    echo $avatarSize ? ' style="margin-left:-' . ($avatarSize + 5) . 'px"' : "";
                    echo $avatarSize ? 'width="' . $avatarSize . 'px" height="' . $avatarSize . 'px"' : 'width="48px" height="48px"';
                    echo 'src="' . $t['image'] . '" alt="';
                    _e('Tweet Avatar', 'simple-twitter-tweets');
                    echo '" class="';
                    echo $roundCorners ? 'a-corn' : '';
                    echo '"/>';
                }
                ?>
								<?php 
                echo $t['text'];
                ?>
									<br/><em>
									<?php 
                if (!isset($screen_name)) {
                    $screen_name = $name;
                }
                ?>
						<a href="http://www.twitter.com/<?php 
                echo $screen_name;
                ?>
" target="_blank" title="<?php 
                printf(__('Follow %s on Twitter [Opens a new window]', 'simple-twitter-tweets'), $name);
                ?>
">
							<?php 
                // Original - long time ref: hours...
                if ($timeRef == "true") {
                    // New - short Twitter style time ref: h...
                    $timeDisplay = twitter_time_diff($t['time'], current_time('timestamp'));
                } else {
                    $timeDisplay = human_time_diff($t['time'], current_time('timestamp'));
                }
                // Ago - to show?
                if ($timeAgo == "true") {
                    $displayAgo = _x(' ago', 'leading space is required to keep gap from date', 'simple-twitter-tweets');
                } else {
                    // Added to counter 'no ago var' setting undefined variable warning
                    $displayAgo = "";
                }
                // Use to make il8n compliant
                printf(__('%1$s%2$s'), $timeDisplay, $displayAgo);
                ?>
							</a>
									</em>

						<?php 
                // INTENTS REF: DISPLAY OR NOT
                if ($twitterIntents == "true") {
                    ?>
						<div class="intent-meta">
							<a href="http://twitter.com/intent/tweet?in_reply_to=<?php 
                    echo $t['tweet_id'];
                    ?>
" data-lang="en" class="in-reply-to" title="<?php 
                    _e('Reply', 'simple-twitter-tweets');
                    ?>
" target="_blank">
								<span aria-hidden="true" data-icon="&#xf079;" <?php 
                    echo $intentColor ? 'style="color:' . $intentColor . ';"' : '';
                    ?>
></span>
								<span <?php 
                    echo $twitterIntentsText ? 'class="pi-visuallyhidden"' : '';
                    ?>
><?php 
                    _e('Reply', 'simple-twitter-tweets');
                    ?>
</span></a>
							<a href="http://twitter.com/intent/retweet?tweet_id=<?php 
                    echo $t['tweet_id'];
                    ?>
" data-lang="en" class="retweet" title="<?php 
                    _e('Retweet', 'simple-twitter-tweets');
                    ?>
" target="_blank">
								<span aria-hidden="true" data-icon="&#xf112;" <?php 
                    echo $intentColor ? 'style="color:' . $intentColor . ';"' : '';
                    ?>
></span>
								<span <?php 
                    echo $twitterIntentsText ? 'class="pi-visuallyhidden"' : '';
                    ?>
><?php 
                    _e('Retweet', 'simple-twitter-tweets');
                    ?>
</span></a>
							<a href="http://twitter.com/intent/favorite?tweet_id=<?php 
                    echo $t['tweet_id'];
                    ?>
" data-lang="en" class="favorite" title="<?php 
                    _e('Favourite', 'simple-twitter-tweets');
                    ?>
" target="_blank">
								<span aria-hidden="true" data-icon="&#xf005;" <?php 
                    echo $intentColor ? 'style="color:' . $intentColor . ';"' : '';
                    ?>
></span>
								<span <?php 
                    echo $twitterIntentsText ? 'class="pi-visuallyhidden"' : '';
                    ?>
><?php 
                    _e('Favourite', 'simple-twitter-tweets');
                    ?>
</span></a>
						</div>
						<?php 
                }
                ?>

							</li>
					<?php 
            }
            ?>

			<?php 
        } else {
            ?>
					<li><?php 
            _e('Waiting for Twitter... Once Twitter is ready they will display my Tweets again.', 'simple-twitter-tweets');
            ?>
</li>
			<?php 
        }
        ?>
			</ul>

			<?php 
        // ADD Twitter follow button - to increase engagement
        // Make it an options choice though
        if ($twitterFollow) {
            ?>
				<a href="https://twitter.com/<?php 
            echo $PI_name;
            ?>
" class="twitter-follow-button" data-show-count="<?php 
            echo $dataShowCount;
            ?>
" data-show-screen-name="<?php 
            echo $dataShowScreenName;
            ?>
" data-lang="<?php 
            echo $dataLang;
            ?>
"><?php 
            _e('Follow', 'simple-twitter-tweets');
            ?>
 @<?php 
            echo $PI_name;
            ?>
</a>
				<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
			<?php 
        }
        // END OF WIDGET CODE HERE
        echo $after_widget;
    }
示例#2
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        //	print_r($args);
        echo $before_widget;
        $this->widgetid = $args['widget_id'];
        $wpltf_wdgt_title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $wpltf_wdgt_name = $instance['name'];
        $wpltf_wdgt_consumerSecret = trim($instance['consumerSecret']);
        $wpltf_wdgt_accessTokenSecret = trim($instance['accessTokenSecret']);
        $widget_replies_excl = isset($instance['replies_excl']) ? $instance['replies_excl'] : false;
        $wpltf_wdgt_accessToken = trim($instance['accessToken']);
        $wpltf_wdgt_tweets_cnt = $instance['tweets_cnt'];
        $wpltf_wdgt_store_time = $instance['store_time'];
        $wpltf_wdgt_consumerKey = trim($instance['consumerKey']);
        //$wpltf_wdgt_dataShowCount 		= isset( $instance['dataShowCount'] ) ? $instance['dataShowCount'] : false;
        $wpltf_wdgt_disp_scr_name = isset($instance['disp_scr_name']) ? $instance['disp_scr_name'] : false;
        $wpltf_wdgt_timeRef = isset($instance['timeRef']) ? $instance['timeRef'] : false;
        $wpltf_wdgt_timeAgo = isset($instance['timeAgo']) ? $instance['timeAgo'] : false;
        $wpltf_wdgt_twitterIntents = isset($instance['twitterIntents']) ? $instance['twitterIntents'] : false;
        $wpltf_wdgt_twitterIntentsText = isset($instance['twitterIntentsText']) ? $instance['twitterIntentsText'] : false;
        $wpltf_wdgt_intentColor = $instance['intentColor'];
        $wpltf_wdgt_slide_style = isset($instance['slide_style']) ? $instance['slide_style'] : 'list';
        $wpltf_wdgt_showAvatar = isset($instance['showAvatar']) ? $instance['showAvatar'] : false;
        $wpltf_wdgt_border_rad = isset($instance['border_rad']) ? $instance['border_rad'] : false;
        $wpltf_wdgt_tewwt_border = isset($instance['tweet_border']) ? $instance['tweet_border'] : 'false';
        $wpltf_wdgt_tweet_theme = isset($instance['tweet_theme']) ? $instance['tweet_theme'] : 'light';
        if (!empty($wpltf_wdgt_title)) {
            echo $before_title . $wpltf_wdgt_title . $after_title;
        }
        if ($wpltf_wdgt_consumerKey == '' || $wpltf_wdgt_consumerSecret == '' || $wpltf_wdgt_accessTokenSecret == '' || $wpltf_wdgt_accessToken == '') {
            echo '<div class="isa_error">Bad Authentication data.<br/>Please enter valid API Keys.</div>';
        } else {
            $class = 'light';
            if (isset($wpltf_wdgt_tweet_theme) && $wpltf_wdgt_tweet_theme == 'dark') {
                $class = 'dark';
            }
            if (isset($wpltf_wdgt_tewwt_border) && $wpltf_wdgt_tewwt_border == 'true') {
                echo '<style>
				.fetched_tweets.light > li{border-color: rgb(238, 238, 238) rgb(221, 221, 221) rgb(187, 187, 187);
				border-width: 1px;
				border-style: solid;}
				.fetched_tweets.dark > li{
				border-color: #444;
				border-width: 1px;
				border-style: solid;}</style>';
            }
            ?>
			

<ul class="fetched_tweets <?php 
            echo $class;
            ?>
">
			<?php 
            $tweets_count = $wpltf_wdgt_tweets_cnt;
            $name = $wpltf_wdgt_name;
            $timeto_store = $wpltf_wdgt_store_time;
            $consumerSecret = trim($wpltf_wdgt_consumerSecret);
            $accessToken = trim($wpltf_wdgt_accessToken);
            $accessTokenSecret = trim($wpltf_wdgt_accessTokenSecret);
            $replies_excl = $widget_replies_excl;
            $consumerKey = trim($wpltf_wdgt_consumerKey);
            //$dataShowCount 		= ($wpltf_wdgt_dataShowCount != "true") ? "false" : "true";
            $disp_screen_name = $wpltf_wdgt_disp_scr_name != "true" ? "false" : "true";
            $intents_text = $wpltf_wdgt_twitterIntentsText;
            $color_intents = $wpltf_wdgt_intentColor;
            $slide_style = $wpltf_wdgt_slide_style;
            $cache_transient = $wpltf_wdgt_timeRef;
            $alter_ago_time = $wpltf_wdgt_timeAgo;
            $twitterIntents = $wpltf_wdgt_twitterIntents;
            $showAvatar = $wpltf_wdgt_showAvatar;
            $border_rad_avatar = $wpltf_wdgt_border_rad;
            $transName = 'list-tweets-' . $name;
            $backupName = $transName . '-backup';
            if (false === ($tweets = get_transient($transName))) {
                require_once 'twitteroauth/twitteroauth.php';
                $api_call = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
                $totalToFetch = $replies_excl ? max(50, $tweets_count * 3) : $tweets_count;
                $fetchedTweets = $api_call->get('statuses/user_timeline', array('screen_name' => $name, 'count' => $totalToFetch, 'replies_excl' => $replies_excl));
                if ($api_call->http_code != 200) {
                    $tweets = get_option($backupName);
                } else {
                    $limitToDisplay = min($tweets_count, count($fetchedTweets));
                    for ($i = 0; $i < $limitToDisplay; $i++) {
                        $tweet = $fetchedTweets[$i];
                        $name = $tweet->user->name;
                        $screen_name = $tweet->user->screen_name;
                        $permalink = 'http://twitter.com/' . $name . '/status/' . $tweet->id_str;
                        $tweet_id = $tweet->id_str;
                        $image = $tweet->user->profile_image_url;
                        $text = $this->sanitize_links($tweet);
                        $time = $tweet->created_at;
                        $time = date_parse($time);
                        $uTime = mktime($time['hour'], $time['minute'], $time['second'], $time['month'], $time['day'], $time['year']);
                        $tweets[] = array('text' => $text, 'scr_name' => $screen_name, 'favourite_count' => $tweet->favorite_count, 'retweet_count' => $tweet->retweet_count, 'name' => $name, 'permalink' => $permalink, 'image' => $image, 'time' => $uTime, 'tweet_id' => $tweet_id);
                    }
                    set_transient($transName, $tweets, 60 * $timeto_store);
                    update_option($backupName, $tweets);
                }
            }
            if (!function_exists('twitter_time_diff')) {
                function twitter_time_diff($from, $to = '')
                {
                    $diff = human_time_diff($from, $to);
                    $replace = array(' hour' => 'h', ' hours' => 'h', ' day' => 'd', ' days' => 'd', ' minute' => 'm', ' minutes' => 'm', ' second' => 's', ' seconds' => 's');
                    return strtr($diff, $replace);
                }
            }
            if ($tweets) {
                ?>
			    <?php 
                foreach ($tweets as $t) {
                    ?>
			        <li class="tweets_avatar">
			        	<?php 
                    echo '<div class="tweet_wrap"><div class="wdtf-user-card ltr">';
                    if ($showAvatar) {
                        echo '<img ';
                        echo 'width="45px" height="45px"';
                        echo 'src="' . $t['image'] . '" alt="Tweet Avatar" class="';
                        echo $border_rad_avatar ? 'circular' : '';
                        echo '"/>';
                    }
                    if (!isset($screen_name)) {
                        $screen_name = $name;
                    }
                    if ($disp_screen_name != 'false') {
                        echo '<div class="wdtf-screen-name">';
                        echo "<span class=\"screen_name\">{$t['name']}</span><br>";
                        echo "<a href=\"https://twitter.com/{$screen_name}\" target=\"_blank\" dir=\"ltr\">@{$screen_name}</a></div>";
                    }
                    echo '<div class="clear"></div></div>';
                    ?>
			       		<div class="tweet_data">
			        	<?php 
                    echo $t['text'];
                    ?>
			        	</div>
			            <br/>
			            <div class="clear"></div>
			            <div class="times">
			            <em>
			            
						<a href="http://www.twitter.com/<?php 
                    echo $screen_name;
                    ?>
" target="_blank" title="Follow <?php 
                    echo $name;
                    ?>
 on Twitter [Opens new window]">
							<?php 
                    if ($cache_transient == "true") {
                        $timeDisplay = twitter_time_diff($t['time'], current_time('timestamp'));
                    } else {
                        $timeDisplay = human_time_diff($t['time'], current_time('timestamp'));
                    }
                    if ($alter_ago_time == "true") {
                        $displayAgo = " ago";
                    }
                    printf(__('%1$s%2$s'), $timeDisplay, $displayAgo);
                    ?>
							</a>
			            </em>
			            </div>
						<?php 
                    if ($twitterIntents == "true") {
                        ?>
       
<div class="tweets-intent-data">
<?php 
                        if ($t['favourite_count'] != 0 || $t['retweet_count'] != 0) {
                            ?>
<span class="stats-narrow customisable-border"><span class="stats" data-scribe="component:stats">
 <?php 
                            if ($t['retweet_count'] != 0) {
                                ?>
  <a href="https://twitter.com/<?php 
                                echo $screen_name;
                                ?>
/statuses/<?php 
                                echo $t['tweet_id'];
                                ?>
" title="View Tweet on Twitter" data-scribe="element:favorite_count" target="_blank">
    <span class="stats-favorites">
      <strong><?php 
                                echo $t['retweet_count'];
                                ?>
</strong> retweet<?php 
                                if ($t['retweet_count'] > 1) {
                                    echo 's';
                                }
                                ?>
    </span>
  </a>
  <?php 
                            }
                            if ($t['favourite_count'] != 0) {
                                ?>
  <a href="https://twitter.com/<?php 
                                echo $screen_name;
                                ?>
/statuses/<?php 
                                echo $t['tweet_id'];
                                ?>
" title="View Tweet on Twitter" data-scribe="element:favorite_count" target="_blank">
    <span class="stats-favorites">
      <strong><?php 
                                echo $t['favourite_count'];
                                ?>
</strong> Favorite<?php 
                                if ($t['favourite_count'] > 1) {
                                    echo 's';
                                }
                                ?>
    </span>
  </a>
  <?php 
                            }
                            ?>
  
</span>
</span>
<div class="clear"></div>
<div class="seperator_wpltf"></div>
<?php 
                        }
                        ?>
      <ul class="tweet-actions " role="menu" >
  <li><a href="http://twitter.com/intent/tweet?in_reply_to=<?php 
                        echo $t['tweet_id'];
                        ?>
" data-lang="en" class="in-reply-to" title="Reply" target="_blank"><span aria-hidden="true" data-icon="&#xf079;" <?php 
                        echo $color_intents ? 'style="color:' . $color_intents . ';"' : '';
                        ?>
></span></a></li>
  <li><a href="http://twitter.com/intent/retweet?tweet_id=<?php 
                        echo $t['tweet_id'];
                        ?>
" data-lang="en" class="retweet" title="Retweet" target="_blank"><span aria-hidden="true" data-icon="&#xf112;" <?php 
                        echo $color_intents ? 'style="color:' . $color_intents . ';"' : '';
                        ?>
></span></a></li>
  <li><a href="http://twitter.com/intent/favorite?tweet_id=<?php 
                        echo $t['tweet_id'];
                        ?>
" data-lang="en" class="favorite" title="Favorite" target="_blank"><span aria-hidden="true" data-icon="&#xf005;" <?php 
                        echo $color_intents ? 'style="color:' . $color_intents . ';"' : '';
                        ?>
></span></a></li>
</ul>
    </div>
						<?php 
                    }
                    ?>
						<div class="clear"></div>
</div><div class="clear"></div>
			        </li>
			    <?php 
                }
                ?>

			<?php 
            } else {
                ?>
			    <li>Waiting for twitter.com...Try reloading the page again </li>
			<?php 
            }
            ?>
			</ul>
			
			<?php 
            if (isset($wpltf_wdgt_slide_style) && $wpltf_wdgt_slide_style == 'slider') {
                wp_register_script('ticker_script', plugins_url('/js/jquery.newsTicker.js', dirname(__FILE__)));
                if (!wp_script_is('ticker_script')) {
                    wp_print_scripts('ticker_script');
                }
                add_action('wp_footer', array($this, 'add_script_footer'));
            }
        }
        echo $after_widget;
    }
示例#3
0
			        	</div>
			            <br/>
			            <div class="clear"></div>
			            <div class="times">
			            <em>
			            
						<a href="http://www.twitter.com/<?php 
        echo $screen_name;
        ?>
" target="_blank" title="Follow <?php 
        echo $name;
        ?>
 on Twitter [Opens new window]">
							<?php 
        if ($cache_transient == "true") {
            $timeDisplay = twitter_time_diff($t['time'], current_time('timestamp'));
        } else {
            $timeDisplay = human_time_diff($t['time'], current_time('timestamp'));
        }
        if ($alter_ago_time == "true") {
            $displayAgo = " ago";
        }
        printf(__('%1$s%2$s'), $timeDisplay, $displayAgo);
        ?>
							</a>
			            </em>
			            </div>
						<?php 
        if ($twitterIntents == "true") {
            ?>