From 267ab67c8325243d176e1124f2024c7b08417f37 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 30 Sep 2009 12:22:55 +0000 Subject: Script no longer needed for Realtime plugin --- plugins/Realtime/jquery.getUrlParam.js | 72 ---------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 plugins/Realtime/jquery.getUrlParam.js (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/jquery.getUrlParam.js b/plugins/Realtime/jquery.getUrlParam.js deleted file mode 100644 index e8f73eb47..000000000 --- a/plugins/Realtime/jquery.getUrlParam.js +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2006-2007 Mathias Bank (http://www.mathias-bank.de) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * Version 2.1 - * - * Thanks to - * Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing. - * Tom Leonard for some improvements - * - */ -jQuery.fn.extend({ -/** -* Returns get parameters. -* -* If the desired param does not exist, null will be returned -* -* To get the document params: -* @example value = $(document).getUrlParam("paramName"); -* -* To get the params of a html-attribut (uses src attribute) -* @example value = $('#imgLink').getUrlParam("paramName"); -*/ - getUrlParam: function(strParamName){ - strParamName = escape(unescape(strParamName)); - - var returnVal = new Array(); - var qString = null; - - if ($(this).attr("nodeName")=="#document") { - //document-handler - - if (window.location.search.search(strParamName) > -1 ){ - - qString = window.location.search.substr(1,window.location.search.length).split("&"); - } - - } else if ($(this).attr("src")!="undefined") { - - var strHref = $(this).attr("src") - if ( strHref.indexOf("?") > -1 ){ - var strQueryString = strHref.substr(strHref.indexOf("?")+1); - qString = strQueryString.split("&"); - } - } else if ($(this).attr("href")!="undefined") { - - var strHref = $(this).attr("href") - if ( strHref.indexOf("?") > -1 ){ - var strQueryString = strHref.substr(strHref.indexOf("?")+1); - qString = strQueryString.split("&"); - } - } else { - return null; - } - - - if (qString==null) return null; - - - for (var i=0;i Date: Wed, 30 Sep 2009 12:48:15 +0000 Subject: Relocated the button for pop up window for notice stream --- plugins/Realtime/realtimeupdate.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 4cd68a816..3303d3a44 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -125,14 +125,17 @@ RealtimeUpdate = { addPopup: function(url, timeline, iconurl) { - $('#content').prepend(''); + $('#notices_primary').css({'position':'relative'}); + $('#notices_primary').prepend(''); $('#realtime_timeline').css({ - 'margin':'0 0 18px 0', + 'margin':'0 0 11px 0', 'background':'transparent url('+ iconurl + ') no-repeat 0% 30%', 'padding':'0 0 0 20px', 'display':'block', - 'float':'right', + 'position':'absolute', + 'top':'-20px', + 'right':'0', 'border':'none', 'cursor':'pointer', 'color':$("a").css("color"), -- cgit v1.2.3-54-g00ecf From a57783de0214f061eca3ab65880f573e8668de03 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 30 Sep 2009 13:29:37 +0000 Subject: Timeout a little incase the notice item from XHR response is not appended to the page. --- plugins/Realtime/realtimeupdate.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 3303d3a44..11e466325 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -30,19 +30,20 @@ RealtimeUpdate = { receive: function(data) { - id = data.id; - - // Don't add it if it already exists - // - if ($("#notice-"+id).length > 0) { - return; - } - - var noticeItem = RealtimeUpdate.makeNoticeItem(data); - $("#notices_primary .notices").prepend(noticeItem); - $("#notices_primary .notice:first").css({display:"none"}); - $("#notices_primary .notice:first").fadeIn(1000); - NoticeReply(); + setTimeout(function() { + id = data.id; + + // Don't add it if it already exists + if ($("#notice-"+id).length > 0) { + return; + } + + var noticeItem = RealtimeUpdate.makeNoticeItem(data); + $("#notices_primary .notices").prepend(noticeItem); + $("#notices_primary .notice:first").css({display:"none"}); + $("#notices_primary .notice:first").fadeIn(1000); + NoticeReply(); + }, 500); }, makeNoticeItem: function(data) -- cgit v1.2.3-54-g00ecf From 091e7b908befb7d24404ea653f59b38063e04f69 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 4 Oct 2009 04:10:15 -0400 Subject: need to show scripts at end of body in RealtimePlugin --- plugins/Realtime/RealtimePlugin.php | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 0f0d0f9f4..181927968 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -230,6 +230,7 @@ class RealtimePlugin extends Plugin } $action->showContentBlock(); + $action->showScripts(); $action->elementEnd('body'); return false; // No default processing } -- cgit v1.2.3-54-g00ecf From f7d86f1cc62248c0de742bd44af5bf30e70add9d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 6 Oct 2009 16:04:36 +0000 Subject: Returning false seems to fix IE from reclaiming window focus. I think 'WTF' best describes this behaviour. Further investigation required. --- plugins/Realtime/realtimeupdate.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 11e466325..a75f17d8c 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -25,6 +25,8 @@ RealtimeUpdate = { 'border-top-color':'#AAAAAA', 'border-top-style':'solid' }); + + return false; }); }, -- cgit v1.2.3-54-g00ecf From bb08611def2309711f91c1ab6cdab92fb7c069b2 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 9 Oct 2009 14:22:18 -0700 Subject: Delete action/api.php and rename lib/twitterapi.php to lib/api.php --- actions/api.php | 306 --------- actions/apifriendshipsexists.php | 2 +- actions/apigrouplistall.php | 2 +- actions/apigroupmembership.php | 2 +- actions/apigroupshow.php | 2 +- actions/apihelptest.php | 2 +- actions/apistatusesshow.php | 4 +- actions/apistatusnetconfig.php | 2 +- actions/apistatusnetversion.php | 2 +- actions/apitimelinegroup.php | 4 +- actions/apitimelinepublic.php | 4 +- actions/apitimelinetag.php | 4 +- actions/apiusershow.php | 2 +- actions/twitapinotifications.php | 40 -- actions/twitapisearchatom.php | 6 +- actions/twitapisearchjson.php | 6 +- actions/twitapitrends.php | 6 +- lib/api.php | 1271 +++++++++++++++++++++++++++++++++++ lib/apiauth.php | 4 +- lib/twitterapi.php | 1251 ---------------------------------- plugins/Realtime/RealtimePlugin.php | 2 +- 21 files changed, 1299 insertions(+), 1625 deletions(-) delete mode 100644 actions/api.php delete mode 100644 actions/twitapinotifications.php create mode 100644 lib/api.php delete mode 100644 lib/twitterapi.php (limited to 'plugins/Realtime') diff --git a/actions/api.php b/actions/api.php deleted file mode 100644 index 1bc90de11..000000000 --- a/actions/api.php +++ /dev/null @@ -1,306 +0,0 @@ -. - * - * @category Actions - * @package Actions - * @author Evan Prodromou - * @author Brenda Wallace - * @author Jeffery To - * @author Robin Millette - * @author Tom Adams - * @author Christopher Vollick - * @author CiaranG - * @author Craig Andrews - * @author Gina Haeussge - * @author Mike Cochrane - * @author Sarven Capadisli - * @license GNU Affero General Public License http://www.gnu.org/licenses/ - * @link http://status.net - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -class ApiAction extends Action -{ - - var $user; - var $content_type; - var $api_arg; - var $api_method; - var $api_action; - var $auth_user; - var $auth_pw; - - function handle($args) - { - parent::handle($args); - - $this->api_action = $this->arg('apiaction'); - $method = $this->arg('method'); - $argument = $this->arg('argument'); - $this->basic_auth_process_header(); - - if (isset($argument)) { - $cmdext = explode('.', $argument); - $this->api_arg = $cmdext[0]; - $this->api_method = $method; - $this->content_type = strtolower($cmdext[1]); - } else { - - //Requested format / content-type will be an extension on the method - $cmdext = explode('.', $method); - $this->api_method = $cmdext[0]; - $this->content_type = strtolower($cmdext[1]); - } - - if ($this->requires_auth()) { - if (!isset($this->auth_user)) { - - //This header makes basic auth go - header('WWW-Authenticate: Basic realm="StatusNet API"'); - - //If the user hits cancel -- bam! - $this->show_basic_auth_error(); - } else { - $nickname = $this->auth_user; - $password = $this->auth_pw; - $user = common_check_user($nickname, $password); - - if ($user) { - $this->user = $user; - $this->process_command(); - } else { - //basic authentication failed - list($proxy, $ip) = common_client_ip(); - - common_log(LOG_WARNING, "Failed API auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip."); - $this->show_basic_auth_error(); - } - } - } else { - - // Caller might give us a username even if not required - if (isset($this->auth_user)) { - $user = User::staticGet('nickname', $this->auth_user); - if ($user) { - $this->user = $user; - } - //Twitter doesn't throw an error if the user isn't found - } - - $this->process_command(); - } - } - - function process_command() - { - $action = "twitapi$this->api_action"; - $actionfile = INSTALLDIR."/actions/$action.php"; - - if (file_exists($actionfile)) { - include_once $actionfile; - $action_class = ucfirst($action)."Action"; - $action_obj = new $action_class(); - - if (!$action_obj->prepare($this->args)) { - return; - } - - if (method_exists($action_obj, $this->api_method)) { - $apidata = array( 'content-type' => $this->content_type, - 'api_method' => $this->api_method, - 'api_arg' => $this->api_arg, - 'user' => $this->user); - - call_user_func(array($action_obj, $this->api_method), $_REQUEST, $apidata); - } else { - $this->clientError("API method not found!", $code = 404); - } - } else { - $this->clientError("API method not found!", $code = 404); - } - } - - // Whitelist of API methods that don't need authentication - function requires_auth() - { - static $noauth = array( 'statuses/public_timeline', - 'statuses/show', - 'users/show', - 'help/test', - 'help/downtime_schedule', - 'statusnet/version', - 'statusnet/config', - 'statusnet/wadl', - 'tags/timeline', - 'oembed/oembed', - 'groups/show', - 'groups/timeline', - 'groups/list_all', - 'groups/membership', - 'groups/is_member', - 'groups/timeline'); - - static $bareauth = array('statuses/user_timeline', - 'statuses/friends_timeline', - 'statuses/home_timeline', - 'statuses/friends', - 'statuses/replies', - 'statuses/mentions', - 'statuses/followers', - 'favorites/favorites', - 'friendships/show', - 'groups/list_groups'); - - $fullname = "$this->api_action/$this->api_method"; - - // If the site is "private", all API methods except statusnet/config - // need authentication - - if (common_config('site', 'private')) { - return $fullname != 'statusnet/config' || false; - } - - // bareauth: only needs auth if without an argument or query param specifying user - - if (in_array($fullname, $bareauth)) { - - // Special case: friendships/show only needs auth if source_id or - // source_screen_name is not specified as a param - - if ($fullname == 'friendships/show') { - - $source_id = $this->arg('source_id'); - $source_screen_name = $this->arg('source_screen_name'); - - if (empty($source_id) && empty($source_screen_name)) { - return true; - } - - return false; - } - - // if all of these are empty, auth is required - - $id = $this->arg('id'); - $user_id = $this->arg('user_id'); - $screen_name = $this->arg('screen_name'); - - if (empty($this->api_arg) - && empty($id) - && empty($user_id) - && empty($screen_name) - ) { - return true; - } else { - return false; - } - - } else if (in_array($fullname, $noauth)) { - - // noauth: never needs auth - - return false; - } else { - - // everybody else needs auth - - return true; - } - } - - function basic_auth_process_header() - { - if (isset($_SERVER['AUTHORIZATION']) || isset($_SERVER['HTTP_AUTHORIZATION'])) { - $authorization_header = isset($_SERVER['HTTP_AUTHORIZATION'])? $_SERVER['HTTP_AUTHORIZATION'] : $_SERVER['AUTHORIZATION']; - } - - if (isset($_SERVER['PHP_AUTH_USER'])) { - $this->auth_user = $_SERVER['PHP_AUTH_USER']; - $this->auth_pw = $_SERVER['PHP_AUTH_PW']; - } elseif (isset($authorization_header) && strstr(substr($authorization_header, 0, 5), 'Basic')) { - // decode the HTTP_AUTHORIZATION header on php-cgi server self - // on fcgid server the header name is AUTHORIZATION - - $auth_hash = base64_decode(substr($authorization_header, 6)); - list($this->auth_user, $this->auth_pw) = explode(':', $auth_hash); - - // set all to null on a empty basic auth request - if ($this->auth_user == "") { - $this->auth_user = null; - $this->auth_pw = null; - } - } else { - $this->auth_user = null; - $this->auth_pw = null; - } - } - - function show_basic_auth_error() - { - header('HTTP/1.1 401 Unauthorized'); - $msg = 'Could not authenticate you.'; - - if ($this->content_type == 'xml') { - header('Content-Type: application/xml; charset=utf-8'); - $this->startXML(); - $this->elementStart('hash'); - $this->element('error', null, $msg); - $this->element('request', null, $_SERVER['REQUEST_URI']); - $this->elementEnd('hash'); - $this->endXML(); - } else if ($this->content_type == 'json') { - header('Content-Type: application/json; charset=utf-8'); - $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); - print(json_encode($error_array)); - } else { - header('Content-type: text/plain'); - print "$msg\n"; - } - } - - function isReadOnly($args) - { - $apiaction = $args['apiaction']; - $method = $args['method']; - - list($cmdtext, $fmt) = explode('.', $method); - - static $write_methods = array( - 'account' => array('update_location', 'update_delivery_device', 'end_session'), - 'blocks' => array('create', 'destroy'), - 'direct_messages' => array('create', 'destroy'), - 'favorites' => array('create', 'destroy'), - 'friendships' => array('create', 'destroy'), - 'help' => array(), - 'notifications' => array('follow', 'leave'), - 'statuses' => array('update', 'destroy'), - 'users' => array() - ); - - if (array_key_exists($apiaction, $write_methods)) { - if (!in_array($cmdtext, $write_methods[$apiaction])) { - return true; - } - } - - return false; - } -} diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index 3d6e7448d..d1d5d520f 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Tests for the existence of friendship between two users. Will return true if diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index b1964d800..80dcad9dc 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/twitterapi.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * Returns of the lastest 20 groups for the site diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index 0cd3ed290..872ee45ee 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/twitterapi.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * List 20 newest members of the group specified by name or ID. diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 733c9ccfe..a38d50afe 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Outputs detailed information about the group specified by ID diff --git a/actions/apihelptest.php b/actions/apihelptest.php index 5f32165cf..2cec46462 100644 --- a/actions/apihelptest.php +++ b/actions/apihelptest.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/twitterapi.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * Returns the string "ok" in the requested format with a 200 OK HTTP status code. diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 55eea2356..9e28fe2ab 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Returns the notice specified by id as a Twitter-style status and inline user @@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * @link http://status.net/ */ -class ApiStatusesShowAction extends TwitterapiAction +class ApiStatusesShowAction extends ApiAction { var $notice_id = null; diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php index 94bd5b4b3..6847a48fe 100644 --- a/actions/apistatusnetconfig.php +++ b/actions/apistatusnetconfig.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/twitterapi.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * Gives a full dump of configuration variables for this instance diff --git a/actions/apistatusnetversion.php b/actions/apistatusnetversion.php index 471297ad5..e6f35e7d2 100644 --- a/actions/apistatusnetversion.php +++ b/actions/apistatusnetversion.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/twitterapi.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * Returns a version number for this version of StatusNet, which diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 11f73eeed..9d6ac6ad1 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/twitterapi.php'; +require_once INSTALLDIR . '/lib/api.php'; /** * Returns the most recent notices (default 20) posted to the group specified by ID @@ -43,7 +43,7 @@ require_once INSTALLDIR . '/lib/twitterapi.php'; * @link http://status.net/ */ -class ApiTimelineGroupAction extends TwitterapiAction +class ApiTimelineGroupAction extends ApiAction { var $group = null; diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index 10bde6f37..2638dd292 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Returns the most recent notices (default 20) posted by everybody @@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * @link http://status.net/ */ -class ApiTimelinePublicAction extends TwitterapiAction +class ApiTimelinePublicAction extends ApiAction { var $notices = null; diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index 2a23bb72a..0efe8d244 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Returns the 20 most recent notices tagged by a given tag @@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * @link http://status.net/ */ -class ApiTimelineTagAction extends TwitterapiAction +class ApiTimelineTagAction extends ApiAction { var $notices = null; diff --git a/actions/apiusershow.php b/actions/apiusershow.php index 2e2ceab41..afcbd3618 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Ouputs information for a user, specified by ID or screen name. diff --git a/actions/twitapinotifications.php b/actions/twitapinotifications.php deleted file mode 100644 index 0653e69ab..000000000 --- a/actions/twitapinotifications.php +++ /dev/null @@ -1,40 +0,0 @@ -. - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } - -require_once(INSTALLDIR.'/lib/twitterapi.php'); - -# This naming convention looks real sick -class TwitapinotificationsAction extends TwitterapiAction -{ - - function follow($args, $apidata) - { - parent::handle($args); - $this->serverError(_('API method under construction.'), $code=501); - } - - function leave($args, $apidata) - { - parent::handle($args); - $this->serverError(_('API method under construction.'), $code=501); - } - -} \ No newline at end of file diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 2f587d604..0ef9d2826 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Action for outputting search results in Twitter compatible Atom @@ -46,10 +46,10 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ * - * @see TwitterapiAction + * @see ApiAction */ -class TwitapisearchatomAction extends TwitterapiAction +class TwitapisearchatomAction extends ApiAction { var $cnt; diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index c628ee624..5abff6496 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; require_once INSTALLDIR.'/lib/jsonsearchresultslist.php'; /** @@ -42,10 +42,10 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php'; * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ - * @see TwitterapiAction + * @see ApiAction */ -class TwitapisearchjsonAction extends TwitterapiAction +class TwitapisearchjsonAction extends ApiAction { var $query; var $lang; diff --git a/actions/twitapitrends.php b/actions/twitapitrends.php index 83ab28f35..779405e6d 100644 --- a/actions/twitapitrends.php +++ b/actions/twitapitrends.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Returns the top ten queries that are currently trending @@ -42,10 +42,10 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ * - * @see TwitterapiAction + * @see ApiAction */ -class TwitapitrendsAction extends TwitterapiAction +class TwitapitrendsAction extends ApiAction { var $callback; diff --git a/lib/api.php b/lib/api.php new file mode 100644 index 000000000..93b4a7513 --- /dev/null +++ b/lib/api.php @@ -0,0 +1,1271 @@ +. + * + * @category API + * @package StatusNet + * @author Zach Copley + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + exit(1); +} + +/** + * Contains most of the Twitter-compatible API output functions. + * + * @category API + * @package StatusNet + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class ApiAction extends Action +{ + + /** + * Initialization. + * + * @param array $args Web and URL arguments + * + * @return boolean false if user doesn't exist + */ + + function prepare($args) + { + parent::prepare($args); + return true; + } + + /** + * Handle a request + * + * @param array $args Arguments from $_REQUEST + * + * @return void + */ + + function handle($args) + { + parent::handle($args); + } + + /** + * Overrides XMLOutputter::element to write booleans as strings (true|false). + * See that method's documentation for more info. + * + * @param string $tag Element type or tagname + * @param array $attrs Array of element attributes, as + * key-value pairs + * @param string $content string content of the element + * + * @return void + */ + function element($tag, $attrs=null, $content=null) + { + if (is_bool($content)) { + $content = ($content ? 'true' : 'false'); + } + + return parent::element($tag, $attrs, $content); + } + + function twitter_user_array($profile, $get_notice=false) + { + $twitter_user = array(); + + $twitter_user['id'] = intval($profile->id); + $twitter_user['name'] = $profile->getBestName(); + $twitter_user['screen_name'] = $profile->nickname; + $twitter_user['location'] = ($profile->location) ? $profile->location : null; + $twitter_user['description'] = ($profile->bio) ? $profile->bio : null; + + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); + $twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() : + Avatar::defaultImage(AVATAR_STREAM_SIZE); + + $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null; + $twitter_user['protected'] = false; # not supported by StatusNet yet + $twitter_user['followers_count'] = $profile->subscriberCount(); + + // To be supported soon... + $twitter_user['profile_background_color'] = ''; + $twitter_user['profile_text_color'] = ''; + $twitter_user['profile_link_color'] = ''; + $twitter_user['profile_sidebar_fill_color'] = ''; + $twitter_user['profile_sidebar_border_color'] = ''; + + $twitter_user['friends_count'] = $profile->subscriptionCount(); + + $twitter_user['created_at'] = $this->date_twitter($profile->created); + + $twitter_user['favourites_count'] = $profile->faveCount(); // British spelling! + + // Need to pull up the user for some of this + $user = User::staticGet($profile->id); + + $timezone = 'UTC'; + + if ($user->timezone) { + $timezone = $user->timezone; + } + + $t = new DateTime; + $t->setTimezone(new DateTimeZone($timezone)); + + $twitter_user['utc_offset'] = $t->format('Z'); + $twitter_user['time_zone'] = $timezone; + + // To be supported some day, perhaps + $twitter_user['profile_background_image_url'] = ''; + $twitter_user['profile_background_tile'] = false; + + $twitter_user['statuses_count'] = $profile->noticeCount(); + + // Is the requesting user following this user? + $twitter_user['following'] = false; + $twitter_user['notifications'] = false; + + if (isset($apidata['user'])) { + + $twitter_user['following'] = $apidata['user']->isSubscribed($profile); + + // Notifications on? + $sub = Subscription::pkeyGet(array('subscriber' => + $apidata['user']->id, 'subscribed' => $profile->id)); + + if ($sub) { + $twitter_user['notifications'] = ($sub->jabber || $sub->sms); + } + } + + if ($get_notice) { + $notice = $profile->getCurrentNotice(); + if ($notice) { + # don't get user! + $twitter_user['status'] = $this->twitter_status_array($notice, false); + } + } + + return $twitter_user; + } + + function twitter_status_array($notice, $include_user=true) + { + $profile = $notice->getProfile(); + + $twitter_status = array(); + $twitter_status['text'] = $notice->content; + $twitter_status['truncated'] = false; # Not possible on StatusNet + $twitter_status['created_at'] = $this->date_twitter($notice->created); + $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? + intval($notice->reply_to) : null; + $twitter_status['source'] = $this->source_link($notice->source); + $twitter_status['id'] = intval($notice->id); + + $replier_profile = null; + + if ($notice->reply_to) { + $reply = Notice::staticGet(intval($notice->reply_to)); + if ($reply) { + $replier_profile = $reply->getProfile(); + } + } + + $twitter_status['in_reply_to_user_id'] = + ($replier_profile) ? intval($replier_profile->id) : null; + $twitter_status['in_reply_to_screen_name'] = + ($replier_profile) ? $replier_profile->nickname : null; + + if (isset($this->auth_user)) { + $twitter_status['favorited'] = $this->auth_user->hasFave($notice); + } else { + $twitter_status['favorited'] = false; + } + + // Enclosures + $attachments = $notice->attachments(); + + if (!empty($attachments)) { + + $twitter_status['attachments'] = array(); + + foreach ($attachments as $attachment) { + if ($attachment->isEnclosure()) { + $enclosure = array(); + $enclosure['url'] = $attachment->url; + $enclosure['mimetype'] = $attachment->mimetype; + $enclosure['size'] = $attachment->size; + $twitter_status['attachments'][] = $enclosure; + } + } + } + + if ($include_user) { + # Don't get notice (recursive!) + $twitter_user = $this->twitter_user_array($profile, false); + $twitter_status['user'] = $twitter_user; + } + + return $twitter_status; + } + + function twitter_group_array($group) + { + $twitter_group=array(); + $twitter_group['id']=$group->id; + $twitter_group['url']=$group->permalink(); + $twitter_group['nickname']=$group->nickname; + $twitter_group['fullname']=$group->fullname; + $twitter_group['homepage_url']=$group->homepage_url; + $twitter_group['original_logo']=$group->original_logo; + $twitter_group['homepage_logo']=$group->homepage_logo; + $twitter_group['stream_logo']=$group->stream_logo; + $twitter_group['mini_logo']=$group->mini_logo; + $twitter_group['homepage']=$group->homepage; + $twitter_group['description']=$group->description; + $twitter_group['location']=$group->location; + $twitter_group['created']=$this->date_twitter($group->created); + $twitter_group['modified']=$this->date_twitter($group->modified); + return $twitter_group; + } + + function twitter_rss_group_array($group) + { + $entry = array(); + $entry['content']=$group->description; + $entry['title']=$group->nickname; + $entry['link']=$group->permalink(); + $entry['published']=common_date_iso8601($group->created); + $entry['updated']==common_date_iso8601($group->modified); + $taguribase = common_config('integration', 'groupuri'); + $entry['id'] = "group:$groupuribase:$entry[link]"; + + $entry['description'] = $entry['content']; + $entry['pubDate'] = common_date_rfc2822($group->created); + $entry['guid'] = $entry['link']; + + return $entry; + } + + function twitter_rss_entry_array($notice) + { + $profile = $notice->getProfile(); + $entry = array(); + + // We trim() to avoid extraneous whitespace in the output + + $entry['content'] = common_xml_safe_str(trim($notice->rendered)); + $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content)); + $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id)); + $entry['published'] = common_date_iso8601($notice->created); + + $taguribase = common_config('integration', 'taguri'); + $entry['id'] = "tag:$taguribase:$entry[link]"; + + $entry['updated'] = $entry['published']; + $entry['author'] = $profile->getBestName(); + + // Enclosures + $attachments = $notice->attachments(); + $enclosures = array(); + + foreach ($attachments as $attachment) { + $enclosure_o=$attachment->getEnclosure(); + if ($enclosure_o) { + $enclosure = array(); + $enclosure['url'] = $enclosure_o->url; + $enclosure['mimetype'] = $enclosure_o->mimetype; + $enclosure['size'] = $enclosure_o->size; + $enclosures[] = $enclosure; + } + } + + if (!empty($enclosures)) { + $entry['enclosures'] = $enclosures; + } + +/* + // Enclosure + $attachments = $notice->attachments(); + if($attachments){ + $entry['enclosures']=array(); + foreach($attachments as $attachment){ + if ($attachment->isEnclosure()) { + $enclosure=array(); + $enclosure['url']=$attachment->url; + $enclosure['mimetype']=$attachment->mimetype; + $enclosure['size']=$attachment->size; + $entry['enclosures'][]=$enclosure; + } + } + } +*/ + + // Tags/Categories + $tag = new Notice_tag(); + $tag->notice_id = $notice->id; + if ($tag->find()) { + $entry['tags']=array(); + while ($tag->fetch()) { + $entry['tags'][]=$tag->tag; + } + } + $tag->free(); + + // RSS Item specific + $entry['description'] = $entry['content']; + $entry['pubDate'] = common_date_rfc2822($notice->created); + $entry['guid'] = $entry['link']; + + return $entry; + } + + + function twitter_relationship_array($source, $target) + { + $relationship = array(); + + $relationship['source'] = + $this->relationship_details_array($source, $target); + $relationship['target'] = + $this->relationship_details_array($target, $source); + + return array('relationship' => $relationship); + } + + function relationship_details_array($source, $target) + { + $details = array(); + + $details['screen_name'] = $source->nickname; + $details['followed_by'] = $target->isSubscribed($source); + $details['following'] = $source->isSubscribed($target); + + $notifications = false; + + if ($source->isSubscribed($target)) { + + $sub = Subscription::pkeyGet(array('subscriber' => + $source->id, 'subscribed' => $target->id)); + + if (!empty($sub)) { + $notifications = ($sub->jabber || $sub->sms); + } + } + + $details['notifications_enabled'] = $notifications; + $details['blocking'] = $source->hasBlocked($target); + $details['id'] = $source->id; + + return $details; + } + + function show_twitter_xml_relationship($relationship) + { + $this->elementStart('relationship'); + + foreach($relationship as $element => $value) { + if ($element == 'source' || $element == 'target') { + $this->elementStart($element); + $this->show_xml_relationship_details($value); + $this->elementEnd($element); + } + } + + $this->elementEnd('relationship'); + } + + function show_xml_relationship_details($details) + { + foreach($details as $element => $value) { + $this->element($element, null, $value); + } + } + + function show_twitter_xml_status($twitter_status) + { + $this->elementStart('status'); + foreach($twitter_status as $element => $value) { + switch ($element) { + case 'user': + $this->show_twitter_xml_user($twitter_status['user']); + break; + case 'text': + $this->element($element, null, common_xml_safe_str($value)); + break; + case 'attachments': + $this->show_xml_attachments($twitter_status['attachments']); + break; + default: + $this->element($element, null, $value); + } + } + $this->elementEnd('status'); + } + + function show_twitter_xml_group($twitter_group) + { + $this->elementStart('group'); + foreach($twitter_group as $element => $value) { + $this->element($element, null, $value); + } + $this->elementEnd('group'); + } + + function show_twitter_xml_user($twitter_user, $role='user') + { + $this->elementStart($role); + foreach($twitter_user as $element => $value) { + if ($element == 'status') { + $this->show_twitter_xml_status($twitter_user['status']); + } else { + $this->element($element, null, $value); + } + } + $this->elementEnd($role); + } + + function show_xml_attachments($attachments) { + if (!empty($attachments)) { + $this->elementStart('attachments', array('type' => 'array')); + foreach ($attachments as $attachment) { + $attrs = array(); + $attrs['url'] = $attachment['url']; + $attrs['mimetype'] = $attachment['mimetype']; + $attrs['size'] = $attachment['size']; + $this->element('enclosure', $attrs, ''); + } + $this->elementEnd('attachments'); + } + } + + function show_twitter_rss_item($entry) + { + $this->elementStart('item'); + $this->element('title', null, $entry['title']); + $this->element('description', null, $entry['description']); + $this->element('pubDate', null, $entry['pubDate']); + $this->element('guid', null, $entry['guid']); + $this->element('link', null, $entry['link']); + + # RSS only supports 1 enclosure per item + if(array_key_exists('enclosures', $entry) and !empty($entry['enclosures'])){ + $enclosure = $entry['enclosures'][0]; + $this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null); + } + + if(array_key_exists('tags', $entry)){ + foreach($entry['tags'] as $tag){ + $this->element('category', null,$tag); + } + } + + $this->elementEnd('item'); + } + + function show_json_objects($objects) + { + print(json_encode($objects)); + } + + function show_single_xml_status($notice) + { + $this->init_document('xml'); + $twitter_status = $this->twitter_status_array($notice); + $this->show_twitter_xml_status($twitter_status); + $this->end_document('xml'); + } + + function show_single_json_status($notice) + { + $this->init_document('json'); + $status = $this->twitter_status_array($notice); + $this->show_json_objects($status); + $this->end_document('json'); + } + + + function show_xml_timeline($notice) + { + + $this->init_document('xml'); + $this->elementStart('statuses', array('type' => 'array')); + + if (is_array($notice)) { + foreach ($notice as $n) { + $twitter_status = $this->twitter_status_array($n); + $this->show_twitter_xml_status($twitter_status); + } + } else { + while ($notice->fetch()) { + $twitter_status = $this->twitter_status_array($notice); + $this->show_twitter_xml_status($twitter_status); + } + } + + $this->elementEnd('statuses'); + $this->end_document('xml'); + } + + function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) + { + + $this->init_document('rss'); + + $this->element('title', null, $title); + $this->element('link', null, $link); + if (!is_null($suplink)) { + # For FriendFeed's SUP protocol + $this->element('link', array('xmlns' => 'http://www.w3.org/2005/Atom', + 'rel' => 'http://api.friendfeed.com/2008/03#sup', + 'href' => $suplink, + 'type' => 'application/json')); + } + $this->element('description', null, $subtitle); + $this->element('language', null, 'en-us'); + $this->element('ttl', null, '40'); + + if (is_array($notice)) { + foreach ($notice as $n) { + $entry = $this->twitter_rss_entry_array($n); + $this->show_twitter_rss_item($entry); + } + } else { + while ($notice->fetch()) { + $entry = $this->twitter_rss_entry_array($notice); + $this->show_twitter_rss_item($entry); + } + } + + $this->end_twitter_rss(); + } + + function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null) + { + + $this->init_document('atom'); + + $this->element('title', null, $title); + $this->element('id', null, $id); + $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null); + + if (!is_null($suplink)) { + # For FriendFeed's SUP protocol + $this->element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup', + 'href' => $suplink, + 'type' => 'application/json')); + } + + if (!is_null($selfuri)) { + $this->element('link', array('href' => $selfuri, + 'rel' => 'self', 'type' => 'application/atom+xml'), null); + } + + $this->element('updated', null, common_date_iso8601('now')); + $this->element('subtitle', null, $subtitle); + + if (is_array($notice)) { + foreach ($notice as $n) { + $this->raw($n->asAtomEntry()); + } + } else { + while ($notice->fetch()) { + $this->raw($notice->asAtomEntry()); + } + } + + $this->end_document('atom'); + + } + + function show_rss_groups($group, $title, $link, $subtitle) + { + + $this->init_document('rss'); + + $this->element('title', null, $title); + $this->element('link', null, $link); + $this->element('description', null, $subtitle); + $this->element('language', null, 'en-us'); + $this->element('ttl', null, '40'); + + if (is_array($group)) { + foreach ($group as $g) { + $twitter_group = $this->twitter_rss_group_array($g); + $this->show_twitter_rss_item($twitter_group); + } + } else { + while ($group->fetch()) { + $twitter_group = $this->twitter_rss_group_array($group); + $this->show_twitter_rss_item($twitter_group); + } + } + + $this->end_twitter_rss(); + } + + + function showTwitterAtomEntry($entry) + { + $this->elementStart('entry'); + $this->element('title', null, $entry['title']); + $this->element('content', array('type' => 'html'), $entry['content']); + $this->element('id', null, $entry['id']); + $this->element('published', null, $entry['published']); + $this->element('updated', null, $entry['updated']); + $this->element('link', array('type' => 'text/html', + 'href' => $entry['link'], + 'rel' => 'alternate')); + $this->element('link', array('type' => $entry['avatar-type'], + 'href' => $entry['avatar'], + 'rel' => 'image')); + $this->elementStart('author'); + + $this->element('name', null, $entry['author-name']); + $this->element('uri', null, $entry['author-uri']); + + $this->elementEnd('author'); + $this->elementEnd('entry'); + } + + function showXmlDirectMessage($dm) + { + $this->elementStart('direct_message'); + foreach($dm as $element => $value) { + switch ($element) { + case 'sender': + case 'recipient': + $this->show_twitter_xml_user($value, $element); + break; + case 'text': + $this->element($element, null, common_xml_safe_str($value)); + break; + default: + $this->element($element, null, $value); + break; + } + } + $this->elementEnd('direct_message'); + } + + function directMessageArray($message) + { + $dmsg = array(); + + $from_profile = $message->getFrom(); + $to_profile = $message->getTo(); + + $dmsg['id'] = $message->id; + $dmsg['sender_id'] = $message->from_profile; + $dmsg['text'] = trim($message->content); + $dmsg['recipient_id'] = $message->to_profile; + $dmsg['created_at'] = $this->date_twitter($message->created); + $dmsg['sender_screen_name'] = $from_profile->nickname; + $dmsg['recipient_screen_name'] = $to_profile->nickname; + $dmsg['sender'] = $this->twitter_user_array($from_profile, false); + $dmsg['recipient'] = $this->twitter_user_array($to_profile, false); + + return $dmsg; + } + + function rssDirectMessageArray($message) + { + $entry = array(); + + $from = $message->getFrom(); + + $entry['title'] = sprintf('Message from %s to %s', + $from->nickname, $message->getTo()->nickname); + + $entry['content'] = common_xml_safe_str($message->rendered); + $entry['link'] = common_local_url('showmessage', array('message' => $message->id)); + $entry['published'] = common_date_iso8601($message->created); + + $taguribase = common_config('integration', 'taguri'); + + $entry['id'] = "tag:$taguribase:$entry[link]"; + $entry['updated'] = $entry['published']; + + $entry['author-name'] = $from->getBestName(); + $entry['author-uri'] = $from->homepage; + + $avatar = $from->getAvatar(AVATAR_STREAM_SIZE); + + $entry['avatar'] = (!empty($avatar)) ? $avatar->url : Avatar::defaultImage(AVATAR_STREAM_SIZE); + $entry['avatar-type'] = (!empty($avatar)) ? $avatar->mediatype : 'image/png'; + + // RSS item specific + + $entry['description'] = $entry['content']; + $entry['pubDate'] = common_date_rfc2822($message->created); + $entry['guid'] = $entry['link']; + + return $entry; + } + + function showSingleXmlDirectMessage($message) + { + $this->init_document('xml'); + $dmsg = $this->directMessageArray($message); + $this->showXmlDirectMessage($dmsg); + $this->end_document('xml'); + } + + function showSingleJsonDirectMessage($message) + { + $this->init_document('json'); + $dmsg = $this->directMessageArray($message); + $this->show_json_objects($dmsg); + $this->end_document('json'); + } + + function show_atom_groups($group, $title, $id, $link, $subtitle=null, $selfuri=null) + { + + $this->init_document('atom'); + + $this->element('title', null, $title); + $this->element('id', null, $id); + $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null); + + if (!is_null($selfuri)) { + $this->element('link', array('href' => $selfuri, + 'rel' => 'self', 'type' => 'application/atom+xml'), null); + } + + $this->element('updated', null, common_date_iso8601('now')); + $this->element('subtitle', null, $subtitle); + + if (is_array($group)) { + foreach ($group as $g) { + $this->raw($g->asAtomEntry()); + } + } else { + while ($group->fetch()) { + $this->raw($group->asAtomEntry()); + } + } + + $this->end_document('atom'); + + } + + function show_json_timeline($notice) + { + + $this->init_document('json'); + + $statuses = array(); + + if (is_array($notice)) { + foreach ($notice as $n) { + $twitter_status = $this->twitter_status_array($n); + array_push($statuses, $twitter_status); + } + } else { + while ($notice->fetch()) { + $twitter_status = $this->twitter_status_array($notice); + array_push($statuses, $twitter_status); + } + } + + $this->show_json_objects($statuses); + + $this->end_document('json'); + } + + function show_json_groups($group) + { + + $this->init_document('json'); + + $groups = array(); + + if (is_array($group)) { + foreach ($group as $g) { + $twitter_group = $this->twitter_group_array($g); + array_push($groups, $twitter_group); + } + } else { + while ($group->fetch()) { + $twitter_group = $this->twitter_group_array($group); + array_push($groups, $twitter_group); + } + } + + $this->show_json_objects($groups); + + $this->end_document('json'); + } + + function show_xml_groups($group) + { + + $this->init_document('xml'); + $this->elementStart('groups', array('type' => 'array')); + + if (is_array($group)) { + foreach ($group as $g) { + $twitter_group = $this->twitter_group_array($g); + $this->show_twitter_xml_group($twitter_group); + } + } else { + while ($group->fetch()) { + $twitter_group = $this->twitter_group_array($group); + $this->show_twitter_xml_group($twitter_group); + } + } + + $this->elementEnd('groups'); + $this->end_document('xml'); + } + + function show_twitter_xml_users($user) + { + + $this->init_document('xml'); + $this->elementStart('users', array('type' => 'array')); + + if (is_array($user)) { + foreach ($user as $u) { + $twitter_user = $this->twitter_user_array($u); + $this->show_twitter_xml_user($twitter_user); + } + } else { + while ($user->fetch()) { + $twitter_user = $this->twitter_user_array($user); + $this->show_twitter_xml_user($twitter_user); + } + } + + $this->elementEnd('users'); + $this->end_document('xml'); + } + + function show_json_users($user) + { + + $this->init_document('json'); + + $users = array(); + + if (is_array($user)) { + foreach ($user as $u) { + $twitter_user = $this->twitter_user_array($u); + array_push($users, $twitter_user); + } + } else { + while ($user->fetch()) { + $twitter_user = $this->twitter_user_array($user); + array_push($users, $twitter_user); + } + } + + $this->show_json_objects($users); + + $this->end_document('json'); + } + + function show_single_json_group($group) + { + $this->init_document('json'); + $twitter_group = $this->twitter_group_array($group); + $this->show_json_objects($twitter_group); + $this->end_document('json'); + } + + function show_single_xml_group($group) + { + $this->init_document('xml'); + $twitter_group = $this->twitter_group_array($group); + $this->show_twitter_xml_group($twitter_group); + $this->end_document('xml'); + } + + function date_twitter($dt) + { + $dateStr = date('d F Y H:i:s', strtotime($dt)); + $d = new DateTime($dateStr, new DateTimeZone('UTC')); + $d->setTimezone(new DateTimeZone(common_timezone())); + return $d->format('D M d H:i:s O Y'); + } + + // XXX: Candidate for a general utility method somewhere? + function count_subscriptions($profile) + { + + $count = 0; + $sub = new Subscription(); + $sub->subscribed = $profile->id; + + $count = $sub->find(); + + if ($count > 0) { + return $count - 1; + } else { + return 0; + } + } + + function init_document($type='xml') + { + switch ($type) { + case 'xml': + header('Content-Type: application/xml; charset=utf-8'); + $this->startXML(); + break; + case 'json': + header('Content-Type: application/json; charset=utf-8'); + + // Check for JSONP callback + $callback = $this->arg('callback'); + if ($callback) { + print $callback . '('; + } + break; + case 'rss': + header("Content-Type: application/rss+xml; charset=utf-8"); + $this->init_twitter_rss(); + break; + case 'atom': + header('Content-Type: application/atom+xml; charset=utf-8'); + $this->init_twitter_atom(); + break; + default: + $this->clientError(_('Not a supported data format.')); + break; + } + + return; + } + + function end_document($type='xml') + { + switch ($type) { + case 'xml': + $this->endXML(); + break; + case 'json': + + // Check for JSONP callback + $callback = $this->arg('callback'); + if ($callback) { + print ')'; + } + break; + case 'rss': + $this->end_twitter_rss(); + break; + case 'atom': + $this->end_twitter_rss(); + break; + default: + $this->clientError(_('Not a supported data format.')); + break; + } + return; + } + + function clientError($msg, $code = 400, $format = 'xml') + { + $action = $this->trimmed('action'); + + common_debug("User error '$code' on '$action': $msg", __FILE__); + + if (!array_key_exists($code, ClientErrorAction::$status)) { + $code = 400; + } + + $status_string = ClientErrorAction::$status[$code]; + + header('HTTP/1.1 '.$code.' '.$status_string); + + if ($format == 'xml') { + $this->init_document('xml'); + $this->elementStart('hash'); + $this->element('error', null, $msg); + $this->element('request', null, $_SERVER['REQUEST_URI']); + $this->elementEnd('hash'); + $this->end_document('xml'); + } elseif ($format == 'json'){ + $this->init_document('json'); + $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); + print(json_encode($error_array)); + $this->end_document('json'); + } else { + + // If user didn't request a useful format, throw a regular client error + throw new ClientException($msg, $code); + } + } + + function serverError($msg, $code = 500, $content_type = 'json') + { + $action = $this->trimmed('action'); + + common_debug("Server error '$code' on '$action': $msg", __FILE__); + + if (!array_key_exists($code, ServerErrorAction::$status)) { + $code = 400; + } + + $status_string = ServerErrorAction::$status[$code]; + + header('HTTP/1.1 '.$code.' '.$status_string); + + if ($content_type == 'xml') { + $this->init_document('xml'); + $this->elementStart('hash'); + $this->element('error', null, $msg); + $this->element('request', null, $_SERVER['REQUEST_URI']); + $this->elementEnd('hash'); + $this->end_document('xml'); + } else { + $this->init_document('json'); + $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); + print(json_encode($error_array)); + $this->end_document('json'); + } + } + + function init_twitter_rss() + { + $this->startXML(); + $this->elementStart('rss', array('version' => '2.0', 'xmlns:atom'=>'http://www.w3.org/2005/Atom')); + $this->elementStart('channel'); + Event::handle('StartApiRss', array($this)); + } + + function end_twitter_rss() + { + $this->elementEnd('channel'); + $this->elementEnd('rss'); + $this->endXML(); + } + + function init_twitter_atom() + { + $this->startXML(); + // FIXME: don't hardcode the language here! + $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', + 'xml:lang' => 'en-US', + 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0')); + Event::handle('StartApiAtom', array($this)); + } + + function end_twitter_atom() + { + $this->elementEnd('feed'); + $this->endXML(); + } + + function show_profile($profile, $content_type='xml', $notice=null, $includeStatuses=true) + { + $profile_array = $this->twitter_user_array($profile, $includeStatuses); + switch ($content_type) { + case 'xml': + $this->show_twitter_xml_user($profile_array); + break; + case 'json': + $this->show_json_objects($profile_array); + break; + default: + $this->clientError(_('Not a supported data format.')); + return; + } + return; + } + + function get_user($id, $apidata=null) + { + if (empty($id)) { + + // Twitter supports these other ways of passing the user ID + if (is_numeric($this->arg('id'))) { + return User::staticGet($this->arg('id')); + } else if ($this->arg('id')) { + $nickname = common_canonical_nickname($this->arg('id')); + return User::staticGet('nickname', $nickname); + } else if ($this->arg('user_id')) { + // This is to ensure that a non-numeric user_id still + // overrides screen_name even if it doesn't get used + if (is_numeric($this->arg('user_id'))) { + return User::staticGet('id', $this->arg('user_id')); + } + } else if ($this->arg('screen_name')) { + $nickname = common_canonical_nickname($this->arg('screen_name')); + return User::staticGet('nickname', $nickname); + } else { + // Fall back to trying the currently authenticated user + return $apidata['user']; + } + + } else if (is_numeric($id)) { + return User::staticGet($id); + } else { + $nickname = common_canonical_nickname($id); + return User::staticGet('nickname', $nickname); + } + } + + function getTargetUser($id) + { + if (empty($id)) { + + // Twitter supports these other ways of passing the user ID + if (is_numeric($this->arg('id'))) { + return User::staticGet($this->arg('id')); + } else if ($this->arg('id')) { + $nickname = common_canonical_nickname($this->arg('id')); + return User::staticGet('nickname', $nickname); + } else if ($this->arg('user_id')) { + // This is to ensure that a non-numeric user_id still + // overrides screen_name even if it doesn't get used + if (is_numeric($this->arg('user_id'))) { + return User::staticGet('id', $this->arg('user_id')); + } + } else if ($this->arg('screen_name')) { + $nickname = common_canonical_nickname($this->arg('screen_name')); + return User::staticGet('nickname', $nickname); + } else { + // Fall back to trying the currently authenticated user + return $this->auth_user; + } + + } else if (is_numeric($id)) { + return User::staticGet($id); + } else { + $nickname = common_canonical_nickname($id); + return User::staticGet('nickname', $nickname); + } + } + + function getTargetGroup($id) + { + if (empty($id)) { + if (is_numeric($this->arg('id'))) { + return User_group::staticGet($this->arg('id')); + } else if ($this->arg('id')) { + $nickname = common_canonical_nickname($this->arg('id')); + return User_group::staticGet('nickname', $nickname); + } else if ($this->arg('group_id')) { + // This is to ensure that a non-numeric user_id still + // overrides screen_name even if it doesn't get used + if (is_numeric($this->arg('group_id'))) { + return User_group::staticGet('id', $this->arg('group_id')); + } + } else if ($this->arg('group_name')) { + $nickname = common_canonical_nickname($this->arg('group_name')); + return User_group::staticGet('nickname', $nickname); + } + + } else if (is_numeric($id)) { + return User_group::staticGet($id); + } else { + $nickname = common_canonical_nickname($id); + return User_group::staticGet('nickname', $nickname); + } + } + + function get_profile($id) + { + if (is_numeric($id)) { + return Profile::staticGet($id); + } else { + $user = User::staticGet('nickname', $id); + if ($user) { + return $user->getProfile(); + } else { + return null; + } + } + } + + function source_link($source) + { + $source_name = _($source); + switch ($source) { + case 'web': + case 'xmpp': + case 'mail': + case 'omb': + case 'api': + break; + default: + $ns = Notice_source::staticGet($source); + if ($ns) { + $source_name = '' . $ns->name . ''; + } + break; + } + return $source_name; + } + + /** + * Returns query argument or default value if not found. Certain + * parameters used throughout the API are lightly scrubbed and + * bounds checked. This overrides Action::arg(). + * + * @param string $key requested argument + * @param string $def default value to return if $key is not provided + * + * @return var $var + */ + function arg($key, $def=null) + { + + // XXX: Do even more input validation/scrubbing? + + if (array_key_exists($key, $this->args)) { + switch($key) { + case 'page': + $page = (int)$this->args['page']; + return ($page < 1) ? 1 : $page; + case 'count': + $count = (int)$this->args['count']; + if ($count < 1) { + return 20; + } elseif ($count > 200) { + return 200; + } else { + return $count; + } + case 'since_id': + $since_id = (int)$this->args['since_id']; + return ($since_id < 1) ? 0 : $since_id; + case 'max_id': + $max_id = (int)$this->args['max_id']; + return ($max_id < 1) ? 0 : $max_id; + case 'since': + return strtotime($this->args['since']); + default: + return parent::arg($key, $def); + } + } else { + return $def; + } + } + +} diff --git a/lib/apiauth.php b/lib/apiauth.php index f0b4b6bf7..d7f8017eb 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -31,7 +31,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; /** * Actions extending this class will require auth @@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * @link http://status.net/ */ -class ApiAuthAction extends TwitterapiAction +class ApiAuthAction extends ApiAction { var $auth_user = null; diff --git a/lib/twitterapi.php b/lib/twitterapi.php deleted file mode 100644 index e5904cc85..000000000 --- a/lib/twitterapi.php +++ /dev/null @@ -1,1251 +0,0 @@ -. - */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -class TwitterapiAction extends Action -{ - - /** - * Initialization. - * - * @param array $args Web and URL arguments - * - * @return boolean false if user doesn't exist - */ - - function prepare($args) - { - parent::prepare($args); - return true; - } - - /** - * Handle a request - * - * @param array $args Arguments from $_REQUEST - * - * @return void - */ - - function handle($args) - { - parent::handle($args); - } - - /** - * Overrides XMLOutputter::element to write booleans as strings (true|false). - * See that method's documentation for more info. - * - * @param string $tag Element type or tagname - * @param array $attrs Array of element attributes, as - * key-value pairs - * @param string $content string content of the element - * - * @return void - */ - function element($tag, $attrs=null, $content=null) - { - if (is_bool($content)) { - $content = ($content ? 'true' : 'false'); - } - - return parent::element($tag, $attrs, $content); - } - - function twitter_user_array($profile, $get_notice=false) - { - $twitter_user = array(); - - $twitter_user['id'] = intval($profile->id); - $twitter_user['name'] = $profile->getBestName(); - $twitter_user['screen_name'] = $profile->nickname; - $twitter_user['location'] = ($profile->location) ? $profile->location : null; - $twitter_user['description'] = ($profile->bio) ? $profile->bio : null; - - $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); - $twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() : - Avatar::defaultImage(AVATAR_STREAM_SIZE); - - $twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null; - $twitter_user['protected'] = false; # not supported by StatusNet yet - $twitter_user['followers_count'] = $profile->subscriberCount(); - - // To be supported soon... - $twitter_user['profile_background_color'] = ''; - $twitter_user['profile_text_color'] = ''; - $twitter_user['profile_link_color'] = ''; - $twitter_user['profile_sidebar_fill_color'] = ''; - $twitter_user['profile_sidebar_border_color'] = ''; - - $twitter_user['friends_count'] = $profile->subscriptionCount(); - - $twitter_user['created_at'] = $this->date_twitter($profile->created); - - $twitter_user['favourites_count'] = $profile->faveCount(); // British spelling! - - // Need to pull up the user for some of this - $user = User::staticGet($profile->id); - - $timezone = 'UTC'; - - if ($user->timezone) { - $timezone = $user->timezone; - } - - $t = new DateTime; - $t->setTimezone(new DateTimeZone($timezone)); - - $twitter_user['utc_offset'] = $t->format('Z'); - $twitter_user['time_zone'] = $timezone; - - // To be supported some day, perhaps - $twitter_user['profile_background_image_url'] = ''; - $twitter_user['profile_background_tile'] = false; - - $twitter_user['statuses_count'] = $profile->noticeCount(); - - // Is the requesting user following this user? - $twitter_user['following'] = false; - $twitter_user['notifications'] = false; - - if (isset($apidata['user'])) { - - $twitter_user['following'] = $apidata['user']->isSubscribed($profile); - - // Notifications on? - $sub = Subscription::pkeyGet(array('subscriber' => - $apidata['user']->id, 'subscribed' => $profile->id)); - - if ($sub) { - $twitter_user['notifications'] = ($sub->jabber || $sub->sms); - } - } - - if ($get_notice) { - $notice = $profile->getCurrentNotice(); - if ($notice) { - # don't get user! - $twitter_user['status'] = $this->twitter_status_array($notice, false); - } - } - - return $twitter_user; - } - - function twitter_status_array($notice, $include_user=true) - { - $profile = $notice->getProfile(); - - $twitter_status = array(); - $twitter_status['text'] = $notice->content; - $twitter_status['truncated'] = false; # Not possible on StatusNet - $twitter_status['created_at'] = $this->date_twitter($notice->created); - $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? - intval($notice->reply_to) : null; - $twitter_status['source'] = $this->source_link($notice->source); - $twitter_status['id'] = intval($notice->id); - - $replier_profile = null; - - if ($notice->reply_to) { - $reply = Notice::staticGet(intval($notice->reply_to)); - if ($reply) { - $replier_profile = $reply->getProfile(); - } - } - - $twitter_status['in_reply_to_user_id'] = - ($replier_profile) ? intval($replier_profile->id) : null; - $twitter_status['in_reply_to_screen_name'] = - ($replier_profile) ? $replier_profile->nickname : null; - - if (isset($this->auth_user)) { - $twitter_status['favorited'] = $this->auth_user->hasFave($notice); - } else { - $twitter_status['favorited'] = false; - } - - // Enclosures - $attachments = $notice->attachments(); - - if (!empty($attachments)) { - - $twitter_status['attachments'] = array(); - - foreach ($attachments as $attachment) { - if ($attachment->isEnclosure()) { - $enclosure = array(); - $enclosure['url'] = $attachment->url; - $enclosure['mimetype'] = $attachment->mimetype; - $enclosure['size'] = $attachment->size; - $twitter_status['attachments'][] = $enclosure; - } - } - } - - if ($include_user) { - # Don't get notice (recursive!) - $twitter_user = $this->twitter_user_array($profile, false); - $twitter_status['user'] = $twitter_user; - } - - return $twitter_status; - } - - function twitter_group_array($group) - { - $twitter_group=array(); - $twitter_group['id']=$group->id; - $twitter_group['url']=$group->permalink(); - $twitter_group['nickname']=$group->nickname; - $twitter_group['fullname']=$group->fullname; - $twitter_group['homepage_url']=$group->homepage_url; - $twitter_group['original_logo']=$group->original_logo; - $twitter_group['homepage_logo']=$group->homepage_logo; - $twitter_group['stream_logo']=$group->stream_logo; - $twitter_group['mini_logo']=$group->mini_logo; - $twitter_group['homepage']=$group->homepage; - $twitter_group['description']=$group->description; - $twitter_group['location']=$group->location; - $twitter_group['created']=$this->date_twitter($group->created); - $twitter_group['modified']=$this->date_twitter($group->modified); - return $twitter_group; - } - - function twitter_rss_group_array($group) - { - $entry = array(); - $entry['content']=$group->description; - $entry['title']=$group->nickname; - $entry['link']=$group->permalink(); - $entry['published']=common_date_iso8601($group->created); - $entry['updated']==common_date_iso8601($group->modified); - $taguribase = common_config('integration', 'groupuri'); - $entry['id'] = "group:$groupuribase:$entry[link]"; - - $entry['description'] = $entry['content']; - $entry['pubDate'] = common_date_rfc2822($group->created); - $entry['guid'] = $entry['link']; - - return $entry; - } - - function twitter_rss_entry_array($notice) - { - $profile = $notice->getProfile(); - $entry = array(); - - // We trim() to avoid extraneous whitespace in the output - - $entry['content'] = common_xml_safe_str(trim($notice->rendered)); - $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content)); - $entry['link'] = common_local_url('shownotice', array('notice' => $notice->id)); - $entry['published'] = common_date_iso8601($notice->created); - - $taguribase = common_config('integration', 'taguri'); - $entry['id'] = "tag:$taguribase:$entry[link]"; - - $entry['updated'] = $entry['published']; - $entry['author'] = $profile->getBestName(); - - // Enclosures - $attachments = $notice->attachments(); - $enclosures = array(); - - foreach ($attachments as $attachment) { - $enclosure_o=$attachment->getEnclosure(); - if ($enclosure_o) { - $enclosure = array(); - $enclosure['url'] = $enclosure_o->url; - $enclosure['mimetype'] = $enclosure_o->mimetype; - $enclosure['size'] = $enclosure_o->size; - $enclosures[] = $enclosure; - } - } - - if (!empty($enclosures)) { - $entry['enclosures'] = $enclosures; - } - -/* - // Enclosure - $attachments = $notice->attachments(); - if($attachments){ - $entry['enclosures']=array(); - foreach($attachments as $attachment){ - if ($attachment->isEnclosure()) { - $enclosure=array(); - $enclosure['url']=$attachment->url; - $enclosure['mimetype']=$attachment->mimetype; - $enclosure['size']=$attachment->size; - $entry['enclosures'][]=$enclosure; - } - } - } -*/ - - // Tags/Categories - $tag = new Notice_tag(); - $tag->notice_id = $notice->id; - if ($tag->find()) { - $entry['tags']=array(); - while ($tag->fetch()) { - $entry['tags'][]=$tag->tag; - } - } - $tag->free(); - - // RSS Item specific - $entry['description'] = $entry['content']; - $entry['pubDate'] = common_date_rfc2822($notice->created); - $entry['guid'] = $entry['link']; - - return $entry; - } - - - function twitter_relationship_array($source, $target) - { - $relationship = array(); - - $relationship['source'] = - $this->relationship_details_array($source, $target); - $relationship['target'] = - $this->relationship_details_array($target, $source); - - return array('relationship' => $relationship); - } - - function relationship_details_array($source, $target) - { - $details = array(); - - $details['screen_name'] = $source->nickname; - $details['followed_by'] = $target->isSubscribed($source); - $details['following'] = $source->isSubscribed($target); - - $notifications = false; - - if ($source->isSubscribed($target)) { - - $sub = Subscription::pkeyGet(array('subscriber' => - $source->id, 'subscribed' => $target->id)); - - if (!empty($sub)) { - $notifications = ($sub->jabber || $sub->sms); - } - } - - $details['notifications_enabled'] = $notifications; - $details['blocking'] = $source->hasBlocked($target); - $details['id'] = $source->id; - - return $details; - } - - function show_twitter_xml_relationship($relationship) - { - $this->elementStart('relationship'); - - foreach($relationship as $element => $value) { - if ($element == 'source' || $element == 'target') { - $this->elementStart($element); - $this->show_xml_relationship_details($value); - $this->elementEnd($element); - } - } - - $this->elementEnd('relationship'); - } - - function show_xml_relationship_details($details) - { - foreach($details as $element => $value) { - $this->element($element, null, $value); - } - } - - function show_twitter_xml_status($twitter_status) - { - $this->elementStart('status'); - foreach($twitter_status as $element => $value) { - switch ($element) { - case 'user': - $this->show_twitter_xml_user($twitter_status['user']); - break; - case 'text': - $this->element($element, null, common_xml_safe_str($value)); - break; - case 'attachments': - $this->show_xml_attachments($twitter_status['attachments']); - break; - default: - $this->element($element, null, $value); - } - } - $this->elementEnd('status'); - } - - function show_twitter_xml_group($twitter_group) - { - $this->elementStart('group'); - foreach($twitter_group as $element => $value) { - $this->element($element, null, $value); - } - $this->elementEnd('group'); - } - - function show_twitter_xml_user($twitter_user, $role='user') - { - $this->elementStart($role); - foreach($twitter_user as $element => $value) { - if ($element == 'status') { - $this->show_twitter_xml_status($twitter_user['status']); - } else { - $this->element($element, null, $value); - } - } - $this->elementEnd($role); - } - - function show_xml_attachments($attachments) { - if (!empty($attachments)) { - $this->elementStart('attachments', array('type' => 'array')); - foreach ($attachments as $attachment) { - $attrs = array(); - $attrs['url'] = $attachment['url']; - $attrs['mimetype'] = $attachment['mimetype']; - $attrs['size'] = $attachment['size']; - $this->element('enclosure', $attrs, ''); - } - $this->elementEnd('attachments'); - } - } - - function show_twitter_rss_item($entry) - { - $this->elementStart('item'); - $this->element('title', null, $entry['title']); - $this->element('description', null, $entry['description']); - $this->element('pubDate', null, $entry['pubDate']); - $this->element('guid', null, $entry['guid']); - $this->element('link', null, $entry['link']); - - # RSS only supports 1 enclosure per item - if(array_key_exists('enclosures', $entry) and !empty($entry['enclosures'])){ - $enclosure = $entry['enclosures'][0]; - $this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null); - } - - if(array_key_exists('tags', $entry)){ - foreach($entry['tags'] as $tag){ - $this->element('category', null,$tag); - } - } - - $this->elementEnd('item'); - } - - function show_json_objects($objects) - { - print(json_encode($objects)); - } - - function show_single_xml_status($notice) - { - $this->init_document('xml'); - $twitter_status = $this->twitter_status_array($notice); - $this->show_twitter_xml_status($twitter_status); - $this->end_document('xml'); - } - - function show_single_json_status($notice) - { - $this->init_document('json'); - $status = $this->twitter_status_array($notice); - $this->show_json_objects($status); - $this->end_document('json'); - } - - - function show_xml_timeline($notice) - { - - $this->init_document('xml'); - $this->elementStart('statuses', array('type' => 'array')); - - if (is_array($notice)) { - foreach ($notice as $n) { - $twitter_status = $this->twitter_status_array($n); - $this->show_twitter_xml_status($twitter_status); - } - } else { - while ($notice->fetch()) { - $twitter_status = $this->twitter_status_array($notice); - $this->show_twitter_xml_status($twitter_status); - } - } - - $this->elementEnd('statuses'); - $this->end_document('xml'); - } - - function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) - { - - $this->init_document('rss'); - - $this->element('title', null, $title); - $this->element('link', null, $link); - if (!is_null($suplink)) { - # For FriendFeed's SUP protocol - $this->element('link', array('xmlns' => 'http://www.w3.org/2005/Atom', - 'rel' => 'http://api.friendfeed.com/2008/03#sup', - 'href' => $suplink, - 'type' => 'application/json')); - } - $this->element('description', null, $subtitle); - $this->element('language', null, 'en-us'); - $this->element('ttl', null, '40'); - - if (is_array($notice)) { - foreach ($notice as $n) { - $entry = $this->twitter_rss_entry_array($n); - $this->show_twitter_rss_item($entry); - } - } else { - while ($notice->fetch()) { - $entry = $this->twitter_rss_entry_array($notice); - $this->show_twitter_rss_item($entry); - } - } - - $this->end_twitter_rss(); - } - - function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null) - { - - $this->init_document('atom'); - - $this->element('title', null, $title); - $this->element('id', null, $id); - $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null); - - if (!is_null($suplink)) { - # For FriendFeed's SUP protocol - $this->element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup', - 'href' => $suplink, - 'type' => 'application/json')); - } - - if (!is_null($selfuri)) { - $this->element('link', array('href' => $selfuri, - 'rel' => 'self', 'type' => 'application/atom+xml'), null); - } - - $this->element('updated', null, common_date_iso8601('now')); - $this->element('subtitle', null, $subtitle); - - if (is_array($notice)) { - foreach ($notice as $n) { - $this->raw($n->asAtomEntry()); - } - } else { - while ($notice->fetch()) { - $this->raw($notice->asAtomEntry()); - } - } - - $this->end_document('atom'); - - } - - function show_rss_groups($group, $title, $link, $subtitle) - { - - $this->init_document('rss'); - - $this->element('title', null, $title); - $this->element('link', null, $link); - $this->element('description', null, $subtitle); - $this->element('language', null, 'en-us'); - $this->element('ttl', null, '40'); - - if (is_array($group)) { - foreach ($group as $g) { - $twitter_group = $this->twitter_rss_group_array($g); - $this->show_twitter_rss_item($twitter_group); - } - } else { - while ($group->fetch()) { - $twitter_group = $this->twitter_rss_group_array($group); - $this->show_twitter_rss_item($twitter_group); - } - } - - $this->end_twitter_rss(); - } - - - function showTwitterAtomEntry($entry) - { - $this->elementStart('entry'); - $this->element('title', null, $entry['title']); - $this->element('content', array('type' => 'html'), $entry['content']); - $this->element('id', null, $entry['id']); - $this->element('published', null, $entry['published']); - $this->element('updated', null, $entry['updated']); - $this->element('link', array('type' => 'text/html', - 'href' => $entry['link'], - 'rel' => 'alternate')); - $this->element('link', array('type' => $entry['avatar-type'], - 'href' => $entry['avatar'], - 'rel' => 'image')); - $this->elementStart('author'); - - $this->element('name', null, $entry['author-name']); - $this->element('uri', null, $entry['author-uri']); - - $this->elementEnd('author'); - $this->elementEnd('entry'); - } - - function showXmlDirectMessage($dm) - { - $this->elementStart('direct_message'); - foreach($dm as $element => $value) { - switch ($element) { - case 'sender': - case 'recipient': - $this->show_twitter_xml_user($value, $element); - break; - case 'text': - $this->element($element, null, common_xml_safe_str($value)); - break; - default: - $this->element($element, null, $value); - break; - } - } - $this->elementEnd('direct_message'); - } - - function directMessageArray($message) - { - $dmsg = array(); - - $from_profile = $message->getFrom(); - $to_profile = $message->getTo(); - - $dmsg['id'] = $message->id; - $dmsg['sender_id'] = $message->from_profile; - $dmsg['text'] = trim($message->content); - $dmsg['recipient_id'] = $message->to_profile; - $dmsg['created_at'] = $this->date_twitter($message->created); - $dmsg['sender_screen_name'] = $from_profile->nickname; - $dmsg['recipient_screen_name'] = $to_profile->nickname; - $dmsg['sender'] = $this->twitter_user_array($from_profile, false); - $dmsg['recipient'] = $this->twitter_user_array($to_profile, false); - - return $dmsg; - } - - function rssDirectMessageArray($message) - { - $entry = array(); - - $from = $message->getFrom(); - - $entry['title'] = sprintf('Message from %s to %s', - $from->nickname, $message->getTo()->nickname); - - $entry['content'] = common_xml_safe_str($message->rendered); - $entry['link'] = common_local_url('showmessage', array('message' => $message->id)); - $entry['published'] = common_date_iso8601($message->created); - - $taguribase = common_config('integration', 'taguri'); - - $entry['id'] = "tag:$taguribase:$entry[link]"; - $entry['updated'] = $entry['published']; - - $entry['author-name'] = $from->getBestName(); - $entry['author-uri'] = $from->homepage; - - $avatar = $from->getAvatar(AVATAR_STREAM_SIZE); - - $entry['avatar'] = (!empty($avatar)) ? $avatar->url : Avatar::defaultImage(AVATAR_STREAM_SIZE); - $entry['avatar-type'] = (!empty($avatar)) ? $avatar->mediatype : 'image/png'; - - // RSS item specific - - $entry['description'] = $entry['content']; - $entry['pubDate'] = common_date_rfc2822($message->created); - $entry['guid'] = $entry['link']; - - return $entry; - } - - function showSingleXmlDirectMessage($message) - { - $this->init_document('xml'); - $dmsg = $this->directMessageArray($message); - $this->showXmlDirectMessage($dmsg); - $this->end_document('xml'); - } - - function showSingleJsonDirectMessage($message) - { - $this->init_document('json'); - $dmsg = $this->directMessageArray($message); - $this->show_json_objects($dmsg); - $this->end_document('json'); - } - - function show_atom_groups($group, $title, $id, $link, $subtitle=null, $selfuri=null) - { - - $this->init_document('atom'); - - $this->element('title', null, $title); - $this->element('id', null, $id); - $this->element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), null); - - if (!is_null($selfuri)) { - $this->element('link', array('href' => $selfuri, - 'rel' => 'self', 'type' => 'application/atom+xml'), null); - } - - $this->element('updated', null, common_date_iso8601('now')); - $this->element('subtitle', null, $subtitle); - - if (is_array($group)) { - foreach ($group as $g) { - $this->raw($g->asAtomEntry()); - } - } else { - while ($group->fetch()) { - $this->raw($group->asAtomEntry()); - } - } - - $this->end_document('atom'); - - } - - function show_json_timeline($notice) - { - - $this->init_document('json'); - - $statuses = array(); - - if (is_array($notice)) { - foreach ($notice as $n) { - $twitter_status = $this->twitter_status_array($n); - array_push($statuses, $twitter_status); - } - } else { - while ($notice->fetch()) { - $twitter_status = $this->twitter_status_array($notice); - array_push($statuses, $twitter_status); - } - } - - $this->show_json_objects($statuses); - - $this->end_document('json'); - } - - function show_json_groups($group) - { - - $this->init_document('json'); - - $groups = array(); - - if (is_array($group)) { - foreach ($group as $g) { - $twitter_group = $this->twitter_group_array($g); - array_push($groups, $twitter_group); - } - } else { - while ($group->fetch()) { - $twitter_group = $this->twitter_group_array($group); - array_push($groups, $twitter_group); - } - } - - $this->show_json_objects($groups); - - $this->end_document('json'); - } - - function show_xml_groups($group) - { - - $this->init_document('xml'); - $this->elementStart('groups', array('type' => 'array')); - - if (is_array($group)) { - foreach ($group as $g) { - $twitter_group = $this->twitter_group_array($g); - $this->show_twitter_xml_group($twitter_group); - } - } else { - while ($group->fetch()) { - $twitter_group = $this->twitter_group_array($group); - $this->show_twitter_xml_group($twitter_group); - } - } - - $this->elementEnd('groups'); - $this->end_document('xml'); - } - - function show_twitter_xml_users($user) - { - - $this->init_document('xml'); - $this->elementStart('users', array('type' => 'array')); - - if (is_array($user)) { - foreach ($user as $u) { - $twitter_user = $this->twitter_user_array($u); - $this->show_twitter_xml_user($twitter_user); - } - } else { - while ($user->fetch()) { - $twitter_user = $this->twitter_user_array($user); - $this->show_twitter_xml_user($twitter_user); - } - } - - $this->elementEnd('users'); - $this->end_document('xml'); - } - - function show_json_users($user) - { - - $this->init_document('json'); - - $users = array(); - - if (is_array($user)) { - foreach ($user as $u) { - $twitter_user = $this->twitter_user_array($u); - array_push($users, $twitter_user); - } - } else { - while ($user->fetch()) { - $twitter_user = $this->twitter_user_array($user); - array_push($users, $twitter_user); - } - } - - $this->show_json_objects($users); - - $this->end_document('json'); - } - - function show_single_json_group($group) - { - $this->init_document('json'); - $twitter_group = $this->twitter_group_array($group); - $this->show_json_objects($twitter_group); - $this->end_document('json'); - } - - function show_single_xml_group($group) - { - $this->init_document('xml'); - $twitter_group = $this->twitter_group_array($group); - $this->show_twitter_xml_group($twitter_group); - $this->end_document('xml'); - } - - function date_twitter($dt) - { - $dateStr = date('d F Y H:i:s', strtotime($dt)); - $d = new DateTime($dateStr, new DateTimeZone('UTC')); - $d->setTimezone(new DateTimeZone(common_timezone())); - return $d->format('D M d H:i:s O Y'); - } - - // XXX: Candidate for a general utility method somewhere? - function count_subscriptions($profile) - { - - $count = 0; - $sub = new Subscription(); - $sub->subscribed = $profile->id; - - $count = $sub->find(); - - if ($count > 0) { - return $count - 1; - } else { - return 0; - } - } - - function init_document($type='xml') - { - switch ($type) { - case 'xml': - header('Content-Type: application/xml; charset=utf-8'); - $this->startXML(); - break; - case 'json': - header('Content-Type: application/json; charset=utf-8'); - - // Check for JSONP callback - $callback = $this->arg('callback'); - if ($callback) { - print $callback . '('; - } - break; - case 'rss': - header("Content-Type: application/rss+xml; charset=utf-8"); - $this->init_twitter_rss(); - break; - case 'atom': - header('Content-Type: application/atom+xml; charset=utf-8'); - $this->init_twitter_atom(); - break; - default: - $this->clientError(_('Not a supported data format.')); - break; - } - - return; - } - - function end_document($type='xml') - { - switch ($type) { - case 'xml': - $this->endXML(); - break; - case 'json': - - // Check for JSONP callback - $callback = $this->arg('callback'); - if ($callback) { - print ')'; - } - break; - case 'rss': - $this->end_twitter_rss(); - break; - case 'atom': - $this->end_twitter_rss(); - break; - default: - $this->clientError(_('Not a supported data format.')); - break; - } - return; - } - - function clientError($msg, $code = 400, $format = 'xml') - { - $action = $this->trimmed('action'); - - common_debug("User error '$code' on '$action': $msg", __FILE__); - - if (!array_key_exists($code, ClientErrorAction::$status)) { - $code = 400; - } - - $status_string = ClientErrorAction::$status[$code]; - - header('HTTP/1.1 '.$code.' '.$status_string); - - if ($format == 'xml') { - $this->init_document('xml'); - $this->elementStart('hash'); - $this->element('error', null, $msg); - $this->element('request', null, $_SERVER['REQUEST_URI']); - $this->elementEnd('hash'); - $this->end_document('xml'); - } elseif ($format == 'json'){ - $this->init_document('json'); - $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); - print(json_encode($error_array)); - $this->end_document('json'); - } else { - - // If user didn't request a useful format, throw a regular client error - throw new ClientException($msg, $code); - } - } - - function serverError($msg, $code = 500, $content_type = 'json') - { - $action = $this->trimmed('action'); - - common_debug("Server error '$code' on '$action': $msg", __FILE__); - - if (!array_key_exists($code, ServerErrorAction::$status)) { - $code = 400; - } - - $status_string = ServerErrorAction::$status[$code]; - - header('HTTP/1.1 '.$code.' '.$status_string); - - if ($content_type == 'xml') { - $this->init_document('xml'); - $this->elementStart('hash'); - $this->element('error', null, $msg); - $this->element('request', null, $_SERVER['REQUEST_URI']); - $this->elementEnd('hash'); - $this->end_document('xml'); - } else { - $this->init_document('json'); - $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); - print(json_encode($error_array)); - $this->end_document('json'); - } - } - - function init_twitter_rss() - { - $this->startXML(); - $this->elementStart('rss', array('version' => '2.0', 'xmlns:atom'=>'http://www.w3.org/2005/Atom')); - $this->elementStart('channel'); - Event::handle('StartApiRss', array($this)); - } - - function end_twitter_rss() - { - $this->elementEnd('channel'); - $this->elementEnd('rss'); - $this->endXML(); - } - - function init_twitter_atom() - { - $this->startXML(); - // FIXME: don't hardcode the language here! - $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', - 'xml:lang' => 'en-US', - 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0')); - Event::handle('StartApiAtom', array($this)); - } - - function end_twitter_atom() - { - $this->elementEnd('feed'); - $this->endXML(); - } - - function show_profile($profile, $content_type='xml', $notice=null, $includeStatuses=true) - { - $profile_array = $this->twitter_user_array($profile, $includeStatuses); - switch ($content_type) { - case 'xml': - $this->show_twitter_xml_user($profile_array); - break; - case 'json': - $this->show_json_objects($profile_array); - break; - default: - $this->clientError(_('Not a supported data format.')); - return; - } - return; - } - - function get_user($id, $apidata=null) - { - if (empty($id)) { - - // Twitter supports these other ways of passing the user ID - if (is_numeric($this->arg('id'))) { - return User::staticGet($this->arg('id')); - } else if ($this->arg('id')) { - $nickname = common_canonical_nickname($this->arg('id')); - return User::staticGet('nickname', $nickname); - } else if ($this->arg('user_id')) { - // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it doesn't get used - if (is_numeric($this->arg('user_id'))) { - return User::staticGet('id', $this->arg('user_id')); - } - } else if ($this->arg('screen_name')) { - $nickname = common_canonical_nickname($this->arg('screen_name')); - return User::staticGet('nickname', $nickname); - } else { - // Fall back to trying the currently authenticated user - return $apidata['user']; - } - - } else if (is_numeric($id)) { - return User::staticGet($id); - } else { - $nickname = common_canonical_nickname($id); - return User::staticGet('nickname', $nickname); - } - } - - function getTargetUser($id) - { - if (empty($id)) { - - // Twitter supports these other ways of passing the user ID - if (is_numeric($this->arg('id'))) { - return User::staticGet($this->arg('id')); - } else if ($this->arg('id')) { - $nickname = common_canonical_nickname($this->arg('id')); - return User::staticGet('nickname', $nickname); - } else if ($this->arg('user_id')) { - // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it doesn't get used - if (is_numeric($this->arg('user_id'))) { - return User::staticGet('id', $this->arg('user_id')); - } - } else if ($this->arg('screen_name')) { - $nickname = common_canonical_nickname($this->arg('screen_name')); - return User::staticGet('nickname', $nickname); - } else { - // Fall back to trying the currently authenticated user - return $this->auth_user; - } - - } else if (is_numeric($id)) { - return User::staticGet($id); - } else { - $nickname = common_canonical_nickname($id); - return User::staticGet('nickname', $nickname); - } - } - - function getTargetGroup($id) - { - if (empty($id)) { - if (is_numeric($this->arg('id'))) { - return User_group::staticGet($this->arg('id')); - } else if ($this->arg('id')) { - $nickname = common_canonical_nickname($this->arg('id')); - return User_group::staticGet('nickname', $nickname); - } else if ($this->arg('group_id')) { - // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it doesn't get used - if (is_numeric($this->arg('group_id'))) { - return User_group::staticGet('id', $this->arg('group_id')); - } - } else if ($this->arg('group_name')) { - $nickname = common_canonical_nickname($this->arg('group_name')); - return User_group::staticGet('nickname', $nickname); - } - - } else if (is_numeric($id)) { - return User_group::staticGet($id); - } else { - $nickname = common_canonical_nickname($id); - return User_group::staticGet('nickname', $nickname); - } - } - - function get_profile($id) - { - if (is_numeric($id)) { - return Profile::staticGet($id); - } else { - $user = User::staticGet('nickname', $id); - if ($user) { - return $user->getProfile(); - } else { - return null; - } - } - } - - function source_link($source) - { - $source_name = _($source); - switch ($source) { - case 'web': - case 'xmpp': - case 'mail': - case 'omb': - case 'api': - break; - default: - $ns = Notice_source::staticGet($source); - if ($ns) { - $source_name = '' . $ns->name . ''; - } - break; - } - return $source_name; - } - - /** - * Returns query argument or default value if not found. Certain - * parameters used throughout the API are lightly scrubbed and - * bounds checked. This overrides Action::arg(). - * - * @param string $key requested argument - * @param string $def default value to return if $key is not provided - * - * @return var $var - */ - function arg($key, $def=null) - { - - // XXX: Do even more input validation/scrubbing? - - if (array_key_exists($key, $this->args)) { - switch($key) { - case 'page': - $page = (int)$this->args['page']; - return ($page < 1) ? 1 : $page; - case 'count': - $count = (int)$this->args['count']; - if ($count < 1) { - return 20; - } elseif ($count > 200) { - return 200; - } else { - return $count; - } - case 'since_id': - $since_id = (int)$this->args['since_id']; - return ($since_id < 1) ? 0 : $since_id; - case 'max_id': - $max_id = (int)$this->args['max_id']; - return ($max_id < 1) ? 0 : $max_id; - case 'since': - return strtotime($this->args['since']); - default: - return parent::arg($key, $def); - } - } else { - return $def; - } - } - -} diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 181927968..31e75221b 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -242,7 +242,7 @@ class RealtimePlugin extends Plugin // of refactoring from within a plugin, so I'm just abusing // the TwitterApiAction method. Don't do this unless you're me! - require_once(INSTALLDIR.'/lib/twitterapi.php'); + require_once(INSTALLDIR.'/lib/api.php'); $act = new TwitterApiAction('/dev/null'); -- cgit v1.2.3-54-g00ecf From 57dfad64beae100187dcaf3c205645e89611e115 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 9 Oct 2009 17:21:22 -0700 Subject: Missed some of the references to the old TwitterApiAction - removed --- actions/apiaccountverifycredentials.php | 5 +++-- actions/apifriendshipsexists.php | 2 +- actions/apigrouplistall.php | 2 +- actions/apigroupmembership.php | 2 +- actions/apigroupshow.php | 2 +- actions/apihelptest.php | 2 +- actions/apistatusnetconfig.php | 2 +- actions/apistatusnetversion.php | 2 +- actions/apiusershow.php | 2 +- plugins/Realtime/RealtimePlugin.php | 4 ++-- 10 files changed, 13 insertions(+), 12 deletions(-) (limited to 'plugins/Realtime') diff --git a/actions/apiaccountverifycredentials.php b/actions/apiaccountverifycredentials.php index 104b9867f..8b976bbf3 100644 --- a/actions/apiaccountverifycredentials.php +++ b/actions/apiaccountverifycredentials.php @@ -67,8 +67,9 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction case 'json': $args['id'] = $this->auth_user->id; $action_obj = new ApiUserShowAction(); - $action_obj->prepare($args); - $action_obj->handle($args); + if ($action_obj->prepare($args)) { + $action_obj->handle($args); + } break; default: header('Content-Type: text/html; charset=utf-8'); diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index 1ebfc9e8f..df9f0c949 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/api.php'; * @link http://status.net/ */ -class ApiFriendshipsExistsAction extends TwitterApiAction +class ApiFriendshipsExistsAction extends ApiAction { var $user_a = null; var $user_b = null; diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index a0f04ed76..070927b1e 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -43,7 +43,7 @@ require_once INSTALLDIR . '/lib/api.php'; * @link http://status.net/ */ -class ApiGroupListAllAction extends TwitterApiAction +class ApiGroupListAllAction extends ApiAction { var $page = null; var $count = null; diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index da510ff26..0e9510d71 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -43,7 +43,7 @@ require_once INSTALLDIR . '/lib/api.php'; * @link http://status.net/ */ -class ApiGroupMembershipAction extends TwitterApiAction +class ApiGroupMembershipAction extends ApiAction { var $page = null; var $count = null; diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index cdaf707aa..262fe6718 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -43,7 +43,7 @@ require_once INSTALLDIR.'/lib/api.php'; * @link http://status.net/ */ -class ApiGroupShowAction extends TwitterApiAction +class ApiGroupShowAction extends ApiAction { var $group = null; diff --git a/actions/apihelptest.php b/actions/apihelptest.php index ac1bb1a5b..cd5b86cf9 100644 --- a/actions/apihelptest.php +++ b/actions/apihelptest.php @@ -43,7 +43,7 @@ require_once INSTALLDIR . '/lib/api.php'; * @link http://status.net/ */ -class ApiHelpTestAction extends TwitterApiAction +class ApiHelpTestAction extends ApiAction { /** diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php index 6fb65331f..356942a85 100644 --- a/actions/apistatusnetconfig.php +++ b/actions/apistatusnetconfig.php @@ -47,7 +47,7 @@ require_once INSTALLDIR . '/lib/api.php'; * @link http://status.net/ */ -class ApiStatusnetConfigAction extends TwitterApiAction +class ApiStatusnetConfigAction extends ApiAction { var $keys = array( 'site' => array('name', 'server', 'theme', 'path', 'fancy', 'language', diff --git a/actions/apistatusnetversion.php b/actions/apistatusnetversion.php index 2cd99edb7..fb632fd93 100644 --- a/actions/apistatusnetversion.php +++ b/actions/apistatusnetversion.php @@ -46,7 +46,7 @@ require_once INSTALLDIR . '/lib/api.php'; * @link http://status.net/ */ -class ApiStatusnetVersionAction extends TwitterApiAction +class ApiStatusnetVersionAction extends ApiAction { /** * Take arguments for running diff --git a/actions/apiusershow.php b/actions/apiusershow.php index 1cd0cdfd5..442efc194 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -44,7 +44,7 @@ require_once INSTALLDIR.'/lib/api.php'; * @link http://status.net/ */ -class ApiUserShowAction extends TwitterApiAction +class ApiUserShowAction extends ApiAction { var $user = null; diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 31e75221b..9a750bbc8 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -240,11 +240,11 @@ class RealtimePlugin extends Plugin // FIXME: this code should be abstracted to a neutral third // party, like Notice::asJson(). I'm not sure of the ethics // of refactoring from within a plugin, so I'm just abusing - // the TwitterApiAction method. Don't do this unless you're me! + // the ApiAction method. Don't do this unless you're me! require_once(INSTALLDIR.'/lib/api.php'); - $act = new TwitterApiAction('/dev/null'); + $act = new ApiAction('/dev/null'); $arr = $act->twitter_status_array($notice, true); $arr['url'] = $notice->bestUrl(); -- cgit v1.2.3-54-g00ecf From 061af8fa06ccb98f667d1ee670da2dbb179d8b0e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 9 Oct 2009 17:53:35 -0700 Subject: CamelCase all function names in the API code --- actions/apiaccountratelimitstatus.php | 4 +- actions/apiblockcreate.php | 6 +- actions/apiblockdestroy.php | 6 +- actions/apidirectmessage.php | 20 +-- actions/apifavoritecreate.php | 2 +- actions/apifavoritedestroy.php | 2 +- actions/apifriendshipscreate.php | 6 +- actions/apifriendshipsdestroy.php | 6 +- actions/apifriendshipsexists.php | 8 +- actions/apifriendshipsshow.php | 12 +- actions/apigroupismember.php | 10 +- actions/apigroupjoin.php | 2 +- actions/apigroupleave.php | 2 +- actions/apigrouplist.php | 8 +- actions/apigrouplistall.php | 8 +- actions/apigroupmembership.php | 4 +- actions/apigroupshow.php | 2 +- actions/apihelptest.php | 8 +- actions/apistatusesdestroy.php | 4 +- actions/apistatusesshow.php | 2 +- actions/apistatusesupdate.php | 2 +- actions/apistatusnetconfig.php | 10 +- actions/apistatusnetversion.php | 8 +- actions/apisubscriptions.php | 8 +- actions/apitimelinefavorites.php | 8 +- actions/apitimelinefriends.php | 8 +- actions/apitimelinegroup.php | 8 +- actions/apitimelinementions.php | 8 +- actions/apitimelinepublic.php | 8 +- actions/apitimelinetag.php | 8 +- actions/apitimelineuser.php | 8 +- actions/apiusershow.php | 14 +- actions/twitapisearchatom.php | 2 +- actions/twitapisearchjson.php | 4 +- lib/api.php | 295 ++++++++++++++++------------------ lib/twitter.php | 4 +- plugins/Realtime/RealtimePlugin.php | 2 +- 37 files changed, 255 insertions(+), 272 deletions(-) (limited to 'plugins/Realtime') diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php index b823e1cd2..af86dae6a 100644 --- a/actions/apiaccountratelimitstatus.php +++ b/actions/apiaccountratelimitstatus.php @@ -73,7 +73,7 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction $reset = new DateTime(); $reset->modify('+1 hour'); - $this->init_document($this->format); + $this->initDocument($this->format); if ($this->format == 'xml') { $this->elementStart('hash'); @@ -101,7 +101,7 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction print json_encode($out); } - $this->end_document($this->format); + $this->endDocument($this->format); } } diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php index 6dd28dd5e..e003e5ee9 100644 --- a/actions/apiblockcreate.php +++ b/actions/apiblockcreate.php @@ -100,9 +100,9 @@ class ApiBlockCreateAction extends ApiAuthAction if ($this->user->hasBlocked($this->other) || $this->user->block($this->other) ) { - $this->init_document($this->format); - $this->show_profile($this->other, $this->format); - $this->end_document($this->format); + $this->initDocument($this->format); + $this->showProfile($this->other, $this->format); + $this->endDocument($this->format); } else { $this->serverError(_('Block user failed.'), 500, $this->format); } diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php index a869dfe46..470b60ea5 100644 --- a/actions/apiblockdestroy.php +++ b/actions/apiblockdestroy.php @@ -99,9 +99,9 @@ class ApiBlockDestroyAction extends ApiAuthAction if (!$this->user->hasBlocked($this->other) || $this->user->unblock($this->other) ) { - $this->init_document($this->format); - $this->show_profile($this->other, $this->format); - $this->end_document($this->format); + $this->initDocument($this->format); + $this->showProfile($this->other, $this->format); + $this->endDocument($this->format); } else { $this->serverError(_('Unblock user failed.')); } diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index f0013c54c..4e55886d9 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -230,7 +230,7 @@ class ApiDirectMessageAction extends ApiAuthAction function showXmlDirectMessages() { - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('direct-messages', array('type' => 'array')); foreach ($this->messages as $m) { @@ -239,7 +239,7 @@ class ApiDirectMessageAction extends ApiAuthAction } $this->elementEnd('direct-messages'); - $this->end_document('xml'); + $this->endDocument('xml'); } /** @@ -250,7 +250,7 @@ class ApiDirectMessageAction extends ApiAuthAction function showJsonDirectMessages() { - $this->init_document('json'); + $this->initDocument('json'); $dmsgs = array(); @@ -259,8 +259,8 @@ class ApiDirectMessageAction extends ApiAuthAction array_push($dmsgs, $dm_array); } - $this->show_json_objects($dmsgs); - $this->end_document('json'); + $this->showJsonObjects($dmsgs); + $this->endDocument('json'); } /** @@ -271,7 +271,7 @@ class ApiDirectMessageAction extends ApiAuthAction function showRssDirectMessages() { - $this->init_document('rss'); + $this->initDocument('rss'); $this->element('title', null, $this->title); @@ -292,10 +292,10 @@ class ApiDirectMessageAction extends ApiAuthAction foreach ($this->messages as $m) { $entry = $this->rssDirectMessageArray($m); - $this->show_twitter_rss_item($entry); + $this->showTwitterRssItem($entry); } - $this->end_twitter_rss(); + $this->endTwitterRss(); } /** @@ -306,7 +306,7 @@ class ApiDirectMessageAction extends ApiAuthAction function showAtomDirectMessages() { - $this->init_document('atom'); + $this->initDocument('atom'); $this->element('title', null, $this->title); $this->element('id', null, $this->id); @@ -334,7 +334,7 @@ class ApiDirectMessageAction extends ApiAuthAction $this->showTwitterAtomEntry($entry); } - $this->end_document('atom'); + $this->endDocument('atom'); } /** diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php index db001561e..1b05eb95c 100644 --- a/actions/apifavoritecreate.php +++ b/actions/apifavoritecreate.php @@ -135,7 +135,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction $this->user->blowFavesCache(); if ($this->format == 'xml') { - $this->show_single_xml_status($this->notice); + $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') { $this->show_single_json_status($this->notice); } diff --git a/actions/apifavoritedestroy.php b/actions/apifavoritedestroy.php index 3640459f9..aac866d7e 100644 --- a/actions/apifavoritedestroy.php +++ b/actions/apifavoritedestroy.php @@ -138,7 +138,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction $this->user->blowFavesCache(); if ($this->format == 'xml') { - $this->show_single_xml_status($this->notice); + $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') { $this->show_single_json_status($this->notice); } diff --git a/actions/apifriendshipscreate.php b/actions/apifriendshipscreate.php index 85eaf3a29..6c44d7961 100644 --- a/actions/apifriendshipscreate.php +++ b/actions/apifriendshipscreate.php @@ -126,9 +126,9 @@ class ApiFriendshipsCreateAction extends ApiAuthAction return; } - $this->init_document($this->format); - $this->show_profile($this->other, $this->format); - $this->end_document($this->format); + $this->initDocument($this->format); + $this->showProfile($this->other, $this->format); + $this->endDocument($this->format); } } diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php index 274378051..a15f202aa 100644 --- a/actions/apifriendshipsdestroy.php +++ b/actions/apifriendshipsdestroy.php @@ -128,9 +128,9 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction return; } - $this->init_document($this->format); - $this->show_profile($this->other, $this->format); - $this->end_document($this->format); + $this->initDocument($this->format); + $this->showProfile($this->other, $this->format); + $this->endDocument($this->format); } } diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index df9f0c949..93be5f84e 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -107,14 +107,14 @@ class ApiFriendshipsExistsAction extends ApiAction switch ($this->format) { case 'xml': - $this->init_document('xml'); + $this->initDocument('xml'); $this->element('friends', null, $result); - $this->end_document('xml'); + $this->endDocument('xml'); break; case 'json': - $this->init_document('json'); + $this->initDocument('json'); print json_encode($result); - $this->end_document('json'); + $this->endDocument('json'); break; default: break; diff --git a/actions/apifriendshipsshow.php b/actions/apifriendshipsshow.php index 0ae6a7b82..8850496c7 100644 --- a/actions/apifriendshipsshow.php +++ b/actions/apifriendshipsshow.php @@ -143,18 +143,18 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction return; } - $result = $this->twitter_relationship_array($this->source, $this->target); + $result = $this->twitterRelationshipArray($this->source, $this->target); switch ($this->format) { case 'xml': - $this->init_document('xml'); - $this->show_twitter_xml_relationship($result[relationship]); - $this->end_document('xml'); + $this->initDocument('xml'); + $this->showTwitterXmlRelationship($result[relationship]); + $this->endDocument('xml'); break; case 'json': - $this->init_document('json'); + $this->initDocument('json'); print json_encode($result); - $this->end_document('json'); + $this->endDocument('json'); break; default: break; diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php index 359b7ca4f..6cf327012 100644 --- a/actions/apigroupismember.php +++ b/actions/apigroupismember.php @@ -95,14 +95,14 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction switch($this->format) { case 'xml': - $this->init_document('xml'); + $this->initDocument('xml'); $this->element('is_member', null, $is_member); - $this->end_document('xml'); + $this->endDocument('xml'); break; case 'json': - $this->init_document('json'); - $this->show_json_objects(array('is_member' => $is_member)); - $this->end_document('json'); + $this->initDocument('json'); + $this->showJsonObjects(array('is_member' => $is_member)); + $this->endDocument('json'); break; default: $this->clientError( diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php index e51842bcb..f930aa519 100644 --- a/actions/apigroupjoin.php +++ b/actions/apigroupjoin.php @@ -143,7 +143,7 @@ class ApiGroupJoinAction extends ApiAuthAction $this->show_single_xml_group($this->group); break; case 'json': - $this->show_single_json_group($this->group); + $this->showSingleJsonGroup($this->group); break; default: $this->clientError( diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index 332bd7b7b..4e3192ac0 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -129,7 +129,7 @@ class ApiGroupLeaveAction extends ApiAuthAction $this->show_single_xml_group($this->group); break; case 'json': - $this->show_single_json_group($this->group); + $this->showSingleJsonGroup($this->group); break; default: $this->clientError( diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php index 7a5aab72e..1fc31831a 100644 --- a/actions/apigrouplist.php +++ b/actions/apigrouplist.php @@ -101,15 +101,15 @@ class ApiGroupListAction extends ApiBareAuthAction switch($this->format) { case 'xml': - $this->show_xml_groups($this->groups); + $this->showXmlGroups($this->groups); break; case 'rss': - $this->show_rss_groups($this->groups, $title, $link, $subtitle); + $this->showRssGroups($this->groups, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . 'api/statusnet/groups/list/' . $this->user->id . '.atom'; - $this->show_atom_groups( + $this->showAtomGroups( $this->groups, $title, $id, @@ -119,7 +119,7 @@ class ApiGroupListAction extends ApiBareAuthAction ); break; case 'json': - $this->show_json_groups($this->groups); + $this->showJsonGroups($this->groups); break; default: $this->clientError( diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index 3e236816a..ef96a08bd 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -89,15 +89,15 @@ class ApiGroupListAllAction extends ApiAction switch($this->format) { case 'xml': - $this->show_xml_groups($this->groups); + $this->showXmlGroups($this->groups); break; case 'rss': - $this->show_rss_groups($this->groups, $title, $link, $subtitle); + $this->showRssGroups($this->groups, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . 'api/statusnet/groups/list_all.atom'; - $this->show_atom_groups( + $this->showAtomGroups( $this->groups, $title, $id, @@ -107,7 +107,7 @@ class ApiGroupListAllAction extends ApiAction ); break; case 'json': - $this->show_json_groups($this->groups); + $this->showJsonGroups($this->groups); break; default: $this->clientError( diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index 0bc846d60..27f77029e 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -85,10 +85,10 @@ class ApiGroupMembershipAction extends ApiAction switch($this->format) { case 'xml': - $this->show_twitter_xml_users($this->profiles); + $this->showTwitterXmlUsers($this->profiles); break; case 'json': - $this->show_json_users($this->profiles); + $this->showJsonUsers($this->profiles); break; default: $this->clientError( diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 262fe6718..8969ae194 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -93,7 +93,7 @@ class ApiGroupShowAction extends ApiAction $this->show_single_xml_group($this->group); break; case 'json': - $this->show_single_json_group($this->group); + $this->showSingleJsonGroup($this->group); break; default: $this->clientError(_('API method not found!'), 404, $this->format); diff --git a/actions/apihelptest.php b/actions/apihelptest.php index cd5b86cf9..4691cbf99 100644 --- a/actions/apihelptest.php +++ b/actions/apihelptest.php @@ -74,13 +74,13 @@ class ApiHelpTestAction extends ApiAction parent::handle($args); if ($this->format == 'xml') { - $this->init_document('xml'); + $this->initDocument('xml'); $this->element('ok', null, 'true'); - $this->end_document('xml'); + $this->endDocument('xml'); } elseif ($this->format == 'json') { - $this->init_document('json'); + $this->initDocument('json'); print '"ok"'; - $this->end_document('json'); + $this->endDocument('json'); } else { $this->clientError( _('API method not found!'), diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 7680f96dc..74a1310a2 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -112,7 +112,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction $this->notice->delete(); if ($this->format == 'xml') { - $this->show_single_xml_status($this->notice); + $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') { $this->show_single_json_status($this->notice); } @@ -134,7 +134,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction { if (!empty($this->notice)) { if ($this->format == 'xml') { - $this->show_single_xml_status($this->notice); + $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') { $this->show_single_json_status($this->notice); } diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 0096cfe6b..5d32a0bfc 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -110,7 +110,7 @@ class ApiStatusesShowAction extends ApiAction { if (!empty($this->notice)) { if ($this->format == 'xml') { - $this->show_single_xml_status($this->notice); + $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') { $this->show_single_json_status($this->notice); } diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 7d6a574ef..479654be8 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -201,7 +201,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction { if (!empty($this->notice)) { if ($this->format == 'xml') { - $this->show_single_xml_status($this->notice); + $this->showSingleXmlStatus($this->notice); } elseif ($this->format == 'json') { $this->show_single_json_status($this->notice); } diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php index 356942a85..a93570698 100644 --- a/actions/apistatusnetconfig.php +++ b/actions/apistatusnetconfig.php @@ -88,7 +88,7 @@ class ApiStatusnetConfigAction extends ApiAction switch ($this->format) { case 'xml': - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('config'); // XXX: check that all sections and settings are legal XML elements @@ -111,7 +111,7 @@ class ApiStatusnetConfigAction extends ApiAction $this->elementEnd($section); } $this->elementEnd('config'); - $this->end_document('xml'); + $this->endDocument('xml'); break; case 'json': $result = array(); @@ -122,9 +122,9 @@ class ApiStatusnetConfigAction extends ApiAction = common_config($section, $setting); } } - $this->init_document('json'); - $this->show_json_objects($result); - $this->end_document('json'); + $this->initDocument('json'); + $this->showJsonObjects($result); + $this->endDocument('json'); break; default: $this->clientError( diff --git a/actions/apistatusnetversion.php b/actions/apistatusnetversion.php index fb632fd93..6af9bdd1a 100644 --- a/actions/apistatusnetversion.php +++ b/actions/apistatusnetversion.php @@ -77,14 +77,14 @@ class ApiStatusnetVersionAction extends ApiAction switch ($this->format) { case 'xml': - $this->init_document('xml'); + $this->initDocument('xml'); $this->element('version', null, STATUSNET_VERSION); - $this->end_document('xml'); + $this->endDocument('xml'); break; case 'json': - $this->init_document('json'); + $this->initDocument('json'); print '"'.STATUSNET_VERSION.'"'; - $this->end_document('json'); + $this->endDocument('json'); break; default: $this->clientError( diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index 1332fd71c..a952e20b8 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -108,7 +108,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction return; } - $this->init_document($this->format); + $this->initDocument($this->format); if (isset($this->ids_only)) { $this->showIds(); @@ -116,7 +116,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction $this->showProfiles(isset($this->lite) ? false : true); } - $this->end_document($this->format); + $this->endDocument($this->format); } /** @@ -204,7 +204,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction case 'xml': $this->elementStart('users', array('type' => 'array')); foreach ($this->profiles as $profile) { - $this->show_profile( + $this->showProfile( $profile, $this->format, null, @@ -216,7 +216,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction case 'json': $arrays = array(); foreach ($this->profiles as $profile) { - $arrays[] = $this->twitter_user_array( + $arrays[] = $this->twitterUserArray( $profile, $include_statuses ); diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php index d35e05183..c85e56264 100644 --- a/actions/apitimelinefavorites.php +++ b/actions/apitimelinefavorites.php @@ -121,21 +121,21 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline($this->notices, $title, $link, $subtitle); + $this->showRssTimeline($this->notices, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . ltrim($_SERVER['QUERY_STRING'], 'p='); - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, $link, $subtitle, null, $selfuri ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found!'), $code = 404); diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php index 544824078..90f3b3c06 100644 --- a/actions/apitimelinefriends.php +++ b/actions/apitimelinefriends.php @@ -112,10 +112,10 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline($this->notices, $title, $link, $subtitle); + $this->showRssTimeline($this->notices, $title, $link, $subtitle); break; case 'atom': @@ -130,13 +130,13 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction 'api/statuses/friends_timeline.atom'; } - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, $link, $subtitle, null, $selfuri ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found!'), $code = 404); diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 6f2043fb6..2a6f35d72 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -108,16 +108,16 @@ class ApiTimelineGroupAction extends ApiAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline($this->notices, $title, $link, $subtitle); + $this->showRssTimeline($this->notices, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . 'api/statusnet/groups/timeline/' . $this->group->nickname . '.atom'; - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, @@ -128,7 +128,7 @@ class ApiTimelineGroupAction extends ApiAction ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError( diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index 60669d9ba..c25fb0a0e 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -118,21 +118,21 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline($this->notices, $title, $link, $subtitle); + $this->showRssTimeline($this->notices, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . ltrim($_SERVER['QUERY_STRING'], 'p='); - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, $link, $subtitle, null, $selfuri ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found!'), $code = 404); diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index b992136d1..4bff4adb6 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -99,20 +99,20 @@ class ApiTimelinePublicAction extends ApiAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline($this->notices, $title, $link, $subtitle); + $this->showRssTimeline($this->notices, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . 'api/statuses/public_timeline.atom'; - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, $link, $subtitle, null, $selfuri ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found!'), $code = 404); diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index 53e79e4b9..cf211b173 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -107,16 +107,16 @@ class ApiTimelineTagAction extends ApiAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline($this->notices, $title, $link, $subtitle); + $this->showRssTimeline($this->notices, $title, $link, $subtitle); break; case 'atom': $selfuri = common_root_url() . 'api/statusnet/tags/timeline/' . $this->tag . '.atom'; - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, @@ -127,7 +127,7 @@ class ApiTimelineTagAction extends ApiAction ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found!'), $code = 404); diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 652a1b0d9..e7fac3e7a 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -123,10 +123,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction switch($this->format) { case 'xml': - $this->show_xml_timeline($this->notices); + $this->showXmlTimeline($this->notices); break; case 'rss': - $this->show_rss_timeline( + $this->showRssTimeline( $this->notices, $title, $link, $subtitle, $suplink ); @@ -140,13 +140,13 @@ class ApiTimelineUserAction extends ApiBareAuthAction $selfuri = common_root_url() . 'api/statuses/user_timeline.atom'; } - $this->show_atom_timeline( + $this->showAtomTimeline( $this->notices, $title, $id, $link, $subtitle, $suplink, $selfuri ); break; case 'json': - $this->show_json_timeline($this->notices); + $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found!'), $code = 404); diff --git a/actions/apiusershow.php b/actions/apiusershow.php index 442efc194..d07040a43 100644 --- a/actions/apiusershow.php +++ b/actions/apiusershow.php @@ -105,16 +105,16 @@ class ApiUserShowAction extends ApiAction return; } - $twitter_user = $this->twitter_user_array($this->user->getProfile(), true); + $twitter_user = $this->twitterUserArray($this->user->getProfile(), true); if ($this->format == 'xml') { - $this->init_document('xml'); - $this->show_twitter_xml_user($twitter_user); - $this->end_document('xml'); + $this->initDocument('xml'); + $this->showTwitterXmlUser($twitter_user); + $this->endDocument('xml'); } elseif ($this->format == 'json') { - $this->init_document('json'); - $this->show_json_objects($twitter_user); - $this->end_document('json'); + $this->initDocument('json'); + $this->showJsonObjects($twitter_user); + $this->endDocument('json'); } } diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 0ef9d2826..7d618c471 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -340,7 +340,7 @@ class TwitapisearchatomAction extends ApiAction // TODO: Here is where we'd put in a link to an atom feed for threads $this->element("twitter:source", null, - htmlentities($this->source_link($notice->source))); + htmlentities($this->sourceLink($notice->source))); $this->elementStart('author'); diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index 5abff6496..c7fa741a0 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -134,9 +134,9 @@ class TwitapisearchjsonAction extends ApiAction $results = new JSONSearchResultsList($notice, $q, $this->rpp, $this->page); - $this->init_document('json'); + $this->initDocument('json'); $results->show(); - $this->end_document('json'); + $this->endDocument('json'); } /** diff --git a/lib/api.php b/lib/api.php index 95a0779ad..0801d2823 100644 --- a/lib/api.php +++ b/lib/api.php @@ -106,7 +106,7 @@ class ApiAction extends Action return parent::element($tag, $attrs, $content); } - function twitter_user_array($profile, $get_notice=false) + function twitterUserArray($profile, $get_notice=false) { $twitter_user = array(); @@ -133,7 +133,7 @@ class ApiAction extends Action $twitter_user['friends_count'] = $profile->subscriptionCount(); - $twitter_user['created_at'] = $this->date_twitter($profile->created); + $twitter_user['created_at'] = $this->dateTwitter($profile->created); $twitter_user['favourites_count'] = $profile->faveCount(); // British spelling! @@ -179,24 +179,24 @@ class ApiAction extends Action $notice = $profile->getCurrentNotice(); if ($notice) { # don't get user! - $twitter_user['status'] = $this->twitter_status_array($notice, false); + $twitter_user['status'] = $this->twitterStatusArray($notice, false); } } return $twitter_user; } - function twitter_status_array($notice, $include_user=true) + function twitterStatusArray($notice, $include_user=true) { $profile = $notice->getProfile(); $twitter_status = array(); $twitter_status['text'] = $notice->content; $twitter_status['truncated'] = false; # Not possible on StatusNet - $twitter_status['created_at'] = $this->date_twitter($notice->created); + $twitter_status['created_at'] = $this->dateTwitter($notice->created); $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null; - $twitter_status['source'] = $this->source_link($notice->source); + $twitter_status['source'] = $this->sourceLink($notice->source); $twitter_status['id'] = intval($notice->id); $replier_profile = null; @@ -239,14 +239,14 @@ class ApiAction extends Action if ($include_user) { # Don't get notice (recursive!) - $twitter_user = $this->twitter_user_array($profile, false); + $twitter_user = $this->twitterUserArray($profile, false); $twitter_status['user'] = $twitter_user; } return $twitter_status; } - function twitter_group_array($group) + function twitterGroupArray($group) { $twitter_group=array(); $twitter_group['id']=$group->id; @@ -261,12 +261,12 @@ class ApiAction extends Action $twitter_group['homepage']=$group->homepage; $twitter_group['description']=$group->description; $twitter_group['location']=$group->location; - $twitter_group['created']=$this->date_twitter($group->created); - $twitter_group['modified']=$this->date_twitter($group->modified); + $twitter_group['created']=$this->dateTwitter($group->created); + $twitter_group['modified']=$this->dateTwitter($group->modified); return $twitter_group; } - function twitter_rss_group_array($group) + function twitterRssGroupArray($group) { $entry = array(); $entry['content']=$group->description; @@ -284,7 +284,7 @@ class ApiAction extends Action return $entry; } - function twitter_rss_entry_array($notice) + function twitterRssEntryArray($notice) { $profile = $notice->getProfile(); $entry = array(); @@ -341,19 +341,19 @@ class ApiAction extends Action } - function twitter_relationship_array($source, $target) + function twitterRelationshipArray($source, $target) { $relationship = array(); $relationship['source'] = - $this->relationship_details_array($source, $target); + $this->relationshipDetailsArray($source, $target); $relationship['target'] = - $this->relationship_details_array($target, $source); + $this->relationshipDetailsArray($target, $source); return array('relationship' => $relationship); } - function relationship_details_array($source, $target) + function relationshipDetailsArray($source, $target) { $details = array(); @@ -380,14 +380,14 @@ class ApiAction extends Action return $details; } - function show_twitter_xml_relationship($relationship) + function showTwitterXmlRelationship($relationship) { $this->elementStart('relationship'); foreach($relationship as $element => $value) { if ($element == 'source' || $element == 'target') { $this->elementStart($element); - $this->show_xml_relationship_details($value); + $this->showXmlRelationshipDetails($value); $this->elementEnd($element); } } @@ -395,26 +395,26 @@ class ApiAction extends Action $this->elementEnd('relationship'); } - function show_xml_relationship_details($details) + function showXmlRelationshipDetails($details) { foreach($details as $element => $value) { $this->element($element, null, $value); } } - function show_twitter_xml_status($twitter_status) + function showTwitterXmlStatus($twitter_status) { $this->elementStart('status'); foreach($twitter_status as $element => $value) { switch ($element) { case 'user': - $this->show_twitter_xml_user($twitter_status['user']); + $this->showTwitterXmlUser($twitter_status['user']); break; case 'text': $this->element($element, null, common_xml_safe_str($value)); break; case 'attachments': - $this->show_xml_attachments($twitter_status['attachments']); + $this->showXmlAttachments($twitter_status['attachments']); break; default: $this->element($element, null, $value); @@ -423,7 +423,7 @@ class ApiAction extends Action $this->elementEnd('status'); } - function show_twitter_xml_group($twitter_group) + function showTwitterXmlGroup($twitter_group) { $this->elementStart('group'); foreach($twitter_group as $element => $value) { @@ -432,12 +432,12 @@ class ApiAction extends Action $this->elementEnd('group'); } - function show_twitter_xml_user($twitter_user, $role='user') + function showTwitterXmlUser($twitter_user, $role='user') { $this->elementStart($role); foreach($twitter_user as $element => $value) { if ($element == 'status') { - $this->show_twitter_xml_status($twitter_user['status']); + $this->showTwitterXmlStatus($twitter_user['status']); } else { $this->element($element, null, $value); } @@ -445,7 +445,7 @@ class ApiAction extends Action $this->elementEnd($role); } - function show_xml_attachments($attachments) { + function showXmlAttachments($attachments) { if (!empty($attachments)) { $this->elementStart('attachments', array('type' => 'array')); foreach ($attachments as $attachment) { @@ -459,7 +459,7 @@ class ApiAction extends Action } } - function show_twitter_rss_item($entry) + function showTwitterRssItem($entry) { $this->elementStart('item'); $this->element('title', null, $entry['title']); @@ -483,59 +483,59 @@ class ApiAction extends Action $this->elementEnd('item'); } - function show_json_objects($objects) + function showJsonObjects($objects) { print(json_encode($objects)); } - function show_single_xml_status($notice) + function showSingleXmlStatus($notice) { - $this->init_document('xml'); - $twitter_status = $this->twitter_status_array($notice); - $this->show_twitter_xml_status($twitter_status); - $this->end_document('xml'); + $this->initDocument('xml'); + $twitter_status = $this->twitterStatusArray($notice); + $this->showTwitterXmlStatus($twitter_status); + $this->endDocument('xml'); } function show_single_json_status($notice) { - $this->init_document('json'); - $status = $this->twitter_status_array($notice); - $this->show_json_objects($status); - $this->end_document('json'); + $this->initDocument('json'); + $status = $this->twitterStatusArray($notice); + $this->showJsonObjects($status); + $this->endDocument('json'); } - function show_xml_timeline($notice) + function showXmlTimeline($notice) { - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('statuses', array('type' => 'array')); if (is_array($notice)) { foreach ($notice as $n) { - $twitter_status = $this->twitter_status_array($n); - $this->show_twitter_xml_status($twitter_status); + $twitter_status = $this->twitterStatusArray($n); + $this->showTwitterXmlStatus($twitter_status); } } else { while ($notice->fetch()) { - $twitter_status = $this->twitter_status_array($notice); - $this->show_twitter_xml_status($twitter_status); + $twitter_status = $this->twitterStatusArray($notice); + $this->showTwitterXmlStatus($twitter_status); } } $this->elementEnd('statuses'); - $this->end_document('xml'); + $this->endDocument('xml'); } - function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=null) + function showRssTimeline($notice, $title, $link, $subtitle, $suplink=null) { - $this->init_document('rss'); + $this->initDocument('rss'); $this->element('title', null, $title); $this->element('link', null, $link); if (!is_null($suplink)) { - # For FriendFeed's SUP protocol + // For FriendFeed's SUP protocol $this->element('link', array('xmlns' => 'http://www.w3.org/2005/Atom', 'rel' => 'http://api.friendfeed.com/2008/03#sup', 'href' => $suplink, @@ -547,23 +547,23 @@ class ApiAction extends Action if (is_array($notice)) { foreach ($notice as $n) { - $entry = $this->twitter_rss_entry_array($n); - $this->show_twitter_rss_item($entry); + $entry = $this->twitterRssEntryArray($n); + $this->showTwitterRssItem($entry); } } else { while ($notice->fetch()) { - $entry = $this->twitter_rss_entry_array($notice); - $this->show_twitter_rss_item($entry); + $entry = $this->twitterRssEntryArray($notice); + $this->showTwitterRssItem($entry); } } - $this->end_twitter_rss(); + $this->endTwitterRss(); } - function show_atom_timeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null) + function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null) { - $this->init_document('atom'); + $this->initDocument('atom'); $this->element('title', null, $title); $this->element('id', null, $id); @@ -594,14 +594,14 @@ class ApiAction extends Action } } - $this->end_document('atom'); + $this->endDocument('atom'); } - function show_rss_groups($group, $title, $link, $subtitle) + function showRssGroups($group, $title, $link, $subtitle) { - $this->init_document('rss'); + $this->initDocument('rss'); $this->element('title', null, $title); $this->element('link', null, $link); @@ -611,17 +611,17 @@ class ApiAction extends Action if (is_array($group)) { foreach ($group as $g) { - $twitter_group = $this->twitter_rss_group_array($g); - $this->show_twitter_rss_item($twitter_group); + $twitter_group = $this->twitterRssGroupArray($g); + $this->showTwitterRssItem($twitter_group); } } else { while ($group->fetch()) { - $twitter_group = $this->twitter_rss_group_array($group); - $this->show_twitter_rss_item($twitter_group); + $twitter_group = $this->twitterRssGroupArray($group); + $this->showTwitterRssItem($twitter_group); } } - $this->end_twitter_rss(); + $this->endTwitterRss(); } @@ -655,7 +655,7 @@ class ApiAction extends Action switch ($element) { case 'sender': case 'recipient': - $this->show_twitter_xml_user($value, $element); + $this->showTwitterXmlUser($value, $element); break; case 'text': $this->element($element, null, common_xml_safe_str($value)); @@ -679,11 +679,11 @@ class ApiAction extends Action $dmsg['sender_id'] = $message->from_profile; $dmsg['text'] = trim($message->content); $dmsg['recipient_id'] = $message->to_profile; - $dmsg['created_at'] = $this->date_twitter($message->created); + $dmsg['created_at'] = $this->dateTwitter($message->created); $dmsg['sender_screen_name'] = $from_profile->nickname; $dmsg['recipient_screen_name'] = $to_profile->nickname; - $dmsg['sender'] = $this->twitter_user_array($from_profile, false); - $dmsg['recipient'] = $this->twitter_user_array($to_profile, false); + $dmsg['sender'] = $this->twitterUserArray($from_profile, false); + $dmsg['recipient'] = $this->twitterUserArray($to_profile, false); return $dmsg; } @@ -725,24 +725,24 @@ class ApiAction extends Action function showSingleXmlDirectMessage($message) { - $this->init_document('xml'); + $this->initDocument('xml'); $dmsg = $this->directMessageArray($message); $this->showXmlDirectMessage($dmsg); - $this->end_document('xml'); + $this->endDocument('xml'); } function showSingleJsonDirectMessage($message) { - $this->init_document('json'); + $this->initDocument('json'); $dmsg = $this->directMessageArray($message); - $this->show_json_objects($dmsg); - $this->end_document('json'); + $this->showJsonObjects($dmsg); + $this->endDocument('json'); } - function show_atom_groups($group, $title, $id, $link, $subtitle=null, $selfuri=null) + function showAtomGroups($group, $title, $id, $link, $subtitle=null, $selfuri=null) { - $this->init_document('atom'); + $this->initDocument('atom'); $this->element('title', null, $title); $this->element('id', null, $id); @@ -766,143 +766,143 @@ class ApiAction extends Action } } - $this->end_document('atom'); + $this->endDocument('atom'); } - function show_json_timeline($notice) + function showJsonTimeline($notice) { - $this->init_document('json'); + $this->initDocument('json'); $statuses = array(); if (is_array($notice)) { foreach ($notice as $n) { - $twitter_status = $this->twitter_status_array($n); + $twitter_status = $this->twitterStatusArray($n); array_push($statuses, $twitter_status); } } else { while ($notice->fetch()) { - $twitter_status = $this->twitter_status_array($notice); + $twitter_status = $this->twitterStatusArray($notice); array_push($statuses, $twitter_status); } } - $this->show_json_objects($statuses); + $this->showJsonObjects($statuses); - $this->end_document('json'); + $this->endDocument('json'); } - function show_json_groups($group) + function showJsonGroups($group) { - $this->init_document('json'); + $this->initDocument('json'); $groups = array(); if (is_array($group)) { foreach ($group as $g) { - $twitter_group = $this->twitter_group_array($g); + $twitter_group = $this->twitterGroupArray($g); array_push($groups, $twitter_group); } } else { while ($group->fetch()) { - $twitter_group = $this->twitter_group_array($group); + $twitter_group = $this->twitterGroupArray($group); array_push($groups, $twitter_group); } } - $this->show_json_objects($groups); + $this->showJsonObjects($groups); - $this->end_document('json'); + $this->endDocument('json'); } - function show_xml_groups($group) + function showXmlGroups($group) { - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('groups', array('type' => 'array')); if (is_array($group)) { foreach ($group as $g) { - $twitter_group = $this->twitter_group_array($g); - $this->show_twitter_xml_group($twitter_group); + $twitter_group = $this->twitterGroupArray($g); + $this->showTwitterXmlGroup($twitter_group); } } else { while ($group->fetch()) { - $twitter_group = $this->twitter_group_array($group); - $this->show_twitter_xml_group($twitter_group); + $twitter_group = $this->twitterGroupArray($group); + $this->showTwitterXmlGroup($twitter_group); } } $this->elementEnd('groups'); - $this->end_document('xml'); + $this->endDocument('xml'); } - function show_twitter_xml_users($user) + function showTwitterXmlUsers($user) { - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('users', array('type' => 'array')); if (is_array($user)) { foreach ($user as $u) { - $twitter_user = $this->twitter_user_array($u); - $this->show_twitter_xml_user($twitter_user); + $twitter_user = $this->twitterUserArray($u); + $this->showTwitterXmlUser($twitter_user); } } else { while ($user->fetch()) { - $twitter_user = $this->twitter_user_array($user); - $this->show_twitter_xml_user($twitter_user); + $twitter_user = $this->twitterUserArray($user); + $this->showTwitterXmlUser($twitter_user); } } $this->elementEnd('users'); - $this->end_document('xml'); + $this->endDocument('xml'); } - function show_json_users($user) + function showJsonUsers($user) { - $this->init_document('json'); + $this->initDocument('json'); $users = array(); if (is_array($user)) { foreach ($user as $u) { - $twitter_user = $this->twitter_user_array($u); + $twitter_user = $this->twitterUserArray($u); array_push($users, $twitter_user); } } else { while ($user->fetch()) { - $twitter_user = $this->twitter_user_array($user); + $twitter_user = $this->twitterUserArray($user); array_push($users, $twitter_user); } } - $this->show_json_objects($users); + $this->showJsonObjects($users); - $this->end_document('json'); + $this->endDocument('json'); } - function show_single_json_group($group) + function showSingleJsonGroup($group) { - $this->init_document('json'); - $twitter_group = $this->twitter_group_array($group); - $this->show_json_objects($twitter_group); - $this->end_document('json'); + $this->initDocument('json'); + $twitter_group = $this->twitterGroupArray($group); + $this->showJsonObjects($twitter_group); + $this->endDocument('json'); } function show_single_xml_group($group) { - $this->init_document('xml'); - $twitter_group = $this->twitter_group_array($group); - $this->show_twitter_xml_group($twitter_group); - $this->end_document('xml'); + $this->initDocument('xml'); + $twitter_group = $this->twitterGroupArray($group); + $this->showTwitterXmlGroup($twitter_group); + $this->endDocument('xml'); } - function date_twitter($dt) + function dateTwitter($dt) { $dateStr = date('d F Y H:i:s', strtotime($dt)); $d = new DateTime($dateStr, new DateTimeZone('UTC')); @@ -910,24 +910,7 @@ class ApiAction extends Action return $d->format('D M d H:i:s O Y'); } - // XXX: Candidate for a general utility method somewhere? - function count_subscriptions($profile) - { - - $count = 0; - $sub = new Subscription(); - $sub->subscribed = $profile->id; - - $count = $sub->find(); - - if ($count > 0) { - return $count - 1; - } else { - return 0; - } - } - - function init_document($type='xml') + function initDocument($type='xml') { switch ($type) { case 'xml': @@ -945,11 +928,11 @@ class ApiAction extends Action break; case 'rss': header("Content-Type: application/rss+xml; charset=utf-8"); - $this->init_twitter_rss(); + $this->initTwitterRss(); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); - $this->init_twitter_atom(); + $this->initTwitterAtom(); break; default: $this->clientError(_('Not a supported data format.')); @@ -959,7 +942,7 @@ class ApiAction extends Action return; } - function end_document($type='xml') + function endDocument($type='xml') { switch ($type) { case 'xml': @@ -974,10 +957,10 @@ class ApiAction extends Action } break; case 'rss': - $this->end_twitter_rss(); + $this->endTwitterRss(); break; case 'atom': - $this->end_twitter_rss(); + $this->endTwitterRss(); break; default: $this->clientError(_('Not a supported data format.')); @@ -1001,17 +984,17 @@ class ApiAction extends Action header('HTTP/1.1 '.$code.' '.$status_string); if ($format == 'xml') { - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('hash'); $this->element('error', null, $msg); $this->element('request', null, $_SERVER['REQUEST_URI']); $this->elementEnd('hash'); - $this->end_document('xml'); + $this->endDocument('xml'); } elseif ($format == 'json'){ - $this->init_document('json'); + $this->initDocument('json'); $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); print(json_encode($error_array)); - $this->end_document('json'); + $this->endDocument('json'); } else { // If user didn't request a useful format, throw a regular client error @@ -1034,21 +1017,21 @@ class ApiAction extends Action header('HTTP/1.1 '.$code.' '.$status_string); if ($content_type == 'xml') { - $this->init_document('xml'); + $this->initDocument('xml'); $this->elementStart('hash'); $this->element('error', null, $msg); $this->element('request', null, $_SERVER['REQUEST_URI']); $this->elementEnd('hash'); - $this->end_document('xml'); + $this->endDocument('xml'); } else { - $this->init_document('json'); + $this->initDocument('json'); $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']); print(json_encode($error_array)); - $this->end_document('json'); + $this->endDocument('json'); } } - function init_twitter_rss() + function initTwitterRss() { $this->startXML(); $this->elementStart('rss', array('version' => '2.0', 'xmlns:atom'=>'http://www.w3.org/2005/Atom')); @@ -1056,14 +1039,14 @@ class ApiAction extends Action Event::handle('StartApiRss', array($this)); } - function end_twitter_rss() + function endTwitterRss() { $this->elementEnd('channel'); $this->elementEnd('rss'); $this->endXML(); } - function init_twitter_atom() + function initTwitterAtom() { $this->startXML(); // FIXME: don't hardcode the language here! @@ -1073,21 +1056,21 @@ class ApiAction extends Action Event::handle('StartApiAtom', array($this)); } - function end_twitter_atom() + function endTwitterAtom() { $this->elementEnd('feed'); $this->endXML(); } - function show_profile($profile, $content_type='xml', $notice=null, $includeStatuses=true) + function showProfile($profile, $content_type='xml', $notice=null, $includeStatuses=true) { - $profile_array = $this->twitter_user_array($profile, $includeStatuses); + $profile_array = $this->twitterUserArray($profile, $includeStatuses); switch ($content_type) { case 'xml': - $this->show_twitter_xml_user($profile_array); + $this->showTwitterXmlUser($profile_array); break; case 'json': - $this->show_json_objects($profile_array); + $this->showJsonObjects($profile_array); break; default: $this->clientError(_('Not a supported data format.')); @@ -1155,7 +1138,7 @@ class ApiAction extends Action } } - function source_link($source) + function sourceLink($source) { $source_name = _($source); switch ($source) { diff --git a/lib/twitter.php b/lib/twitter.php index b49e2e119..afc3f55ba 100644 --- a/lib/twitter.php +++ b/lib/twitter.php @@ -23,7 +23,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { define('TWITTER_SERVICE', 1); // Twitter is foreign_service ID 1 -function update_twitter_user($twitter_id, $screen_name) +function updateTwitter_user($twitter_id, $screen_name) { $uri = 'http://twitter.com/' . $screen_name; $fuser = new Foreign_user(); @@ -115,7 +115,7 @@ function save_twitter_user($twitter_id, $screen_name) // Only update if Twitter screen name has changed if ($fuser->nickname != $screen_name) { - $result = update_twitter_user($twitter_id, $screen_name); + $result = updateTwitter_user($twitter_id, $screen_name); common_debug('Twitter bridge - Updated nickname (and URI) for Twitter user ' . "$fuser->id to $screen_name, was $fuser->nickname"); diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 9a750bbc8..0c7c1240c 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -246,7 +246,7 @@ class RealtimePlugin extends Plugin $act = new ApiAction('/dev/null'); - $arr = $act->twitter_status_array($notice, true); + $arr = $act->twitterStatusArray($notice, true); $arr['url'] = $notice->bestUrl(); $arr['html'] = htmlspecialchars($notice->rendered); $arr['source'] = htmlspecialchars($arr['source']); -- cgit v1.2.3-54-g00ecf From eaaa01a1713b14f48b9889bfbe7f91a9ddd60fd5 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 18 Oct 2009 15:10:49 +0000 Subject: Added an update counter in the document title. When window is in blur, it will update the document title when new notices are received. The counter will reset when window is blurred (after a focus) again. --- plugins/Realtime/realtimeupdate.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index a75f17d8c..9371326fe 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -7,6 +7,7 @@ RealtimeUpdate = { _replyurl: '', _favorurl: '', _deleteurl: '', + _updatecounter: 0, init: function(userid, replyurl, favorurl, deleteurl) { @@ -15,6 +16,8 @@ RealtimeUpdate = { RealtimeUpdate._favorurl = favorurl; RealtimeUpdate._deleteurl = deleteurl; + DT = document.title; + $(window).blur(function() { $('#notices_primary .notice').css({ 'border-top-color':$('#notices_primary .notice:last').css('border-top-color'), @@ -25,7 +28,10 @@ RealtimeUpdate = { 'border-top-color':'#AAAAAA', 'border-top-style':'solid' }); - + + RealtimeUpdate._updatecounter = 0; + document.title = DT; + return false; }); }, @@ -39,12 +45,15 @@ RealtimeUpdate = { if ($("#notice-"+id).length > 0) { return; } - + var noticeItem = RealtimeUpdate.makeNoticeItem(data); $("#notices_primary .notices").prepend(noticeItem); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(1000); NoticeReply(); + + RealtimeUpdate._updatecounter += 1; + document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; }, 500); }, -- cgit v1.2.3-54-g00ecf From 5ab709b73977131813884558bf56d97172a7aa26 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 8 Nov 2009 23:32:15 +0100 Subject: Remove more contractions * doesn't * won't * isn't * don't --- actions/allrss.php | 2 +- actions/apiaccountratelimitstatus.php | 2 +- actions/apifriendshipsdestroy.php | 2 +- actions/attachment.php | 4 ++-- actions/avatarbynickname.php | 2 +- actions/groupblock.php | 2 +- actions/login.php | 2 +- actions/logout.php | 2 +- actions/newmessage.php | 2 +- actions/newnotice.php | 2 +- actions/opensearch.php | 2 +- actions/passwordsettings.php | 2 +- actions/register.php | 2 +- actions/showgroup.php | 2 +- actions/showmessage.php | 8 ++++---- actions/shownotice.php | 6 +++--- actions/showstream.php | 2 +- actions/sup.php | 2 +- actions/twitapisearchatom.php | 2 +- actions/twitapitrends.php | 2 +- classes/File_redirection.php | 8 ++++---- classes/Notice.php | 6 +++--- classes/Profile.php | 4 ++-- classes/User.php | 6 +++--- lib/api.php | 14 +++++++------- lib/apiauth.php | 2 +- lib/dberroraction.php | 6 +++--- lib/error.php | 4 ++-- lib/htmloutputter.php | 2 +- lib/imagefile.php | 2 +- lib/jabber.php | 2 +- lib/mail.php | 6 +++--- lib/noticelist.php | 4 ++-- lib/queuehandler.php | 12 ++++++------ lib/rssaction.php | 2 +- lib/search_engines.php | 2 +- lib/util.php | 12 ++++++------ lib/xmloutputter.php | 2 +- lib/xmppqueuehandler.php | 2 +- plugins/Autocomplete/autocomplete.php | 2 +- plugins/BlogspamNetPlugin.php | 2 +- plugins/Facebook/FBConnectAuth.php | 4 ++-- plugins/Facebook/FacebookPlugin.php | 4 ++-- plugins/Facebook/facebook/facebook.php | 8 ++++---- plugins/Facebook/facebook/facebook_desktop.php | 2 +- plugins/Facebook/facebook/facebookapi_php5_restlib.php | 6 +++--- plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php | 2 +- plugins/Facebook/facebookaction.php | 6 +++--- plugins/GeonamesPlugin.php | 8 ++++---- plugins/OpenID/finishopenidlogin.php | 4 ++-- plugins/OpenID/openid.php | 2 +- plugins/PiwikAnalyticsPlugin.php | 2 +- plugins/Realtime/RealtimePlugin.php | 2 +- plugins/TwitterBridge/daemons/synctwitterfriends.php | 2 +- plugins/TwitterBridge/daemons/twitterstatusfetcher.php | 4 ++-- plugins/TwitterBridge/twitter.php | 2 +- scripts/console.php | 4 ++-- scripts/maildaemon.php | 2 +- scripts/xmppconfirmhandler.php | 2 +- 59 files changed, 110 insertions(+), 110 deletions(-) (limited to 'plugins/Realtime') diff --git a/actions/allrss.php b/actions/allrss.php index 28b1be27d..4a5d15c7b 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -56,7 +56,7 @@ class AllrssAction extends Rss10Action * * @param array $args Web and URL arguments * - * @return boolean false if user doesn't exist + * @return boolean false if user does not exist */ function prepare($args) { diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php index 96179f175..c7c0e7c00 100644 --- a/actions/apiaccountratelimitstatus.php +++ b/actions/apiaccountratelimitstatus.php @@ -36,7 +36,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/lib/apibareauth.php'; /** - * We don't have a rate limit, but some clients check this method. + * We do not have a rate limit, but some clients check this method. * It always returns the same thing: 150 hits left. * * @category API diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php index 3d9b7e001..fb73624c9 100644 --- a/actions/apifriendshipsdestroy.php +++ b/actions/apifriendshipsdestroy.php @@ -113,7 +113,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction return; } - // Don't allow unsubscribing from yourself! + // Do not allow unsubscribing from yourself! if ($this->user->id == $this->other->id) { $this->clientError( diff --git a/actions/attachment.php b/actions/attachment.php index 6981354d1..ca9e57845 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -146,7 +146,7 @@ class AttachmentAction extends Action } /** - * Don't show local navigation + * Do not show local navigation * * @return void */ @@ -170,7 +170,7 @@ class AttachmentAction extends Action } /** - * Don't show page notice + * Do not show page notice * * @return void */ diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 537950792..1a6925e11 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -49,7 +49,7 @@ class AvatarbynicknameAction extends Action * * @param array $args query arguments * - * @return boolean false if nickname or user isn't found + * @return boolean false if nickname or user is not found */ function handle($args) { diff --git a/actions/groupblock.php b/actions/groupblock.php index 979a56a81..133101eb7 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -95,7 +95,7 @@ class GroupblockAction extends Action $this->clientError(_('User is already blocked from group.')); return false; } - // XXX: could have proactive blocks, but we don't have UI for it. + // XXX: could have proactive blocks, but we do not have UI for it. if (!$this->profile->isMember($this->group)) { $this->clientError(_('User is not a member of group.')); return false; diff --git a/actions/login.php b/actions/login.php index ad57dd667..679817520 100644 --- a/actions/login.php +++ b/actions/login.php @@ -159,7 +159,7 @@ class LoginAction extends Action $url = common_get_returnto(); if ($url) { - // We don't have to return to it again + // We do not have to return to it again common_set_returnto(null); } else { $url = common_local_url('all', diff --git a/actions/logout.php b/actions/logout.php index 1e0adae57..7e768fca6 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -81,7 +81,7 @@ class LogoutAction extends Action { common_set_user(null); common_real_login(false); // not logged in - common_forgetme(); // don't log back in! + common_forgetme(); // do not log back in! } } diff --git a/actions/newmessage.php b/actions/newmessage.php index 0db2e7181..73307fdfc 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -61,7 +61,7 @@ class NewmessageAction extends Action /** * Title of the page * - * Note that this usually doesn't get called unless something went wrong + * Note that this usually does not get called unless something went wrong * * @return string page title */ diff --git a/actions/newnotice.php b/actions/newnotice.php index fbd7ab6bc..fc06e5c98 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -59,7 +59,7 @@ class NewnoticeAction extends Action /** * Title of the page * - * Note that this usually doesn't get called unless something went wrong + * Note that this usually does not get called unless something went wrong * * @return string page title */ diff --git a/actions/opensearch.php b/actions/opensearch.php index 8ebb5fc82..3136380b0 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -52,7 +52,7 @@ class OpensearchAction extends Action * * @param array $args query arguments * - * @return boolean false if user doesn't exist + * @return boolean false if user does not exist */ function handle($args) { diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php index 87eb45a7d..6658d279f 100644 --- a/actions/passwordsettings.php +++ b/actions/passwordsettings.php @@ -97,7 +97,7 @@ class PasswordsettingsAction extends AccountSettingsAction $this->elementStart('ul', 'form_data'); - // Users who logged in with OpenID won't have a pwd + // Users who logged in with OpenID will not have a pwd if ($user->password) { $this->elementStart('li'); $this->password('oldpassword', _('Old password')); diff --git a/actions/register.php b/actions/register.php index 584ad3ead..69c50faca 100644 --- a/actions/register.php +++ b/actions/register.php @@ -174,7 +174,7 @@ class RegisterAction extends Action $bio = $this->trimmed('bio'); $location = $this->trimmed('location'); - // We don't trim these... whitespace is OK in a password! + // We do not trim these... whitespace is OK in a password! $password = $this->arg('password'); $confirm = $this->arg('confirm'); diff --git a/actions/showgroup.php b/actions/showgroup.php index a4af29391..ae956befa 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -418,7 +418,7 @@ class ShowgroupAction extends GroupDesignAction // XXX: WORM cache this $members = $this->group->getMembers(); $members_count = 0; - /** $member->count() doesn't work. */ + /** $member->count() does not work. */ while ($members->fetch()) { $members_count++; } diff --git a/actions/showmessage.php b/actions/showmessage.php index db757948b..cf3a819c1 100644 --- a/actions/showmessage.php +++ b/actions/showmessage.php @@ -137,7 +137,7 @@ class ShowmessageAction extends MailboxAction } /** - * Don't show local navigation + * Do not show local navigation * * @return void */ @@ -147,7 +147,7 @@ class ShowmessageAction extends MailboxAction } /** - * Don't show page notice + * Do not show page notice * * @return void */ @@ -157,7 +157,7 @@ class ShowmessageAction extends MailboxAction } /** - * Don't show aside + * Do not show aside * * @return void */ @@ -167,7 +167,7 @@ class ShowmessageAction extends MailboxAction } /** - * Don't show any instructions + * Do not show any instructions * * @return string */ diff --git a/actions/shownotice.php b/actions/shownotice.php index 5d16fdad9..688089f02 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -208,7 +208,7 @@ class ShownoticeAction extends OwnerDesignAction } /** - * Don't show local navigation + * Do not show local navigation * * @return void */ @@ -234,7 +234,7 @@ class ShownoticeAction extends OwnerDesignAction } /** - * Don't show page notice + * Do not show page notice * * @return void */ @@ -244,7 +244,7 @@ class ShownoticeAction extends OwnerDesignAction } /** - * Don't show aside + * Do not show aside * * @return void */ diff --git a/actions/showstream.php b/actions/showstream.php index 663638c18..4952ebdb7 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -253,7 +253,7 @@ class ShowstreamAction extends ProfileAction } } -// We don't show the author for a profile, since we already know who it is! +// We do not show the author for a profile, since we already know who it is! class ProfileNoticeList extends NoticeList { diff --git a/actions/sup.php b/actions/sup.php index 5daf0a1c1..a199f247e 100644 --- a/actions/sup.php +++ b/actions/sup.php @@ -61,7 +61,7 @@ class SupAction extends Action $notice = new Notice(); # XXX: cache this. Depends on how big this protocol becomes; - # Re-doing this query every 15 seconds isn't the end of the world. + # Re-doing this query every 15 seconds is not the end of the world. $divider = common_sql_date(time() - $seconds); diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 7d618c471..511d7cdc6 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -250,7 +250,7 @@ class TwitapisearchatomAction extends ApiAction } // FIXME: this alternate link is not quite right because our - // web-based notice search doesn't support a rpp (responses per + // web-based notice search does not support a rpp (responses per // page) param yet $this->element('link', array('type' => 'text/html', diff --git a/actions/twitapitrends.php b/actions/twitapitrends.php index 779405e6d..2d17e77cc 100644 --- a/actions/twitapitrends.php +++ b/actions/twitapitrends.php @@ -55,7 +55,7 @@ class TwitapitrendsAction extends ApiAction * * @param array $args Web and URL arguments * - * @return boolean false if user doesn't exist + * @return boolean false if user does not exist */ function prepare($args) { diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 08a6e8d8b..c951c1ee7 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -53,7 +53,7 @@ class File_redirection extends Memcached_DataObject 'connect_timeout' => 10, // # seconds to wait 'max_redirs' => $redirs, // # max number of http redirections to follow 'follow_redirects' => true, // Follow redirects - 'store_body' => false, // We won't need body content here. + 'store_body' => false, // We will not need body content here. )); return $request; } @@ -81,12 +81,12 @@ class File_redirection extends Memcached_DataObject } try { $request = self::_commonHttp($short_url, $redirs); - // Don't include body in output + // Do not include body in output $request->setMethod(HTTP_Request2::METHOD_HEAD); $response = $request->send(); if (405 == $response->getStatus()) { - // Server doesn't support HEAD method? Can this really happen? + // Server does not support HEAD method? Can this really happen? // We'll try again as a GET and ignore the response data. $request = self::_commonHttp($short_url, $redirs); $response = $request->send(); @@ -178,7 +178,7 @@ class File_redirection extends Memcached_DataObject case 'aim': case 'jabber': case 'xmpp': - // don't touch anything + // do not touch anything break; default: diff --git a/classes/Notice.php b/classes/Notice.php index 862d4c762..0c54b6b67 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -146,7 +146,7 @@ class Notice extends Memcached_DataObject /* Add them to the database */ foreach(array_unique($hashtags) as $hashtag) { - /* elide characters we don't want in the tag */ + /* elide characters we do not want in the tag */ $this->saveTag($hashtag); } return true; @@ -1105,7 +1105,7 @@ class Notice extends Memcached_DataObject if (empty($recipient)) { continue; } - // Don't save replies from blocked profile to local user + // Do not save replies from blocked profile to local user $recipient_user = User::staticGet('id', $recipient->id); if (!empty($recipient_user) && $recipient_user->hasBlocked($sender)) { continue; @@ -1131,7 +1131,7 @@ class Notice extends Memcached_DataObject $tagged = Profile_tag::getTagged($sender->id, $tag); foreach ($tagged as $t) { if (!$replied[$t->id]) { - // Don't save replies from blocked profile to local user + // Do not save replies from blocked profile to local user $t_user = User::staticGet('id', $t->id); if ($t_user && $t_user->hasBlocked($sender)) { continue; diff --git a/classes/Profile.php b/classes/Profile.php index 7c1e9db33..a50f4951d 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -101,7 +101,7 @@ class Profile extends Memcached_DataObject } foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) { - # We don't do a scaled one if original is our scaled size + # We do not do a scaled one if original is our scaled size if (!($avatar->width == $size && $avatar->height == $size)) { $scaled_filename = $imagefile->resize($size); @@ -174,7 +174,7 @@ class Profile extends Memcached_DataObject function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null) { - // XXX: I'm not sure this is going to be any faster. It probably isn't. + // XXX: I'm not sure this is going to be any faster. It probably is not. $ids = Notice::stream(array($this, '_streamDirect'), array(), 'profile:notice_ids:' . $this->id, diff --git a/classes/User.php b/classes/User.php index 9b90ce61b..c529b82e0 100644 --- a/classes/User.php +++ b/classes/User.php @@ -87,7 +87,7 @@ class User extends Memcached_DataObject return (is_null($sub)) ? false : true; } - // 'update' won't write key columns, so we have to do it ourselves. + // 'update' will not write key columns, so we have to do it ourselves. function updateKeys(&$orig) { @@ -384,7 +384,7 @@ class User extends Memcached_DataObject return false; } - // Otherwise, cache doesn't have all faves; + // Otherwise, cache does not have all faves; // fall through to the default } @@ -463,7 +463,7 @@ class User extends Memcached_DataObject { $cache = common_memcache(); if ($cache) { - // Faves don't happen chronologically, so we need to blow + // Faves do not happen chronologically, so we need to blow // ;last cache, too $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id)); $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last')); diff --git a/lib/api.php b/lib/api.php index a1236ab7e..fb4c4289b 100644 --- a/lib/api.php +++ b/lib/api.php @@ -66,7 +66,7 @@ class ApiAction extends Action * * @param array $args Web and URL arguments * - * @return boolean false if user doesn't exist + * @return boolean false if user does not exist */ function prepare($args) @@ -138,7 +138,7 @@ class ApiAction extends Action $design = null; $user = $profile->getUser(); - // Note: some profiles don't have an associated user + // Note: some profiles do not have an associated user if (!empty($user)) { $design = $user->getDesign(); @@ -203,7 +203,7 @@ class ApiAction extends Action if ($get_notice) { $notice = $profile->getCurrentNotice(); if ($notice) { - # don't get user! + # do not get user! $twitter_user['status'] = $this->twitterStatusArray($notice, false); } } @@ -263,7 +263,7 @@ class ApiAction extends Action } if ($include_user) { - # Don't get notice (recursive!) + # Do not get notice (recursive!) $twitter_user = $this->twitterUserArray($profile, false); $twitter_status['user'] = $twitter_user; } @@ -1074,7 +1074,7 @@ class ApiAction extends Action function initTwitterAtom() { $this->startXML(); - // FIXME: don't hardcode the language here! + // FIXME: do not hardcode the language here! $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US', 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0')); @@ -1116,7 +1116,7 @@ class ApiAction extends Action return User::staticGet('nickname', $nickname); } else if ($this->arg('user_id')) { // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it doesn't get used + // overrides screen_name even if it does not get used if (is_numeric($this->arg('user_id'))) { return User::staticGet('id', $this->arg('user_id')); } @@ -1146,7 +1146,7 @@ class ApiAction extends Action return User_group::staticGet('nickname', $nickname); } else if ($this->arg('group_id')) { // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it doesn't get used + // overrides screen_name even if it does not get used if (is_numeric($this->arg('group_id'))) { return User_group::staticGet('id', $this->arg('group_id')); } diff --git a/lib/apiauth.php b/lib/apiauth.php index 2f2e44a26..b8189f15d 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -87,7 +87,7 @@ class ApiAuthAction extends ApiAction } /** - * Check for a user specified via HTTP basic auth. If there isn't + * Check for a user specified via HTTP basic auth. If there is not * one, try to get one by outputting the basic auth header. * * @return boolean true or false diff --git a/lib/dberroraction.php b/lib/dberroraction.php index 2cb66a022..893797b70 100644 --- a/lib/dberroraction.php +++ b/lib/dberroraction.php @@ -39,7 +39,7 @@ require_once INSTALLDIR.'/lib/servererroraction.php'; * * This only occurs if there's been a DB_DataObject_Error that's * reported through PEAR, so we try to avoid doing anything that connects - * to the DB, so we don't trigger it again. + * to the DB, so we do not trigger it again. * * @category Action * @package StatusNet @@ -62,12 +62,12 @@ class DBErrorAction extends ServerErrorAction function getLanguage() { - // Don't try to figure out user's language; just show the page + // Do not try to figure out user's language; just show the page return common_config('site', 'language'); } function showPrimaryNav() { - // don't show primary nav + // do not show primary nav } } diff --git a/lib/error.php b/lib/error.php index 3162cfe65..5ed5dec1b 100644 --- a/lib/error.php +++ b/lib/error.php @@ -104,11 +104,11 @@ class ErrorAction extends Action { parent::showPage(); - // We don't want to have any more output after this + // We do not want to have any more output after this exit(); } - // Overload a bunch of stuff so the page isn't too bloated + // Overload a bunch of stuff so the page is not too bloated function showBody() { diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index c2ec83c28..73bd9ce81 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -76,7 +76,7 @@ class HTMLOutputter extends XMLOutputter /** * Start an HTML document * - * If $type isn't specified, will attempt to do content negotiation. + * If $type is not specified, will attempt to do content negotiation. * * Attempts to do content negotiation for language, also. * diff --git a/lib/imagefile.php b/lib/imagefile.php index cf1668f20..edc7218d0 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -119,7 +119,7 @@ class ImageFile return; } - // Don't crop/scale if it isn't necessary + // Do not crop/scale if it is not necessary if ($size === $this->width && $size === $this->height && $x === 0 diff --git a/lib/jabber.php b/lib/jabber.php index 73f2ec660..d666fcbb3 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -437,7 +437,7 @@ function jabber_public_notice($notice) $public = common_config('xmpp', 'public'); - // FIXME PRIV don't send out private messages here + // FIXME PRIV do not send out private messages here // XXX: should we send out non-local messages if public,localonly // = false? I think not diff --git a/lib/mail.php b/lib/mail.php index 5218059e9..79630b721 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -467,7 +467,7 @@ function mail_notify_nudge($from, $to) "these days and is inviting you to post some news.\n\n". "So let's hear from you :)\n\n". "%3\$s\n\n". - "Don't reply to this email; it won't get to them.\n\n". + "Do not reply to this email. It will not get to them.\n\n". "With kind regards,\n". "%4\$s\n"), $from_profile->getBestName(), @@ -516,7 +516,7 @@ function mail_notify_message($message, $from=null, $to=null) "------------------------------------------------------\n\n". "You can reply to their message here:\n\n". "%4\$s\n\n". - "Don't reply to this email; it won't get to them.\n\n". + "Do not reply to this email. It will not get to them.\n\n". "With kind regards,\n". "%5\$s\n"), $from_profile->getBestName(), @@ -532,7 +532,7 @@ function mail_notify_message($message, $from=null, $to=null) /** * notify a user that one of their notices has been chosen as a 'fave' * - * Doesn't check that the user has an email address nor if they + * Does not check that the user has an email address nor if they * want to receive notification of faves. Maybe this happens higher * up the stack...? * diff --git a/lib/noticelist.php b/lib/noticelist.php index 027db2b3e..206724676 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -347,7 +347,7 @@ class NoticeListItem extends Widget * show the link to the main page for the notice * * Displays a link to the page for a notice, with "relative" time. Tries to - * get remote notice URLs correct, but doesn't always succeed. + * get remote notice URLs correct, but does not always succeed. * * @return void */ @@ -483,7 +483,7 @@ class NoticeListItem extends Widget * show a link to reply to the current notice * * Should either do the reply in the current notice form (if available), or - * link out to the notice-posting form. A little flakey, doesn't always work. + * link out to the notice-posting form. A little flakey, does not always work. * * @return void */ diff --git a/lib/queuehandler.php b/lib/queuehandler.php index cd43b1e09..7c07ca4f9 100644 --- a/lib/queuehandler.php +++ b/lib/queuehandler.php @@ -96,8 +96,8 @@ class QueueHandler extends Daemon * Initialization, run when the queue handler starts. * If this function indicates failure, the handler run will be aborted. * - * @fixme run() will abort if this doesn't return true, - * but some subclasses don't bother. + * @fixme run() will abort if this does not return true, + * but some subclasses do not bother. * @return boolean true on success, false on failure */ function start() @@ -108,8 +108,8 @@ class QueueHandler extends Daemon * Cleanup, run when the queue handler ends. * If this function indicates failure, a warning will be logged. * - * @fixme run() will throw warnings if this doesn't return true, - * but many subclasses don't bother. + * @fixme run() will throw warnings if this does not return true, + * but many subclasses do not bother. * @return boolean true on success, false on failure */ function finish() @@ -137,7 +137,7 @@ class QueueHandler extends Daemon * method, which passes control back to our handle_notice() method for * each notice that comes in on the queue. * - * Most of the time this won't need to be overridden in a subclass. + * Most of the time this will not need to be overridden in a subclass. * * @return boolean true on success, false on failure */ @@ -173,7 +173,7 @@ class QueueHandler extends Daemon * Called by QueueHandler after each handled item or empty polling cycle. * This is a good time to e.g. service your XMPP connection. * - * Doesn't need to be overridden if there's no maintenance to do. + * Does not need to be overridden if there's no maintenance to do. * * @param int $timeout seconds to sleep if there's nothing to do */ diff --git a/lib/rssaction.php b/lib/rssaction.php index faf6bec7d..0e84a65e9 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -386,7 +386,7 @@ class Rss10Action extends Action return null; } - // FIXME: doesn't handle modified profiles, avatars, deleted notices + // FIXME: does not handle modified profiles, avatars, deleted notices return strtotime($this->notices[0]->created); } diff --git a/lib/search_engines.php b/lib/search_engines.php index 69f6ff468..82713235c 100644 --- a/lib/search_engines.php +++ b/lib/search_engines.php @@ -119,7 +119,7 @@ class MySQLSearch extends SearchEngine return true; } else if ('identica_notices' === $this->table) { - // Don't show imported notices + // Do not show imported notices $this->target->whereAdd('notice.is_local != ' . Notice::GATEWAY); if (strtolower($q) != $q) { diff --git a/lib/util.php b/lib/util.php index dde3fb48f..8f7521e59 100644 --- a/lib/util.php +++ b/lib/util.php @@ -62,7 +62,7 @@ function common_init_language() $locale_set = common_init_locale($language); setlocale(LC_CTYPE, 'C'); - // So we don't have to make people install the gettext locales + // So we do not have to make people install the gettext locales $path = common_config('site','locale_path'); bindtextdomain("statusnet", $path); bind_textdomain_codeset("statusnet", "UTF-8"); @@ -139,7 +139,7 @@ function common_check_user($nickname, $password) } } }else{ - //no handler indicated the credentials were valid, and we know their not valid because the user isn't in the database + //no handler indicated the credentials were valid, and we know their not valid because the user is not in the database return false; } } else { @@ -396,7 +396,7 @@ function common_current_user() } // Logins that are 'remembered' aren't 'real' -- they're subject to -// cookie-stealing. So, we don't let them do certain things. New reg, +// cookie-stealing. So, we do not let them do certain things. New reg, // OpenID, and password logins _are_ real. function common_real_login($real=true) @@ -1147,7 +1147,7 @@ function common_accept_to_prefs($accept, $def = '*/*') $parts = explode(',', $accept); foreach($parts as $part) { - // FIXME: doesn't deal with params like 'text/html; level=1' + // FIXME: does not deal with params like 'text/html; level=1' @list($value, $qpart) = explode(';', trim($part)); $match = array(); if(!isset($qpart)) { @@ -1346,7 +1346,7 @@ function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext) } // FIXME: show error page if we're on the Web - /* Don't execute PHP internal error handler */ + /* Do not execute PHP internal error handler */ return true; } @@ -1448,7 +1448,7 @@ function common_shorten_url($long_url) } global $_shorteners; if (!isset($_shorteners[$svc])) { - //the user selected service doesn't exist, so default to ur1.ca + //the user selected service does not exist, so default to ur1.ca $svc = 'ur1.ca'; } if (!isset($_shorteners[$svc])) { diff --git a/lib/xmloutputter.php b/lib/xmloutputter.php index 5f06e491d..9d862b2d0 100644 --- a/lib/xmloutputter.php +++ b/lib/xmloutputter.php @@ -112,7 +112,7 @@ class XMLOutputter * * Utility for outputting an XML element. A convenient wrapper * for a bunch of longer XMLWriter calls. This is best for - * when an element doesn't have any sub-elements; if that's the + * when an element does not have any sub-elements; if that's the * case, use elementStart() and elementEnd() instead. * * The $content element will be escaped for XML. If you need diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php index 8acdcafe7..29008da64 100644 --- a/lib/xmppqueuehandler.php +++ b/lib/xmppqueuehandler.php @@ -37,7 +37,7 @@ class XmppQueueHandler extends QueueHandler function start() { - # Low priority; we don't want to receive messages + # Low priority; we do not want to receive messages $this->log(LOG_INFO, "INITIALIZE"); $this->conn = jabber_connect($this->_id.$this->transport()); diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php index 379390ffd..aeb100cfa 100644 --- a/plugins/Autocomplete/autocomplete.php +++ b/plugins/Autocomplete/autocomplete.php @@ -79,7 +79,7 @@ class AutocompleteAction extends Action function etag() { return '"' . implode(':', array($this->arg('action'), - crc32($this->arg('q')), //the actual string can have funny characters in we don't want showing up in the etag + crc32($this->arg('q')), //the actual string can have funny characters in we do not want showing up in the etag $this->arg('limit'), $this->lastModified())) . '"'; } diff --git a/plugins/BlogspamNetPlugin.php b/plugins/BlogspamNetPlugin.php index 51236001a..bf60fdcaf 100644 --- a/plugins/BlogspamNetPlugin.php +++ b/plugins/BlogspamNetPlugin.php @@ -85,7 +85,7 @@ class BlogspamNetPlugin extends Plugin } else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) { throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400); } else if (preg_match('/^OK$/', $response)) { - // don't do anything + // do not do anything } else { throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500); } diff --git a/plugins/Facebook/FBConnectAuth.php b/plugins/Facebook/FBConnectAuth.php index b909a4977..165477419 100644 --- a/plugins/Facebook/FBConnectAuth.php +++ b/plugins/Facebook/FBConnectAuth.php @@ -71,7 +71,7 @@ class FBConnectauthAction extends Action 'There is already a local user (' . $flink->user_id . ') linked with this Facebook (' . $this->fbuid . ').'); - // We don't want these cookies + // We do not want these cookies getFacebook()->clear_cookie_state(); $this->clientError(_('There is already a local user linked with this Facebook.')); @@ -364,7 +364,7 @@ class FBConnectauthAction extends Action { $url = common_get_returnto(); if ($url) { - // We don't have to return to it again + // We do not have to return to it again common_set_returnto(null); } else { $url = common_local_url('all', diff --git a/plugins/Facebook/FacebookPlugin.php b/plugins/Facebook/FacebookPlugin.php index b68534b24..cd1ad7b45 100644 --- a/plugins/Facebook/FacebookPlugin.php +++ b/plugins/Facebook/FacebookPlugin.php @@ -182,7 +182,7 @@ class FacebookPlugin extends Plugin $login_url = common_local_url('FBConnectAuth'); $logout_url = common_local_url('logout'); - // XXX: Facebook says we don't need this FB_RequireFeatures(), + // XXX: Facebook says we do not need this FB_RequireFeatures(), // but we actually do, for IE and Safari. Gar. $js = '"; } else { diff --git a/plugins/Facebook/facebook/facebook_desktop.php b/plugins/Facebook/facebook/facebook_desktop.php index e79a2ca34..425bb5c7b 100644 --- a/plugins/Facebook/facebook/facebook_desktop.php +++ b/plugins/Facebook/facebook/facebook_desktop.php @@ -93,7 +93,7 @@ class FacebookDesktop extends Facebook { } public function verify_signature($fb_params, $expected_sig) { - // we don't want to verify the signature until we have a valid + // we do not want to verify the signature until we have a valid // session secret if ($this->verify_sig) { return parent::verify_signature($fb_params, $expected_sig); diff --git a/plugins/Facebook/facebook/facebookapi_php5_restlib.php b/plugins/Facebook/facebook/facebookapi_php5_restlib.php index e2a6fe88b..781390002 100755 --- a/plugins/Facebook/facebook/facebookapi_php5_restlib.php +++ b/plugins/Facebook/facebook/facebookapi_php5_restlib.php @@ -46,7 +46,7 @@ class FacebookRestClient { // on canvas pages public $added; public $is_user; - // we don't pass friends list to iframes, but we want to make + // we do not pass friends list to iframes, but we want to make // friends_get really simple in the canvas_user (non-logged in) case. // So we use the canvas_user as default arg to friends_get public $canvas_user; @@ -657,7 +657,7 @@ function toggleDisplay(id, type) { * deleted. * * IMPORTANT: If your application has registered public tags - * that other applications may be using, don't delete those tags! + * that other applications may be using, do not delete those tags! * Doing so can break the FBML ofapplications that are using them. * * @param array $tag_names the names of the tags to delete (optinal) @@ -820,7 +820,7 @@ function toggleDisplay(id, type) { if (is_array($target_ids)) { $target_ids = json_encode($target_ids); - $target_ids = trim($target_ids, "[]"); // we don't want square brackets + $target_ids = trim($target_ids, "[]"); // we do not want square brackets } return $this->call_method('facebook.feed.publishUserAction', diff --git a/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php index 29509deba..9c6c62663 100644 --- a/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php +++ b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php @@ -1,5 +1,5 @@ location_id = $n->geonameId; $location->location_ns = self::NAMESPACE; - // handled, don't continue processing! + // handled, do not continue processing! return false; } } - // Continue processing; we don't have the answer + // Continue processing; we do not have the answer return true; } @@ -217,7 +217,7 @@ class GeonamesPlugin extends Plugin } } - // For some reason we don't know, so pass. + // For some reason we do not know, so pass. return true; } @@ -299,7 +299,7 @@ class GeonamesPlugin extends Plugin $url = 'http://www.geonames.org/' . $location->location_id; - // it's been filled, so don't process further. + // it's been filled, so do not process further. return false; } } diff --git a/plugins/OpenID/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php index ff0b451d3..b5d978294 100644 --- a/plugins/OpenID/finishopenidlogin.php +++ b/plugins/OpenID/finishopenidlogin.php @@ -341,7 +341,7 @@ class FinishopenidloginAction extends Action { $url = common_get_returnto(); if ($url) { - # We don't have to return to it again + # We do not have to return to it again common_set_returnto(null); } else { $url = common_local_url('all', @@ -421,7 +421,7 @@ class FinishopenidloginAction extends Action $parts = parse_url($openid); - # If any of these parts exist, this won't work + # If any of these parts exist, this will not work foreach ($bad as $badpart) { if (array_key_exists($badpart, $parts)) { diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php index cd042226b..4a76a8791 100644 --- a/plugins/OpenID/openid.php +++ b/plugins/OpenID/openid.php @@ -187,7 +187,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) $form_html = $auth_request->formMarkup($trust_root, $process_url, $immediate, array('id' => $form_id)); - # XXX: This is cheap, but things choke if we don't escape ampersands + # XXX: This is cheap, but things choke if we do not escape ampersands # in the HTML attributes $form_html = preg_replace('/&/', '&', $form_html); diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index 54faa0bdb..81ef7c683 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -44,7 +44,7 @@ if (!defined('STATUSNET')) { * 'piwikId' => 'id')); * * Replace 'example.com/piwik/' with the URL to your Piwik installation and - * make sure you don't forget the final /. + * make sure you do not forget the final /. * Replace 'id' with the ID your statusnet installation has in your Piwik * analytics setup - for example '8'. * diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 0c7c1240c..88a87dcf9 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -240,7 +240,7 @@ class RealtimePlugin extends Plugin // FIXME: this code should be abstracted to a neutral third // party, like Notice::asJson(). I'm not sure of the ethics // of refactoring from within a plugin, so I'm just abusing - // the ApiAction method. Don't do this unless you're me! + // the ApiAction method. Do not do this unless you're me! require_once(INSTALLDIR.'/lib/api.php'); diff --git a/plugins/TwitterBridge/daemons/synctwitterfriends.php b/plugins/TwitterBridge/daemons/synctwitterfriends.php index 6a155b301..76410c7cb 100755 --- a/plugins/TwitterBridge/daemons/synctwitterfriends.php +++ b/plugins/TwitterBridge/daemons/synctwitterfriends.php @@ -115,7 +115,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon // Each child ps needs its own DB connection // Note: DataObject::getDatabaseConnection() creates - // a new connection if there isn't one already + // a new connection if there is not one already $conn = &$flink->getDatabaseConnection(); diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index ab610e553..5d0d83be3 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -136,7 +136,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon // Each child ps needs its own DB connection // Note: DataObject::getDatabaseConnection() creates - // a new connection if there isn't one already + // a new connection if there is not one already $conn = &$flink->getDatabaseConnection(); @@ -499,7 +499,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon $avatar->height = 73; } - $avatar->original = 0; // we don't have the original + $avatar->original = 0; // we do not have the original $avatar->mediatype = $mediatype; $avatar->filename = $filename; $avatar->url = Avatar::url($filename); diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 3c6803e49..d48089caa 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -33,7 +33,7 @@ function updateTwitter_user($twitter_id, $screen_name) $fuser->query('BEGIN'); - // Dropping down to SQL because regular DB_DataObject udpate stuff doesn't seem + // Dropping down to SQL because regular DB_DataObject udpate stuff does not seem // to work so good with tables that have multiple column primary keys // Any time we update the uri for a forein user we have to make sure there diff --git a/scripts/console.php b/scripts/console.php index 2413f5079..fecb75b4a 100755 --- a/scripts/console.php +++ b/scripts/console.php @@ -60,9 +60,9 @@ function read_input_line($prompt) } /** - * On Unix-like systems where PHP readline extension isn't present, + * On Unix-like systems where PHP readline extension is not present, * -cough- Mac OS X -cough- we can shell out to bash to do it for us. - * This lets us at least handle things like arrow keys, but we don't + * This lets us at least handle things like arrow keys, but we do not * get any entry history. :( * * Shamelessly ripped from when I wrote the same code for MediaWiki. :) diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php index b4e4d9f08..4ec4526ef 100755 --- a/scripts/maildaemon.php +++ b/scripts/maildaemon.php @@ -231,7 +231,7 @@ class MailerDaemon foreach ($parsed->parts as $part) { $this->extract_part($part,$msg,$attachments); } - //we don't want any attachments that are a result of this parsing + //we do not want any attachments that are a result of this parsing return $msg; } diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php index c7ed15e49..f5f824dee 100755 --- a/scripts/xmppconfirmhandler.php +++ b/scripts/xmppconfirmhandler.php @@ -69,7 +69,7 @@ class XmppConfirmHandler extends XmppQueueHandler continue; } else { $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address); - # Mark confirmation sent; need a dupe so we don't have the WHERE clause + # Mark confirmation sent; need a dupe so we do not have the WHERE clause $dupe = Confirm_address::staticGet('code', $confirm->code); if (!$dupe) { common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__); -- cgit v1.2.3-54-g00ecf From 2a0a363e1d846334bc37d46b5f6f42e64a5a96eb Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 8 Nov 2009 23:06:25 +0000 Subject: Updated Realtime plugin to use the util's NoticeReply object --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index e82b4dbfb..ca6ea891a 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -76,7 +76,7 @@ RealtimeUpdate = { $("#notices_primary .notices").prepend(noticeItem); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(1000); - NoticeReply(); + SN.U.NoticeReply(); RealtimeUpdate._updatecounter += 1; document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; -- cgit v1.2.3-54-g00ecf From 088081675fb7d5250a9b9dfe5015de0822cb5ac2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 9 Nov 2009 20:01:46 +0100 Subject: Revert "Remove more contractions" This reverts commit 5ab709b73977131813884558bf56d97172a7aa26. Missed this one yesterday... --- actions/allrss.php | 2 +- actions/apiaccountratelimitstatus.php | 2 +- actions/apifriendshipsdestroy.php | 2 +- actions/attachment.php | 4 ++-- actions/avatarbynickname.php | 2 +- actions/groupblock.php | 2 +- actions/login.php | 2 +- actions/logout.php | 2 +- actions/newmessage.php | 2 +- actions/newnotice.php | 2 +- actions/opensearch.php | 2 +- actions/passwordsettings.php | 2 +- actions/register.php | 2 +- actions/showgroup.php | 2 +- actions/showmessage.php | 8 ++++---- actions/shownotice.php | 6 +++--- actions/showstream.php | 2 +- actions/sup.php | 2 +- actions/twitapisearchatom.php | 2 +- actions/twitapitrends.php | 2 +- classes/File_redirection.php | 8 ++++---- classes/Notice.php | 6 +++--- classes/Profile.php | 4 ++-- classes/User.php | 6 +++--- lib/api.php | 14 +++++++------- lib/apiauth.php | 2 +- lib/dberroraction.php | 6 +++--- lib/error.php | 4 ++-- lib/htmloutputter.php | 2 +- lib/imagefile.php | 2 +- lib/jabber.php | 2 +- lib/mail.php | 6 +++--- lib/noticelist.php | 4 ++-- lib/queuehandler.php | 12 ++++++------ lib/rssaction.php | 2 +- lib/search_engines.php | 2 +- lib/util.php | 12 ++++++------ lib/xmloutputter.php | 2 +- lib/xmppqueuehandler.php | 2 +- plugins/Autocomplete/autocomplete.php | 2 +- plugins/BlogspamNetPlugin.php | 2 +- plugins/Facebook/FBConnectAuth.php | 4 ++-- plugins/Facebook/FacebookPlugin.php | 4 ++-- plugins/Facebook/facebook/facebook.php | 8 ++++---- plugins/Facebook/facebook/facebook_desktop.php | 2 +- plugins/Facebook/facebook/facebookapi_php5_restlib.php | 6 +++--- plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php | 2 +- plugins/Facebook/facebookaction.php | 6 +++--- plugins/GeonamesPlugin.php | 8 ++++---- plugins/OpenID/finishopenidlogin.php | 4 ++-- plugins/OpenID/openid.php | 2 +- plugins/PiwikAnalyticsPlugin.php | 2 +- plugins/Realtime/RealtimePlugin.php | 2 +- plugins/TwitterBridge/daemons/synctwitterfriends.php | 2 +- plugins/TwitterBridge/daemons/twitterstatusfetcher.php | 4 ++-- plugins/TwitterBridge/twitter.php | 2 +- scripts/console.php | 4 ++-- scripts/maildaemon.php | 2 +- scripts/xmppconfirmhandler.php | 2 +- 59 files changed, 110 insertions(+), 110 deletions(-) (limited to 'plugins/Realtime') diff --git a/actions/allrss.php b/actions/allrss.php index 4a5d15c7b..28b1be27d 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -56,7 +56,7 @@ class AllrssAction extends Rss10Action * * @param array $args Web and URL arguments * - * @return boolean false if user does not exist + * @return boolean false if user doesn't exist */ function prepare($args) { diff --git a/actions/apiaccountratelimitstatus.php b/actions/apiaccountratelimitstatus.php index c7c0e7c00..96179f175 100644 --- a/actions/apiaccountratelimitstatus.php +++ b/actions/apiaccountratelimitstatus.php @@ -36,7 +36,7 @@ if (!defined('STATUSNET')) { require_once INSTALLDIR . '/lib/apibareauth.php'; /** - * We do not have a rate limit, but some clients check this method. + * We don't have a rate limit, but some clients check this method. * It always returns the same thing: 150 hits left. * * @category API diff --git a/actions/apifriendshipsdestroy.php b/actions/apifriendshipsdestroy.php index fb73624c9..3d9b7e001 100644 --- a/actions/apifriendshipsdestroy.php +++ b/actions/apifriendshipsdestroy.php @@ -113,7 +113,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction return; } - // Do not allow unsubscribing from yourself! + // Don't allow unsubscribing from yourself! if ($this->user->id == $this->other->id) { $this->clientError( diff --git a/actions/attachment.php b/actions/attachment.php index ca9e57845..6981354d1 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -146,7 +146,7 @@ class AttachmentAction extends Action } /** - * Do not show local navigation + * Don't show local navigation * * @return void */ @@ -170,7 +170,7 @@ class AttachmentAction extends Action } /** - * Do not show page notice + * Don't show page notice * * @return void */ diff --git a/actions/avatarbynickname.php b/actions/avatarbynickname.php index 1a6925e11..537950792 100644 --- a/actions/avatarbynickname.php +++ b/actions/avatarbynickname.php @@ -49,7 +49,7 @@ class AvatarbynicknameAction extends Action * * @param array $args query arguments * - * @return boolean false if nickname or user is not found + * @return boolean false if nickname or user isn't found */ function handle($args) { diff --git a/actions/groupblock.php b/actions/groupblock.php index 133101eb7..979a56a81 100644 --- a/actions/groupblock.php +++ b/actions/groupblock.php @@ -95,7 +95,7 @@ class GroupblockAction extends Action $this->clientError(_('User is already blocked from group.')); return false; } - // XXX: could have proactive blocks, but we do not have UI for it. + // XXX: could have proactive blocks, but we don't have UI for it. if (!$this->profile->isMember($this->group)) { $this->clientError(_('User is not a member of group.')); return false; diff --git a/actions/login.php b/actions/login.php index 679817520..ad57dd667 100644 --- a/actions/login.php +++ b/actions/login.php @@ -159,7 +159,7 @@ class LoginAction extends Action $url = common_get_returnto(); if ($url) { - // We do not have to return to it again + // We don't have to return to it again common_set_returnto(null); } else { $url = common_local_url('all', diff --git a/actions/logout.php b/actions/logout.php index 7e768fca6..1e0adae57 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -81,7 +81,7 @@ class LogoutAction extends Action { common_set_user(null); common_real_login(false); // not logged in - common_forgetme(); // do not log back in! + common_forgetme(); // don't log back in! } } diff --git a/actions/newmessage.php b/actions/newmessage.php index 73307fdfc..0db2e7181 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -61,7 +61,7 @@ class NewmessageAction extends Action /** * Title of the page * - * Note that this usually does not get called unless something went wrong + * Note that this usually doesn't get called unless something went wrong * * @return string page title */ diff --git a/actions/newnotice.php b/actions/newnotice.php index fc06e5c98..fbd7ab6bc 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -59,7 +59,7 @@ class NewnoticeAction extends Action /** * Title of the page * - * Note that this usually does not get called unless something went wrong + * Note that this usually doesn't get called unless something went wrong * * @return string page title */ diff --git a/actions/opensearch.php b/actions/opensearch.php index b205d2fe2..861b53d7d 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -52,7 +52,7 @@ class OpensearchAction extends Action * * @param array $args query arguments * - * @return boolean false if user does not exist + * @return boolean false if user doesn't exist */ function handle($args) { diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php index 6658d279f..87eb45a7d 100644 --- a/actions/passwordsettings.php +++ b/actions/passwordsettings.php @@ -97,7 +97,7 @@ class PasswordsettingsAction extends AccountSettingsAction $this->elementStart('ul', 'form_data'); - // Users who logged in with OpenID will not have a pwd + // Users who logged in with OpenID won't have a pwd if ($user->password) { $this->elementStart('li'); $this->password('oldpassword', _('Old password')); diff --git a/actions/register.php b/actions/register.php index c4f6760aa..57f8e7bdf 100644 --- a/actions/register.php +++ b/actions/register.php @@ -174,7 +174,7 @@ class RegisterAction extends Action $bio = $this->trimmed('bio'); $location = $this->trimmed('location'); - // We do not trim these... whitespace is OK in a password! + // We don't trim these... whitespace is OK in a password! $password = $this->arg('password'); $confirm = $this->arg('confirm'); diff --git a/actions/showgroup.php b/actions/showgroup.php index ae956befa..a4af29391 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -418,7 +418,7 @@ class ShowgroupAction extends GroupDesignAction // XXX: WORM cache this $members = $this->group->getMembers(); $members_count = 0; - /** $member->count() does not work. */ + /** $member->count() doesn't work. */ while ($members->fetch()) { $members_count++; } diff --git a/actions/showmessage.php b/actions/showmessage.php index cf3a819c1..db757948b 100644 --- a/actions/showmessage.php +++ b/actions/showmessage.php @@ -137,7 +137,7 @@ class ShowmessageAction extends MailboxAction } /** - * Do not show local navigation + * Don't show local navigation * * @return void */ @@ -147,7 +147,7 @@ class ShowmessageAction extends MailboxAction } /** - * Do not show page notice + * Don't show page notice * * @return void */ @@ -157,7 +157,7 @@ class ShowmessageAction extends MailboxAction } /** - * Do not show aside + * Don't show aside * * @return void */ @@ -167,7 +167,7 @@ class ShowmessageAction extends MailboxAction } /** - * Do not show any instructions + * Don't show any instructions * * @return string */ diff --git a/actions/shownotice.php b/actions/shownotice.php index 688089f02..5d16fdad9 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -208,7 +208,7 @@ class ShownoticeAction extends OwnerDesignAction } /** - * Do not show local navigation + * Don't show local navigation * * @return void */ @@ -234,7 +234,7 @@ class ShownoticeAction extends OwnerDesignAction } /** - * Do not show page notice + * Don't show page notice * * @return void */ @@ -244,7 +244,7 @@ class ShownoticeAction extends OwnerDesignAction } /** - * Do not show aside + * Don't show aside * * @return void */ diff --git a/actions/showstream.php b/actions/showstream.php index 4952ebdb7..663638c18 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -253,7 +253,7 @@ class ShowstreamAction extends ProfileAction } } -// We do not show the author for a profile, since we already know who it is! +// We don't show the author for a profile, since we already know who it is! class ProfileNoticeList extends NoticeList { diff --git a/actions/sup.php b/actions/sup.php index a199f247e..5daf0a1c1 100644 --- a/actions/sup.php +++ b/actions/sup.php @@ -61,7 +61,7 @@ class SupAction extends Action $notice = new Notice(); # XXX: cache this. Depends on how big this protocol becomes; - # Re-doing this query every 15 seconds is not the end of the world. + # Re-doing this query every 15 seconds isn't the end of the world. $divider = common_sql_date(time() - $seconds); diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 511d7cdc6..7d618c471 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -250,7 +250,7 @@ class TwitapisearchatomAction extends ApiAction } // FIXME: this alternate link is not quite right because our - // web-based notice search does not support a rpp (responses per + // web-based notice search doesn't support a rpp (responses per // page) param yet $this->element('link', array('type' => 'text/html', diff --git a/actions/twitapitrends.php b/actions/twitapitrends.php index 2d17e77cc..779405e6d 100644 --- a/actions/twitapitrends.php +++ b/actions/twitapitrends.php @@ -55,7 +55,7 @@ class TwitapitrendsAction extends ApiAction * * @param array $args Web and URL arguments * - * @return boolean false if user does not exist + * @return boolean false if user doesn't exist */ function prepare($args) { diff --git a/classes/File_redirection.php b/classes/File_redirection.php index c951c1ee7..08a6e8d8b 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -53,7 +53,7 @@ class File_redirection extends Memcached_DataObject 'connect_timeout' => 10, // # seconds to wait 'max_redirs' => $redirs, // # max number of http redirections to follow 'follow_redirects' => true, // Follow redirects - 'store_body' => false, // We will not need body content here. + 'store_body' => false, // We won't need body content here. )); return $request; } @@ -81,12 +81,12 @@ class File_redirection extends Memcached_DataObject } try { $request = self::_commonHttp($short_url, $redirs); - // Do not include body in output + // Don't include body in output $request->setMethod(HTTP_Request2::METHOD_HEAD); $response = $request->send(); if (405 == $response->getStatus()) { - // Server does not support HEAD method? Can this really happen? + // Server doesn't support HEAD method? Can this really happen? // We'll try again as a GET and ignore the response data. $request = self::_commonHttp($short_url, $redirs); $response = $request->send(); @@ -178,7 +178,7 @@ class File_redirection extends Memcached_DataObject case 'aim': case 'jabber': case 'xmpp': - // do not touch anything + // don't touch anything break; default: diff --git a/classes/Notice.php b/classes/Notice.php index 32a8b693c..9886875cb 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -146,7 +146,7 @@ class Notice extends Memcached_DataObject /* Add them to the database */ foreach(array_unique($hashtags) as $hashtag) { - /* elide characters we do not want in the tag */ + /* elide characters we don't want in the tag */ $this->saveTag($hashtag); } return true; @@ -1105,7 +1105,7 @@ class Notice extends Memcached_DataObject if (empty($recipient)) { continue; } - // Do not save replies from blocked profile to local user + // Don't save replies from blocked profile to local user $recipient_user = User::staticGet('id', $recipient->id); if (!empty($recipient_user) && $recipient_user->hasBlocked($sender)) { continue; @@ -1131,7 +1131,7 @@ class Notice extends Memcached_DataObject $tagged = Profile_tag::getTagged($sender->id, $tag); foreach ($tagged as $t) { if (!$replied[$t->id]) { - // Do not save replies from blocked profile to local user + // Don't save replies from blocked profile to local user $t_user = User::staticGet('id', $t->id); if ($t_user && $t_user->hasBlocked($sender)) { continue; diff --git a/classes/Profile.php b/classes/Profile.php index a50f4951d..7c1e9db33 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -101,7 +101,7 @@ class Profile extends Memcached_DataObject } foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) { - # We do not do a scaled one if original is our scaled size + # We don't do a scaled one if original is our scaled size if (!($avatar->width == $size && $avatar->height == $size)) { $scaled_filename = $imagefile->resize($size); @@ -174,7 +174,7 @@ class Profile extends Memcached_DataObject function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null) { - // XXX: I'm not sure this is going to be any faster. It probably is not. + // XXX: I'm not sure this is going to be any faster. It probably isn't. $ids = Notice::stream(array($this, '_streamDirect'), array(), 'profile:notice_ids:' . $this->id, diff --git a/classes/User.php b/classes/User.php index c529b82e0..9b90ce61b 100644 --- a/classes/User.php +++ b/classes/User.php @@ -87,7 +87,7 @@ class User extends Memcached_DataObject return (is_null($sub)) ? false : true; } - // 'update' will not write key columns, so we have to do it ourselves. + // 'update' won't write key columns, so we have to do it ourselves. function updateKeys(&$orig) { @@ -384,7 +384,7 @@ class User extends Memcached_DataObject return false; } - // Otherwise, cache does not have all faves; + // Otherwise, cache doesn't have all faves; // fall through to the default } @@ -463,7 +463,7 @@ class User extends Memcached_DataObject { $cache = common_memcache(); if ($cache) { - // Faves do not happen chronologically, so we need to blow + // Faves don't happen chronologically, so we need to blow // ;last cache, too $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id)); $cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last')); diff --git a/lib/api.php b/lib/api.php index fb4c4289b..a1236ab7e 100644 --- a/lib/api.php +++ b/lib/api.php @@ -66,7 +66,7 @@ class ApiAction extends Action * * @param array $args Web and URL arguments * - * @return boolean false if user does not exist + * @return boolean false if user doesn't exist */ function prepare($args) @@ -138,7 +138,7 @@ class ApiAction extends Action $design = null; $user = $profile->getUser(); - // Note: some profiles do not have an associated user + // Note: some profiles don't have an associated user if (!empty($user)) { $design = $user->getDesign(); @@ -203,7 +203,7 @@ class ApiAction extends Action if ($get_notice) { $notice = $profile->getCurrentNotice(); if ($notice) { - # do not get user! + # don't get user! $twitter_user['status'] = $this->twitterStatusArray($notice, false); } } @@ -263,7 +263,7 @@ class ApiAction extends Action } if ($include_user) { - # Do not get notice (recursive!) + # Don't get notice (recursive!) $twitter_user = $this->twitterUserArray($profile, false); $twitter_status['user'] = $twitter_user; } @@ -1074,7 +1074,7 @@ class ApiAction extends Action function initTwitterAtom() { $this->startXML(); - // FIXME: do not hardcode the language here! + // FIXME: don't hardcode the language here! $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', 'xml:lang' => 'en-US', 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0')); @@ -1116,7 +1116,7 @@ class ApiAction extends Action return User::staticGet('nickname', $nickname); } else if ($this->arg('user_id')) { // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it does not get used + // overrides screen_name even if it doesn't get used if (is_numeric($this->arg('user_id'))) { return User::staticGet('id', $this->arg('user_id')); } @@ -1146,7 +1146,7 @@ class ApiAction extends Action return User_group::staticGet('nickname', $nickname); } else if ($this->arg('group_id')) { // This is to ensure that a non-numeric user_id still - // overrides screen_name even if it does not get used + // overrides screen_name even if it doesn't get used if (is_numeric($this->arg('group_id'))) { return User_group::staticGet('id', $this->arg('group_id')); } diff --git a/lib/apiauth.php b/lib/apiauth.php index b8189f15d..2f2e44a26 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -87,7 +87,7 @@ class ApiAuthAction extends ApiAction } /** - * Check for a user specified via HTTP basic auth. If there is not + * Check for a user specified via HTTP basic auth. If there isn't * one, try to get one by outputting the basic auth header. * * @return boolean true or false diff --git a/lib/dberroraction.php b/lib/dberroraction.php index 893797b70..2cb66a022 100644 --- a/lib/dberroraction.php +++ b/lib/dberroraction.php @@ -39,7 +39,7 @@ require_once INSTALLDIR.'/lib/servererroraction.php'; * * This only occurs if there's been a DB_DataObject_Error that's * reported through PEAR, so we try to avoid doing anything that connects - * to the DB, so we do not trigger it again. + * to the DB, so we don't trigger it again. * * @category Action * @package StatusNet @@ -62,12 +62,12 @@ class DBErrorAction extends ServerErrorAction function getLanguage() { - // Do not try to figure out user's language; just show the page + // Don't try to figure out user's language; just show the page return common_config('site', 'language'); } function showPrimaryNav() { - // do not show primary nav + // don't show primary nav } } diff --git a/lib/error.php b/lib/error.php index 5ed5dec1b..3162cfe65 100644 --- a/lib/error.php +++ b/lib/error.php @@ -104,11 +104,11 @@ class ErrorAction extends Action { parent::showPage(); - // We do not want to have any more output after this + // We don't want to have any more output after this exit(); } - // Overload a bunch of stuff so the page is not too bloated + // Overload a bunch of stuff so the page isn't too bloated function showBody() { diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 73bd9ce81..c2ec83c28 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -76,7 +76,7 @@ class HTMLOutputter extends XMLOutputter /** * Start an HTML document * - * If $type is not specified, will attempt to do content negotiation. + * If $type isn't specified, will attempt to do content negotiation. * * Attempts to do content negotiation for language, also. * diff --git a/lib/imagefile.php b/lib/imagefile.php index edc7218d0..cf1668f20 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -119,7 +119,7 @@ class ImageFile return; } - // Do not crop/scale if it is not necessary + // Don't crop/scale if it isn't necessary if ($size === $this->width && $size === $this->height && $x === 0 diff --git a/lib/jabber.php b/lib/jabber.php index d666fcbb3..73f2ec660 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -437,7 +437,7 @@ function jabber_public_notice($notice) $public = common_config('xmpp', 'public'); - // FIXME PRIV do not send out private messages here + // FIXME PRIV don't send out private messages here // XXX: should we send out non-local messages if public,localonly // = false? I think not diff --git a/lib/mail.php b/lib/mail.php index 79630b721..5218059e9 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -467,7 +467,7 @@ function mail_notify_nudge($from, $to) "these days and is inviting you to post some news.\n\n". "So let's hear from you :)\n\n". "%3\$s\n\n". - "Do not reply to this email. It will not get to them.\n\n". + "Don't reply to this email; it won't get to them.\n\n". "With kind regards,\n". "%4\$s\n"), $from_profile->getBestName(), @@ -516,7 +516,7 @@ function mail_notify_message($message, $from=null, $to=null) "------------------------------------------------------\n\n". "You can reply to their message here:\n\n". "%4\$s\n\n". - "Do not reply to this email. It will not get to them.\n\n". + "Don't reply to this email; it won't get to them.\n\n". "With kind regards,\n". "%5\$s\n"), $from_profile->getBestName(), @@ -532,7 +532,7 @@ function mail_notify_message($message, $from=null, $to=null) /** * notify a user that one of their notices has been chosen as a 'fave' * - * Does not check that the user has an email address nor if they + * Doesn't check that the user has an email address nor if they * want to receive notification of faves. Maybe this happens higher * up the stack...? * diff --git a/lib/noticelist.php b/lib/noticelist.php index 4e5623ded..bf12bb73c 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -347,7 +347,7 @@ class NoticeListItem extends Widget * show the link to the main page for the notice * * Displays a link to the page for a notice, with "relative" time. Tries to - * get remote notice URLs correct, but does not always succeed. + * get remote notice URLs correct, but doesn't always succeed. * * @return void */ @@ -483,7 +483,7 @@ class NoticeListItem extends Widget * show a link to reply to the current notice * * Should either do the reply in the current notice form (if available), or - * link out to the notice-posting form. A little flakey, does not always work. + * link out to the notice-posting form. A little flakey, doesn't always work. * * @return void */ diff --git a/lib/queuehandler.php b/lib/queuehandler.php index 7c07ca4f9..cd43b1e09 100644 --- a/lib/queuehandler.php +++ b/lib/queuehandler.php @@ -96,8 +96,8 @@ class QueueHandler extends Daemon * Initialization, run when the queue handler starts. * If this function indicates failure, the handler run will be aborted. * - * @fixme run() will abort if this does not return true, - * but some subclasses do not bother. + * @fixme run() will abort if this doesn't return true, + * but some subclasses don't bother. * @return boolean true on success, false on failure */ function start() @@ -108,8 +108,8 @@ class QueueHandler extends Daemon * Cleanup, run when the queue handler ends. * If this function indicates failure, a warning will be logged. * - * @fixme run() will throw warnings if this does not return true, - * but many subclasses do not bother. + * @fixme run() will throw warnings if this doesn't return true, + * but many subclasses don't bother. * @return boolean true on success, false on failure */ function finish() @@ -137,7 +137,7 @@ class QueueHandler extends Daemon * method, which passes control back to our handle_notice() method for * each notice that comes in on the queue. * - * Most of the time this will not need to be overridden in a subclass. + * Most of the time this won't need to be overridden in a subclass. * * @return boolean true on success, false on failure */ @@ -173,7 +173,7 @@ class QueueHandler extends Daemon * Called by QueueHandler after each handled item or empty polling cycle. * This is a good time to e.g. service your XMPP connection. * - * Does not need to be overridden if there's no maintenance to do. + * Doesn't need to be overridden if there's no maintenance to do. * * @param int $timeout seconds to sleep if there's nothing to do */ diff --git a/lib/rssaction.php b/lib/rssaction.php index 0e84a65e9..faf6bec7d 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -386,7 +386,7 @@ class Rss10Action extends Action return null; } - // FIXME: does not handle modified profiles, avatars, deleted notices + // FIXME: doesn't handle modified profiles, avatars, deleted notices return strtotime($this->notices[0]->created); } diff --git a/lib/search_engines.php b/lib/search_engines.php index 82713235c..69f6ff468 100644 --- a/lib/search_engines.php +++ b/lib/search_engines.php @@ -119,7 +119,7 @@ class MySQLSearch extends SearchEngine return true; } else if ('identica_notices' === $this->table) { - // Do not show imported notices + // Don't show imported notices $this->target->whereAdd('notice.is_local != ' . Notice::GATEWAY); if (strtolower($q) != $q) { diff --git a/lib/util.php b/lib/util.php index b4f5af1af..a4865c46c 100644 --- a/lib/util.php +++ b/lib/util.php @@ -62,7 +62,7 @@ function common_init_language() $locale_set = common_init_locale($language); setlocale(LC_CTYPE, 'C'); - // So we do not have to make people install the gettext locales + // So we don't have to make people install the gettext locales $path = common_config('site','locale_path'); bindtextdomain("statusnet", $path); bind_textdomain_codeset("statusnet", "UTF-8"); @@ -139,7 +139,7 @@ function common_check_user($nickname, $password) } } }else{ - //no handler indicated the credentials were valid, and we know their not valid because the user is not in the database + //no handler indicated the credentials were valid, and we know their not valid because the user isn't in the database return false; } } else { @@ -396,7 +396,7 @@ function common_current_user() } // Logins that are 'remembered' aren't 'real' -- they're subject to -// cookie-stealing. So, we do not let them do certain things. New reg, +// cookie-stealing. So, we don't let them do certain things. New reg, // OpenID, and password logins _are_ real. function common_real_login($real=true) @@ -1147,7 +1147,7 @@ function common_accept_to_prefs($accept, $def = '*/*') $parts = explode(',', $accept); foreach($parts as $part) { - // FIXME: does not deal with params like 'text/html; level=1' + // FIXME: doesn't deal with params like 'text/html; level=1' @list($value, $qpart) = explode(';', trim($part)); $match = array(); if(!isset($qpart)) { @@ -1346,7 +1346,7 @@ function common_error_handler($errno, $errstr, $errfile, $errline, $errcontext) } // FIXME: show error page if we're on the Web - /* Do not execute PHP internal error handler */ + /* Don't execute PHP internal error handler */ return true; } @@ -1448,7 +1448,7 @@ function common_shorten_url($long_url) } global $_shorteners; if (!isset($_shorteners[$svc])) { - //the user selected service does not exist, so default to ur1.ca + //the user selected service doesn't exist, so default to ur1.ca $svc = 'ur1.ca'; } if (!isset($_shorteners[$svc])) { diff --git a/lib/xmloutputter.php b/lib/xmloutputter.php index 9d862b2d0..5f06e491d 100644 --- a/lib/xmloutputter.php +++ b/lib/xmloutputter.php @@ -112,7 +112,7 @@ class XMLOutputter * * Utility for outputting an XML element. A convenient wrapper * for a bunch of longer XMLWriter calls. This is best for - * when an element does not have any sub-elements; if that's the + * when an element doesn't have any sub-elements; if that's the * case, use elementStart() and elementEnd() instead. * * The $content element will be escaped for XML. If you need diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php index 7caa078ae..f28fc9088 100644 --- a/lib/xmppqueuehandler.php +++ b/lib/xmppqueuehandler.php @@ -37,7 +37,7 @@ class XmppQueueHandler extends QueueHandler function start() { - # Low priority; we do not want to receive messages + # Low priority; we don't want to receive messages $this->log(LOG_INFO, "INITIALIZE"); $this->conn = jabber_connect($this->_id.$this->transport()); diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php index aeb100cfa..379390ffd 100644 --- a/plugins/Autocomplete/autocomplete.php +++ b/plugins/Autocomplete/autocomplete.php @@ -79,7 +79,7 @@ class AutocompleteAction extends Action function etag() { return '"' . implode(':', array($this->arg('action'), - crc32($this->arg('q')), //the actual string can have funny characters in we do not want showing up in the etag + crc32($this->arg('q')), //the actual string can have funny characters in we don't want showing up in the etag $this->arg('limit'), $this->lastModified())) . '"'; } diff --git a/plugins/BlogspamNetPlugin.php b/plugins/BlogspamNetPlugin.php index bf60fdcaf..51236001a 100644 --- a/plugins/BlogspamNetPlugin.php +++ b/plugins/BlogspamNetPlugin.php @@ -85,7 +85,7 @@ class BlogspamNetPlugin extends Plugin } else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) { throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400); } else if (preg_match('/^OK$/', $response)) { - // do not do anything + // don't do anything } else { throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500); } diff --git a/plugins/Facebook/FBConnectAuth.php b/plugins/Facebook/FBConnectAuth.php index 165477419..b909a4977 100644 --- a/plugins/Facebook/FBConnectAuth.php +++ b/plugins/Facebook/FBConnectAuth.php @@ -71,7 +71,7 @@ class FBConnectauthAction extends Action 'There is already a local user (' . $flink->user_id . ') linked with this Facebook (' . $this->fbuid . ').'); - // We do not want these cookies + // We don't want these cookies getFacebook()->clear_cookie_state(); $this->clientError(_('There is already a local user linked with this Facebook.')); @@ -364,7 +364,7 @@ class FBConnectauthAction extends Action { $url = common_get_returnto(); if ($url) { - // We do not have to return to it again + // We don't have to return to it again common_set_returnto(null); } else { $url = common_local_url('all', diff --git a/plugins/Facebook/FacebookPlugin.php b/plugins/Facebook/FacebookPlugin.php index cd1ad7b45..b68534b24 100644 --- a/plugins/Facebook/FacebookPlugin.php +++ b/plugins/Facebook/FacebookPlugin.php @@ -182,7 +182,7 @@ class FacebookPlugin extends Plugin $login_url = common_local_url('FBConnectAuth'); $logout_url = common_local_url('logout'); - // XXX: Facebook says we do not need this FB_RequireFeatures(), + // XXX: Facebook says we don't need this FB_RequireFeatures(), // but we actually do, for IE and Safari. Gar. $js = '"; } else { diff --git a/plugins/Facebook/facebook/facebook_desktop.php b/plugins/Facebook/facebook/facebook_desktop.php index 425bb5c7b..e79a2ca34 100644 --- a/plugins/Facebook/facebook/facebook_desktop.php +++ b/plugins/Facebook/facebook/facebook_desktop.php @@ -93,7 +93,7 @@ class FacebookDesktop extends Facebook { } public function verify_signature($fb_params, $expected_sig) { - // we do not want to verify the signature until we have a valid + // we don't want to verify the signature until we have a valid // session secret if ($this->verify_sig) { return parent::verify_signature($fb_params, $expected_sig); diff --git a/plugins/Facebook/facebook/facebookapi_php5_restlib.php b/plugins/Facebook/facebook/facebookapi_php5_restlib.php index c742df748..55cb7fb86 100755 --- a/plugins/Facebook/facebook/facebookapi_php5_restlib.php +++ b/plugins/Facebook/facebook/facebookapi_php5_restlib.php @@ -46,7 +46,7 @@ class FacebookRestClient { // on canvas pages public $added; public $is_user; - // we do not pass friends list to iframes, but we want to make + // we don't pass friends list to iframes, but we want to make // friends_get really simple in the canvas_user (non-logged in) case. // So we use the canvas_user as default arg to friends_get public $canvas_user; @@ -657,7 +657,7 @@ function toggleDisplay(id, type) { * deleted. * * IMPORTANT: If your application has registered public tags - * that other applications may be using, do not delete those tags! + * that other applications may be using, don't delete those tags! * Doing so can break the FBML ofapplications that are using them. * * @param array $tag_names the names of the tags to delete (optinal) @@ -820,7 +820,7 @@ function toggleDisplay(id, type) { if (is_array($target_ids)) { $target_ids = json_encode($target_ids); - $target_ids = trim($target_ids, "[]"); // we do not want square brackets + $target_ids = trim($target_ids, "[]"); // we don't want square brackets } return $this->call_method('facebook.feed.publishUserAction', diff --git a/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php index 9c6c62663..29509deba 100644 --- a/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php +++ b/plugins/Facebook/facebook/jsonwrapper/jsonwrapper.php @@ -1,5 +1,5 @@ location_id = $n->geonameId; $location->location_ns = self::NAMESPACE; - // handled, do not continue processing! + // handled, don't continue processing! return false; } } - // Continue processing; we do not have the answer + // Continue processing; we don't have the answer return true; } @@ -217,7 +217,7 @@ class GeonamesPlugin extends Plugin } } - // For some reason we do not know, so pass. + // For some reason we don't know, so pass. return true; } @@ -299,7 +299,7 @@ class GeonamesPlugin extends Plugin $url = 'http://www.geonames.org/' . $location->location_id; - // it's been filled, so do not process further. + // it's been filled, so don't process further. return false; } } diff --git a/plugins/OpenID/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php index b5d978294..ff0b451d3 100644 --- a/plugins/OpenID/finishopenidlogin.php +++ b/plugins/OpenID/finishopenidlogin.php @@ -341,7 +341,7 @@ class FinishopenidloginAction extends Action { $url = common_get_returnto(); if ($url) { - # We do not have to return to it again + # We don't have to return to it again common_set_returnto(null); } else { $url = common_local_url('all', @@ -421,7 +421,7 @@ class FinishopenidloginAction extends Action $parts = parse_url($openid); - # If any of these parts exist, this will not work + # If any of these parts exist, this won't work foreach ($bad as $badpart) { if (array_key_exists($badpart, $parts)) { diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php index c5f6d1713..ff7a93899 100644 --- a/plugins/OpenID/openid.php +++ b/plugins/OpenID/openid.php @@ -187,7 +187,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false) $form_html = $auth_request->formMarkup($trust_root, $process_url, $immediate, array('id' => $form_id)); - # XXX: This is cheap, but things choke if we do not escape ampersands + # XXX: This is cheap, but things choke if we don't escape ampersands # in the HTML attributes $form_html = preg_replace('/&/', '&', $form_html); diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index 81ef7c683..54faa0bdb 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -44,7 +44,7 @@ if (!defined('STATUSNET')) { * 'piwikId' => 'id')); * * Replace 'example.com/piwik/' with the URL to your Piwik installation and - * make sure you do not forget the final /. + * make sure you don't forget the final /. * Replace 'id' with the ID your statusnet installation has in your Piwik * analytics setup - for example '8'. * diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 88a87dcf9..0c7c1240c 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -240,7 +240,7 @@ class RealtimePlugin extends Plugin // FIXME: this code should be abstracted to a neutral third // party, like Notice::asJson(). I'm not sure of the ethics // of refactoring from within a plugin, so I'm just abusing - // the ApiAction method. Do not do this unless you're me! + // the ApiAction method. Don't do this unless you're me! require_once(INSTALLDIR.'/lib/api.php'); diff --git a/plugins/TwitterBridge/daemons/synctwitterfriends.php b/plugins/TwitterBridge/daemons/synctwitterfriends.php index c89c02eed..671e3c7af 100755 --- a/plugins/TwitterBridge/daemons/synctwitterfriends.php +++ b/plugins/TwitterBridge/daemons/synctwitterfriends.php @@ -115,7 +115,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon // Each child ps needs its own DB connection // Note: DataObject::getDatabaseConnection() creates - // a new connection if there is not one already + // a new connection if there isn't one already $conn = &$flink->getDatabaseConnection(); diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php index 25df0d839..b5428316b 100755 --- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php +++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php @@ -136,7 +136,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon // Each child ps needs its own DB connection // Note: DataObject::getDatabaseConnection() creates - // a new connection if there is not one already + // a new connection if there isn't one already $conn = &$flink->getDatabaseConnection(); @@ -499,7 +499,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon $avatar->height = 73; } - $avatar->original = 0; // we do not have the original + $avatar->original = 0; // we don't have the original $avatar->mediatype = $mediatype; $avatar->filename = $filename; $avatar->url = Avatar::url($filename); diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index d48089caa..3c6803e49 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -33,7 +33,7 @@ function updateTwitter_user($twitter_id, $screen_name) $fuser->query('BEGIN'); - // Dropping down to SQL because regular DB_DataObject udpate stuff does not seem + // Dropping down to SQL because regular DB_DataObject udpate stuff doesn't seem // to work so good with tables that have multiple column primary keys // Any time we update the uri for a forein user we have to make sure there diff --git a/scripts/console.php b/scripts/console.php index 2a000d39b..41dd43f28 100755 --- a/scripts/console.php +++ b/scripts/console.php @@ -60,9 +60,9 @@ function read_input_line($prompt) } /** - * On Unix-like systems where PHP readline extension is not present, + * On Unix-like systems where PHP readline extension isn't present, * -cough- Mac OS X -cough- we can shell out to bash to do it for us. - * This lets us at least handle things like arrow keys, but we do not + * This lets us at least handle things like arrow keys, but we don't * get any entry history. :( * * Shamelessly ripped from when I wrote the same code for MediaWiki. :) diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php index 4ec4526ef..b4e4d9f08 100755 --- a/scripts/maildaemon.php +++ b/scripts/maildaemon.php @@ -231,7 +231,7 @@ class MailerDaemon foreach ($parsed->parts as $part) { $this->extract_part($part,$msg,$attachments); } - //we do not want any attachments that are a result of this parsing + //we don't want any attachments that are a result of this parsing return $msg; } diff --git a/scripts/xmppconfirmhandler.php b/scripts/xmppconfirmhandler.php index f5f824dee..c7ed15e49 100755 --- a/scripts/xmppconfirmhandler.php +++ b/scripts/xmppconfirmhandler.php @@ -69,7 +69,7 @@ class XmppConfirmHandler extends XmppQueueHandler continue; } else { $this->log(LOG_INFO, 'Confirmation sent for ' . $confirm->address); - # Mark confirmation sent; need a dupe so we do not have the WHERE clause + # Mark confirmation sent; need a dupe so we don't have the WHERE clause $dupe = Confirm_address::staticGet('code', $confirm->code); if (!$dupe) { common_log(LOG_WARNING, 'Could not refetch confirm', __FILE__); -- cgit v1.2.3-54-g00ecf From d6cd083946be96bcfc64329fc0bfdd28261c82ef Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 11 Nov 2009 12:21:27 +0000 Subject: Using mark-top styles --- plugins/Realtime/realtimeupdate.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index ca6ea891a..a2af4007b 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -45,15 +45,9 @@ RealtimeUpdate = { DT = document.title; $(window).blur(function() { - $('#notices_primary .notice').css({ - 'border-top-color':$('#notices_primary .notice:last').css('border-top-color'), - 'border-top-style':'dotted' - }); - - $('#notices_primary .notice:first').css({ - 'border-top-color':'#AAAAAA', - 'border-top-style':'solid' - }); + $('#notices_primary .notice').removeClass('mark-top'); + + $('#notices_primary .notice:first').addClass('mark-top'); RealtimeUpdate._updatecounter = 0; document.title = DT; -- cgit v1.2.3-54-g00ecf From 3874269a0b3ba81a1813cc282356618bb02d0f20 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 11 Nov 2009 12:31:14 +0000 Subject: Calling selector once --- plugins/Realtime/realtimeupdate.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index a2af4007b..ebe94ca41 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -157,10 +157,12 @@ RealtimeUpdate = { addPopup: function(url, timeline, iconurl) { - $('#notices_primary').css({'position':'relative'}); - $('#notices_primary').prepend(''); + var NP = $('#notices_primary'); + NP.css({'position':'relative'}); + NP.prepend(''); - $('#realtime_timeline').css({ + var RT = $('#realtime_timeline'); + RT.css({ 'margin':'0 0 11px 0', 'background':'transparent url('+ iconurl + ') no-repeat 0% 30%', 'padding':'0 0 0 20px', @@ -170,12 +172,12 @@ RealtimeUpdate = { 'right':'0', 'border':'none', 'cursor':'pointer', - 'color':$("a").css("color"), + 'color':$('a').css('color'), 'font-weight':'bold', 'font-size':'1em' }); - $('#realtime_timeline').click(function() { + RT.click(function() { window.open(url, timeline, 'toolbar=no,resizable=yes,scrollbars=yes,status=yes'); -- cgit v1.2.3-54-g00ecf From af4a54b1674ae118afcc88c03bab93d47208b6f8 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 11 Nov 2009 12:34:22 +0000 Subject: Set window resize before openning it up --- plugins/Realtime/realtimeupdate.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index ebe94ca41..c7ba2c531 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -180,7 +180,7 @@ RealtimeUpdate = { RT.click(function() { window.open(url, timeline, - 'toolbar=no,resizable=yes,scrollbars=yes,status=yes'); + 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,width=500,height=550'); return false; }); @@ -188,7 +188,6 @@ RealtimeUpdate = { initPopupWindow: function() { - window.resizeTo(500, 550); $('address').hide(); $('#content').css({'width':'93.5%'}); -- cgit v1.2.3-54-g00ecf From dbe02049a829dd0f3200984f1c797907aac5423f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 11 Nov 2009 12:57:48 +0000 Subject: Added margin-top for showstream page (space between entity_actions and notice_primary) --- plugins/Realtime/realtimeupdate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index c7ba2c531..9b9991b9e 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -164,7 +164,7 @@ RealtimeUpdate = { var RT = $('#realtime_timeline'); RT.css({ 'margin':'0 0 11px 0', - 'background':'transparent url('+ iconurl + ') no-repeat 0% 30%', + 'background':'transparent url('+ iconurl + ') no-repeat 0 30%', 'padding':'0 0 0 20px', 'display':'block', 'position':'absolute', @@ -176,6 +176,7 @@ RealtimeUpdate = { 'font-weight':'bold', 'font-size':'1em' }); + $('#showstream #notices_primary').css({'margin-top':'18px'}); RT.click(function() { window.open(url, -- cgit v1.2.3-54-g00ecf From 730b1a211f9d28dc33c67cacfda8538ec7196e8f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:42:43 +0000 Subject: Added on click event to open up anchors in notice items in a new window for the Realtime plugin's pop-up window. --- plugins/Realtime/realtimeupdate.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 9b9991b9e..3a1e9683f 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -208,6 +208,12 @@ RealtimeUpdate = { 'left':'auto', 'right':'0' }); + + $('.notices .entry-title a, .notices .entry-content a').bind('click', function() { + window.open(this.href, ''); + + return false; + }); } } -- cgit v1.2.3-54-g00ecf From edf9b38637cd48b45c9675247bb3243138d98ffb Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:43:55 +0000 Subject: Changed window open name to '' because IE doesn't compute names that include the '-' character. --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 3a1e9683f..aa4c6c15f 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -180,7 +180,7 @@ RealtimeUpdate = { RT.click(function() { window.open(url, - timeline, + '', 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,width=500,height=550'); return false; -- cgit v1.2.3-54-g00ecf From 4fbb6b0dfb9ee74accd23d680d45d1cace91974a Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:46:55 +0000 Subject: Removed setTimeout. It was initially intended to prevent dupes but this is not the case with 0.9.x's util.js as opposed to 0.8.x, where it didn't properly check if a given notice id is already in the list --- plugins/Realtime/realtimeupdate.js | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index aa4c6c15f..165888054 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -58,23 +58,21 @@ RealtimeUpdate = { receive: function(data) { - setTimeout(function() { - id = data.id; - - // Don't add it if it already exists - if ($("#notice-"+id).length > 0) { - return; - } - - var noticeItem = RealtimeUpdate.makeNoticeItem(data); - $("#notices_primary .notices").prepend(noticeItem); - $("#notices_primary .notice:first").css({display:"none"}); - $("#notices_primary .notice:first").fadeIn(1000); - SN.U.NoticeReply(); - - RealtimeUpdate._updatecounter += 1; - document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; - }, 500); + id = data.id; + + // Don't add it if it already exists + if ($("#notice-"+id).length > 0) { + return; + } + + var noticeItem = RealtimeUpdate.makeNoticeItem(data); + $("#notices_primary .notices").prepend(noticeItem); + $("#notices_primary .notice:first").css({display:"none"}); + $("#notices_primary .notice:first").fadeIn(1000); + SN.U.NoticeReply(); + + RealtimeUpdate._updatecounter += 1; + document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; }, makeNoticeItem: function(data) -- cgit v1.2.3-54-g00ecf From 5e0fb1ddfc877cec5b367857a58f621f47067ddc Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:49:41 +0000 Subject: Added a call to NoticeFavor() --- plugins/Realtime/realtimeupdate.js | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 165888054..3c5d37f79 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -70,6 +70,7 @@ RealtimeUpdate = { $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(1000); SN.U.NoticeReply(); + SN.U.NoticeFavor(); RealtimeUpdate._updatecounter += 1; document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; -- cgit v1.2.3-54-g00ecf From 0c81f39bee37e288ad6d56091884da61b96637c5 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:53:48 +0000 Subject: Added check to see whether window has focus --- plugins/Realtime/realtimeupdate.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 3c5d37f79..d77a95f7a 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -34,6 +34,7 @@ RealtimeUpdate = { _favorurl: '', _deleteurl: '', _updatecounter: 0, + _windowhasfocus: false, init: function(userid, replyurl, favorurl, deleteurl) { @@ -44,6 +45,8 @@ RealtimeUpdate = { DT = document.title; + $(window).bind('focus', function(){ RealtimeUpdate._windowhasfocus = true; }); + $(window).blur(function() { $('#notices_primary .notice').removeClass('mark-top'); @@ -51,6 +54,7 @@ RealtimeUpdate = { RealtimeUpdate._updatecounter = 0; document.title = DT; + RealtimeUpdate._windowhasfocus = false; return false; }); @@ -72,8 +76,10 @@ RealtimeUpdate = { SN.U.NoticeReply(); SN.U.NoticeFavor(); - RealtimeUpdate._updatecounter += 1; - document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; + if (RealtimeUpdate._windowhasfocus === false) { + RealtimeUpdate._updatecounter += 1; + document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; + } }, makeNoticeItem: function(data) -- cgit v1.2.3-54-g00ecf From 23367ecdcf3146fe4a8d294e95d908f9c4882361 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:54:57 +0000 Subject: Setting max notice count in order not to freak out the browser with memory issues. It removes the node and unbinds the previously assigned events. --- plugins/Realtime/realtimeupdate.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index d77a95f7a..8e7383a02 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -34,6 +34,7 @@ RealtimeUpdate = { _favorurl: '', _deleteurl: '', _updatecounter: 0, + _maxnotices: 50, _windowhasfocus: false, init: function(userid, replyurl, favorurl, deleteurl) @@ -73,6 +74,14 @@ RealtimeUpdate = { $("#notices_primary .notices").prepend(noticeItem); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(1000); + + if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) { + $("#notices_primary .notice:last .form_disfavor").unbind('submit'); + $("#notices_primary .notice:last .form_favor").unbind('submit'); + $("#notices_primary .notice:last .notice_reply").unbind('click'); + $("#notices_primary .notice:last").remove(); + } + SN.U.NoticeReply(); SN.U.NoticeFavor(); -- cgit v1.2.3-54-g00ecf From 51e4a45161f0f1cb1a63c3ac5b8748706876bed1 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 10:56:25 +0000 Subject: Changed from click to bind --- plugins/Realtime/realtimeupdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 8e7383a02..4444d801d 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -192,7 +192,7 @@ RealtimeUpdate = { }); $('#showstream #notices_primary').css({'margin-top':'18px'}); - RT.click(function() { + RT.bind('click', function() { window.open(url, '', 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,width=500,height=550'); -- cgit v1.2.3-54-g00ecf From 007418fdab8f9f0c718a18568bfbf4377bb85364 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 12:46:36 +0000 Subject: Setting windowhasfocus to true by default --- plugins/Realtime/realtimeupdate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 4444d801d..d1cf1d507 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -35,7 +35,7 @@ RealtimeUpdate = { _deleteurl: '', _updatecounter: 0, _maxnotices: 50, - _windowhasfocus: false, + _windowhasfocus: true, init: function(userid, replyurl, favorurl, deleteurl) { @@ -48,7 +48,7 @@ RealtimeUpdate = { $(window).bind('focus', function(){ RealtimeUpdate._windowhasfocus = true; }); - $(window).blur(function() { + $(window).bind('blur', function() { $('#notices_primary .notice').removeClass('mark-top'); $('#notices_primary .notice:first').addClass('mark-top'); -- cgit v1.2.3-54-g00ecf From 43b6da8afc223d1eefa74d390b09b7a4381ee734 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 13:34:06 +0000 Subject: Created separate objects for receive actions --- plugins/Realtime/realtimeupdate.js | 44 +++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index d1cf1d507..6404cf896 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -36,6 +36,7 @@ RealtimeUpdate = { _updatecounter: 0, _maxnotices: 50, _windowhasfocus: true, + _documenttitle: '', init: function(userid, replyurl, favorurl, deleteurl) { @@ -44,7 +45,7 @@ RealtimeUpdate = { RealtimeUpdate._favorurl = favorurl; RealtimeUpdate._deleteurl = deleteurl; - DT = document.title; + RealtimeUpdate._documenttitle = document.title; $(window).bind('focus', function(){ RealtimeUpdate._windowhasfocus = true; }); @@ -54,7 +55,7 @@ RealtimeUpdate = { $('#notices_primary .notice:first').addClass('mark-top'); RealtimeUpdate._updatecounter = 0; - document.title = DT; + document.title = RealtimeUpdate._documenttitle; RealtimeUpdate._windowhasfocus = false; return false; @@ -70,24 +71,37 @@ RealtimeUpdate = { return; } - var noticeItem = RealtimeUpdate.makeNoticeItem(data); - $("#notices_primary .notices").prepend(noticeItem); - $("#notices_primary .notice:first").css({display:"none"}); - $("#notices_primary .notice:first").fadeIn(1000); + RealtimeUpdate.purgeLastNoticeItem(); - if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) { - $("#notices_primary .notice:last .form_disfavor").unbind('submit'); - $("#notices_primary .notice:last .form_favor").unbind('submit'); - $("#notices_primary .notice:last .notice_reply").unbind('click'); - $("#notices_primary .notice:last").remove(); - } + RealtimeUpdate.insertNoticeItem(data); + + RealtimeUpdate.updateWindowCounter(); + + }, - SN.U.NoticeReply(); - SN.U.NoticeFavor(); + insertNoticeItem: function(data) { + var noticeItem = RealtimeUpdate.makeNoticeItem(data); + $("#notices_primary .notices").prepend(noticeItem); + $("#notices_primary .notice:first").css({display:"none"}); + $("#notices_primary .notice:first").fadeIn(1000); + + SN.U.NoticeReply(); + SN.U.NoticeFavor(); + }, + + purgeLastNoticeItem: function() { + if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) { + $("#notices_primary .notice:last .form_disfavor").unbind('submit'); + $("#notices_primary .notice:last .form_favor").unbind('submit'); + $("#notices_primary .notice:last .notice_reply").unbind('click'); + $("#notices_primary .notice:last").remove(); + } + }, + updateWindowCounter: function() { if (RealtimeUpdate._windowhasfocus === false) { RealtimeUpdate._updatecounter += 1; - document.title = '('+RealtimeUpdate._updatecounter+') ' + DT; + document.title = '('+RealtimeUpdate._updatecounter+') ' + RealtimeUpdate._documenttitle; } }, -- cgit v1.2.3-54-g00ecf From 5014b748e486f46a8653d1609479f8f64dc24722 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 15:41:07 +0000 Subject: Added play/pause button for realtime notices. While on pause, it will store the notices and on play it will add them to the notice list --- plugins/Realtime/RealtimePlugin.php | 4 +- plugins/Realtime/icon_pause.gif | Bin 0 -> 75 bytes plugins/Realtime/icon_play.gif | Bin 0 -> 75 bytes plugins/Realtime/realtimeupdate.js | 91 +++++++++++++++++++++++++++++++++--- 4 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 plugins/Realtime/icon_pause.gif create mode 100644 plugins/Realtime/icon_play.gif (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 0c7c1240c..6d59bd1b1 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -101,8 +101,8 @@ class RealtimePlugin extends Plugin $realtimeUI = ' RealtimeUpdate.initPopupWindow();'; } else { - $iconurl = common_path('plugins/Realtime/icon_external.gif'); - $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$timeline.'", "'. $iconurl .'");'; + $pluginPath = common_path('plugins/Realtime/'); + $realtimeUI = ' RealtimeUpdate.initActions("'.$url.'", "'.$timeline.'", "'. $pluginPath .'");'; } $action->elementStart('script', array('type' => 'text/javascript')); diff --git a/plugins/Realtime/icon_pause.gif b/plugins/Realtime/icon_pause.gif new file mode 100644 index 000000000..ced0b6440 Binary files /dev/null and b/plugins/Realtime/icon_pause.gif differ diff --git a/plugins/Realtime/icon_play.gif b/plugins/Realtime/icon_play.gif new file mode 100644 index 000000000..794ec85b6 Binary files /dev/null and b/plugins/Realtime/icon_play.gif differ diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 6404cf896..4352b45d9 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -37,6 +37,8 @@ RealtimeUpdate = { _maxnotices: 50, _windowhasfocus: true, _documenttitle: '', + _paused:false, + _queuedNotices:[], init: function(userid, replyurl, favorurl, deleteurl) { @@ -71,12 +73,16 @@ RealtimeUpdate = { return; } - RealtimeUpdate.purgeLastNoticeItem(); + if (RealtimeUpdate._paused === false) { + RealtimeUpdate.purgeLastNoticeItem(); - RealtimeUpdate.insertNoticeItem(data); - - RealtimeUpdate.updateWindowCounter(); + RealtimeUpdate.insertNoticeItem(data); + RealtimeUpdate.updateWindowCounter(); + } + else { + RealtimeUpdate._queuedNotices.push(data); + } }, insertNoticeItem: function(data) { @@ -183,7 +189,80 @@ RealtimeUpdate = { return dl; }, - addPopup: function(url, timeline, iconurl) + initActions: function(url, timeline, path) + { + var NP = $('#notices_primary'); + NP.prepend('
'); + + RealtimeUpdate._pluginPath = path; + + RealtimeUpdate.initPlayPause(); + RealtimeUpdate.initAddPopup(url, timeline, RealtimeUpdate._pluginPath); + }, + + initPlayPause: function() + { + RealtimeUpdate.showPause(); + }, + + showPause: function() + { + RT_PP = $('#realtime_pauseplay'); + RT_PP.empty(); + RT_PP.append(''); + + RT_P = $('#realtime_pause'); + $('#realtime_pause').css({ + 'background':'url('+RealtimeUpdate._pluginPath+'icon_pause.gif) no-repeat 47% 47%', + 'width':'16px', + 'height':'16px', + 'text-indent':'-9999px', + 'border':'none', + 'cursor':'pointer' + }); + RT_P.bind('click', function() { + RealtimeUpdate._paused = true; + + RealtimeUpdate.showPlay(); + return false; + }); + }, + + showPlay: function() + { + RT_PP = $('#realtime_pauseplay'); + RT_PP.empty(); + RT_PP.append(''); + + RT_P = $('#realtime_play'); + RT_P.css({ + 'background':'url('+RealtimeUpdate._pluginPath+'icon_play.gif) no-repeat 47% 47%', + 'width':'16px', + 'height':'16px', + 'text-indent':'-9999px', + 'border':'none', + 'cursor':'pointer' + }); + RT_P.bind('click', function() { + RealtimeUpdate._paused = false; + + RealtimeUpdate.showPause(); + + RealtimeUpdate.showQueuedNotices(); + + return false; + }); + }, + + showQueuedNotices: function() { + $.each(RealtimeUpdate._queuedNotices, function(i, n) { + RealtimeUpdate.insertNoticeItem(n); + }); + + RealtimeUpdate._queuedNotices = []; + }, + + initAddPopup: function(url, timeline, path) { var NP = $('#notices_primary'); NP.css({'position':'relative'}); @@ -192,7 +271,7 @@ RealtimeUpdate = { var RT = $('#realtime_timeline'); RT.css({ 'margin':'0 0 11px 0', - 'background':'transparent url('+ iconurl + ') no-repeat 0 30%', + 'background':'transparent url('+ path + 'icon_external.gif) no-repeat 0 30%', 'padding':'0 0 0 20px', 'display':'block', 'position':'absolute', -- cgit v1.2.3-54-g00ecf From 6d3d78c793594f3737718f24a461710e278f3022 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 15:57:45 +0000 Subject: Styled realtime_actions --- plugins/Realtime/realtimeupdate.js | 55 ++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 23 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 4352b45d9..28cd59028 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -192,7 +192,20 @@ RealtimeUpdate = { initActions: function(url, timeline, path) { var NP = $('#notices_primary'); - NP.prepend('
'); + NP.prepend('
'); + + $('#realtime_actions').css({ + 'position':'absolute', + 'top':'-20px', + 'right':'0', + 'margin':'0 0 11px 0' + }); + + $('#realtime_actions li').css({ + 'margin-left':'18px', + 'list-style-type':'none', + 'float':'left' + }); RealtimeUpdate._pluginPath = path; @@ -214,11 +227,12 @@ RealtimeUpdate = { RT_P = $('#realtime_pause'); $('#realtime_pause').css({ 'background':'url('+RealtimeUpdate._pluginPath+'icon_pause.gif) no-repeat 47% 47%', - 'width':'16px', - 'height':'16px', - 'text-indent':'-9999px', + 'width':'16px', + 'height':'16px', + 'display':'block', 'border':'none', - 'cursor':'pointer' + 'cursor':'pointer', + 'text-indent':'-9999px' }); RT_P.bind('click', function() { RealtimeUpdate._paused = true; @@ -237,11 +251,12 @@ RealtimeUpdate = { RT_P = $('#realtime_play'); RT_P.css({ 'background':'url('+RealtimeUpdate._pluginPath+'icon_play.gif) no-repeat 47% 47%', - 'width':'16px', - 'height':'16px', - 'text-indent':'-9999px', + 'width':'16px', + 'height':'16px', + 'display':'block', 'border':'none', - 'cursor':'pointer' + 'cursor':'pointer', + 'text-indent':'-9999px' }); RT_P.bind('click', function() { RealtimeUpdate._paused = false; @@ -264,28 +279,22 @@ RealtimeUpdate = { initAddPopup: function(url, timeline, path) { - var NP = $('#notices_primary'); - NP.css({'position':'relative'}); - NP.prepend(''); + var NP = $('#realtime_timeline'); + NP.append(''); - var RT = $('#realtime_timeline'); - RT.css({ - 'margin':'0 0 11px 0', + var PP = $('#realtime_popup'); + PP.css({ 'background':'transparent url('+ path + 'icon_external.gif) no-repeat 0 30%', - 'padding':'0 0 0 20px', + 'width':'16px', + 'height':'16px', 'display':'block', - 'position':'absolute', - 'top':'-20px', - 'right':'0', 'border':'none', 'cursor':'pointer', - 'color':$('a').css('color'), - 'font-weight':'bold', - 'font-size':'1em' + 'text-indent':'-9999px' }); $('#showstream #notices_primary').css({'margin-top':'18px'}); - RT.bind('click', function() { + PP.bind('click', function() { window.open(url, '', 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,width=500,height=550'); -- cgit v1.2.3-54-g00ecf From 4823463e3f397ddfc44e6455ff6fcdb32cbf9809 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 16:00:40 +0000 Subject: Relatively positioning notice_primary --- plugins/Realtime/realtimeupdate.js | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 28cd59028..e2bd8daea 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -193,6 +193,7 @@ RealtimeUpdate = { { var NP = $('#notices_primary'); NP.prepend('
'); + NP.css({'position':'relative'}); $('#realtime_actions').css({ 'position':'absolute', -- cgit v1.2.3-54-g00ecf From ef542afbe5f6aec04f7c72d71fb613265e794f95 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 17:23:04 +0000 Subject: Added counter beside the play button. When paused, it will update the counter on new received notices. Counter is removed when play is clicked --- plugins/Realtime/realtimeupdate.js | 44 +++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index e2bd8daea..8e3052dfc 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -77,12 +77,14 @@ RealtimeUpdate = { RealtimeUpdate.purgeLastNoticeItem(); RealtimeUpdate.insertNoticeItem(data); - - RealtimeUpdate.updateWindowCounter(); } else { RealtimeUpdate._queuedNotices.push(data); + + RealtimeUpdate.updateQueuedCounter(); } + + RealtimeUpdate.updateWindowCounter(); }, insertNoticeItem: function(data) { @@ -192,7 +194,7 @@ RealtimeUpdate = { initActions: function(url, timeline, path) { var NP = $('#notices_primary'); - NP.prepend('
'); + NP.prepend('
'); NP.css({'position':'relative'}); $('#realtime_actions').css({ @@ -221,7 +223,7 @@ RealtimeUpdate = { showPause: function() { - RT_PP = $('#realtime_pauseplay'); + RT_PP = $('#realtime_playpause'); RT_PP.empty(); RT_PP.append(''); @@ -233,7 +235,8 @@ RealtimeUpdate = { 'display':'block', 'border':'none', 'cursor':'pointer', - 'text-indent':'-9999px' + 'text-indent':'-9999px', + 'float':'left' }); RT_P.bind('click', function() { RealtimeUpdate._paused = true; @@ -245,9 +248,14 @@ RealtimeUpdate = { showPlay: function() { - RT_PP = $('#realtime_pauseplay'); + RT_PP = $('#realtime_playpause'); RT_PP.empty(); - RT_PP.append(''); + RT_PP.append(' '); + + $('#queued_counter').css({ + 'float':'left', + 'line-height':'1.2' + }); RT_P = $('#realtime_play'); RT_P.css({ @@ -257,7 +265,9 @@ RealtimeUpdate = { 'display':'block', 'border':'none', 'cursor':'pointer', - 'text-indent':'-9999px' + 'text-indent':'-9999px', + 'float':'left', + 'margin-left':'4px' }); RT_P.bind('click', function() { RealtimeUpdate._paused = false; @@ -270,12 +280,25 @@ RealtimeUpdate = { }); }, - showQueuedNotices: function() { + showQueuedNotices: function() + { $.each(RealtimeUpdate._queuedNotices, function(i, n) { RealtimeUpdate.insertNoticeItem(n); }); RealtimeUpdate._queuedNotices = []; + + RealtimeUpdate.removeQueuedCounter(); + }, + + updateQueuedCounter: function() + { + QC = $('#realtime_playpause #queued_counter').html('('+RealtimeUpdate._queuedNotices.length+')'); + }, + + removeQueuedCounter: function() + { + $('#realtime_playpause #queued_counter').empty(); }, initAddPopup: function(url, timeline, path) @@ -291,7 +314,8 @@ RealtimeUpdate = { 'display':'block', 'border':'none', 'cursor':'pointer', - 'text-indent':'-9999px' + 'text-indent':'-9999px', + 'float':'left' }); $('#showstream #notices_primary').css({'margin-top':'18px'}); -- cgit v1.2.3-54-g00ecf From c1efb8aa7fc429c6885cb6337e141e32847d34e9 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 17:59:44 +0000 Subject: Took out CSS from JS and placed it in its own file. --- plugins/Realtime/RealtimePlugin.php | 7 +++++ plugins/Realtime/realtimeupdate.css | 49 ++++++++++++++++++++++++++++++++++ plugins/Realtime/realtimeupdate.js | 52 ------------------------------------- 3 files changed, 56 insertions(+), 52 deletions(-) create mode 100644 plugins/Realtime/realtimeupdate.css (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 6d59bd1b1..2cff03d6c 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -118,6 +118,13 @@ class RealtimePlugin extends Plugin return true; } + function onEndShowStatusNetStyles($action) + { + $action->cssLink(common_path('plugins/Realtime/realtimeupdate.css'), + null, 'screen, projection, tv'); + return true; + } + function onEndNoticeSave($notice) { $paths = array(); diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/realtimeupdate.css new file mode 100644 index 000000000..0ab5dd32b --- /dev/null +++ b/plugins/Realtime/realtimeupdate.css @@ -0,0 +1,49 @@ +#notices_primary { +position:relative; +} + +#realtime_actions { +position: absolute; +top: -20px; +right: 0; +margin: 0 0 11px 0; +} + +#realtime_actions li { +margin-left: 18px; +list-style-type: none; +float: left; +} + +#realtime_actions button { +width: 16px; +height: 16px; +display: block; +border: none; +cursor: pointer; +text-indent: -9999px; +float: left; +} + +#realtime_play { +background: url(icon_play.gif) no-repeat 47% 47%; +margin-left: 4px; +} + +#realtime_pause { +background: url(icon_pause.gif) no-repeat 47% 47%; +} + +#realtime_popup { +background: url(icon_external.gif) no-repeat 0 30%; +} + +#queued_counter { +float:left; +line-height:1.2; +} + +#showstream #notices_primary { +margin-top: 18px; +} + diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 8e3052dfc..9030ad551 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -195,20 +195,6 @@ RealtimeUpdate = { { var NP = $('#notices_primary'); NP.prepend('
'); - NP.css({'position':'relative'}); - - $('#realtime_actions').css({ - 'position':'absolute', - 'top':'-20px', - 'right':'0', - 'margin':'0 0 11px 0' - }); - - $('#realtime_actions li').css({ - 'margin-left':'18px', - 'list-style-type':'none', - 'float':'left' - }); RealtimeUpdate._pluginPath = path; @@ -228,16 +214,6 @@ RealtimeUpdate = { RT_PP.append(''); RT_P = $('#realtime_pause'); - $('#realtime_pause').css({ - 'background':'url('+RealtimeUpdate._pluginPath+'icon_pause.gif) no-repeat 47% 47%', - 'width':'16px', - 'height':'16px', - 'display':'block', - 'border':'none', - 'cursor':'pointer', - 'text-indent':'-9999px', - 'float':'left' - }); RT_P.bind('click', function() { RealtimeUpdate._paused = true; @@ -252,23 +228,7 @@ RealtimeUpdate = { RT_PP.empty(); RT_PP.append(' '); - $('#queued_counter').css({ - 'float':'left', - 'line-height':'1.2' - }); - RT_P = $('#realtime_play'); - RT_P.css({ - 'background':'url('+RealtimeUpdate._pluginPath+'icon_play.gif) no-repeat 47% 47%', - 'width':'16px', - 'height':'16px', - 'display':'block', - 'border':'none', - 'cursor':'pointer', - 'text-indent':'-9999px', - 'float':'left', - 'margin-left':'4px' - }); RT_P.bind('click', function() { RealtimeUpdate._paused = false; @@ -307,18 +267,6 @@ RealtimeUpdate = { NP.append(''); var PP = $('#realtime_popup'); - PP.css({ - 'background':'transparent url('+ path + 'icon_external.gif) no-repeat 0 30%', - 'width':'16px', - 'height':'16px', - 'display':'block', - 'border':'none', - 'cursor':'pointer', - 'text-indent':'-9999px', - 'float':'left' - }); - $('#showstream #notices_primary').css({'margin-top':'18px'}); - PP.bind('click', function() { window.open(url, '', -- cgit v1.2.3-54-g00ecf From 63d3e07ce4b12a0a06d74730ff4c938ace519517 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 18 Nov 2009 19:15:55 +0000 Subject: Check for dupe from insertNoticeItem() --- plugins/Realtime/realtimeupdate.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 9030ad551..a2c4da113 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -66,13 +66,6 @@ RealtimeUpdate = { receive: function(data) { - id = data.id; - - // Don't add it if it already exists - if ($("#notice-"+id).length > 0) { - return; - } - if (RealtimeUpdate._paused === false) { RealtimeUpdate.purgeLastNoticeItem(); @@ -88,6 +81,11 @@ RealtimeUpdate = { }, insertNoticeItem: function(data) { + // Don't add it if it already exists + if ($("#notice-"+data.id).length > 0) { + return; + } + var noticeItem = RealtimeUpdate.makeNoticeItem(data); $("#notices_primary .notices").prepend(noticeItem); $("#notices_primary .notice:first").css({display:"none"}); @@ -253,7 +251,7 @@ RealtimeUpdate = { updateQueuedCounter: function() { - QC = $('#realtime_playpause #queued_counter').html('('+RealtimeUpdate._queuedNotices.length+')'); + $('#realtime_playpause #queued_counter').html('('+RealtimeUpdate._queuedNotices.length+')'); }, removeQueuedCounter: function() -- cgit v1.2.3-54-g00ecf From c721884b52b2d0caf34d0e445596362139af4fb1 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 19 Nov 2009 11:08:13 -0500 Subject: Should be using onHandleQueuedNotice instead of onEndNoticeSave --- plugins/LinkbackPlugin.php | 2 +- plugins/Realtime/RealtimePlugin.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/Realtime') diff --git a/plugins/LinkbackPlugin.php b/plugins/LinkbackPlugin.php index 915d15c07..f220fff8f 100644 --- a/plugins/LinkbackPlugin.php +++ b/plugins/LinkbackPlugin.php @@ -59,7 +59,7 @@ class LinkbackPlugin extends Plugin parent::__construct(); } - function onEndNoticeSave($notice) + function onHandleQueuedNotice($notice) { if ($notice->is_local == 1) { // Try to avoid actually mucking with the diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 2cff03d6c..c5fb6de03 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -125,7 +125,7 @@ class RealtimePlugin extends Plugin return true; } - function onEndNoticeSave($notice) + function onHandleQueuedNotice($notice) { $paths = array(); -- cgit v1.2.3-54-g00ecf