/* Plugin Name: Twitter Feed Written by: Okler Themes - (http://www.okler.net) Version: 0.1 Based On: http://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/ */ ; (function($, window) { "use strict"; window.twitterFeed = function() { var options = { id: "", count: 2, URL: theme_settings.twitter_feed, wrapper: "tweet" }; this.initialize = function(options) { this.options = $.extend({}, this.options, options); this.options.URL = theme_settings.twitter_feed; this.options.URL = this.options.URL + "&twitteruser=" + this.options.id + "¬weets=" + this.options.count; this.build(); return this; }; this.build = function() { var $this = this; var showdirecttweets = false; var showretweets = true; var showtweetlinks = true; var showprofilepic = true; $.getJSON($this.options.URL, function(feeds) { var feedHTML = ''; var displayCounter = 1; for (var i = 0; i < feeds.length; i++) { var tweetscreenname = feeds[i].user.name; var tweetusername = feeds[i].user.screen_name; var profileimage = feeds[i].user.profile_image_url_https; var status = feeds[i].text; var isaretweet = false; var isdirect = false; var tweetid = feeds[i].id_str; if (typeof feeds[i].retweeted_status != 'undefined') { profileimage = feeds[i].retweeted_status.user.profile_image_url_https; tweetscreenname = feeds[i].retweeted_status.user.name; tweetusername = feeds[i].retweeted_status.user.screen_name; tweetid = feeds[i].retweeted_status.id_str isaretweet = true; }; //Check to see if the tweet is a direct message if (feeds[i].text.substr(0, 1) == "@") { isdirect = true; } if (((showretweets == true) || ((isaretweet == false) && (showretweets == false))) && ((showdirecttweets == true) || ((showdirecttweets == false) && (isdirect == false)))) { if ((feeds[i].text.length > 1) && (displayCounter <= $this.options.count)) { if (showtweetlinks == true) { status = $this.addLink(status); } feedHTML += '