From f0923464654029d4a680dc42f9fb7b7c05b2d022 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 28 Sep 2013 04:18:12 +0000 Subject: [PATCH] Filters for locale in wp_update_plugins() and wp_update_themes(). see #18200. Built from https://develop.svn.wordpress.org/trunk@25634 git-svn-id: http://core.svn.wordpress.org/trunk@25551 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/update.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/wp-includes/update.php b/wp-includes/update.php index d98ed37a2b..9cfa5a7368 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -203,12 +203,21 @@ function wp_update_plugins() { $to_send = compact( 'plugins', 'active' ); + /** + * Filter the locales requested for plugin translations. + * + * @since 3.7.0 + * + * @param array $locales Defaults to the current locale of the site. + */ + $locales = apply_filters( 'plugins_update_check_locales', array( get_locale() ) ); + $options = array( 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), 'body' => array( 'plugins' => json_encode( $to_send ), 'translations' => json_encode( $translations ), - 'locale' => json_encode( array( get_locale() ) ), // @todo filter. + 'locale' => json_encode( $locales ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ); @@ -329,12 +338,21 @@ function wp_update_themes() { $request['themes'] = $themes; + /** + * Filter the locales requested for theme translations. + * + * @since 3.7.0 + * + * @param array $locales Defaults to the current locale of the site. + */ + $locales = apply_filters( 'themes_update_check_locales', array( get_locale() ) ); + $options = array( 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3), 'body' => array( 'themes' => json_encode( $request ), 'translations' => json_encode( $translations ), - 'locale' => json_encode( array( get_locale() ) ), // @todo filter. + 'locale' => json_encode( $locales ), ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );