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