Make WordPress Core

Changeset 31635


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

PressThis:

  • Fix error when checking for empty array keys.
  • Add better DailyMotion embed support.

Props stephdau, see #31373.

File:
1 edited

Legend:

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

    r31609 r31635  
    335335
    336336                if ( is_numeric( $value ) || is_bool( $value ) ) {
    337                         $return = (string) $value;
     337                        $return = $value;
    338338                } else if ( is_string( $value ) ) {
    339339                        if ( mb_strlen( $value ) > 5000 ) {
    … …  
    354354                        return '';
    355355                }
    356                
     356
    357357                $url = $this->_limit_string( $url );
    358358
    … …  
    420420                } else if ( preg_match( '/\/\/vine\.co\/v\/([^\/]+)\/embed/', $src, $src_matches ) ) {
    421421                        $src = 'https://vine.co/v/' . $src_matches[1];
     422                } else if ( preg_match( '/\/\/(www\.)?dailymotion\.com\/embed\/video\/([^\/\?]+)([\/\?]{1}.+)?/', $src, $src_matches ) ) {
     423                        $src = 'https://www.dailymotion.com/video/' . $src_matches[2];
    422424                } else if ( ! preg_match( '/\/\/(m\.|www\.)?youtube\.com\/watch\?/', $src )
    423425                            && ! preg_match( '/\/youtu\.be\/.+$/', $src )
    … …  
    471473                        }
    472474                }
    473                
     475
    474476                return $data;
    475477        }
    … …  
    638640
    639641                                        foreach ( $items as $key => $value ) {
    640                                                 $key = $this->_limit_string( wp_unslash( $key ) );
    641 
    642                                                 // Sanity check. $key is usually things like 'title', 'description', 'keywords', etc.
    643                                                 if ( empty( $key ) || strlen( $key ) > 100 ) {
    644                                                         continue;
     642                                                if ( ! is_numeric( $key ) ) {
     643                                                        $key = $this->_limit_string( wp_unslash( $key ) );
     644
     645                                                        // Sanity check. $key is usually things like 'title', 'description', 'keywords', etc.
     646                                                        if ( empty( $key ) || strlen( $key ) > 100 ) {
     647                                                                continue;
     648                                                        }
    645649                                                }
    646650
Note: See TracChangeset for help on using the changeset viewer.