function get_twitter_feed_list($id, $max_tweets = NULL) { $feed = get_twitter_feed($id); $rtn = '<ul>'; for ($i = 0; $i < $max_tweets; $i++) { $rtn .= '<li>' . str_replace('JoshuaMorse: ', '', $feed->channel->item[$i]->title) . '</li>'; } $rtn .= '</ul>'; return $rtn; }
public function widget($args, $instance) { // Widget output /** Define the default argument array. */ $defaults = array('before_widget' => '<section class="twitter-widget widget">', 'after_widget' => '</section>', 'title' => '', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'); /** Merge the arguments with the defaults. */ $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); $title = empty($instance['title']) ? ' ' : apply_filters('title', $instance['title']); $twitter_username = empty($instance['username']) ? ' ' : apply_filters('username', $instance['username']); $count = empty($instance['count']) ? ' ' : apply_filters('count', $instance['count']); if (!empty($twitter_username)) { $username = $twitter_username; } else { $username = @pls_get_option('pls-twitter-username'); } ?> <?php echo $before_widget; ?> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> <?php echo $before_title . $title . $after_title; ?> <p class="twitter-handle"><a href="https://twitter.com/<?php echo $username; ?> ">@<?php echo $username; ?> </a></p> <section id="twitter-sidebar-widget"> <?php echo get_twitter_feed($username, $count); ?> </section> <?php echo $after_widget; ?> <?php }
<?php require 'plugins/twitter/lib/functions.php'; $feed = get_twitter_feed(14983693); if (is_object($feed)) { echo 'I see a feed object; looks good!' . "\n"; echo "\n"; echo get_twitter_feed_list(14983693, 3); echo "\n"; //print_r($feed); }
if ($expert->socialprofile->twitter) { function get_twitter_feed($username) { $twitteruser = $username; $notweets = 30; $consumerkey = "XguHk4IArzSaq108CmWtv8rFF"; $consumersecret = "r4AmdveanQilhEe8lofGH7fbtegFHQ3BccKJDiBoWby769WoQR"; $accesstoken = "131286593-b5Vo7Y8KbTqEQ0TC9wG1aXyzZ5UuE9GbXvf4QuHY"; $accesstokensecret = "6EXU53aejUWdBc4j3xkwg8HfPZKnKlJA7dkFIRROEj37d"; $connection = new TwitterOAuth($consumerkey, $consumersecret, $accesstoken, $accesstokensecret); $tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $twitteruser . "&count=" . $notweets); return $tweets; } //replace ExpertFile full Twitter URL with user name $username = str_replace("https://twitter.com/", "", $expert->socialprofile->twitter); $tweets = get_twitter_feed($username); } ?> <?php if (isset($tweets) || count($tweets) > 0) { ?> <div id="activity" class="nice_box"> <div class="nice-content-wrapper"> <h2 class="nice-box-header"> Activity </h2> <div class="twitter-activity"> <?php foreach ($tweets as $tweet) {
<?php // Get twitter feed $twitter_feed = get_twitter_feed(IGV_get_option('_igv_twitter_handle')); if ($twitter_feed) { ?> <section id="twitter-feed" class="theme-bg hide-on-mobile"> <div id="twitter-marquee-outer"> <div id="twitter-marquee-holder"> <div class="twitter-marquee"> <?php foreach ($twitter_feed as $twitter_item) { $url = $twitter_item->link->url; $target = $twitter_item->link->blank === TRUE ? '_blank' : '_self'; // NOTE: we can also check $blank to add the ajax-link class $text = $twitter_item->text; ?> <a class="twitter-feed-tweet" href="<?php echo $url; ?> " target="<?php echo $target; ?> "><?php echo $text; ?> </a>
$aside_snippet[$aside_title] = $aside_data; } } // define snippets content // generate some basic lists and a search form $authors_list = get_authors(); $pages_list = get_pages_basic(); $categories_list = get_categories(); $categories_basic_list = get_categories_basic(); $tags_list = get_tags(); $months_list = get_months(); $search_form = show_search_form(); $aside_snippet['twitter_feed'] = ''; if (!empty($config['connections']['twitter_username'])) { $twitter_username = $config['connections']['twitter_username']; $twitter_feed = get_twitter_feed($twitter_username); $aside_snippet['twitter_feed'] = build_snippet('Recent twitterings...', $twitter_feed); } // now use a ready made function to put the above data arrays into some drop down lists $months_select_form = build_select_form('months_select_form', $months_list); $categories_select_form = build_select_form('categories_select_form', $categories_list); $authors_select_form = build_select_form('authors_select_form', $authors_list); $tags_select_form = build_select_form('tags_select_form', $tags_list); // get two lists of articles - the latest and the most popule $latest_articles = get_articles_basic($config['layout']['url_style']); $popular_articles = get_articles_basic($config['layout']['url_style'], '', 'view_count DESC', '5'); // feeds - this is slightly different - we'll write out the html and put it in a variable $feeds_img = file_exists(WW_ROOT . '/ww_view/_img/feed-icon16x16.png') ? '<img src="' . WW_WEB_ROOT . '/ww_view/_img/feed-icon16x16.png" alt="RSS logo" width="16" height="16"/>' : ''; $feeds_list = ' <ul> <li>