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