Current Path : /storage/v11800/sahityaonline/public_html/wp-content/plugins/elementor/modules/compatibility-tag/

Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64

Upload File :
Current File : /storage/v11800/sahityaonline/public_html/wp-content/plugins/elementor/modules/compatibility-tag/compatibility-tag.php
<?php
namespace Elementor\Modules\CompatibilityTag;

use Elementor\Plugin;
use Elementor\Core\Utils\Version;
use Elementor\Core\Base\Base_Object;
use Elementor\Core\Utils\Collection;

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

class Compatibility_Tag extends Base_Object {
	const PLUGIN_NOT_EXISTS = 'plugin_not_exists';
	const HEADER_NOT_EXISTS = 'header_not_exists';
	const INVALID_VERSION = 'invalid_version';
	const INCOMPATIBLE = 'incompatible';
	const COMPATIBLE = 'compatible';

	/**
	 * @var string Holds the header that should be checked.
	 */
	private $header;

	/**
	 * Compatibility_Tag constructor.
	 *
	 * @param string $header
	 */
	public function __construct( $header ) {
		$this->header = $header;
	}

	/**
	 * Return if plugins is compatible or not.
	 *
	 * @param Version $version
	 * @param array   $plugins_names
	 *
	 * @return array
	 * @throws \Exception
	 */
	public function check( Version $version, array $plugins_names ) {
		return ( new Collection( $plugins_names ) )
			->map_with_keys( function ( $plugin_name ) use ( $version ) {
				return [ $plugin_name => $this->is_compatible( $version, $plugin_name ) ];
			} )
			->all();
	}

	/**
	 * Check single plugin if is compatible or not.
	 *
	 * @param Version $version
	 * @param         $plugin_name
	 *
	 * @return string
	 * @throws \Exception
	 */
	private function is_compatible( Version $version, $plugin_name ) {
		$plugins = Plugin::$instance->wp->get_plugins();

		if ( ! isset( $plugins[ $plugin_name ] ) ) {
			return self::PLUGIN_NOT_EXISTS;
		}

		$requested_plugin = $plugins[ $plugin_name ];

		if ( empty( $requested_plugin[ $this->header ] ) ) {
			return self::HEADER_NOT_EXISTS;
		}

		if ( ! Version::is_valid_version( $requested_plugin[ $this->header ] ) ) {
			return self::INVALID_VERSION;
		}

		if ( $version->compare( '>', $requested_plugin[ $this->header ], Version::PART_MAJOR_2 ) ) {
			return self::INCOMPATIBLE;
		}

		return self::COMPATIBLE;
	}
}

Softgel-Capsule – Affy Pharma Pvt Ltd

Arrange A Callback
[]
1 Step 1
Full Name
Telephone
Departmentyour full name
Postal Address
Message
0 /
Previous
Next
Shopping Basket