diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 7a1b038518..76a590333f 100644
a
|
b
|
|
31 | 31 | * Network: Optional. Specify "Network: true" to require that a plugin is activated |
32 | 32 | * across all sites in an installation. This will prevent a plugin from being |
33 | 33 | * activated on a single site when Multisite is enabled. |
| 34 | * Requires WP: Optional. Specify the minimum required WordPress version. |
| 35 | * Requires PHP: Optional. Specify the minimum required PHP version. |
34 | 36 | * * / # Remove the space to close comment |
35 | 37 | * |
36 | 38 | * Some users have issues with opening large files and manipulating the contents |
… |
… |
|
46 | 48 | * reading. |
47 | 49 | * |
48 | 50 | * @since 1.5.0 |
| 51 | * @since 5.3.0 Added `RequiresWP` and `RequiresPHP`. |
49 | 52 | * |
50 | 53 | * @param string $plugin_file Absolute path to the main plugin file. |
51 | 54 | * @param bool $markup Optional. If the returned data should have HTML markup applied. |
… |
… |
|
63 | 66 | * @type string $TextDomain Plugin textdomain. |
64 | 67 | * @type string $DomainPath Plugins relative directory path to .mo files. |
65 | 68 | * @type bool $Network Whether the plugin can only be activated network-wide. |
| 69 | * @type string $RequiresWP Minimum required version of WordPress. |
| 70 | * @type string $RequiresPHP Minimum required version of PHP. |
66 | 71 | * } |
67 | 72 | */ |
68 | 73 | function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { |
… |
… |
function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { |
77 | 82 | 'TextDomain' => 'Text Domain', |
78 | 83 | 'DomainPath' => 'Domain Path', |
79 | 84 | 'Network' => 'Network', |
| 85 | 'RequiresWP' => 'Requires WP', |
| 86 | 'RequiresPHP' => 'Requires PHP', |
80 | 87 | // Site Wide Only is deprecated in favor of Network. |
81 | 88 | '_sitewide' => 'Site Wide Only', |
82 | 89 | ); |
… |
… |
function validate_plugin( $plugin ) { |
1085 | 1092 | */ |
1086 | 1093 | function validate_plugin_requirements( $plugin ) { |
1087 | 1094 | $readme_file = WP_PLUGIN_DIR . '/' . dirname( $plugin ) . '/readme.txt'; |
| 1095 | $plugin_data = array(); |
1088 | 1096 | |
1089 | 1097 | if ( file_exists( $readme_file ) ) { |
1090 | 1098 | $plugin_data = get_file_data( |
… |
… |
function validate_plugin_requirements( $plugin ) { |
1095 | 1103 | ), |
1096 | 1104 | 'plugin' |
1097 | 1105 | ); |
1098 | | } else { |
1099 | | return true; |
1100 | 1106 | } |
1101 | 1107 | |
| 1108 | $plugin_data = array_merge( $plugin_data, get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ); |
| 1109 | |
| 1110 | // Check for headers in plugin file, precedence to headers in readme.txt file. |
| 1111 | $plugin_data['requires'] = isset( $plugin_data['requires'] ) ? $plugin_data['requires'] : $plugin_data['RequiresWP']; |
| 1112 | $plugin_data['requires_php'] = isset( $plugin_data['requires_php'] ) ? $plugin_data['requires_php'] : $plugin_data['RequiresPHP']; |
| 1113 | |
1102 | 1114 | $plugin_data['wp_compatible'] = is_wp_version_compatible( $plugin_data['requires'] ); |
1103 | 1115 | $plugin_data['php_compatible'] = is_php_version_compatible( $plugin_data['requires_php'] ); |
1104 | 1116 | |
1105 | | $plugin_data = array_merge( $plugin_data, get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ); |
1106 | | |
1107 | 1117 | if ( ! $plugin_data['wp_compatible'] && ! $plugin_data['php_compatible'] ) { |
1108 | 1118 | return new WP_Error( |
1109 | 1119 | 'plugin_wp_php_incompatible', |