Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/elemento.../modules/variable...
File: module.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Elementor\Modules\Variables;
[2] Fix | Delete
[3] Fix | Delete
use Elementor\Core\Base\Module as BaseModule;
[4] Fix | Delete
use Elementor\Core\Experiments\Manager as ExperimentsManager;
[5] Fix | Delete
use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule;
[6] Fix | Delete
use Elementor\Modules\Variables\Classes\Variable_Types_Registry;
[7] Fix | Delete
use Elementor\Modules\Variables\PropTypes\Color_Variable_Prop_Type;
[8] Fix | Delete
use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
[9] Fix | Delete
use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
[10] Fix | Delete
use Elementor\Plugin;
[11] Fix | Delete
use Elementor\Utils;
[12] Fix | Delete
[13] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[14] Fix | Delete
exit; // Exit if accessed directly.
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
class Module extends BaseModule {
[18] Fix | Delete
const MODULE_NAME = 'e-variables';
[19] Fix | Delete
const EXPERIMENT_NAME = 'e_variables';
[20] Fix | Delete
const EXPERIMENT_MANAGER_NAME = 'e_variables_manager';
[21] Fix | Delete
[22] Fix | Delete
private Variable_Types_Registry $variable_types_registry;
[23] Fix | Delete
[24] Fix | Delete
public function get_name() {
[25] Fix | Delete
return self::MODULE_NAME;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
public static function get_experimental_data(): array {
[29] Fix | Delete
return [
[30] Fix | Delete
'name' => self::EXPERIMENT_NAME,
[31] Fix | Delete
'title' => esc_html__( 'Variables', 'elementor' ),
[32] Fix | Delete
'description' => esc_html__( 'Enable variables. (For this feature to work - Atomic Widgets must be active)', 'elementor' ),
[33] Fix | Delete
'hidden' => true,
[34] Fix | Delete
'default' => ExperimentsManager::STATE_ACTIVE,
[35] Fix | Delete
'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
[36] Fix | Delete
];
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
private function hooks() {
[40] Fix | Delete
return new Hooks();
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
public function __construct() {
[44] Fix | Delete
parent::__construct();
[45] Fix | Delete
[46] Fix | Delete
if ( ! $this->is_experiment_active() ) {
[47] Fix | Delete
return;
[48] Fix | Delete
}
[49] Fix | Delete
$this->register_features();
[50] Fix | Delete
[51] Fix | Delete
$this->hooks()->register();
[52] Fix | Delete
[53] Fix | Delete
add_action( 'init', [ $this, 'init_variable_types_registry' ] );
[54] Fix | Delete
add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() );
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
private function register_features() {
[58] Fix | Delete
Plugin::$instance->experiments->add_feature([
[59] Fix | Delete
'name' => self::EXPERIMENT_MANAGER_NAME,
[60] Fix | Delete
'title' => esc_html__( 'Variables Manager', 'elementor' ),
[61] Fix | Delete
'description' => esc_html__( 'Enable variables manager. (For this feature to work - Variables must be active)', 'elementor' ),
[62] Fix | Delete
'hidden' => true,
[63] Fix | Delete
'default' => ExperimentsManager::STATE_ACTIVE,
[64] Fix | Delete
'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
[65] Fix | Delete
]);
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
private function is_experiment_active(): bool {
[69] Fix | Delete
return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME )
[70] Fix | Delete
&& Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
public function init_variable_types_registry(): void {
[74] Fix | Delete
$this->variable_types_registry = new Variable_Types_Registry();
[75] Fix | Delete
[76] Fix | Delete
do_action( 'elementor/variables/register', $this->variable_types_registry );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
[80] Fix | Delete
public function get_variable_types_registry(): Variable_Types_Registry {
[81] Fix | Delete
return $this->variable_types_registry;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
private function get_quota_config(): array {
[85] Fix | Delete
return [
[86] Fix | Delete
Color_Variable_Prop_Type::get_key() => 100000,
[87] Fix | Delete
Font_Variable_Prop_Type::get_key() => 100000,
[88] Fix | Delete
];
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
public function enqueue_editor_scripts() {
[92] Fix | Delete
[93] Fix | Delete
wp_add_inline_script(
[94] Fix | Delete
'elementor-common',
[95] Fix | Delete
'window.ElementorVariablesQuotaConfig = ' . wp_json_encode( $this->get_quota_config() ) . ';',
[96] Fix | Delete
'before'
[97] Fix | Delete
);
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function