Make WordPress Core


Ignore:
Timestamp:
12/21/2006 10:10:04 AM (19 years ago)
Author:
markjaquith
Message:

new function for escaping within attributes: attribute_escape()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/functions.php

    r4581 r4656  
    350350
    351351function form_option($option) {
    352     echo wp_specialchars( get_option($option), 1 );
     352    echo attribute_escape( get_option($option));
    353353}
    354354
     
    23632363
    23642364function wp_referer_field() {
    2365     $ref = wp_specialchars($_SERVER['REQUEST_URI']);
     2365    $ref = attribute_escape(stripslashes($_SERVER['REQUEST_URI']));
    23662366    echo '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
    23672367    if ( wp_get_original_referer() ) {
    2368         $original_ref = wp_specialchars(stripslashes(wp_get_original_referer()));
     2368        $original_ref = attribute_escape(stripslashes(wp_get_original_referer()));
    23692369        echo '<input type="hidden" name="_wp_original_http_referer" value="'. $original_ref . '" />';
    23702370    }
     
    23722372
    23732373function wp_original_referer_field() {
    2374     echo '<input type="hidden" name="_wp_original_http_referer" value="' . wp_specialchars(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
     2374    echo '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
    23752375}
    23762376
     
    24572457    $adminurl = get_settings('siteurl') . '/wp-admin';
    24582458    if ( wp_get_referer() )
    2459         $adminurl = wp_get_referer();
     2459        $adminurl = attribute_escape(stripslashes(wp_get_referer()));
    24602460
    24612461    $title = __('WordPress Confirmation');
     
    24692469            $v = substr(strstr($a, '='), 1);
    24702470            $k = substr($a, 0, -(strlen($v)+1));
    2471             $html .= "\t\t<input type='hidden' name='" . wp_specialchars( urldecode($k), 1 ) . "' value='" . wp_specialchars( urldecode($v), 1 ) . "' />\n";
     2471            $html .= "\t\t<input type='hidden' name='" . attribute_escape( urldecode($k)) . "' value='" . attribute_escape( urldecode($v)) . "' />\n";
    24722472        }
    24732473        $html .= "\t\t<input type='hidden' name='_wpnonce' value='" . wp_create_nonce($action) . "' />\n";
    24742474        $html .= "\t\t<div id='message' class='confirm fade'>\n\t\t<p>" . wp_explain_nonce($action) . "</p>\n\t\t<p><a href='$adminurl'>" . __('No') . "</a> <input type='submit' value='" . __('Yes') . "' /></p>\n\t\t</div>\n\t</form>\n";
    24752475    } else {
    2476         $html .= "\t<div id='message' class='confirm fade'>\n\t<p>" . wp_explain_nonce($action) . "</p>\n\t<p><a href='$adminurl'>" . __('No') . "</a> <a href='" . add_query_arg( '_wpnonce', wp_create_nonce($action), $_SERVER['REQUEST_URI'] ) . "'>" . __('Yes') . "</a></p>\n\t</div>\n";
     2476        $html .= "\t<div id='message' class='confirm fade'>\n\t<p>" . wp_explain_nonce($action) . "</p>\n\t<p><a href='$adminurl'>" . __('No') . "</a> <a href='" . attribute_escape(add_query_arg('_wpnonce', wp_create_nonce($action), $_SERVER['REQUEST_URI'])) . "'>" . __('Yes') . "</a></p>\n\t</div>\n";
    24772477    }
    24782478    $html .= "</body>\n</html>";
Note: See TracChangeset for help on using the changeset viewer.