Ticket #3986: clean_url-admin_a-l.diff

File clean_url-admin_a-l.diff, 7.7 kB (added by ryan, 2 years ago)

Use clean_url where approproate. Admin files A - L.

  • wp-admin/edit-comments.php

    old new  
    101101$r = ''; 
    102102if ( 1 < $page ) { 
    103103        $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; 
    104         $r .=  '<a class="prev" href="' . attribute_escape(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n"; 
     104        $r .=  '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n"; 
    105105} 
    106106if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { 
    107107        for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : 
     
    111111                        $p = false; 
    112112                        if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : 
    113113                                $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; 
    114                                 $r .= '<a class="page-numbers" href="' . attribute_escape(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; 
     114                                $r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; 
    115115                                $in = true; 
    116116                        elseif ( $in == true ) : 
    117117                                $r .= "...\n"; 
     
    122122} 
    123123if ( ( $page ) * 20 < $total || -1 == $total ) { 
    124124        $args['apage'] = $page + 1; 
    125         $r .=  '<a class="next" href="' . attribute_escape(add_query_arg($args)) . '">'. __('Next Page') .' &raquo;</a>' . "\n"; 
     125        $r .=  '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page') .' &raquo;</a>' . "\n"; 
    126126} 
    127127echo "<p class='pagenav'>$r</p>"; 
    128128?> 
     
    248248$r = ''; 
    249249if ( 1 < $page ) { 
    250250        $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; 
    251         $r .=  '<a class="prev" href="' . attribute_escape(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n"; 
     251        $r .=  '<a class="prev" href="' . clean_url(add_query_arg( $args )) . '">&laquo; '. __('Previous Page') .'</a>' . "\n"; 
    252252} 
    253253if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { 
    254254        for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : 
     
    258258                        $p = false; 
    259259                        if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : 
    260260                                $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; 
    261                                 $r .= '<a class="page-numbers" href="' . attribute_escape(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; 
     261                                $r .= '<a class="page-numbers" href="' . clean_url(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; 
    262262                                $in = true; 
    263263                        elseif ( $in == true ) : 
    264264                                $r .= "...\n"; 
     
    269269} 
    270270if ( ( $page ) * 20 < $total || -1 == $total ) { 
    271271        $args['apage'] = $page + 1; 
    272         $r .=  '<a class="next" href="' . attribute_escape(add_query_arg($args)) . '">'. __('Next Page') .' &raquo;</a>' . "\n"; 
     272        $r .=  '<a class="next" href="' . clean_url(add_query_arg($args)) . '">'. __('Next Page') .' &raquo;</a>' . "\n"; 
    273273} 
    274274echo "<p class='pagenav'>$r</p>"; 
    275275?> 
  • wp-admin/admin-functions.php

    old new  
    370370        else if ( !empty( $post_title ) ) { 
    371371                $text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) ); 
    372372                $text       = funky_javascript_fix( $text); 
    373                 $popupurl   = attribute_escape($_REQUEST['popupurl']); 
     373                $popupurl   = clean_url($_REQUEST['popupurl']); 
    374374        $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text"; 
    375375    } 
    376376 
     
    429429        $user = new WP_User( $user_id ); 
    430430        $user->user_login   = attribute_escape($user->user_login); 
    431431        $user->user_email   = attribute_escape($user->user_email); 
    432         $user->user_url     = attribute_escape($user->user_url); 
     432        $user->user_url     = clean_url($user->user_url); 
    433433        $user->first_name   = attribute_escape($user->first_name); 
    434434        $user->last_name    = attribute_escape($user->last_name); 
    435435        $user->display_name = attribute_escape($user->display_name); 
     
    574574function get_link_to_edit( $link_id ) { 
    575575        $link = get_link( $link_id ); 
    576576 
    577         $link->link_url         = attribute_escape($link->link_url); 
     577        $link->link_url         = clean_url($link->link_url); 
    578578        $link->link_name        = attribute_escape($link->link_name); 
    579579        $link->link_image       = attribute_escape($link->link_image); 
    580580        $link->link_description = attribute_escape($link->link_description); 
    581         $link->link_rss         = attribute_escape($link->link_rss); 
     581        $link->link_rss         = clean_url($link->link_rss); 
    582582        $link->link_rel         = attribute_escape($link->link_rel); 
    583583        $link->link_notes       =  wp_specialchars($link->link_notes); 
    584584        $link->post_category    = $link->link_category; 
     
    588588 
    589589function get_default_link_to_edit() { 
    590590        if ( isset( $_GET['linkurl'] ) ) 
    591                 $link->link_url = attribute_escape( $_GET['linkurl']); 
     591                $link->link_url = clean_url( $_GET['linkurl']); 
    592592        else 
    593593                $link->link_url = ''; 
    594594 
     
    879879        } 
    880880        $r .= "</td>\n\t\t<td>"; 
    881881        if ( current_user_can( 'edit_user', $user_object->ID ) ) { 
    882                 $edit_link = attribute_escape( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" )); 
     882                $edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" )); 
    883883                $r .= "<a href='$edit_link' class='edit'>".__( 'Edit' )."</a>"; 
    884884        } 
    885885        $r .= "</td>\n\t</tr>"; 
  • wp-admin/edit-page-form.php

    old new  
    1313        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; 
    1414} 
    1515 
    16 $sendto = attribute_escape(stripslashes(wp_get_referer())); 
     16$sendto = clean_url(stripslashes(wp_get_referer())); 
    1717 
    1818if ( 0 != $post_ID && $sendto == get_permalink($post_ID) ) 
    1919        $sendto = 'redo'; 
  • wp-admin/edit-form-advanced.php

    old new  
    168168?> 
    169169<input name="referredby" type="hidden" id="referredby" value="<?php  
    170170if ( !empty($_REQUEST['popupurl']) ) 
    171         echo attribute_escape(stripslashes($_REQUEST['popupurl'])); 
     171        echo clean_url(stripslashes($_REQUEST['popupurl'])); 
    172172else if ( url_to_postid(wp_get_referer()) == $post_ID ) 
    173173        echo 'redo'; 
    174174else 
    175         echo attribute_escape(stripslashes(wp_get_referer())); 
     175        echo clean_url(stripslashes(wp_get_referer())); 
    176176?>" /></p> 
    177177 
    178178<?php do_action('edit_form_advanced'); ?> 
  • wp-admin/link-manager.php

    old new  
    133133        foreach ($links as $link) { 
    134134                $link->link_name = attribute_escape(apply_filters('link_title', $link->link_name)); 
    135135                $link->link_description = wp_specialchars(apply_filters('link_description', $link->link_description)); 
    136                 $link->link_url = attribute_escape($link->link_url); 
     136                $link->link_url = clean_url($link->link_url); 
    137137                $link->link_category = wp_get_link_cats($link->link_id); 
    138138                $short_url = str_replace('http://', '', $link->link_url); 
    139139                $short_url = str_replace('www.', '', $short_url); 
  • wp-admin/bookmarklet.php

    old new  
    3737 
    3838 
    3939$content  = wp_specialchars($_REQUEST['content']); 
    40 $popupurl = attribute_escape($_REQUEST['popupurl']); 
     40$popupurl = clean_url($_REQUEST['popupurl']); 
    4141if ( !empty($content) ) { 
    4242        $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) ); 
    4343} else {