本文整理汇总了PHP中wp_specialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_specialchars函数的具体用法?PHP wp_specialchars怎么用?PHP wp_specialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_specialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: title
function title()
{
if (is_category()) {
echo 'Category Archive for "';
single_cat_title();
echo '" | ';
bloginfo('name');
} elseif (is_tag()) {
echo 'Tag Archive for "';
single_tag_title();
echo '" | ';
bloginfo('name');
} elseif (is_archive()) {
wp_title('');
echo ' Archive | ';
bloginfo('name');
} elseif (is_search()) {
echo 'Search for "' . wp_specialchars($s) . '" | ';
bloginfo('name');
} elseif (is_home() || is_front_page()) {
bloginfo('name');
echo ' | ';
bloginfo('description');
} elseif (is_404()) {
echo 'Error 404 Not Found | ';
bloginfo('name');
} elseif (is_single()) {
wp_title('');
} else {
echo wp_title(' | ', false, right);
bloginfo('name');
}
}
示例2: wp_generate_product_tag_cloud
function wp_generate_product_tag_cloud($tags, $args = '')
{
global $wp_rewrite;
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC');
$args = wp_parse_args($args, $defaults);
extract($args);
if (!$tags) {
return;
}
$counts = $tag_links = array();
foreach ((array) $tags as $tag) {
$counts[$tag->name] = $tag->count;
$tag_links[$tag->name] = get_product_tag_link($tag->term_id);
if (is_wp_error($tag_links[$tag->name])) {
return $tag_links[$tag->name];
}
$tag_ids[$tag->name] = $tag->term_id;
}
$min_count = min($counts);
$spread = max($counts) - $min_count;
if ($spread <= 0) {
$spread = 1;
}
$font_spread = $largest - $smallest;
if ($font_spread <= 0) {
$font_spread = 1;
}
$font_step = $font_spread / $spread;
// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
if ('name' == $orderby) {
uksort($counts, 'strnatcasecmp');
} else {
asort($counts);
}
if ('DESC' == $order) {
$counts = array_reverse($counts, true);
}
$a = array();
$rel = is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ? ' rel="tag"' : '';
foreach ($counts as $tag => $count) {
$tag_id = $tag_ids[$tag];
$tag_link = clean_url($tag_links[$tag]);
$tag = str_replace(' ', ' ', wp_specialchars($tag));
$a[] = "<a href='{$tag_link}' class='tag-link-{$tag_id}' title='" . attribute_escape(sprintf(__('%d topics'), $count)) . "'{$rel} style='font-size: " . ($smallest + ($count - $min_count) * $font_step) . "{$unit};'>{$tag}</a>";
}
switch ($format) {
case 'array':
$return =& $a;
break;
case 'list':
$return = "<ul class='product_tag_cloud'>\n\t<li>";
$return .= join("</li>\n\t<li>", $a);
$return .= "</li>\n</ul>\n";
break;
default:
$return = join("\n", $a);
break;
}
return apply_filters('wp_generate_product_tag_cloud', $return, $tags, $args);
}
示例3: jj_ngg_jquery_carousel_shortcode_handler
function jj_ngg_jquery_carousel_shortcode_handler($atts)
{
$instance = array();
foreach ($atts as $att => $val) {
$instance[wp_specialchars($att)] = wp_specialchars($val);
}
// Set defaults
if (WPJJNGGJ_CAROUSEL_use_default($instance, 'html_id')) {
$instance['html_id'] = 'jcarousel';
}
if (WPJJNGGJ_CAROUSEL_use_default($instance, 'order')) {
$instance['order'] = 'random';
}
if (WPJJNGGJ_CAROUSEL_use_default($instance, 'scroll')) {
$instance['scroll'] = '1';
}
if (WPJJNGGJ_CAROUSEL_use_default($instance, 'visible')) {
$instance['visible'] = '1';
}
if (WPJJNGGJ_CAROUSEL_use_default($instance, 'wrap')) {
$instance['wrap'] = 'circular';
}
$instance['shortcode'] = '1';
ob_start();
the_widget("JJ_NGG_JQuery_Carousel", $instance, array());
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例4: apanel_gateways_html
public function apanel_gateways_html($atts, $content)
{
// global $wp_widget_factory;
//
// extract(shortcode_atts(array(
// 'widget_name' => FALSE
// ), $atts));
//
// $widget_name = wp_specialchars($widget_name);
//
// if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')):
// $wp_class = 'WP_Widget_'.ucwords(strtolower($class));
//
// if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')):
// return '<p>'.sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"),'<strong>'.$class.'</strong>').'</p>';
// else:
// $class = $wp_class;
// endif;
// endif;
$widget_name = wp_specialchars('Skc_Apanel_Gateways_Widget');
ob_start();
the_widget($widget_name, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''));
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例5: thematic_search_form
function thematic_search_form($echo = true)
{
$search_form = "\n" . "\t";
$search_form .= '<form id="searchbox" method="get" action="' . get_bloginfo('home') . '">';
$search_form .= "\n" . "\t" . "\t";
$search_form .= '<div>';
$search_form .= "\n" . "\t" . "\t" . "\t";
if (is_search()) {
$search_form .= '<input id="s" name="s" type="search" placeholder="' . wp_specialchars(stripslashes($_GET['s']), true) . '" size="32" tabindex="1" />';
} else {
$value = __('To search, type and hit enter', 'thematic');
$value = apply_filters('search_field_value', $value);
$search_form .= '<input id="s" name="s" type="text" value="' . $value . '" onfocus="if (this.value == \'' . $value . '\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'' . $value . '\';}" size="32" tabindex="1" />';
}
$search_form .= "\n" . "\t" . "\t" . "\t";
$search_submit = '<input id="searchsubmit" name="searchsubmit" type="submit" value="' . __('Search', 'thematic') . '" tabindex="2" />';
$search_form .= apply_filters('thematic_search_submit', $search_submit);
$search_form .= "\n" . "\t" . "\t";
$search_form .= '</div>';
$search_form .= "\n" . "\t";
$search_form .= '</form>';
if ($echo) {
echo apply_filters('thematic_search_form', $search_form);
} else {
return apply_filters('thematic_search_form', $search_form);
}
}
示例6: pdf24Plugin_widgetControl
function pdf24Plugin_widgetControl()
{
if ($_POST['pdf24PluginSubmit']) {
update_option('pdf24Plugin_sbpStyle', $_POST['pdf24Plugin-sbpStyle']);
update_option('pdf24Plugin_widgetTitle', $_POST['pdf24Plugin-widget-title']);
}
$styleParms = pdf24Plugin_getStyleParams('pdf24Plugin_sbpStyle', 'styles/sbp');
?>
<p style="text-align:left; line-height: 100%;">
<label for="pdf24Plugin-widget-title" style="line-height:25px;display:block;">
<?php
_e('Title:');
?>
<br />
<input style="width:100%" type="text" id="pdf24Plugin-widget-title" name="pdf24Plugin-widget-title" value="<?php
echo wp_specialchars(pdf24Plugin_getWidgetTitle(), true);
?>
" />
</label>
<label for="pdf24Plugin-sbpStyle" style="line-height:25px;display:block;">
<?php
_e('Style:');
?>
<br />
<select id="pdf24Plugin-sbpStyle" name="pdf24Plugin-sbpStyle">
<?php
echo $styleParms['options'];
?>
</select>
</label>
<input type="hidden" name="pdf24PluginSubmit" id="pdf24PluginSubmit" value="1" />
</p>
<?php
}
示例7: widget_subpagehierarchy_page_rows
function widget_subpagehierarchy_page_rows($headpage, $parent = 0, $level = 0, $pages = 0)
{
global $wpdb, $class, $post;
if (!$pages) {
$pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
}
if ($pages) {
foreach ($pages as $post) {
start_wp();
if ($post->post_parent == $parent) {
$post->post_title = wp_specialchars($post->post_title);
$pad = str_repeat('—', $level);
$id = $post->ID;
if ($id == $headpage) {
$selectString = ' selected';
} else {
unset($selectString);
}
$class = 'alternate' == $class ? '' : 'alternate';
echo ' <option value="' . $post->ID . '"' . $selectString . ">{$pad}" . $post->post_title . "</option>\n";
widget_subpagehierarchy_page_rows($headpage, $id, $level + 1, $pages);
}
}
} else {
return false;
}
}
示例8: the_content_rss
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content_rss', $content);
if ( $cut && !$encode_html )
$encode_html = 2;
if ( 1== $encode_html ) {
$content = wp_specialchars($content);
$cut = 0;
} elseif ( 0 == $encode_html ) {
$content = make_url_footnote($content);
} elseif ( 2 == $encode_html ) {
$content = strip_tags($content);
}
if ( $cut ) {
$blah = explode(' ', $content);
if ( count($blah) > $cut ) {
$k = $cut;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
for ( $i=0; $i<$k; $i++ )
$excerpt .= $blah[$i].' ';
$excerpt .= ($use_dotdotdot) ? '...' : '';
$content = $excerpt;
}
$content = str_replace(']]>', ']]>', $content);
echo $content;
}
示例9: __construct
function __construct()
{
global $email, $opt, $tml;
$this->post_author = __("Thank Me Later", "thankmelater");
$this->post_date = date("Y-m-d H:i:s");
$this->guid = get_bloginfo('url') . "?tmloptout";
$this->post_title = __("E-mail Preferences", "thankmelater");
$this->post_content = '<form method="get" action="' . htmlspecialchars(get_bloginfo('url')) . '">';
$this->post_content .= '<input type="hidden" name="tmloptout" value="" />';
$this->post_content .= '<p>' . sprintf(__("This page allows you to opt-out or subscribe to 'Thank Me Later' e-mails. These are e-mails sent when you leave a comment at %s.", "thankmelater"), wp_specialchars(get_bloginfo("name"))) . '</p>';
if ($email) {
$this->post_content .= '<input type="hidden" name="email" value="' . attribute_escape($email) . '" />';
$this->post_content .= '<p>' . sprintf(__("Your e-mail address: <strong>%s</strong>", "thankmelater"), wp_specialchars($email)) . '</p>';
if ($opt) {
$this->post_content .= '<p>' . __("You are currently <strong>subscribed</strong> to receive e-mails. Click 'Opt Out' if you wish to opt-out of these e-mails:", "thankmelater") . '</p>';
$this->post_content .= '<input type="hidden" name="opt" value="0" />';
$this->post_content .= '<p><input type="submit" value="' . __("Opt Out", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>';
} else {
$this->post_content .= '<p>' . __("You are <strong>not subscribed</strong> to receive e-mails. Click 'Opt In' if you wish to receive e-mails again:", "thankmelater") . '</p>';
$this->post_content .= '<input type="hidden" name="opt" value="1" />';
$this->post_content .= '<p><input type="submit" value="' . __("Opt In", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>';
}
} else {
$this->post_content .= '<p>' . sprintf(__("Your e-mail address: <strong>%s</strong>", "thankmelater"), '<input type="text" name="email" value="" />') . '</p>';
$this->post_content .= '<p><input type="submit" value="' . __("Get Preferences »", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>';
}
// don't allow opt outs
if (!$tml->get_option("allow_opt_out")) {
$this->post_content = "<p>" . __("Sorry, this feature is disabled.", "thankmelater") . "</p>";
}
}
示例10: ufandshands_widget_shortcode
function ufandshands_widget_shortcode($atts)
{
global $wp_widget_factory;
extract(shortcode_atts(array('widget_name' => FALSE, 'title' => '', 'numberofposts' => '3', 'showexcerpt' => 1, 'showthumbnails' => 1, 'showdate' => 1, 'showrssicon' => 1, 'specific_category_id' => ''), $atts));
$widget_name = wp_specialchars($widget_name);
if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')) {
$wp_class = 'WP_Widget_' . ucwords(strtolower($class));
if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')) {
return '<p>' . sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"), '<strong>' . $class . '</strong>') . '</p>';
} else {
$class = $wp_class;
}
}
$instance = '&title=' . $title;
$instance .= '&numberofposts=' . $numberofposts;
$instance .= '&showexcerpt=' . $showexcerpt;
$instance .= '&showthumbnails=' . $showthumbnails;
$instance .= '&showdate=' . $showdate;
$instance .= '&showrssicon=' . $showrssicon;
$instance .= '&specific_category_id=' . $specific_category_id;
// $instance .= '&='.$;
ob_start();
the_widget($widget_name, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '<div class="widget_body">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例11: thematic_search_form
function thematic_search_form($echo = true)
{
global $my_shortname;
$search_form = "\n" . "\t";
$search_form .= '<form id="searchbox" method="get" action="' . get_bloginfo('home') . '" role="search">';
$search_form .= "\n" . "\t" . "\t";
$search_form .= '<div>';
$search_form .= "\n" . "\t" . "\t" . "\t";
if (is_search()) {
$search_form .= '<input id="s" name="s" type="search" placeholder="' . wp_specialchars(stripslashes($_GET['s']), true) . '" size="32" tabindex="1" autofocus>';
} else {
$value = __('Type to Find', $my_shortname);
$value = apply_filters('search_field_value', $value);
$search_form .= '<input id="s" name="s" type="search" placeholder="' . $value . '" size="32" tabindex="1">';
}
$search_form .= "\n" . "\t" . "\t" . "\t";
$search_submit = '<input id="searchsubmit" name="searchsubmit" type="submit" value="' . __('go', $my_shortname) . '" tabindex="2">';
$search_form .= apply_filters('thematic_search_submit', $search_submit);
$search_form .= "\n" . "\t" . "\t";
$search_form .= '</div>';
$search_form .= "\n" . "\t";
$search_form .= '</form>';
if ($echo) {
echo apply_filters('thematic_search_form', $search_form);
} else {
return apply_filters('thematic_search_form', $search_form);
}
}
示例12: admin_filter_action
function admin_filter_action($string, $action)
{
if (strpos($string, '?') === false) {
return $string .= "?action={$action}";
} else {
return $string .= wp_specialchars("&action={$action}");
}
}
示例13: cargopress_title
function cargopress_title() {
if ( is_single() ) { single_post_title(); }
elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); }
elseif ( is_page() ) { single_post_title(''); }
elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); }
elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; }
else { bloginfo('name'); wp_title('|'); get_page_number(); }
}
示例14: admin_getpanellink
function admin_getpanellink($page, $action, $command = '')
{
$link = BLOG_BASEURL . 'admin.php?p=' . $page . '&action=' . $action;
if ($command) {
$link .= '&' . $command;
}
return wp_specialchars(apply_filter('admin_panel_link', $link, $page, $action, $command));
}
示例15: start_el
function start_el(&$output, $category, $depth, $args)
{
extract($args);
$input_id = $this->input_id . '-' . $category->term_id;
$output .= "\n" . '<li id="' . $this->li_id . '">';
$output .= '<label for="' . $input_id . '" class="selectit">';
$output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $input_id . '"' . (in_array($category->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . wp_specialchars(apply_filters('the_category', $category->name)) . '</label>';
}