PluginProbe
Elementor Website Builder – more than just a page builder / 3.3.1
Elementor Website Builder – more than just a page builder v3.3.1
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 +111 -160 4.2.23.3.1 View file →
@@ -1,12 +1,11 @@
1 1 <?php
2 -
3 2 namespace Elementor;
4 3
5 -use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 4 use Elementor\Core\Wp_Api;
7 5 use Elementor\Core\Admin\Admin;
8 6 use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
7 +use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
9 8 use Elementor\Core\Common\App as CommonApp;
10 9 use Elementor\Core\Debug\Inspector;
11 10 use Elementor\Core\Documents_Manager;
12 11 use Elementor\Core\Experiments\Manager as Experiments_Manager;
@@ -14,10 +13,12 @@
14 13 use Elementor\Core\Editor\Editor;
15 14 use Elementor\Core\Files\Manager as Files_Manager;
16 15 use Elementor\Core\Files\Assets\Manager as Assets_Manager;
17 16 use Elementor\Core\Modules_Manager;
17 +use Elementor\Core\Schemes\Manager as Schemes_Manager;
18 18 use Elementor\Core\Settings\Manager as Settings_Manager;
19 19 use Elementor\Core\Settings\Page\Manager as Page_Settings_Manager;
20 +use Elementor\Core\Upgrade\Elementor_3_Re_Migrate_Globals;
20 21 use Elementor\Modules\History\Revisions_Manager;
21 22 use Elementor\Core\DynamicTags\Manager as Dynamic_Tags_Manager;
22 23 use Elementor\Core\Logger\Manager as Log_Manager;
23 24 use Elementor\Core\Page_Assets\Loader as Assets_Loader;
@@ -22,10 +23,10 @@
22 23 use Elementor\Core\Logger\Manager as Log_Manager;
23 24 use Elementor\Core\Page_Assets\Loader as Assets_Loader;
24 25 use Elementor\Modules\System_Info\Module as System_Info_Module;
25 26 use Elementor\Data\Manager as Data_Manager;
26 -use Elementor\Data\V2\Manager as Data_Manager_V2;
27 -use Elementor\Core\Files\Uploads_Manager;
27 +use Elementor\Core\Common\Modules\DevTools\Module as Dev_Tools;
28 +use Elementor\Core\Files\Uploads_Manager as Uploads_Manager;
28 29
29 30 if ( ! defined( 'ABSPATH' ) ) {
30 31 exit;
31 32 }
@@ -39,10 +40,8 @@
39 40 * @since 1.0.0
40 41 */
41 42 class Plugin {
42 43
43 - const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ];
44 -
45 44 /**
46 45 * Instance.
47 46 *
48 47 * Holds the plugin instance.
@@ -57,10 +56,9 @@
57 56
58 57 /**
59 58 * Database.
60 59 *
61 - * Holds the plugin database handler which is responsible for communicating
62 - * with the database.
60 + * Holds the plugin database.
63 61 *
64 62 * @since 1.0.0
65 63 * @access public
66 64 *
@@ -68,12 +66,24 @@
68 66 */
69 67 public $db;
70 68
71 69 /**
70 + * Ajax Manager.
71 + *
72 + * Holds the plugin ajax manager.
73 + *
74 + * @since 1.9.0
75 + * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )` instead
76 + * @access public
77 + *
78 + * @var Ajax
79 + */
80 + public $ajax;
81 +
82 + /**
72 83 * Controls manager.
73 84 *
74 - * Holds the plugin controls manager handler is responsible for registering
75 - * and initializing controls.
85 + * Holds the plugin controls manager.
76 86 *
77 87 * @since 1.0.0
78 88 * @access public
79 89 *
@@ -93,8 +103,20 @@
93 103 */
94 104 public $documents;
95 105
96 106 /**
107 + * Schemes manager.
108 + *
109 + * Holds the plugin schemes manager.
110 + *
111 + * @since 1.0.0
112 + * @access public
113 + *
114 + * @var Schemes_Manager
115 + */
116 + public $schemes_manager;
117 +
118 + /**
97 119 * Elements manager.
98 120 *
99 121 * Holds the plugin elements manager.
100 122 *
@@ -107,10 +129,9 @@
107 129
108 130 /**
109 131 * Widgets manager.
110 132 *
111 - * Holds the plugin widgets manager which is responsible for registering and
112 - * initializing widgets.
133 + * Holds the plugin widgets manager.
113 134 *
114 135 * @since 1.0.0
115 136 * @access public
116 137 *
@@ -120,10 +141,9 @@
120 141
121 142 /**
122 143 * Revisions manager.
123 144 *
124 - * Holds the plugin revisions manager which handles history and revisions
125 - * functionality.
145 + * Holds the plugin revisions manager.
126 146 *
127 147 * @since 1.0.0
128 148 * @access public
129 149 *
@@ -133,10 +153,9 @@
133 153
134 154 /**
135 155 * Images manager.
136 156 *
137 - * Holds the plugin images manager which is responsible for retrieving image
138 - * details.
157 + * Holds the plugin images manager.
139 158 *
140 159 * @since 2.9.0
141 160 * @access public
142 161 *
@@ -146,10 +165,9 @@
146 165
147 166 /**
148 167 * Maintenance mode.
149 168 *
150 - * Holds the maintenance mode manager responsible for the "Maintenance Mode"
151 - * and the "Coming Soon" features.
169 + * Holds the plugin maintenance mode.
152 170 *
153 171 * @since 1.0.0
154 172 * @access public
155 173 *
@@ -195,14 +213,14 @@
195 213
196 214 /**
197 215 * Role Manager.
198 216 *
199 - * Holds the plugin role manager.
217 + * Holds the plugin Role Manager
200 218 *
201 219 * @since 2.0.0
202 220 * @access public
203 221 *
204 - * @var Core\RoleManager\Role_Manager
222 + * @var \Elementor\Core\RoleManager\Role_Manager
205 223 */
206 224 public $role_manager;
207 225
208 226 /**
@@ -313,11 +331,11 @@
313 331 */
314 332 public $skins_manager;
315 333
316 334 /**
317 - * Files manager.
335 + * Files Manager.
318 336 *
319 - * Holds the plugin files manager.
337 + * Holds the files manager.
320 338 *
321 339 * @since 2.1.0
322 340 * @access public
323 341 *
@@ -325,11 +343,11 @@
325 343 */
326 344 public $files_manager;
327 345
328 346 /**
329 - * Assets manager.
347 + * Assets Manager.
330 348 *
331 - * Holds the plugin assets manager.
349 + * Holds the Assets manager.
332 350 *
333 351 * @since 2.6.0
334 352 * @access public
335 353 *
@@ -337,17 +355,19 @@
337 355 */
338 356 public $assets_manager;
339 357
340 358 /**
341 - * Icons Manager.
359 + * Files Manager.
342 360 *
343 - * Holds the plugin icons manager.
361 + * Holds the files manager.
344 362 *
363 + * @since 1.0.0
345 364 * @access public
365 + * @deprecated 2.1.0 Use `Plugin::$files_manager` instead
346 366 *
347 - * @var Icons_Manager
367 + * @var Files_Manager
348 368 */
349 - public $icons_manager;
369 + private $posts_css_manager;
350 370
351 371 /**
352 372 * WordPress widgets manager.
353 373 *
@@ -362,9 +382,9 @@
362 382
363 383 /**
364 384 * Modules manager.
365 385 *
366 - * Holds the plugin modules manager.
386 + * Holds the modules manager.
367 387 *
368 388 * @since 1.0.0
369 389 * @access public
370 390 *
@@ -384,164 +404,76 @@
384 404 */
385 405 public $beta_testers;
386 406
387 407 /**
388 - * Inspector.
389 - *
390 - * Holds the plugin inspector data.
391 - *
392 - * @since 2.1.2
393 - * @access public
394 - *
395 408 * @var Inspector
409 + * @deprecated 2.1.2 Use $inspector.
396 410 */
397 - public $inspector;
411 + public $debugger;
398 412
399 413 /**
400 - * @var Admin_Menu_Manager
414 + * @var Inspector
401 415 */
402 - public $admin_menu_manager;
416 + public $inspector;
403 417
404 418 /**
405 - * Common functionality.
406 - *
407 - * Holds the plugin common functionality.
408 - *
409 - * @since 2.3.0
410 - * @access public
411 - *
412 419 * @var CommonApp
413 420 */
414 421 public $common;
415 422
416 423 /**
417 - * Log manager.
418 - *
419 - * Holds the plugin log manager.
420 - *
421 - * @access public
422 - *
423 424 * @var Log_Manager
424 425 */
425 426 public $logger;
426 427
427 428 /**
428 - * Upgrade manager.
429 - *
430 - * Holds the plugin upgrade manager.
431 - *
432 - * @access public
433 - *
434 - * @var Core\Upgrade\Manager
429 + * @var Dev_Tools
435 430 */
436 - public $upgrade;
431 + private $dev_tools;
437 432
438 433 /**
439 - * Tasks manager.
440 - *
441 - * Holds the plugin tasks manager.
442 - *
443 - * @var Core\Upgrade\Custom_Tasks_Manager
434 + * @var Core\Upgrade\Manager
444 435 */
445 - public $custom_tasks;
436 + public $upgrade;
446 437
447 438 /**
448 - * Kits manager.
449 - *
450 - * Holds the plugin kits manager.
451 - *
452 - * @access public
453 - *
454 439 * @var Core\Kits\Manager
455 440 */
456 441 public $kits_manager;
457 442
458 443 /**
459 - * @var \Elementor\Data\V2\Manager
444 + * @var \Core\Data\Manager
460 445 */
461 - public $data_manager_v2;
446 + public $data_manager;
462 447
463 - /**
464 - * Legacy mode.
465 - *
466 - * Holds the plugin legacy mode data.
467 - *
468 - * @access public
469 - *
470 - * @var array
471 - */
472 448 public $legacy_mode;
473 449
474 450 /**
475 - * App.
476 - *
477 - * Holds the plugin app data.
478 - *
479 - * @since 3.0.0
480 - * @access public
481 - *
482 - * @var App\App
451 + * @var Core\App\App
483 452 */
484 453 public $app;
485 454
486 455 /**
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 456 * @var Wp_Api
495 457 */
496 458 public $wp;
497 459
498 460 /**
499 - * Experiments manager.
500 - *
501 - * Holds the plugin experiments manager.
502 - *
503 - * @since 3.1.0
504 - * @access public
505 - *
506 461 * @var Experiments_Manager
507 462 */
508 463 public $experiments;
509 464
510 465 /**
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 466 * @var Uploads_Manager
520 467 */
521 468 public $uploads_manager;
522 469
523 470 /**
524 - * Breakpoints manager.
525 - *
526 - * Holds the plugin breakpoints manager.
527 - *
528 - * @since 3.2.0
529 - * @access public
530 - *
531 471 * @var Breakpoints_Manager
532 472 */
533 473 public $breakpoints;
534 474
535 475 /**
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 476 * @var Assets_Loader
545 477 */
546 478 public $assets_loader;
547 479
@@ -556,13 +488,10 @@
556 488 * @access public
557 489 * @since 1.0.0
558 490 */
559 491 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 - );
492 + // Cloning instances of the class is forbidden.
493 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
565 494 }
566 495
567 496 /**
568 497 * Wakeup.
@@ -572,13 +501,10 @@
572 501 * @access public
573 502 * @since 1.0.0
574 503 */
575 504 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 - );
505 + // Unserializing instances of the class is forbidden.
506 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
581 507 }
582 508
583 509 /**
584 510 * Instance.
@@ -624,12 +550,11 @@
624 550
625 551 /**
626 552 * Elementor init.
627 553 *
628 - * Fires when Elementor components are initialized.
554 + * Fires on Elementor init, after Elementor has finished loading but
555 + * before any headers are sent.
629 556 *
630 - * After Elementor finished loading but before any headers are sent.
631 - *
632 557 * @since 1.0.0
633 558 */
634 559 do_action( 'elementor/init' );
635 560 }
@@ -681,8 +606,9 @@
681 606 private function init_components() {
682 607 $this->experiments = new Experiments_Manager();
683 608 $this->breakpoints = new Breakpoints_Manager();
684 609 $this->inspector = new Inspector();
610 + $this->debugger = $this->inspector;
685 611
686 612 Settings_Manager::run();
687 613
688 614 $this->db = new DB();
@@ -688,8 +614,9 @@
688 614 $this->db = new DB();
689 615 $this->controls_manager = new Controls_Manager();
690 616 $this->documents = new Documents_Manager();
691 617 $this->kits_manager = new Kits_Manager();
618 + $this->schemes_manager = new Schemes_Manager();
692 619 $this->elements_manager = new Elements_Manager();
693 620 $this->widgets_manager = new Widgets_Manager();
694 621 $this->skins_manager = new Skins_Manager();
695 622 $this->files_manager = new Files_Manager();
@@ -711,20 +638,15 @@
711 638 $this->wp = new Wp_Api();
712 639 $this->assets_loader = new Assets_Loader();
713 640 $this->uploads_manager = new Uploads_Manager();
714 641
715 - $this->admin_menu_manager = new Admin_Menu_Manager();
716 - $this->admin_menu_manager->register_actions();
717 -
718 642 User::init();
719 - User_Data::init();
720 643 Api::init();
721 644 Tracker::init();
722 645
723 646 $this->upgrade = new Core\Upgrade\Manager();
724 - $this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager();
725 647
726 - $this->app = new App\App();
648 + $this->app = new Core\App\App();
727 649
728 650 if ( is_admin() ) {
729 651 $this->heartbeat = new Heartbeat();
730 652 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
@@ -729,8 +651,9 @@
729 651 $this->heartbeat = new Heartbeat();
730 652 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
731 653 $this->admin = new Admin();
732 654 $this->beta_testers = new Beta_Testers();
655 + new Elementor_3_Re_Migrate_Globals();
733 656 }
734 657 }
735 658
736 659 /**
@@ -740,11 +663,43 @@
740 663 public function init_common() {
741 664 $this->common = new CommonApp();
742 665
743 666 $this->common->init_components();
667 +
668 + $this->ajax = $this->common->get_component( 'ajax' );
744 669 }
745 670
746 671 /**
672 + * Get Legacy Mode
673 + *
674 + * @since 3.0.0
675 + * @deprecated 3.1.0 Use `Plugin::$instance->experiments->is_feature_active()` instead
676 + *
677 + * @param string $mode_name Optional. Default is null
678 + *
679 + * @return bool|bool[]
680 + */
681 + public function get_legacy_mode( $mode_name = null ) {
682 + self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation
683 + ->deprecated_function( __METHOD__, '3.1.0', 'Plugin::$instance->experiments->is_feature_active()' );
684 +
685 + $legacy_mode = [
686 + 'elementWrappers' => ! self::$instance->experiments->is_feature_active( 'e_dom_optimization' ),
687 + ];
688 +
689 + if ( ! $mode_name ) {
690 + return $legacy_mode;
691 + }
692 +
693 + if ( isset( $legacy_mode[ $mode_name ] ) ) {
694 + return $legacy_mode[ $mode_name ];
695 + }
696 +
697 + // If there is no legacy mode with the given mode name;
698 + return false;
699 + }
700 +
701 + /**
747 702 * Add custom post type support.
748 703 *
749 704 * Register Elementor support for all the supported post types defined by
750 705 * the user in the admin screen and saved as `elementor_cpt_support` option
@@ -756,9 +711,9 @@
756 711 * @since 1.0.0
757 712 * @access private
758 713 */
759 714 private function add_cpt_support() {
760 - $cpt_support = get_option( 'elementor_cpt_support', self::ELEMENTOR_DEFAULT_POST_TYPES );
715 + $cpt_support = get_option( 'elementor_cpt_support', [ 'page', 'post' ] );
761 716
762 717 foreach ( $cpt_support as $cpt_slug ) {
763 718 add_post_type_support( $cpt_slug, 'elementor' );
764 719 }
@@ -778,16 +733,16 @@
778 733 Autoloader::run();
779 734 }
780 735
781 736 /**
782 - * Magic getter for accessing certain properties.
737 + * Plugin Magic Getter
783 738 *
784 739 * @since 3.1.0
785 740 * @access public
786 741 *
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.
742 + * @param $property
743 + * @return mixed
744 + * @throws \Exception
790 745 */
791 746 public function __get( $property ) {
792 747 if ( 'posts_css_manager' === $property ) {
793 748 self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( 'Plugin::$instance->posts_css_manager', '2.7.0', 'Plugin::$instance->files_manager' );
@@ -794,14 +749,10 @@
794 749
795 750 return $this->files_manager;
796 751 }
797 752
798 - if ( 'data_manager' === $property ) {
799 - return Data_Manager::instance();
800 - }
801 -
802 753 if ( property_exists( $this, $property ) ) {
803 - throw new \Exception( 'Cannot access private property.' );
754 + throw new \Exception( 'Cannot access private property' );
804 755 }
805 756
806 757 return null;
807 758 }
@@ -817,19 +768,19 @@
817 768 private function __construct() {
818 769 $this->register_autoloader();
819 770
820 771 $this->logger = Log_Manager::instance();
821 - $this->data_manager_v2 = Data_Manager_V2::instance();
772 + $this->data_manager = Data_Manager::instance();
822 773
823 774 Maintenance::init();
824 775 Compatibility::register_actions();
825 776
826 777 add_action( 'init', [ $this, 'init' ], 0 );
827 - add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 );
778 + add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ] );
828 779 }
829 780
830 781 final public static function get_title() {
831 - return esc_html__( 'Elementor', 'elementor' );
782 + return __( 'Elementor', 'elementor' );
832 783 }
833 784 }
834 785
835 786 if ( ! defined( 'ELEMENTOR_TESTS' ) ) {