} ?> <?php if (yiw_get_option('topbar_content') == 'twitter') { ?> <!-- START TWITTER --> <div id="twitter-slider" class="group"><div class="tweets-list"> <?php $access_token = yiw_get_option('topbar_access_token') != '' ? yiw_get_option('topbar_access_token') : yiw_get_option('twitter_access_token'); $access_token_secret = yiw_get_option('topbar_access_token_secret') != '' ? yiw_get_option('topbar_access_token_secret') : yiw_get_option('twitter_access_token_secret'); $consumer_key = yiw_get_option('topbar_consumer_key') != '' ? yiw_get_option('topbar_consumer_key') : yiw_get_option('twitter_consumer_key'); $consumer_secret = yiw_get_option('topbar_consumer_secret') != '' ? yiw_get_option('topbar_consumer_secret') : yiw_get_option('twitter_consumer_secret'); $twitter_data = yit_get_tweets($access_token, $access_token_secret, $consumer_key, $consumer_secret, yiw_get_option('topbar_twitter_items')); if (!isset($twitter_data->errors)) { echo '<ul class="last-tweets slides">'; $i = 1; foreach ($twitter_data as $tweet) { if (!empty($tweet)) { $text = $tweet->text; $text_in_tooltip = str_replace('"', '', $text); // replace " to avoid conflicts with title="" opening tags $id = $tweet->id; $time = strftime('%d/%m/%Y %H:%M:%S', strtotime($tweet->created_at)); $username = $tweet->user->name; } echo '<li class="tweet_' . $i . '"><p><span class="text">' . $text . '</span></p>'; ?>
/** * Template file for print a list of last tweets * * @package Yithemes * @author Francesco Licandro <*****@*****.**> * @since 1.0.0 */ $show_time = isset($time) && $time == 'yes' ? 'true' : 'false'; if (function_exists('yit_get_option')) { $username = isset($instance['username']) && $instance['username'] != '' ? $instance['username'] : yit_get_option('twitter-username'); $access_token = isset($access_token) && $access_token != '' ? $access_token : yit_get_option('twitter-access-token'); $access_token_secret = isset($access_token_secret) && $access_token_secret != '' ? $access_token_secret : yit_get_option('twitter-access-token-secret'); $consumer_key = isset($consumer_key) && $consumer_key != '' ? $consumer_key : yit_get_option('twitter-consumer-key'); $consumer_secret = isset($consumer_secret) && $consumer_secret != '' ? $consumer_secret : yit_get_option('twitter-consumer-secret'); } $twitter_data = yit_get_tweets($access_token, $access_token_secret, $consumer_key, $consumer_secret, $items); $animate_data = $animate != '' ? 'data-animate="' . $animate . '"' : ''; $animate_data .= $animation_delay != '' ? ' data-delay="' . $animation_delay . '"' : ''; $animate = $animate != '' ? ' yit_animate ' . $animate : ''; if (!isset($twitter_data->errors)) { ?> <div class="<?php echo $class . $animate; ?> " <?php echo $animate_data; ?> > <?php echo '<ul class="tweets-widget">';
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); if (isset($instance['icon_title']) && $instance['icon_title'] != '') { $img_title = '<img class="title-icon" src="' . $instance['icon_title'] . '" />'; } else { $img_title = ''; } echo $before_widget; echo $before_title . $img_title . $title . $after_title; //echo '<img src="' . YIT_IMAGES_URL . '/last-tweets-arrow.png" class="arrow" />'; echo '<div class="list-tweets' . '-' . $this->number . '">'; $username = isset($instance['username']) && $instance['username'] != '' ? $instance['username'] : yit_get_option('twitter-username'); $access_token = isset($instance['access_token']) && $instance['access_token'] != '' ? $instance['access_token'] : yit_get_option('twitter-access-token'); $access_token_secret = isset($instance['access_token_secret']) && $instance['access_token_secret'] != '' ? $instance['access_token_secret'] : yit_get_option('twitter-access-token-secret'); $consumer_key = isset($instance['consumer_key']) && $instance['consumer_key'] != '' ? $instance['consumer_key'] : yit_get_option('twitter-consumer-key'); $consumer_secret = isset($instance['consumer_secret']) && $instance['consumer_secret'] != '' ? $instance['consumer_secret'] : yit_get_option('twitter-consumer-secret'); $twitter_data = yit_get_tweets($access_token, $access_token_secret, $consumer_key, $consumer_secret, $instance['limit']); if (!isset($twitter_data->errors)) { echo '<ul class="last-tweets">'; $i = 1; foreach ($twitter_data as $tweet) { if (!empty($tweet)) { $text = $tweet->text; $text_in_tooltip = str_replace('"', '', $text); // replace " to avoid conflicts with title="" opening tags $id = $tweet->id; $time = strftime('%d/%m/%Y %H:%M:%S', strtotime($tweet->created_at)); //$username = $tweet->user->name; } echo '<li class="tweet_' . $i . '"><p><span class="text">' . $text . '</span><br />'; if ($instance['time']) { echo '<span class="meta">' . $time . '</span>'; } echo '</p></li>'; ?> <script type="text/javascript"> jQuery(function($){ var test = twttr.txt.autoLink("<?php echo addslashes(str_replace("\n", " ", $text)); ?> "); $('ul.last-tweets li.tweet_<?php echo $i; ?> span.text').replaceWith(test); }); </script> <?php $i++; } echo '</ul>'; } echo '</div>'; if (isset($instance['follow']) && $instance['follow'] == 'true') { echo '<p id="follow-twitter"><a href="https://twitter.com/intent/user?screen_name=' . $username . '" target="_blank">' . apply_filters('yit_follow_us_twitter_widget', __('Follow us on Twitter →', 'yit')) . '</a>'; } echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; echo $before_title . $title . $after_title; echo '<div class="list-tweets' . '-' . $this->number . '">'; $access_token = isset($instance['access_token']) && $instance['access_token'] != '' ? $instance['access_token'] : yiw_get_option('twitter_access_token'); $access_token_secret = isset($instance['access_token_secret']) && $instance['access_token_secret'] != '' ? $instance['access_token_secret'] : yiw_get_option('twitter_access_token_secret'); $consumer_key = isset($instance['consumer_key']) && $instance['consumer_key'] != '' ? $instance['consumer_key'] : yiw_get_option('twitter_consumer_key'); $consumer_secret = isset($instance['consumer_secret']) && $instance['consumer_secret'] != '' ? $instance['consumer_secret'] : yiw_get_option('twitter_consumer_secret'); $twitter_data = yit_get_tweets($access_token, $access_token_secret, $consumer_key, $consumer_secret, $instance['limit']); if (!isset($twitter_data->errors)) { echo '<ul class="last-tweets">'; $i = 1; foreach ($twitter_data as $tweet) { if (!empty($tweet)) { $text = $tweet->text; $text_in_tooltip = str_replace('"', '', $text); // replace " to avoid conflicts with title="" opening tags $id = $tweet->id; $time = strftime('%d/%m/%Y %H:%M:%S', strtotime($tweet->created_at)); $username = $tweet->user->name; } echo '<li class="tweet_' . $i . '"><p><span class="text">' . $text . '</span><br />'; if ($instance['time']) { echo '<span class="meta">' . $time . '</span>'; } echo '</p></li>'; ?> <script type="text/javascript"> jQuery(function($){ var test = twttr.txt.autoLink("<?php echo addslashes(str_replace("\n", " ", $text)); ?> "); $('ul.last-tweets li.tweet_<?php echo $i; ?> span.text').replaceWith(test); }); </script> <?php $i++; } echo '</ul>'; } echo '</div>'; echo $after_widget; }
/** * TWITTER * * @description * Print a list of last tweets * * @example * [twitter username="******" items="5" consumer_key="" consumer_secret="" access_token="" access_token_secret="" [class="last-tweets-widget"] [time="true"] ] * * @attr * usarname - the username * items - number of post for list **/ function yiw_sc_twitter_func($atts, $content = null) { extract(shortcode_atts(array("username" => null, "items" => 5, "class" => 'last-tweets-widget', "time" => true, 'consumer_key' => '', 'consumer_secret' => '', 'access_token' => '', 'access_token_secret' => ''), $atts)); $access_token = $access_token != '' ? $access_token : yiw_get_option('twitter_access_token'); $access_token_secret = $access_token_secret != '' ? $access_token_secret : yiw_get_option('twitter_access_token_secret'); $consumer_key = $consumer_key != '' ? $consumer_key : yiw_get_option('twitter_consumer_key'); $consumer_secret = $consumer_secret != '' ? $consumer_secret : yiw_get_option('twitter_consumer_secret'); $twitter_data = yit_get_tweets($access_token, $access_token_secret, $consumer_key, $consumer_secret, $items); $html = '<div class="last-tweets-widget">'; $show_time = isset($time) && $time == 'yes' ? 'true' : 'false'; if (!isset($twitter_data->errors)) { $html .= '<ul class="tweets-widget">'; $i = 1; foreach ($twitter_data as $tweet) { if (!empty($tweet)) { $text = $tweet->text; $text_in_tooltip = str_replace('"', '', $text); // replace " to avoid conflicts with title="" opening tags $id = $tweet->id; $time = strftime('%d/%m/%Y %H:%M:%S', strtotime($tweet->created_at)); $username = $tweet->user->name; } $html .= '<li class="tweet_' . $i . '"><p><span class="text">' . $text . '</span><br />'; if ($show_time == 'true') { $html .= '<span class="meta">' . $time . '</span>'; } $html .= '</p></li>'; ?> <script type="text/javascript"> jQuery(function($){ var test = twttr.txt.autoLink("<?php echo $text; ?> "); $('ul li.tweet_<?php echo $i; ?> span.text').replaceWith(test); }); </script> <?php $i++; } $html .= '</ul>'; } $html .= '</div>'; return apply_filters('yiw_sc_twitter_html', $html); }
<!-- </div>--> <?php } ?> </div> </div> <div class="clear"></div> </div> <?php $twitter_username = yit_get_option('twitter-username'); $twitter_consumer_key = yit_get_option('twitter-consumer-key'); $twitter_consumer_secret = yit_get_option('twitter-consumer-secret'); $twitter_access_token = yit_get_option('twitter-access-token'); $twitter_access_token_secret = yit_get_option('twitter-access-token-secret'); $tweets = yit_get_tweets($twitter_access_token, $twitter_access_token_secret, $twitter_consumer_key, $twitter_consumer_secret, 3); if (!isset($tweets->errors)) { ?> <script type="text/javascript"> jQuery(document).ready(function($){ $('#maintenance_twitter_text').flexslider({ animation: 'fade', slideshowSpeed: 5000, animationSpeed: 300, selectors: '.slides > li', directionNav: false, slideshow: true, pauseOnAction: false, controlNav: false, touch: true });
function widget($args, $instance) { extract($args); wp_enqueue_script('yit-shortcodes-twitter'); wp_enqueue_script('yit-shortcodes-twitter-text'); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; echo $before_title . $title . $after_title; //echo '<img src="' . YIT_IMAGES_URL . '/last-tweets-arrow.png" class="arrow" />'; echo '<div class="list-tweets' . '-' . $this->number . '">'; $username = isset($instance['username']) && $instance['username'] != '' ? $instance['username'] : yit_get_option('twitter-username'); $access_token = isset($instance['access_token']) && $instance['access_token'] != '' ? $instance['access_token'] : yit_get_option('twitter-access-token'); $access_token_secret = isset($instance['access_token_secret']) && $instance['access_token_secret'] != '' ? $instance['access_token_secret'] : yit_get_option('twitter-access-token-secret'); $consumer_key = isset($instance['consumer_key']) && $instance['consumer_key'] != '' ? $instance['consumer_key'] : yit_get_option('twitter-consumer-key'); $consumer_secret = isset($instance['consumer_secret']) && $instance['consumer_secret'] != '' ? $instance['consumer_secret'] : yit_get_option('twitter-consumer-secret'); $twitter_data = yit_get_tweets($access_token, $access_token_secret, $consumer_key, $consumer_secret, $instance['limit']); if (!isset($twitter_data->errors)) { echo '<ul class="last-tweets">'; $i = 1; foreach ($twitter_data as $tweet) { if (!empty($tweet)) { $text = $tweet->text; $text_in_tooltip = str_replace('"', '', $text); // replace " to avoid conflicts with title="" opening tags $id = $tweet->id; $time = strftime('%d/%m/%Y %H:%M:%S', strtotime($tweet->created_at)); //$username = $tweet->user->name; } echo '<li class="tweet_' . $i . '"><i class="fa fa-twitter widget-tweet-icon"></i><p class="arrow-left"><span class="text">' . $text . '</span><br />'; if ($instance['time']) { echo '<span class="meta">' . $time . '</span>'; } echo '</p></li>'; $i++; } echo '</ul>'; } echo '</div>'; if (isset($instance['follow']) && $instance['follow'] == 'true') { $fowllow_message = "Follow us on Twitter →"; if (is_rtl()) { $fowllow_message = "← Follow us on Twitter"; } echo '<p id="follow-twitter"><a href="https://twitter.com/intent/user?screen_name=' . $username . '" target="_blank">' . apply_filters('yit_follow_us_twitter_widget', __($fowllow_message, 'yit')) . '</a>'; } echo $after_widget; }