/var/www/html_us/wp-content/plugins/elementor/includes/plugin.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
<?php
namespace Elementor;

use 
Elementor\Container\Container;
use 
ElementorDeps\DI\Container as DIContainer;
use 
Elementor\Core\Admin\Menu\Admin_Menu_Manager;
use 
Elementor\Core\Wp_Api;
use 
Elementor\Core\Admin\Admin;
use 
Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
use 
Elementor\Core\Common\App as CommonApp;
use 
Elementor\Core\Debug\Inspector;
use 
Elementor\Core\Documents_Manager;
use 
Elementor\Core\Experiments\Manager as Experiments_Manager;
use 
Elementor\Core\Kits\Manager as Kits_Manager;
use 
Elementor\Core\Editor\Editor;
use 
Elementor\Core\Files\Manager as Files_Manager;
use 
Elementor\Core\Files\Assets\Manager as Assets_Manager;
use 
Elementor\Core\Modules_Manager;
use 
Elementor\Core\Settings\Manager as Settings_Manager;
use 
Elementor\Core\Settings\Page\Manager as Page_Settings_Manager;
use 
Elementor\Modules\History\Revisions_Manager;
use 
Elementor\Core\DynamicTags\Manager as Dynamic_Tags_Manager;
use 
Elementor\Core\Logger\Manager as Log_Manager;
use 
Elementor\Core\Page_Assets\Loader as Assets_Loader;
use 
Elementor\Modules\System_Info\Module as System_Info_Module;
use 
Elementor\Data\Manager as Data_Manager;
use 
Elementor\Data\V2\Manager as Data_Manager_V2;
use 
Elementor\Core\Common\Modules\DevTools\Module as Dev_Tools;
use 
Elementor\Core\Files\Uploads_Manager as Uploads_Manager;

if ( ! 
defined'ABSPATH' ) ) {
    exit;
}

/**
 * Elementor plugin.
 *
 * The main plugin handler class is responsible for initializing Elementor. The
 * class registers and all the components required to run the plugin.
 *
 * @since 1.0.0
 */
class Plugin {
    const 
ELEMENTOR_DEFAULT_POST_TYPES = [ 'page''post' ];

    
/**
     * Instance.
     *
     * Holds the plugin instance.
     *
     * @since 1.0.0
     * @access public
     * @static
     *
     * @var Plugin
     */
    
public static $instance null;

    
/**
     * Database.
     *
     * Holds the plugin database handler which is responsible for communicating
     * with the database.
     *
     * @since 1.0.0
     * @access public
     *
     * @var DB
     */
    
public $db;

    
/**
     * Controls manager.
     *
     * Holds the plugin controls manager handler is responsible for registering
     * and initializing controls.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Controls_Manager
     */
    
public $controls_manager;

    
/**
     * Documents manager.
     *
     * Holds the documents manager.
     *
     * @since 2.0.0
     * @access public
     *
     * @var Documents_Manager
     */
    
public $documents;

    
/**
     * Schemes manager.
     *
     * Holds the plugin schemes manager.
     *
     * @since 1.0.0
     * @access public
     * @deprecated 3.0.0
     *
     * @var Schemes_Manager
     */
    
public $schemes_manager;

    
/**
     * Elements manager.
     *
     * Holds the plugin elements manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Elements_Manager
     */
    
public $elements_manager;

    
/**
     * Widgets manager.
     *
     * Holds the plugin widgets manager which is responsible for registering and
     * initializing widgets.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Widgets_Manager
     */
    
public $widgets_manager;

    
/**
     * Revisions manager.
     *
     * Holds the plugin revisions manager which handles history and revisions
     * functionality.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Revisions_Manager
     */
    
public $revisions_manager;

    
/**
     * Images manager.
     *
     * Holds the plugin images manager which is responsible for retrieving image
     * details.
     *
     * @since 2.9.0
     * @access public
     *
     * @var Images_Manager
     */
    
public $images_manager;

    
/**
     * Maintenance mode.
     *
     * Holds the maintenance mode manager responsible for the "Maintenance Mode"
     * and the "Coming Soon" features.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Maintenance_Mode
     */
    
public $maintenance_mode;

    
/**
     * Page settings manager.
     *
     * Holds the page settings manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Page_Settings_Manager
     */
    
public $page_settings_manager;

    
/**
     * Dynamic tags manager.
     *
     * Holds the dynamic tags manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Dynamic_Tags_Manager
     */
    
public $dynamic_tags;

    
/**
     * Settings.
     *
     * Holds the plugin settings.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Settings
     */
    
public $settings;

    
/**
     * Role Manager.
     *
     * Holds the plugin role manager.
     *
     * @since 2.0.0
     * @access public
     *
     * @var Core\RoleManager\Role_Manager
     */
    
public $role_manager;

    
/**
     * Admin.
     *
     * Holds the plugin admin.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Admin
     */
    
public $admin;

    
/**
     * Tools.
     *
     * Holds the plugin tools.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Tools
     */
    
public $tools;

    
/**
     * Preview.
     *
     * Holds the plugin preview.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Preview
     */
    
public $preview;

    
/**
     * Editor.
     *
     * Holds the plugin editor.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Editor
     */
    
public $editor;

    
/**
     * Frontend.
     *
     * Holds the plugin frontend.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Frontend
     */
    
public $frontend;

    
/**
     * Heartbeat.
     *
     * Holds the plugin heartbeat.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Heartbeat
     */
    
public $heartbeat;

    
/**
     * System info.
     *
     * Holds the system info data.
     *
     * @since 1.0.0
     * @access public
     *
     * @var System_Info_Module
     */
    
public $system_info;

    
/**
     * Template library manager.
     *
     * Holds the template library manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var TemplateLibrary\Manager
     */
    
public $templates_manager;

    
/**
     * Skins manager.
     *
     * Holds the skins manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Skins_Manager
     */
    
public $skins_manager;

    
/**
     * Files manager.
     *
     * Holds the plugin files manager.
     *
     * @since 2.1.0
     * @access public
     *
     * @var Files_Manager
     */
    
public $files_manager;

    
/**
     * Assets manager.
     *
     * Holds the plugin assets manager.
     *
     * @since 2.6.0
     * @access public
     *
     * @var Assets_Manager
     */
    
public $assets_manager;

    
/**
     * Icons Manager.
     *
     * Holds the plugin icons manager.
     *
     * @access public
     *
     * @var Icons_Manager
     */
    
public $icons_manager;

    
/**
     * WordPress widgets manager.
     *
     * Holds the WordPress widgets manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var WordPress_Widgets_Manager
     */
    
public $wordpress_widgets_manager;

    
/**
     * Modules manager.
     *
     * Holds the plugin modules manager.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Modules_Manager
     */
    
public $modules_manager;

    
/**
     * Beta testers.
     *
     * Holds the plugin beta testers.
     *
     * @since 1.0.0
     * @access public
     *
     * @var Beta_Testers
     */
    
public $beta_testers;

    
/**
     * Inspector.
     *
     * Holds the plugin inspector data.
     *
     * @since 2.1.2
     * @access public
     *
     * @var Inspector
     */
    
public $inspector;

    
/**
     * @var Admin_Menu_Manager
     */
    
public $admin_menu_manager;

    
/**
     * Common functionality.
     *
     * Holds the plugin common functionality.
     *
     * @since 2.3.0
     * @access public
     *
     * @var CommonApp
     */
    
public $common;

    
/**
     * Log manager.
     *
     * Holds the plugin log manager.
     *
     * @access public
     *
     * @var Log_Manager
     */
    
public $logger;

    
/**
     * Dev tools.
     *
     * Holds the plugin dev tools.
     *
     * @access private
     *
     * @var Dev_Tools
     */
    
private $dev_tools;

    
/**
     * Upgrade manager.
     *
     * Holds the plugin upgrade manager.
     *
     * @access public
     *
     * @var Core\Upgrade\Manager
     */
    
public $upgrade;

    
/**
     * Tasks manager.
     *
     * Holds the plugin tasks manager.
     *
     * @var Core\Upgrade\Custom_Tasks_Manager
     */
    
public $custom_tasks;

    
/**
     * Kits manager.
     *
     * Holds the plugin kits manager.
     *
     * @access public
     *
     * @var Core\Kits\Manager
     */
    
public $kits_manager;

    
/**
     * @var \Elementor\Data\V2\Manager
     */
    
public $data_manager_v2;

    
/**
     * Legacy mode.
     *
     * Holds the plugin legacy mode data.
     *
     * @access public
     *
     * @var array
     */
    
public $legacy_mode;

    
/**
     * App.
     *
     * Holds the plugin app data.
     *
     * @since 3.0.0
     * @access public
     *
     * @var App\App
     */
    
public $app;

    
/**
     * WordPress API.
     *
     * Holds the methods that interact with WordPress Core API.
     *
     * @since 3.0.0
     * @access public
     *
     * @var Wp_Api
     */
    
public $wp;

    
/**
     * Experiments manager.
     *
     * Holds the plugin experiments manager.
     *
     * @since 3.1.0
     * @access public
     *
     * @var Experiments_Manager
     */
    
public $experiments;

    
/**
     * Uploads manager.
     *
     * Holds the plugin uploads manager responsible for handling file uploads
     * that are not done with WordPress Media.
     *
     * @since 3.3.0
     * @access public
     *
     * @var Uploads_Manager
     */
    
public $uploads_manager;

    
/**
     * Breakpoints manager.
     *
     * Holds the plugin breakpoints manager.
     *
     * @since 3.2.0
     * @access public
     *
     * @var Breakpoints_Manager
     */
    
public $breakpoints;

    
/**
     * Assets loader.
     *
     * Holds the plugin assets loader responsible for conditionally enqueuing
     * styles and script assets that were pre-enabled.
     *
     * @since 3.3.0
     * @access public
     *
     * @var Assets_Loader
     */
    
public $assets_loader;

    
/**
     * Container instance for managing dependencies.
     *
     * @since 3.24.0
     * @var DIContainer
     */
    
private $container;

    
/**
     * Clone.
     *
     * Disable class cloning and throw an error on object clone.
     *
     * The whole idea of the singleton design pattern is that there is a single
     * object. Therefore, we don't want the object to be cloned.
     *
     * @access public
     * @since 1.0.0
     */
    
public function __clone() {
        
_doing_it_wrong(
            
__FUNCTION__,
            
sprintf'Cloning instances of the singleton "%s" class is forbidden.'get_class$this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
            
'1.0.0'
        
);
    }

    
/**
     * Wakeup.
     *
     * Disable unserializing of the class.
     *
     * @access public
     * @since 1.0.0
     */
    
public function __wakeup() {
        
_doing_it_wrong(
            
__FUNCTION__,
            
sprintf'Unserializing instances of the singleton "%s" class is forbidden.'get_class$this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
            
'1.0.0'
        
);
    }

    
/**
     * Instance.
     *
     * Ensures only one instance of the plugin class is loaded or can be loaded.
     *
     * @since 1.0.0
     * @access public
     * @static
     *
     * @return Plugin An instance of the class.
     */
    
public static function instance() {
        if ( 
is_nullself::$instance ) ) {
            
self::$instance = new self();

            
/**
             * Elementor loaded.
             *
             * Fires when Elementor was fully loaded and instantiated.
             *
             * @since 1.0.0
             */
            
do_action'elementor/loaded' );
        }

        return 
self::$instance;
    }

    public function 
initialize_container() {
        
Container::initialize_instance();

        
$this->container Container::get_instance();
    }

    
/**
     * Get the Elementor container or resolve a dependency.
     */
    
public function elementor_container$abstract null ) {
        if ( 
is_null$abstract ) ) {
            return 
$this->container;
        }

        return 
$this->container->make$abstract );
    }

    
/**
     * Init.
     *
     * Initialize Elementor Plugin. Register Elementor support for all the
     * supported post types and initialize Elementor components.
     *
     * @since 1.0.0
     * @access public
     */
    
public function init() {
        
$this->add_cpt_support();

        
$this->init_components();

        
/**
         * Elementor init.
         *
         * Fires when Elementor components are initialized.
         *
         * After Elementor finished loading but before any headers are sent.
         *
         * @since 1.0.0
         */
        
do_action'elementor/init' );
    }

    
/**
     * Get install time.
     *
     * Retrieve the time when Elementor was installed.
     *
     * @since 2.6.0
     * @access public
     * @static
     *
     * @return int Unix timestamp when Elementor was installed.
     */
    
public function get_install_time() {
        
$installed_time get_option'_elementor_installed_time' );

        if ( ! 
$installed_time ) {
            
$installed_time time();

            
update_option'_elementor_installed_time'$installed_time );
        }

        return 
$installed_time;
    }

    
/**
     * @since 2.3.0
     * @access public
     */
    
public function on_rest_api_init() {
        
// On admin/frontend sometimes the rest API is initialized after the common is initialized.
        
if ( ! $this->common ) {
            
$this->init_common();
        }
    }

    
/**
     * Init components.
     *
     * Initialize Elementor components. Register actions, run setting manager,
     * initialize all the components that run elementor, and if in admin page
     * initialize admin components.
     *
     * @since 1.0.0
     * @access private
     */
    
private function init_components() {
        
$this->experiments = new Experiments_Manager();
        
$this->breakpoints = new Breakpoints_Manager();
        
$this->inspector = new Inspector();

        
Settings_Manager::run();

        
$this->db = new DB();
        
$this->controls_manager = new Controls_Manager();
        
$this->documents = new Documents_Manager();
        
$this->kits_manager = new Kits_Manager();
        
$this->elements_manager = new Elements_Manager();
        
$this->widgets_manager = new Widgets_Manager();
        
$this->skins_manager = new Skins_Manager();
        
$this->files_manager = new Files_Manager();
        
$this->assets_manager = new Assets_Manager();
        
$this->icons_manager = new Icons_Manager();
        
$this->settings = new Settings();
        
$this->tools = new Tools();
        
$this->editor = new Editor();
        
$this->preview = new Preview();
        
$this->frontend = new Frontend();
        
$this->maintenance_mode = new Maintenance_Mode();
        
$this->dynamic_tags = new Dynamic_Tags_Manager();
        
$this->modules_manager = new Modules_Manager();
        
$this->templates_manager = new TemplateLibrary\Manager();
        
$this->role_manager = new Core\RoleManager\Role_Manager();
        
$this->system_info = new System_Info_Module();
        
$this->revisions_manager = new Revisions_Manager();
        
$this->images_manager = new Images_Manager();
        
$this->wp = new Wp_Api();
        
$this->assets_loader = new Assets_Loader();
        
$this->uploads_manager = new Uploads_Manager();

        
$this->admin_menu_manager = new Admin_Menu_Manager();
        
$this->admin_menu_manager->register_actions();

        
User::init();
        
Api::init();
        
Tracker::init();

        
$this->upgrade = new Core\Upgrade\Manager();
        
$this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager();

        
$this->app = new App\App();

        if ( 
is_admin() ) {
            
$this->heartbeat = new Heartbeat();
            
$this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
            
$this->admin = new Admin();
            
$this->beta_testers = new Beta_Testers();
        }
    }

    
/**
     * @since 2.3.0
     * @access public
     */
    
public function init_common() {
        
$this->common = new CommonApp();

        
$this->common->init_components();
    }

    
/**
     * Add custom post type support.
     *
     * Register Elementor support for all the supported post types defined by
     * the user in the admin screen and saved as `elementor_cpt_support` option
     * in WordPress `$wpdb->options` table.
     *
     * If no custom post type selected, usually in new installs, this method
     * will return the two default post types: `page` and `post`.
     *
     * @since 1.0.0
     * @access private
     */
    
private function add_cpt_support() {
        
$cpt_support get_option'elementor_cpt_support'self::ELEMENTOR_DEFAULT_POST_TYPES );

        foreach ( 
$cpt_support as $cpt_slug ) {
            
add_post_type_support$cpt_slug'elementor' );
        }
    }

    
/**
     * Register autoloader.
     *
     * Elementor autoloader loads all the classes needed to run the plugin.
     *
     * @since 1.6.0
     * @access private
     */
    
private function register_autoloader() {
        require_once 
ELEMENTOR_PATH '/includes/autoloader.php';

        
Autoloader::run();
    }

    
/**
     * Plugin Magic Getter
     *
     * @since 3.1.0
     * @access public
     *
     * @param $property
     * @return mixed
     * @throws \Exception
     */
    
public function __get$property ) {
        if ( 
'posts_css_manager' === $property ) {
            
self::$instance->modules_manager->get_modules'dev-tools' )->deprecation->deprecated_argument'Plugin::$instance->posts_css_manager''2.7.0''Plugin::$instance->files_manager' );

            return 
$this->files_manager;
        }

        if ( 
'data_manager' === $property ) {
            return 
Data_Manager::instance();
        }

        if ( 
property_exists$this$property ) ) {
            throw new 
\Exception'Cannot access private property.' );
        }

        return 
null;
    }

    
/**
     * Plugin constructor.
     *
     * Initializing Elementor plugin.
     *
     * @since 1.0.0
     * @access private
     */
    
private function __construct() {
        
$this->register_autoloader();

        
$this->logger Log_Manager::instance();
        
$this->data_manager_v2 Data_Manager_V2::instance();

        
Maintenance::init();
        
Compatibility::register_actions();

        
add_action'init', [ $this'init' ], );
        
add_action'rest_api_init', [ $this'on_rest_api_init' ], );
    }

    final public static function 
get_title() {
        return 
esc_html__'Elementor''elementor' );
    }
}

if ( ! 
defined'ELEMENTOR_TESTS' ) ) {
    
// In tests we run the instance manually.
    
$plugin_instance Plugin::instance();

    
$plugin_instance->initialize_container();
}