diff --git a/contrib/twitter_soc/main.php b/contrib/twitter_soc/main.php new file mode 100644 index 00000000..04d42c48 --- /dev/null +++ b/contrib/twitter_soc/main.php @@ -0,0 +1,23 @@ + + * License: GPLv2 + * Description: Show a twitter feed with the Sea of Clouds script + */ + +class TwitterSoc extends SimpleExtension { + public function onPostListBuilding($event) { + global $config, $page; + if(strlen($config->get_string("twitter_soc_username")) > 0) { + $this->theme->display_feed($page, $config->get_string("twitter_soc_username")); + } + } + + public function onSetupBuilding($event) { + $sb = new SetupBlock("Tweet!"); + $sb->add_text_option("twitter_soc_username", "Username "); + $event->panel->add_block($sb); + } +} +?> diff --git a/contrib/twitter_soc/script.js b/contrib/twitter_soc/script.js new file mode 100644 index 00000000..06457f3a --- /dev/null +++ b/contrib/twitter_soc/script.js @@ -0,0 +1,238 @@ +// jquery.tweet.js - See http://tweet.seaofclouds.com/ or https://github.com/seaofclouds/tweet for more info +// Copyright (c) 2008-2011 Todd Matthews & Steve Purcell +(function($) { + $.fn.tweet = function(o){ + var s = $.extend({ + username: null, // [string or array] required unless using the 'query' option; one or more twitter screen names (use 'list' option for multiple names, where possible) + list: null, // [string] optional name of list belonging to username + favorites: false, // [boolean] display the user's favorites instead of his tweets + query: null, // [string] optional search query (see also: http://search.twitter.com/operators) + avatar_size: null, // [integer] height and width of avatar if displayed (48px max) + count: 3, // [integer] how many tweets to display? + fetch: null, // [integer] how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option) + page: 1, // [integer] which page of results to fetch (if count != fetch, you'll get unexpected results) + retweets: true, // [boolean] whether to fetch (official) retweets (not supported in all display modes) + intro_text: null, // [string] do you want text BEFORE your your tweets? + outro_text: null, // [string] do you want text AFTER your tweets? + join_text: null, // [string] optional text in between date and tweet, try setting to "auto" + auto_join_text_default: "i said,", // [string] auto text for non verb: "i said" bullocks + auto_join_text_ed: "i", // [string] auto text for past tense: "i" surfed + auto_join_text_ing: "i am", // [string] auto tense for present tense: "i was" surfing + auto_join_text_reply: "i replied to", // [string] auto tense for replies: "i replied to" @someone "with" + auto_join_text_url: "i was looking at", // [string] auto tense for urls: "i was looking at" http:... + loading_text: null, // [string] optional loading text, displayed while tweets load + refresh_interval: null , // [integer] optional number of seconds after which to reload tweets + twitter_url: "twitter.com", // [string] custom twitter url, if any (apigee, etc.) + twitter_api_url: "api.twitter.com", // [string] custom twitter api url, if any (apigee, etc.) + twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.) + template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet
'+s.intro_text+'
'; + var outro = ''+s.outro_text+'
'; + var loading = $(''+s.loading_text+'
'); + + if(s.username && typeof(s.username) == "string"){ + s.username = [s.username]; + } + + $(widget).bind("tweet:load", function(){ + if (s.loading_text) $(widget).empty().append(loading); + $.getJSON(build_api_url(), function(data){ + $(widget).empty().append(list); + if (s.intro_text) list.before(intro); + list.empty(); + + var tweets = $.map(data.results || data, extract_template_data); + tweets = $.grep(tweets, s.filter).sort(s.comparator).slice(0, s.count); + list.append($.map(tweets, function(o) { return "Follow us on Twitter + + ', "left", 25)); + } +} +?> diff --git a/index.php b/index.php index 41e28b47..63c3b52c 100644 --- a/index.php +++ b/index.php @@ -57,18 +57,18 @@ if(empty($database_dsn) && !file_exists("config.php")) { require_once "config.php"; // set up and purify the environment -define("DEBUG", false); -define("COVERAGE", false); -define("CONTEXT", false); -define("CACHE_MEMCACHE", false); -define("CACHE_DIR", false); -define("CACHE_HTTP", false); -define("VERSION", 'trunk'); -define("SCORE_VERSION", 's2hack/'.VERSION); -define("COOKIE_PREFIX", 'shm'); -define("SPEED_HAX", false); -define("FORCE_NICE_URLS", false); -define("WH_SPLITS", 1); +if(!defined("DEBUG")) define("DEBUG", false); +if(!defined("COVERAGE")) define("COVERAGE", false); +if(!defined("CONTEXT")) define("CONTEXT", false); +if(!defined("CACHE_MEMCACHE")) define("CACHE_MEMCACHE", false); +if(!defined("CACHE_DIR")) define("CACHE_DIR", false); +if(!defined("CACHE_HTTP")) define("CACHE_HTTP", false); +if(!defined("VERSION")) define("VERSION", 'trunk'); +if(!defined("SCORE_VERSION")) define("SCORE_VERSION", 's2hack/'.VERSION); +if(!defined("COOKIE_PREFIX")) define("COOKIE_PREFIX", 'shm'); +if(!defined("SPEED_HAX")) define("SPEED_HAX", false); +if(!defined("FORCE_NICE_URLS")) define("FORCE_NICE_URLS", false); +if(!defined("WH_SPLITS")) define("WH_SPLITS", 1); require_once "core/util.inc.php"; require_once "lib/context.php";