Priority File Manager

Base Directory:
/home/lvabrwqv/public_html/wp-content/plugins/elementor/includes
NameTypeSizeActions
📁 .. Folder -
📁 admin-templates Folder -
📄 api.php File 8813
Edit Download
📄 autoloader.php File 10022
Edit Download
📁 base Folder -
📄 beta-testers.php File 3059
Edit Download
📄 compatibility.php File 11221
Edit Download
📄 conditions.php File 2768
Edit Download
📁 controls Folder -
📄 db.php File 16276
Edit Download
📄 editor-assets-api.php File 1807
Edit Download
📁 editor-templates Folder -
📁 elements Folder -
📄 embed.php File 8679
Edit Download
📄 fonts.php File 64029
Edit Download
📄 frontend.php File 40070
Edit Download
📄 heartbeat.php File 2635
Edit Download
📁 interfaces Folder -
📁 libraries Folder -
📄 maintenance-mode.php File 11426
Edit Download
📄 maintenance.php File 2881
Edit Download
📁 managers Folder -
📄 plugin.php File 15979
Edit Download
📄 preview.php File 7874
Edit Download
📄 rollback.php File 4255
Edit Download
📁 settings Folder -
📄 shapes.php File 7999
Edit Download
📄 stylesheet.php File 9124
Edit Download
📁 template-library Folder -
📄 tracker.php File 17407
Edit Download
📄 user-data.php File 3522
Edit Download
📄 user.php File 10230
Edit Download
📄 utils.php File 24930
Edit Download
📁 widgets Folder -

View File: 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;
	}
}