本文整理汇总了PHP中utils::htmlentities方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::htmlentities方法的具体用法?PHP utils::htmlentities怎么用?PHP utils::htmlentities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::htmlentities方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: addMetaTags
public function addMetaTags()
{
global $post, $wp, $properties;
/*
* og: inicial
*/
$this->properties = array('og:type' => 'article', 'og:url' => home_url($wp->request), 'og:site_name' => get_bloginfo('name'), 'og:locale' => 'pt_BR');
/*
*
* og:title
* Título do "post" que ira aparecer no PopUP do facebook e na Timeline
*
*/
if (is_single()) {
$this->properties['og:title'] = get_the_title();
} elseif (is_category()) {
$this->properties['og:title'] = single_cat_title('', false);
} elseif (is_tag()) {
$this->properties['og:title'] = single_tag_title('', false);
} else {
$this->properties['og:title'] = get_bloginfo('name');
}
/*
*
* og:image
* Thumbnail do "post" que ira aparecer no PopUP do facebook e na Timeline
*
*/
if (is_single() && has_post_thumbnail($post->ID)) {
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
if (!empty($image[0])) {
$this->properties['og:image'] = $image[0];
} else {
$this->properties['og:image'] = get_stylesheet_directory_uri() . '/img/logo-facebook.png';
}
}
/*
*
* og:description
* Descrição do "post" se tiver em um ou do site
*
*/
if (is_single() && !empty(get_the_excerpt())) {
$this->properties['og:description'] = get_the_excerpt();
} else {
$this->properties['og:description'] = get_bloginfo('description');
}
/*
* Faz um loop de todos os ogs existentes e adiciona ao head do HTML
*/
foreach ($this->properties as $og => $og_value) {
if ($og === 'og:url' or $og === 'og:image') {
echo "<meta name=\"{$og}\" content=\"{$og_value}\" />\n";
} else {
$og_value = utils::htmlentities($og_value);
echo "<meta name=\"{$og}\" content=\"{$og_value}\" />\n";
}
}
}