Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Blocks/Utils
File: Utils.php
<?php
[0] Fix | Delete
namespace Automattic\WooCommerce\Blocks\Utils;
[1] Fix | Delete
[2] Fix | Delete
/**
[3] Fix | Delete
* Utils class
[4] Fix | Delete
*/
[5] Fix | Delete
class Utils {
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Compare the current WordPress version with a given version. It's a wrapper around `version-compare`
[9] Fix | Delete
* that additionally takes into account the suffix (like `-RC1`).
[10] Fix | Delete
* For example: version 6.3 is considered lower than 6.3-RC2, so you can do
[11] Fix | Delete
* wp_version_compare( '6.3', '>=' ) and that will return true for 6.3-RC2.
[12] Fix | Delete
*
[13] Fix | Delete
* @param string $version The version to compare against.
[14] Fix | Delete
* @param string|null $operator Optional. The comparison operator. Defaults to null.
[15] Fix | Delete
* @return bool|int Returns true if the current WordPress version satisfies the comparison, false otherwise.
[16] Fix | Delete
*/
[17] Fix | Delete
public static function wp_version_compare( $version, $operator = null ) {
[18] Fix | Delete
$current_wp_version = get_bloginfo( 'version' );
[19] Fix | Delete
if ( preg_match( '/^([0-9]+\.[0-9]+)/', $current_wp_version, $matches ) ) {
[20] Fix | Delete
$current_wp_version = (float) $matches[1];
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
// Replace non-alphanumeric characters with a dot.
[24] Fix | Delete
$current_wp_version = preg_replace( '/[^0-9a-zA-Z\.]+/i', '.', $current_wp_version );
[25] Fix | Delete
$version = preg_replace( '/[^0-9a-zA-Z\.]+/i', '.', $version );
[26] Fix | Delete
[27] Fix | Delete
return version_compare( $current_wp_version, $version, $operator );
[28] Fix | Delete
}
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function