コード例 #1
0
    function front_end($args, $instance)
    {
        extract($args);
        $tweets = TwitterHelper::get_tweets($instance['username'], $instance['count']);
        if (!empty($tweets)) {
            if ($instance['title']) {
                echo $before_title . $instance['title'] . $after_title;
            }
        }
        ?>
			<?php 
        foreach ($tweets as $tweet) {
            ?>
				<p><?php 
            echo $tweet->tweet_text;
            ?>
 - <span class="time"><?php 
            echo $tweet->time_distance;
            ?>
 ago</span></p>
			<?php 
        }
        ?>
		<?php 
    }
コード例 #2
0
function carbon_twitter_is_config_valid()
{
    $tweets = TwitterHelper::get_tweets('cnn', 1, true);
    if (!$tweets) {
        return false;
    }
    return true;
}
コード例 #3
0
    public function front_end($args, $instance)
    {
        // outputs the content of the widget
        if (!carbon_twitter_is_configured()) {
            return;
            //twitter settings are not configured
        }
        $instance = array('title' => Carbon_ACF_Widget::get_widget_meta($widget_id, 'title'), 'username' => Carbon_ACF_Widget::get_widget_meta($widget_id, 'username'), 'count' => Carbon_ACF_Widget::get_widget_meta($widget_id, 'count'));
        $tweets = TwitterHelper::get_tweets($instance['username'], $instance['count']);
        if (empty($tweets)) {
            return;
            //no tweets, or error while retrieving
        }
        if ($instance['title']) {
            $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
            echo $args['before_title'] . $title . $args['after_title'];
        }
        ?>
		<div class="widget-body">
			<ul>
				<?php 
        foreach ($tweets as $tweet) {
            ?>
					<li><?php 
            echo $tweet->tweet_text;
            ?>
 - <span><?php 
            printf(__('%1$s ago', 'crb'), $tweet->time_distance);
            ?>
</span></li>
				<?php 
        }
        ?>
			</ul>
		</div><!-- /.widget-body -->
		<?php 
    }
コード例 #4
0
    function front_end($args, $instance)
    {
        extract($args);
        if (ot_get_option('twitter_oauth_access_token') && ot_get_option('twitter_oauth_access_token_secret') && ot_get_option('twitter_consumer_key') && ot_get_option('twitter_consumer_secret')) {
            $load = intval($instance['load']);
            $title = $instance['title'];
            $twitter_user = $instance['twitter_user'];
            $button_text = $instance['button_text'];
            $button_url = $instance['button_url'];
            $new_window = $instance['new_window'];
            ?>
<div class="tweets-widget"><?php 
            echo $title ? $before_title . $title . $after_title : '';
            if ($button_url || $button_text) {
                ?>
<a href="<?php 
                echo $button_url;
                ?>
"<?php 
                if ($new_window) {
                    ?>
target="_blank"<?php 
                }
                ?>
 class="widget-button"><?php 
                echo $button_text;
                ?>
</a><?php 
            }
            ?>
			
				<div class="tweets-container">
					
					<?php 
            $tweets = TwitterHelper::get_tweets($twitter_user, $load);
            if (empty($tweets)) {
                return;
            }
            if (!empty($tweets)) {
                echo '<ul>';
                foreach ($tweets as $tweet) {
                    ?>
							<li>
								<span class="tweet_text"><?php 
                    echo wpautop(preg_replace('~' . preg_quote($instance['twitter_user'], '~') . ': ~iu', '', $tweet->tweet_text));
                    ?>
</span>
								<span class="tweet_time"><a target="_blank" href="<?php 
                    echo $tweet->tweet_link;
                    ?>
"><?php 
                    echo $tweet->time_distance;
                    ?>
 &mdash; <?php 
                    _e('View on Twitter', 'espresso');
                    ?>
</a></span>
							</li>
							<?php 
                }
                echo '</ul>';
            }
            ?>
					
				</div>
			
			</div><?php 
        } else {
            echo '<p style="color:#dd0000;"><strong>Important:</strong> You need to enter your Twitter Settings on the Theme Options panel before you can use this widget.</p>';
        }
    }
コード例 #5
0
<?php

$section_title_tweets = get_post_meta($post->ID, '_recent_tweets_title', true);
$twitter_user = get_post_meta($post->ID, '_recent_tweets_user', true);
$load = get_post_meta($post->ID, '_tweet_count', true);
$tweets = TwitterHelper::get_tweets($twitter_user, $load);
if (!empty($tweets)) {
    ?>
<section id="recent-tweets" class="colored-block">
		<h3><?php 
    echo $section_title_tweets;
    ?>
</h3>
		<div class="tweets-carousel"><?php 
    foreach ($tweets as $tweet) {
        ?>
<div class="tweet">
					<div class="wrapped">
						<?php 
        echo wpautop(preg_replace('~' . preg_quote($twitter_user, '~') . ': ~iu', '', $tweet->tweet_text));
        ?>
						<small><?php 
        _e('about', 'espresso');
        ?>
 <?php 
        echo relativeTime($tweet->created_at);
        ?>
 <?php 
        _e('via', 'espresso');
        ?>
 <a href="http://twitter.com/<?php