PluginProbe
Elementor Website Builder – more than just a page builder / 3.13.2
Elementor Website Builder – more than just a page builder v3.13.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 +63 -48 4.1.0-dev13.13.2 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -
3 2 namespace Elementor;
4 3
5 4 use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 5 use Elementor\Core\Wp_Api;
@@ -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,16 +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 - ];
50 -
51 46 /**
52 47 * Instance.
53 48 *
54 49 * Holds the plugin instance.
@@ -99,8 +94,20 @@
99 94 */
100 95 public $documents;
101 96
102 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 + /**
103 110 * Elements manager.
104 111 *
105 112 * Holds the plugin elements manager.
106 113 *
@@ -430,8 +437,19 @@
430 437 */
431 438 public $logger;
432 439
433 440 /**
441 + * Dev tools.
442 + *
443 + * Holds the plugin dev tools.
444 + *
445 + * @access private
446 + *
447 + * @var Dev_Tools
448 + */
449 + private $dev_tools;
450 +
451 + /**
434 452 * Upgrade manager.
435 453 *
436 454 * Holds the plugin upgrade manager.
437 455 *
@@ -694,8 +712,9 @@
694 712 $this->db = new DB();
695 713 $this->controls_manager = new Controls_Manager();
696 714 $this->documents = new Documents_Manager();
697 715 $this->kits_manager = new Kits_Manager();
716 + $this->schemes_manager = new Schemes_Manager();
698 717 $this->elements_manager = new Elements_Manager();
699 718 $this->widgets_manager = new Widgets_Manager();
700 719 $this->skins_manager = new Skins_Manager();
701 720 $this->files_manager = new Files_Manager();
@@ -721,9 +740,8 @@
721 740 $this->admin_menu_manager = new Admin_Menu_Manager();
722 741 $this->admin_menu_manager->register_actions();
723 742
724 743 User::init();
725 - User_Data::init();
726 744 Api::init();
727 745 Tracker::init();
728 746
729 747 $this->upgrade = new Core\Upgrade\Manager();
@@ -735,8 +753,9 @@
735 753 $this->heartbeat = new Heartbeat();
736 754 $this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
737 755 $this->admin = new Admin();
738 756 $this->beta_testers = new Beta_Testers();
757 + new Elementor_3_Re_Migrate_Globals();
739 758 }
740 759 }
741 760
742 761 /**
@@ -749,8 +768,38 @@
749 768 $this->common->init_components();
750 769 }
751 770
752 771 /**
772 + * Get Legacy Mode
773 + *
774 + * @since 3.0.0
775 + * @deprecated 3.1.0 Use `Plugin::$instance->experiments->is_feature_active()` instead
776 + *
777 + * @param string $mode_name Optional. Default is null
778 + *
779 + * @return bool|bool[]
780 + */
781 + public function get_legacy_mode( $mode_name = null ) {
782 + self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation
783 + ->deprecated_function( __METHOD__, '3.1.0', 'Plugin::$instance->experiments->is_feature_active()' );
784 +
785 + $legacy_mode = [
786 + 'elementWrappers' => ! self::$instance->experiments->is_feature_active( 'e_dom_optimization' ),
787 + ];
788 +
789 + if ( ! $mode_name ) {
790 + return $legacy_mode;
791 + }
792 +
793 + if ( isset( $legacy_mode[ $mode_name ] ) ) {
794 + return $legacy_mode[ $mode_name ];
795 + }
796 +
797 + // If there is no legacy mode with the given mode name;
798 + return false;
799 + }
800 +
801 + /**
753 802 * Add custom post type support.
754 803 *
755 804 * Register Elementor support for all the supported post types defined by
756 805 * the user in the admin screen and saved as `elementor_cpt_support` option
@@ -784,16 +833,16 @@
784 833 Autoloader::run();
785 834 }
786 835
787 836 /**
788 - * Magic getter for accessing certain properties.
837 + * Plugin Magic Getter
789 838 *
790 839 * @since 3.1.0
791 840 * @access public
792 841 *
793 - * @param string $property The property name.
794 - * @return mixed The property value or null if not found.
795 - * @throws \Exception If trying to access a private property.
842 + * @param $property
843 + * @return mixed
844 + * @throws \Exception
796 845 */
797 846 public function __get( $property ) {
798 847 if ( 'posts_css_manager' === $property ) {
799 848 self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( 'Plugin::$instance->posts_css_manager', '2.7.0', 'Plugin::$instance->files_manager' );
@@ -830,46 +879,12 @@
830 879 Compatibility::register_actions();
831 880
832 881 add_action( 'init', [ $this, 'init' ], 0 );
833 882 add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 );
834 - add_filter( 'rest_pre_insert_post', [ $this, 'sanitize_post_data' ], 10, 2 );
835 883 }
836 884
837 885 final public static function get_title() {
838 886 return esc_html__( 'Elementor', 'elementor' );
839 - }
840 -
841 - public function sanitize_post_data( $post, WP_REST_Request $request ) {
842 - if ( current_user_can( 'unfiltered_html' ) ) {
843 - return $post;
844 - }
845 -
846 - $meta = $request->get_param( 'meta' );
847 - if ( empty( $meta ) || ! is_array( $meta ) ) {
848 - return $post;
849 - }
850 -
851 - foreach ( self::SANITIZABLE_META_KEYS as $meta_key ) {
852 - $elementor_data = $meta[ $meta_key ] ?? null;
853 - if ( is_null( $elementor_data ) ) {
854 - continue;
855 - }
856 - if ( is_string( $elementor_data ) ) {
857 - $elementor_data = json_decode( $elementor_data, true );
858 - }
859 - if ( empty( $elementor_data ) ) {
860 - continue;
861 - }
862 -
863 - $elementor_data = map_deep($elementor_data, function ( $value ) {
864 - return is_bool( $value ) || is_null( $value ) ? $value : wp_kses_post( $value );
865 - });
866 -
867 - $meta[ $meta_key ] = wp_json_encode( $elementor_data );
868 - }
869 -
870 - $request->set_param( 'meta', $meta );
871 - return $post;
872 887 }
873 888 }
874 889
875 890 if ( ! defined( 'ELEMENTOR_TESTS' ) ) {