本文整理汇总了PHP中Comment::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::getContent方法的具体用法?PHP Comment::getContent怎么用?PHP Comment::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::getContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Guarda un comentario en la base de datos
*
* @param Comment $coment
* El comentario a ser guardado
* @throws PDOException Si ocurre un error de base de datos
* @return void
*/
public function save(Comment $comment)
{
$stmt = $this->db->prepare("INSERT INTO comments(`dateComment`,`content`,`numLikes`,`author`,`idPost`) values(?,?,?,?,?)");
$stmt->execute(array($comment->getDate(), $comment->getContent(), 0, $comment->getAuthor(), $comment->getIdPost()));
}
示例2: add_comment
function add_comment()
{
$this->assertLoggedIn();
try {
$this->setTitle('Add Comment');
$content_id = $this->args('content_id');
$content_type = $this->args('content_type');
$content = Comment::getContent($content_id, $content_type);
if (!is_object($content)) {
throw new Exception("That content does not exist.");
}
if (!$content->isHydrated()) {
throw new Exception("That content does not exist.");
}
if (!$content->canComment()) {
throw new Exception("You cannot comment on this content.");
}
$form = $this->_createAddCommentForm($content_id, $content_type);
//handle our form
if ($form->checkSubmitAndValidate($this->args())) {
$comment = new Comment();
$comment->set('content_id', $form->data('content_id'));
$comment->set('content_type', $form->data('content_type'));
$comment->set('comment', $form->data('comment'));
$comment->set('user_id', User::$me->id);
$comment->set('comment_date', date("Y-m-d H:i:s"));
$comment->save();
Activity::log("commented on " . $content->getLink() . ".");
$this->forwardToUrl($content->getUrl());
}
$this->set('form', $form);
} catch (Exception $e) {
$this->setTitle('Add Comment - Error');
$this->set('megaerror', $e->getMessage());
}
}
示例3: Post
if (!$client->query('time.getGMTTime')) {
die("Something went wrong - " . $client->getErrorCode() . $client->getErrorMessage());
}
echo($client->getResponse());*/
/*---------- Design Patterns: Decorator Pattern ----------*/
print "<br/><br/>";
$bbcode_enabled = 0;
$emoticon_enabled = 1;
$post = new Post();
$comment = new Comment();
$post->filter("Test Title: A Test", "Lorem Ipsum Amet");
$comment->filter("Dolot avenus persina olatus");
if ($bbcode_enabled == false && $emoticon_enabled == false) {
$postcontent = $post->getContent();
$commentcontent = $comment->getContent();
} elseif ($bbcode_enabled == true && $emoticon_enabled == false) {
$bb = new BBCodeParser($post);
// Passing the Post() object to BBCodeParser()
$postcontent = $bb->getContent();
$bb = new BBCodeParser($comment);
$commentcontent = $bb->getContent();
} elseif ($bbcode_enabled == false && $emoticon_enabled == true) {
$em = new EmoticonParser($post);
$postcontent = $em->getContent();
$em = new EmoticonParser($comment);
$commentcontent = $em->getContent();
}
/*---------- Design Patterns: Facade Pattern ----------*/
$F = new Facade();
$F->findApartments("London, Greater London", "mapdiv");
示例4:
if ($comment->getAuthor() == $uid) {
$permEdit = true;
}
$blog_user = Database::get()->querySingle("SELECT user_id FROM blog_post WHERE id = ?d", $comment->getRid());
if ($blog_user->user_id == $uid) {
$permEdit = true;
}
if (isset($is_admin) && $is_admin) {
$permEdit = true;
}
}
if ($permEdit) {
if ($comment->edit($_POST['commentText'])) {
$response[0] = 'OK';
$response[1] = "<div class='alert alert-success'>".$langCommentsSaveSuccess."</div>";
$response[2] = '<div id="comment_content-'.$comment->getId().'">'.q($comment->getContent()).'</div>';
} else {
$response[0] = 'ERROR';
$response[1] = "<div class='alert alert-warning'>".$langCommentsSaveFail."</div>";
}
} else {
$response[0] = 'ERROR';
$response[1] = "<div class='alert alert-warning'>".$langCommentsEditNoPerm."</div>";
}
} else {
$response[0] = 'ERROR';
$response[1] = "<div class='alert alert-warning'>".$langCommentsLoadFail."</div>";
}
echo json_encode($response);
}
}
示例5: save
/**
* Saves a comment
*
* @param Comment $comment The comment to save
* @throws PDOException if a database error occurs
* @return void
*/
public function save(Comment $comment)
{
$stmt = $this->db->prepare("INSERT INTO comments(content, author, post) values (?,?,?)");
$stmt->execute(array($comment->getContent(), $comment->getAuthor()->getUsername(), $comment->getPost()->getId()));
}
示例6: header
if (getUser()->getRank() < RANK_WRITER) {
header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
exit;
}
$comment = null;
$view->setTitle("Viewing Comment");
try {
$comment = new Comment($id);
} catch (Exception $e) {
if ($e->getCode() == COMMENT_NOT_EXIST) {
header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=comments"));
exit;
} else {
header("Location: " . orongoURL("orongo-admin/index.php?msg=2"));
exit;
}
}
$form = new AdminFrontendForm(100, l("Comment") . " (" . $comment->getID() . ")", "GET", "", false);
$form->addInput("ID", "id", "text", $comment->getID(), false, true);
$form->addInput("Date", "date", "text", date("Y-m-d H:i:s", $comment->getTimestamp()), false, true);
$form->addInput("Commenter", "title", "text", $comment->getAuthorName(), false, true);
$form->addInput("Comment", "content", "textarea", $comment->getContent(), false, true);
$form->addButton("Delete", false, orongoURL("orongo-admin/delete.php?comment." . $id));
$view->addObject($form);
$view->render();
break;
default:
header("Location: " . orongoURL("orongo-admin/index.php?msg=1"));
exit;
break;
}