PHP 8.2.31
Preview: conditions.php Size: 2.70 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/elementor/includes/conditions.php

<?php
namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Elementor conditions.
 *
 * Elementor conditions handler class introduce the compare conditions and the
 * check conditions methods.
 *
 * @since 1.0.0
 */
class Conditions {

	/**
	 * Compare conditions.
	 *
	 * Whether the two values comply the comparison operator.
	 *
	 * @since 1.0.0
	 * @access public
	 * @static
	 *
	 * @param mixed  $left_value  First value to compare.
	 * @param mixed  $right_value Second value to compare.
	 * @param string $operator    Comparison operator.
	 *
	 * @return bool Whether the two values complies the comparison operator.
	 */
	public static function compare( $left_value, $right_value, $operator ) {
		switch ( $operator ) {
			case '==':
				return $left_value == $right_value;
			case '!=':
				return $left_value != $right_value;
			case '!==':
				return $left_value !== $right_value;
			case 'in':
				return in_array( $left_value, $right_value, true );
			case '!in':
				return ! in_array( $left_value, $right_value, true );
			case 'contains':
				return in_array( $right_value, $left_value, true );
			case '!contains':
				return ! in_array( $right_value, $left_value, true );
			case '<':
				return $left_value < $right_value;
			case '<=':
				return $left_value <= $right_value;
			case '>':
				return $left_value > $right_value;
			case '>=':
				return $left_value >= $right_value;
			default:
				return $left_value === $right_value;
		}
	}

	/**
	 * Check conditions.
	 *
	 * Whether the comparison conditions comply.
	 *
	 * @since 1.0.0
	 * @access public
	 * @static
	 *
	 * @param array $conditions The conditions to check.
	 * @param array $comparison The comparison parameter.
	 *
	 * @return bool Whether the comparison conditions comply.
	 */
	public static function check( array $conditions, array $comparison ) {
		$is_or_condition = isset( $conditions['relation'] ) && 'or' === $conditions['relation'];

		$condition_succeed = ! $is_or_condition;

		foreach ( $conditions['terms'] as $term ) {
			if ( ! empty( $term['terms'] ) ) {
				$comparison_result = self::check( $term, $comparison );
			} else {
				preg_match( '/(\w+)(?:\[(\w+)])?/', $term['name'], $parsed_name );

				$value = $comparison[ $parsed_name[1] ];

				if ( ! empty( $parsed_name[2] ) ) {
					$value = $value[ $parsed_name[2] ];
				}

				$operator = null;

				if ( ! empty( $term['operator'] ) ) {
					$operator = $term['operator'];
				}

				$comparison_result = self::compare( $value, $term['value'], $operator );
			}

			if ( $is_or_condition ) {
				if ( $comparison_result ) {
					return true;
				}
			} elseif ( ! $comparison_result ) {
				return false;
			}
		}

		return $condition_succeed;
	}
}

Directory Contents

Dirs: 11 × Files: 22

Name Size Perms Modified Actions
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
base DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
controls DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
elements DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
libraries DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
managers DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
settings DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
widgets DIR
- drwxr-xr-x 2026-06-10 02:40:26
Edit Download
8.67 KB lrw-r--r-- 2026-05-20 16:19:28
Edit Download
9.79 KB lrw-r--r-- 2025-10-21 16:51:06
Edit Download
2.99 KB lrw-r--r-- 2023-04-23 15:22:46
Edit Download
10.96 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
2.70 KB lrw-r--r-- 2023-04-23 15:22:46
Edit Download
15.89 KB lrw-r--r-- 2026-02-02 14:52:12
Edit Download
4.11 KB lrw-r--r-- 2026-06-08 16:48:02
Edit Download
8.48 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
62.53 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
40.03 KB lrw-r--r-- 2026-04-20 15:03:48
Edit Download
2.57 KB lrw-r--r-- 2023-04-23 15:22:46
Edit Download
11.16 KB lrw-r--r-- 2025-10-21 16:51:06
Edit Download
2.81 KB lrw-r--r-- 2025-03-17 17:28:54
Edit Download
16.68 KB lrw-r--r-- 2026-05-26 12:54:34
Edit Download
7.93 KB lrw-r--r-- 2026-05-20 16:19:28
Edit Download
4.16 KB lrw-r--r-- 2026-01-20 13:22:36
Edit Download
7.81 KB lrw-r--r-- 2025-08-05 18:00:00
Edit Download
8.91 KB lrw-r--r-- 2025-09-15 14:10:16
Edit Download
17.00 KB lrw-r--r-- 2025-11-10 16:25:22
Edit Download
3.44 KB lrw-r--r-- 2025-10-21 16:51:06
Edit Download
9.99 KB lrw-r--r-- 2025-12-04 22:09:04
Edit Download
24.88 KB lrw-r--r-- 2026-06-08 16:48:02
Edit Download

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