function widget($args, $data) { $title = apply_filters('widget_title', $data['title']); $nbTweets = $data['nbTweets']; $consumer_key = $data['consumer_key']; $consumer_secret = $data['consumer_secret']; $access_token = $data['access_token']; $access_token_secret = $data['access_token_secret']; extract($args); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $cache = plugin_dir_path(__FILE__) . 'cache/twitter.txt'; if (time() - filemtime($cache) > $data['cachetime']) { include_once 'class/twitteroauth.php'; $connect = new TwitterOAuth($data['consumer_key'], $data['consumer_secret'], $data['access_token'], $data['access_token_secret']); $tweets = $connect->get('statuses/user_timeline', array('count' => $data['nbTweets'])); file_put_contents($cache, serialize($tweets)); } else { $tweets = unserialize(file_get_contents($cache)); } if (!$consumer_key || !$consumer_secret || !$access_token || !$access_token_secret) { echo "No Tweets Available or bad configuration..."; } else { if (!empty($tweets)) { // to use with intents echo '<div class="twitter"><i class="icon-twitter icon-3x"></i>'; global $hercules_add_owl; $hercules_add_owl = true; $random = hs_gener_random(10); echo '<script type="text/javascript"> jQuery(document).ready(function() { jQuery("#owl-demo_' . $random . '").owlCarousel({ autoPlay : 5000, stopOnHover : true, navigation:false, singleItem : true, autoHeight : true, touchDrag: true, scrollPerPage: true }); }); </script>'; echo '<div id="owl-demo_' . $random . '" class="owl-carousel">'; foreach ($tweets as $tweet) { $text = parseTweet($tweet->text); $screen_name = $tweet->user->screen_name; $name = $tweet->user->name; $retweet = $tweet->id_str; $time = date('d M Y', strtotime($tweet->created_at)); echo '<div>'; echo '<div class="tweet_item">'; echo '<div class="tweet_content">'; echo '<div class="stream-item-header">'; if ($data['fullname']) { echo '<strong class="fullname">' . $name . '</strong>'; } if ($data['username']) { echo '<a class="account-group" href="http://twitter.com/' . $screen_name . '" target="_blank"><span class="username"> @' . $screen_name . '</span></a>'; } echo '</div>'; echo '<div class="tweet_txt">' . $text . '</div>'; echo '<div class="clearfix">'; ?> <div class="twitter_intents"> <span><a onClick="window.open('https://twitter.com/intent/tweet?in_reply_to=<?php echo $retweet; ?> ','Twitter','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" class="reply-tweet" href="https://twitter.com/intent/tweet?in_reply_to=<?php echo $retweet; ?> ">Reply</a></span> <span><a onClick="window.open('https://twitter.com/intent/retweet?tweet_id=<?php echo $retweet; ?> ','Twitter','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" class="retweet" href="https://twitter.com/intent/retweet?tweet_id=<?php echo $retweet; ?> ">Retweet</a></span> <span><a onClick="window.open('https://twitter.com/intent/favorite?tweet_id=<?php echo $retweet; ?> ','Twitter','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" class="favorite-tweet" href="https://twitter.com/intent/favorite?tweet_id=<?php echo $retweet; ?> ">Favorite</a></span> </div> <?php echo "</div>"; echo ' <p class="timestamp"> <a href="https://twitter.com/' . $screen_name . '/status/' . $retweet . '" target="_blank"> ' . $time . ' </a> </p>'; echo '</div>'; echo '</div>'; echo '</div>'; } echo "</div></div>"; } } echo $after_widget; }
?> </header> <?php $post_meta = of_get_option('post_meta'); if ($post_meta == 'true' || $post_meta == '') { get_template_part('includes/post-formats/post-meta'); } ?> <?php $hercules_gallery_type = get_post_meta(get_the_ID(), 'tz_gallery_format', true); $hercules_targetheight = get_post_meta(get_the_ID(), 'tz_gallery_targetheight', true); $hercules_gallery_margins = get_post_meta(get_the_ID(), 'tz_gallery_margins', true); $hercules_gallery_captions = get_post_meta(get_the_ID(), 'tz_gallery_captions', true); $hercules_gallery_randomize = get_post_meta(get_the_ID(), 'tz_gallery_randomize', true); $hercules_random = hs_gener_random(10); ?> <div class="post-thumb clearfix"> <?php if ($hercules_gallery_type == 'slideshow') { global $hercules_add_owl; $hercules_add_owl = true; ?> <script type="text/javascript"> jQuery(window).load(function() { jQuery("#owl-demo_<?php echo $hercules_random; ?> ").owlCarousel({ autoPlay : 5000,
function shortcode_slideshow($atts, $content = null) { global $hercules_add_owl; $hercules_add_owl = true; extract(shortcode_atts(array('num' => '5', 'autoplay' => '5000', 'blankwindow' => 'false', 'effect' => 'fade', 'pagination' => 'true', 'custom_category' => '', 'custom_class' => ''), $atts)); $args = array('post_type' => 'slideshow', 'slideshow_categories' => $custom_category, 'numberposts' => $num, 'orderby' => 'post_date', 'order' => 'DESC'); $slideshow = get_posts($args); $random = hs_gener_random(10); $output = '<script type="text/javascript"> jQuery(window).ready(function() { jQuery("#owl-demo_' . $random . '").owlCarousel({ items : ' . $num . ', autoPlay : ' . $autoplay . ', stopOnHover : true, navigation:false, paginationSpeed : 3000, touchDrag: false, goToFirstSpeed : 2000, singleItem : true, autoHeight : true, pagination : ' . $pagination . ', transitionStyle:"' . $effect . '" }); });'; $output .= '</script>'; $output .= '<div id="owl-demo_' . $random . '" class="owl-carousel">'; global $post; if ($blankwindow == "true") { $window = "_blank"; } else { $window = "_self"; } foreach ($slideshow as $post) { setup_postdata($post); $content = get_the_content(); $custom = get_post_custom($post->ID); $slideshow_link = get_post_meta($post->ID, 'my_slideshow_link', true); $post_id = ''; if (has_post_thumbnail($post->ID)) { $attachment_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'slideshow', true); } $output .= '<div class="featured-thumbnail thumbnail large">'; $output .= '<div class="hider-page"></div>'; if ($content) { $output .= '<div class="slideshow-caption"><div>'; $output .= $content; $output .= '</div></div>'; } if (has_post_thumbnail($post->ID)) { if ($slideshow_link) { $output .= '<a href="' . $slideshow_link . '" target="' . $window . '">'; } $output .= '<img src="' . $attachment_url[0] . '" alt="' . get_the_title($post_id) . '" />'; if ($slideshow_link) { $output .= '</a>'; } } $output .= '</div>'; } $output .= '</div>'; return $output; }