Make WordPress Core

Changeset 31637


Ignore:
Timestamp:
03/06/2015 02:02:03 AM (12 years ago)
Author:
azaozz
Message:

PressThis: when server-side parsing, filter small images by the width and height attributes if set.
See #31373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r31635 r31637  
    286286
    287287                        $source_content = wp_kses(
    288                                 file_get_contents( $source_tmp_file ),
     288                                @file_get_contents( $source_tmp_file ),
    289289                                array(
    290290                                        'img' => array(
    291291                                                'src'      => array(),
     292                                                'width'    => array(),
     293                                                'height'   => array(),
    292294                                        ),
    293295                                        'iframe' => array(
     
    530532
    531533                        foreach ( $items as $value ) {
    532                                 if ( preg_match( '/src=(\'|")([^\'"]+)\\1/', $value, $new_matches ) ) {
     534                                if ( ( preg_match( '/width=(\'|")(\d+)\\1/i', $value, $new_matches ) && $new_matches[2] < 256 ) ||
     535                                        ( preg_match( '/height=(\'|")(\d+)\\1/i', $value, $new_matches ) && $new_matches[2] < 128 ) ) {
     536
     537                                        continue;
     538                                }
     539
     540                                if ( preg_match( '/src=(\'|")([^\'"]+)\\1/i', $value, $new_matches ) ) {
    533541                                        $src = $this->_limit_img( $new_matches[2] );
    534542                                        if ( ! empty( $src ) && ! in_array( $src, $data['_img'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.