PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
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 | core/base/document.php +21 -46 4.0.83.28.0-dev2 View file →
@@ -5,9 +5,8 @@
5 5 use Elementor\Core\Base\Elements_Iteration_Actions\Base as Elements_Iteration_Action;
6 6 use Elementor\Core\Behaviors\Interfaces\Lock_Behavior;
7 7 use Elementor\Core\Files\CSS\Post as Post_CSS;
8 8 use Elementor\Core\Settings\Page\Model as Page_Model;
9 -use Elementor\Core\Utils\Collection;
10 9 use Elementor\Core\Utils\Exceptions;
11 10 use Elementor\Includes\Elements\Container;
12 11 use Elementor\Plugin;
13 12 use Elementor\Controls_Manager;
@@ -40,9 +39,8 @@
40 39 * Document type meta key.
41 40 */
42 41 const TYPE_META_KEY = '_elementor_template_type';
43 42 const PAGE_META_KEY = '_elementor_page_settings';
44 - const ELEMENTOR_DATA_META_KEY = '_elementor_data';
45 43
46 44 const BUILT_WITH_ELEMENTOR_META_KEY = '_elementor_edit_mode';
47 45
48 46 const CACHE_META_KEY = '_elementor_element_cache';
@@ -608,12 +606,8 @@
608 606
609 607 if ( $autosave_id ) {
610 608 $document = Plugin::$instance->documents->get( $autosave_id );
611 609 } elseif ( $create ) {
612 - if ( ! function_exists( 'wp_create_post_autosave' ) ) {
613 - require_once ABSPATH . 'wp-admin/includes/post.php';
614 - }
615 -
616 610 $autosave_id = wp_create_post_autosave( [
617 611 'post_ID' => $this->post->ID,
618 612 'post_type' => $this->post->post_type,
619 613 'post_title' => $this->post->post_title,
@@ -642,9 +636,9 @@
642 636 * Fired by `post_row_actions` and `page_row_actions` filters.
643 637 *
644 638 * @access public
645 639 *
646 - * @param array $actions An array of row action links.
640 + * @param array $actions An array of row action links.
647 641 *
648 642 * @return array An updated array of row action links.
649 643 */
650 644 public function filter_admin_row_actions( $actions ) {
@@ -729,16 +723,22 @@
729 723
730 724 do_action( 'elementor/document/before_get_config', $this );
731 725
732 726 if ( static::get_property( 'has_elements' ) ) {
733 - $elements_config = Collection::make( Plugin::$instance->elements_manager->get_element_types() )
734 - ->filter( fn( $element ) => ( ! empty( $element->get_config()['include_in_widgets_config'] ) ) )
735 - ->map( fn( $element ) => $element->get_config() )
736 - ->all();
727 + $container_config = [];
737 728
729 + if ( Plugin::$instance->experiments->is_feature_active( 'container' ) ) {
730 + $container_config['container'] =
731 + Plugin::$instance->elements_manager->get_element_types( 'container' )->get_config();
732 + }
733 +
734 + if ( Plugin::$instance->experiments->is_feature_active( 'atomic_widgets' ) ) {
735 + $container_config['div-block'] =
736 + Plugin::$instance->elements_manager->get_element_types( 'div-block' )->get_config();
737 + }
738 +
738 739 $config['elements'] = $this->get_elements_raw_data( null, true );
739 - // `get_elements_raw_data` has to be called before `get_widget_types_config`, because it affects it.
740 - $config['widgets'] = array_merge( $elements_config, Plugin::$instance->widgets_manager->get_widget_types_config() );
740 + $config['widgets'] = $container_config + Plugin::$instance->widgets_manager->get_widget_types_config();
741 741 }
742 742
743 743 $additional_config = [];
744 744
@@ -836,11 +836,9 @@
836 836 */
837 837 do_action( 'elementor/document/before_save', $this, $data );
838 838
839 839 if ( ! current_user_can( 'unfiltered_html' ) ) {
840 - $data = map_deep( $data, function ( $value ) {
841 - return is_bool( $value ) || is_null( $value ) ? $value : wp_kses_post( $value );
842 - } );
840 + $data = wp_kses_post_deep( $data );
843 841 }
844 842
845 843 if ( ! empty( $data['settings'] ) ) {
846 844 if ( isset( $data['settings']['post_status'] ) && self::STATUS_AUTOSAVE === $data['settings']['post_status'] ) {
@@ -1052,10 +1050,8 @@
1052 1050 * @param null $data
1053 1051 * @param bool $with_html_content
1054 1052 *
1055 1053 * @return array
1056 - *
1057 - * @throws \Exception If elements retrieval fails or data processing errors occur.
1058 1054 */
1059 1055 public function get_elements_raw_data( $data = null, $with_html_content = false ) {
1060 1056 if ( ! static::get_property( 'has_elements' ) ) {
1061 1057 return [];
@@ -1064,23 +1060,8 @@
1064 1060 if ( is_null( $data ) ) {
1065 1061 $data = $this->get_elements_data();
1066 1062 }
1067 1063
1068 - /**
1069 - * Filters document elements data after loading.
1070 - *
1071 - * Allows modification of elements data when loading (not saving).
1072 - * Useful for migrations, transformations, or data enrichment.
1073 - *
1074 - * @since 3.35.0
1075 - *
1076 - * @param array $data The elements data array.
1077 - * @param \Elementor\Core\Base\Document $document The document instance.
1078 - */
1079 - if ( ! $this->is_saving ) {
1080 - $data = apply_filters( 'elementor/document/load/data', $data, $this );
1081 - }
1082 -
1083 1064 // Change the current documents, so widgets can use `documents->get_current` and other post data
1084 1065 Plugin::$instance->documents->switch_to_document( $this );
1085 1066
1086 1067 $editor_data = [];
@@ -1121,9 +1102,9 @@
1121 1102 *
1122 1103 * @return array
1123 1104 */
1124 1105 public function get_elements_data( $status = self::STATUS_PUBLISH ) {
1125 - $elements = $this->get_json_meta( self::ELEMENTOR_DATA_META_KEY );
1106 + $elements = $this->get_json_meta( '_elementor_data' );
1126 1107
1127 1108 if ( self::STATUS_DRAFT === $status ) {
1128 1109 $autosave = $this->get_newer_autosave();
1129 1110
@@ -1129,9 +1110,9 @@
1129 1110
1130 1111 if ( is_object( $autosave ) ) {
1131 1112 $autosave_elements = Plugin::$instance->documents
1132 1113 ->get( $autosave->get_post()->ID )
1133 - ->get_json_meta( self::ELEMENTOR_DATA_META_KEY );
1114 + ->get_json_meta( '_elementor_data' );
1134 1115 }
1135 1116 }
1136 1117
1137 1118 if ( Plugin::$instance->editor->is_edit_mode() ) {
@@ -1368,9 +1349,9 @@
1368 1349 // We need the `wp_slash` in order to avoid the unslashing during the `update_post_meta`
1369 1350 $json_value = wp_slash( wp_json_encode( $editor_data ) );
1370 1351
1371 1352 // Don't use `update_post_meta` that can't handle `revision` post type
1372 - $is_meta_updated = update_metadata( 'post', $this->post->ID, self::ELEMENTOR_DATA_META_KEY, $json_value );
1353 + $is_meta_updated = update_metadata( 'post', $this->post->ID, '_elementor_data', $json_value );
1373 1354
1374 1355 /**
1375 1356 * Before saving data.
1376 1357 *
@@ -1476,9 +1457,9 @@
1476 1457 * @since 2.0.4
1477 1458 * @access public
1478 1459 *
1479 1460 * @param string $key Meta data key.
1480 - * @param mixed $value Meta data value.
1461 + * @param mixed $value Meta data value.
1481 1462 *
1482 1463 * @return bool|int
1483 1464 */
1484 1465 public function update_main_meta( $key, $value ) {
@@ -1640,10 +1621,8 @@
1640 1621 public function get_export_data() {
1641 1622 $content = Plugin::$instance->db->iterate_data( $this->get_elements_data(), function( $element_data ) {
1642 1623 $element_data['id'] = Utils::generate_random_string();
1643 1624
1644 - $element_data = apply_filters( 'elementor/document/element/replace_id', $element_data );
1645 -
1646 1625 $element = Plugin::$instance->elements_manager->create_element_instance( $element_data );
1647 1626
1648 1627 // If the widget/element does not exist, like a plugin that creates a widget but deactivated.
1649 1628 if ( ! $element ) {
@@ -1813,12 +1792,12 @@
1813 1792 }
1814 1793
1815 1794 /**
1816 1795 * @since 2.1.3
1817 - * @access public
1796 + * @access protected
1818 1797 */
1819 - public function print_elements( $elements_data ) {
1820 - $is_element_cache_active = 'disable' !== get_option( 'elementor_element_cache_ttl', '' );
1798 + protected function print_elements( $elements_data ) {
1799 + $is_element_cache_active = Plugin::$instance->experiments->is_feature_active( 'e_element_cache' ) && 'disable' !== get_option( 'elementor_element_cache_ttl', '' );
1821 1800 if ( ! $is_element_cache_active ) {
1822 1801 ob_start();
1823 1802
1824 1803 $this->do_print_elements( $elements_data );
@@ -2107,10 +2086,6 @@
2107 2086 $this->elements_iteration_actions[] = new Assets_Iteration_Action( $this );
2108 2087 }
2109 2088
2110 2089 return $this->elements_iteration_actions;
2111 - }
2112 -
2113 - public function get_elementor_version() {
2114 - return $this->get_main_meta( '_elementor_version' );
2115 2090 }
2116 2091 }