Making WordPress.org


Ignore:
Timestamp:
01/30/2018 03:18:52 AM (7 years ago)
Author:
dd32
Message:

Theme Directory: API: Move the Themes_API class into the plugin, making api.wordpress.org/themes/info/ a wrapper for it.

See #1630

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r6419 r6462  
    788788
    789789/**
    790  * Makes a query against api.wordpress.org/themes/info/1.0/ without making a HTTP call
    791  * Switches to the appropriate blog for the query.
    792  */
    793 function wporg_themes_query_api( $method, $args = array() ) {
     790 * Make a query against the api.wordpress.org/themes/info/ API
     791 * This function can be used to access the API without making an external HTTP call.
     792 *
     793 * NOTE: The API also calls this function.
     794 *
     795 * @param $method string The Method being called. Valid values: 'query_themes', 'theme_information', 'hot_tags', 'feature_list', and 'get_commercial_shops'
     796 * @param $args   array  The arguements for the call.
     797 * @param $format string The format to return the data in. Valid values: 'json', 'php', 'raw' (default)
     798 */
     799function wporg_themes_query_api( $method, $args = array(), $format = 'raw' ) {
    794800    if ( ! class_exists( 'Themes_API' ) ) {
    795         if ( file_exists( __DIR__ . '/class-themes-api.php' ) ) {
    796             include_once __DIR__ . '/class-themes-api.php';
    797         } else {
    798             include_once API_WPORGPATH . 'themes/info/1.0/class-themes-api.php';
    799         }
     801        include_once __DIR__ . '/class-themes-api.php';
    800802    }
    801803
    802804    $api = new Themes_API( $method, $args );
    803805
    804     return $api->response;
     806    return $api->get_result( $format );
    805807}
    806808
Note: See TracChangeset for help on using the changeset viewer.