PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.6
Elementor Website Builder – more than just a page builder v3.5.6
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 +72 -72 4.1.23.5.6 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;
@@ -23,10 +24,10 @@
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 27 use Elementor\Data\V2\Manager as Data_Manager_V2;
27 -use Elementor\Core\Files\Uploads_Manager;
28 -use WP_REST_Request;
28 +use Elementor\Core\Common\Modules\DevTools\Module as Dev_Tools;
29 +use Elementor\Core\Files\Uploads_Manager as Uploads_Manager;
29 30
30 31 if ( ! defined( 'ABSPATH' ) ) {
31 32 exit;
32 33 }
@@ -39,17 +40,10 @@
39 40 *
40 41 * @since 1.0.0
41 42 */
42 43 class Plugin {
43 -
44 44 const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ];
45 45
46 - private const SANITIZABLE_META_KEYS = [
47 - '_elementor_data',
48 - '_elementor_page_settings',
49 - '_elementor_global_class_data',
50 - ];
51 -
52 46 /**
53 47 * Instance.
54 48 *
55 49 * Holds the plugin instance.
@@ -100,8 +94,20 @@
100 94 */
101 95 public $documents;
102 96
103 97 /**
98 + * Schemes manager.
99 + *
100 + * Holds the plugin schemes manager.
101 + *
102 + * @since 1.0.0
103 + * @access public
104 + *
105 + * @var Schemes_Manager
106 + */
107 + public $schemes_manager;
108 +
109 + /**
104 110 * Elements manager.
105 111 *
106 112 * Holds the plugin elements manager.
107 113 *
@@ -403,13 +409,8 @@
403 409 */
404 410 public $inspector;
405 411
406 412 /**
407 - * @var Admin_Menu_Manager
408 - */
409 - public $admin_menu_manager;
410 -
411 - /**
412 413 * Common functionality.
413 414 *
414 415 * Holds the plugin common functionality.
415 416 *
@@ -431,8 +432,19 @@
431 432 */
432 433 public $logger;
433 434
434 435 /**
436 + * Dev tools.
437 + *
438 + * Holds the plugin dev tools.
439 + *
440 + * @access private
441 + *
442 + * @var Dev_Tools
443 + */
444 + private $dev_tools;
445 +
446 + /**
435 447 * Upgrade manager.
436 448 *
437 449 * Holds the plugin upgrade manager.
438 450 *
@@ -485,9 +497,9 @@
485 497 *
486 498 * @since 3.0.0
487 499 * @access public
488 500 *
489 - * @var App\App
501 + * @var Core\App\App
490 502 */
491 503 public $app;
492 504
493 505 /**
@@ -563,13 +575,10 @@
563 575 * @access public
564 576 * @since 1.0.0
565 577 */
566 578 public function __clone() {
567 - _doing_it_wrong(
568 - __FUNCTION__,
569 - sprintf( 'Cloning instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
570 - '1.0.0'
571 - );
579 + // Cloning instances of the class is forbidden.
580 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
572 581 }
573 582
574 583 /**
575 584 * Wakeup.
@@ -579,13 +588,10 @@
579 588 * @access public
580 589 * @since 1.0.0
581 590 */
582 591 public function __wakeup() {
583 - _doing_it_wrong(
584 - __FUNCTION__,
585 - sprintf( 'Unserializing instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
586 - '1.0.0'
587 - );
592 + // Unserializing instances of the class is forbidden.
593 + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' );
588 594 }
589 595
590 596 /**
591 597 * Instance.
@@ -695,8 +701,9 @@
695 701 $this->db = new DB();
696 702 $this->controls_manager = new Controls_Manager();
697 703 $this->documents = new Documents_Manager();
698 704 $this->kits_manager = new Kits_Manager();
705 + $this->schemes_manager = new Schemes_Manager();
699 706 $this->elements_manager = new Elements_Manager();
700 707 $this->widgets_manager = new Widgets_Manager();
701 708 $this->skins_manager = new Skins_Manager();
702 709 $this->files_manager = new Files_Manager();
@@ -718,13 +725,9 @@
718 725 $this->wp = new Wp_Api();
719 726 $this->assets_loader = new Assets_Loader();
720 727 $this->uploads_manager = new Uploads_Manager();
721 728
722 - $this->admin_menu_manager = new Admin_Menu_Manager();
723 - $this->admin_menu_manager->register_actions();
724 -
725 729 User::init();
726 - User_Data::init();
727 730 Api::init();
728 731 Tracker::init();
729 732
730 733 $this->upgrade = new Core\Upgrade\Manager();
@@ -729,9 +732,9 @@
729 732
730 733 $this->upgrade = new Core\Upgrade\Manager();
731 734 $this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager();
732 735
733 - $this->app = new App\App();
736 + $this->app = new Core\App\App();
734 737
735 738 if ( is_admin() ) {
736 739 $this->heartbeat = new Heartbeat();
737 740 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
@@ -736,8 +739,9 @@
736 739 $this->heartbeat = new Heartbeat();
737 740 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
738 741 $this->admin = new Admin();
739 742 $this->beta_testers = new Beta_Testers();
743 + new Elementor_3_Re_Migrate_Globals();
740 744 }
741 745 }
742 746
743 747 /**
@@ -750,8 +754,38 @@
750 754 $this->common->init_components();
751 755 }
752 756
753 757 /**
758 + * Get Legacy Mode
759 + *
760 + * @since 3.0.0
761 + * @deprecated 3.1.0 Use `Plugin::$instance->experiments->is_feature_active()` instead
762 + *
763 + * @param string $mode_name Optional. Default is null
764 + *
765 + * @return bool|bool[]
766 + */
767 + public function get_legacy_mode( $mode_name = null ) {
768 + self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation
769 + ->deprecated_function( __METHOD__, '3.1.0', 'Plugin::$instance->experiments->is_feature_active()' );
770 +
771 + $legacy_mode = [
772 + 'elementWrappers' => ! self::$instance->experiments->is_feature_active( 'e_dom_optimization' ),
773 + ];
774 +
775 + if ( ! $mode_name ) {
776 + return $legacy_mode;
777 + }
778 +
779 + if ( isset( $legacy_mode[ $mode_name ] ) ) {
780 + return $legacy_mode[ $mode_name ];
781 + }
782 +
783 + // If there is no legacy mode with the given mode name;
784 + return false;
785 + }
786 +
787 + /**
754 788 * Add custom post type support.
755 789 *
756 790 * Register Elementor support for all the supported post types defined by
757 791 * the user in the admin screen and saved as `elementor_cpt_support` option
@@ -785,16 +819,16 @@
785 819 Autoloader::run();
786 820 }
787 821
788 822 /**
789 - * Magic getter for accessing certain properties.
823 + * Plugin Magic Getter
790 824 *
791 825 * @since 3.1.0
792 826 * @access public
793 827 *
794 - * @param string $property The property name.
795 - * @return mixed The property value or null if not found.
796 - * @throws \Exception If trying to access a private property.
828 + * @param $property
829 + * @return mixed
830 + * @throws \Exception
797 831 */
798 832 public function __get( $property ) {
799 833 if ( 'posts_css_manager' === $property ) {
800 834 self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( 'Plugin::$instance->posts_css_manager', '2.7.0', 'Plugin::$instance->files_manager' );
@@ -806,9 +840,9 @@
806 840 return Data_Manager::instance();
807 841 }
808 842
809 843 if ( property_exists( $this, $property ) ) {
810 - throw new \Exception( 'Cannot access private property.' );
844 + throw new \Exception( 'Cannot access private property' );
811 845 }
812 846
813 847 return null;
814 848 }
@@ -830,47 +864,13 @@
830 864 Maintenance::init();
831 865 Compatibility::register_actions();
832 866
833 867 add_action( 'init', [ $this, 'init' ], 0 );
834 - add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 );
835 - add_filter( 'rest_pre_insert_post', [ $this, 'sanitize_post_data' ], 10, 2 );
868 + add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ] );
836 869 }
837 870
838 871 final public static function get_title() {
839 872 return esc_html__( 'Elementor', 'elementor' );
840 - }
841 -
842 - public function sanitize_post_data( $post, WP_REST_Request $request ) {
843 - if ( current_user_can( 'unfiltered_html' ) ) {
844 - return $post;
845 - }
846 -
847 - $meta = $request->get_param( 'meta' );
848 - if ( empty( $meta ) || ! is_array( $meta ) ) {
849 - return $post;
850 - }
851 -
852 - foreach ( self::SANITIZABLE_META_KEYS as $meta_key ) {
853 - $elementor_data = $meta[ $meta_key ] ?? null;
854 - if ( is_null( $elementor_data ) ) {
855 - continue;
856 - }
857 - if ( is_string( $elementor_data ) ) {
858 - $elementor_data = json_decode( $elementor_data, true );
859 - }
860 - if ( empty( $elementor_data ) ) {
861 - continue;
862 - }
863 -
864 - $elementor_data = map_deep($elementor_data, function ( $value ) {
865 - return is_bool( $value ) || is_null( $value ) ? $value : wp_kses_post( $value );
866 - });
867 -
868 - $meta[ $meta_key ] = wp_json_encode( $elementor_data );
869 - }
870 -
871 - $request->set_param( 'meta', $meta );
872 - return $post;
873 873 }
874 874 }
875 875
876 876 if ( ! defined( 'ELEMENTOR_TESTS' ) ) {