From 7149ae3b9f5de7215c6230f8a7649dff08d52019 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 28 Sep 2013 04:17:54 +0000 Subject: [PATCH] Filters for locale in wp_update_plugins() and wp_update_themes(). see #18200. git-svn-id: https://develop.svn.wordpress.org/trunk@25634 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/update.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php index d98ed37a2b..9cfa5a7368 100644 --- a/src/wp-includes/update.php +++ b/src/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' ) );