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