Changeset 25536
- Timestamp:
- 09/21/2013 04:07:34 AM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r25520 r25536 628 628 629 629 /** 630 * Get installed language data.630 * Get installed translations. 631 631 * 632 632 * Looks in the wp-content/languages directory for translations of … … 638 638 * @return array Array of language data. 639 639 */ 640 function wp_get_installed_ language_data( $type ) {640 function wp_get_installed_translations( $type ) { 641 641 if ( $type !== 'themes' && $type !== 'plugins' ) 642 642 return array(); -
trunk/src/wp-includes/update.php
r25520 r25536 147 147 148 148 $plugins = get_plugins(); 149 $ languages = wp_get_installed_language_data( 'plugins' );149 $translations = wp_get_installed_translations( 'plugins' ); 150 150 151 151 $active = get_option( 'active_plugins', array() ); … … 203 203 $options = array( 204 204 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), 205 'body' => array( 'plugins' => json_encode( $to_send ), 'languages' => json_encode( $languages ) ), 205 'body' => array( 206 'plugins' => json_encode( $to_send ), 207 'translations' => json_encode( $translations ), 208 'locale' => json_encode( array( get_locale() ) ), // @todo filter. 209 ), 206 210 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 207 211 ); … … 216 220 return false; 217 221 218 $response = json_decode( wp_remote_retrieve_body( $raw_response ) ); 219 220 if ( is_object( $response ) ) 221 $new_option->response = (array) $response->plugins; 222 else 222 $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); 223 foreach ( $response['plugins'] as &$plugin ) { 224 $plugin = (object) $plugin; 225 } 226 unset( $plugin ); 227 228 if ( is_array( $response ) ) { 229 $new_option->response = $response['plugins']; 230 $new_option->translations = $response['translations']; 231 } else { 223 232 $new_option->response = array(); 233 } 224 234 225 235 set_site_transient( 'update_plugins', $new_option ); … … 246 256 247 257 $installed_themes = wp_get_themes(); 248 $ languages = wp_get_installed_language_data( 'themes' );258 $translations = wp_get_installed_translations( 'themes' ); 249 259 250 260 $last_update = get_site_transient( 'update_themes' ); … … 315 325 $options = array( 316 326 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), 317 'body' => array( 'themes' => json_encode( $request ), 'languages' => json_encode( $languages ) ), 327 'body' => array( 328 'themes' => json_encode( $request ), 329 'translations' => json_encode( $translations ), 330 'locale' => json_encode( array( get_locale() ) ), // @todo filter. 331 ), 318 332 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) 319 333 ); … … 334 348 $response = json_decode( wp_remote_retrieve_body( $raw_response ), true ); 335 349 336 if ( is_array( $response ) ) 337 $new_update->response = $response['themes']; 350 if ( is_array( $response ) ) { 351 $new_update->response = $response['themes']; 352 $new_update->translations = $response['translations']; 353 } 338 354 339 355 set_site_transient( 'update_themes', $new_update );
Note: See TracChangeset
for help on using the changeset viewer.