Make WordPress Core

Changes from tags/4.6 at r38270 to tags/4.6.1 at r38560


Ignore:
Location:
tags/4.6.1
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • tags/4.6.1/Gruntfile.js

    r38270 r38560  
    515515                src: SOURCE_DIR + 'wp-admin/js/bookmarklet.js',
    516516                dest: SOURCE_DIR + 'wp-admin/js/bookmarklet.min.js'
    517             }
    518         },
     517            },
     518            masonry: {
     519                options: {
     520                    // Preserve comments that start with a bang.
     521                    preserveComments: /^!/
     522                },
     523                src: SOURCE_DIR + 'wp-includes/js/jquery/jquery.masonry.js',
     524                dest: SOURCE_DIR + 'wp-includes/js/jquery/jquery.masonry.min.js'
     525            }
     526        },
     527
    519528        concat: {
    520529            tinymce: {
     
    677686        'jshint:corejs',
    678687        'uglify:bookmarklet',
     688        'uglify:masonry',
    679689        'qunit:compiled'
    680690    ] );
  • tags/4.6.1/package.json

    r38270 r38560  
    11{
    22  "name": "WordPress",
    3   "version": "4.6.0",
     3  "version": "4.6.1",
    44  "description": "WordPress is web software you can use to create a beautiful website or blog.",
    55  "repository": {
  • tags/4.6.1/src/readme.html

    r38270 r38560  
    1010<h1 id="logo">
    1111    <a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
    12     <br /> Version 4.6
     12    <br /> Version 4.6.1
    1313</h1>
    1414<p style="text-align: center">Semantic Personal Publishing Platform</p>
  • tags/4.6.1/src/wp-admin/about.php

    r38270 r38560  
    5858            <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
    5959        </h2>
     60
     61        <div class="changelog point-releases">
     62            <h3><?php _e( 'Maintenance and Security Release' ); ?></h3>
     63            <p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
     64                '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 15 ), '4.6.1', number_format_i18n( 15 ) ); ?>
     65                <?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.6.1' ); ?>
     66            </p>
     67        </div>
    6068
    6169        <div class="headline-feature feature-video">
  • tags/4.6.1/src/wp-admin/includes/class-file-upload-upgrader.php

    r38270 r38560  
    101101                wp_die( $uploads['error'] );
    102102
    103             $this->filename = $_GET[$urlholder];
     103            $this->filename = sanitize_file_name( $_GET[ $urlholder ] );
    104104            $this->package = $uploads['basedir'] . '/' . $this->filename;
     105
     106            if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) {
     107                wp_die( __( 'Please select a file' ) );
     108            }
    105109        }
    106110    }
  • tags/4.6.1/src/wp-admin/includes/class-language-pack-upgrader.php

    r38270 r38560  
    283283        // Re-add upgrade hooks.
    284284        add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
    285         add_action( 'upgrader_process_complete', 'wp_version_check' );
    286         add_action( 'upgrader_process_complete', 'wp_update_plugins' );
    287         add_action( 'upgrader_process_complete', 'wp_update_themes' );
     285        add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
     286        add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
     287        add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
    288288
    289289        $this->skin->bulk_footer();
  • tags/4.6.1/src/wp-admin/includes/media.php

    r38270 r38560  
    291291    $type = $file['type'];
    292292    $file = $file['file'];
    293     $title = $name;
     293    $title = sanitize_title( $name );
    294294    $content = '';
    295295    $excerpt = '';
  • tags/4.6.1/src/wp-admin/js/editor-expand.js

    r38270 r38560  
    5454            };
    5555
     56        var shrinkTextarea = window._.throttle( function() {
     57            var x = window.scrollX || document.documentElement.scrollLeft;
     58            var y = window.scrollY || document.documentElement.scrollTop;
     59            var height = parseInt( textEditor.style.height, 10 );
     60
     61            textEditor.style.height = autoresizeMinHeight + 'px';
     62
     63            if ( textEditor.scrollHeight > autoresizeMinHeight ) {
     64                textEditor.style.height = textEditor.scrollHeight + 'px';
     65            }
     66
     67            if ( typeof x !== 'undefined' ) {
     68                window.scrollTo( x, y );
     69            }
     70
     71            if ( textEditor.scrollHeight < height ) {
     72                adjust();
     73            }
     74        }, 300 );
     75
     76        function textEditorResize() {
     77            var length = textEditor.value.length;
     78
     79            if ( mceEditor && ! mceEditor.isHidden() ) {
     80                return;
     81            }
     82
     83            if ( ! mceEditor && initialMode === 'tinymce' ) {
     84                return;
     85            }
     86
     87            if ( length < oldTextLength ) {
     88                shrinkTextarea();
     89            } else if ( parseInt( textEditor.style.height, 10 ) < textEditor.scrollHeight ) {
     90                textEditor.style.height = Math.ceil( textEditor.scrollHeight ) + 'px';
     91                adjust();
     92            }
     93
     94            oldTextLength = length;
     95        }
     96
    5697        function getHeights() {
    5798            var windowWidth = $window.width();
     
    74115                heights.menuBarHeight = 0;
    75116            }
    76         }
    77 
    78         function textEditorResize() {
    79             if ( mceEditor && ! mceEditor.isHidden() ) {
    80                 return;
    81             }
    82 
    83             if ( ! mceEditor && initialMode === 'tinymce' ) {
    84                 return;
    85             }
    86 
    87             var length = textEditor.value.length;
    88             var height = parseInt( textEditor.style.height, 10 );
    89             var top = window.scrollTop;
    90 
    91             if ( length < oldTextLength ) {
    92                 // textEditor.scrollHeight is not adjusted until the next line.
    93                 textEditor.style.height = 'auto';
    94 
    95                 if ( textEditor.scrollHeight > autoresizeMinHeight ) {
    96                     textEditor.style.height = textEditor.scrollHeight + 'px';
    97                 } else {
    98                     textEditor.style.height = autoresizeMinHeight + 'px';
    99                 }
    100 
    101                 // Prevent scroll-jumping in Firefox and IE.
    102                 window.scrollTop = top;
    103 
    104                 if ( textEditor.scrollHeight < height ) {
    105                     adjust();
    106                 }
    107             } else if ( height < textEditor.scrollHeight ) {
    108                 textEditor.style.height = textEditor.scrollHeight + 'px';
    109                 adjust();
    110             }
    111 
    112             oldTextLength = length;
    113117        }
    114118
  • tags/4.6.1/src/wp-includes/Requests/Transport/cURL.php

    r38270 r38560  
    348348                curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, $options['type']);
    349349                if (!empty($data)) {
    350                     curl_setopt( $this->handle, CURLOPT_POSTFIELDS, $data );
     350                    curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);
    351351                }
    352352        }
     
    525525     */
    526526    public static function test($capabilities = array()) {
    527         if (!function_exists('curl_init') && !function_exists('curl_exec')) {
     527        if (!function_exists('curl_init') || !function_exists('curl_exec')) {
    528528            return false;
    529529        }
  • tags/4.6.1/src/wp-includes/class-http.php

    r38270 r38560  
    363363        }
    364364
     365        // Work around a bug in Requests when the path starts with // See https://github.com/rmccue/Requests/issues/231
     366        $url = preg_replace( '!^(\w+://[^/]+)//(.*)$!i', '$1/$2', $url );
     367
    365368        try {
    366369            $requests_response = Requests::request( $url, $headers, $data, $type, $options );
     
    434437            if ( $value instanceof WP_Http_Cookie ) {
    435438                $cookie_jar[ $value->name ] = new Requests_Cookie( $value->name, $value->value, $value->get_attributes() );
    436             } elseif ( is_string( $value ) ) {
     439            } elseif ( is_scalar( $value ) ) {
    437440                $cookie_jar[ $name ] = new Requests_Cookie( $name, $value );
    438441            }
  • tags/4.6.1/src/wp-includes/class-wp-editor.php

    r38270 r38560  
    12601260
    12611261            if ( typeof tinymce !== 'undefined' ) {
     1262                // Fix RTL
     1263                tinymce.on( 'addeditor', function( event ) {
     1264                    event.editor.rtl = event.editor.settings.rtl_ui ||
     1265                        ( event.editor.editorManager &&
     1266                        event.editor.editorManager.i18n &&
     1267                        event.editor.editorManager.i18n.rtl );
     1268                }, true );
     1269
    12621270                for ( id in tinyMCEPreInit.mceInit ) {
    12631271                    init = tinyMCEPreInit.mceInit[id];
  • tags/4.6.1/src/wp-includes/css/editor.css

    r38270 r38560  
    391391    text-shadow: none;
    392392    cursor: pointer;
     393}
     394
     395.mce-btn .mce-txt {
     396    direction: inherit;
     397    text-align: inherit;
    393398}
    394399
  • tags/4.6.1/src/wp-includes/functions.php

    r38270 r38560  
    31913191 * plugin, and adds the 'ltr' button to 'toolbar1', formerly
    31923192 * 'theme_advanced_buttons1' array keys. These keys are then returned
    3193  * in the $input (TinyMCE settings) array.
     3193 * in the $mce_init (TinyMCE settings) array.
    31943194 *
    31953195 * @since 2.1.0
    31963196 * @access private
    31973197 *
    3198  * @param array $input MCE settings array.
     3198 * @param array $mce_init MCE settings array.
    31993199 * @return array Direction set for 'rtl', if needed by locale.
    32003200 */
    3201 function _mce_set_direction( $input ) {
     3201function _mce_set_direction( $mce_init ) {
    32023202    if ( is_rtl() ) {
    3203         $input['directionality'] = 'rtl';
    3204 
    3205         if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
    3206             $input['plugins'] .= ',directionality';
    3207         }
    3208 
    3209         if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
    3210             $input['toolbar1'] .= ',ltr';
    3211         }
    3212     }
    3213 
    3214     return $input;
     3203        $mce_init['directionality'] = 'rtl';
     3204        $mce_init['rtl_ui'] = true;
     3205
     3206        if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
     3207            $mce_init['plugins'] .= ',directionality';
     3208        }
     3209
     3210        if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
     3211            $mce_init['toolbar1'] .= ',ltr';
     3212        }
     3213    }
     3214
     3215    return $mce_init;
    32153216}
    32163217
  • tags/4.6.1/src/wp-includes/general-template.php

    r38270 r38560  
    28542854
    28552855        foreach ( $urls as $url ) {
    2856             printf( "<link rel='%s' href='%s'>\n", $relation_type, $url );
     2856            printf( "<link rel='%s' href='%s' />\n", $relation_type, $url );
    28572857        }
    28582858    }
  • tags/4.6.1/src/wp-includes/js/jquery/jquery.masonry.min.js

    r38270 r38560  
    1 -/*!
    2 - * Masonry v2 shim
    3 - * to maintain backwards compatibility
    4 - * as of Masonry v3.1.2
    5 - *
    6 - * Cascading grid layout library
    7 - * http://masonry.desandro.com
    8 - * MIT License
    9 - * by David DeSandro
    10 - */
    11 !function(a){"use strict";var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?b.prototype.options.transitionDuration:0),void 0===a||a){var c=this.options.animationOptions,d=c&&c.duration;d&&(this.options.transitionDuration="string"==typeof d?d:d+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){var a=this;this._remapV2Options(),c.apply(this,arguments),setTimeout(function(){jQuery(a.element).addClass("masonry")},0)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype._itemize;b.prototype._itemize=function(a){var b=f.apply(this,arguments);return jQuery(a).addClass("masonry-brick"),b};var g=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),g.apply(this,arguments)},b.prototype.reload=function(){this.reloadItems.apply(this,arguments),this.layout.apply(this)};var h=b.prototype.destroy;b.prototype.destroy=function(){var a=this.getItemElements();jQuery(this.element).removeClass("masonry"),jQuery(a).removeClass("masonry-brick"),h.apply(this,arguments)}}(window);
     1/*!
     2 * Masonry v2 shim
     3 * to maintain backwards compatibility
     4 * as of Masonry v3.1.2
     5 *
     6 * Cascading grid layout library
     7 * http://masonry.desandro.com
     8 * MIT License
     9 * by David DeSandro
     10 */
     11!function(a){"use strict";var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?this.options.transitionDuration:0),void 0===a||a){var b=this.options.animationOptions,c=b&&b.duration;c&&(this.options.transitionDuration="string"==typeof c?c:c+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){var a=this;this._remapV2Options(),c.apply(this,arguments),setTimeout(function(){jQuery(a.element).addClass("masonry")},0)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype._itemize;b.prototype._itemize=function(a){var b=f.apply(this,arguments);return jQuery(a).addClass("masonry-brick"),b};var g=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),g.apply(this,arguments)},b.prototype.reload=function(){this.reloadItems.apply(this,arguments),this.layout.apply(this)};var h=b.prototype.destroy;b.prototype.destroy=function(){var a=this.getItemElements();jQuery(this.element).removeClass("masonry"),jQuery(a).removeClass("masonry-brick"),h.apply(this,arguments)}}(window);
  • tags/4.6.1/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css

    r38270 r38560  
    2121}
    2222
    23 body.locale-he-il {
     23body.locale-he-il,
     24body.locale-vi {
    2425    font-family: Arial, "Times New Roman", "Bitstream Charter", Times, serif;
    2526}
  • tags/4.6.1/src/wp-includes/load.php

    r38270 r38560  
    10181018
    10191019    if ( ! isset( $ini_all ) ) {
    1020         $ini_all = ini_get_all();
    1021     }
     1020        $ini_all = false;
     1021        // Sometimes `ini_get_all()` is disabled via the `disable_functions` option for "security purposes".
     1022        if ( function_exists( 'ini_get_all' ) ) {
     1023            $ini_all = ini_get_all();
     1024        }
     1025    }
    10221026
    10231027    // Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17.
     
    10261030    }
    10271031
     1032    // If we were unable to retrieve the details, fail gracefully to assume it's changeable.
     1033    if ( ! is_array( $ini_all ) ) {
     1034        return true;
     1035    }
     1036
    10281037    return false;
    10291038}
  • tags/4.6.1/src/wp-includes/pluggable.php

    r38270 r38560  
    350350    $from_name = apply_filters( 'wp_mail_from_name', $from_name );
    351351
    352     $phpmailer->setFrom( $from_email, $from_name );
     352    $phpmailer->setFrom( $from_email, $from_name, false );
    353353
    354354    // Set destination addresses
  • tags/4.6.1/src/wp-includes/revision.php

    r38270 r38560  
    595595    }
    596596
    597     if ( empty( $_REQUEST['_thumbnail_id'] ) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type ) {
     597    if ( empty( $_REQUEST['_thumbnail_id'] ) ||
     598         empty( $_REQUEST['preview_id'] ) ||
     599         $post->ID != $post_id ||
     600         '_thumbnail_id' != $meta_key ||
     601         'revision' == $post->post_type ||
     602         $post_id != $_REQUEST['preview_id']
     603    ) {
    598604        return $value;
    599605    }
  • tags/4.6.1/src/wp-includes/script-loader.php

    r38270 r38560  
    251251    $scripts->add( 'imagesloaded', "/wp-includes/js/imagesloaded.min.js", array(), '3.2.0', 1 );
    252252    $scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array( 'imagesloaded' ), '3.3.2', 1 );
    253     $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2a', 1 );
     253    $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
    254254
    255255    $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
     
    564564        ) );
    565565
    566         $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery' ), false, 1 );
     566        $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
    567567
    568568        $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
  • tags/4.6.1/src/wp-includes/taxonomy.php

    r38270 r38560  
    42754275    if ( false === $object_terms ) {
    42764276        $object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) );
     4277        if ( is_wp_error( $object_terms ) ) {
     4278            return $object_terms;
     4279        }
     4280
    42774281        wp_cache_set( $object_id, wp_list_pluck( $object_terms, 'term_id' ), "{$taxonomy}_relationships" );
    42784282    }
  • tags/4.6.1/src/wp-includes/version.php

    r38270 r38560  
    55 * @global string $wp_version
    66 */
    7 $wp_version = '4.6-src';
     7$wp_version = '4.6.1-src';
    88
    99/**
  • tags/4.6.1/src/wp-includes/wp-db.php

    r38270 r38560  
    735735     */
    736736    public function init_charset() {
     737        $charset = '';
     738        $collate = '';
     739
    737740        if ( function_exists('is_multisite') && is_multisite() ) {
    738741            $charset = 'utf8';
     
    809812            $collate = $this->collate;
    810813        if ( $this->has_cap( 'collation' ) && ! empty( $charset ) ) {
     814            $set_charset_succeeded = true;
     815
    811816            if ( $this->use_mysqli ) {
    812817                if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
    813                     mysqli_set_charset( $dbh, $charset );
     818                    $set_charset_succeeded = mysqli_set_charset( $dbh, $charset );
    814819                }
    815                 $query = $this->prepare( 'SET NAMES %s', $charset );
    816                 if ( ! empty( $collate ) )
    817                     $query .= $this->prepare( ' COLLATE %s', $collate );
    818                 mysqli_query( $dbh, $query );
     820
     821                if ( $set_charset_succeeded ) {
     822                    $query = $this->prepare( 'SET NAMES %s', $charset );
     823                    if ( ! empty( $collate ) )
     824                        $query .= $this->prepare( ' COLLATE %s', $collate );
     825                    mysqli_query( $dbh, $query );
     826                }
    819827            } else {
    820828                if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
    821                     mysql_set_charset( $charset, $dbh );
     829                    $set_charset_succeeded = mysql_set_charset( $charset, $dbh );
    822830                }
    823                 $query = $this->prepare( 'SET NAMES %s', $charset );
    824                 if ( ! empty( $collate ) )
    825                     $query .= $this->prepare( ' COLLATE %s', $collate );
    826                 mysql_query( $query, $dbh );
     831                if ( $set_charset_succeeded ) {
     832                    $query = $this->prepare( 'SET NAMES %s', $charset );
     833                    if ( ! empty( $collate ) )
     834                        $query .= $this->prepare( ' COLLATE %s', $collate );
     835                    mysql_query( $query, $dbh );
     836                }
    827837            }
    828838        }
  • tags/4.6.1/tests/phpunit/tests/general/resourceHints.php

    r38270 r38560  
    3232
    3333    function test_should_have_defaults_on_frontend() {
    34         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
     34        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
    3535
    3636        $this->expectOutputString( $expected );
     
    4040
    4141    function test_dns_prefetching() {
    42         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
    43                     "<link rel='dns-prefetch' href='//wordpress.org'>\n" .
    44                     "<link rel='dns-prefetch' href='//google.com'>\n" .
    45                     "<link rel='dns-prefetch' href='//make.wordpress.org'>\n";
     42        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
     43                    "<link rel='dns-prefetch' href='//wordpress.org' />\n" .
     44                    "<link rel='dns-prefetch' href='//google.com' />\n" .
     45                    "<link rel='dns-prefetch' href='//make.wordpress.org' />\n";
    4646
    4747        add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 );
     
    7171     */
    7272    function test_preconnect() {
    73         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
    74                     "<link rel='preconnect' href='//wordpress.org'>\n" .
    75                     "<link rel='preconnect' href='https://make.wordpress.org'>\n" .
    76                     "<link rel='preconnect' href='http://google.com'>\n" .
    77                     "<link rel='preconnect' href='http://w.org'>\n";
     73        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
     74                    "<link rel='preconnect' href='//wordpress.org' />\n" .
     75                    "<link rel='preconnect' href='https://make.wordpress.org' />\n" .
     76                    "<link rel='preconnect' href='http://google.com' />\n" .
     77                    "<link rel='preconnect' href='http://w.org' />\n";
    7878
    7979        add_filter( 'wp_resource_hints', array( $this, '_add_preconnect_domains' ), 10, 2 );
     
    9999
    100100    function test_prerender() {
    101         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
    102                     "<link rel='prerender' href='https://make.wordpress.org/great-again'>\n" .
    103                     "<link rel='prerender' href='http://jobs.wordpress.net'>\n" .
    104                     "<link rel='prerender' href='//core.trac.wordpress.org'>\n";
     101        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
     102                    "<link rel='prerender' href='https://make.wordpress.org/great-again' />\n" .
     103                    "<link rel='prerender' href='http://jobs.wordpress.net' />\n" .
     104                    "<link rel='prerender' href='//core.trac.wordpress.org' />\n";
    105105
    106106        add_filter( 'wp_resource_hints', array( $this, '_add_prerender_urls' ), 10, 2 );
     
    125125
    126126    function test_parse_url_dns_prefetch() {
    127         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" .
    128                     "<link rel='dns-prefetch' href='//make.wordpress.org'>\n";
     127        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
     128                    "<link rel='dns-prefetch' href='//make.wordpress.org' />\n";
    129129
    130130        add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 );
     
    146146
    147147    function test_dns_prefetch_styles() {
    148         $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" .
    149                     "<link rel='dns-prefetch' href='//s.w.org'>\n";
     148        $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" .
     149                    "<link rel='dns-prefetch' href='//s.w.org' />\n";
    150150
    151151        $args = array(
     
    165165
    166166    function test_dns_prefetch_scripts() {
    167         $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" .
    168                     "<link rel='dns-prefetch' href='//s.w.org'>\n";
     167        $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com' />\n" .
     168                    "<link rel='dns-prefetch' href='//s.w.org' />\n";
    169169
    170170        $args = array(
     
    183183
    184184    function test_dns_prefetch_scripts_does_not_included_registered_only() {
    185         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
    186         $unexpected = "<link rel='dns-prefetch' href='//wordpress.org'>\n";
     185        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
     186        $unexpected = "<link rel='dns-prefetch' href='//wordpress.org' />\n";
    187187
    188188        wp_register_script( 'jquery-elsewhere', 'https://wordpress.org/wp-includes/js/jquery/jquery.js' );
     
    200200     */
    201201    function test_deregistered_scripts_are_ignored() {
    202         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
     202        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
    203203
    204204        wp_enqueue_script( 'test-script', 'http://example.org/script.js' );
     
    213213     */
    214214    function test_malformed_urls() {
    215         $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n";
     215        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
    216216
    217217        // Errant colon.
  • tags/4.6.1/tests/phpunit/tests/http/base.php

    r38270 r38560  
    377377    }
    378378
     379    /**
     380     * @ticket 37733
     381     */
     382    function test_url_with_double_slashes_path() {
     383        $url = $this->redirection_script . '?rt=' . 0;
     384
     385        $path = parse_url( $url, PHP_URL_PATH );
     386        $url = str_replace( $path, '/' . $path, $url );
     387
     388        $res = wp_remote_request( $url );
     389        $this->assertNotWPError( $res );
     390    }
     391
    379392
    380393}
  • tags/4.6.1/tests/phpunit/tests/http/http.php

    r38270 r38560  
    119119
    120120    }
     121
     122    /**
     123     * @ticket 37768
     124     */
     125    public function test_normalize_cookies_scalar_values() {
     126        $http = _wp_http_get_object();
     127
     128        $cookies = array(
     129            'x'   => 'foo',
     130            'y'   => 2,
     131            'z'   => 0.45,
     132            'foo' => array( 'bar' ),
     133        );
     134
     135        $cookie_jar = $http->normalize_cookies( array(
     136            'x'   => 'foo',
     137            'y'   => 2,
     138            'z'   => 0.45,
     139            'foo' => array( 'bar' ),
     140        ) );
     141
     142        $this->assertInstanceOf( 'Requests_Cookie_Jar', $cookie_jar );
     143
     144        foreach( array_keys( $cookies ) as $cookie ) {
     145            if ( 'foo' === $cookie ) {
     146                $this->assertFalse( isset( $cookie_jar[ $cookie ] ) );
     147            } else {
     148                $this->assertInstanceOf( 'Requests_Cookie', $cookie_jar[ $cookie ] );
     149            }
     150        }
     151    }
    121152}
  • tags/4.6.1/tests/phpunit/tests/mail.php

    r38270 r38560  
    343343        }
    344344    }
     345
     346    /**
     347     * Test that the Sender field in the SMTP envelope is not set by Core.
     348     *
     349     * Correctly setting the Sender requires knowledge that is not available
     350     * to Core. An incorrect value will often lead to messages being rejected
     351     * by the receiving MTA, so it's the admin's responsibility to
     352     * set it correctly.
     353     *
     354     * @ticket 37736
     355     */
     356    public function test_wp_mail_sender_not_set() {
     357        wp_mail( 'user@example.org', 'Testing the Sender field', 'The Sender field should not have been set.' );
     358
     359        $mailer = tests_retrieve_phpmailer_instance();
     360
     361        $this->assertEquals( '', $mailer->Sender );
     362    }
    345363}
  • tags/4.6.1/tests/phpunit/tests/post/thumbnails.php

    r38270 r38560  
    243243        $GLOBALS['post'] = self::$post;
    244244        $_REQUEST['_thumbnail_id'] = self::$attachment_id;
     245        $_REQUEST['preview_id'] = self::$post->ID;
    245246
    246247        $result = _wp_preview_post_thumbnail_filter( '', self::$post->ID, '_thumbnail_id' );
     248
     249        // Clean up.
     250        $GLOBALS['post'] = $old_post;
     251        unset( $_REQUEST['_thumbnail_id'] );
     252        unset( $_REQUEST['preview_id'] );
     253
    247254        $this->assertEquals( self::$attachment_id, $result );
    248 
     255    }
     256
     257    /**
     258     * @ticket 37697
     259     */
     260    function test__wp_preview_post_thumbnail_filter_secondary_post() {
     261        $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] : null;
     262
     263        $secondary_post = self::factory()->post->create( array(
     264                'post_stauts' => 'publish',
     265            )
     266        );
     267
     268        $GLOBALS['post'] = self::$post;
     269        $_REQUEST['_thumbnail_id'] = self::$attachment_id;
     270        $_REQUEST['preview_id'] = $secondary_post;
     271
     272        $result = _wp_preview_post_thumbnail_filter( '', self::$post->ID, '_thumbnail_id' );
     273
     274        // Clean up.
     275        $GLOBALS['post'] = $old_post;
    249276        unset( $_REQUEST['_thumbnail_id'] );
    250         if ( null === $old_post ) {
    251             unset( $GLOBALS['post'] );
    252         } else {
    253             $GLOBALS['post'] = $old_post;
    254         }
     277        unset( $_REQUEST['preview_id'] );
     278
     279        $this->assertEmpty( $result );
    255280    }
    256281
  • tags/4.6.1/tests/phpunit/tests/term/isObjectInTerm.php

    r38270 r38560  
    147147        $this->assertSame( $num_queries, $wpdb->num_queries );
    148148    }
     149
     150    /**
     151     * @ticket 37721
     152     */
     153    public function test_invalid_taxonomy_should_return_wp_error_object() {
     154        $this->assertWPError( is_object_in_term( 12345, 'foo', 'bar' ) );
     155    }
    149156}
Note: See TracChangeset for help on using the changeset viewer.