本文整理汇总了PHP中Doo::autoload方法的典型用法代码示例。如果您正苦于以下问题:PHP Doo::autoload方法的具体用法?PHP Doo::autoload怎么用?PHP Doo::autoload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doo
的用法示例。
在下文中一共展示了Doo::autoload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: approveComment
/**
* Approve a comment
*/
function approveComment()
{
Doo::loadModel('Comment');
$c = new Comment();
$c->id = intval($this->params['cid']);
$comment = $c->find(array('limit' => 1, 'select' => 'id, post_id'));
//if not exists, show error
if ($comment == Null) {
return 404;
}
//change status to Approved
$comment->status = 1;
$comment->update(array('field' => 'status'));
Doo::loadModel('Post');
Doo::autoload('DooDbExpression');
//Update totalcomment field in Post
$p = new Post();
$p->id = $comment->post_id;
$p->totalcomment = new DooDbExpression('totalcomment+1');
$p->update(array('field' => 'totalcomment'));
$data['rootUrl'] = Doo::conf()->APP_URL;
$data['title'] = 'Comment Approved!';
$data['content'] = "<p>Comment is approved successfully!</p>";
$data['content'] .= "<p>View the comment <a href=\"{$data['rootUrl']}article/{$p->id}#comment{$comment->id}\">here</a></p>";
$this->render('admin_msg', $data);
}
示例2: autoload
/**
* short hand of Doo::autoload()
* @param string $class_name
*/
public function autoload($class_name)
{
Doo::autoload($class_name);
}
示例3: newComment
function newComment()
{
foreach ($_POST as $k => $v) {
$_POST[$k] = trim($v);
}
if ($_POST['url'] == 'http://' || empty($_POST['url'])) {
unset($_POST['url']);
}
//strip html tags in comment
if (!empty($_POST['content'])) {
$_POST['content'] = strip_tags($_POST['content']);
}
Doo::loadModel('Comment');
$c = new Comment($_POST);
$this->prepareSidebar();
// 'skip' is same as DooValidator::CHECK_SKIP
if ($error = $c->validate('skip')) {
$this->data['rootUrl'] = Doo::conf()->APP_URL;
$this->data['title'] = 'Oops! Error Occured!';
$this->data['content'] = '<p style="color:#ff0000;">' . $error . '</p>';
$this->data['content'] .= '<p>Go <a href="javascript:history.back();">back</a> to post.</p>';
$this->render('error', $this->data);
} else {
Doo::autoload('DooDbExpression');
$c->createtime = new DooDbExpression('NOW()');
$c->insert();
$this->data['rootUrl'] = Doo::conf()->APP_URL;
$this->render('comment', $this->data);
}
}