Make WordPress Core

Ticket #34036: 34036.patch

File 34036.patch, 5.0 KB (added by ocean90, 6 years ago)
  • src/wp-admin/includes/theme.php

     
    296296}
    297297
    298298/**
    299  * Retrieve theme installer pages from WordPress Themes API.
     299 * Retrieves theme installer pages from WordPress Themes API.
    300300 *
    301301 * It is possible for a theme to override the Themes API result with three
    302302 * filters. Assume this is for themes, which can extend on the Theme Info to
    303303 * offer more choices. This is very powerful and must be used with care, when
    304304 * overriding the filters.
    305305 *
    306  * The first filter, 'themes_api_args', is for the args and gives the action as
    307  * the second parameter. The hook for 'themes_api_args' must ensure that an
    308  * object is returned.
     306 * The first filter, {@see 'themes_api_args'}, is for the args and gives the action
     307 * as the second parameter. The hook for {@see 'themes_api_args'} must ensure that
     308 * an object is returned.
    309309 *
    310  * The second filter, 'themes_api', is the result that would be returned.
     310 * The second filter, {@see 'themes_api'}, is the result that would be returned.
    311311 *
    312312 * @since 2.8.0
    313313 *
    314  * @param string       $action The requested action. Likely values are 'theme_information',
    315  *                             'feature_list', or 'query_themes'.
    316  * @param array|object $args   Optional. Arguments to serialize for the Theme Info API.
    317  * @return mixed
     314 * @param string       $action API action to perform: 'query_themes', 'theme_information',
     315 *                             'hot_tags' or 'feature_list'.
     316 * @param array|object $args   {
     317 *     Optional. Array or object of arguments to serialize for the Plugin Info API.
     318 *
     319 *     @type string  $slug     The plugin slug.
     320 *     @type int     $per_page Number of themes per page. Default 24.
     321 *     @type int     $page     Number of current page.
     322 *     @type int     $number   Number of tags to be queried.
     323 *     @type string  $search   A search term.
     324 *     @type string  $tag      Tag to filter themes.
     325 *     @type string  $author   Username of an author to filter themes.
     326 *     @type string  $user     Username to query for their favorites.
     327 *     @type string  $browse   Browse view: 'featured', 'popular', 'updated', 'favorites'.
     328 *     @type string  $locale   Locale to provide context-sensitive results. Default is the value of get_locale().
     329 *     @type array   $fields   {
     330 *         Array of fields which should or should not be returned.
     331 *
     332 *         @type bool $description        Whether to return the theme full description. Default false.
     333 *         @type bool $sections           Whether to return the theme readme sections: description, installation,
     334 *                                        FAQ, screenshots, other notes, and changelog. Default false.
     335 *         @type bool $rating             Whether to return the rating in percent and total number of ratings.
     336 *                                        Default false.
     337 *         @type bool $ratings            Whether to return the number of rating for each star (1-5). Default false.
     338 *         @type bool $downloaded         Whether to return the download count. Default false.
     339 *         @type bool $downloadlink       Whether to return the download link for the package. Default false.
     340 *         @type bool $last_updated       Whether to return the date of the last update. Default false.
     341 *         @type bool $tags               Whether to return the assigned tags. Default false.
     342 *         @type bool $homepage           Whether to return the theme homepage link. Default false.
     343 *         @type bool $screenshots        Whether to return the screenshots. Default false.
     344 *         @type int  $screenshot_count   Number of screenshots to return. Default 1.
     345 *         @type bool $screenshot_url     Whether to return the URL of the first screenshot. Default false.
     346 *         @type bool $photon_screenshots Whether to return the screenshots via Photon. Default false.
     347 *         @type bool $template           Whether to return the slug of the parent theme. Default false.
     348 *         @type bool $parent             Whether to return the slug, name and homepage of the parent theme. Default false.
     349 *         @type bool $versions           Whether to return the list of all available versions. Default false.
     350 *         @type bool $theme_url          Whether to return theme's URL. Default false.
     351 *         @type bool $extended_author    Whether to return nicename or nicename and display name. Default false.
     352 *     }
     353 * }
     354 * @return object|WP_Error Response object on success, WP_Error on failure. See the
     355 *         {@link https://developer.wordpress.org/reference/functions/themes_api/ function reference article}
     356 *         for more information on the make-up of possible return objects depending on the value of `$action`.
    318357 */
    319 function themes_api( $action, $args = null ) {
     358function themes_api( $action, $args = array() ) {
    320359
    321360        if ( is_array( $args ) ) {
    322361                $args = (object) $args;