本文整理汇总了PHP中utils::nl2br方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::nl2br方法的具体用法?PHP utils::nl2br怎么用?PHP utils::nl2br使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::nl2br方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($id = NULL)
{
$this->view->setLayout("admin");
$this->view->conf = $this->conf;
$this->title_for_layout($this->l10n->__("Comentarios - Codice CMS"));
$comment = new comment();
$total_rows = $comment->countCommentsByPost();
$page = $id;
$page = is_null($page) ? 1 : $page;
$limit = $this->userConf['posts_per_page'];
$offset = ($page - 1) * $limit;
$limitQuery = $offset . "," . $limit;
$targetpage = $this->path . 'comments/';
$pagination = $this->pagination->init($total_rows, $page, $limit, $targetpage);
$this->view->pagination = $pagination;
$comments = $comment->findAll(NULL, "ID DESC", $limitQuery, NULL);
foreach ($comments as $key => $value) {
$Post = new post();
$post = $Post->findBy('ID', $value['ID_post']);
$value['post'] = array('urlfriendly' => $post['urlfriendly'], 'title' => $post['title']);
$value["content"] = utils::htmlentities($value["content"]);
$value["content"] = utils::nl2br($value["content"]);
$comments[$key] = $value;
}
$this->registry->comments = $comments;
$this->plugin->call("comments_comment_content");
$this->view->comments = $this->registry->comments;
$this->render();
}
示例2: getAll
public function getAll($ID_post, $status = null)
{
$C = new comment();
$rows = array();
if (is_null($status) === true) {
$rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post}");
} else {
if (is_array($status)) {
$status_sql = "";
foreach ($status as $st) {
$status_sql .= "status = '{$st}' OR ";
}
$status_sql = substr($status_sql, 0, -4);
$rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND ({$status_sql})");
} else {
$rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND status='{$status}'");
}
}
foreach ($rows as $key => $comment) {
$comment['content'] = utils::htmlentities($comment['content']);
$comment['content'] = utils::nl2br($comment['content']);
$rows[$key] = $comment;
}
return $rows;
}
示例3: adminNotify
public function adminNotify()
{
if ($this->cookie->check("id_user") and $this->cookie->id_user == 1) {
//no notificamos a administrador de su propio comentario.
return;
}
$id = $this->registry->lastCommentID;
$Comment = new comment();
$comment = $Comment->find($id);
$comment['content'] = utils::nl2br($comment['content']);
if (!defined('GESHI_VERSION')) {
$comment['content'] = $this->comment_source_code_beautifier($comment['content'], 'addTagPRE');
} else {
$comment['content'] = $this->comment_source_code_beautifier($comment['content']);
}
$User = new user();
$user = $User->find(1);
$Post = new post();
$post = $Post->find($comment['ID_post']);
$commentsWaiting = $Comment->countCommentsByPost(null, 'waiting');
$mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<small>\n\t\t\t\t\t\t<strong>From IP</strong>: {$comment['IP']}<br />\n\t\t\t\t\t\t<strong>URL</strong>: <a href=\"{$comment['url']}\">{$comment['url']}</a><br />\n\t\t\t\t\t\t<strong>Email</strong>: <a href=\"mailto:{$comment['email']}\">{$comment['email']}</a><br />\n\t\t\t\t\t\t<strong>DateTime</strong>: {$comment['created']}<br />\n\t\t\t\t\t</small>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr><td><strong>Content</strong></td></tr>\n\t\t\t<tr><td bgcolor=\"#f7f7f7\">\n\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tModerate comment: <a href=\"{$this->registry->path}comments/edit/{$comment['ID']}\">{$this->registry->path}comments/edit/{$comment['ID']}</a><br />\n\t\t\t\t\t\tView entry: <a href=\"{$this->registry->path}{$post['urlfriendly']}\">{$this->registry->path}{$post['urlfriendly']}</a>\n\t\t\t\t\t</p>\n\t\t\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThere are {$commentsWaiting} comments waiting for approbal. <br />\n\t\t\t\t\t\tPlease moderate comments: <a href=\"{$this->registry->path}comments/waiting\">{$this->registry->path}comments</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t";
$conf = $this->registry->conf;
$subject = "[{$conf['blog_name']}] Nuevo Comentario en: {$post['title']}";
$this->enviaMail($user['email'], $subject, $mailStr, $user['email']);
}