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


PHP Reply::delete方法代码示例

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


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

示例1: handle

 /**
  * Handle the request
  *
  * Delete the notice and all related replies
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!in_array($this->format, array('xml', 'json'))) {
         $this->clientError(_('API method not found.'), $code = 404);
         return;
     }
     if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
         $this->clientError(_('This method requires a POST or DELETE.'), 400, $this->format);
         return;
     }
     if (empty($this->notice)) {
         $this->clientError(_('No status found with that ID.'), 404, $this->format);
         return;
     }
     if ($this->user->id == $this->notice->profile_id) {
         $replies = new Reply();
         $replies->get('notice_id', $this->notice_id);
         $replies->delete();
         $this->notice->delete();
         if ($this->format == 'xml') {
             $this->showSingleXmlStatus($this->notice);
         } elseif ($this->format == 'json') {
             $this->show_single_json_status($this->notice);
         }
     } else {
         $this->clientError(_('You may not delete another user\'s status.'), 403, $this->format);
     }
     $this->showNotice();
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:39,代码来源:apistatusesdestroy.php

示例2: clearReplies

 function clearReplies()
 {
     $replyNotice = new Notice();
     $replyNotice->reply_to = $this->id;
     //Null any notices that are replies to this notice
     if ($replyNotice->find()) {
         while ($replyNotice->fetch()) {
             $orig = clone $replyNotice;
             $replyNotice->reply_to = null;
             $replyNotice->update($orig);
         }
     }
     // Reply records
     $reply = new Reply();
     $reply->notice_id = $this->id;
     if ($reply->find()) {
         while ($reply->fetch()) {
             self::blow('reply:stream:%d', $reply->profile_id);
             $reply->delete();
         }
     }
     $reply->free();
 }
开发者ID:a780201,项目名称:gnu-social,代码行数:23,代码来源:Notice.php

示例3: destroy

 function destroy($args, $apidata)
 {
     parent::handle($args);
     if (!in_array($apidata['content-type'], array('xml', 'json'))) {
         $this->clientError(_('API method not found!'), $code = 404);
         return;
     }
     // Check for RESTfulness
     if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
         // XXX: Twitter just prints the err msg, no XML / JSON.
         $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
         return;
     }
     $this->auth_user = $apidata['user'];
     $user = $this->auth_user;
     $notice_id = $apidata['api_arg'];
     $notice = Notice::staticGet($notice_id);
     if (!$notice) {
         $this->clientError(_('No status found with that ID.'), 404, $apidata['content-type']);
         return;
     }
     if ($user->id == $notice->profile_id) {
         $replies = new Reply();
         $replies->get('notice_id', $notice_id);
         $replies->delete();
         $notice->delete();
         if ($apidata['content-type'] == 'xml') {
             $this->show_single_xml_status($notice);
         } elseif ($apidata['content-type'] == 'json') {
             $this->show_single_json_status($notice);
         }
     } else {
         $this->clientError(_('You may not delete another user\'s status.'), 403, $apidata['content-type']);
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:35,代码来源:twitapistatuses.php


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