• Resolved apolloman

    (@apolloman)


    hello and good day

    first of all:; i hope youre all right and everything goes well at your site;:

    I’m currently working on a parser to make a small preview on the newest plugins in wordpress. at the moment i think i work from a URL given out of the range of these: https://de.wordpress.org/plugins/browse/popular/ – let us say the first 30 to 40 URL-pages.

    I’d like to retrieve only the title of the page and https://wordpress.org/plugins/wp-job-manager and https://wordpress.org/plugins/ninja-forms and – let us say the most popular wp-plugins:

    a little chunk of information (a bit of text)

    The project: for a list of meta-data of popular wordpress-plugins (cf. https://de.wordpress.org/plugins/browse/popular/ and gathering the first 50 URLs – that are
    50 plugins which are of interest! The challenge is: i want to fetch meta-data of all the existing plugins.

    What i subsequently want to filter out after the fetch is – those plugins that have the newest timestamp
    – that are updated (most) recently. It is all aobut acutality…

    https://wordpress.org/plugins/wp-job-manager
    https://wordpress.org/plugins/ninja-forms
    https://wordpress.org/plugins/participants-database ….and so on and so forth.

    see the source: https://wordpress.org/plugins/wp-job-manager/ we have the following set of meta-data for each wordpress-plugin:

    Version: 1.9.5.12
    installations: 10,000+
    WordPress Version: 5.0 or higher
    Tested up to: 5.4 PHP
    Version: 5.6 or higher
    Tags 3 Tags: database member sign-up form volunteer
    Last updated: 19 hours ago
    plugin-ratings Click and drag to move

    but as i saw today: there we have a api that can be used for this purpose too: the WordPress-Plugins-API

    cf: https://developer.wordpress.org/reference/functions/plugins_api/

    Browse: Home / Reference / Functions / plugins_api()
    plugins_api( string $action, array|object $args = array() )
    Retrieves plugin installer pages from the WordPress.org Plugins API.

    Description #Description
    It is possible for a plugin to override the Plugin API result with three filters. Assume this is for plugins, which can extend on the Plugin Info to offer more choices. This is very powerful and must be used with care when overriding the filters. The first filter, ‘plugins_api_args’, is for the args and gives the action as the second parameter. The hook for ‘plugins_api_args’ must ensure that an object is returned. The second filter, ‘plugins_api’, allows a plugin to override the WordPress.org Plugin Installation API entirely. If $action is ‘query_plugins’ or ‘plugin_information’, an object MUST be passed. If $action is ‘hot_tags’ or ‘hot_categories’, an array MUST be passed. Finally, the third filter, ‘plugins_api_result’, makes it possible to filter the response object or array, depending on the $action type.

    Supported arguments per action

    (object|array|WP_Error) Response object or array on success, WP_Error on failure. See the function reference article for more information on the make-up of possible return values depending on the value of $action.

    well – i guess i can use this API for the above mentioned aims too?

    look forward to hear from you

    regards

    yours Apolloman- that is happy about the new

    start of the Falcon-rocket! its amazing 😉

    +——————–+—————+——————–+———-+—————-+
    | | | | | |
    +——————–+—————+——————–+———-+—————-+
    | Argument Name | query_plugins | plugin_information | hot_tags | hot_categories |
    | $slug | No | Yes | No | No |
    | $per_page | Yes | No | No | No |
    | $page | Yes | No | No | No |
    | $number | No | No | Yes | Yes |
    | $search | Yes | No | No | No |
    | $tag | Yes | No | No | No |
    | $author | Yes | No | No | No |
    | $user | Yes | No | No | No |
    | $browse | Yes | No | No | No |
    | $locale | Yes | Yes | No | No |
    | $installed_plugins | Yes | No | No | No |
    | $is_ssl | Yes | Yes | No | No |
    | $fields | Yes | Yes | No | No |
    +——————–+—————+——————–+———-+—————-+

    cf: https://developer.wordpress.org/reference/functions/plugins_api/

    see the reference list:

    https://developer.wordpress.org/reference/functions/plugins_api/

    $fields = array(
    ‘active_installs’ => true, // rounded int
    ‘added’ => true, // date
    ‘author’ => true, // a href html
    ‘author_block_count’ => true, // int
    ‘author_block_rating’ => true, // int
    ‘author_profile’ => true, // url
    ‘banners’ => true, // array( [low], [high] )
    ‘compatibility’ => false, // empty array?
    ‘contributors’ => true, // array( array( [profile], [avatar], [display_name] )
    ‘description’ => false, // string
    ‘donate_link’ => true, // url
    ‘download_link’ => true, // url
    ‘downloaded’ => false, // int
    // ‘group’ => false, // n/a
    ‘homepage’ => true, // url
    ‘icons’ => false, // array( [1x] url, [2x] url )
    ‘last_updated’ => true, // datetime
    ‘name’ => true, // string
    ‘num_ratings’ => true, // int
    ‘rating’ => true, // int
    ‘ratings’ => true, // array( [5..0] )
    ‘requires’ => true, // version string
    ‘requires_php’ => true, // version string
    // ‘reviews’ => false, // n/a, part of ‘sections’
    ‘screenshots’ => true, // array( array( [src], ) )
    ‘sections’ => true, // array( [description], [installation], [changelog], [reviews], …)
    ‘short_description’ => false, // string
    ‘slug’ => true, // string
    ‘support_threads’ => true, // int
    ‘support_threads_resolved’ => true, // int
    ‘tags’ => true, // array( )
    ‘tested’ => true, // version string
    ‘version’ => true, // version string
    ‘versions’ => true, // array( [version] url )
    );
    `

    what do you say-!?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Worpress-Plugin API – giving back the meta-data according the usage of filters’ is closed to new replies.