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