本文整理汇总了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();
}
示例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();
}
示例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']);
}
}