本文整理汇总了PHP中esc_attr_x函数的典型用法代码示例。如果您正苦于以下问题:PHP esc_attr_x函数的具体用法?PHP esc_attr_x怎么用?PHP esc_attr_x使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了esc_attr_x函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: oxford_comment_form_defaults
/**
* Change the comment form defaults.
*
* @since 1.0.
*
* @param array $defaults The default values.
* @return array The modified defaults.
*/
function oxford_comment_form_defaults($defaults)
{
$input_size = 22;
// Comment form title
$defaults['title_reply'] = __('Leave a comment', 'oxford');
// Comment form notes
$defaults['comment_notes_before'] = '';
$defaults['comment_notes_after'] = '';
// Comment Author
$comment_author = isset($_POST['author']) ? wp_strip_all_tags($_POST['author'], true) : null;
$author_field = sprintf('<p class="comment-form-author"><input class="text-input respond-type" type="text" name="%1$s" id="%1$s" value="%3$s" size="%4$d" aria-required="true" tabindex="%5$d" placeholder="%2$s" /></p>', 'author', esc_attr_x('Name', 'comment field placeholder', 'oxford'), esc_attr($comment_author), $input_size, 1);
// Comment Author Email
$comment_author_email = isset($_POST['email']) ? trim($_POST['email']) : null;
$email_field = sprintf('<p class="comment-form-email"><input class="text-input respond-type" type="email" name="%1$s" id="%1$s" value="%3$s" size="%4$d" aria-required="true" tabindex="%5$d" placeholder="%2$s" /></p>', 'email', esc_attr_x('Email', 'comment field placeholder', 'oxford'), esc_attr($comment_author_email), $input_size, 2);
// Comment Author URL
$comment_author_url = isset($_POST['url']) ? trim($_POST['url']) : null;
$url_field = sprintf('<p class="comment-form-url"><input class="text-input respond-type" type="url" name="%1$s" id="%1$s" value="%3$s" size="%4$d" tabindex="%5$d" placeholder="%2$s" /></p>', 'url', esc_attr_x('Website', 'comment field placeholder', 'oxford'), esc_attr($comment_author_url), $input_size, 3);
// Set the fields in the $defaults array
$defaults['fields'] = array('author' => $author_field, 'email' => $email_field, 'url' => $url_field);
// Comment Form
$defaults['comment_field'] = sprintf('<p class="comment-form-comment"><textarea id="comment" class="blog-textarea respond-type" name="comment" cols="58" rows="10" aria-required="true" tabindex="4" placeholder="%s"></textarea></p>', esc_attr_x('Type reply here…', 'comment field placeholder', 'oxford'));
// Submit label
$defaults['label_submit'] = __('Post comment', 'oxford');
return $defaults;
}
示例2: vossen_jubi_get_search_form
static function vossen_jubi_get_search_form($echo = true)
{
$format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml';
$format = apply_filters('search_form_format', $format);
if ('html5' == $format) {
$form = ' <div class="widget-search"><form role="search" method="get" class="search-form" action="' . esc_url(home_url('/')) . '">
<div class="input-group">
<input type="search" class="form-control search-input" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x('Search for:', 'label') . '" />
<span class="input-group-btn">
<button class="btn btn-default search-button" type="submit">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</form></div>';
} else {
$form = ' <div class="widget-search"><form role="search" method="get" id="searchform" class="searchform" action="' . esc_url(home_url('/')) . '">
<div class="input-group">
<input type="text" class="form-control search-input" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" id="s" />
<span class="input-group-btn">
<button class="btn btn-default search-button" type="submit">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</form></div>';
}
return $form;
}
示例3: document_tag_slug_input
/**
* Show a slug input box.
* @since 1.0.0
*/
public function document_tag_slug_input()
{
?>
<input name="documentate_permalinks[tag_base]" type="text" class="regular-text code" value="<?php
echo esc_attr(documentate_get_option('tag_base'));
?>
" placeholder="<?php
echo esc_attr_x('docu_tag', 'slug', 'documentate');
?>
" />
<?php
}
示例4: photo_perfect_customize_search_form
/**
* Customize search form.
*
* @since Photo Perfect 1.0
*/
function photo_perfect_customize_search_form()
{
$search_placeholder = photo_perfect_get_option('search_placeholder');
$form = '<form role="search" method="get" class="search-form" action="' . esc_url(home_url('/')) . '">
<label>
<span class="screen-reader-text">' . _x('Search for:', 'label', 'photo-perfect') . '</span>
<input type="search" class="search-field" placeholder="' . esc_attr($search_placeholder) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x('Search for:', 'label', 'photo-perfect') . '" />
</label>
<input type="submit" class="search-submit" value="' . esc_attr_x('Search', 'submit button', 'photo-perfect') . '" />
</form>';
return $form;
}
示例5: taxonomy_slug_input
/**
* Show a slug input box.
*/
public function taxonomy_slug_input()
{
$permalinks = get_option('elm_randomizer_permalinks');
?>
<input name="elm_randomizer_taxonomy_slug" type="text" class="regular-text code" value="<?php
if (isset($permalinks['taxonomy_base'])) {
echo esc_attr($permalinks['taxonomy_base']);
}
?>
" placeholder="<?php
echo esc_attr_x('randomizer-category', 'slug', 'elm');
?>
" />
<?php
}
示例6: portfolio_tag_slug_input
/**
* Show a slug input box.
*/
public function portfolio_tag_slug_input()
{
$permalinks = get_option('axiscomposer_permalinks');
?>
<input name="axiscomposer_portfolio_tag_slug" type="text" class="regular-text code" value="<?php
if (isset($permalinks['tag_base'])) {
echo esc_attr($permalinks['tag_base']);
}
?>
" placeholder="<?php
echo esc_attr_x('portfolio-tag', 'slug', 'axiscomposer');
?>
" />
<?php
}
示例7: product_tag_slug_input
/**
* Show a slug input box.
*/
public function product_tag_slug_input()
{
$permalinks = get_option('woocommerce_permalinks');
?>
<input name="woocommerce_product_tag_slug" type="text" class="regular-text code" value="<?php
if (isset($permalinks['tag_base'])) {
echo esc_attr($permalinks['tag_base']);
}
?>
" placeholder="<?php
echo esc_attr_x('product-tag', 'slug', 'woocommerce');
?>
" />
<?php
}
示例8: event_action_links
/**
* Injects action links into the attendee screen.
*
* @param $event_id
*/
public function event_action_links($event_id)
{
$action_links = array('<a href="' . esc_url(get_edit_post_link($event_id)) . '" title="' . esc_attr_x('Edit', 'attendee event actions', 'event-tickets') . '">' . esc_html_x('Edit', 'attendee event actions', 'event-tickets') . '</a>', '<a href="' . esc_url(get_permalink($event_id)) . '" title="' . esc_attr_x('View', 'attendee event actions', 'event-tickets') . '">' . esc_html_x('View', 'attendee event actions', 'event-tickets') . '</a>');
/**
* Provides an opportunity to add and remove action links from the
* attendee screen summary box.
*
* @param array $action_links
*/
$action_links = (array) apply_filters('tribe_tickets_attendees_event_action_links', $action_links);
if (empty($action_links)) {
return;
}
echo '<div class="event-actions">' . join(' | ', $action_links) . '</div>';
}
示例9: call_some_i18n_methods
function call_some_i18n_methods()
{
__('Hello World', 'test-domain');
_e('Hello World', 'test-domain');
_n('Single', 'Plural', 1, 'test-domain');
_n_noop('Single Noop', 'Plural Noop', 1, 'test-domain');
_x('Hello World', 'Testing', 'test-domain');
_ex('Hello World', 'Testing', 'test-domain');
_nx('Hello World', 'Testing', 'test-domain');
_nx_noop('Hello World Noop', 'Testing', 'test-domain');
esc_attr__('Attribute', 'test-domain');
esc_html__('HTML', 'test-domain');
esc_attr_e('Attribute', 'test-domain');
esc_html_e('HTML', 'test-domain');
esc_attr_x('Attribute', 'Testing', 'test-domain');
esc_html_x('HTML', 'Testing', 'test-domain');
translate_nooped_plural('Plural Noop', 2, 'test-domain');
}
示例10: wpex_mobile_search
function wpex_mobile_search()
{
?>
<div id="mobile-search">
<form method="get" action="<?php
echo esc_url(home_url('/'));
?>
" role="search" id="mobile-search-form">
<input type="search" class="field" name="s" value="<?php
echo esc_attr(get_search_query());
?>
" placeholder="<?php
echo esc_attr_x('To search type and hit enter', 'wpex');
?>
" />
</form>
</div>
<?php
}
示例11: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
* @since 3.2.0
*
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
// Set vars for widget usage
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$filter_page = empty($instance['filter_page']) ? '' : (int) $instance['filter_page'];
// Before widget WP hook
echo $args['before_widget'];
// Display title if defined
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
?>
<form role="search" method="get" class="search-form" action="<?php
echo get_page_link($filter_page);
?>
">
<input type="search" class="search-field" placeholder="<?php
echo esc_attr_x('Search …', 'placeholder', 'wpsp_admin');
?>
" value="<?php
if (!empty($_GET['p'])) {
echo $_GET['p'];
}
?>
" name="p" title="<?php
echo esc_attr_x('Search for:', 'label', 'wpsp_admin');
?>
" />
<button type="submit" class="search-submit"><span class="screen-reader-text"><?php
echo _x('Search', 'submit button', 'wpsp_admin');
?>
</span></button>
</form>
<?php
// After widget WP hook
echo $args['after_widget'];
?>
<?php
}
示例12: shopping_header_right
function shopping_header_right()
{
?>
<aside class="header-right widget-area sidebar">
<?php
if (is_active_sidebar('header-right')) {
dynamic_sidebar('header-right');
} else {
?>
<section class="widget widget_search widget-widget_search">
<div class="widget-wrap">
<form role="search" method="get" class="search-form" action="<?php
echo esc_url(home_url('/'));
?>
">
<input type="search" class="search-field" placeholder="<?php
echo esc_attr_x('Search …', 'placeholder', 'shopping');
?>
" value="<?php
echo esc_attr(get_search_query());
?>
" name="s" title="<?php
_ex('Search for:', 'label', 'shopping');
?>
">
</form>
</div>
</section>
<?php
}
?>
</aside><!-- .sidebar -->
<?php
}
示例13: widget
/**
* front-end display of widget
*
* @see WP_Widget::widget()
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
$navbaralign = $this->navbaralign;
if (isset($instance['navbaralign']) && $instance['navbaralign'] != null) {
$navbaralign = $instance['navbaralign'];
}
// set output front-end widget ---------------------------------
$output = $args['before_widget'];
$output .= '<form class="navbar-form ' . $navbaralign . '" action="' . esc_url(home_url('/')) . '" role="search">';
$output .= '<div class="form-group">';
$output .= '<input type="text" name="s" class="form-control" placeholder="' . esc_attr_x('Search …', 'placeholder', 'son-of-a-saint') . '" value="' . esc_attr(get_search_query()) . '" title="' . esc_attr_x('Search for:', 'label', 'son-of-a-saint') . '">';
$output .= '</div>';
$output .= ' ';
$output .= '<button type="submit" class="btn btn-default">' . esc_html__('Search', 'son-of-a-saint') . '</button>';
$output .= '</form>';
$output .= $args['after_widget'];
echo $output;
// clear unused variables
unset($output);
}
示例14: pranon_get_search_form
static function pranon_get_search_form($echo = true)
{
$format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml';
$format = apply_filters('search_form_format', $format);
if ('html5' == $format) {
$form = ' <div class="widget-search"><form role="search" method="get" class="searchForm light" action="' . esc_url(home_url('/')) . '">
<div class="input-group">
<input type="search" class="form-control search-input" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x('Search for:', 'label') . '" />
<input type="submit" class="submitSearch" value="Ok">
</div>
</form></div>';
} else {
$form = ' <div class="widget-search"><form role="search" method="get" id="searchform" class="searchForm light" action="' . esc_url(home_url('/')) . '">
<div class="input-group">
<input type="text" class="form-control search-input" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" id="s" />
<input type="submit" class="submitSearch" value="Ok">
</div>
</form></div>';
}
return $form;
}
示例15: get_search_form
function get_search_form($echo = true)
{
do_action('pre_get_search_form');
$format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml';
$format = apply_filters('search_form_format', $format);
$search_form_template = locate_template('searchform.php');
if ('' != $search_form_template) {
ob_start();
require $search_form_template;
$form = ob_get_clean();
} else {
if ('html5' == $format) {
$form = '<form role="search" method="get" class="search-form" action="' . esc_url(home_url('/')) . '">
<label>
<span class="screen-reader-text">' . _x('Search for:', 'label') . '</span>
<input type="search" class="search-field" placeholder="' . esc_attr_x('Search …', 'placeholder') . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x('Search for:', 'label') . '" />
</label>
<input type="submit" class="search-submit" value="' . esc_attr_x('Search', 'submit button') . '" />
</form>';
} else {
$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url(home_url('/')) . '">
<div>
<label class="screen-reader-text" for="s">' . _x('Search for:', 'label') . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="' . esc_attr_x('Search', 'submit button') . '" />
</div>
</form>';
}
}
$result = apply_filters('get_search_form', $form);
if (null === $result) {
$result = $form;
}
if ($echo) {
echo $result;
} else {
return $result;
}
}