本文整理匯總了PHP中post::isNew方法的典型用法代碼示例。如果您正苦於以下問題:PHP post::isNew方法的具體用法?PHP post::isNew怎麽用?PHP post::isNew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類post
的用法示例。
在下文中一共展示了post::isNew方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addComment
public function addComment($urlfriendly = null)
{
$C = new configuration();
$codice = $C->getBlogConfiguration();
if ($this->data) {
if (is_null($urlfriendly) === true) {
$this->redirect($codice['blog_siteurl'], true);
}
$P = new post();
$post = $P->findBy('urlfriendly', $urlfriendly);
if ($P->isNew() === true) {
$this->redirect($codice['blog_siteurl'], true);
}
if (isset($this->data["resultado"]) === true) {
$captcha = $this->data['resultado'];
if ($captcha != '5') {
$this->session->flash('Tu comentario no puede ser agregado. Necesitas contestar la pregunta correctamente.');
$this->redirect("{$post['urlfriendly']}#comments");
}
unset($this->data['resultado']);
} else {
$this->session->flash('Tu comentario no puede ser agregado. Necesitas contestar la pregunta.');
$this->redirect("{$post['urlfriendly']}#comments");
}
if ($this->cookie->check('id_user')) {
$this->data['user_id'] = $this->cookie->id_user;
$this->data['status'] = 'publish';
} else {
$this->data['user_id'] = 0;
$this->data['status'] = 'waiting';
}
$this->data['type'] = '';
//'pingback', 'trackback', ''
$this->data['IP'] = utils::getIP();
$this->data['ID_post'] = $post["ID"];
$this->cookie->author = $this->data['author'];
$this->cookie->email = $this->data['email'];
$this->cookie->url = $this->data['url'];
$C = new comment();
$C->prepareFromArray($this->data);
$valid = $C->save();
if ($valid) {
$this->registry->lastCommentID = $valid;
$this->registry->postID = $post["ID"];
$this->plugin->call("index_comment_added");
}
if ($valid and $this->isAjax()) {
echo $valid;
} else {
if ($valid) {
$this->redirect("{$post['urlfriendly']}#comment-{$valid}");
} else {
$this->redirect("{$post['urlfriendly']}");
}
}
}
}