Make WordPress Core

Ticket #31645: 31645.4.patch

File 31645.4.patch, 1019 bytes (added by azaozz, 10 years ago)
  • src/wp-admin/includes/class-wp-press-this.php

     
    564564                                        $url = $this->_limit_url( $matches_url[1] );
    565565
    566566                                        if ( ! empty( $url ) && empty( $data['_links'][ $rel ] ) ) {
     567                                                if ( $rel === 'canonical' && ! preg_match( '%^(?:https?:)?//%i', $url ) ) {
     568                                                        continue;
     569                                                }
     570
    567571                                                $data['_links'][ $rel ] = $url;
    568572                                        }
    569573                                }
     
    664668                                                        }
    665669                                                } else {
    666670                                                        if ( in_array( $key, array( 'canonical', 'shortlink', 'icon' ), true ) ) {
    667                                                                 $data[ $type ][ $key ] = $this->_limit_url( wp_unslash( $value ) );
     671                                                                $url = $this->_limit_url( wp_unslash( $value ) );
     672
     673                                                                if ( $key === 'canonical' && ! preg_match( '%^(?:https?:)?//%i', $url ) ) {
     674                                                                        continue;
     675                                                                }
     676
     677                                                                $data[ $type ][ $key ] = $url;
    668678                                                        }
    669679                                                }
    670680                                        }