s/attribute_escape/attr/. see #9650

git-svn-id: https://develop.svn.wordpress.org/trunk@11109 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-04-28 05:58:45 +00:00
parent 6c066a90d8
commit fe7c34b6fd
84 changed files with 391 additions and 391 deletions
+2 -2
View File
@@ -421,7 +421,7 @@ function the_author_posts_link($deprecated = '') {
printf(
'<a href="%1$s" title="%2$s">%3$s</a>',
get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
sprintf( __( 'Posts by %s' ), attribute_escape( get_the_author() ) ),
sprintf( __( 'Posts by %s' ), attr( get_the_author() ) ),
get_the_author()
);
}
@@ -544,7 +544,7 @@ function wp_list_authors($args = '') {
if ( ! $hide_empty )
$link = $name;
} else {
$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attr($author->display_name)) . '">' . $name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) {
$link .= ' ';
+2 -2
View File
@@ -72,8 +72,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
if ( !empty($bookmark->link_url) )
$the_link = clean_url($bookmark->link_url);
$desc = attribute_escape(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display'));
$name = attribute_escape(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display'));
$desc = attr(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display'));
$name = attr(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display'));
$title = $desc;
if ( $show_updated )
+2 -2
View File
@@ -345,7 +345,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
if ( in_array($field, $format_to_edit) ) {
$value = format_to_edit($value);
} else {
$value = attribute_escape($value);
$value = attr($value);
}
} else if ( 'db' == $context ) {
$value = apply_filters("pre_$field", $value);
@@ -355,7 +355,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
}
if ( 'attribute' == $context )
$value = attribute_escape($value);
$value = attr($value);
else if ( 'js' == $context )
$value = js_escape($value);
+1 -1
View File
@@ -661,7 +661,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
$tag_link = '#' != $tag->link ? clean_url( $tag->link ) : '#';
$tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
$tag_name = $tags[ $key ]->name;
$a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( $topic_count_text_callback( $count ) ) . "'$rel style='font-size: " .
$a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attr( $topic_count_text_callback( $count ) ) . "'$rel style='font-size: " .
( $smallest + ( ( $count - $min_count ) * $font_step ) )
. "$unit;'>$tag_name</a>";
}
+2 -2
View File
@@ -48,13 +48,13 @@ class WP_Styles extends WP_Dependencies {
}
if ( isset($this->registered[$handle]->args) )
$media = attribute_escape( $this->registered[$handle]->args );
$media = attr( $this->registered[$handle]->args );
else
$media = 'all';
$href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle );
$rel = isset($this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
$title = isset($this->registered[$handle]->extra['title']) ? "title='" . attribute_escape( $this->registered[$handle]->extra['title'] ) . "'" : '';
$title = isset($this->registered[$handle]->extra['title']) ? "title='" . attr( $this->registered[$handle]->extra['title'] ) . "'" : '';
$end_cond = $tag = '';
if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
+3 -3
View File
@@ -1187,7 +1187,7 @@ class Walker_Page extends Walker {
$css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attr(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
if ( !empty($show_date) ) {
if ( 'modified' == $show_date )
@@ -1325,13 +1325,13 @@ class Walker_Category extends Walker {
function start_el(&$output, $category, $depth, $args) {
extract($args);
$cat_name = attribute_escape( $category->name);
$cat_name = attr( $category->name);
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
$link = '<a href="' . get_category_link( $category->term_id ) . '" ';
if ( $use_desc_for_title == 0 || empty($category->description) )
$link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
else
$link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"';
$link .= 'title="' . attr( apply_filters( 'category_description', $category->description, $category )) . '"';
$link .= '>';
$link .= $cat_name . '</a>';
+1 -1
View File
@@ -945,7 +945,7 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
if ( !empty( $css_class ) ) {
echo ' class="'.$css_class.'" ';
}
$title = attribute_escape( get_the_title() );
$title = attr( get_the_title() );
echo apply_filters( 'comments_popup_link_attributes', '' );
+2 -2
View File
@@ -369,14 +369,14 @@ function sanitize_comment_cookies() {
if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
$comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
$comment_author = stripslashes($comment_author);
$comment_author = attribute_escape($comment_author);
$comment_author = attr($comment_author);
$_COOKIE['comment_author_'.COOKIEHASH] = $comment_author;
}
if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
$comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
$comment_author_email = stripslashes($comment_author_email);
$comment_author_email = attribute_escape($comment_author_email);
$comment_author_email = attr($comment_author_email);
$_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
}
+21 -21
View File
@@ -60,8 +60,8 @@ class WP_Widget_Pages extends WP_Widget {
function form( $instance ) {
//Defaults
$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
$title = attribute_escape( $instance['title'] );
$exclude = attribute_escape( $instance['exclude'] );
$title = attr( $instance['title'] );
$exclude = attr( $instance['exclude'] );
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<p>
@@ -210,7 +210,7 @@ class WP_Widget_Archives extends WP_Widget {
if ( $d ) {
?>
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c"); ?> </select>
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attr(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c"); ?> </select>
<?php
} else {
?>
@@ -239,7 +239,7 @@ class WP_Widget_Archives extends WP_Widget {
$count = $instance['count'] ? 'checked="checked"' : '';
$dropdown = $instance['dropdown'] ? 'checked="checked"' : '';
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attr($title); ?>" /></label></p>
<p>
<label for="<?php echo $this->get_field_id('count'); ?>"><input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <?php _e('Show post counts'); ?></label>
<br />
@@ -273,9 +273,9 @@ class WP_Widget_Meta extends WP_Widget {
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo attribute_escape(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo attribute_escape(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
<li><a href="http://wordpress.org/" title="<?php echo attribute_escape(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
<li><a href="http://wordpress.org/" title="<?php echo attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
<?php wp_meta(); ?>
</ul>
<?php
@@ -293,7 +293,7 @@ class WP_Widget_Meta extends WP_Widget {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attr($title); ?>" /></label></p>
<?php
}
}
@@ -333,7 +333,7 @@ class WP_Widget_Calendar extends WP_Widget {
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">
<?php _e('Title:'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attr($title); ?>" />
</label></p>
<?php
}
@@ -381,7 +381,7 @@ class WP_Widget_Text extends WP_Widget {
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">
<?php _e('Title:'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attr($title); ?>" />
</label></p>
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
@@ -463,7 +463,7 @@ class WP_Widget_Categories extends WP_Widget {
function form( $instance ) {
//Defaults
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
$title = attribute_escape( $instance['title'] );
$title = attr( $instance['title'] );
$count = (bool) $instance['count'];
$hierarchical = (bool) $instance['hierarchical'];
$dropdown = (bool) $instance['dropdown'];
@@ -566,7 +566,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
}
function form( $instance ) {
$title = attribute_escape($instance['title']);
$title = attr($instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 5;
?>
@@ -653,7 +653,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
}
function form( $instance ) {
$title = attribute_escape($instance['title']);
$title = attr($instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 5;
?>
@@ -702,7 +702,7 @@ class WP_Widget_RSS extends WP_Widget {
$link = '';
if ( ! is_wp_error($rss) ) {
$desc = attribute_escape(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
$desc = attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
if ( empty($title) )
$title = htmlentities(strip_tags($rss->get_title()));
$link = clean_url(strip_tags($rss->get_permalink()));
@@ -716,7 +716,7 @@ class WP_Widget_RSS extends WP_Widget {
$title = apply_filters('widget_title', $title );
$url = clean_url(strip_tags($url));
$icon = includes_url('images/rss.png');
$title = "<a class='rsswidget' href='$url' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
$title = "<a class='rsswidget' href='$url' title='" . attr(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
echo $before_widget;
echo $before_title . $title . $after_title;
@@ -787,11 +787,11 @@ function wp_widget_rss_output( $rss, $args = array() ) {
while ( stristr($link, 'http') != $link )
$link = substr($link, 1);
$link = clean_url(strip_tags($link));
$title = attribute_escape(strip_tags($item->get_title()));
$title = attr(strip_tags($item->get_title()));
if ( empty($title) )
$title = __('Untitled');
$desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
$desc = str_replace(array("\n", "\r"), ' ', attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
$desc = wp_html_excerpt( $desc, 360 ) . ' [&hellip;]';
$desc = wp_specialchars( $desc );
@@ -850,9 +850,9 @@ function wp_widget_rss_form( $args, $inputs = null ) {
extract( $args );
extract( $inputs, EXTR_SKIP);
$number = attribute_escape( $number );
$title = attribute_escape( $title );
$url = attribute_escape( $url );
$number = attr( $number );
$title = attr( $title );
$url = attr( $url );
$items = (int) $items;
if ( $items < 1 || 20 < $items )
$items = 10;
@@ -984,7 +984,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">
<?php _e('Title:') ?>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo attribute_escape( $instance['title'] ); ?>" />
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo attr( $instance['title'] ); ?>" />
</label></p>
<?php
}
+2 -2
View File
@@ -1006,8 +1006,8 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
if ( '' != $rel )
$rel = ' rel="' . $rel . '"';
$desc = attribute_escape(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
$name = attribute_escape(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
$desc = attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
$name = attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
$title = $desc;
if ( $show_updated )
+2 -2
View File
@@ -18,7 +18,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
if ( is_singular() )
printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
elseif ( is_search() )
printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), attribute_escape(get_search_query()));
printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), attr(get_search_query()));
else
printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
?></title>
@@ -32,7 +32,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
<?php } elseif(is_search()) { ?>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . attribute_escape(get_search_query()); ?>" />
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . attr(get_search_query()); ?>" />
<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
<?php } else { ?>
+1 -1
View File
@@ -20,7 +20,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
if ( is_singular() )
printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
elseif ( is_search() )
printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s']));
printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), attr($wp_query->query_vars['s']));
else
printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
?></title>
+1 -1
View File
@@ -338,7 +338,7 @@ function get_the_category_rss($type = 'rss') {
if ( 'rdf' == $type )
$the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
elseif ( 'atom' == $type )
$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) );
$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attr( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attr( $cat_name ) );
else
$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
}
+1 -1
View File
@@ -1270,7 +1270,7 @@ function translate_smiley($smiley) {
$smiley = trim(reset($smiley));
$img = $wpsmiliestrans[$smiley];
$smiley_masked = attribute_escape($smiley);
$smiley_masked = attr($smiley);
return " <img src='$siteurl/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}
+5 -5
View File
@@ -385,7 +385,7 @@ function wp_protect_special_option( $option ) {
/**
* Print option value after sanitizing for forms.
*
* @uses attribute_escape Sanitizes value.
* @uses attr Sanitizes value.
* @since 1.5.0
* @package WordPress
* @subpackage Option
@@ -393,7 +393,7 @@ function wp_protect_special_option( $option ) {
* @param string $option Option name.
*/
function form_option( $option ) {
echo attribute_escape (get_option( $option ) );
echo attr (get_option( $option ) );
}
/**
@@ -1741,7 +1741,7 @@ function wp_nonce_url( $actionurl, $action = -1 ) {
* @return string Nonce field.
*/
function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
$name = attribute_escape( $name );
$name = attr( $name );
$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
if ( $echo )
echo $nonce_field;
@@ -1766,7 +1766,7 @@ function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $ec
* @return string Referer field.
*/
function wp_referer_field( $echo = true) {
$ref = attribute_escape( $_SERVER['REQUEST_URI'] );
$ref = attr( $_SERVER['REQUEST_URI'] );
$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
if ( $echo )
@@ -1792,7 +1792,7 @@ function wp_referer_field( $echo = true) {
function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
$jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];
$ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to;
$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape( stripslashes( $ref ) ) . '" />';
$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . attr( stripslashes( $ref ) ) . '" />';
if ( $echo )
echo $orig_referer_field;
return $orig_referer_field;
+13 -13
View File
@@ -120,8 +120,8 @@ function get_search_form() {
$form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
<div><label class="hidden" for="s">' . __('Search for:') . '</label>
<input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'.attribute_escape(__('Search')).'" />
<input type="text" value="' . attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'.attr(__('Search')).'" />
</div>
</form>';
@@ -688,7 +688,7 @@ function single_month_title($prefix = '', $display = true ) {
*/
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
$text = wptexturize($text);
$title_text = attribute_escape($text);
$title_text = attr($text);
$url = clean_url($url);
if ('link' == $format)
@@ -1434,8 +1434,8 @@ function feed_links( $args ) {
$args = wp_parse_args( $args, $defaults );
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['feedtitle'], get_bloginfo('name') )) . '" href="' . get_feed_link() . "\" />\n";
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attribute_escape(sprintf( $args['comstitle'], get_bloginfo('name') )) . '" href="' . get_feed_link( 'comments_' . get_default_feed() ) . "\" />\n";
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attr(sprintf( $args['feedtitle'], get_bloginfo('name') )) . '" href="' . get_feed_link() . "\" />\n";
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . attr(sprintf( $args['comstitle'], get_bloginfo('name') )) . '" href="' . get_feed_link( 'comments_' . get_default_feed() ) . "\" />\n";
}
/**
@@ -1467,27 +1467,27 @@ function feed_links_extra( $args ) {
$post = &get_post( $id = 0 );
if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
$title = attribute_escape(sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], wp_specialchars( get_the_title() ) ));
$title = attr(sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], wp_specialchars( get_the_title() ) ));
$href = get_post_comments_feed_link( $post->ID );
}
} elseif ( is_category() ) {
$cat_id = intval( get_query_var('cat') );
$title = attribute_escape(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name( $cat_id ) ));
$title = attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name( $cat_id ) ));
$href = get_category_feed_link( $cat_id );
} elseif ( is_tag() ) {
$tag_id = intval( get_query_var('tag_id') );
$tag = get_tag( $tag_id );
$title = attribute_escape(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name ));
$title = attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name ));
$href = get_tag_feed_link( $tag_id );
} elseif ( is_author() ) {
$author_id = intval( get_query_var('author') );
$title = attribute_escape(sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_author_name( $author_id ) ));
$title = attr(sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_author_name( $author_id ) ));
$href = get_author_feed_link( $author_id );
} elseif ( is_search() ) {
$title = attribute_escape(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query() ));
$title = attr(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query() ));
$href = get_search_feed_link();
}
@@ -1678,14 +1678,14 @@ function get_search_query() {
/**
* Display the contents of the search query variable.
*
* The search query string is passed through {@link attribute_escape()}
* The search query string is passed through {@link attr()}
* to ensure that it is safe for placing in an html attribute.
*
* @uses attribute_escape
* @uses attr
* @since 2.1.0
*/
function the_search_query() {
echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
echo attr( apply_filters( 'the_search_query', get_search_query() ) );
}
/**
+9 -9
View File
@@ -619,9 +619,9 @@ function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
*/
function get_search_feed_link($search_query = '', $feed = '') {
if ( empty($search_query) )
$search = attribute_escape(get_search_query());
$search = attr(get_search_query());
else
$search = attribute_escape(stripslashes($search_query));
$search = attr(stripslashes($search_query));
if ( empty($feed) )
$feed = get_default_feed();
@@ -644,9 +644,9 @@ function get_search_feed_link($search_query = '', $feed = '') {
*/
function get_search_comments_feed_link($search_query = '', $feed = '') {
if ( empty($search_query) )
$search = attribute_escape(get_search_query());
$search = attr(get_search_query());
else
$search = attribute_escape(stripslashes($search_query));
$search = attr(stripslashes($search_query));
if ( empty($feed) )
$feed = get_default_feed();
@@ -730,7 +730,7 @@ function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
return;
}
$link = '<a class="post-edit-link" href="' . get_edit_post_link( $post->ID ) . '" title="' . attribute_escape( __( 'Edit post' ) ) . '">' . $link . '</a>';
$link = '<a class="post-edit-link" href="' . get_edit_post_link( $post->ID ) . '" title="' . attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
}
@@ -940,7 +940,7 @@ function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $ex
$title = apply_filters('the_title', $title, $post);
$link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
$link .= attribute_escape( $title );
$link .= attr( $title );
$link .= "' href='" . get_permalink($post) . "' />\n";
$adjacent = $previous ? 'previous' : 'next';
@@ -1064,7 +1064,7 @@ function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $ex
$title = apply_filters('the_title', $title, $post);
$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
$link .= attribute_escape($title);
$link .= attr($title);
$link .= "' href='" . get_permalink($post) . "' />\n";
$boundary = $start ? 'start' : 'end';
@@ -1092,7 +1092,7 @@ function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_
* @return string
*/
function get_index_rel_link() {
$link = "<link rel='index' title='" . attribute_escape(get_bloginfo('name')) . "' href='" . get_bloginfo('siteurl') . "' />\n";
$link = "<link rel='index' title='" . attr(get_bloginfo('name')) . "' href='" . get_bloginfo('siteurl') . "' />\n";
return apply_filters( "index_rel_link", $link );
}
@@ -1127,7 +1127,7 @@ function get_parent_post_rel_link($title = '%title') {
$title = apply_filters('the_title', $title, $post);
$link = "<link rel='up' title='";
$link .= attribute_escape( $title );
$link .= attr( $title );
$link .= "' href='" . get_permalink($post) . "' />\n";
return apply_filters( "parent_post_rel_link", $link );
+3 -3
View File
@@ -200,10 +200,10 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') {
list( $img_src, $width, $height ) = image_downsize($id, $size);
$hwstring = image_hwstring($width, $height);
$class = 'align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id;
$class = 'align'.attr($align).' size-'.attr($size).' wp-image-'.$id;
$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
$html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="'.$class.'" />';
$html = '<img src="'.attr($img_src).'" alt="'.attr($alt).'" title="'.attr($title).'" '.$hwstring.'class="'.$class.'" />';
$html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
@@ -542,7 +542,7 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa
'title' => trim(strip_tags( $attachment->post_title )),
);
$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
$attr = array_map( 'attribute_escape', $attr );
$attr = array_map( 'attr', $attr );
$html = rtrim("<img $hwstring");
foreach ( $attr as $name => $value ) {
$html .= " $name=" . '"' . $value . '"';
+1 -1
View File
@@ -1499,7 +1499,7 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
if ( false === $alt)
$safe_alt = '';
else
$safe_alt = attribute_escape( $alt );
$safe_alt = attr( $alt );
if ( !is_numeric($size) )
$size = '96';
+7 -7
View File
@@ -63,7 +63,7 @@ function the_title($before = '', $after = '', $echo = true) {
* an array. See the function for what can be override in the $args parameter.
*
* The title before it is displayed will have the tags stripped and {@link
* attribute_escape()} before it is passed to the user or displayed. The default
* attr()} before it is passed to the user or displayed. The default
* as with {@link the_title()}, is to display the title.
*
* @since 2.3.0
@@ -83,7 +83,7 @@ function the_title_attribute( $args = '' ) {
$title = $before . $title . $after;
$title = attribute_escape(strip_tags($title));
$title = attr(strip_tags($title));
if ( $echo )
echo $title;
@@ -924,10 +924,10 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
if ( $permalink )
$url = get_attachment_link($_post->ID);
$post_title = attribute_escape($_post->post_title);
$post_title = attr($_post->post_title);
if ( $text ) {
$link_text = attribute_escape($text);
$link_text = attr($text);
} elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
$link_text = wp_get_attachment_image($id, $size, $icon);
}
@@ -961,7 +961,7 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false,
if ( $permalink )
$url = get_attachment_link($_post->ID);
$post_title = attribute_escape($_post->post_title);
$post_title = attr($_post->post_title);
$innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
return "<a href='$url' title='$post_title'>$innerHTML</a>";
@@ -1057,7 +1057,7 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
$constraint = '';
}
$post_title = attribute_escape($post->post_title);
$post_title = attr($post->post_title);
$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
@@ -1085,7 +1085,7 @@ function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false)
return $innerHTML;
$innerHTML = attribute_escape($post->post_title);
$innerHTML = attr($post->post_title);
return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
}
+2 -2
View File
@@ -869,7 +869,7 @@ function sanitize_post_field($field, $value, $post_id, $context) {
else
$value = format_to_edit($value);
} else {
$value = attribute_escape($value);
$value = attr($value);
}
} else if ( 'db' == $context ) {
if ( $prefixed ) {
@@ -888,7 +888,7 @@ function sanitize_post_field($field, $value, $post_id, $context) {
}
if ( 'attribute' == $context )
$value = attribute_escape($value);
$value = attr($value);
else if ( 'js' == $context )
$value = js_escape($value);
+1 -1
View File
@@ -873,7 +873,7 @@ function wp_rss( $url, $num_items = -1 ) {
printf(
'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
clean_url( $item['link'] ),
attribute_escape( strip_tags( $item['description'] ) ),
attr( strip_tags( $item['description'] ) ),
htmlentities( $item['title'] )
);
}
+9 -9
View File
@@ -74,10 +74,10 @@ function wp_default_scripts( &$scripts ) {
$scripts->localize( 'quicktags', 'quicktagsL10n', array(
'quickLinks' => __('(Quick Links)'),
'wordLookup' => __('Enter a word to look up:'),
'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),
'lookup' => attribute_escape(__('lookup')),
'closeAllOpenTags' => attribute_escape(__('Close all open tags')),
'closeTags' => attribute_escape(__('close tags')),
'dictionaryLookup' => attr(__('Dictionary lookup')),
'lookup' => attr(__('lookup')),
'closeAllOpenTags' => attr(__('Close all open tags')),
'closeTags' => attr(__('close tags')),
'enterURL' => __('Enter the URL'),
'enterImageURL' => __('Enter the URL of the image'),
'enterImageDescription' => __('Enter a description of the image'),
@@ -212,7 +212,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
$scripts->add_data( 'ajaxcat', 'group', 1 );
$scripts->localize( 'ajaxcat', 'catL10n', array(
'add' => attribute_escape(__('Add')),
'add' => attr(__('Add')),
'how' => __('Separate multiple categories with commas.'),
'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
) );
@@ -266,8 +266,8 @@ function wp_default_scripts( &$scripts ) {
$scripts->add_data( 'post', 'group', 1 );
$scripts->localize( 'post', 'postL10n', array(
'tagsUsed' => __('Tags used on this post:'),
'add' => attribute_escape(__('Add')),
'addTag' => attribute_escape(__('Add new tag')),
'add' => attr(__('Add')),
'addTag' => attr(__('Add new tag')),
'separate' => __('Separate tags with commas'),
'cancel' => __('Cancel'),
'edit' => __('Edit'),
@@ -604,7 +604,7 @@ function _print_scripts() {
$ver = md5("$wp_scripts->concat_version");
$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . trim($wp_scripts->concat, ', ') . "&ver=$ver";
echo "<script type='text/javascript' src='" . attribute_escape($src) . "'></script>\n";
echo "<script type='text/javascript' src='" . attr($src) . "'></script>\n";
}
if ( !empty($wp_scripts->print_html) )
@@ -671,7 +671,7 @@ function print_admin_styles() {
$dir = $wp_styles->text_direction;
$ver = md5("$wp_styles->concat_version{$dir}");
$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver";
echo "<link rel='stylesheet' href='" . attribute_escape($href) . "' type='text/css' media='all' />\n";
echo "<link rel='stylesheet' href='" . attr($href) . "' type='text/css' media='all' />\n";
}
if ( !empty($wp_styles->print_html) )
+3 -3
View File
@@ -991,7 +991,7 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
if ( 'description' == $field )
$value = format_to_edit($value);
else
$value = attribute_escape($value);
$value = attr($value);
} else if ( 'db' == $context ) {
$value = apply_filters("pre_term_$field", $value, $taxonomy);
$value = apply_filters("pre_${taxonomy}_$field", $value);
@@ -1009,7 +1009,7 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
}
if ( 'attribute' == $context )
$value = attribute_escape($value);
$value = attr($value);
else if ( 'js' == $context )
$value = js_escape($value);
@@ -2260,7 +2260,7 @@ function get_the_taxonomies($post = 0) {
$links = array();
foreach ( $terms as $term )
$links[] = "<a href='" . attribute_escape(get_term_link($term, $taxonomy)) . "'>$term->name</a>";
$links[] = "<a href='" . attr(get_term_link($term, $taxonomy)) . "'>$term->name</a>";
if ( $links )
$taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
+1 -1
View File
@@ -932,7 +932,7 @@ function preview_theme_ob_filter_callback( $matches ) {
$link = add_query_arg( array('preview' => 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] );
if ( 0 === strpos($link, 'preview=1') )
$link = "?$link";
return $matches[1] . attribute_escape( $link ) . $matches[4];
return $matches[1] . attr( $link ) . $matches[4];
}
/**
+3 -3
View File
@@ -62,15 +62,15 @@ function wp_version_check() {
foreach( explode( "\n\n", $body ) as $entry) {
$returns = explode("\n", $entry);
$new_option = new stdClass();
$new_option->response = attribute_escape( $returns[0] );
$new_option->response = attr( $returns[0] );
if ( isset( $returns[1] ) )
$new_option->url = clean_url( $returns[1] );
if ( isset( $returns[2] ) )
$new_option->package = clean_url( $returns[2] );
if ( isset( $returns[3] ) )
$new_option->current = attribute_escape( $returns[3] );
$new_option->current = attr( $returns[3] );
if ( isset( $returns[4] ) )
$new_option->locale = attribute_escape( $returns[4] );
$new_option->locale = attr( $returns[4] );
$new_options[] = $new_option;
}