WordPress.org

Make WordPress Core

Ticket #34035: 34035.3.patch

File 34035.3.patch, 5.2 KB (added by DrewAPicture, 4 years ago)
  • src/wp-admin/includes/plugin-install.php

     
    77 */
    88
    99/**
    10  * Retrieve plugin installer pages from WordPress Plugins API.
     10 * Retrieves plugin installer pages from WordPress Plugins API.
    1111 *
    1212 * It is possible for a plugin to override the Plugin API result with three
    1313 * filters. Assume this is for plugins, which can extend on the Plugin Info to
    14  * offer more choices. This is very powerful and must be used with care, when
     14 * offer more choices. This is very powerful and must be used with care when
    1515 * overriding the filters.
    1616 *
    17  * The first filter, 'plugins_api_args', is for the args and gives the action as
    18  * the second parameter. The hook for 'plugins_api_args' must ensure that an
    19  * object is returned.
     17 * The first filter, {@see 'plugins_api_args'}, is for the args and gives the action
     18 * as the second parameter. The hook for {@see 'plugins_api_args'} must ensure that
     19 * an object is returned.
    2020 *
    21  * The second filter, 'plugins_api', is the result that would be returned.
     21 * The second filter, {@see 'plugins_api'}, is the result that would be returned.
    2222 *
    2323 * @since 2.7.0
    2424 *
    25  * @param string $action
    26  * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
    27  * @return object plugins_api response object on success, WP_Error on failure.
     25 * @param string       $action API action to perform: 'query_plugins', 'plugin_information',
     26 *                             'hot_tags' or 'hot_categories'.
     27 * @param array|object $args   {
     28 *     Optional. Array or object of arguments to serialize for the Plugin Info API.
     29 *
     30 *     @type string  $slug     The plugin slug.
     31 *     @type int     $per_page Number of plugins per page. Default 24.
     32 *     @type int     $number   Number of tags or categories to be queried.
     33 *     @type string  $locale   Locale to provide context-sensitive results. Default is the value of get_locale().
     34 *     @type bool    $is_ssl   Whether links should be returned with https or not. Default false.
     35 *     @type array   $fields   {
     36 *         Array of fields which should or should not be returned.
     37 *
     38 *         @type bool $short_description Whether to return the plugin short description. Default true.
     39 *         @type bool $description       Whether to return the plugin full description. Default false.
     40 *         @type bool $sections          Whether to return the plugin readme sections: description, installation,
     41 *                                       faq, screenshots, other notes, and changelog. Default false.
     42 *         @type bool $tested            Whether to return the 'compatible up to' value. Default true.
     43 *         @type bool $requires          Whether to return the required WordPress version. Default true.
     44 *         @type bool $rating            Whether to return the rating in percent and total number of ratings.
     45 *                                       Default true.
     46 *         @type bool $ratings           Whether to return the number of rating for each star (1-5). Default true.
     47 *         @type bool $downloaded        Whether to return the download count. Default true.
     48 *         @type bool $downloadlink      Whether to return the download link for the package. Default true.
     49 *         @type bool $last_updated      Whether to return the date of the last update. Default true.
     50 *         @type bool $added             Whether to return the date when the plugin was added to the wordpress.org
     51 *                                       repo. Default true.
     52 *         @type bool $tags              Whether to return the assigned tags. Default true.
     53 *         @type bool $compatibility     Whether to return the WordPress compatibility list. Default true.
     54 *         @type bool $homepage          Whether to return the plugin homepage link. Default true.
     55 *         @type bool $versions          Whether to return the list of all available versions. Default false.
     56 *         @type bool $donate_link       Whether to return the donation link. Default true.
     57 *         @type bool $reviews           Whether to return the plugin reviews. Default false.
     58 *         @type bool $banners           Whether to return the banner images links. Default false.
     59 *         @type bool $icons             Whether to return the icon links. Default false.
     60 *         @type bool $active_installs   Whether to return the number of active installs. Default false.
     61 *         @type bool $group             Whether to return the assigned group. Default false.
     62 *         @type bool $contributors      Whether to return the ist of contributors. Default false.
     63 *     }
     64 * }
     65 * @return object|WP_Error Response object on success, WP_Error on failure. See the
     66 *         {@link https://developer.wordpress.org/reference/functions/plugins_api/ function reference article}
     67 *         for more information on the make-up of possible return objects depending on the value of `$action`.
    2868 */
    29 function plugins_api($action, $args = null) {
     69function plugins_api( $action, $args = array() ) {
    3070
    3171        if ( is_array( $args ) ) {
    3272                $args = (object) $args;