本文整理汇总了PHP中Comment::getText方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::getText方法的具体用法?PHP Comment::getText怎么用?PHP Comment::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::getText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetSet
public function testGetSet()
{
$comment = new Comment('/* Some comment */', 1);
$this->assertSame('/* Some comment */', $comment->getText());
$this->assertSame('/* Some comment */', (string) $comment);
$this->assertSame(1, $comment->getLine());
$comment->setText('/* Some other comment */');
$comment->setLine(10);
$this->assertSame('/* Some other comment */', $comment->getText());
$this->assertSame('/* Some other comment */', (string) $comment);
$this->assertSame(10, $comment->getLine());
}
示例2: onNewComment
public function onNewComment(FrontController $sender, Comment $comment, Statement $st)
{
$users = $st->getSubscribers();
if ($users) {
require_once ST_DIR . '/Classes/Mailer.php';
$mailer = new Mailer();
$vars = array('text' => strip_tags($comment->getText()), 'st_link' => FrontController::getURLByRoute('view', array('id' => $st->getId()), true), 'title' => $st->getTitle(), 'comment_user' => $comment->getUsername());
foreach ($users as $user) {
if ($user->user_id == $comment->getUserId() || $user->email == $comment->getEmail()) {
continue;
}
$vars['username'] = $user->name;
$vars['unSubscribeLink'] = $this->_getSubscribeLink($user->email, $user->user_id, $st->getId());
$mailer->sendMail('SubscribeNewComment', $user->email, $vars);
}
}
$user = FrontController::getUser();
if (!$user->user_id) {
$guest = clone $user;
$guest->email = $comment->getEmail();
$guest->name = $comment->getUsername();
$this->_subscribe($st, $guest);
} else {
$this->_subscribe($st, $user);
}
}
示例3: renderComment
public function renderComment(Comment $comm, $template)
{
$vars = array('id' => $comm->getId(), 'username' => $comm->getUsername(), 'text' => $comm->getText(), 'date' => date('j.m.Y H:i', $comm->getDate()), 'ip' => $comm->getIpAddress());
$user = FrontController::getUser();
$config = FrontController::$config;
if (in_array($this->_user->user_group, $config['moder_groups']) || in_array($this->_user->user_id, $config['moders']) || ($user->user_id == $comm->getUserId() && $comm->getUserId() || $user->ip_address == $comm->getIpAddress() && $comm->getDate() > time() - $config['owner_comment_del_time'])) {
$blocks['perm_del'] = true;
}
return $this->render($template, $vars, $blocks);
}
示例4: testGetText
public function testGetText()
{
$comment = new Comment('c');
$this->assertEquals("c", $comment->getText());
}
示例5: _writeComment
/**
* Write comment to XML format
*
* @param Shared_XMLWriter $objWriter XML Writer
* @param string $pCellReference Cell reference
* @param Comment $pComment Comment
* @param array $pAuthors Array of authors
* @throws Exception
*/
public function _writeComment(Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', Comment $pComment = null, $pAuthors = null)
{
// comment
$objWriter->startElement('comment');
$objWriter->writeAttribute('ref', $pCellReference);
$objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
// text
$objWriter->startElement('text');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
$objWriter->endElement();
$objWriter->endElement();
}
示例6: onEditComment
/**
* This event is trigered when comment that belongs to this object is updated
*
* @param Comment $comment
* @return boolean
*/
function onEditComment(Comment $comment)
{
if ($this->isSearchable()) {
SearchableObjects::dropContentByObjectColumn($this, 'comment' . $comment->getId());
$searchable_object = new SearchableObject();
$searchable_object->setRelObjectId($this->getObjectId());
$searchable_object->setColumnName('comment' . $comment->getId());
$searchable_object->setContent($comment->getText());
$searchable_object->save();
}
return true;
}
示例7: onNewComment
public function onNewComment(FrontController $sender, Comment $comment, Statement $st)
{
$vars = array('username' => $comment->getUsername(), 'text' => strip_tags($comment->getText()), 'st_link' => FrontController::getURLByRoute('@view', array('id' => $st->getId()), true), 'title' => $st->getTitle());
$this->getMailer()->sendMail('newComment', $this->_getModerEmails(), $vars);
}