Make WordPress Core

Changes from tags/4.1 at r64347 to tags/4.1.1 at r64347


Ignore:
Location:
tags/4.1.1
Files:
4 added
28 edited

Legend:

Unmodified
Added
Removed
  • tags/4.1.1/package.json

    r64347 r64347  
    11{
    22  "name": "WordPress",
    3   "version": "4.1.0",
     3  "version": "4.1.1",
    44  "description": "WordPress is web software you can use to create a beautiful website or blog.",
    55  "repository": {
  • tags/4.1.1/src/license.txt

    r64347 r64347  
    11WordPress - Web publishing software
    22
    3 Copyright 2014 by the contributors
     3Copyright 2015 by the contributors
    44
    55This program is free software; you can redistribute it and/or modify
  • tags/4.1.1/src/readme.html

    r64347 r64347  
    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.1
     12        <br /> Version 4.1.1
    1313</h1>
    1414<p style="text-align: center">Semantic Personal Publishing Platform</p>
  • tags/4.1.1/src/wp-admin/about.php

    r64347 r64347  
    4141        </a>
    4242</h2>
     43
     44<div class="changelog point-releases">
     45        <h3><?php echo _n( 'Maintenance Release', 'Maintenance Releases', 1 ); ?></h3>
     46        <p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
     47         '<strong>Version %1$s</strong> addressed %2$s bugs.', 21 ), '4.1.1', number_format_i18n( 21 ) ); ?>
     48                <?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.1.1' ); ?>
     49        </p>
     50</div>
    4351
    4452<div class="changelog headline-feature">
  • tags/4.1.1/src/wp-admin/async-upload.php

    r64347 r64347  
    3333require_once( ABSPATH . 'wp-admin/admin.php' );
    3434
     35header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
     36
    3537if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
    3638        include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
    … …  
    4648        wp_die( __( 'You do not have permission to upload files.' ) );
    4749}
    48 
    49 header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
    5050
    5151// just fetch the detail form for that attachment
  • tags/4.1.1/src/wp-admin/includes/ajax-actions.php

    r64347 r64347  
    18331833function wp_ajax_upload_attachment() {
    18341834        check_ajax_referer( 'media-form' );
     1835        /*
     1836         * This function does not use wp_send_json_success() / wp_send_json_error()
     1837         * as the html4 Plupload handler requires a text/html content-type for older IE.
     1838         * See https://core.trac.wordpress.org/ticket/31037
     1839         */
    18351840
    18361841        if ( ! current_user_can( 'upload_files' ) ) {
    1837                 wp_send_json_error( array(
    1838                         'message'  => __( "You don't have permission to upload files." ),
    1839                         'filename' => $_FILES['async-upload']['name'],
     1842                echo wp_json_encode( array(
     1843                        'success' => false,
     1844                        'data'    => array(
     1845                                'message'  => __( "You don't have permission to upload files." ),
     1846                                'filename' => $_FILES['async-upload']['name'],
     1847                        )
    18401848                ) );
     1849
     1850                wp_die();
    18411851        }
    18421852
    … …  
    18441854                $post_id = $_REQUEST['post_id'];
    18451855                if ( ! current_user_can( 'edit_post', $post_id ) ) {
    1846                         wp_send_json_error( array(
    1847                                 'message'  => __( "You don't have permission to attach files to this post." ),
    1848                                 'filename' => $_FILES['async-upload']['name'],
     1856                        echo wp_json_encode( array(
     1857                                'success' => false,
     1858                                'data'    => array(
     1859                                        'message'  => __( "You don't have permission to attach files to this post." ),
     1860                                        'filename' => $_FILES['async-upload']['name'],
     1861                                )
    18491862                        ) );
     1863
     1864                        wp_die();
    18501865                }
    18511866        } else {
    … …  
    18591874                $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'], false );
    18601875                if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
    1861                         wp_send_json_error( array(
    1862                                 'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
     1876                        echo wp_json_encode( array(
     1877                                'success' => false,
     1878                                'data'    => array(
     1879                                        'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
     1880                                        'filename' => $_FILES['async-upload']['name'],
     1881                                )
     1882                        ) );
     1883
     1884                        wp_die();
     1885                }
     1886        }
     1887
     1888        $attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data );
     1889
     1890        if ( is_wp_error( $attachment_id ) ) {
     1891                echo wp_json_encode( array(
     1892                        'success' => false,
     1893                        'data'    => array(
     1894                                'message'  => $attachment_id->get_error_message(),
    18631895                                'filename' => $_FILES['async-upload']['name'],
    1864                         ) );
    1865                 }
    1866         }
    1867 
    1868         $attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data );
    1869 
    1870         if ( is_wp_error( $attachment_id ) ) {
    1871                 wp_send_json_error( array(
    1872                         'message'  => $attachment_id->get_error_message(),
    1873                         'filename' => $_FILES['async-upload']['name'],
     1896                        )
    18741897                ) );
     1898
     1899                wp_die();
    18751900        }
    18761901
    … …  
    18861911                wp_die();
    18871912
    1888         wp_send_json_success( $attachment );
     1913        echo wp_json_encode( array(
     1914                'success' => true,
     1915                'data'    => $attachment,
     1916        ) );
     1917
     1918        wp_die();
    18891919}
    18901920
  • tags/4.1.1/src/wp-admin/includes/taxonomy.php

    r64347 r64347  
    1212
    1313/**
    14  * {@internal Missing Short Description}}
    15  *
    16  * @since 2.0.0
    17  *
    18  * @param int|string $cat_name
    19  * @return int
    20  */
    21 function category_exists($cat_name, $parent = 0) {
     14 * Check whether a category exists.
     15 *
     16 * @since 2.0.0
     17 *
     18 * @see term_exists()
     19 *
     20 * @param int|string $cat_name Category name.
     21 * @param int        $parent   Optional. ID of parent term.
     22 * @return mixed
     23 */
     24function category_exists( $cat_name, $parent = null ) {
    2225        $id = term_exists($cat_name, 'category', $parent);
    2326        if ( is_array($id) )
  • tags/4.1.1/src/wp-admin/includes/update-core.php

    r64347 r64347  
    695695'wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js',
    696696'wp-includes/js/jquery/ui/jquery.ui.widget.min.js',
     697'wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png',
    697698);
    698699
  • tags/4.1.1/src/wp-admin/js/common.js

    r64347 r64347  
    172172
    173173$(document).ready( function() {
    174         var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions,
     174        var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions, $firstHeading,
    175175                lastClicked = false,
    176176                pageInput = $('input.current-page'),
    … …  
    369369        }
    370370
    371         // Move .updated and .error alert boxes. Don't move boxes designed to be inline.
    372         $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
    373         $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
     371        // Move .notice, .updated and .error alert boxes. Don't move boxes designed to be inline.
     372        $firstHeading = $( 'div.wrap h2:first' );
     373        $firstHeading.nextAll( 'div.updated, div.error, div.notice' ).addClass( 'below-h2' );
     374        $( 'div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $firstHeading );
    374375
    375376        // Init screen meta
  • tags/4.1.1/src/wp-admin/js/customize-controls.js

    r64347 r64347  
    129129                var equal = (
    130130                        listA.length === listB.length && // if lists are different lengths, then naturally they are not equal
    131                         -1 === _.map( // are there any false values in the list returned by map?
     131                        -1 === _.indexOf( _.map( // are there any false values in the list returned by map?
    132132                                _.zip( listA, listB ), // pair up each element between the two lists
    133133                                function ( pair ) {
    134134                                        return $( pair[0] ).is( pair[1] ); // compare to see if each pair are equal
    135135                                }
    136                         ).indexOf( false ) // check for presence of false in map's return value
     136                        ), false ) // check for presence of false in map's return value
    137137                );
    138138                return equal;
  • tags/4.1.1/src/wp-admin/update-core.php

    r64347 r64347  
    243243                $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
    244244                if ( is_wp_error( $info ) ) {
    245                         continue;
     245                        $info = false;
    246246                }
    247247
  • tags/4.1.1/src/wp-admin/user-edit.php

    r64347 r64347  
    490490                <th>&nbsp;</th>
    491491                <td aria-live="assertive">
    492                         <div class="destroy-sessions"><button disabled class="button button-secondary"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
     492                        <div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
    493493                        <p class="description">
    494494                                <?php _e( 'You are only logged in at this location.' ); ?>
    … …  
    500500                <th>&nbsp;</th>
    501501                <td aria-live="assertive">
    502                         <div class="destroy-sessions"><button class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
     502                        <div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
    503503                        <p class="description">
    504504                                <?php _e( 'Left your account logged in at a public computer? Lost your phone? This will log you out everywhere except your current browser.' ); ?>
    … …  
    510510                <th>&nbsp;</th>
    511511                <td>
    512                         <p><button class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Sessions' ); ?></button></p>
     512                        <p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Sessions' ); ?></button></p>
    513513                        <p class="description">
    514514                                <?php
  • tags/4.1.1/src/wp-includes/class-wp-customize-control.php

    r64347 r64347  
    739739        public function content_template() {
    740740                ?>
    741                 <label for="{{ data.settings.default }}-button">
     741                <label for="{{ data.settings['default'] }}-button">
    742742                        <# if ( data.label ) { #>
    743743                                <span class="customize-control-title">{{ data.label }}</span>
    … …  
    776776                        <div class="actions">
    777777                                <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
    778                                 <button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['change']; ?></button>
     778                                <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
    779779                                <div style="clear:both"></div>
    780780                        </div>
    … …  
    795795                                        <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
    796796                                <# } #>
    797                                 <button type="button" class="button upload-button" id="{{ data.settings.default }}-button"><?php echo $this->button_labels['select']; ?></button>
     797                                <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
    798798                                <div style="clear:both"></div>
    799799                        </div>
  • tags/4.1.1/src/wp-includes/class-wp-customize-manager.php

    r64347 r64347  
    6464
    6565        /**
    66          * $_POST values for Customize Settings.
    67          *
    68          * @var array
     66         * Unsanitized values for Customize Settings parsed from $_POST['customized'].
     67         *
     68         * @var array|false
    6969         */
    7070        private $_post_values;
    … …  
    7676         */
    7777        public function __construct() {
    78                 require( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
    79                 require( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
    80                 require( ABSPATH . WPINC . '/class-wp-customize-section.php' );
    81                 require( ABSPATH . WPINC . '/class-wp-customize-control.php' );
    82                 require( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
     78                require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
     79                require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
     80                require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
     81                require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
     82                require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
    8383
    8484                $this->widgets = new WP_Customize_Widgets( $this );
    … …  
    400400
    401401        /**
    402          * Decode the $_POST['customized'] values for a specific Customize Setting.
    403          *
    404          * @since 3.4.0
     402         * Parse the incoming $_POST['customized'] JSON data and store the unsanitized
     403         * settings for subsequent post_value() lookups.
     404         *
     405         * @since 4.1.1
     406         *
     407         * @return array
     408         */
     409        public function unsanitized_post_values() {
     410                if ( ! isset( $this->_post_values ) ) {
     411                        if ( isset( $_POST['customized'] ) ) {
     412                                $this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
     413                        }
     414                        if ( empty( $this->_post_values ) ) { // if not isset or of JSON error
     415                                $this->_post_values = false;
     416                        }
     417                }
     418                if ( empty( $this->_post_values ) ) {
     419                        return array();
     420                } else {
     421                        return $this->_post_values;
     422                }
     423        }
     424
     425        /**
     426         * Return the sanitized value for a given setting from the request's POST data.
     427         *
     428         * @since 3.4.0
     429         * @since 4.1.1 Introduced 'default' parameter.
    405430         *
    406431         * @param WP_Customize_Setting $setting A WP_Customize_Setting derived object
    407          * @return string $post_value Sanitized value
    408          */
    409         public function post_value( $setting ) {
    410                 if ( ! isset( $this->_post_values ) ) {
    411                         if ( isset( $_POST['customized'] ) )
    412                                 $this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
    413                         else
    414                                 $this->_post_values = false;
    415                 }
    416 
    417                 if ( isset( $this->_post_values[ $setting->id ] ) )
    418                         return $setting->sanitize( $this->_post_values[ $setting->id ] );
     432         * @param mixed $default value returned $setting has no post value (added in 4.2.0).
     433         * @return string|mixed $post_value Sanitized value or the $default provided
     434         */
     435        public function post_value( $setting, $default = null ) {
     436                $post_values = $this->unsanitized_post_values();
     437                if ( array_key_exists( $setting->id, $post_values ) ) {
     438                        return $setting->sanitize( $post_values[ $setting->id ] );
     439                } else {
     440                        return $default;
     441                }
    419442        }
    420443
  • tags/4.1.1/src/wp-includes/class-wp-customize-setting.php

    r64347 r64347  
    104104        }
    105105
     106        protected $_original_value;
     107
    106108        /**
    107109         * Handle previewing the setting.
    … …  
    110112         */
    111113        public function preview() {
     114                if ( ! isset( $this->_original_value ) ) {
     115                        $this->_original_value = $this->value();
     116                }
     117
    112118                switch( $this->type ) {
    113119                        case 'theme_mod' :
    … …  
    160166         */
    161167        public function _preview_filter( $original ) {
    162                 return $this->multidimensional_replace( $original, $this->id_data[ 'keys' ], $this->post_value() );
     168                $undefined = new stdClass(); // symbol hack
     169                $post_value = $this->manager->post_value( $this, $undefined );
     170                if ( $undefined === $post_value ) {
     171                        $value = $this->_original_value;
     172                } else {
     173                        $value = $post_value;
     174                }
     175
     176                return $this->multidimensional_replace( $original, $this->id_data['keys'], $value );
    163177        }
    164178
    … …  
    426440                }
    427441
    428                 if ( $create && ! isset( $node[ $last ] ) )
    429                         $node[ $last ] = array();
     442                if ( $create ) {
     443                        if ( ! is_array( $node ) ) {
     444                                // account for an array overriding a string or object value
     445                                $node = array();
     446                        }
     447                        if ( ! isset( $node[ $last ] ) ) {
     448                                $node[ $last ] = array();
     449                        }
     450                }
    430451
    431452                if ( ! isset( $node[ $last ] ) )
  • tags/4.1.1/src/wp-includes/date.php

    r64347 r64347  
    306306                // Days per year.
    307307                if ( array_key_exists( 'year', $date_query ) ) {
    308                         // If a year exists in the date query, we can use it to get the days.
    309                         $max_days_of_year = date( 'z', mktime( 0, 0, 0, 12, 31, $date_query['year'] ) ) + 1;
     308                        /*
     309                         * If a year exists in the date query, we can use it to get the days.
     310                         * If multiple years are provided (as in a BETWEEN), use the first one.
     311                         */
     312                        if ( is_array( $date_query['year'] ) ) {
     313                                $_year = reset( $date_query['year'] );
     314                        } else {
     315                                $_year = $date_query['year'];
     316                        }
     317
     318                        $max_days_of_year = date( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
    310319                } else {
    311320                        // otherwise we use the max of 366 (leap-year)
    … …  
    337346
    338347                // Weeks per year.
    339                 if ( array_key_exists( 'year', $date_query ) ) {
     348                if ( isset( $_year ) ) {
    340349                        // If we have a specific year, use it to calculate number of weeks.
    341350                        $date = new DateTime();
    342                         $date->setISODate( $date_query['year'], 53 );
     351                        $date->setISODate( $_year, 53 );
    343352                        $week_count = $date->format( "W" ) === "53" ? 53 : 52;
    344353
    … …  
    361370                // Hours per day.
    362371                $min_max_checks['hour'] = array(
    363                         'min' => 1,
     372                        'min' => 0,
    364373                        'max' => 23
    365374                );
    … …  
    383392                        }
    384393
    385                         $is_between = $date_query[ $key ] >= $check['min'] && $date_query[ $key ] <= $check['max'];
    386 
    387                         if ( ! $is_between ) {
    388 
    389                                 $error = sprintf(
    390                                         /* translators: Date query invalid date message: 1: invalid value, 2: type of value, 3: minimum valid value, 4: maximum valid value */
    391                                         __( 'Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.' ),
    392                                         '<code>' . esc_html( $date_query[ $key ] ) . '</code>',
    393                                         '<code>' . esc_html( $key ) . '</code>',
    394                                         '<code>' . esc_html( $check['min'] ) . '</code>',
    395                                         '<code>' . esc_html( $check['max'] ) . '</code>'
    396                                 );
    397 
    398                                 _doing_it_wrong( __CLASS__, $error, '4.1.0' );
    399 
    400                                 $valid = false;
     394                        // Throw a notice for each failing value.
     395                        $is_between = true;
     396                        foreach ( (array) $date_query[ $key ] as $_value ) {
     397                                $is_between = $_value >= $check['min'] && $_value <= $check['max'];
     398
     399                                if ( ! is_numeric( $_value ) || ! $is_between ) {
     400                                        $error = sprintf(
     401                                                /* translators: Date query invalid date message: 1: invalid value, 2: type of value, 3: minimum valid value, 4: maximum valid value */
     402                                                __( 'Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.' ),
     403                                                '<code>' . esc_html( $_value ) . '</code>',
     404                                                '<code>' . esc_html( $key ) . '</code>',
     405                                                '<code>' . esc_html( $check['min'] ) . '</code>',
     406                                                '<code>' . esc_html( $check['max'] ) . '</code>'
     407                                        );
     408
     409                                        _doing_it_wrong( __CLASS__, $error, '4.1.0' );
     410
     411                                        $valid = false;
     412                                }
    401413                        }
    402414                }
  • tags/4.1.1/src/wp-includes/general-template.php

    r64347 r64347  
    25882588        global $wp_query, $wp_rewrite;
    25892589
    2590         $total        = ( isset( $wp_query->max_num_pages ) ) ? $wp_query->max_num_pages : 1;
    2591         $current      = ( get_query_var( 'paged' ) ) ? intval( get_query_var( 'paged' ) ) : 1;
     2590        // Setting up default values based on the current URL.
    25922591        $pagenum_link = html_entity_decode( get_pagenum_link() );
    2593         $query_args   = array();
    25942592        $url_parts    = explode( '?', $pagenum_link );
    25952593
    2596         if ( isset( $url_parts[1] ) ) {
    2597                 wp_parse_str( $url_parts[1], $query_args );
    2598                 $query_args = urlencode_deep( $query_args );
    2599         }
    2600 
    2601         $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
    2602         $pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
    2603 
     2594        // Get max pages and current page out of the current query, if available.
     2595        $total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
     2596        $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
     2597
     2598        // Append the format placeholder to the base URL.
     2599        $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
     2600
     2601        // URL base depends on permalink settings.
    26042602        $format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
    26052603        $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
    … …  
    26172615                'mid_size' => 2,
    26182616                'type' => 'plain',
    2619                 'add_args' => $query_args, // array of query args to add
     2617                'add_args' => array(), // array of query args to add
    26202618                'add_fragment' => '',
    26212619                'before_page_number' => '',
    … …  
    26252623        $args = wp_parse_args( $args, $defaults );
    26262624
     2625        if ( ! is_array( $args['add_args'] ) ) {
     2626                $args['add_args'] = array();
     2627        }
     2628
     2629        // Merge additional query vars found in the original URL into 'add_args' array.
     2630        if ( isset( $url_parts[1] ) ) {
     2631                // Find the format argument.
     2632                $format_query = parse_url( str_replace( '%_%', $args['format'], $args['base'] ), PHP_URL_QUERY );
     2633                wp_parse_str( $format_query, $format_arg );
     2634
     2635                // Remove the format argument from the array of query arguments, to avoid overwriting custom format.
     2636                wp_parse_str( remove_query_arg( array_keys( $format_arg ), $url_parts[1] ), $query_args );
     2637                $args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $query_args ) );
     2638        }
     2639
    26272640        // Who knows what else people pass in $args
    26282641        $total = (int) $args['total'];
    … …  
    26392652                $mid_size = 2;
    26402653        }
    2641         $add_args = is_array( $args['add_args'] ) ? $args['add_args'] : false;
     2654        $add_args = $args['add_args'];
    26422655        $r = '';
    26432656        $page_links = array();
    … …  
    31143127        return $settings;
    31153128}
     3129
     3130/**
     3131 * Temporary function to add a missing style rule to the themes page.
     3132 * This avoids the need to ship an entirely rebuilt wp-admin.css in partial builds.
     3133 *
     3134 * @since 4.1.1
     3135 * @ignore
     3136 */
     3137function _wp_add_themesphp_notice_styling() {
     3138        global $pagenow;
     3139        if ( 'themes.php' == $pagenow ) {
     3140                echo "<style type='text/css'>.themes-php div.notice { margin: 0 0 20px 0; clear: both; }</style>\n";
     3141        }
     3142}
     3143add_action( 'admin_head', '_wp_add_themesphp_notice_styling' );
  • tags/4.1.1/src/wp-includes/js/media-audiovideo.js

    r64347 r64347  
    5454
    5555                        if ( 'native' !== t.media.pluginType ) {
    56                                 t.media.remove();
     56                                t.$media.remove();
    5757                        }
    5858
  • tags/4.1.1/src/wp-includes/js/media-grid.js

    r64347 r64347  
    299299                        this.$( 'audio, video' ).each( function (i, elem) {
    300300                                var el = media.view.MediaDetails.prepareSrc( elem );
    301                                 new MediaElementPlayer( el, media.mixin.mejsSettings );
     301                                setTimeout( function() {
     302                                        new MediaElementPlayer( el, media.mixin.mejsSettings );
     303                                }, 0 );
    302304                        } );
    303305                }
  • tags/4.1.1/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r64347 r64347  
    186186                toolbarWidth = toolbarNode.offsetWidth;
    187187                toolbarHalf = toolbarWidth / 2;
    188                 iframe = editor.getContentAreaContainer().firstChild;
     188                iframe = document.getElementById( editor.id + '_ifr' );
    189189                iframePos = DOM.getPos( iframe );
    190190                iframeWidth = iframe.offsetWidth;
    … …  
    239239                left += iframePos.x;
    240240
    241                 if ( toolbarWidth >= windowWidth ) {
     241                if ( boundary.left < 0 || boundary.right > iframeWidth ) {
     242                        left = iframePos.x + ( iframeWidth - toolbarWidth ) / 2;
     243                } else if ( toolbarWidth >= windowWidth ) {
    242244                        className += ' mce-arrow-full';
    243245                        left = 0;
  • tags/4.1.1/src/wp-includes/link-template.php

    r64347 r64347  
    23112311                $args = wp_parse_args( $args, array(
    23122312                        'mid_size'           => 1,
    2313                         'prev_text'          => __( 'Previous' ),
    2314                         'next_text'          => __( 'Next' ),
     2313                        'prev_text'          => _x( 'Previous', 'previous post' ),
     2314                        'next_text'          => _x( 'Next', 'next post' ),
    23152315                        'screen_reader_text' => __( 'Posts navigation' ),
    23162316                ) );
  • tags/4.1.1/src/wp-includes/script-loader.php

    r64347 r64347  
    178178        $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
    179179        $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
    180         $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
     180        $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-scale'), '1.11.2', 1 );
    181181        $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
    182         $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
     182        $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-size'), '1.11.2', 1 );
    183183        $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
    184184        $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
  • tags/4.1.1/src/wp-includes/taxonomy.php

    r64347 r64347  
    33543354
    33553355        // Check for duplicate slug
    3356         $id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE slug = %s", $slug ) );
    3357         if ( $id && ($id != $term_id) ) {
     3356        $duplicate = get_term_by( 'slug', $slug, $taxonomy );
     3357        if ( $duplicate && $duplicate->term_id != $term_id ) {
    33583358                // If an empty slug was passed or the parent changed, reset the slug to something unique.
    33593359                // Otherwise, bail.
    … …  
    43374337         *
    43384338         * @since 3.1.0
     4339         * @since 4.1.1 Introduced the `$resource_type` parameter.
    43394340         *
    43404341         * @param array  $ancestors     An array of object ancestors.
    … …  
    43434344         * @param string $resource_type Type of resource $object_type is.
    43444345         */
    4345         return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type );
     4346        return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
    43464347}
    43474348
  • tags/4.1.1/src/wp-includes/update.php

    r64347 r64347  
    522522
    523523        if ( $plugins = current_user_can( 'update_plugins' ) ) {
    524                 wp_update_plugins(); // Check for Plugin updates
    525524                $update_plugins = get_site_transient( 'update_plugins' );
    526525                if ( ! empty( $update_plugins->response ) )
    … …  
    529528
    530529        if ( $themes = current_user_can( 'update_themes' ) ) {
    531                 wp_update_themes(); // Check for Theme updates
    532530                $update_themes = get_site_transient( 'update_themes' );
    533531                if ( ! empty( $update_themes->response ) )
  • tags/4.1.1/src/wp-includes/version.php

    r64347 r64347  
    55 * @global string $wp_version
    66 */
    7 $wp_version = '4.1-src';
     7$wp_version = '4.1.1-src';
    88
    99/**
    … …  
    1919 * @global string $tinymce_version
    2020 */
    21 $tinymce_version = '4107-20141130';
     21$tinymce_version = '4107-20150118';
    2222
    2323/**
  • tags/4.1.1/tests/phpunit/tests/date/query.php

    r64347 r64347  
    858858        public function test_validate_date_values_hour() {
    859859                // Valid values.
    860                 $hours = range( 1, 23 );
     860                $hours = range( 0, 23 );
    861861                foreach ( $hours as $hour ) {
    862862                        $this->assertTrue( $this->q->validate_date_values( array( 'hour' => $hour ) ) );
    … …  
    864864
    865865                // Invalid values.
    866                 $hours = array( -1, 24, 25, 'string who wants to be a int' );
     866                $hours = array( -1, 24, 25, 'string' );
    867867                foreach ( $hours as $hour ) {
    868868                        $this->assertFalse( $this->q->validate_date_values( array( 'hour' => $hour ) ) );
    … …  
    961961        }
    962962
     963        /**
     964         * @ticket 31001
     965         */
     966        public function test_validate_date_values_should_process_array_value_for_year() {
     967                $p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12' ) );
     968                $p2 = $this->factory->post->create( array( 'post_date' => '2013-01-12' ) );
     969
     970                $q = new WP_Query( array(
     971                        'date_query' => array(
     972                                array(
     973                                        'compare' => 'BETWEEN',
     974                                        'year' => array( 2012, 2014 ),
     975                                ),
     976                        ),
     977                        'fields' => 'ids',
     978                ) );
     979
     980                $this->assertEquals( array( $p2 ), $q->posts );
     981        }
     982
     983        /**
     984         * @ticket 31001
     985         */
     986        public function test_validate_date_values_should_process_array_value_for_day() {
     987                $p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12' ) );
     988                $p2 = $this->factory->post->create( array( 'post_date' => '2015-01-10' ) );
     989
     990                $q = new WP_Query( array(
     991                        'date_query' => array(
     992                                array(
     993                                        'compare' => 'BETWEEN',
     994                                        'day' => array( 9, 11 ),
     995                                ),
     996                        ),
     997                        'fields' => 'ids',
     998                ) );
     999
     1000                $this->assertEquals( array( $p2 ), $q->posts );
     1001        }
     1002
     1003        /**
     1004         * @ticket 31001
     1005         * @expectedIncorrectUsage WP_Date_Query
     1006         */
     1007        public function test_validate_date_values_should_process_array_value_for_day_when_values_are_invalid() {
     1008                $p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12' ) );
     1009                $p2 = $this->factory->post->create( array( 'post_date' => '2015-01-10' ) );
     1010
     1011                $q = new WP_Query( array(
     1012                        'date_query' => array(
     1013                                array(
     1014                                        'compare' => 'BETWEEN',
     1015                                        'day' => array( 9, 32 ),
     1016                                ),
     1017                        ),
     1018                        'fields' => 'ids',
     1019                ) );
     1020
     1021                // MySQL ignores the invalid clause.
     1022                $this->assertEquals( array( $p1, $p2 ), $q->posts );
     1023        }
     1024
    9631025        /** Helpers **********************************************************/
    9641026
  • tags/4.1.1/tests/phpunit/tests/general/paginateLinks.php

    r64347 r64347  
    230230                }
    231231        }
     232
     233        /**
     234         * @ticket 30831
     235         */
     236        function test_paginate_links_with_custom_query_args() {
     237                add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) );
     238                $links = paginate_links( array(
     239                        'current'  => 2,
     240                        'total'    => 5,
     241                        'end_size' => 1,
     242                        'mid_size' => 1,
     243                        'type'     => 'array',
     244                        'add_args' => array(
     245                                'baz' => 'qux',
     246                        ),
     247                ) );
     248                remove_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) );
     249
     250                $document = new DOMDocument();
     251                $document->preserveWhiteSpace = false;
     252
     253                $data = array(
     254                        0 => home_url( '/?baz=qux&foo=bar&s=search+term' ),
     255                        1 => home_url( '/?baz=qux&foo=bar&s=search+term' ),
     256                        3 => home_url( '/?paged=3&baz=qux&foo=bar&s=search+term' ),
     257                        5 => home_url( '/?paged=5&baz=qux&foo=bar&s=search+term' ),
     258                        6 => home_url( '/?paged=3&baz=qux&foo=bar&s=search+term' ),
     259                );
     260
     261                foreach ( $data as $index => $expected_href ) {
     262                        $document->loadHTML( $links[ $index ] );
     263                        $tag = $document->getElementsByTagName( 'a' )->item( 0 );
     264                        $this->assertNotNull( $tag );
     265
     266                        $href = $tag->attributes->getNamedItem( 'href' )->value;
     267                        $this->assertEquals( $expected_href, $href );
     268                }
     269        }
     270
     271        /**
     272         * @ticket 30831
     273         */
     274        public function test_paginate_links_should_allow_non_default_format_without_add_args() {
     275                // Fake the query params.
     276                $request_uri = $_SERVER['REQUEST_URI'];
     277                $_SERVER['REQUEST_URI'] = add_query_arg( 'foo', 3, home_url() );
     278
     279                $links = paginate_links( array(
     280                        'base'    => add_query_arg( 'foo', '%#%' ),
     281                        'format'  => '',
     282                        'total'   => 5,
     283                        'current' => 3,
     284                        'type'    => 'array',
     285                ) );
     286
     287                $this->assertContains( '?foo=1', $links[1] );
     288                $this->assertContains( '?foo=2', $links[2] );
     289                $this->assertContains( '?foo=4', $links[4] );
     290                $this->assertContains( '?foo=5', $links[5] );
     291
     292                $_SERVER['REQUEST_URI'] = $request_uri;
     293        }
     294
     295        /**
     296         * @ticket 30831
     297         */
     298        public function test_paginate_links_should_allow_add_args_to_be_bool_false() {
     299                // Fake the query params.
     300                $request_uri = $_SERVER['REQUEST_URI'];
     301                $_SERVER['REQUEST_URI'] = add_query_arg( 'foo', 3, home_url() );
     302
     303                $links = paginate_links( array(
     304                        'add_args' => false,
     305                        'base'    => add_query_arg( 'foo', '%#%' ),
     306                        'format'  => '',
     307                        'total'   => 5,
     308                        'current' => 3,
     309                        'type'    => 'array',
     310                ) );
     311
     312                $this->assertContains( "<span class='page-numbers current'>3</span>", $links );
     313        }
    232314}
  • tags/4.1.1/tests/phpunit/tests/term.php

    r64347 r64347  
    641641         * @ticket 5809
    642642         */
    643         public function test_wp_update_term_duplicate_slug_same_taxonomy() {
     643        public function test_wp_update_term_should_not_create_duplicate_slugs_within_the_same_taxonomy() {
    644644                register_taxonomy( 'wptests_tax', 'post' );
    645645
    … …  
    651651
    652652                $t2 = $this->factory->term->create( array(
    653                         'name' => 'Foo',
     653                        'name' => 'Bar',
    654654                        'slug' => 'bar',
    655655                        'taxonomy' => 'wptests_tax',
    … …  
    667667         * @ticket 5809
    668668         */
    669         public function test_wp_update_term_duplicate_slug_different_taxonomy() {
     669        public function test_wp_update_term_should_allow_duplicate_slugs_in_different_taxonomy() {
    670670                register_taxonomy( 'wptests_tax', 'post' );
    671671                register_taxonomy( 'wptests_tax_2', 'post' );
    … …  
    687687                ) );
    688688
    689                 $this->assertWPError( $updated );
    690                 $this->assertSame( 'duplicate_term_slug', $updated->get_error_code() );
     689                $this->assertFalse( is_wp_error( $updated ) );
     690
     691                $t1_term = get_term( $t1, 'wptests_tax' );
     692                $t2_term = get_term( $t2, 'wptests_tax_2' );
     693                $this->assertSame( $t1_term->slug, $t2_term->slug );
     694        }
     695
     696        /**
     697         * @ticket 30780
     698         */
     699        public function test_wp_update_term_should_allow_duplicate_names_in_different_taxonomies() {
     700                register_taxonomy( 'wptests_tax', 'post' );
     701                register_taxonomy( 'wptests_tax_2', 'post' );
     702
     703                $t1 = $this->factory->term->create( array(
     704                        'name' => 'Foo',
     705                        'slug' => 'foo',
     706                        'taxonomy' => 'wptests_tax',
     707                ) );
     708
     709                $t2 = $this->factory->term->create( array(
     710                        'name' => 'Bar',
     711                        'slug' => 'bar',
     712                        'taxonomy' => 'wptests_tax_2',
     713                ) );
     714
     715                $updated = wp_update_term( $t2, 'wptests_tax_2', array(
     716                        'name' => 'Foo',
     717                ) );
     718
     719                $this->assertFalse( is_wp_error( $updated ) );
     720
     721                $t2_term = get_term( $t2, 'wptests_tax_2' );
     722                $this->assertSame( 'Foo', $t2_term->name );
     723        }
     724
     725        /**
     726         * @ticket 30780
     727         */
     728        public function test_wp_update_term_should_allow_duplicate_names_at_different_levels_of_the_same_taxonomy() {
     729                register_taxonomy( 'wptests_tax', 'post', array(
     730                        'hierarchical' => true,
     731                ) );
     732
     733                $t1 = $this->factory->term->create( array(
     734                        'name' => 'Foo',
     735                        'slug' => 'foo',
     736                        'taxonomy' => 'wptests_tax',
     737                ) );
     738
     739                $t2 = $this->factory->term->create( array(
     740                        'name' => 'Bar',
     741                        'slug' => 'bar',
     742                        'taxonomy' => 'wptests_tax',
     743                        'parent' => $t1,
     744                ) );
     745
     746                $t3 = $this->factory->term->create( array(
     747                        'name' => 'Bar Child',
     748                        'slug' => 'bar-child',
     749                        'taxonomy' => 'wptests_tax',
     750                        'parent' => $t2,
     751                ) );
     752
     753                $updated = wp_update_term( $t3, 'wptests_tax', array(
     754                        'name' => 'Bar',
     755                ) );
     756
     757                $this->assertFalse( is_wp_error( $updated ) );
     758
     759                $t3_term = get_term( $t3, 'wptests_tax' );
     760                $this->assertSame( 'Bar', $t3_term->name );
    691761        }
    692762
    … …  
    16061676        }
    16071677
     1678        /**
     1679         * @ticket 30780
     1680         */
     1681        public function test_wp_update_term_should_assign_new_slug_when_reassigning_parent_as_long_as_there_is_no_other_term_with_the_same_slug() {
     1682                register_taxonomy( 'wptests_tax', 'post', array(
     1683                        'hierarchical' => true,
     1684                ) );
     1685                register_taxonomy( 'wptests_tax_2', 'post', array(
     1686                        'hierarchical' => true,
     1687                ) );
     1688
     1689                $t1 = $this->factory->term->create( array(
     1690                        'taxonomy' => 'wptests_tax',
     1691                        'slug' => 'parent-term',
     1692                ) );
     1693
     1694                $t2 = $this->factory->term->create( array(
     1695                        'taxonomy' => 'wptests_tax',
     1696                        'slug' => 'foo',
     1697                ) );
     1698
     1699                wp_update_term( $t2, 'wptests_tax', array(
     1700                        'parent' => $t1,
     1701                ) );
     1702
     1703                $t2_term = get_term( $t2, 'wptests_tax' );
     1704
     1705                $this->assertSame( 'foo', $t2_term->slug );
     1706
     1707                _unregister_taxonomy( 'wptests_tax' );
     1708        }
     1709
     1710        /**
     1711         * @ticket 30780
     1712         */
     1713        public function test_wp_update_term_should_not_assign_new_slug_when_reassigning_parent_as_long_as_there_is_no_other_slug_conflict_within_the_taxonomy() {
     1714                register_taxonomy( 'wptests_tax', 'post', array(
     1715                        'hierarchical' => true,
     1716                ) );
     1717                register_taxonomy( 'wptests_tax_2', 'post', array(
     1718                        'hierarchical' => true,
     1719                ) );
     1720
     1721                $t1 = $this->factory->term->create( array(
     1722                        'taxonomy' => 'wptests_tax',
     1723                        'slug' => 'parent-term',
     1724                ) );
     1725
     1726                // Same slug but in a different tax.
     1727                $t2 = $this->factory->term->create( array(
     1728                        'taxonomy' => 'wptests_tax_2',
     1729                        'slug' => 'foo',
     1730                ) );
     1731
     1732                $t3 = $this->factory->term->create( array(
     1733                        'taxonomy' => 'wptests_tax',
     1734                        'slug' => 'foo',
     1735                ) );
     1736
     1737                wp_update_term( $t3, 'wptests_tax', array(
     1738                        'parent' => $t1,
     1739                ) );
     1740
     1741                $t3_term = get_term( $t3, 'wptests_tax' );
     1742
     1743                $this->assertSame( 'foo', $t3_term->slug );
     1744
     1745                _unregister_taxonomy( 'wptests_tax' );
     1746        }
     1747
    16081748        /** Helpers **********************************************************/
    16091749
Note: See TracChangeset for help on using the changeset viewer.