PHP 8.2.31
Preview: Utils.php Size: 1.21 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Blocks/Utils/Utils.php

<?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 );
	}
}

Directory Contents

Dirs: 0 × Files: 11

Name Size Perms Modified Actions
6.89 KB lrw-r--r-- 2024-07-30 19:31:16
Edit Download
6.86 KB lrw-r--r-- 2026-03-30 17:12:24
Edit Download
2.08 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
30.09 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
17.33 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
3.51 KB lrw-r--r-- 2024-11-14 01:17:00
Edit Download
1.26 KB lrw-r--r-- 2025-07-29 12:34:58
Edit Download
455 B lrw-r--r-- 2025-06-23 19:46:28
Edit Download
5.75 KB lrw-r--r-- 2026-03-30 17:12:24
Edit Download
23.12 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
1.21 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).