Make WordPress Core


Ignore:
Timestamp:
03/01/2013 05:00:25 PM (14 years ago)
Author:
ryan
Message:

Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().

see #21767

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r23554 r23563  
    469469                if ( isset($attachment['image_alt']) ) {
    470470                        $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
    471                         if ( $image_alt != stripslashes($attachment['image_alt']) ) {
    472                                 $image_alt = wp_strip_all_tags( stripslashes($attachment['image_alt']), true );
     471                        if ( $image_alt != wp_unslash($attachment['image_alt']) ) {
     472                                $image_alt = wp_strip_all_tags( wp_unslash($attachment['image_alt']), true );
    473473                                // update_meta expects slashed
    474474                                update_post_meta( $attachment_id, '_wp_attachment_image_alt', addslashes($image_alt) );
    … …  
    502502
    503503        if ( isset($send_id) ) {
    504                 $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
     504                $attachment = wp_unslash( $_POST['attachments'][$send_id] );
    505505
    506506                $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
    … …  
    547547
    548548                if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
    549                         $title = esc_html( stripslashes( $_POST['title'] ) );
     549                        $title = esc_html( wp_unslash( $_POST['title'] ) );
    550550                        if ( empty( $title ) )
    551551                                $title = esc_html( basename( $src ) );
    … …  
    562562                } else {
    563563                        $align = '';
    564                         $alt = esc_attr( stripslashes( $_POST['alt'] ) );
     564                        $alt = esc_attr( wp_unslash( $_POST['alt'] ) );
    565565                        if ( isset($_POST['align']) ) {
    566                                 $align = esc_attr( stripslashes( $_POST['align'] ) );
     566                                $align = esc_attr( wp_unslash( $_POST['align'] ) );
    567567                                $class = " class='align$align'";
    568568                        }
Note: See TracChangeset for help on using the changeset viewer.