From 7560f4cf8c955eb3867b28f1657ed70b5e96c0fe Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Tue, 16 Dec 2014 22:38:52 +0000 Subject: [PATCH] Pass locale to wordpress.org theme/plugin API. In the future this will be used to return localized plugin/theme info. see #30735. git-svn-id: https://develop.svn.wordpress.org/trunk@30944 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/plugin-install.php | 12 +++++++++--- src/wp-admin/includes/theme.php | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php index 0486030342..3031341961 100644 --- a/src/wp-admin/includes/plugin-install.php +++ b/src/wp-admin/includes/plugin-install.php @@ -28,11 +28,17 @@ */ function plugins_api($action, $args = null) { - if ( is_array($args) ) - $args = (object)$args; + if ( is_array( $args ) ) { + $args = (object) $args; + } - if ( !isset($args->per_page) ) + if ( ! isset( $args->per_page ) ) { $args->per_page = 24; + } + + if ( ! isset( $args->locale ) ) { + $args->locale = get_locale(); + } /** * Override the Plugin Install API arguments. diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index 3c0c51c98e..1bc7212bb1 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/wp-admin/includes/theme.php @@ -314,13 +314,20 @@ function get_theme_feature_list( $api = true ) { * @param array|object $args Optional. Arguments to serialize for the Theme Info API. * @return mixed */ - function themes_api( $action, $args = null ) { +function themes_api( $action, $args = null ) { - if ( is_array($args) ) - $args = (object)$args; + if ( is_array( $args ) ) { + $args = (object) $args; + } - if ( !isset($args->per_page) ) + if ( ! isset( $args->per_page ) ) { $args->per_page = 24; + } + + if ( ! isset( $args->locale ) ) { + $args->locale = get_locale(); + } + /** * Filter arguments used to query for installer pages from the WordPress.org Themes API. * @@ -331,7 +338,7 @@ function get_theme_feature_list( $api = true ) { * @param object $args Arguments used to query for installer pages from the WordPress.org Themes API. * @param string $action Requested action. Likely values are 'theme_information', * 'feature_list', or 'query_themes'. - */ + */ $args = apply_filters( 'themes_api_args', $args, $action ); /**