コード例 #1
0
 public function content($atts, $content = null)
 {
     $title = $order = $text_size = $items = $el_class = $width = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'twitter_username' => '', 'text_size' => 'normal', 'item_count' => '6', 'animation' => 'fade', 'autoplay' => 'yes', 'el_class' => '', 'alt_background' => 'none', 'el_position' => '', 'width' => '1/1'), $atts));
     $output = '';
     if ($autoplay == "yes") {
         $items .= '<div class="flexslider tweets-slider content-slider" data-animation="' . $animation . '" data-autoplay="yes"><ul class="slides">';
     } else {
         $items .= '<div class="flexslider tweets-slider content-slider" data-animation="' . $animation . '" data-autoplay="no"><ul class="slides">';
     }
     $items .= latestTweet($item_count, $twitter_username, true);
     wp_reset_postdata();
     $items .= '</ul></div>';
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $el_class .= ' testimonial';
     if ($alt_background == "none") {
         $output .= "\n\t" . '<div class="wpb_tweets_slider_widget wpb_content_element ' . $width . $el_class . '">';
     } else {
         $output .= "\n\t" . '<div class="wpb_tweets_slider_widget wpb_content_element alt-bg ' . $alt_background . ' ' . $width . $el_class . '">';
     }
     $output .= "\n\t\t" . '<div class="wpb_wrapper slider-wrap text-' . $text_size . '">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading">' . $title . '</h3></div>' : '';
     $output .= "\n\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $include_carousel;
     $include_carousel = true;
     return $output;
 }
コード例 #2
0
 function widget($args, $instance)
 {
     extract($args);
     // User-selected settings
     $title = apply_filters('widget_title', $instance['title']);
     $username = $instance['username'];
     $posts = $instance['posts'];
     // Before widget (defined by themes)
     echo $before_widget;
     // Title of widget (before and after defined by themes)
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     // This check prevents fatal errors — which can't be turned off in PHP — when feed updates fail
     if (function_exists('getTweets')) {
         $result = '<ul class="widget-tweet-list">';
         $result .= latestTweet($posts, $username);
         $result .= '</ul>';
         $result .= '<div class="twitter-link"><a href="http://www.twitter.com/' . $username . '"><span>Follow</span> @' . $username . '</a></div>';
         // Display everything
         echo $result;
         // If loading from Twitter fails, display message
     } else {
         echo '<p>Please install and activate the Twitter oAuth Developer Plugin.</p>';
     }
     // After widget (defined by themes)
     echo $after_widget;
 }
コード例 #3
0
ファイル: latest-tweet-bar.php プロジェクト: rabisahar/Spring
 protected function content($atts, $content = null)
 {
     $width = $pb_margin_bottom = $pb_border_bottom = $pb_border_top = $el_class = $output = $items = $el_position = '';
     extract(shortcode_atts(array('el_position' => '', 'pb_margin_bottom' => 'no', 'pb_border_bottom' => 'no', 'pb_border_top' => 'no', 'width' => '1/1', 'twitter_username' => '', 'el_class' => ''), $atts));
     if ($pb_margin_bottom == "yes") {
         $el_class .= ' pb-margin-bottom';
     }
     if ($pb_border_bottom == "yes") {
         $el_class .= ' pb-border-bottom';
     }
     if ($pb_border_top == "yes") {
         $el_class .= ' pb-border-top';
     }
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $output .= "\n\t" . '<div class="wpb_latest_tweet_bar_widget wpb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="wpb_wrapper latest-tweet-bar-wrap clearfix">';
     $output .= "\n\t\t\t" . '<div class="text-wrap">' . latestTweet($twitter_username) . "</div>";
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     return $output;
 }
コード例 #4
0
function latest_tweet($atts)
{
    extract(shortcode_atts(array("username" => ''), $atts));
    $tweet_content = latestTweet($username);
    return $tweet_content;
}