PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.2
Elementor Website Builder – more than just a page builder v3.17.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 | core/base/document.php +52 -292 4.1.0-dev23.17.2 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;
@@ -18,12 +17,11 @@
18 17 use Elementor\Utils;
19 18 use Elementor\Widget_Base;
20 19 use Elementor\Core\Settings\Page\Manager as PageManager;
21 20 use ElementorPro\Modules\Library\Widgets\Template;
22 -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
23 21
24 22 if ( ! defined( 'ABSPATH' ) ) {
25 - exit; // Exit if accessed directly.
23 + exit; // Exit if accessed directly
26 24 }
27 25
28 26 /**
29 27 * Elementor document.
@@ -40,14 +38,11 @@
40 38 * Document type meta key.
41 39 */
42 40 const TYPE_META_KEY = '_elementor_template_type';
43 41 const PAGE_META_KEY = '_elementor_page_settings';
44 - const ELEMENTOR_DATA_META_KEY = '_elementor_data';
45 42
46 43 const BUILT_WITH_ELEMENTOR_META_KEY = '_elementor_edit_mode';
47 44
48 - const CACHE_META_KEY = '_elementor_element_cache';
49 -
50 45 /**
51 46 * Document publish status.
52 47 */
53 48 const STATUS_PUBLISH = 'publish';
@@ -71,11 +66,9 @@
71 66 * Document pending status.
72 67 */
73 68 const STATUS_PENDING = 'pending';
74 69
75 - /**
76 - * @var int
77 - */
70 +
78 71 private $main_id;
79 72
80 73 /**
81 74 * @var bool
@@ -164,15 +157,8 @@
164 157 'edit_capability' => '',
165 158 'show_in_finder' => true,
166 159 'show_on_admin_bar' => true,
167 160 'support_kit' => false,
168 - 'show_navigator' => true,
169 - 'allow_adding_widgets' => true,
170 - 'support_page_layout' => true,
171 - 'show_copy_and_share' => false,
172 - 'library_close_title' => esc_html__( 'Close', 'elementor' ),
173 - 'publish_button_title' => esc_html__( 'Publish', 'elementor' ),
174 - 'allow_closing_remote_library' => true,
175 161 ];
176 162 }
177 163
178 164 /**
@@ -189,63 +175,20 @@
189 175
190 176 return [
191 177 'title' => static::get_title(), // JS Container title.
192 178 'widgets_settings' => [],
193 - 'elements_categories' => self::get_filtered_editor_panel_categories(),
179 + 'elements_categories' => static::get_editor_panel_categories(),
194 180 'default_route' => $default_route,
195 181 'has_elements' => static::get_property( 'has_elements' ),
196 182 'support_kit' => static::get_property( 'support_kit' ),
197 183 'messages' => [
198 - 'publish_notification' => sprintf(
199 - /* translators: %s: Document title. */
200 - esc_html__( 'Hurray! Your %s is live.', 'elementor' ),
201 - static::get_title()
202 - ),
184 + /* translators: %s: Document title. */
185 + 'publish_notification' => sprintf( esc_html__( 'Hurray! Your %s is live.', 'elementor' ), static::get_title() ),
203 186 ],
204 - 'show_navigator' => static::get_property( 'show_navigator' ),
205 - 'allow_adding_widgets' => static::get_property( 'allow_adding_widgets' ),
206 - 'show_copy_and_share' => static::get_property( 'show_copy_and_share' ),
207 - 'library_close_title' => static::get_property( 'library_close_title' ),
208 - 'publish_button_title' => static::get_property( 'publish_button_title' ),
209 - 'allow_closing_remote_library' => static::get_property( 'allow_closing_remote_library' ),
210 187 ];
211 188 }
212 189
213 - public static function get_filtered_editor_panel_categories(): array {
214 - $categories = static::get_editor_panel_categories();
215 - $has_pro = Utils::has_pro();
216 -
217 - foreach ( $categories as $index => $category ) {
218 - if ( isset( $category['promotion'] ) ) {
219 - $categories = self::get_panel_category_item( $category['promotion'], $index, $categories, $has_pro );
220 - }
221 - }
222 -
223 - return $categories;
224 - }
225 -
226 190 /**
227 - * @param $promotion
228 - * @param $index
229 - * @param array $categories
230 - *
231 - * @return array
232 - */
233 - private static function get_panel_category_item( $promotion, $index, array $categories, bool $has_pro ): array {
234 - if ( ! $has_pro ) {
235 - $categories[ $index ]['promotion'] = Filtered_Promotions_Manager::get_filtered_promotion_data(
236 - $promotion,
237 - 'elementor/panel/' . $index . '/custom_promotion',
238 - 'url'
239 - );
240 - } else {
241 - unset( $categories[ $index ]['promotion'] );
242 - }
243 -
244 - return $categories;
245 - }
246 -
247 - /**
248 191 * Get element title.
249 192 *
250 193 * Retrieve the element title.
251 194 *
@@ -263,13 +206,9 @@
263 206 return static::get_title();
264 207 }
265 208
266 209 public static function get_add_new_title() {
267 - return sprintf(
268 - /* translators: %s: Document title. */
269 - esc_html__( 'Add New %s', 'elementor' ),
270 - static::get_title()
271 - );
210 + return sprintf( esc_html__( 'Add New %s', 'elementor' ), static::get_title() );
272 211 }
273 212
274 213 /**
275 214 * Get property.
@@ -550,10 +489,12 @@
550 489 *
551 490 * @since 2.0.0
552 491 * @access public
553 492 *
493 + *
554 494 * @return bool|Document
555 495 */
496 +
556 497 public function get_newer_autosave() {
557 498 $autosave = $this->get_autosave();
558 499
559 500 // Detect if there exists an autosave newer than the post.
@@ -608,12 +549,8 @@
608 549
609 550 if ( $autosave_id ) {
610 551 $document = Plugin::$instance->documents->get( $autosave_id );
611 552 } elseif ( $create ) {
612 - if ( ! function_exists( 'wp_create_post_autosave' ) ) {
613 - require_once ABSPATH . 'wp-admin/includes/post.php';
614 - }
615 -
616 553 $autosave_id = wp_create_post_autosave( [
617 554 'post_ID' => $this->post->ID,
618 555 'post_type' => $this->post->post_type,
619 556 'post_title' => $this->post->post_title,
@@ -642,9 +579,9 @@
642 579 * Fired by `post_row_actions` and `page_row_actions` filters.
643 580 *
644 581 * @access public
645 582 *
646 - * @param array $actions An array of row action links.
583 + * @param array $actions An array of row action links.
647 584 *
648 585 * @return array An updated array of row action links.
649 586 */
650 587 public function filter_admin_row_actions( $actions ) {
@@ -729,16 +666,19 @@
729 666
730 667 do_action( 'elementor/document/before_get_config', $this );
731 668
732 669 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();
670 + $container_config = [];
671 + $experiments_manager = Plugin::$instance->experiments;
737 672
673 + if ( $experiments_manager->is_feature_active( 'container' ) ) {
674 + $container_config = [
675 + 'container' => Plugin::$instance->elements_manager->get_element_types( 'container' )->get_config(),
676 + ];
677 + }
678 +
738 679 $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() );
680 + $config['widgets'] = $container_config + Plugin::$instance->widgets_manager->get_widget_types_config();
741 681 }
742 682
743 683 $additional_config = [];
744 684
@@ -793,16 +733,8 @@
793 733 * @return bool
794 734 */
795 735 public function save( $data ) {
796 736 /**
797 - * Set locale to "C" to avoid issues with comma as decimal separator.
798 - *
799 - * @see https://github.com/elementor/elementor/issues/10992
800 - */
801 - $original_lc = setlocale( LC_NUMERIC, 0 );
802 - setlocale( LC_NUMERIC, 'C' );
803 -
804 - /**
805 737 * Document save data.
806 738 *
807 739 * Filter the document data before saving process starts.
808 740 *
@@ -836,11 +768,9 @@
836 768 */
837 769 do_action( 'elementor/document/before_save', $this, $data );
838 770
839 771 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 - } );
772 + $data = wp_kses_post_deep( $data );
843 773 }
844 774
845 775 if ( ! empty( $data['settings'] ) ) {
846 776 if ( isset( $data['settings']['post_status'] ) && self::STATUS_AUTOSAVE === $data['settings']['post_status'] ) {
@@ -867,11 +797,8 @@
867 797 $post_css = Post_CSS::create( $this->post->ID );
868 798
869 799 $post_css->delete();
870 800
871 - // Remove Document Cache
872 - $this->delete_cache();
873 -
874 801 /**
875 802 * After document save.
876 803 *
877 804 * Fires when document save is complete.
@@ -886,10 +813,8 @@
886 813 $this->set_is_saving( false );
887 814
888 815 $this->remove_handle_revisions_changed_filter();
889 816
890 - setlocale( LC_NUMERIC, $original_lc );
891 -
892 817 return true;
893 818 }
894 819
895 820 public function refresh_post() {
@@ -925,9 +850,9 @@
925 850 *
926 851 * @return bool Whether the post was built with Elementor.
927 852 */
928 853 public function is_built_with_elementor() {
929 - return (bool) $this->get_meta( self::BUILT_WITH_ELEMENTOR_META_KEY );
854 + return ! ! $this->get_meta( self::BUILT_WITH_ELEMENTOR_META_KEY );
930 855 }
931 856
932 857 /**
933 858 * Mark the post as "built with elementor" or not.
@@ -1037,9 +962,9 @@
1037 962 return $meta;
1038 963 }
1039 964
1040 965 public function update_json_meta( $key, $value ) {
1041 - return $this->update_meta(
966 + $this->update_meta(
1042 967 $key,
1043 968 // `wp_slash` in order to avoid the unslashing during the `update_post_meta`
1044 969 wp_slash( wp_json_encode( $value ) )
1045 970 );
@@ -1052,10 +977,8 @@
1052 977 * @param null $data
1053 978 * @param bool $with_html_content
1054 979 *
1055 980 * @return array
1056 - *
1057 - * @throws \Exception If elements retrieval fails or data processing errors occur.
1058 981 */
1059 982 public function get_elements_raw_data( $data = null, $with_html_content = false ) {
1060 983 if ( ! static::get_property( 'has_elements' ) ) {
1061 984 return [];
@@ -1064,23 +987,8 @@
1064 987 if ( is_null( $data ) ) {
1065 988 $data = $this->get_elements_data();
1066 989 }
1067 990
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 991 // Change the current documents, so widgets can use `documents->get_current` and other post data
1084 992 Plugin::$instance->documents->switch_to_document( $this );
1085 993
1086 994 $editor_data = [];
@@ -1105,9 +1013,9 @@
1105 1013 $element_data = $element->get_raw_data( $with_html_content );
1106 1014 }
1107 1015
1108 1016 $editor_data[] = $element_data;
1109 - }
1017 + } // End foreach().
1110 1018
1111 1019 Plugin::$instance->documents->restore_document();
1112 1020
1113 1021 return $editor_data;
@@ -1121,9 +1029,9 @@
1121 1029 *
1122 1030 * @return array
1123 1031 */
1124 1032 public function get_elements_data( $status = self::STATUS_PUBLISH ) {
1125 - $elements = $this->get_json_meta( self::ELEMENTOR_DATA_META_KEY );
1033 + $elements = $this->get_json_meta( '_elementor_data' );
1126 1034
1127 1035 if ( self::STATUS_DRAFT === $status ) {
1128 1036 $autosave = $this->get_newer_autosave();
1129 1037
@@ -1129,9 +1037,9 @@
1129 1037
1130 1038 if ( is_object( $autosave ) ) {
1131 1039 $autosave_elements = Plugin::$instance->documents
1132 1040 ->get( $autosave->get_post()->ID )
1133 - ->get_json_meta( self::ELEMENTOR_DATA_META_KEY );
1041 + ->get_json_meta( '_elementor_data' );
1134 1042 }
1135 1043 }
1136 1044
1137 1045 if ( Plugin::$instance->editor->is_edit_mode() ) {
@@ -1215,11 +1123,20 @@
1215 1123 if ( ! $elements_data ) {
1216 1124 $elements_data = $this->get_elements_data();
1217 1125 }
1218 1126
1127 + $is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' );
1219 1128 ?>
1220 1129 <div <?php Utils::print_html_attributes( $this->get_container_attributes() ); ?>>
1130 + <?php if ( ! $is_dom_optimization_active ) : ?>
1131 + <div class="elementor-inner">
1132 + <div class="elementor-section-wrap">
1133 + <?php endif; ?>
1221 1134 <?php $this->print_elements( $elements_data ); ?>
1135 + <?php if ( ! $is_dom_optimization_active ) : ?>
1136 + </div>
1137 + </div>
1138 + <?php endif; ?>
1222 1139 </div>
1223 1140 <?php
1224 1141 }
1225 1142
@@ -1236,13 +1153,10 @@
1236 1153 * @access public
1237 1154 */
1238 1155 public function get_panel_page_settings() {
1239 1156 return [
1240 - 'title' => sprintf(
1241 - /* translators: %s: Document title. */
1242 - esc_html__( '%s Settings', 'elementor' ),
1243 - static::get_title()
1244 - ),
1157 + /* translators: %s: Document title. */
1158 + 'title' => sprintf( esc_html__( '%s Settings', 'elementor' ), static::get_title() ),
1245 1159 ];
1246 1160 }
1247 1161
1248 1162 /**
@@ -1299,9 +1213,9 @@
1299 1213 * @param array|null $controls The available controls.
1300 1214 *
1301 1215 * @return array Element data.
1302 1216 */
1303 - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array {
1217 + public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array {
1304 1218 foreach ( $config as &$element_config ) {
1305 1219 $element_instance = Plugin::$instance->elements_manager->create_element_instance( $element_config );
1306 1220
1307 1221 if ( is_null( $element_instance ) ) {
@@ -1368,9 +1282,9 @@
1368 1282 // We need the `wp_slash` in order to avoid the unslashing during the `update_post_meta`
1369 1283 $json_value = wp_slash( wp_json_encode( $editor_data ) );
1370 1284
1371 1285 // 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 );
1286 + $is_meta_updated = update_metadata( 'post', $this->post->ID, '_elementor_data', $json_value );
1373 1287
1374 1288 /**
1375 1289 * Before saving data.
1376 1290 *
@@ -1438,8 +1352,9 @@
1438 1352 *
1439 1353 * @since 2.5.12
1440 1354 *
1441 1355 * @param \Elementor\Core\Base\Document $this The current document.
1356 + *
1442 1357 */
1443 1358 do_action( 'elementor/document/save_version', $this );
1444 1359 }
1445 1360 }
@@ -1476,9 +1391,9 @@
1476 1391 * @since 2.0.4
1477 1392 * @access public
1478 1393 *
1479 1394 * @param string $key Meta data key.
1480 - * @param mixed $value Meta data value.
1395 + * @param string $value Meta data value.
1481 1396 *
1482 1397 * @return bool|int
1483 1398 */
1484 1399 public function update_main_meta( $key, $value ) {
@@ -1553,21 +1468,13 @@
1553 1468 $date = date_i18n( _x( 'M j, H:i', 'revision date format', 'elementor' ), strtotime( $post->post_modified ) );
1554 1469 $display_name = get_the_author_meta( 'display_name', $post->post_author );
1555 1470
1556 1471 if ( $autosave_post || 'revision' === $post->post_type ) {
1557 - $last_edited = sprintf(
1558 - /* translators: 1: Saving date, 2: Author display name. */
1559 - esc_html__( 'Draft saved on %1$s by %2$s', 'elementor' ),
1560 - '<time>' . $date . '</time>',
1561 - $display_name
1562 - );
1472 + /* translators: 1: Saving date, 2: Author display name. */
1473 + $last_edited = sprintf( esc_html__( 'Draft saved on %1$s by %2$s', 'elementor' ), '<time>' . $date . '</time>', $display_name );
1563 1474 } else {
1564 - $last_edited = sprintf(
1565 - /* translators: 1: Editing date, 2: Author display name. */
1566 - esc_html__( 'Last edited on %1$s by %2$s', 'elementor' ),
1567 - '<time>' . $date . '</time>',
1568 - $display_name
1569 - );
1475 + /* translators: 1: Editing date, 2: Author display name. */
1476 + $last_edited = sprintf( esc_html__( 'Last edited on %1$s by %2$s', 'elementor' ), '<time>' . $date . '</time>', $display_name );
1570 1477 }
1571 1478
1572 1479 return $last_edited;
1573 1480 }
@@ -1606,9 +1513,9 @@
1606 1513 } else {
1607 1514 $this->post = get_post( $data['post_id'] );
1608 1515
1609 1516 if ( ! $this->post ) {
1610 - throw new \Exception( sprintf( 'Post ID #%s does not exist.', esc_html( $data['post_id'] ) ), Exceptions::NOT_FOUND ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
1517 + throw new \Exception( sprintf( 'Post ID #%s does not exist.', $data['post_id'] ), Exceptions::NOT_FOUND );
1611 1518 }
1612 1519 }
1613 1520
1614 1521 // Each Control_Stack is based on a unique ID.
@@ -1626,9 +1533,9 @@
1626 1533
1627 1534 parent::__construct( $data );
1628 1535 }
1629 1536
1630 - /**
1537 + /*
1631 1538 * Get Export Data
1632 1539 *
1633 1540 * Filters a document's data on export
1634 1541 *
@@ -1640,10 +1547,8 @@
1640 1547 public function get_export_data() {
1641 1548 $content = Plugin::$instance->db->iterate_data( $this->get_elements_data(), function( $element_data ) {
1642 1549 $element_data['id'] = Utils::generate_random_string();
1643 1550
1644 - $element_data = apply_filters( 'elementor/document/element/replace_id', $element_data );
1645 -
1646 1551 $element = Plugin::$instance->elements_manager->create_element_instance( $element_data );
1647 1552
1648 1553 // If the widget/element does not exist, like a plugin that creates a widget but deactivated.
1649 1554 if ( ! $element ) {
@@ -1667,9 +1572,9 @@
1667 1572 'thumbnail' => get_the_post_thumbnail_url( $this->post ),
1668 1573 ];
1669 1574 }
1670 1575
1671 - /**
1576 + /*
1672 1577 * Get Import Data
1673 1578 *
1674 1579 * Filters a document's data on import
1675 1580 *
@@ -1813,92 +1718,18 @@
1813 1718 }
1814 1719
1815 1720 /**
1816 1721 * @since 2.1.3
1817 - * @access public
1722 + * @access protected
1818 1723 */
1819 - public function print_elements( $elements_data ) {
1820 - $is_element_cache_active = 'disable' !== get_option( 'elementor_element_cache_ttl', '' );
1821 - if ( ! $is_element_cache_active ) {
1822 - ob_start();
1724 + protected function print_elements( $elements_data ) {
1725 + // Collect all data updaters that should be updated on runtime.
1726 + $runtime_elements_iteration_actions = $this->get_runtime_elements_iteration_actions();
1823 1727
1824 - $this->do_print_elements( $elements_data );
1825 -
1826 - $content = ob_get_clean();
1827 -
1828 - if ( has_blocks( $content ) ) {
1829 - $content = do_blocks( $content );
1830 - }
1831 -
1832 - echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1833 -
1834 - return;
1728 + if ( $runtime_elements_iteration_actions ) {
1729 + $this->iterate_elements( $elements_data, $runtime_elements_iteration_actions, 'render' );
1835 1730 }
1836 1731
1837 - $cached_data = $this->get_document_cache();
1838 -
1839 - if ( false === $cached_data ) {
1840 - add_filter( 'elementor/element/should_render_shortcode', '__return_true' );
1841 -
1842 - $scripts_to_queue = [];
1843 - $styles_to_queue = [];
1844 -
1845 - global $wp_scripts, $wp_styles;
1846 -
1847 - $should_store_scripts = $wp_scripts instanceof \WP_Scripts && $wp_styles instanceof \WP_Styles;
1848 - if ( $should_store_scripts ) {
1849 - $scripts_ignored = $wp_scripts->queue;
1850 - $styles_ignored = $wp_styles->queue;
1851 - }
1852 -
1853 - ob_start();
1854 -
1855 - $this->do_print_elements( $elements_data );
1856 -
1857 - if ( $should_store_scripts ) {
1858 - $scripts_to_queue = array_values( array_diff( $wp_scripts->queue, $scripts_ignored ) );
1859 - $styles_to_queue = array_values( array_diff( $wp_styles->queue, $styles_ignored ) );
1860 - }
1861 -
1862 - $cached_data = [
1863 - 'content' => ob_get_clean(),
1864 - 'scripts' => $scripts_to_queue,
1865 - 'styles' => $styles_to_queue,
1866 - ];
1867 -
1868 - if ( $this->should_store_cache_elements() ) {
1869 - $this->set_document_cache( $cached_data );
1870 - }
1871 -
1872 - remove_filter( 'elementor/element/should_render_shortcode', '__return_true' );
1873 - } else {
1874 - if ( ! empty( $cached_data['scripts'] ) ) {
1875 - foreach ( $cached_data['scripts'] as $script_handle ) {
1876 - wp_enqueue_script( $script_handle );
1877 - }
1878 - }
1879 -
1880 - if ( ! empty( $cached_data['styles'] ) ) {
1881 - foreach ( $cached_data['styles'] as $style_handle ) {
1882 - wp_enqueue_style( $style_handle );
1883 - }
1884 - }
1885 - }
1886 -
1887 - if ( ! empty( $cached_data['content'] ) ) {
1888 - $content = do_shortcode( $cached_data['content'] );
1889 -
1890 - if ( has_blocks( $content ) ) {
1891 - $content = do_blocks( $content );
1892 - }
1893 -
1894 - echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1895 - }
1896 - }
1897 -
1898 - protected function do_print_elements( $elements_data ) {
1899 - $this->update_runtime_elements( $elements_data );
1900 -
1901 1732 foreach ( $elements_data as $element_data ) {
1902 1733 $element = Plugin::$instance->elements_manager->create_element_instance( $element_data );
1903 1734
1904 1735 if ( ! $element ) {
@@ -1908,75 +1739,8 @@
1908 1739 $element->print_element();
1909 1740 }
1910 1741 }
1911 1742
1912 - public function update_runtime_elements( $elements_data = null ) {
1913 - if ( null === $elements_data ) {
1914 - $elements_data = $this->get_elements_data();
1915 - }
1916 -
1917 - // Collect all data updaters that should be updated on runtime.
1918 - $runtime_elements_iteration_actions = $this->get_runtime_elements_iteration_actions();
1919 -
1920 - if ( $runtime_elements_iteration_actions ) {
1921 - $this->iterate_elements( $elements_data, $runtime_elements_iteration_actions, 'render' );
1922 - }
1923 - }
1924 -
1925 - public function set_document_cache( $value ) {
1926 - $expiration_hours = get_option( 'elementor_element_cache_ttl', '' );
1927 -
1928 - if ( empty( $expiration_hours ) || ! is_numeric( $expiration_hours ) ) {
1929 - $expiration_hours = '24';
1930 - }
1931 -
1932 - $expiration_hours = absint( $expiration_hours );
1933 -
1934 - $expiration = '+' . $expiration_hours . ' hours';
1935 -
1936 - $data = [
1937 - 'timeout' => strtotime( $expiration, current_time( 'timestamp' ) ),
1938 - 'value' => $value,
1939 - ];
1940 -
1941 - $this->update_json_meta( static::CACHE_META_KEY, $data );
1942 - }
1943 -
1944 - private function get_document_cache() {
1945 - $cache = $this->get_json_meta( static::CACHE_META_KEY );
1946 -
1947 - if ( empty( $cache['timeout'] ) ) {
1948 - return false;
1949 - }
1950 -
1951 - if ( current_time( 'timestamp' ) > $cache['timeout'] ) {
1952 - return false;
1953 - }
1954 -
1955 - if ( ! is_array( $cache['value'] ) ) {
1956 - return false;
1957 - }
1958 -
1959 - return $cache['value'];
1960 - }
1961 -
1962 - protected function delete_cache() {
1963 - $this->delete_meta( static::CACHE_META_KEY );
1964 - }
1965 -
1966 - private function should_store_cache_elements() {
1967 - static $should_store_cache_elements = null;
1968 -
1969 - if ( null === $should_store_cache_elements ) {
1970 - $should_store_cache_elements = (
1971 - ! is_admin()
1972 - && ! Plugin::$instance->preview->is_preview_mode()
1973 - );
1974 - }
1975 -
1976 - return $should_store_cache_elements;
1977 - }
1978 -
1979 1743 protected function register_document_controls() {
1980 1744 $this->start_controls_section(
1981 1745 'document_settings',
1982 1746 [
@@ -2107,10 +1871,6 @@
2107 1871 $this->elements_iteration_actions[] = new Assets_Iteration_Action( $this );
2108 1872 }
2109 1873
2110 1874 return $this->elements_iteration_actions;
2111 - }
2112 -
2113 - public function get_elementor_version() {
2114 - return $this->get_main_meta( '_elementor_version' );
2115 1875 }
2116 1876 }