本文整理汇总了PHP中esc_html_x函数的典型用法代码示例。如果您正苦于以下问题:PHP esc_html_x函数的具体用法?PHP esc_html_x怎么用?PHP esc_html_x使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了esc_html_x函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: square_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function square_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
$byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
$comment_count = get_comments_number();
// get_comments_number returns only a numeric value
if (comments_open()) {
if ($comment_count == 0) {
$comments = __('No Comments', 'square');
} elseif ($comment_count > 1) {
$comments = $comment_count . __(' Comments', 'square');
} else {
$comments = __('1 Comment', 'square');
}
$comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
} else {
$comment_link = __(' Comment Closed', 'square');
}
echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
// WPCS: XSS OK.
}
示例2: impronta_metadata
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function impronta_metadata()
{
// Hide category and tag text for pages.
if ('post' === get_post_type()) {
echo '<p class="metadata">';
$byline = sprintf(esc_html_x('By %s', 'post author', 'impronta'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span> ');
echo $byline;
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'impronta'));
if ($categories_list && impronta_categorized_blog()) {
printf('<span class="cat-links">' . esc_html_x('on %1$s ', 'on categories', 'impronta') . '</span>', $categories_list);
// WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list('', esc_html__(', ', 'impronta'));
if ($tags_list) {
printf(esc_html__('tagged %1$s', 'impronta'), $tags_list);
// WPCS: XSS OK.
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
if (get_comments_number(get_the_id()) == 0) {
echo esc_html__('- ', 'impronta');
} else {
echo esc_html__('with ', 'impronta');
}
comments_popup_link(esc_html__('Leave a comment', 'impronta'), esc_html__('1 Comment', 'impronta'), esc_html__('% Comments', 'impronta'));
}
if (is_sticky()) {
echo ' - ' . '<i class="feature-star fa fa-star" data-toggle="tooltip" data-placement="right" title="' . esc_attr__('Featured Post', 'impronta') . '"></i>';
}
echo '</p>';
}
}
示例3: ushipnetwork_entry_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function ushipnetwork_entry_footer()
{
// Hide category and tag text for pages.
if ('post' === get_post_type()) {
$byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>' . '<div class="share">';
include "share.php";
echo '</div>' . '</div>';
$posttags = get_the_tags();
$count = 0;
$separator = ', ';
$output = '';
if (!empty($posttags)) {
echo '<span class="tag-list">tags: ';
foreach ($posttags as $posttag) {
$count++;
if ($count <= 2) {
$output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator;
}
}
echo trim($output, $separator);
}
echo '</span>';
}
edit_post_link(sprintf(esc_html__('Edit %s', 'ushipnetwork'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
}
示例4: vaidusworld_register_sidebars
/**
* Registers sidebars.
*
* @since 1.0.0
* @access public
* @return void
*/
function vaidusworld_register_sidebars()
{
hybrid_register_sidebar(array('id' => 'primary', 'name' => esc_html_x('Primary', 'sidebar', 'vaidusworld'), 'description' => esc_html__('Add sidebar description.', 'vaidusworld')));
// hybrid_register_sidebar(
// array(
// 'id' => 'header-right',
// 'name' => esc_html_x( 'Header Right', 'sidebar', 'vaidusworld' ),
// 'description' => esc_html__( 'Add sidebar description.', 'vaidusworld' )
// )
// );
//
// hybrid_register_sidebar(
// array(
// 'id' => 'footer-1',
// 'name' => esc_html_x( 'Footer 1', 'sidebar', 'vaidusworld' ),
// 'description' => esc_html__( 'Add sidebar description.', 'vaidusworld' )
// )
// );
//
// hybrid_register_sidebar(
// array(
// 'id' => 'footer-2',
// 'name' => esc_html_x( 'Footer 2', 'sidebar', 'vaidusworld' ),
// 'description' => esc_html__( 'Add sidebar description.', 'vaidusworld' )
// )
// );
//
// hybrid_register_sidebar(
// array(
// 'id' => 'footer-3',
// 'name' => esc_html_x( 'Footer 3', 'sidebar', 'vaidusworld' ),
// 'description' => esc_html__( 'Add sidebar description.', 'vaidusworld' )
// )
// );
}
示例5: ubuntugnome_register_sidebars
/**
* Registers sidebars.
*
* @since 1.0.0
* @access public
* @return void
*/
function ubuntugnome_register_sidebars()
{
hybrid_register_sidebar(array('id' => 'footer-1', 'name' => esc_html_x('Footer 1', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
hybrid_register_sidebar(array('id' => 'footer-2', 'name' => esc_html_x('Footer 2', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
hybrid_register_sidebar(array('id' => 'footer-3', 'name' => esc_html_x('Footer 3', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
hybrid_register_sidebar(array('id' => 'footer-4', 'name' => esc_html_x('Footer 4', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
}
示例6: output_html
/**
* Modify the output of the field on the fronted profile.
*
* @since 1.2.0
* @param string $value the value of the field.
* @param object $field field details.
* @return string the formatted field value.
*/
public static function output_html($value, $field)
{
if ($value == '1') {
$value = esc_html_x('Yes', 'Used when displaying the value of a checkbox field within the profile page.', 'wpaam');
}
return $value;
}
示例7: river_radio_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function river_radio_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf(esc_html_x('%s', 'post date', 'river-radio'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
$byline = sprintf(esc_html_x('%s', 'post author', 'river-radio'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
echo '<span class="byline icons"><i class="fa fa-headphones"></i>
' . $byline . '</span><span class="posted-on icons"><i class="fa fa-calendar"></i>
' . $posted_on . '</span>';
// WPCS: XSS OK.
if ('post' === get_post_type()) {
$tags_list = get_the_tag_list('', esc_html__(', ', 'river-radio'));
if ($tags_list) {
printf('<span class="tags-links icons"><i class="fa fa-music"></i>
' . esc_html__('%1$s', 'river-radio') . '</span> ', $tags_list);
// WPCS: XSS OK.
}
$categories_list = get_the_category_list(esc_html__(', ', 'river-radio'));
if ($categories_list && river_radio_categorized_blog()) {
printf('<span class="cat-links icons"><i class="fa fa-map-marker"></i>
' . esc_html__('%1$s', 'river-radio') . '</span>', $categories_list);
// WPCS: XSS OK.
}
}
}
示例8: ocin_lite_metadata
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function ocin_lite_metadata()
{
echo '<ul>';
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
echo '<li class="meta_date">' . $time_string . '</li>';
$byline = sprintf(esc_html_x('by %s', 'post author', 'ocin-lite'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
echo '<li class="meta_comments">' . $byline . '</li>';
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<li class="meta_date"><span class="comments-link">';
comments_popup_link(esc_html__('Leave a comment', 'ocin-lite'), esc_html__('1 Comment', 'ocin-lite'), esc_html__('% Comments', 'ocin-lite'));
echo '</span></li>';
}
// Hide category and tag text for pages.
if ('post' === get_post_type() && is_single()) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'ocin-lite'));
if ($categories_list && ocin_lite_categorized_blog()) {
printf('<li class="meta_categories"><span class="cat-links">' . esc_html__('Posted in %1$s', 'ocin-lite') . '</span></li>', $categories_list);
// WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list('', esc_html__(', ', 'ocin-lite'));
if ($tags_list) {
printf('<li class="meta_tags"><span class="tags-links">' . esc_html__('Tagged %1$s', 'ocin-lite') . '</span></li>', $tags_list);
// WPCS: XSS OK.
}
}
echo '</ul>';
}
示例9: add
/**
* Adds the settings page to the Settings menu.
*
* @wp-hook admin_menu
*
* @return void
*/
public function add()
{
$menu_title = esc_html_x('Taxonomies', 'Menu item title', 'linked-taxonomies');
$capability = $this->settings_page->get_capability('list');
$menu_slug = $this->settings_page->get_slug();
add_options_page($this->title, $menu_title, $capability, $menu_slug, array($this, 'render'));
}
示例10: display_template_management_view
/**
* Display Template List Table
*/
public static function display_template_management_view()
{
self::run_management_actions();
echo '<div class="wrap">';
?>
<h2><?php
_e('Manage Templates', 'landing-pages');
?>
<a href="edit.php?post_type=landing-page&page=lp_templates_upload"
class="add-new-h2"><?php
echo esc_html_x('Add New Template', 'template');
?>
</a>
</h2>
<?php
$myListTable = new Landing_Pages_Templates_List_Table();
$myListTable->prepare_items();
?>
<form method="post">
<input type="hidden" name="page" value="my_list_test"/>
<?php
$myListTable->search_box('search', 'search_id');
?>
</form>
<form method="post" id='bulk_actions'>
<?php
$myListTable->display();
echo '</div></form>';
}
示例11: jkl_index_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function jkl_index_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$byline = sprintf(esc_html('%s'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">@' . esc_html(get_the_author()) . '</a></span>');
if ('chat' === get_post_format() || 'image' === get_post_format() || 'gallery' === get_post_format() || 'audio' === get_post_format() || 'video' === get_post_format()) {
$string = ucwords(get_post_format());
$posted_on = $string . ': <a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>';
} else {
$posted_on = sprintf(esc_html_x('Date: %s', 'post date', 'jkl'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
}
$meta_class = is_single() ? 'format-small-meta' : 'meta-content-index';
echo '<div class="' . $meta_class . '">';
echo '<span class="posted-on">' . $posted_on . '</span>';
// WPCS: XSS OK.
if (is_single()) {
echo '<span class="byline">' . $byline . '</span>';
if (!has_post_format('quote')) {
jkl_better_taxonomy_listing('category', 1);
}
}
echo '</div><!-- .meta-content-index -->';
}
示例12: pleiadesweb_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function pleiadesweb_posted_on()
{
// POSTED ON
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf('<i class="fa fa-calendar"></i>' . esc_html_x(' %s', 'post date', 'pleiadesweb'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
// AUTHOR
$byline = sprintf(esc_html_x('| escrito por %s', 'post author', 'pleiadesweb'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
// CATEGORIES
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'pleiadesweb'));
if ($categories_list && pleiadesweb_categorized_blog()) {
echo ' | </i><span class="category-list">' . $categories_list . '</span>';
}
// COMMENTS
if (!post_password_required() && (comments_open() || '0' != get_comments_number())) {
echo ' | <span class="comments-link">';
comments_popup_link(__('Deja un comentario', 'my-simone'), __('1 comentario', 'my-simone'), __('% comentarios', 'my-simone'));
echo '</span>';
}
//!post_password_required()
}
示例13: abc_nuorisotominta_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function abc_nuorisotominta_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
/*
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
*/
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf(esc_html_x('Опубликовано %s', 'post date', 'abc-nuorisotominta'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
/*
$posted_on = sprintf(
esc_html_x( 'Posted on %s', 'post date', 'abc-nuorisotominta' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
*/
/*
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'abc-nuorisotominta' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
*/
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
// WPCS: XSS OK.
}
示例14: magik_register_sidebars
/**
* Registers sidebars.
*
* @since 1.0.0
* @access public
* @return void
*/
function magik_register_sidebars()
{
hybrid_register_sidebar(array('id' => 'primary', 'name' => esc_html_x('Primary', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
hybrid_register_sidebar(array('id' => 'footer-1', 'name' => esc_html_x('Footer 1', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
hybrid_register_sidebar(array('id' => 'footer-2', 'name' => esc_html_x('Footer 2', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
hybrid_register_sidebar(array('id' => 'footer-3', 'name' => esc_html_x('Footer 3', 'sidebar', 'magik'), 'description' => esc_html__('Add sidebar description.', 'magik')));
}
示例15: usbasske_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function usbasske_posted_on()
{
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if (get_the_time('U') !== get_the_modified_time('U')) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf(esc_html_x('Posted on %s', 'post date', 'usbasske'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
$byline = sprintf(esc_html_x('by %s', 'post author', 'usbasske'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
// Display the author avatar if the author has a Gravatar
$author_id = get_the_author_meta('ID');
if (usbasske_validate_gravatar($author_id)) {
echo '<div class="meta-content has-avatar">';
echo '<div class="author-avatar">' . get_avatar($author_id) . '</div>';
} else {
echo '<div class="meta-content">';
}
echo '<span class="byline"> ' . $byline . '</span><span class="posted-on">' . $posted_on . '</span>';
// WPCS: XSS OK.
if (!post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link">';
comments_popup_link(esc_html__('Leave a comment', 'usbasske'), esc_html__('1 Comment', 'usbasske'), esc_html__('% Comments', 'usbasske'));
echo '</span>';
}
echo '</div><!-- .meta-content -->';
}