mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Plugins: Introduce is_wp_version_compatible() and is_php_version_compatible() for checking compatibility with the current WordPress or PHP version.
Props afragen. Fixes #46599. git-svn-id: https://develop.svn.wordpress.org/trunk@45185 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3417,7 +3417,7 @@ function _xml_wp_die_handler( $message, $title = '', $args = array() ) {
|
||||
<message><![CDATA[{$message}]]></message>
|
||||
<data>
|
||||
<status>{$r['response']}</status>
|
||||
</data>
|
||||
</data>
|
||||
</error>
|
||||
|
||||
EOD;
|
||||
@@ -7121,3 +7121,27 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks compatibility with the current WordPress version.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @param string $required Minimum required WordPress version.
|
||||
* @return bool True if required version is compatible or empty, false if not.
|
||||
*/
|
||||
function is_wp_version_compatible( $required ) {
|
||||
return empty( $required ) || version_compare( get_bloginfo( 'version' ), $required, '>=' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks compatibility with the current PHP version.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @param string $required Minimum required PHP version.
|
||||
* @return bool True if required version is compatible or empty, false if not.
|
||||
*/
|
||||
function is_php_version_compatible( $required ) {
|
||||
return empty( $required ) || version_compare( phpversion(), $required, '>=' );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user