Changeset 45546
- Timestamp:
- 06/18/2019 03:23:53 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin.php
r45448 r45546 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 at least: 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 * … … 47 49 * 48 50 * @since 1.5.0 51 * @since 5.3.0 Added support for `Requires at least` and `Requires PHP`. 49 52 * 50 53 * @param string $plugin_file Absolute path to the main plugin file. … … 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 */ … … 78 83 'DomainPath' => 'Domain Path', 79 84 'Network' => 'Network', 85 'RequiresWP' => 'Requires at least', 86 'RequiresPHP' => 'Requires PHP', 80 87 // Site Wide Only is deprecated in favor of Network. 81 88 '_sitewide' => 'Site Wide Only', … … 1086 1093 function validate_plugin_requirements( $plugin ) { 1087 1094 $readme_file = WP_PLUGIN_DIR . '/' . dirname( $plugin ) . '/readme.txt'; 1095 $plugin_data = array( 1096 'requires' => '', 1097 'requires_php' => '', 1098 ); 1088 1099 1089 1100 if ( file_exists( $readme_file ) ) { … … 1096 1107 'plugin' 1097 1108 ); 1098 } else { 1099 return true; 1100 } 1109 } 1110 1111 $plugin_data = array_merge( $plugin_data, get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ); 1112 1113 // Check for headers in the plugin's PHP file, give precedence to the plugin headers. 1114 $plugin_data['requires'] = ! empty( $plugin_data['RequiresWP'] ) ? $plugin_data['RequiresWP'] : $plugin_data['requires']; 1115 $plugin_data['requires_php'] = ! empty( $plugin_data['RequiresPHP'] ) ? $plugin_data['RequiresPHP'] : $plugin_data['requires_php']; 1101 1116 1102 1117 $plugin_data['wp_compatible'] = is_wp_version_compatible( $plugin_data['requires'] ); 1103 1118 $plugin_data['php_compatible'] = is_php_version_compatible( $plugin_data['requires_php'] ); 1104 1105 $plugin_data = array_merge( $plugin_data, get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) );1106 1119 1107 1120 if ( ! $plugin_data['wp_compatible'] && ! $plugin_data['php_compatible'] ) {
Note: See TracChangeset
for help on using the changeset viewer.