From 3a26e383aebe3cbcb8966092ee99baf507c5a87b Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 27 Oct 2013 22:45:32 +0000 Subject: [PATCH] Inline documentation for hooks in wp-admin/includes/theme.php. Props l10n for the initial patch. Fixes #25732. git-svn-id: https://develop.svn.wordpress.org/trunk@25961 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/theme.php | 49 ++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index 9ea69f2faa..ccfad6b169 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/wp-admin/includes/theme.php @@ -266,20 +266,45 @@ function get_theme_feature_list( $api = true ) { * * @since 2.8.0 * - * @param string $action - * @param array|object $args Optional. Arguments to serialize for the Theme Info API. + * @param string $action The requested action. Likely values are 'theme_information', + * 'feature_list', or 'query_themes'. + * @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 ( !isset($args->per_page) ) $args->per_page = 24; - - $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter. - $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API. + /** + * Filter arguments used to query for installer pages from the WordPress.org Themes API. + * + * Important: An object MUST be returned to this filter. + * + * @since 2.8.0 + * + * @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 ); + + /** + * Filter whether to override the WordPress.org Themes API. + * + * Returning a value of true to this filter allows a theme to completely + * override the built-in WordPress.org API. + * + * @since 2.8.0 + * + * @param bool $bool Whether to override the WordPress.org Themes API. Default false. + * @param string $action Requested action. Likely values are 'theme_information', + * 'feature_list', or 'query_themes'. + * @param object $args Arguments used to query for installer pages from the Themes API. + */ + $res = apply_filters( 'themes_api', false, $action, $args ); if ( ! $res ) { $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/'; @@ -308,5 +333,15 @@ function themes_api($action, $args = null) { } } - return apply_filters('themes_api_result', $res, $action, $args); + /** + * Filter the returned WordPress.org Themes API response. + * + * @since 2.8.0 + * + * @param array|object $res WordPress.org Themes API response. + * @param string $action Requested action. Likely values are 'theme_information', + * 'feature_list', or 'query_themes'. + * @param object $args Arguments used to query for installer pages from the WordPress.org Themes API. + */ + return apply_filters( 'themes_api_result', $res, $action, $args ); }