* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @category API
- * @package GNUSocial
+ * @package GNUsocial
* @author Hannes Mannerheim <h@nnesmannerhe.im>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://www.gnu.org/software/social/
* @return boolean success flag
*
*/
- function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
+ if ($this->format !== 'json') {
+ $this->clientError('This method currently only serves JSON.', 415);
+ }
+
$profileurl = urldecode($this->arg('profileurl'));
- $this->profile = Profile::staticGet('profileurl', $profileurl);
+ // TODO: Make this more ... unique!
+ $this->profile = Profile::getKV('profileurl', $profileurl);
+
+ if (!($this->profile instanceof Profile)) {
+ // TRANS: Client error displayed when requesting profile information for a non-existing profile.
+ $this->clientError(_('Profile not found.'), 404);
+ }
return true;
}
*
* @return void
*/
- function handle($args)
+ protected function handle()
{
- parent::handle($args);
-
- if (empty($this->profile)) {
- // TRANS: Client error displayed when requesting profile information for a non-existing profile.
- $this->clientError(_('Profile not found.'), 404, 'json');
- return;
- }
+ parent::handle();
$twitter_user = $this->twitterUserArray($this->profile, true);
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}