PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.4
Elementor Website Builder – more than just a page builder v3.0.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/plugin.php +104 -216 4.2.13.0.4 View file →
@@ -1,31 +1,27 @@
1 1 <?php
2 -
3 2 namespace Elementor;
4 3
5 -use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 -use Elementor\Core\Wp_Api;
7 4 use Elementor\Core\Admin\Admin;
8 -use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
5 +use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
9 6 use Elementor\Core\Common\App as CommonApp;
10 7 use Elementor\Core\Debug\Inspector;
11 8 use Elementor\Core\Documents_Manager;
12 -use Elementor\Core\Experiments\Manager as Experiments_Manager;
13 9 use Elementor\Core\Kits\Manager as Kits_Manager;
14 10 use Elementor\Core\Editor\Editor;
15 11 use Elementor\Core\Files\Manager as Files_Manager;
16 12 use Elementor\Core\Files\Assets\Manager as Assets_Manager;
17 13 use Elementor\Core\Modules_Manager;
14 +use Elementor\Core\Schemes\Manager as Schemes_Manager;
18 15 use Elementor\Core\Settings\Manager as Settings_Manager;
19 16 use Elementor\Core\Settings\Page\Manager as Page_Settings_Manager;
17 +use Elementor\Core\Upgrade\Elementor_3_Re_Migrate_Globals;
18 +use Elementor\Core\Upgrade\Manager as Upgrades_Manager;
20 19 use Elementor\Modules\History\Revisions_Manager;
21 20 use Elementor\Core\DynamicTags\Manager as Dynamic_Tags_Manager;
22 21 use Elementor\Core\Logger\Manager as Log_Manager;
23 -use Elementor\Core\Page_Assets\Loader as Assets_Loader;
24 22 use Elementor\Modules\System_Info\Module as System_Info_Module;
25 23 use Elementor\Data\Manager as Data_Manager;
26 -use Elementor\Data\V2\Manager as Data_Manager_V2;
27 -use Elementor\Core\Files\Uploads_Manager;
28 24
29 25 if ( ! defined( 'ABSPATH' ) ) {
30 26 exit;
31 27 }
@@ -39,10 +35,8 @@
39 35 * @since 1.0.0
40 36 */
41 37 class Plugin {
42 38
43 - const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ];
44 -
45 39 /**
46 40 * Instance.
47 41 *
48 42 * Holds the plugin instance.
@@ -57,10 +51,9 @@
57 51
58 52 /**
59 53 * Database.
60 54 *
61 - * Holds the plugin database handler which is responsible for communicating
62 - * with the database.
55 + * Holds the plugin database.
63 56 *
64 57 * @since 1.0.0
65 58 * @access public
66 59 *
@@ -68,12 +61,24 @@
68 61 */
69 62 public $db;
70 63
71 64 /**
65 + * Ajax Manager.
66 + *
67 + * Holds the plugin ajax manager.
68 + *
69 + * @since 1.9.0
70 + * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )` instead
71 + * @access public
72 + *
73 + * @var Ajax
74 + */
75 + public $ajax;
76 +
77 + /**
72 78 * Controls manager.
73 79 *
74 - * Holds the plugin controls manager handler is responsible for registering
75 - * and initializing controls.
80 + * Holds the plugin controls manager.
76 81 *
77 82 * @since 1.0.0
78 83 * @access public
79 84 *
@@ -93,8 +98,20 @@
93 98 */
94 99 public $documents;
95 100
96 101 /**
102 + * Schemes manager.
103 + *
104 + * Holds the plugin schemes manager.
105 + *
106 + * @since 1.0.0
107 + * @access public
108 + *
109 + * @var Schemes_Manager
110 + */
111 + public $schemes_manager;
112 +
113 + /**
97 114 * Elements manager.
98 115 *
99 116 * Holds the plugin elements manager.
100 117 *
@@ -107,10 +124,9 @@
107 124
108 125 /**
109 126 * Widgets manager.
110 127 *
111 - * Holds the plugin widgets manager which is responsible for registering and
112 - * initializing widgets.
128 + * Holds the plugin widgets manager.
113 129 *
114 130 * @since 1.0.0
115 131 * @access public
116 132 *
@@ -120,10 +136,9 @@
120 136
121 137 /**
122 138 * Revisions manager.
123 139 *
124 - * Holds the plugin revisions manager which handles history and revisions
125 - * functionality.
140 + * Holds the plugin revisions manager.
126 141 *
127 142 * @since 1.0.0
128 143 * @access public
129 144 *
@@ -133,10 +148,9 @@
133 148
134 149 /**
135 150 * Images manager.
136 151 *
137 - * Holds the plugin images manager which is responsible for retrieving image
138 - * details.
152 + * Holds the plugin images manager.
139 153 *
140 154 * @since 2.9.0
141 155 * @access public
142 156 *
@@ -146,10 +160,9 @@
146 160
147 161 /**
148 162 * Maintenance mode.
149 163 *
150 - * Holds the maintenance mode manager responsible for the "Maintenance Mode"
151 - * and the "Coming Soon" features.
164 + * Holds the plugin maintenance mode.
152 165 *
153 166 * @since 1.0.0
154 167 * @access public
155 168 *
@@ -195,14 +208,14 @@
195 208
196 209 /**
197 210 * Role Manager.
198 211 *
199 - * Holds the plugin role manager.
212 + * Holds the plugin Role Manager
200 213 *
201 214 * @since 2.0.0
202 215 * @access public
203 216 *
204 - * @var Core\RoleManager\Role_Manager
217 + * @var \Elementor\Core\RoleManager\Role_Manager
205 218 */
206 219 public $role_manager;
207 220
208 221 /**
@@ -284,9 +297,9 @@
284 297 *
285 298 * @since 1.0.0
286 299 * @access public
287 300 *
288 - * @var System_Info_Module
301 + * @var System_Info\Main
289 302 */
290 303 public $system_info;
291 304
292 305 /**
@@ -313,11 +326,11 @@
313 326 */
314 327 public $skins_manager;
315 328
316 329 /**
317 - * Files manager.
330 + * Files Manager.
318 331 *
319 - * Holds the plugin files manager.
332 + * Holds the files manager.
320 333 *
321 334 * @since 2.1.0
322 335 * @access public
323 336 *
@@ -325,11 +338,11 @@
325 338 */
326 339 public $files_manager;
327 340
328 341 /**
329 - * Assets manager.
342 + * Assets Manager.
330 343 *
331 - * Holds the plugin assets manager.
344 + * Holds the Assets manager.
332 345 *
333 346 * @since 2.6.0
334 347 * @access public
335 348 *
@@ -337,17 +350,19 @@
337 350 */
338 351 public $assets_manager;
339 352
340 353 /**
341 - * Icons Manager.
354 + * Files Manager.
342 355 *
343 - * Holds the plugin icons manager.
356 + * Holds the files manager.
344 357 *
358 + * @since 1.0.0
345 359 * @access public
360 + * @deprecated 2.1.0 Use `Plugin::$files_manager` instead
346 361 *
347 - * @var Icons_Manager
362 + * @var Files_Manager
348 363 */
349 - public $icons_manager;
364 + public $posts_css_manager;
350 365
351 366 /**
352 367 * WordPress widgets manager.
353 368 *
@@ -362,9 +377,9 @@
362 377
363 378 /**
364 379 * Modules manager.
365 380 *
366 - * Holds the plugin modules manager.
381 + * Holds the modules manager.
367 382 *
368 383 * @since 1.0.0
369 384 * @access public
370 385 *
@@ -384,169 +399,51 @@
384 399 */
385 400 public $beta_testers;
386 401
387 402 /**
388 - * Inspector.
389 - *
390 - * Holds the plugin inspector data.
391 - *
392 - * @since 2.1.2
393 - * @access public
394 - *
395 403 * @var Inspector
404 + * @deprecated 2.1.2 Use $inspector.
396 405 */
397 - public $inspector;
406 + public $debugger;
398 407
399 408 /**
400 - * @var Admin_Menu_Manager
409 + * @var Inspector
401 410 */
402 - public $admin_menu_manager;
411 + public $inspector;
403 412
404 413 /**
405 - * Common functionality.
406 - *
407 - * Holds the plugin common functionality.
408 - *
409 - * @since 2.3.0
410 - * @access public
411 - *
412 414 * @var CommonApp
413 415 */
414 416 public $common;
415 417
416 418 /**
417 - * Log manager.
418 - *
419 - * Holds the plugin log manager.
420 - *
421 - * @access public
422 - *
423 419 * @var Log_Manager
424 420 */
425 421 public $logger;
426 422
427 423 /**
428 - * Upgrade manager.
429 - *
430 - * Holds the plugin upgrade manager.
431 - *
432 - * @access public
433 - *
434 424 * @var Core\Upgrade\Manager
435 425 */
436 426 public $upgrade;
437 427
438 428 /**
439 - * Tasks manager.
440 - *
441 - * Holds the plugin tasks manager.
442 - *
443 - * @var Core\Upgrade\Custom_Tasks_Manager
444 - */
445 - public $custom_tasks;
446 -
447 - /**
448 - * Kits manager.
449 - *
450 - * Holds the plugin kits manager.
451 - *
452 - * @access public
453 - *
454 429 * @var Core\Kits\Manager
455 430 */
456 431 public $kits_manager;
457 432
458 433 /**
459 - * @var \Elementor\Data\V2\Manager
434 + * @var \Core\Data\Manager
460 435 */
461 - public $data_manager_v2;
436 + public $data_manager;
462 437
463 - /**
464 - * Legacy mode.
465 - *
466 - * Holds the plugin legacy mode data.
467 - *
468 - * @access public
469 - *
470 - * @var array
471 - */
472 438 public $legacy_mode;
473 439
474 440 /**
475 - * App.
476 - *
477 - * Holds the plugin app data.
478 - *
479 - * @since 3.0.0
480 - * @access public
481 - *
482 - * @var App\App
441 + * @var Core\App\App
483 442 */
484 443 public $app;
485 444
486 445 /**
487 - * WordPress API.
488 - *
489 - * Holds the methods that interact with WordPress Core API.
490 - *
491 - * @since 3.0.0
492 - * @access public
493 - *
494 - * @var Wp_Api
495 - */
496 - public $wp;
497 -
498 - /**
499 - * Experiments manager.
500 - *
501 - * Holds the plugin experiments manager.
502 - *
503 - * @since 3.1.0
504 - * @access public
505 - *
506 - * @var Experiments_Manager
507 - */
508 - public $experiments;
509 -
510 - /**
511 - * Uploads manager.
512 - *
513 - * Holds the plugin uploads manager responsible for handling file uploads
514 - * that are not done with WordPress Media.
515 - *
516 - * @since 3.3.0
517 - * @access public
518 - *
519 - * @var Uploads_Manager
520 - */
521 - public $uploads_manager;
522 -
523 - /**
524 - * Breakpoints manager.
525 - *
526 - * Holds the plugin breakpoints manager.
527 - *
528 - * @since 3.2.0
529 - * @access public
530 - *
531 - * @var Breakpoints_Manager
532 - */
533 - public $breakpoints;
534 -
535 - /**
536 - * Assets loader.
537 - *
538 - * Holds the plugin assets loader responsible for conditionally enqueuing
539 - * styles and script assets that were pre-enabled.
540 - *
541 - * @since 3.3.0
542 - * @access public
543 - *
544 - * @var Assets_Loader
545 - */
546 - public $assets_loader;
547 -
548 - /**
549 446 * Clone.
550 447 *
551 448 * Disable class cloning and throw an error on object clone.
552 449 *
@@ -556,13 +453,10 @@
556 453 * @access public
557 454 * @since 1.0.0
558 455 */
559 456 public function __clone() {
560 - _doing_it_wrong(
561 - __FUNCTION__,
562 - sprintf( 'Cloning instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
563 - '1.0.0'
564 - );
457 + // Cloning instances of the class is forbidden.
458 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
565 459 }
566 460
567 461 /**
568 462 * Wakeup.
@@ -572,13 +466,10 @@
572 466 * @access public
573 467 * @since 1.0.0
574 468 */
575 469 public function __wakeup() {
576 - _doing_it_wrong(
577 - __FUNCTION__,
578 - sprintf( 'Unserializing instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
579 - '1.0.0'
580 - );
470 + // Unserializing instances of the class is forbidden.
471 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
581 472 }
582 473
583 474 /**
584 475 * Instance.
@@ -624,12 +515,11 @@
624 515
625 516 /**
626 517 * Elementor init.
627 518 *
628 - * Fires when Elementor components are initialized.
519 + * Fires on Elementor init, after Elementor has finished loading but
520 + * before any headers are sent.
629 521 *
630 - * After Elementor finished loading but before any headers are sent.
631 - *
632 522 * @since 1.0.0
633 523 */
634 524 do_action( 'elementor/init' );
635 525 }
@@ -678,11 +568,10 @@
678 568 * @since 1.0.0
679 569 * @access private
680 570 */
681 571 private function init_components() {
682 - $this->experiments = new Experiments_Manager();
683 - $this->breakpoints = new Breakpoints_Manager();
684 572 $this->inspector = new Inspector();
573 + $this->debugger = $this->inspector;
685 574
686 575 Settings_Manager::run();
687 576
688 577 $this->db = new DB();
@@ -688,8 +577,9 @@
688 577 $this->db = new DB();
689 578 $this->controls_manager = new Controls_Manager();
690 579 $this->documents = new Documents_Manager();
691 580 $this->kits_manager = new Kits_Manager();
581 + $this->schemes_manager = new Schemes_Manager();
692 582 $this->elements_manager = new Elements_Manager();
693 583 $this->widgets_manager = new Widgets_Manager();
694 584 $this->skins_manager = new Skins_Manager();
695 585 $this->files_manager = new Files_Manager();
@@ -694,37 +584,33 @@
694 584 $this->skins_manager = new Skins_Manager();
695 585 $this->files_manager = new Files_Manager();
696 586 $this->assets_manager = new Assets_Manager();
697 587 $this->icons_manager = new Icons_Manager();
588 + /*
589 + * @TODO: Remove deprecated alias
590 + */
591 + $this->posts_css_manager = $this->files_manager;
698 592 $this->settings = new Settings();
699 593 $this->tools = new Tools();
700 594 $this->editor = new Editor();
701 595 $this->preview = new Preview();
702 596 $this->frontend = new Frontend();
597 + $this->templates_manager = new TemplateLibrary\Manager();
703 598 $this->maintenance_mode = new Maintenance_Mode();
704 599 $this->dynamic_tags = new Dynamic_Tags_Manager();
705 600 $this->modules_manager = new Modules_Manager();
706 - $this->templates_manager = new TemplateLibrary\Manager();
707 601 $this->role_manager = new Core\RoleManager\Role_Manager();
708 602 $this->system_info = new System_Info_Module();
709 603 $this->revisions_manager = new Revisions_Manager();
710 604 $this->images_manager = new Images_Manager();
711 - $this->wp = new Wp_Api();
712 - $this->assets_loader = new Assets_Loader();
713 - $this->uploads_manager = new Uploads_Manager();
714 605
715 - $this->admin_menu_manager = new Admin_Menu_Manager();
716 - $this->admin_menu_manager->register_actions();
717 -
718 606 User::init();
719 - User_Data::init();
720 607 Api::init();
721 608 Tracker::init();
722 609
723 610 $this->upgrade = new Core\Upgrade\Manager();
724 - $this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager();
725 611
726 - $this->app = new App\App();
612 + $this->app = new Core\App\App();
727 613
728 614 if ( is_admin() ) {
729 615 $this->heartbeat = new Heartbeat();
730 616 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
@@ -729,8 +615,9 @@
729 615 $this->heartbeat = new Heartbeat();
730 616 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
731 617 $this->admin = new Admin();
732 618 $this->beta_testers = new Beta_Testers();
619 + new Elementor_3_Re_Migrate_Globals();
733 620 }
734 621 }
735 622
736 623 /**
@@ -740,10 +627,39 @@
740 627 public function init_common() {
741 628 $this->common = new CommonApp();
742 629
743 630 $this->common->init_components();
631 +
632 + $this->ajax = $this->common->get_component( 'ajax' );
744 633 }
745 634
635 + public function get_legacy_mode( $mode_name = null ) {
636 + if ( ! $this->legacy_mode ) {
637 + $optimized_dom_output = get_option( 'elementor_optimized_dom_output' );
638 +
639 + if ( $optimized_dom_output ) {
640 + $element_wrappers_legacy_mode = 'disabled' === $optimized_dom_output;
641 + } else {
642 + $element_wrappers_legacy_mode = true;
643 + }
644 +
645 + $this->legacy_mode = [
646 + 'elementWrappers' => $element_wrappers_legacy_mode,
647 + ];
648 + }
649 +
650 + if ( ! $mode_name ) {
651 + return $this->legacy_mode;
652 + }
653 +
654 + if ( isset( $this->legacy_mode[ $mode_name ] ) ) {
655 + return $this->legacy_mode[ $mode_name ];
656 + }
657 +
658 + // If there is no legacy mode with the given mode name;
659 + return false;
660 + }
661 +
746 662 /**
747 663 * Add custom post type support.
748 664 *
749 665 * Register Elementor support for all the supported post types defined by
@@ -756,9 +672,9 @@
756 672 * @since 1.0.0
757 673 * @access private
758 674 */
759 675 private function add_cpt_support() {
760 - $cpt_support = get_option( 'elementor_cpt_support', self::ELEMENTOR_DEFAULT_POST_TYPES );
676 + $cpt_support = get_option( 'elementor_cpt_support', [ 'page', 'post' ] );
761 677
762 678 foreach ( $cpt_support as $cpt_slug ) {
763 679 add_post_type_support( $cpt_slug, 'elementor' );
764 680 }
@@ -778,36 +694,8 @@
778 694 Autoloader::run();
779 695 }
780 696
781 697 /**
782 - * Magic getter for accessing certain properties.
783 - *
784 - * @since 3.1.0
785 - * @access public
786 - *
787 - * @param string $property The property name.
788 - * @return mixed The property value or null if not found.
789 - * @throws \Exception If trying to access a private property.
790 - */
791 - public function __get( $property ) {
792 - if ( 'posts_css_manager' === $property ) {
793 - self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( 'Plugin::$instance->posts_css_manager', '2.7.0', 'Plugin::$instance->files_manager' );
794 -
795 - return $this->files_manager;
796 - }
797 -
798 - if ( 'data_manager' === $property ) {
799 - return Data_Manager::instance();
800 - }
801 -
802 - if ( property_exists( $this, $property ) ) {
803 - throw new \Exception( 'Cannot access private property.' );
804 - }
805 -
806 - return null;
807 - }
808 -
809 - /**
810 698 * Plugin constructor.
811 699 *
812 700 * Initializing Elementor plugin.
813 701 *
@@ -817,19 +705,19 @@
817 705 private function __construct() {
818 706 $this->register_autoloader();
819 707
820 708 $this->logger = Log_Manager::instance();
821 - $this->data_manager_v2 = Data_Manager_V2::instance();
709 + $this->data_manager = Data_Manager::instance();
822 710
823 711 Maintenance::init();
824 712 Compatibility::register_actions();
825 713
826 714 add_action( 'init', [ $this, 'init' ], 0 );
827 - add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 );
715 + add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ] );
828 716 }
829 717
830 718 final public static function get_title() {
831 - return esc_html__( 'Elementor', 'elementor' );
719 + return __( 'Elementor', 'elementor' );
832 720 }
833 721 }
834 722
835 723 if ( ! defined( 'ELEMENTOR_TESTS' ) ) {