Make WordPress Core

Ticket #31259: 31259.patch

File 31259.patch, 8.2 KB (added by SergeyBiryukov, 10 years ago)
  • src/wp-admin/includes/ajax-actions.php

     
    10911091                        }
    10921092
    10931093                        $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
    1094                         $_menu_item = array_shift( $_menu_items );
     1094                        $_menu_item = current( $_menu_items );
    10951095
    10961096                        // Restore the missing menu item properties
    10971097                        $menu_item_data['menu-item-description'] = $_menu_item->description;
     
    17931793                if ( !$multi_number )
    17941794                        wp_die( $error );
    17951795
    1796                 $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) );
     1796                $_POST[ 'widget-' . $id_base ] = array( $multi_number => current( $settings ) );
    17971797                $widget_id = $id_base . '-' . $multi_number;
    17981798                $sidebar[] = $widget_id;
    17991799        }
  • src/wp-admin/includes/class-wp-upgrader.php

     
    19041904                                break;
    19051905                        case 'plugin':
    19061906                                $plugin_data = get_plugins( '/' . $update->slug );
    1907                                 $plugin_data = array_shift( $plugin_data );
     1907                                $plugin_data = current( $plugin_data );
    19081908                                if ( $plugin_data )
    19091909                                        return $plugin_data['Name'];
    19101910                                break;
  • src/wp-admin/includes/media.php

     
    617617        $errors = null;
    618618
    619619        if ( isset($_POST['send']) ) {
    620                 $keys = array_keys($_POST['send']);
    621                 $send_id = (int) array_shift($keys);
     620                $keys = array_keys( $_POST['send'] );
     621                $send_id = (int) current( $keys );
    622622        }
    623623
    624624        if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
     
    13461346
    13471347        $post_mime_types = get_post_mime_types();
    13481348        $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
    1349         $type = array_shift( $keys );
     1349        $type = current( $keys );
    13501350        $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    13511351
    13521352        $form_fields = get_attachment_fields_to_edit( $post, $r['errors'] );
  • src/wp-admin/includes/menu.php

     
    9494        if ( empty($submenu[$data[2]]) )
    9595                continue;
    9696        $subs = $submenu[$data[2]];
    97         $first_sub = array_shift($subs);
     97        $first_sub = current($subs);
    9898        $old_parent = $data[2];
    9999        $new_parent = $first_sub[2];
    100100        /*
     
    163163         */
    164164        if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
    165165                $subs = $submenu[$data[2]];
    166                 $first_sub = array_shift($subs);
     166                $first_sub = current($subs);
    167167                if ( $data[2] == $first_sub[2] )
    168168                        unset( $submenu[$data[2]] );
    169169        }
  • src/wp-admin/includes/ms.php

     
    795795                        </select>
    796796                        <?php
    797797                        if ( !$found ) {
    798                                 $blog = array_shift( $all_blogs );
     798                                $blog = current( $all_blogs );
    799799                                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
    800800                        }
    801801                } elseif ( count( $all_blogs ) == 1 ) {
    802                         $blog = array_shift( $all_blogs );
     802                        $blog = current( $all_blogs );
    803803                        echo $blog->domain;
    804804                        if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
    805805                                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
  • src/wp-admin/includes/plugin-install.php

     
    304304                                        $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
    305305                        } else {
    306306                                $key = array_keys( $installed_plugin );
    307                                 $key = array_shift( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
     307                                $key = current( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
    308308                                $update_file = $api->slug . '/' . $key;
    309309                                if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
    310310                                        $status = 'latest_installed';
     
    391391        $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
    392392        if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
    393393                $section_titles = array_keys( (array) $api->sections );
    394                 $section = array_shift( $section_titles );
     394                $section = current( $section_titles );
    395395        }
    396396
    397397        iframe_header( __( 'Plugin Install' ) );
  • src/wp-admin/user-edit.php

     
    326326<?php
    327327// Compare user role against currently editable roles
    328328$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
    329 $user_role  = array_shift( $user_roles );
     329$user_role  = current( $user_roles );
    330330
    331331// print the full list of roles with the primary one selected.
    332332wp_dropdown_roles($user_role);
  • src/wp-admin/widgets.php

     
    189189        if ( isset($_GET['addnew']) ) {
    190190                // Default to the first sidebar
    191191                $keys = array_keys( $wp_registered_sidebars );
    192                 $sidebar = array_shift( $keys );
     192                $sidebar = current( $keys );
    193193
    194194                if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget
    195195                        // Copy minimal info from an existing instance of this widget to a new instance
  • src/wp-includes/pomo/streams.php

     
    4040                        return false;
    4141                $endian_letter = ('big' == $this->endian)? 'N' : 'V';
    4242                $int = unpack($endian_letter, $bytes);
    43                 return array_shift($int);
     43                return current($int);
    4444        }
    4545
    4646        /**
  • src/wp-includes/post-formats.php

     
    2626        if ( empty( $_format ) )
    2727                return false;
    2828
    29         $format = array_shift( $_format );
     29        $format = current( $_format );
    3030
    3131        return str_replace('post-format-', '', $format->slug );
    3232}
  • src/wp-includes/post.php

     
    45684568        }
    45694569
    45704570        if ( 1 == count( $post_status ) ) {
    4571                 $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $r['post_type'], array_shift( $post_status ) );
     4571                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $r['post_type'], current( $post_status ) );
    45724572        } else {
    45734573                $post_status = implode( "', '", $post_status );
    45744574                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $r['post_type'] );
  • src/wp-includes/query.php

     
    46714671                if ( is_array( $post_type ) ) {
    46724672                        if ( count( $post_type ) > 1 )
    46734673                                return;
    4674                         $post_type = array_shift( $post_type );
     4674                        $post_type = current( $post_type );
    46754675                }
    46764676
    46774677                // Do not attempt redirect for hierarchical post types