PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.2
Elementor Website Builder – more than just a page builder v3.4.2
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 +123 -49 4.2.33.4.2 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 }
@@ -38,9 +39,8 @@
38 39 *
39 40 * @since 1.0.0
40 41 */
41 42 class Plugin {
42 -
43 43 const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ];
44 44
45 45 /**
46 46 * Instance.
@@ -68,8 +68,22 @@
68 68 */
69 69 public $db;
70 70
71 71 /**
72 + * Ajax Manager.
73 + *
74 + * Holds the plugin ajax handlers which are responsible for ajax requests
75 + * and responses.
76 + *
77 + * @since 1.9.0
78 + * @deprecated 2.3.0 Use `Plugin::$instance->common->get_component( 'ajax' )` instead.
79 + * @access public
80 + *
81 + * @var Ajax
82 + */
83 + public $ajax;
84 +
85 + /**
72 86 * Controls manager.
73 87 *
74 88 * Holds the plugin controls manager handler is responsible for registering
75 89 * and initializing controls.
@@ -93,8 +107,20 @@
93 107 */
94 108 public $documents;
95 109
96 110 /**
111 + * Schemes manager.
112 + *
113 + * Holds the plugin schemes manager.
114 + *
115 + * @since 1.0.0
116 + * @access public
117 + *
118 + * @var Schemes_Manager
119 + */
120 + public $schemes_manager;
121 +
122 + /**
97 123 * Elements manager.
98 124 *
99 125 * Holds the plugin elements manager.
100 126 *
@@ -348,8 +374,21 @@
348 374 */
349 375 public $icons_manager;
350 376
351 377 /**
378 + * Files Manager.
379 + *
380 + * Holds the plugin files manager.
381 + *
382 + * @since 1.0.0
383 + * @deprecated 2.1.0 Use `Plugin::$files_manager` instead.
384 + * @access public
385 + *
386 + * @var Files_Manager
387 + */
388 + private $posts_css_manager;
389 +
390 + /**
352 391 * WordPress widgets manager.
353 392 *
354 393 * Holds the WordPress widgets manager.
355 394 *
@@ -384,8 +423,20 @@
384 423 */
385 424 public $beta_testers;
386 425
387 426 /**
427 + * Debugger.
428 + *
429 + * Holds the plugin debugger data.
430 + *
431 + * @deprecated 2.1.2 Use `Plugin::$inspector` instead.
432 + * @access public
433 + *
434 + * @var Inspector
435 + */
436 + public $debugger;
437 +
438 + /**
388 439 * Inspector.
389 440 *
390 441 * Holds the plugin inspector data.
391 442 *
@@ -396,13 +447,8 @@
396 447 */
397 448 public $inspector;
398 449
399 450 /**
400 - * @var Admin_Menu_Manager
401 - */
402 - public $admin_menu_manager;
403 -
404 - /**
405 451 * Common functionality.
406 452 *
407 453 * Holds the plugin common functionality.
408 454 *
@@ -424,8 +470,19 @@
424 470 */
425 471 public $logger;
426 472
427 473 /**
474 + * Dev tools.
475 + *
476 + * Holds the plugin dev tools.
477 + *
478 + * @access private
479 + *
480 + * @var Dev_Tools
481 + */
482 + private $dev_tools;
483 +
484 + /**
428 485 * Upgrade manager.
429 486 *
430 487 * Holds the plugin upgrade manager.
431 488 *
@@ -435,17 +492,8 @@
435 492 */
436 493 public $upgrade;
437 494
438 495 /**
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 496 * Kits manager.
449 497 *
450 498 * Holds the plugin kits manager.
451 499 *
@@ -455,11 +503,17 @@
455 503 */
456 504 public $kits_manager;
457 505
458 506 /**
459 - * @var \Elementor\Data\V2\Manager
507 + * Data manager.
508 + *
509 + * Holds the plugin data manager.
510 + *
511 + * @access public
512 + *
513 + * @var \Core\Data\Manager
460 514 */
461 - public $data_manager_v2;
515 + public $data_manager;
462 516
463 517 /**
464 518 * Legacy mode.
465 519 *
@@ -478,9 +532,9 @@
478 532 *
479 533 * @since 3.0.0
480 534 * @access public
481 535 *
482 - * @var App\App
536 + * @var Core\App\App
483 537 */
484 538 public $app;
485 539
486 540 /**
@@ -556,13 +610,10 @@
556 610 * @access public
557 611 * @since 1.0.0
558 612 */
559 613 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 - );
614 + // Cloning instances of the class is forbidden.
615 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
565 616 }
566 617
567 618 /**
568 619 * Wakeup.
@@ -572,13 +623,10 @@
572 623 * @access public
573 624 * @since 1.0.0
574 625 */
575 626 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 - );
627 + // Unserializing instances of the class is forbidden.
628 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
581 629 }
582 630
583 631 /**
584 632 * Instance.
@@ -681,8 +729,9 @@
681 729 private function init_components() {
682 730 $this->experiments = new Experiments_Manager();
683 731 $this->breakpoints = new Breakpoints_Manager();
684 732 $this->inspector = new Inspector();
733 + $this->debugger = $this->inspector;
685 734
686 735 Settings_Manager::run();
687 736
688 737 $this->db = new DB();
@@ -688,8 +737,9 @@
688 737 $this->db = new DB();
689 738 $this->controls_manager = new Controls_Manager();
690 739 $this->documents = new Documents_Manager();
691 740 $this->kits_manager = new Kits_Manager();
741 + $this->schemes_manager = new Schemes_Manager();
692 742 $this->elements_manager = new Elements_Manager();
693 743 $this->widgets_manager = new Widgets_Manager();
694 744 $this->skins_manager = new Skins_Manager();
695 745 $this->files_manager = new Files_Manager();
@@ -711,20 +761,15 @@
711 761 $this->wp = new Wp_Api();
712 762 $this->assets_loader = new Assets_Loader();
713 763 $this->uploads_manager = new Uploads_Manager();
714 764
715 - $this->admin_menu_manager = new Admin_Menu_Manager();
716 - $this->admin_menu_manager->register_actions();
717 -
718 765 User::init();
719 - User_Data::init();
720 766 Api::init();
721 767 Tracker::init();
722 768
723 769 $this->upgrade = new Core\Upgrade\Manager();
724 - $this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager();
725 770
726 - $this->app = new App\App();
771 + $this->app = new Core\App\App();
727 772
728 773 if ( is_admin() ) {
729 774 $this->heartbeat = new Heartbeat();
730 775 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
@@ -729,8 +774,9 @@
729 774 $this->heartbeat = new Heartbeat();
730 775 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
731 776 $this->admin = new Admin();
732 777 $this->beta_testers = new Beta_Testers();
778 + new Elementor_3_Re_Migrate_Globals();
733 779 }
734 780 }
735 781
736 782 /**
@@ -740,11 +786,43 @@
740 786 public function init_common() {
741 787 $this->common = new CommonApp();
742 788
743 789 $this->common->init_components();
790 +
791 + $this->ajax = $this->common->get_component( 'ajax' );
744 792 }
745 793
746 794 /**
795 + * Get Legacy Mode
796 + *
797 + * @since 3.0.0
798 + * @deprecated 3.1.0 Use `Plugin::$instance->experiments->is_feature_active()` instead
799 + *
800 + * @param string $mode_name Optional. Default is null
801 + *
802 + * @return bool|bool[]
803 + */
804 + public function get_legacy_mode( $mode_name = null ) {
805 + self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation
806 + ->deprecated_function( __METHOD__, '3.1.0', 'Plugin::$instance->experiments->is_feature_active()' );
807 +
808 + $legacy_mode = [
809 + 'elementWrappers' => ! self::$instance->experiments->is_feature_active( 'e_dom_optimization' ),
810 + ];
811 +
812 + if ( ! $mode_name ) {
813 + return $legacy_mode;
814 + }
815 +
816 + if ( isset( $legacy_mode[ $mode_name ] ) ) {
817 + return $legacy_mode[ $mode_name ];
818 + }
819 +
820 + // If there is no legacy mode with the given mode name;
821 + return false;
822 + }
823 +
824 + /**
747 825 * Add custom post type support.
748 826 *
749 827 * Register Elementor support for all the supported post types defined by
750 828 * the user in the admin screen and saved as `elementor_cpt_support` option
@@ -778,16 +856,16 @@
778 856 Autoloader::run();
779 857 }
780 858
781 859 /**
782 - * Magic getter for accessing certain properties.
860 + * Plugin Magic Getter
783 861 *
784 862 * @since 3.1.0
785 863 * @access public
786 864 *
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.
865 + * @param $property
866 + * @return mixed
867 + * @throws \Exception
790 868 */
791 869 public function __get( $property ) {
792 870 if ( 'posts_css_manager' === $property ) {
793 871 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 +872,10 @@
794 872
795 873 return $this->files_manager;
796 874 }
797 875
798 - if ( 'data_manager' === $property ) {
799 - return Data_Manager::instance();
800 - }
801 -
802 876 if ( property_exists( $this, $property ) ) {
803 - throw new \Exception( 'Cannot access private property.' );
877 + throw new \Exception( 'Cannot access private property' );
804 878 }
805 879
806 880 return null;
807 881 }
@@ -817,15 +891,15 @@
817 891 private function __construct() {
818 892 $this->register_autoloader();
819 893
820 894 $this->logger = Log_Manager::instance();
821 - $this->data_manager_v2 = Data_Manager_V2::instance();
895 + $this->data_manager = Data_Manager::instance();
822 896
823 897 Maintenance::init();
824 898 Compatibility::register_actions();
825 899
826 900 add_action( 'init', [ $this, 'init' ], 0 );
827 - add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 );
901 + add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ] );
828 902 }
829 903
830 904 final public static function get_title() {
831 905 return esc_html__( 'Elementor', 'elementor' );