Exemplo n.º 1
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        echo $args['before_widget'];
        if (!empty($title)) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        ?>
		
		<ul>
		<?php 
        if (get_option('tdf_consumer_key') && get_option('tdf_consumer_secret') && get_option('tdf_access_token') && get_option('tdf_access_token_secret')) {
            $tweets = getTweets($instance['username'], $instance['tweets']);
            foreach ($tweets as $tweet) {
                echo '<li>' . TwitterFilter($tweet['text']) . '</li>';
            }
        } else {
            echo '<li>Twitter Feed not configured. <a href="' . admin_url('options-general.php?page=tdf_settings') . '">Click here to edit.</a></li>';
        }
        ?>
		</ul>

		<?php 
        echo $args['after_widget'];
    }
if ($twitter_mode == "one_tweet") {
    $tweet_id = 'twitter-feed';
} else {
    $tweet_id = 'twitter-feed';
}
$class = setClass(array('tweet_list', $el_class, $twitter_slides_class, $animation_loading_class, $animation_effect_class, $responsive_lg, $responsive_md, $responsive_sm, $responsive_xs));
$output .= '<div id="' . $tweet_id . '">
			<ul' . $class . '' . $animation_delay_class . '>';
if ($twitter_mode == "one_tweet") {
    $num_tweet = 1;
    $tweets = getTweets($num_tweet, $twitter_username);
    foreach ($tweets as $tweet) {
        $output .= '
				<li>
					<span class="tweet_text">' . TwitterFilter($tweet['text']) . '</span>
					<span class="tweet_time"><a href="https://twitter.com/' . $twitter_username . '/status/' . $tweet['id_str'] . '">' . date('j F o \\a\\t g:i A', strtotime($tweet['created_at'])) . '</a></span>
				</li>';
    }
} else {
    $tweets = getTweets(intval($num_tweet), $twitter_username);
    foreach ($tweets as $tweet) {
        $output .= '
				<li>
					<span class="tweet_text">' . TwitterFilter($tweet['text']) . '</span>
					<span class="tweet_time"><a href="https://twitter.com/' . $twitter_username . '/status/' . $tweet['id_str'] . '">' . date('j F o \\a\\t g:i A', strtotime($tweet['created_at'])) . '</a></span>
				</li>';
    }
}
$output .= '</ul>
			</div>';
echo $output . $this->endBlockComment('az_big_twitter_feed');
Exemplo n.º 3
0
<?php

extract(shortcode_atts(array('class' => '', 'id' => '', 'css_animation' => '', 'css_animation_delay' => '', 'carousel' => '', 'color' => '', 'user' => '', 'tweets' => '', 'carousel_style' => ''), $atts));
$animated = $css_animation ? 'animate' : '';
$css_animation_delay = $css_animation ? ' data-delay="' . $css_animation_delay . '"' : '';
$class = setClass(array('md-tweets', $animated, $css_animation, $class, $carousel));
$id = setId($id);
$uniqid = 'md-tweets-' . uniqid();
if (get_option('tdf_consumer_key') && get_option('tdf_consumer_secret') && get_option('tdf_access_token') && get_option('tdf_access_token_secret')) {
    $output .= '<div' . $class . $id . $css_animation_delay . '>';
    $output .= '<div class="twitter-logo"><a href="http://twitter.com/' . $user . '" target="_blank" style="color:' . $color . '"><i class="icon-twitter"></i></a></div>';
    $output .= '<div class="md-carousel ' . $carousel_style . '" data-items="1" data-items-tablet="1" data-items-mobile="1" data-autoplay="true" data-pagination="true" data-navigation="false" id="' . $uniqid . '">';
    $tweets = getTweets($user, $tweets);
    foreach ($tweets as $tweet) {
        $output .= '
                    <div class="md-tweet item" style="color:' . $color . '">
                        <div class="tweet-content">
                            <div class="tweet-text">' . TwitterFilter($tweet['text']) . '</div>
                        </div>
                        <div class="tweet-info">
                            <span class="tweet-time"><a href="' . 'https://twitter.com/' . $user . '/status/' . $tweet['id_str'] . '" target="_blank" style="color:' . $color . '">' . date('j F o \\a\\t g:i A', strtotime($tweet['created_at'])) . '</a></span>
                        </div>
                    </div>';
    }
    $output .= '</div>';
    $output .= '</div>';
    $output .= '<style type="text/css">#' . $uniqid . ' .md-tweet a{color:' . $color . ';}</style>';
} else {
    $output = '<span style="color:' . $color . '">Twitter Feed not configured. <a href="' . admin_url('options-general.php?page=tdf_settings') . '" style="color:' . $color . '">Click here to edit.</a></span>';
}
echo $output;