*
* @category API
* @package StatusNet
+ * @author Dan Moore <dan@moore.cx>
+ * @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @copyright 2009 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
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.
*
* @category API
* @package StatusNet
+ * @author Dan Moore <dan@moore.cx>
+ * @author Evan Prodromou <evan@status.net>
* @author Zach Copley <zach@status.net>
* @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 $format = null;
var $tag = null;
var $lite = null;
var $ids_only = null;
* @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');
- $this->format = $this->arg('format');
// Note: Twitter no longer supports 'lite'
$this->lite = $this->arg('lite');
$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;
}
*
* @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();
$this->showProfiles(isset($this->lite) ? false : true);
}
- $this->end_document($this->format);
+ $this->endDocument($this->format);
}
/**
*
* @return array Profiles
*/
-
function getProfiles()
{
}
*
* @return boolean true
*/
-
function isReadOnly($args)
{
return true;
*
* @return string datestamp of the latest profile in the stream
*/
-
function lastModified()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
*
* @return string etag
*/
-
function etag()
{
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
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))
*
* @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,
case 'json':
$arrays = array();
foreach ($this->profiles as $profile) {
- $arrays[] = $this->twitter_user_array(
+ $arrays[] = $this->twitterUserArray(
$profile,
$include_statuses
);
print json_encode($arrays);
break;
default:
+ // TRANS: Client error displayed when requesting profiles of followers in an unsupported format.
$this->clientError(_('Unsupported format.'));
break;
}
*
* @return void
*/
-
function showIds()
{
switch ($this->format) {
print json_encode($ids);
break;
default:
+ // TRANS: Client error displayed when requesting IDs of followers in an unsupported format.
$this->clientError(_('Unsupported format.'));
break;
}
}
-
}