X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapisubscriptions.php;h=84731ac00fff4a46bf471cca286f756247bbdd6e;hb=c85abebc36e25c87e0292aeb41e4f1eadaa5e2b9;hp=9dbddbd9bdf3df6691be74da8f148269089652b7;hpb=559918826a714c1ee2ecdc49dcfc2b67451a9864;p=quix0rs-gnu-social.git diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index 9dbddbd9bd..84731ac00f 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -21,6 +21,8 @@ * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou * @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 @@ -31,7 +33,7 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR.'/lib/apibareauth.php'; +require_once INSTALLDIR . '/lib/apibareauth.php'; /** * This class outputs a list of profiles as Twitter-style user and status objects. @@ -40,17 +42,14 @@ require_once INSTALLDIR.'/lib/apibareauth.php'; * * @category API * @package StatusNet + * @author Dan Moore + * @author Evan Prodromou * @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 ApiSubscriptionsAction extends ApiBareAuthAction { - - var $page = null; - var $count = null; - var $user = null; var $profiles = null; var $tag = null; var $lite = null; @@ -62,14 +61,11 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); $this->tag = $this->arg('tag'); // Note: Twitter no longer supports 'lite' @@ -85,7 +81,8 @@ class ApiSubscriptionsAction extends ApiBareAuthAction $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { - $this->clientError(_('No such user!'), 404, $this->format); + // TRANS: Client error displayed when requesting a list of followers for a non-existing user. + $this->clientError(_('No such user.'), 404, $this->format); return false; } @@ -103,17 +100,17 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function handle($args) { parent::handle($args); if (!in_array($this->format, array('xml', 'json'))) { - $this->clientError(_('API method not found!'), $code = 404); + // TRANS: Client error displayed when coming across a non-supported API method. + $this->clientError(_('API method not found.'), $code = 404); return; } - $this->init_document($this->format); + $this->initDocument($this->format); if (isset($this->ids_only)) { $this->showIds(); @@ -121,7 +118,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction $this->showProfiles(isset($this->lite) ? false : true); } - $this->end_document($this->format); + $this->endDocument($this->format); } /** @@ -129,7 +126,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return array Profiles */ - function getProfiles() { } @@ -141,7 +137,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -152,7 +147,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string datestamp of the latest profile in the stream */ - function lastModified() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -172,7 +166,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -182,8 +175,10 @@ class ApiSubscriptionsAction extends ApiBareAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->user->id, + // Caching tags. isset($this->ids_only) ? 'IDs' : 'Profiles', strtotime($this->profiles[0]->created), strtotime($this->profiles[$last]->created)) @@ -202,14 +197,14 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showProfiles($include_statuses = true) { switch ($this->format) { case 'xml': - $this->elementStart('users', array('type' => 'array')); + $this->elementStart('users', array('type' => 'array', + 'xmlns:statusnet' => 'http://status.net/schema/api/1/')); foreach ($this->profiles as $profile) { - $this->show_profile( + $this->showProfile( $profile, $this->format, null, @@ -221,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 ); @@ -229,6 +224,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction print json_encode($arrays); break; default: + // TRANS: Client error displayed when requesting profiles of followers in an unsupported format. $this->clientError(_('Unsupported format.')); break; } @@ -240,7 +236,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction * * @return void */ - function showIds() { switch ($this->format) { @@ -259,9 +254,9 @@ class ApiSubscriptionsAction extends ApiBareAuthAction print json_encode($ids); break; default: + // TRANS: Client error displayed when requesting IDs of followers in an unsupported format. $this->clientError(_('Unsupported format.')); break; } } - }