Server IP : 15.235.198.142 / Your IP : 216.73.216.190 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/kiwigrass_LIVE/wp-content/plugins/woocommerce/src/Blocks/Utils/ |
Upload File : |
<?php namespace Automattic\WooCommerce\Blocks\Utils; /** * Utils class */ class Utils { /** * Compare the current WordPress version with a given version. It's a wrapper around `version-compare` * that additionally takes into account the suffix (like `-RC1`). * For example: version 6.3 is considered lower than 6.3-RC2, so you can do * wp_version_compare( '6.3', '>=' ) and that will return true for 6.3-RC2. * * @param string $version The version to compare against. * @param string|null $operator Optional. The comparison operator. Defaults to null. * @return bool|int Returns true if the current WordPress version satisfies the comparison, false otherwise. */ public static function wp_version_compare( $version, $operator = null ) { $current_wp_version = get_bloginfo( 'version' ); if ( preg_match( '/^([0-9]+\.[0-9]+)/', $current_wp_version, $matches ) ) { $current_wp_version = (float) $matches[1]; } // Replace non-alphanumeric characters with a dot. $current_wp_version = preg_replace( '/[^0-9a-zA-Z\.]+/i', '.', $current_wp_version ); $version = preg_replace( '/[^0-9a-zA-Z\.]+/i', '.', $version ); return version_compare( $current_wp_version, $version, $operator ); } }