Function
Add extensions hosted using EDD to the WP plugins API.
tml_add_extension_data_to_plugins_api( false|object|array $result = false, string $action = '', object $args = array() )
Parameters
-
$resultfalse|object|array Defaultfalse - The result object or array.
-
$actionstring Default'' - The API action being requested.
-
$argsobject Defaultarray() - The arguments being passed to the API.
Source
function tml_add_extension_data_to_plugins_api( $result = false, $action = '', $args = array() ) {
if ( 'plugin_information' !== $action ) {
return $result;
}
$extension = tml_get_extension( $args->slug );
if ( ! $extension ) {
return $result;
}
$result = tml_extension_api_call(
$extension->get_store_url(),
array(
'license' => $extension->get_license_key(),
'item_id' => $extension->get_item_id(),
'slug' => $extension->get_name(),
'url' => home_url(),
)
);
if ( $result ) {
if ( empty( $result->version ) && ! empty( $result->new_version ) ) {
$result->version = $result->new_version;
}
}
return $result;
}
Uses
Changelog
| Version | Description |
|---|---|
| 7.0 | Introduced. |