Changeset 25652
- Timestamp:
- 09/30/2013 07:46:15 PM (12 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
-
l10n.php (modified) (2 diffs)
-
update.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r25586 r25652 746 746 * @since 3.7.0 747 747 * 748 * @param string $type What to search for. Accepts 'plugins', 'themes' .748 * @param string $type What to search for. Accepts 'plugins', 'themes', 'core'. 749 749 * @return array Array of language data. 750 750 */ 751 751 function wp_get_installed_translations( $type ) { 752 if ( $type !== 'themes' && $type !== 'plugins' )752 if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' ) 753 753 return array(); 754 754 755 if ( ! is_dir( WP_LANG_DIR ) || ! is_dir( WP_LANG_DIR . "/$type" ) ) 755 $dir = 'core' === $type ? '' : "/$type"; 756 757 if ( ! is_dir( WP_LANG_DIR ) ) 756 758 return array(); 757 759 758 $files = scandir( WP_LANG_DIR . "/$type" ); 760 if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) ) 761 return array(); 762 763 $files = scandir( WP_LANG_DIR . $dir ); 759 764 if ( ! $files ) 760 765 return array(); … … 767 772 if ( substr( $file, -3 ) !== '.po' ) 768 773 continue; 769 if ( ! preg_match( '/( .*)-([A-Za-z_]{2,6}).po/', $file, $match ) )774 if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) 770 775 continue; 771 776 772 777 list( , $textdomain, $language ) = $match; 773 $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "/$type/$file" ); 778 if ( '' === $textdomain ) 779 $textdomain = 'default'; 780 $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" ); 774 781 } 775 782 return $language_data; -
trunk/src/wp-includes/update.php
r25649 r25652 29 29 30 30 $current = get_site_transient( 'update_core' ); 31 $translations = wp_get_installed_translations( 'core' ); 32 31 33 if ( ! is_object($current) ) { 32 34 $current = new stdClass; … … 86 88 'wp_install' => $wp_install, 87 89 'wp_blog' => home_url( '/' ) 88 ) 90 ), 91 'body' => array( 92 'translations' => json_encode( $translations ), 93 ), 89 94 ); 90 95 91 $response = wp_remote_ get($url, $options);96 $response = wp_remote_post( $url, $options ); 92 97 93 98 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) … … 120 125 $updates->last_checked = time(); 121 126 $updates->version_checked = $wp_version; 127 128 if ( isset( $body['translations'] ) ) 129 $updates->translations = $body['translations']; 130 122 131 set_site_transient( 'update_core', $updates); 123 132 }
Note: See TracChangeset
for help on using the changeset viewer.