Make WordPress Core

Ticket #49223: 49223.patch

File 49223.patch, 14.0 KB (added by passoniate, 5 years ago)

Patch

  • wp-admin/includes/meta-boxes.php

     
    462462                        if ( ! $post_format ) {
    463463                                $post_format = '0';
    464464                        }
    465                         // Add in the current one if it isn't there yet, in case the current theme doesn't support it
     465                        // Add in the current one if it isn't there yet, in case the current theme doesn't support it.
    466466                        if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) {
    467467                                $post_formats[0][] = $post_format;
    468468                        }
     
    941941<p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p>
    942942                        <?php echo $pages; ?>
    943943                        <?php
    944                 endif; // end empty pages check
    945         endif;  // end hierarchical check.
     944                endif; // End empty pages check.
     945        endif;  // End hierarchical check.
    946946
    947947        if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) :
    948948                $template = ! empty( $post->page_template ) ? $post->page_template : false;
     
    14131413
    14141414                // We should aim to show the revisions meta box only when there are revisions.
    14151415                if ( count( $revisions ) > 1 ) {
    1416                         reset( $revisions ); // Reset pointer for key()
     1416                        reset( $revisions ); // Reset pointer for key().
    14171417                        $publish_callback_args = array(
    14181418                                'revisions_count'        => count( $revisions ),
    14191419                                'revision_id'            => key( $revisions ),
     
    14401440                add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
    14411441        }
    14421442
    1443         // all taxonomies
     1443        // All taxonomies.
    14441444        foreach ( get_object_taxonomies( $post ) as $tax_name ) {
    14451445                $taxonomy = get_taxonomy( $tax_name );
    14461446                if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) {
  • wp-admin/includes/misc.php

     
    178178                $lines[] = rtrim( fgets( $fp ), "\r\n" );
    179179        }
    180180
    181         // Split out the existing file into the preceding lines, and those that appear after the marker
     181        // Split out the existing file into the preceding lines, and those that appear after the marker.
    182182        $pre_lines        = array();
    183183        $post_lines       = array();
    184184        $existing_lines   = array();
     
    201201                }
    202202        }
    203203
    204         // Check to see if there was a change
     204        // Check to see if there was a change.
    205205        if ( $existing_lines === $insertion ) {
    206206                flock( $fp, LOCK_UN );
    207207                fclose( $fp );
     
    209209                return true;
    210210        }
    211211
    212         // Generate the new file data
     212        // Generate the new file data.
    213213        $new_file_data = implode(
    214214                "\n",
    215215                array_merge(
     
    221221                )
    222222        );
    223223
    224         // Write to the start of the file, and truncate it to that length
     224        // Write to the start of the file, and truncate it to that length.
    225225        fseek( $fp, 0 );
    226226        $bytes = fwrite( $fp, $new_file_data );
    227227        if ( $bytes ) {
     
    296296        $home_path       = get_home_path();
    297297        $web_config_file = $home_path . 'web.config';
    298298
    299         // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
     299        // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP.
    300300        if ( iis7_supports_permalinks() && ( ( ! file_exists( $web_config_file ) && win_is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable( $web_config_file ) ) ) {
    301301                $rule = $wp_rewrite->iis7_url_rewrite_rules( false );
    302302                if ( ! empty( $rule ) ) {
     
    598598                }
    599599
    600600                if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
    601                         // If it's a function or class defined locally, there's not going to be any docs available
     601                        // If it's a function or class defined locally, there's not going to be any docs available.
    602602                        if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) {
    603603                                $ignore_functions[] = $tokens[ $t ][1];
    604604                        }
    605                         // Add this to our stack of unique references
     605                        // Add this to our stack of unique references.
    606606                        $functions[] = $tokens[ $t ][1];
    607607                }
    608608        }
     
    673673                        case 'plugins_per_page':
    674674                        case 'export_personal_data_requests_per_page':
    675675                        case 'remove_personal_data_requests_per_page':
    676                                 // Network admin
     676                                // Network admin.
    677677                        case 'sites_network_per_page':
    678678                        case 'users_network_per_page':
    679679                        case 'site_users_network_per_page':
     
    817817
    818818        $xpath = new DOMXPath( $doc );
    819819
    820         // First check if the rule already exists as in that case there is no need to re-add it
     820        // First check if the rule already exists as in that case there is no need to re-add it.
    821821        $wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' );
    822822        if ( $wordpress_rules->length > 0 ) {
    823823                return true;
    824824        }
    825825
    826         // Check the XPath to the rewrite rule and create XML nodes if they do not exist
     826        // Check the XPath to the rewrite rule and create XML nodes if they do not exist.
    827827        $xmlnodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' );
    828828        if ( $xmlnodes->length > 0 ) {
    829829                $rules_node = $xmlnodes->item( 0 );
  • wp-admin/includes/ms-admin-filters.php

     
    1010// Media Hooks.
    1111add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
    1212
    13 // User Hooks
     13// User Hooks.
    1414add_action( 'user_admin_notices', 'new_user_email_admin_notice' );
    1515add_action( 'network_admin_notices', 'new_user_email_admin_notice' );
    1616
     
    1919// Site Hooks.
    2020add_action( 'wpmueditblogaction', 'upload_space_setting' );
    2121
    22 // Network hooks
     22// Network hooks.
    2323add_action( 'update_site_option_admin_email', 'wp_network_admin_email_change_notification', 10, 4 );
    2424
    25 // Taxonomy Hooks
     25// Taxonomy Hooks.
    2626add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 );
    2727
    2828// Post Hooks.
     
    3131// Tools Hooks.
    3232add_filter( 'import_allow_create_users', 'check_import_new_users' );
    3333
    34 // Notices Hooks
     34// Notices Hooks.
    3535add_action( 'admin_notices', 'site_admin_notice' );
    3636add_action( 'network_admin_notices', 'site_admin_notice' );
    3737
    38 // Update Hooks
     38// Update Hooks.
    3939add_action( 'network_admin_notices', 'update_nag', 3 );
    4040add_action( 'network_admin_notices', 'maintenance_nag', 10 );
    4141
    42 // Network Admin Hooks
     42// Network Admin Hooks.
    4343add_action( 'add_site_option_new_admin_email', 'update_network_option_new_admin_email', 10, 2 );
    4444add_action( 'update_site_option_new_admin_email', 'update_network_option_new_admin_email', 10, 2 );
  • wp-admin/includes/ms.php

     
    2020                return $file;
    2121        }
    2222
    23         if ( $file['error'] != '0' ) { // there's already an error
     23        if ( $file['error'] != '0' ) { // There's already an error.
    2424                return $file;
    2525        }
    2626
     
    220220
    221221        $space_allowed = get_space_allowed();
    222222        if ( ! is_numeric( $space_allowed ) ) {
    223                 $space_allowed = 10; // Default space allowed is 10 MB
     223                $space_allowed = 10; // Default space allowed is 10 MB.
    224224        }
    225225        $space_used = get_space_used();
    226226
     
    644644        foreach ( (array) $lang_files as $val ) {
    645645                $code_lang = basename( $val, '.mo' );
    646646
    647                 if ( $code_lang == 'en_US' ) { // American English
     647                if ( $code_lang == 'en_US' ) { // American English.
    648648                        $flag          = true;
    649649                        $ae            = __( 'American English' );
    650650                        $output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
    651                 } elseif ( $code_lang == 'en_GB' ) { // British English
     651                } elseif ( $code_lang == 'en_GB' ) { // British English.
    652652                        $flag          = true;
    653653                        $be            = __( 'British English' );
    654654                        $output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
     
    658658                }
    659659        }
    660660
    661         if ( $flag === false ) { // WordPress english
     661        if ( $flag === false ) { // WordPress English.
    662662                $output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>';
    663663        }
    664664
    665         // Order by name
     665        // Order by name.
    666666        uksort( $output, 'strnatcasecmp' );
    667667
    668668        /**
     
    10671067                )
    10681068        );
    10691069
    1070         // Parse arguments
     1070        // Parse arguments.
    10711071        $parsed_args = wp_parse_args(
    10721072                $args,
    10731073                array(
     
    10771077                )
    10781078        );
    10791079
    1080         // Setup the links array
     1080        // Setup the links array.
    10811081        $screen_links = array();
    10821082
    1083         // Loop through tabs
     1083        // Loop through tabs.
    10841084        foreach ( $parsed_args['links'] as $link_id => $link ) {
    10851085
    1086                 // Skip link if user can't access
     1086                // Skip link if user can't access.
    10871087                if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) {
    10881088                        continue;
    10891089                }
    10901090
    1091                 // Link classes
     1091                // Link classes.
    10921092                $classes = array( 'nav-tab' );
    10931093
    10941094                // Aria-current attribute.
    10951095                $aria_current = '';
    10961096
    1097                 // Selected is set by the parent OR assumed by the $pagenow global
     1097                // Selected is set by the parent OR assumed by the $pagenow global.
    10981098                if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
    10991099                        $classes[]    = 'nav-tab-active';
    11001100                        $aria_current = ' aria-current="page"';
    11011101                }
    11021102
    1103                 // Escape each class
     1103                // Escape each class.
    11041104                $esc_classes = implode( ' ', $classes );
    11051105
    1106                 // Get the URL for this link
     1106                // Get the URL for this link.
    11071107                $url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) );
    11081108
    1109                 // Add link to nav links
     1109                // Add link to nav links.
    11101110                $screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html( $link['label'] ) . '</a>';
    11111111        }
    11121112
  • wp-admin/includes/nav-menu.php

     
    143143        add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
    144144        wp_nav_menu_taxonomy_meta_boxes();
    145145
    146         // Register advanced menu items (columns)
     146        // Register advanced menu items (columns).
    147147        add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
    148148
    149149        // If first time editing, disable advanced items by default.
     
    422422                }
    423423        }
    424424
    425         // @todo transient caching of these results with proper invalidation on updating of a post of this type
     425        // @todo transient caching of these results with proper invalidation on updating of a post of this type.
    426426        $get_posts = new WP_Query;
    427427        $posts     = $get_posts->query( $args );
    428428
     
    11421142        );
    11431143        $messages            = array();
    11441144        $menu_items          = array();
    1145         // Index menu items by db ID
     1145        // Index menu items by db ID.
    11461146        foreach ( $unsorted_menu_items as $_item ) {
    11471147                $menu_items[ $_item->db_id ] = $_item;
    11481148        }
     
    11641164        );
    11651165
    11661166        wp_defer_term_counting( true );
    1167         // Loop through all the menu items' POST variables
     1167        // Loop through all the menu items' POST variables.
    11681168        if ( ! empty( $_POST['menu-item-db-id'] ) ) {
    11691169                foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
    11701170
    1171                         // Menu item title can't be blank
     1171                        // Menu item title can't be blank.
    11721172                        if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] ) {
    11731173                                continue;
    11741174                        }
     
    11881188                }
    11891189        }
    11901190
    1191         // Remove menu items from the menu that weren't in $_POST
     1191        // Remove menu items from the menu that weren't in $_POST.
    11921192        if ( ! empty( $menu_items ) ) {
    11931193                foreach ( array_keys( $menu_items ) as $menu_item_id ) {
    11941194                        if ( is_nav_menu_item( $menu_item_id ) ) {
     
    12131213                        unset( $nav_menu_option['auto_add'][ $key ] );
    12141214                }
    12151215        }
    1216         // Remove nonexistent/deleted menus
     1216        // Remove nonexistent/deleted menus.
    12171217        $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
    12181218        update_option( 'nav_menu_options', $nav_menu_option );
    12191219
  • wp-admin/includes/network.php

     
    181181
    182182        if ( isset( $_POST['subdomain_install'] ) ) {
    183183                $subdomain_install = (bool) $_POST['subdomain_install'];
    184         } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // assume nothing
     184        } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing.
    185185                $subdomain_install = true;
    186186        } elseif ( ! allow_subdirectory_install() ) {
    187187                $subdomain_install = true;
     
    188188        } else {
    189189                $subdomain_install = false;
    190190                $got_mod_rewrite   = got_mod_rewrite();
    191                 if ( $got_mod_rewrite ) { // dangerous assumptions
     191                if ( $got_mod_rewrite ) { // Dangerous assumptions.
    192192                        echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
    193193                        printf(
    194194                                /* translators: %s: mod_rewrite */
     
    206206                        echo '</p>';
    207207                }
    208208
    209                 if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache)
     209                if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
    210210                        echo '<p>';
    211211                        printf(
    212212                                /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
     
    547547                </li>
    548548        <?php
    549549        if ( iis7_supports_permalinks() ) :
    550                 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us
     550                // IIS doesn't support RewriteBase, all your RewriteBase are belong to us.
    551551                $iis_subdir_match       = ltrim( $base, '/' ) . $subdir_match;
    552552                $iis_rewrite_base       = ltrim( $base, '/' ) . $rewrite_base;
    553553                $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';