| Server IP : 8.134.250.228 / Your IP : 216.73.217.39 Web Server : Apache System : Linux iZ7xv33p9e9ivk7yhmj7ibZ 5.10.134-18.al8.x86_64 #1 SMP Fri Dec 13 16:56:53 CST 2024 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/www.gobluemade.com/wp-content/plugins/elementor/modules/variables/ |
Upload File : |
<?php
namespace Elementor\Modules\Variables;
use Elementor\Core\Base\Module as BaseModule;
use Elementor\Core\Experiments\Manager as ExperimentsManager;
use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule;
use Elementor\Modules\Variables\Classes\Variable_Types_Registry;
use Elementor\Modules\Variables\ImportExportCustomization\Import_Export_Customization;
use Elementor\Modules\Variables\PropTypes\Color_Variable_Prop_Type;
use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
use Elementor\Plugin;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Module extends BaseModule {
const MODULE_NAME = 'e-variables';
const EXPERIMENT_NAME = 'e_variables';
const EXPERIMENT_MANAGER_NAME = 'e_variables_manager';
private Variable_Types_Registry $variable_types_registry;
public function get_name() {
return self::MODULE_NAME;
}
public static function get_experimental_data(): array {
return [
'name' => self::EXPERIMENT_NAME,
'title' => esc_html__( 'Variables', 'elementor' ),
'description' => esc_html__( 'Enable variables. (For this feature to work - Atomic Widgets must be active)', 'elementor' ),
'hidden' => true,
'default' => ExperimentsManager::STATE_ACTIVE,
'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
];
}
private function hooks() {
return new Hooks();
}
public function __construct() {
parent::__construct();
if ( ! $this->is_experiment_active() ) {
return;
}
$this->register_features();
$this->hooks()->register();
( new Import_Export_Customization() )->register_hooks();
add_action( 'init', [ $this, 'init_variable_types_registry' ] );
add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() );
}
private function register_features() {
Plugin::$instance->experiments->add_feature([
'name' => self::EXPERIMENT_MANAGER_NAME,
'title' => esc_html__( 'Variables Manager', 'elementor' ),
'description' => esc_html__( 'Enable variables manager. (For this feature to work - Variables must be active)', 'elementor' ),
'hidden' => true,
'default' => ExperimentsManager::STATE_ACTIVE,
'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
]);
}
private function is_experiment_active(): bool {
return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME )
&& Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
}
public function init_variable_types_registry(): void {
$this->variable_types_registry = new Variable_Types_Registry();
do_action( 'elementor/variables/register', $this->variable_types_registry );
}
public function get_variable_types_registry(): Variable_Types_Registry {
return $this->variable_types_registry;
}
private function get_quota_config(): array {
return [
Color_Variable_Prop_Type::get_key() => 100000,
Font_Variable_Prop_Type::get_key() => 100000,
];
}
public function enqueue_editor_scripts() {
wp_add_inline_script(
'elementor-common',
'window.ElementorVariablesQuotaConfig = ' . wp_json_encode( $this->get_quota_config() ) . ';',
'before'
);
}
}