当前位置: 首页>>代码示例>>PHP>>正文


PHP ApiAuthAction::prepare方法代码示例

本文整理汇总了PHP中ApiAuthAction::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiAuthAction::prepare方法的具体用法?PHP ApiAuthAction::prepare怎么用?PHP ApiAuthAction::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApiAuthAction的用法示例。


在下文中一共展示了ApiAuthAction::prepare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     // TRANS: Server error displayed calling unimplemented API method for 'retweeted by me'.
     $this->serverError(_('Unimplemented.'), 503);
     return false;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:15,代码来源:apitimelineretweetedbyme.php

示例2: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     if (empty($this->user)) {
         // TRANS: Client error given when a user was not found (404).
         $this->clientError(_('No such user.'), 404, $this->format);
         return;
     }
     $server = common_root_url();
     $taguribase = TagURI::base();
     if ($this->arg('sent')) {
         // Action was called by /api/direct_messages/sent.format
         $this->title = sprintf(_("Direct messages from %s"), $this->user->nickname);
         $this->subtitle = sprintf(_("All the direct messages sent from %s"), $this->user->nickname);
         $this->link = $server . $this->user->nickname . '/outbox';
         $this->selfuri_base = common_root_url() . 'api/direct_messages/sent';
         $this->id = "tag:{$taguribase}:SentDirectMessages:" . $this->user->id;
     } else {
         $this->title = sprintf(_("Direct messages to %s"), $this->user->nickname);
         $this->subtitle = sprintf(_("All the direct messages sent to %s"), $this->user->nickname);
         $this->link = $server . $this->user->nickname . '/inbox';
         $this->selfuri_base = common_root_url() . 'api/direct_messages';
         $this->id = "tag:{$taguribase}:DirectMessages:" . $this->user->id;
     }
     $this->messages = $this->getMessages();
     return true;
 }
开发者ID:ronhuang,项目名称:statusnet,代码行数:36,代码来源:apidirectmessage.php

示例3: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     $this->device = $this->trimmed('device');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:14,代码来源:apiaccountupdatedeliverydevice.php

示例4: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     $this->tile = $this->arg('tile');
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:15,代码来源:apiaccountupdateprofilebackgroundimage.php

示例5: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         // TRANS: Client error. POST is a HTTP command. It should not be translated.
         $this->clientError(_('This method requires a POST.'), 400, $this->format);
         return false;
     }
     $id = $this->trimmed('id');
     $this->original = Notice::staticGet('id', $id);
     if (empty($this->original)) {
         $this->clientError(_('No such notice.'), 400, $this->format);
         return false;
     }
     $this->user = $this->auth_user;
     if ($this->user->id == $this->original->profile_id) {
         $this->clientError(_('Cannot repeat your own notice.'), 400, $this->format);
         return false;
     }
     $profile = $this->user->getProfile();
     if ($profile->hasRepeated($id)) {
         $this->clientError(_('Already repeated that notice.'), 400, $this->format);
         return false;
     }
     return true;
 }
开发者ID:ronhuang,项目名称:statusnet,代码行数:34,代码来源:apistatusesretweet.php

示例6: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     $this->other = $this->getTargetProfile($this->arg('id'));
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:15,代码来源:apifriendshipsdestroy.php

示例7: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $subscriberId = $this->trimmed('subscriber');
     $this->_subscriber = Profile::staticGet('id', $subscriberId);
     if (empty($this->_subscriber)) {
         // TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
         // TRANS: %d is the non-existing profile ID number.
         throw new ClientException(sprintf(_('No such profile id: %d.'), $subscriberId), 404);
     }
     $subscribedId = $this->trimmed('subscribed');
     $this->_subscribed = Profile::staticGet('id', $subscribedId);
     if (empty($this->_subscribed)) {
         // TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
         // TRANS: %d is the non-existing profile ID number.
         throw new ClientException(sprintf(_('No such profile id: %d.'), $subscribedId), 404);
     }
     $this->_subscription = Subscription::pkeyGet(array('subscriber' => $subscriberId, 'subscribed' => $subscribedId));
     if (empty($this->_subscription)) {
         // TRANS: Client exception thrown when trying to display a subscription for a non-subscribed profile ID.
         // TRANS: %1$d is the non-existing subscriber ID number, $2$d is the ID of the profile that was not subscribed to.
         $msg = sprintf(_('Profile %1$d not subscribed to profile %2$d.'), $subscriberId, $subscribedId);
         throw new ClientException($msg, 404);
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:33,代码来源:atompubshowsubscription.php

示例8: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     if (!$this->scoped instanceof Profile) {
         // TRANS: Client error given when a user was not found (404).
         $this->clientError(_('No such user.'), 404);
     }
     $server = common_root_url();
     $taguribase = TagURI::base();
     if ($this->arg('sent')) {
         // Action was called by /api/direct_messages/sent.format
         $this->title = sprintf(_("Direct messages from %s"), $this->scoped->getNickname());
         $this->subtitle = sprintf(_("All the direct messages sent from %s"), $this->scoped->getNickname());
         $this->link = $server . $this->scoped->getNickname() . '/outbox';
         $this->selfuri_base = common_root_url() . 'api/direct_messages/sent';
         $this->id = "tag:{$taguribase}:SentDirectMessages:" . $this->scoped->getID();
     } else {
         $this->title = sprintf(_("Direct messages to %s"), $this->scoped->getNickname());
         $this->subtitle = sprintf(_("All the direct messages sent to %s"), $this->scoped->getNickname());
         $this->link = $server . $this->scoped->getNickname() . '/inbox';
         $this->selfuri_base = common_root_url() . 'api/direct_messages';
         $this->id = "tag:{$taguribase}:DirectMessages:" . $this->scoped->getID();
     }
     $this->messages = $this->getMessages();
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:33,代码来源:apidirectmessage.php

示例9: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     $this->group = $this->getTargetGroup($this->arg('id'));
     return true;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:14,代码来源:apigroupjoin.php

示例10: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->format = 'json';
     $this->backgroundcolor = $this->trimmed('backgroundcolor');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-qvitter-debian,代码行数:14,代码来源:apiqvitterupdatebackgroundcolor.php

示例11: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     $this->notice = Notice::staticGet($this->arg('id'));
     return true;
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:15,代码来源:apifavoritedestroy.php

示例12: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $convId = $this->trimmed('id');
     if (empty($convId)) {
         // TRANS: Client exception thrown when no conversation ID is given.
         throw new ClientException(_('No conversation ID.'));
     }
     $this->conversation = Conversation::staticGet('id', $convId);
     if (empty($this->conversation)) {
         // TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
         $this->clientError(_('No conversation ID found'), 404);
         return false;
     }
     $profile = Profile::current();
     $stream = new ConversationNoticeStream($convId, $profile);
     $notice = $stream->getNotices(($this->page - 1) * $this->count, $this->count, $this->since_id, $this->max_id);
     $this->notices = $notice->fetchAll();
     $originalConversation = new Notice();
     $originalConversation->whereAdd('conversation=' . $convId);
     $originalConversation->limit(1);
     $originalConversation->orderBy('created');
     $originalConversation->find();
     if ($originalConversation->fetch()) {
         $this->originalNotice = $originalConversation;
     }
     return true;
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:35,代码来源:apiconversation.php

示例13: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 protected function prepare(array $args = array())
 {
     parent::prepare($args);
     $this->format = 'json';
     $this->bookmarks = $this->trimmed('bookmarks');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-qvitter-debian,代码行数:14,代码来源:apiqvitterupdatebookmarks.php

示例14: prepare

 function prepare($args)
 {
     parent::prepare($args);
     $this->userId = $this->auth_user->id;
     $this->getNotices();
     return true;
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:7,代码来源:apicommentsbyme.php

示例15: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  *
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->user = $this->auth_user;
     $this->other = $this->getTargetUser($id);
     return true;
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:15,代码来源:apifriendshipscreate.php


注:本文中的ApiAuthAction::prepare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。