本文整理汇总了PHP中Draft::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Draft::delete方法的具体用法?PHP Draft::delete怎么用?PHP Draft::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Draft
的用法示例。
在下文中一共展示了Draft::delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
list($params, $id) = $this->parse_params(func_get_args());
$theme = new Theme();
$themes = $theme->read(true);
if ($this->method == 'post' && isset($_POST['theme'])) {
$t = $_POST['theme'];
if (isset($themes[$t])) {
$d = new Draft();
$d->where('draft', 1)->update('draft', 0);
$d->where('path', $t)->get();
$d->path = $t;
$d->draft = 1;
if (isset($_POST['refresh'])) {
$d->init_draft_nav($_POST['refresh']);
}
$d->save();
$this->redirect('/drafts');
} else {
// error
}
} else {
if ($this->method == 'delete' && isset($_POST['theme'])) {
$d = new Draft();
$d->where('path', $_POST['theme'])->get();
if ($d->exists()) {
$d->delete();
}
exit;
}
}
$final = array();
$d = new Draft();
$drafts = $d->get_iterated();
foreach ($drafts as $d) {
if (isset($themes[$d->path])) {
$final[] = array('id' => $d->id, 'theme' => $themes[$d->path], 'published' => (bool) $d->current, 'active' => (bool) $d->draft, 'created_on' => (int) $d->created_on, 'modified_on' => (int) $d->modified_on);
}
}
$this->set_response_data($final);
}