WordPress.org

Make WordPress Core

Ticket #25732: 25732.diff

File 25732.diff, 2.9 KB (added by DrewAPicture, 6 years ago)

Reworked descriptions + parameters.

  • src/wp-admin/includes/theme.php

     
    266266 *
    267267 * @since 2.8.0
    268268 *
    269  * @param string $action
    270  * @param array|object $args Optional. Arguments to serialize for the Theme Info API.
     269 * @param string       $action The requested action. Likely values are 'theme_information',
     270 *                             'feature_list', or 'query_themes'.
     271 * @param array|object $args   Optional. Arguments to serialize for the Theme Info API.
    271272 * @return mixed
    272273 */
    273 function themes_api($action, $args = null) {
     274function themes_api( $action, $args = null ) {
    274275
    275276        if ( is_array($args) )
    276277                $args = (object)$args;
    277278
    278279        if ( !isset($args->per_page) )
    279280                $args->per_page = 24;
     281        /**
     282         * Filter arguments used to query for installer pages from the WordPress.org Themes API.
     283         *
     284         * Important: An object MUST be returned to this filter.
     285         *
     286         * @since 2.8.0
     287         *
     288         * @param object $args   Arguments to query for installer pages from the WordPress.org Themes API.
     289         * @param string $action Requested action. Likely values are 'theme_information',
     290         *                       'feature_list', or 'query_themes'.
     291        */
     292        $args = apply_filters( 'themes_api_args', $args, $action );
     293       
     294        /**
     295         * Filter whether to override the WordPress.org Themes API.
     296         *
     297         * Returning a value of true to this filter allows a theme to completely
     298         * override the built-in WordPress.org API.
     299         *
     300         * @since 2.8.0
     301         *
     302         * @param bool   $bool   Whether to override the WordPress.org Themes API. Default false.
     303         * @param string $action Requested action. Likely values are 'theme_information',
     304         *                       'feature_list', or 'query_themes'.
     305         * @param object $args   Arguments to query for installer pages from the Themes API.
     306         */
     307        $res = apply_filters( 'themes_api', false, $action, $args );
    280308
    281         $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
    282         $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.
    283 
    284309        if ( ! $res ) {
    285310                $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/';
    286311                if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
     
    308333                }
    309334        }
    310335
    311         return apply_filters('themes_api_result', $res, $action, $args);
     336        /**
     337         * Filter the WordPress.org Themes API installer pages result.
     338         *
     339         * @since 2.8.0
     340         *
     341         * @param array|object $res    Response array or object.
     342         * @param string       $action Requested action. Likely values are 'theme_information',
     343         *                             'feature_list', or 'query_themes'.
     344         * @param object       $args   Arguments used to query for installer pages from the Themes API.
     345         */
     346        return apply_filters( 'themes_api_result', $res, $action, $args );
    312347}