Docs: Update documentation for the $plugin_data parameter of various hooks:

* Document the structure of the `$plugin_data` array passed to the `plugin_row_meta` filter.
* Document some missing values returned by `get_plugin_data()`:
 * `PluginURI`
 * `AuthorName`
* Link to `get_plugin_data()` and the `plugin_row_meta` filter as the canonical sources in other various filters and actions which receive the `$plugin_data` parameter:
 * `network_admin_plugin_action_links`
 * `network_admin_plugin_action_links_{$plugin_file}`
 * `plugin_action_links`
 * `plugin_action_links_{$plugin_file}`
 * `plugin_auto_update_setting_html`
 * `manage_plugins_custom_column`
 * `after_plugin_row`
 * `after_plugin_row_{$plugin_file}`
 * `in_plugin_update_message-{$file}`
* Update documentation for the `$response` parameter of the `in_plugin_update_message-{$file}` filter:
 * Correct type for the `id` value. It contains a string like `w.org/plugins/[plugin-name]`, not a numeric ID.
 * Update `$icons`, `$banners`, and `$banners_rtl` values to use typed array notation.

Follow-up to [8367], [8402], [12976], [16758], [26540], [30544], [34818], [51733], [52212], [52224].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52227


git-svn-id: http://core.svn.wordpress.org/trunk@51819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-11-20 02:23:02 +00:00
parent fa62df0774
commit 742cd201e6
4 changed files with 119 additions and 86 deletions

View File

@ -899,12 +899,15 @@ class WP_Plugins_List_Table extends WP_List_Table {
*
* @since 3.1.0
*
* @param string[] $actions An array of plugin action links. By default this can include 'activate',
* 'deactivate', and 'delete'.
* @param string[] $actions An array of plugin action links. By default this can include
* 'activate', 'deactivate', and 'delete'.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`.
* @param string $context The plugin context. By default this can include 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $context The plugin context. By default this can include 'all',
* 'active', 'inactive', 'recently_activated', 'upgrade',
* 'mustuse', 'dropins', and 'search'.
*/
$actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
@ -916,12 +919,15 @@ class WP_Plugins_List_Table extends WP_List_Table {
*
* @since 3.1.0
*
* @param string[] $actions An array of plugin action links. By default this can include 'activate',
* 'deactivate', and 'delete'.
* @param string[] $actions An array of plugin action links. By default this can include
* 'activate', 'deactivate', and 'delete'.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`.
* @param string $context The plugin context. By default this can include 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $context The plugin context. By default this can include 'all',
* 'active', 'inactive', 'recently_activated', 'upgrade',
* 'mustuse', 'dropins', and 'search'.
*/
$actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
@ -934,13 +940,16 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @since 2.6.0 The `$context` parameter was added.
* @since 4.9.0 The 'Edit' link was removed from the list of action links.
*
* @param string[] $actions An array of plugin action links. By default this can include 'activate',
* 'deactivate', and 'delete'. With Multisite active this can also include
* 'network_active' and 'network_only' items.
* @param string[] $actions An array of plugin action links. By default this can include
* 'activate', 'deactivate', and 'delete'. With Multisite active
* this can also include 'network_active' and 'network_only' items.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`.
* @param string $context The plugin context. By default this can include 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $context The plugin context. By default this can include 'all',
* 'active', 'inactive', 'recently_activated', 'upgrade',
* 'mustuse', 'dropins', and 'search'.
*/
$actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
@ -953,13 +962,16 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @since 2.7.0
* @since 4.9.0 The 'Edit' link was removed from the list of action links.
*
* @param string[] $actions An array of plugin action links. By default this can include 'activate',
* 'deactivate', and 'delete'. With Multisite active this can also include
* 'network_active' and 'network_only' items.
* @param string[] $actions An array of plugin action links. By default this can include
* 'activate', 'deactivate', and 'delete'. With Multisite active
* this can also include 'network_active' and 'network_only' items.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`.
* @param string $context The plugin context. By default this can include 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $context The plugin context. By default this can include 'all',
* 'active', 'inactive', 'recently_activated', 'upgrade',
* 'mustuse', 'dropins', and 'search'.
*/
$actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
@ -1085,7 +1097,39 @@ class WP_Plugins_List_Table extends WP_List_Table {
* @param string[] $plugin_meta An array of the plugin's metadata, including
* the version, author, author URI, and plugin URI.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param array $plugin_data {
* An array of plugin data.
*
* @type string $id Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
* @type string $slug Plugin slug.
* @type string $plugin Plugin basename.
* @type string $new_version New plugin version.
* @type string $url Plugin URL.
* @type string $package Plugin update package URL.
* @type string[] $icons An array of plugin icon URLs.
* @type string[] $banners An array of plugin banner URLs.
* @type string[] $banners_rtl An array of plugin RTL banner URLs.
* @type string $requires The version of WordPress which the plugin requires.
* @type string $tested The version of WordPress the plugin is tested against.
* @type string $requires_php The version of PHP which the plugin requires.
* @type string $upgrade_notice The upgrade notice for the new plugin version.
* @type bool $update-supported Whether the plugin supports updates.
* @type string $Name The human-readable name of the plugin.
* @type string $PluginURI Plugin URI.
* @type string $Version Plugin version.
* @type string $Description Plugin description.
* @type string $Author Plugin author.
* @type string $AuthorURI Plugin author URI.
* @type string $TextDomain Plugin textdomain.
* @type string $DomainPath Relative path to the plugin's .mo file(s).
* @type bool $Network Whether the plugin can only be activated network-wide.
* @type string $RequiresWP The version of WordPress which the plugin requires.
* @type string $RequiresPHP The version of PHP which the plugin requires.
* @type string $UpdateURI ID of the plugin for update purposes, should be a URI.
* @type string $Title The human-readable title of the plugin.
* @type string $AuthorName Plugin author's name.
* @type bool $update Whether there's an available update. Default null.
* }
* @param string $status Status filter currently applied to the plugin list. Possible
* values are: 'all', 'active', 'inactive', 'recently_activated',
* 'upgrade', 'mustuse', 'dropins', 'search', 'paused',
@ -1181,10 +1225,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
*
* @since 5.5.0
*
* @param string $html The HTML of the plugin's auto-update column content, including
* toggle auto-update action links and time to next update.
* @param string $html The HTML of the plugin's auto-update column content,
* including toggle auto-update action links and
* time to next update.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
*/
echo apply_filters( 'plugin_auto_update_setting_html', $html, $plugin_file, $plugin_data );
@ -1204,7 +1251,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
*
* @param string $column_name Name of the column.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
*/
do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
@ -1274,14 +1323,17 @@ class WP_Plugins_List_Table extends WP_List_Table {
* Fires after each row in the Plugins list table.
*
* @since 2.3.0
* @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled' to possible values for `$status`.
* @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
* to possible values for `$status`.
*
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param string $status Status filter currently applied to the plugin list. Possible
* values are: 'all', 'active', 'inactive', 'recently_activated',
* 'upgrade', 'mustuse', 'dropins', 'search', 'paused',
* 'auto-update-enabled', 'auto-update-disabled'.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $status Status filter currently applied to the plugin list.
* Possible values are: 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins',
* 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
*/
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
@ -1292,14 +1344,17 @@ class WP_Plugins_List_Table extends WP_List_Table {
* to the plugin file, relative to the plugins directory.
*
* @since 2.7.0
* @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled' to possible values for `$status`.
* @since 5.5.0 Added 'auto-update-enabled' and 'auto-update-disabled'
* to possible values for `$status`.
*
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param string $status Status filter currently applied to the plugin list. Possible
* values are: 'all', 'active', 'inactive', 'recently_activated',
* 'upgrade', 'mustuse', 'dropins', 'search', 'paused',
* 'auto-update-enabled', 'auto-update-disabled'.
* @param array $plugin_data An array of plugin data. See `get_plugin_data()`
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $status Status filter currently applied to the plugin list.
* Possible values are: 'all', 'active', 'inactive',
* 'recently_activated', 'upgrade', 'mustuse', 'dropins',
* 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled'.
*/
do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status );
}

View File

@ -54,17 +54,19 @@
* Plugin data. Values will be empty if not supplied by the plugin.
*
* @type string $Name Name of the plugin. Should be unique.
* @type string $Title Title of the plugin and link to the plugin's site (if set).
* @type string $Description Plugin description.
* @type string $Author Author's name.
* @type string $AuthorURI Author's website address (if set).
* @type string $PluginURI Plugin URI.
* @type string $Version Plugin version.
* @type string $Description Plugin description.
* @type string $Author Plugin author's name.
* @type string $AuthorURI Plugin author's website address (if set).
* @type string $TextDomain Plugin textdomain.
* @type string $DomainPath Plugins relative directory path to .mo files.
* @type string $DomainPath Plugin's relative directory path to .mo files.
* @type bool $Network Whether the plugin can only be activated network-wide.
* @type string $RequiresWP Minimum required version of WordPress.
* @type string $RequiresPHP Minimum required version of PHP.
* @type string $UpdateURI ID of the plugin for update purposes, should be a URI.
* @type string $Title Title of the plugin and link to the plugin's site (if set).
* @type string $AuthorName Plugin author's name.
* }
*/
function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
@ -129,19 +131,8 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
* @param bool $markup Optional. If the returned data should have HTML markup applied.
* Default true.
* @param bool $translate Optional. If the returned data should be translated. Default true.
* @return array {
* Plugin data. Values will be empty if not supplied by the plugin.
*
* @type string $Name Name of the plugin. Should be unique.
* @type string $Title Title of the plugin and link to the plugin's site (if set).
* @type string $Description Plugin description.
* @type string $Author Author's name.
* @type string $AuthorURI Author's website address (if set).
* @type string $Version Plugin version.
* @type string $TextDomain Plugin textdomain.
* @type string $DomainPath Plugins relative directory path to .mo files.
* @type bool $Network Whether the plugin can only be activated network-wide.
* }
* @return array Plugin data. Values will be empty if not supplied by the plugin.
* See get_plugin_data() for the list of possible values.
*/
function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) {

View File

@ -558,37 +558,24 @@ function wp_plugin_update_row( $file, $plugin_data ) {
*
* @since 2.8.0
*
* @param array $plugin_data {
* An array of plugin metadata.
*
* @type string $name The human-readable name of the plugin.
* @type string $plugin_uri Plugin URI.
* @type string $version Plugin version.
* @type string $description Plugin description.
* @type string $author Plugin author.
* @type string $author_uri Plugin author URI.
* @type string $text_domain Plugin text domain.
* @type string $domain_path Relative path to the plugin's .mo file(s).
* @type bool $network Whether the plugin can only be activated network wide.
* @type string $title The human-readable title of the plugin.
* @type string $author_name Plugin author's name.
* @type bool $update Whether there's an available update. Default null.
* }
* @param array $plugin_data An array of plugin metadata. See get_plugin_data()
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param object $response {
* An object of metadata about the available plugin update.
*
* @type int $id Plugin ID.
* @type string $slug Plugin slug.
* @type string $plugin Plugin basename.
* @type string $new_version New plugin version.
* @type string $url Plugin URL.
* @type string $package Plugin update package URL.
* @type array $icons An array of plugin icon URLs.
* @type array $banners An array of plugin banner URLs.
* @type array $banners_rtl An array of plugin RTL banner URLs.
* @type string $requires The version of WordPress which the plugin requires.
* @type string $tested The version of WordPress the plugin is tested against.
* @type string $requires_php The version of PHP which the plugin requires.
* @type string $id Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
* @type string $slug Plugin slug.
* @type string $plugin Plugin basename.
* @type string $new_version New plugin version.
* @type string $url Plugin URL.
* @type string $package Plugin update package URL.
* @type string[] $icons An array of plugin icon URLs.
* @type string[] $banners An array of plugin banner URLs.
* @type string[] $banners_rtl An array of plugin RTL banner URLs.
* @type string $requires The version of WordPress which the plugin requires.
* @type string $tested The version of WordPress the plugin is tested against.
* @type string $requires_php The version of PHP which the plugin requires.
* }
*/
do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52226';
$wp_version = '5.9-alpha-52227';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.