Make WordPress Core

Ticket #43096: 43096.diff

File 43096.diff, 20.5 KB (added by superdav42, 6 years ago)

patch

  • src/wp-includes/class-wp-locale.php

    diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php
    index 81a80a59f0..3da5c6bbe8 100644
    a b class WP_Locale { 
    135135                $this->weekday[6] = /* translators: weekday */ __( 'Saturday' );
    136136
    137137                // The first letter of each day.
    138                 $this->weekday_initial[ __( 'Sunday' ) ]    = /* translators: one-letter abbreviation of the weekday */ _x( 'S', 'Sunday initial' );
    139                 $this->weekday_initial[ __( 'Monday' ) ]    = /* translators: one-letter abbreviation of the weekday */ _x( 'M', 'Monday initial' );
    140                 $this->weekday_initial[ __( 'Tuesday' ) ]  = /* translators: one-letter abbreviation of the weekday */ _x( 'T', 'Tuesday initial' );
    141                 $this->weekday_initial[ __( 'Wednesday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'W', 'Wednesday initial' );
    142                 $this->weekday_initial[ __( 'Thursday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'T', 'Thursday initial' );
    143                 $this->weekday_initial[ __( 'Friday' ) ]    = /* translators: one-letter abbreviation of the weekday */ _x( 'F', 'Friday initial' );
    144                 $this->weekday_initial[ __( 'Saturday' ) ] = /* translators: one-letter abbreviation of the weekday */ _x( 'S', 'Saturday initial' );
     138                $this->weekday_initial[ $this->weekday[0] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'S', 'Sunday initial' );
     139                $this->weekday_initial[ $this->weekday[1] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'M', 'Monday initial' );
     140                $this->weekday_initial[ $this->weekday[2] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'T', 'Tuesday initial' );
     141                $this->weekday_initial[ $this->weekday[3] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'W', 'Wednesday initial' );
     142                $this->weekday_initial[ $this->weekday[4] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'T', 'Thursday initial' );
     143                $this->weekday_initial[ $this->weekday[5] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'F', 'Friday initial' );
     144                $this->weekday_initial[ $this->weekday[6] ] = /* translators: one-letter abbreviation of the weekday */ _x( 'S', 'Saturday initial' );
    145145
    146146                // Abbreviations for each day.
    147                 $this->weekday_abbrev[ __( 'Sunday' ) ]    = /* translators: three-letter abbreviation of the weekday */ __( 'Sun' );
    148                 $this->weekday_abbrev[ __( 'Monday' ) ]    = /* translators: three-letter abbreviation of the weekday */ __( 'Mon' );
    149                 $this->weekday_abbrev[ __( 'Tuesday' ) ]  = /* translators: three-letter abbreviation of the weekday */ __( 'Tue' );
    150                 $this->weekday_abbrev[ __( 'Wednesday' ) ] = /* translators: three-letter abbreviation of the weekday */ __( 'Wed' );
    151                 $this->weekday_abbrev[ __( 'Thursday' ) ] = /* translators: three-letter abbreviation of the weekday */ __( 'Thu' );
    152                 $this->weekday_abbrev[ __( 'Friday' ) ]    = /* translators: three-letter abbreviation of the weekday */ __( 'Fri' );
    153                 $this->weekday_abbrev[ __( 'Saturday' ) ] = /* translators: three-letter abbreviation of the weekday */ __( 'Sat' );
     147                $this->weekday_abbrev[ $this->weekday[0] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Sun' );
     148                $this->weekday_abbrev[ $this->weekday[1] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Mon' );
     149                $this->weekday_abbrev[ $this->weekday[2] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Tue' );
     150                $this->weekday_abbrev[ $this->weekday[3] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Wed' );
     151                $this->weekday_abbrev[ $this->weekday[4] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Thu' );
     152                $this->weekday_abbrev[ $this->weekday[5] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Fri' );
     153                $this->weekday_abbrev[ $this->weekday[6] ] = /* translators: three-letter abbreviation of the weekday */ __( 'Sat' );
    154154
    155155                // The Months
    156156                $this->month['01'] = /* translators: month name */ __( 'January' );
    class WP_Locale { 
    181181                $this->month_genitive['12'] = /* translators: month name, genitive */ _x( 'December', 'genitive' );
    182182
    183183                // Abbreviations for each month.
    184                 $this->month_abbrev[ __( 'January' ) ]  = /* translators: three-letter abbreviation of the month */ _x( 'Jan', 'January abbreviation' );
    185                 $this->month_abbrev[ __( 'February' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Feb', 'February abbreviation' );
    186                 $this->month_abbrev[ __( 'March' ) ]    = /* translators: three-letter abbreviation of the month */ _x( 'Mar', 'March abbreviation' );
    187                 $this->month_abbrev[ __( 'April' ) ]    = /* translators: three-letter abbreviation of the month */ _x( 'Apr', 'April abbreviation' );
    188                 $this->month_abbrev[ __( 'May' ) ]      = /* translators: three-letter abbreviation of the month */ _x( 'May', 'May abbreviation' );
    189                 $this->month_abbrev[ __( 'June' ) ]      = /* translators: three-letter abbreviation of the month */ _x( 'Jun', 'June abbreviation' );
    190                 $this->month_abbrev[ __( 'July' ) ]      = /* translators: three-letter abbreviation of the month */ _x( 'Jul', 'July abbreviation' );
    191                 $this->month_abbrev[ __( 'August' ) ]    = /* translators: three-letter abbreviation of the month */ _x( 'Aug', 'August abbreviation' );
    192                 $this->month_abbrev[ __( 'September' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Sep', 'September abbreviation' );
    193                 $this->month_abbrev[ __( 'October' ) ]  = /* translators: three-letter abbreviation of the month */ _x( 'Oct', 'October abbreviation' );
    194                 $this->month_abbrev[ __( 'November' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Nov', 'November abbreviation' );
    195                 $this->month_abbrev[ __( 'December' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Dec', 'December abbreviation' );
     184                $this->month_abbrev[ $this->month['01'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Jan', 'January abbreviation' );
     185                $this->month_abbrev[ $this->month['02'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Feb', 'February abbreviation' );
     186                $this->month_abbrev[ $this->month['03'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Mar', 'March abbreviation' );
     187                $this->month_abbrev[ $this->month['04'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Apr', 'April abbreviation' );
     188                $this->month_abbrev[ $this->month['05'] ] = /* translators: three-letter abbreviation of the month */ _x( 'May', 'May abbreviation' );
     189                $this->month_abbrev[ $this->month['06'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Jun', 'June abbreviation' );
     190                $this->month_abbrev[ $this->month['07'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Jul', 'July abbreviation' );
     191                $this->month_abbrev[ $this->month['08'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Aug', 'August abbreviation' );
     192                $this->month_abbrev[ $this->month['09'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Sep', 'September abbreviation' );
     193                $this->month_abbrev[ $this->month['10'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Oct', 'October abbreviation' );
     194                $this->month_abbrev[ $this->month['11'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Nov', 'November abbreviation' );
     195                $this->month_abbrev[ $this->month['12'] ] = /* translators: three-letter abbreviation of the month */ _x( 'Dec', 'December abbreviation' );
    196196
    197197                // The Meridiems
    198198                $this->meridiem['am'] = __( 'am' );
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 1796ddeded..fa8d7d1b59 100644
    a b function _post_type_meta_capabilities( $capabilities = null ) { 
    14521452 * @return object Object with all the labels as member variables.
    14531453 */
    14541454function get_post_type_labels( $post_type_object ) {
    1455         $nohier_vs_hier_defaults              = array(
    1456                 'name'                  => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ),
    1457                 'singular_name'         => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ),
    1458                 'add_new'               => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ),
    1459                 'add_new_item'          => array( __( 'Add New Post' ), __( 'Add New Page' ) ),
    1460                 'edit_item'             => array( __( 'Edit Post' ), __( 'Edit Page' ) ),
    1461                 'new_item'              => array( __( 'New Post' ), __( 'New Page' ) ),
    1462                 'view_item'             => array( __( 'View Post' ), __( 'View Page' ) ),
    1463                 'view_items'            => array( __( 'View Posts' ), __( 'View Pages' ) ),
    1464                 'search_items'          => array( __( 'Search Posts' ), __( 'Search Pages' ) ),
    1465                 'not_found'             => array( __( 'No posts found.' ), __( 'No pages found.' ) ),
    1466                 'not_found_in_trash'    => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ),
    1467                 'parent_item_colon'     => array( null, __( 'Parent Page:' ) ),
    1468                 'all_items'             => array( __( 'All Posts' ), __( 'All Pages' ) ),
    1469                 'archives'              => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
    1470                 'attributes'            => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ),
    1471                 'insert_into_item'      => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
    1472                 'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
    1473                 'featured_image'        => array( _x( 'Featured Image', 'post' ), _x( 'Featured Image', 'page' ) ),
    1474                 'set_featured_image'    => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ),
    1475                 'remove_featured_image' => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ),
    1476                 'use_featured_image'    => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
    1477                 'filter_items_list'     => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
    1478                 'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
    1479                 'items_list'            => array( __( 'Posts list' ), __( 'Pages list' ) ),
    1480         );
    1481         $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
     1455
     1456        static $nohier_vs_hier_defaults = null;
     1457
     1458        if ( null === $nohier_vs_hier_defaults ) {
     1459                $nohier_vs_hier_defaults              = array(
     1460                        'name'                  => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ),
     1461                        'singular_name'         => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ),
     1462                        'add_new'               => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ),
     1463                        'add_new_item'          => array( __( 'Add New Post' ), __( 'Add New Page' ) ),
     1464                        'edit_item'             => array( __( 'Edit Post' ), __( 'Edit Page' ) ),
     1465                        'new_item'              => array( __( 'New Post' ), __( 'New Page' ) ),
     1466                        'view_item'             => array( __( 'View Post' ), __( 'View Page' ) ),
     1467                        'view_items'            => array( __( 'View Posts' ), __( 'View Pages' ) ),
     1468                        'search_items'          => array( __( 'Search Posts' ), __( 'Search Pages' ) ),
     1469                        'not_found'             => array( __( 'No posts found.' ), __( 'No pages found.' ) ),
     1470                        'not_found_in_trash'    => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ),
     1471                        'parent_item_colon'     => array( null, __( 'Parent Page:' ) ),
     1472                        'all_items'             => array( __( 'All Posts' ), __( 'All Pages' ) ),
     1473                        'archives'              => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
     1474                        'attributes'            => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ),
     1475                        'insert_into_item'      => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
     1476                        'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
     1477                        'featured_image'        => array( _x( 'Featured Image', 'post' ), _x( 'Featured Image', 'page' ) ),
     1478                        'set_featured_image'    => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ),
     1479                        'remove_featured_image' => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ),
     1480                        'use_featured_image'    => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
     1481                        'filter_items_list'     => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
     1482                        'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
     1483                        'items_list'            => array( __( 'Posts list' ), __( 'Pages list' ) ),
     1484                );
     1485                $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
     1486        }
    14821487
    14831488        $labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
    14841489
  • src/wp-includes/taxonomy.php

    diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
    index 293b18b8b6..10f469a1b6 100644
    a b function get_taxonomy_labels( $tax ) { 
    525525                $tax->labels['not_found'] = $tax->no_tagcloud;
    526526        }
    527527
    528         $nohier_vs_hier_defaults = array(
    529                 'name'                       => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
    530                 'singular_name'              => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
    531                 'search_items'               => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
    532                 'popular_items'              => array( __( 'Popular Tags' ), null ),
    533                 'all_items'                  => array( __( 'All Tags' ), __( 'All Categories' ) ),
    534                 'parent_item'                => array( null, __( 'Parent Category' ) ),
    535                 'parent_item_colon'          => array( null, __( 'Parent Category:' ) ),
    536                 'edit_item'                  => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
    537                 'view_item'                  => array( __( 'View Tag' ), __( 'View Category' ) ),
    538                 'update_item'                => array( __( 'Update Tag' ), __( 'Update Category' ) ),
    539                 'add_new_item'               => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),
    540                 'new_item_name'              => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),
    541                 'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),
    542                 'add_or_remove_items'        => array( __( 'Add or remove tags' ), null ),
    543                 'choose_from_most_used'      => array( __( 'Choose from the most used tags' ), null ),
    544                 'not_found'                  => array( __( 'No tags found.' ), __( 'No categories found.' ) ),
    545                 'no_terms'                   => array( __( 'No tags' ), __( 'No categories' ) ),
    546                 'items_list_navigation'      => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
    547                 'items_list'                 => array( __( 'Tags list' ), __( 'Categories list' ) ),
    548                 /* translators: Tab heading when selecting from the most used terms */
    549                 'most_used'                  => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
    550                 'back_to_items'              => array( __( '← Back to Tags' ), __( '← Back to Categories' ) ),
    551         );
    552         $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
     528        static $nohier_vs_hier_defaults = null;
     529        if ( null === $nohier_vs_hier_defaults ) {
     530                $nohier_vs_hier_defaults = array(
     531                        'name'                       => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
     532                        'singular_name'              => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
     533                        'search_items'               => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
     534                        'popular_items'              => array( __( 'Popular Tags' ), null ),
     535                        'all_items'                  => array( __( 'All Tags' ), __( 'All Categories' ) ),
     536                        'parent_item'                => array( null, __( 'Parent Category' ) ),
     537                        'parent_item_colon'          => array( null, __( 'Parent Category:' ) ),
     538                        'edit_item'                  => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
     539                        'view_item'                  => array( __( 'View Tag' ), __( 'View Category' ) ),
     540                        'update_item'                => array( __( 'Update Tag' ), __( 'Update Category' ) ),
     541                        'add_new_item'               => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),
     542                        'new_item_name'              => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),
     543                        'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),
     544                        'add_or_remove_items'        => array( __( 'Add or remove tags' ), null ),
     545                        'choose_from_most_used'      => array( __( 'Choose from the most used tags' ), null ),
     546                        'not_found'                  => array( __( 'No tags found.' ), __( 'No categories found.' ) ),
     547                        'no_terms'                   => array( __( 'No tags' ), __( 'No categories' ) ),
     548                        'items_list_navigation'      => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
     549                        'items_list'                 => array( __( 'Tags list' ), __( 'Categories list' ) ),
     550                        /* translators: Tab heading when selecting from the most used terms */
     551                        'most_used'                  => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
     552                        'back_to_items'              => array( __( '← Back to Tags' ), __( '← Back to Categories' ) ),
     553                );
     554                $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
     555        }
    553556
    554557        $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
    555558
  • src/wp-includes/widgets/class-wp-widget-media.php

    diff --git a/src/wp-includes/widgets/class-wp-widget-media.php b/src/wp-includes/widgets/class-wp-widget-media.php
    index b4d3631b93..25accd298d 100644
    a b abstract class WP_Widget_Media extends WP_Widget { 
    4141         */
    4242        protected $registered = false;
    4343
     44        /**
     45         * Cache default options across all widget types
     46         *
     47         * @var array
     48         */
     49        static private $l10n_defaults;
     50
    4451        /**
    4552         * Constructor.
    4653         *
    abstract class WP_Widget_Media extends WP_Widget { 
    6471
    6572                $control_opts = wp_parse_args( $control_options, array() );
    6673
    67                 $l10n_defaults = array(
    68                         'no_media_selected'          => __( 'No media selected' ),
    69                         'add_media'                  => _x( 'Add Media', 'label for button in the media widget' ),
    70                         'replace_media'              => _x( 'Replace Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ),
    71                         'edit_media'                 => _x( 'Edit Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ),
    72                         'add_to_widget'              => __( 'Add to Widget' ),
    73                         'missing_attachment'         => sprintf(
    74                                 /* translators: %s: URL to media library */
    75                                 __( 'We can&#8217;t find that file. Check your <a href="%s">media library</a> and make sure it wasn&#8217;t deleted.' ),
    76                                 esc_url( admin_url( 'upload.php' ) )
    77                         ),
    78                         /* translators: %d: widget count */
    79                         'media_library_state_multi'  => _n_noop( 'Media Widget (%d)', 'Media Widget (%d)' ),
    80                         'media_library_state_single' => __( 'Media Widget' ),
    81                         'unsupported_file_type'      => __( 'Looks like this isn&#8217;t the correct kind of file. Please link to an appropriate file instead.' ),
    82                 );
    83                 $this->l10n = array_merge( $l10n_defaults, array_filter( $this->l10n ) );
     74                if ( null === self::$l10n_defaults ) {
     75                        self::$l10n_defaults = array(
     76                                'no_media_selected'          => __( 'No media selected' ),
     77                                'add_media'                  => _x( 'Add Media', 'label for button in the media widget' ),
     78                                'replace_media'              => _x( 'Replace Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ),
     79                                'edit_media'                 => _x( 'Edit Media', 'label for button in the media widget; should preferably not be longer than ~13 characters long' ),
     80                                'add_to_widget'              => __( 'Add to Widget' ),
     81                                'missing_attachment'         => sprintf(
     82                                        /* translators: %s: URL to media library */
     83                                        __( 'We can&#8217;t find that file. Check your <a href="%s">media library</a> and make sure it wasn&#8217;t deleted.' ),
     84                                        esc_url( admin_url( 'upload.php' ) )
     85                                ),
     86                                /* translators: %d: widget count */
     87                                'media_library_state_multi'  => _n_noop( 'Media Widget (%d)', 'Media Widget (%d)' ),
     88                                'media_library_state_single' => __( 'Media Widget' ),
     89                                'unsupported_file_type'      => __( 'Looks like this isn&#8217;t the correct kind of file. Please link to an appropriate file instead.' ),
     90                        );
     91                }
     92                $this->l10n = array_merge( self::$l10n_defaults, array_filter( $this->l10n ) );
    8493
    8594                parent::__construct(
    8695                        $id_base,