WordPress.org

Make WordPress Core

Changeset 29016


Ignore:
Timestamp:
07/07/14 18:05:13 (3 years ago)
Author:
johnbillion
Message:

Correct the usage of the variable passed to wp_install_download_language_pack() and kill an unused local variable. Props michalzuber. Also avoid using the $_REQUEST superglobal in this function. See #28577.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r29006 r29016  
    22112211} 
    22122212 
    2213 function wp_install_download_language_pack( $language ) { 
     2213/** 
     2214 * [wp_install_download_language_pack description] 
     2215 *  
     2216 * @param  string $lang [description] 
     2217 * @return string|false [description] 
     2218 */ 
     2219function wp_install_download_language_pack( $lang ) { 
    22142220    // Check if the language is already installed. 
    22152221    $available_languages = get_available_languages(); 
    2216     if ( in_array( $language->language, $available_languages ) ) { 
    2217         return $language->language; 
     2222    if ( in_array( $lang, $available_languages ) ) { 
     2223        return $lang; 
    22182224    } 
    22192225 
     
    22232229    if ( $body ) { 
    22242230        foreach ( $body['languages'] as $language ) { 
    2225             if ( $language['language'] === $_REQUEST['language'] ) { 
    2226                 $loading_language = $_REQUEST['language']; 
     2231            if ( $language['language'] === $lang ) { 
     2232                $loading_language = $lang; 
    22272233                break; 
    22282234            } 
     
    22382244    $skin = new Automatic_Upgrader_Skin; 
    22392245    $upgrader = new Language_Pack_Upgrader( $skin ); 
    2240     $options = array( 'clear_update_cache' => false ); 
    22412246    $language->type = 'core'; 
    22422247    /** 
Note: See TracChangeset for help on using the changeset viewer.