| @@ -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,16 +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 | - const UNEDITABLE_WITH_ELEMENTOR_TYPES = [ 'kit' ]; | |
| 51 | - | |
| 52 | 45 | /** |
| 53 | 46 | * Document publish status. |
| 54 | 47 | */ |
| 55 | 48 | const STATUS_PUBLISH = 'publish'; |
| @@ -73,11 +66,9 @@ | ||
| 73 | 66 | * Document pending status. |
| 74 | 67 | */ |
| 75 | 68 | const STATUS_PENDING = 'pending'; |
| 76 | 69 | |
| 77 | - /** | |
| 78 | - * @var int | |
| 79 | - */ | |
| 70 | + | |
| 80 | 71 | private $main_id; |
| 81 | 72 | |
| 82 | 73 | /** |
| 83 | 74 | * @var bool |
| @@ -103,44 +94,8 @@ | ||
| 103 | 94 | */ |
| 104 | 95 | protected $post; |
| 105 | 96 | |
| 106 | 97 | /** |
| 107 | - * @param array $internal_elements | |
| 108 | - * | |
| 109 | - * @return array[] | |
| 110 | - */ | |
| 111 | - private function get_container_elements_data( array $internal_elements ): array { | |
| 112 | - return [ | |
| 113 | - [ | |
| 114 | - 'id' => Utils::generate_random_string(), | |
| 115 | - 'elType' => 'container', | |
| 116 | - 'elements' => $internal_elements, | |
| 117 | - ], | |
| 118 | - ]; | |
| 119 | - } | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * @param array $internal_elements | |
| 123 | - * | |
| 124 | - * @return array[] | |
| 125 | - */ | |
| 126 | - private function get_sections_elements_data( array $internal_elements ): array { | |
| 127 | - return [ | |
| 128 | - [ | |
| 129 | - 'id' => Utils::generate_random_string(), | |
| 130 | - 'elType' => 'section', | |
| 131 | - 'elements' => [ | |
| 132 | - [ | |
| 133 | - 'id' => Utils::generate_random_string(), | |
| 134 | - 'elType' => 'column', | |
| 135 | - 'elements' => $internal_elements, | |
| 136 | - ], | |
| 137 | - ], | |
| 138 | - ], | |
| 139 | - ]; | |
| 140 | - } | |
| 141 | - | |
| 142 | - /** | |
| 143 | 98 | * @since 2.1.0 |
| 144 | 99 | * @access protected |
| 145 | 100 | * @static |
| 146 | 101 | */ |
| @@ -166,15 +121,8 @@ | ||
| 166 | 121 | 'edit_capability' => '', |
| 167 | 122 | 'show_in_finder' => true, |
| 168 | 123 | 'show_on_admin_bar' => true, |
| 169 | 124 | 'support_kit' => false, |
| 170 | - 'show_navigator' => true, | |
| 171 | - 'allow_adding_widgets' => true, | |
| 172 | - 'support_page_layout' => true, | |
| 173 | - 'show_copy_and_share' => false, | |
| 174 | - 'library_close_title' => esc_html__( 'Close', 'elementor' ), | |
| 175 | - 'publish_button_title' => esc_html__( 'Publish', 'elementor' ), | |
| 176 | - 'allow_closing_remote_library' => true, | |
| 177 | 125 | ]; |
| 178 | 126 | } |
| 179 | 127 | |
| 180 | 128 | /** |
| @@ -191,70 +139,20 @@ | ||
| 191 | 139 | |
| 192 | 140 | return [ |
| 193 | 141 | 'title' => static::get_title(), // JS Container title. |
| 194 | 142 | 'widgets_settings' => [], |
| 195 | - 'elements_categories' => self::get_filtered_editor_panel_categories(), | |
| 143 | + 'elements_categories' => static::get_editor_panel_categories(), | |
| 196 | 144 | 'default_route' => $default_route, |
| 197 | 145 | 'has_elements' => static::get_property( 'has_elements' ), |
| 198 | 146 | 'support_kit' => static::get_property( 'support_kit' ), |
| 199 | 147 | 'messages' => [ |
| 200 | - 'publish_notification' => sprintf( | |
| 201 | - /* translators: %s: Document title. */ | |
| 202 | - esc_html__( 'Hurray! Your %s is live.', 'elementor' ), | |
| 203 | - static::get_title() | |
| 204 | - ), | |
| 148 | + /* translators: %s: Document title. */ | |
| 149 | + 'publish_notification' => sprintf( esc_html__( 'Hurray! Your %s is live.', 'elementor' ), static::get_title() ), | |
| 205 | 150 | ], |
| 206 | - 'show_navigator' => static::get_property( 'show_navigator' ), | |
| 207 | - 'allow_adding_widgets' => static::get_property( 'allow_adding_widgets' ), | |
| 208 | - 'show_copy_and_share' => static::get_property( 'show_copy_and_share' ), | |
| 209 | - 'library_close_title' => static::get_property( 'library_close_title' ), | |
| 210 | - 'publish_button_title' => static::get_property( 'publish_button_title' ), | |
| 211 | - 'allow_closing_remote_library' => static::get_property( 'allow_closing_remote_library' ), | |
| 212 | 151 | ]; |
| 213 | 152 | } |
| 214 | 153 | |
| 215 | - public static function get_filtered_editor_panel_categories(): array { | |
| 216 | - $categories = static::get_editor_panel_categories(); | |
| 217 | - $has_pro = Utils::has_pro(); | |
| 218 | - | |
| 219 | - foreach ( $categories as $index => $category ) { | |
| 220 | - if ( isset( $category['promotion'] ) ) { | |
| 221 | - $categories = self::get_panel_category_item( $category['promotion'], $index, $categories, $has_pro ); | |
| 222 | - } | |
| 223 | - } | |
| 224 | - | |
| 225 | - return $categories; | |
| 226 | - } | |
| 227 | - | |
| 228 | 154 | /** |
| 229 | - * @param $promotion | |
| 230 | - * @param $index | |
| 231 | - * @param array $categories | |
| 232 | - * | |
| 233 | - * @return array | |
| 234 | - */ | |
| 235 | - private static function get_panel_category_item( $promotion, $index, array $categories, bool $has_pro ): array { | |
| 236 | - $keep_promotion = $has_pro && apply_filters( | |
| 237 | - 'elementor/document/panel_category_keep_promotion', | |
| 238 | - false, | |
| 239 | - $index, | |
| 240 | - $promotion | |
| 241 | - ); | |
| 242 | - | |
| 243 | - if ( ! $has_pro || $keep_promotion ) { | |
| 244 | - $categories[ $index ]['promotion'] = Filtered_Promotions_Manager::get_filtered_promotion_data( | |
| 245 | - $promotion, | |
| 246 | - 'elementor/panel/' . $index . '/custom_promotion', | |
| 247 | - 'url' | |
| 248 | - ); | |
| 249 | - } else { | |
| 250 | - unset( $categories[ $index ]['promotion'] ); | |
| 251 | - } | |
| 252 | - | |
| 253 | - return $categories; | |
| 254 | - } | |
| 255 | - | |
| 256 | - /** | |
| 257 | 155 | * Get element title. |
| 258 | 156 | * |
| 259 | 157 | * Retrieve the element title. |
| 260 | 158 | * |
| @@ -272,13 +170,9 @@ | ||
| 272 | 170 | return static::get_title(); |
| 273 | 171 | } |
| 274 | 172 | |
| 275 | 173 | public static function get_add_new_title() { |
| 276 | - return sprintf( | |
| 277 | - /* translators: %s: Document title. */ | |
| 278 | - esc_html__( 'Add New %s', 'elementor' ), | |
| 279 | - static::get_title() | |
| 280 | - ); | |
| 174 | + return sprintf( esc_html__( 'Add New %s', 'elementor' ), static::get_title() ); | |
| 281 | 175 | } |
| 282 | 176 | |
| 283 | 177 | /** |
| 284 | 178 | * Get property. |
| @@ -433,10 +327,9 @@ | ||
| 433 | 327 | $attributes['data-elementor-settings'] = wp_json_encode( $elementor_settings ); |
| 434 | 328 | } |
| 435 | 329 | } |
| 436 | 330 | |
| 437 | - // apply this filter to allow the attributes to be modified by different sources | |
| 438 | - return apply_filters( 'elementor/document/wrapper_attributes', $attributes, $this ); | |
| 331 | + return $attributes; | |
| 439 | 332 | } |
| 440 | 333 | |
| 441 | 334 | /** |
| 442 | 335 | * @since 2.0.0 |
| @@ -446,12 +339,12 @@ | ||
| 446 | 339 | $main_post_id = $this->get_main_id(); |
| 447 | 340 | $document = $this; |
| 448 | 341 | |
| 449 | 342 | // Ajax request from editor. |
| 450 | - $initial_document_id = Utils::get_super_global_value( $_POST, 'initial_document_id' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 451 | - | |
| 452 | - if ( ! empty( $initial_document_id ) ) { | |
| 453 | - $document = Plugin::$instance->documents->get( $initial_document_id ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 343 | + // PHPCS - only reading the value from $_POST['initial_document_id']. | |
| 344 | + if ( ! empty( $_POST['initial_document_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 345 | + // PHPCS - only reading the value from $_POST['initial_document_id']. | |
| 346 | + $document = Plugin::$instance->documents->get( $_POST['initial_document_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 454 | 347 | } |
| 455 | 348 | |
| 456 | 349 | $url = get_preview_post_link( |
| 457 | 350 | $document->get_main_id(), |
| @@ -559,10 +452,12 @@ | ||
| 559 | 452 | * |
| 560 | 453 | * @since 2.0.0 |
| 561 | 454 | * @access public |
| 562 | 455 | * |
| 456 | + * | |
| 563 | 457 | * @return bool|Document |
| 564 | 458 | */ |
| 459 | + | |
| 565 | 460 | public function get_newer_autosave() { |
| 566 | 461 | $autosave = $this->get_autosave(); |
| 567 | 462 | |
| 568 | 463 | // Detect if there exists an autosave newer than the post. |
| @@ -617,12 +512,8 @@ | ||
| 617 | 512 | |
| 618 | 513 | if ( $autosave_id ) { |
| 619 | 514 | $document = Plugin::$instance->documents->get( $autosave_id ); |
| 620 | 515 | } elseif ( $create ) { |
| 621 | - if ( ! function_exists( 'wp_create_post_autosave' ) ) { | |
| 622 | - require_once ABSPATH . 'wp-admin/includes/post.php'; | |
| 623 | - } | |
| 624 | - | |
| 625 | 516 | $autosave_id = wp_create_post_autosave( [ |
| 626 | 517 | 'post_ID' => $this->post->ID, |
| 627 | 518 | 'post_type' => $this->post->post_type, |
| 628 | 519 | 'post_title' => $this->post->post_title, |
| @@ -651,14 +542,14 @@ | ||
| 651 | 542 | * Fired by `post_row_actions` and `page_row_actions` filters. |
| 652 | 543 | * |
| 653 | 544 | * @access public |
| 654 | 545 | * |
| 655 | - * @param array $actions An array of row action links. | |
| 546 | + * @param array $actions An array of row action links. | |
| 656 | 547 | * |
| 657 | 548 | * @return array An updated array of row action links. |
| 658 | 549 | */ |
| 659 | 550 | public function filter_admin_row_actions( $actions ) { |
| 660 | - if ( $this->is_editable_with_elementor() ) { | |
| 551 | + if ( $this->is_built_with_elementor() && $this->is_editable_by_current_user() ) { | |
| 661 | 552 | $actions['edit_with_elementor'] = sprintf( |
| 662 | 553 | '<a href="%1$s">%2$s</a>', |
| 663 | 554 | $this->get_edit_url(), |
| 664 | 555 | __( 'Edit with Elementor', 'elementor' ) |
| @@ -667,16 +558,8 @@ | ||
| 667 | 558 | |
| 668 | 559 | return $actions; |
| 669 | 560 | } |
| 670 | 561 | |
| 671 | - public function is_editable_with_elementor() { | |
| 672 | - if ( in_array( $this->get_type(), self::UNEDITABLE_WITH_ELEMENTOR_TYPES ) ) { | |
| 673 | - return false; | |
| 674 | - } | |
| 675 | - | |
| 676 | - return $this->is_editable_by_current_user() && $this->is_built_with_elementor(); | |
| 677 | - } | |
| 678 | - | |
| 679 | 562 | /** |
| 680 | 563 | * @since 2.0.0 |
| 681 | 564 | * @access public |
| 682 | 565 | */ |
| @@ -701,12 +584,10 @@ | ||
| 701 | 584 | if ( $locked_user ) { |
| 702 | 585 | $locked_user = $locked_user->display_name; |
| 703 | 586 | } |
| 704 | 587 | |
| 705 | - $post = $this->get_main_post(); | |
| 588 | + $post_type_object = get_post_type_object( $this->get_main_post()->post_type ); | |
| 706 | 589 | |
| 707 | - $post_type_object = get_post_type_object( $post->post_type ); | |
| 708 | - | |
| 709 | 590 | $settings = SettingsManager::get_settings_managers_config(); |
| 710 | 591 | |
| 711 | 592 | $config = [ |
| 712 | 593 | 'id' => $this->get_main_id(), |
| @@ -734,28 +615,22 @@ | ||
| 734 | 615 | 'main_dashboard' => $this->get_main_dashboard_url(), |
| 735 | 616 | ], |
| 736 | 617 | ]; |
| 737 | 618 | |
| 738 | - $post_status_object = get_post_status_object( $post->post_status ); | |
| 739 | - | |
| 740 | - if ( $post_status_object ) { | |
| 741 | - $config['status'] = [ | |
| 742 | - 'value' => $post_status_object->name, | |
| 743 | - 'label' => $post_status_object->label, | |
| 744 | - ]; | |
| 745 | - } | |
| 746 | - | |
| 747 | 619 | do_action( 'elementor/document/before_get_config', $this ); |
| 748 | 620 | |
| 749 | 621 | if ( static::get_property( 'has_elements' ) ) { |
| 750 | - $elements_config = Collection::make( Plugin::$instance->elements_manager->get_element_types() ) | |
| 751 | - ->filter( fn( $element ) => ( ! empty( $element->get_config()['include_in_widgets_config'] ) ) ) | |
| 752 | - ->map( fn( $element ) => $element->get_config() ) | |
| 753 | - ->all(); | |
| 622 | + $container_config = []; | |
| 623 | + $experiments_manager = Plugin::$instance->experiments; | |
| 754 | 624 | |
| 625 | + if ( $experiments_manager->is_feature_active( 'container' ) ) { | |
| 626 | + $container_config = [ | |
| 627 | + 'container' => Plugin::$instance->elements_manager->get_element_types( 'container' )->get_config(), | |
| 628 | + ]; | |
| 629 | + } | |
| 630 | + | |
| 755 | 631 | $config['elements'] = $this->get_elements_raw_data( null, true ); |
| 756 | - // `get_elements_raw_data` has to be called before `get_widget_types_config`, because it affects it. | |
| 757 | - $config['widgets'] = array_merge( $elements_config, Plugin::$instance->widgets_manager->get_widget_types_config() ); | |
| 632 | + $config['widgets'] = $container_config + Plugin::$instance->widgets_manager->get_widget_types_config(); | |
| 758 | 633 | } |
| 759 | 634 | |
| 760 | 635 | $additional_config = []; |
| 761 | 636 | |
| @@ -810,16 +685,8 @@ | ||
| 810 | 685 | * @return bool |
| 811 | 686 | */ |
| 812 | 687 | public function save( $data ) { |
| 813 | 688 | /** |
| 814 | - * Set locale to "C" to avoid issues with comma as decimal separator. | |
| 815 | - * | |
| 816 | - * @see https://github.com/elementor/elementor/issues/10992 | |
| 817 | - */ | |
| 818 | - $original_lc = setlocale( LC_NUMERIC, 0 ); | |
| 819 | - setlocale( LC_NUMERIC, 'C' ); | |
| 820 | - | |
| 821 | - /** | |
| 822 | 689 | * Document save data. |
| 823 | 690 | * |
| 824 | 691 | * Filter the document data before saving process starts. |
| 825 | 692 | * |
| @@ -853,9 +720,9 @@ | ||
| 853 | 720 | */ |
| 854 | 721 | do_action( 'elementor/document/before_save', $this, $data ); |
| 855 | 722 | |
| 856 | 723 | if ( ! current_user_can( 'unfiltered_html' ) ) { |
| 857 | - $data = Utils::kses_post_deep( $data ); | |
| 724 | + $data = wp_kses_post_deep( $data ); | |
| 858 | 725 | } |
| 859 | 726 | |
| 860 | 727 | if ( ! empty( $data['settings'] ) ) { |
| 861 | 728 | if ( isset( $data['settings']['post_status'] ) && self::STATUS_AUTOSAVE === $data['settings']['post_status'] ) { |
| @@ -882,11 +749,8 @@ | ||
| 882 | 749 | $post_css = Post_CSS::create( $this->post->ID ); |
| 883 | 750 | |
| 884 | 751 | $post_css->delete(); |
| 885 | 752 | |
| 886 | - // Remove Document Cache | |
| 887 | - $this->delete_cache(); | |
| 888 | - | |
| 889 | 753 | /** |
| 890 | 754 | * After document save. |
| 891 | 755 | * |
| 892 | 756 | * Fires when document save is complete. |
| @@ -901,10 +765,8 @@ | ||
| 901 | 765 | $this->set_is_saving( false ); |
| 902 | 766 | |
| 903 | 767 | $this->remove_handle_revisions_changed_filter(); |
| 904 | 768 | |
| 905 | - setlocale( LC_NUMERIC, $original_lc ); | |
| 906 | - | |
| 907 | 769 | return true; |
| 908 | 770 | } |
| 909 | 771 | |
| 910 | 772 | public function refresh_post() { |
| @@ -940,9 +802,9 @@ | ||
| 940 | 802 | * |
| 941 | 803 | * @return bool Whether the post was built with Elementor. |
| 942 | 804 | */ |
| 943 | 805 | public function is_built_with_elementor() { |
| 944 | - return (bool) $this->get_meta( self::BUILT_WITH_ELEMENTOR_META_KEY ); | |
| 806 | + return ! ! $this->get_meta( self::BUILT_WITH_ELEMENTOR_META_KEY ); | |
| 945 | 807 | } |
| 946 | 808 | |
| 947 | 809 | /** |
| 948 | 810 | * Mark the post as "built with elementor" or not. |
| @@ -1051,16 +913,8 @@ | ||
| 1051 | 913 | |
| 1052 | 914 | return $meta; |
| 1053 | 915 | } |
| 1054 | 916 | |
| 1055 | - public function update_json_meta( $key, $value ) { | |
| 1056 | - return $this->update_meta( | |
| 1057 | - $key, | |
| 1058 | - // `wp_slash` in order to avoid the unslashing during the `update_post_meta` | |
| 1059 | - wp_slash( wp_json_encode( $value ) ) | |
| 1060 | - ); | |
| 1061 | - } | |
| 1062 | - | |
| 1063 | 917 | /** |
| 1064 | 918 | * @since 2.0.0 |
| 1065 | 919 | * @access public |
| 1066 | 920 | * |
| @@ -1067,10 +921,8 @@ | ||
| 1067 | 921 | * @param null $data |
| 1068 | 922 | * @param bool $with_html_content |
| 1069 | 923 | * |
| 1070 | 924 | * @return array |
| 1071 | - * | |
| 1072 | - * @throws \Exception If elements retrieval fails or data processing errors occur. | |
| 1073 | 925 | */ |
| 1074 | 926 | public function get_elements_raw_data( $data = null, $with_html_content = false ) { |
| 1075 | 927 | if ( ! static::get_property( 'has_elements' ) ) { |
| 1076 | 928 | return []; |
| @@ -1079,23 +931,8 @@ | ||
| 1079 | 931 | if ( is_null( $data ) ) { |
| 1080 | 932 | $data = $this->get_elements_data(); |
| 1081 | 933 | } |
| 1082 | 934 | |
| 1083 | - /** | |
| 1084 | - * Filters document elements data after loading. | |
| 1085 | - * | |
| 1086 | - * Allows modification of elements data when loading (not saving). | |
| 1087 | - * Useful for migrations, transformations, or data enrichment. | |
| 1088 | - * | |
| 1089 | - * @since 3.35.0 | |
| 1090 | - * | |
| 1091 | - * @param array $data The elements data array. | |
| 1092 | - * @param \Elementor\Core\Base\Document $document The document instance. | |
| 1093 | - */ | |
| 1094 | - if ( ! $this->is_saving ) { | |
| 1095 | - $data = apply_filters( 'elementor/document/load/data', $data, $this ); | |
| 1096 | - } | |
| 1097 | - | |
| 1098 | 935 | // Change the current documents, so widgets can use `documents->get_current` and other post data |
| 1099 | 936 | Plugin::$instance->documents->switch_to_document( $this ); |
| 1100 | 937 | |
| 1101 | 938 | $editor_data = []; |
| @@ -1120,9 +957,9 @@ | ||
| 1120 | 957 | $element_data = $element->get_raw_data( $with_html_content ); |
| 1121 | 958 | } |
| 1122 | 959 | |
| 1123 | 960 | $editor_data[] = $element_data; |
| 1124 | - } | |
| 961 | + } // End foreach(). | |
| 1125 | 962 | |
| 1126 | 963 | Plugin::$instance->documents->restore_document(); |
| 1127 | 964 | |
| 1128 | 965 | return $editor_data; |
| @@ -1136,9 +973,9 @@ | ||
| 1136 | 973 | * |
| 1137 | 974 | * @return array |
| 1138 | 975 | */ |
| 1139 | 976 | public function get_elements_data( $status = self::STATUS_PUBLISH ) { |
| 1140 | - $elements = $this->get_json_meta( self::ELEMENTOR_DATA_META_KEY ); | |
| 977 | + $elements = $this->get_json_meta( '_elementor_data' ); | |
| 1141 | 978 | |
| 1142 | 979 | if ( self::STATUS_DRAFT === $status ) { |
| 1143 | 980 | $autosave = $this->get_newer_autosave(); |
| 1144 | 981 | |
| @@ -1144,9 +981,9 @@ | ||
| 1144 | 981 | |
| 1145 | 982 | if ( is_object( $autosave ) ) { |
| 1146 | 983 | $autosave_elements = Plugin::$instance->documents |
| 1147 | 984 | ->get( $autosave->get_post()->ID ) |
| 1148 | - ->get_json_meta( self::ELEMENTOR_DATA_META_KEY ); | |
| 985 | + ->get_json_meta( '_elementor_data' ); | |
| 1149 | 986 | } |
| 1150 | 987 | } |
| 1151 | 988 | |
| 1152 | 989 | if ( Plugin::$instance->editor->is_edit_mode() ) { |
| @@ -1207,20 +1044,28 @@ | ||
| 1207 | 1044 | ]; |
| 1208 | 1045 | } |
| 1209 | 1046 | |
| 1210 | 1047 | // TODO: Better coding to start template for editor |
| 1211 | - $converted_blocks = [ | |
| 1048 | + return [ | |
| 1212 | 1049 | [ |
| 1213 | 1050 | 'id' => Utils::generate_random_string(), |
| 1214 | - 'elType' => $widget_type::get_type(), | |
| 1215 | - 'widgetType' => $widget_type->get_name(), | |
| 1216 | - 'settings' => $settings, | |
| 1051 | + 'elType' => 'section', | |
| 1052 | + 'elements' => [ | |
| 1053 | + [ | |
| 1054 | + 'id' => Utils::generate_random_string(), | |
| 1055 | + 'elType' => 'column', | |
| 1056 | + 'elements' => [ | |
| 1057 | + [ | |
| 1058 | + 'id' => Utils::generate_random_string(), | |
| 1059 | + 'elType' => $widget_type::get_type(), | |
| 1060 | + 'widgetType' => $widget_type->get_name(), | |
| 1061 | + 'settings' => $settings, | |
| 1062 | + ], | |
| 1063 | + ], | |
| 1064 | + ], | |
| 1065 | + ], | |
| 1217 | 1066 | ], |
| 1218 | 1067 | ]; |
| 1219 | - | |
| 1220 | - return Plugin::$instance->experiments->is_feature_active( 'container' ) | |
| 1221 | - ? $this->get_container_elements_data( $converted_blocks ) | |
| 1222 | - : $this->get_sections_elements_data( $converted_blocks ); | |
| 1223 | 1068 | } |
| 1224 | 1069 | |
| 1225 | 1070 | /** |
| 1226 | 1071 | * @since 2.1.3 |
| @@ -1230,11 +1075,20 @@ | ||
| 1230 | 1075 | if ( ! $elements_data ) { |
| 1231 | 1076 | $elements_data = $this->get_elements_data(); |
| 1232 | 1077 | } |
| 1233 | 1078 | |
| 1079 | + $is_dom_optimization_active = Plugin::$instance->experiments->is_feature_active( 'e_dom_optimization' ); | |
| 1234 | 1080 | ?> |
| 1235 | 1081 | <div <?php Utils::print_html_attributes( $this->get_container_attributes() ); ?>> |
| 1082 | + <?php if ( ! $is_dom_optimization_active ) : ?> | |
| 1083 | + <div class="elementor-inner"> | |
| 1084 | + <div class="elementor-section-wrap"> | |
| 1085 | + <?php endif; ?> | |
| 1236 | 1086 | <?php $this->print_elements( $elements_data ); ?> |
| 1087 | + <?php if ( ! $is_dom_optimization_active ) : ?> | |
| 1088 | + </div> | |
| 1089 | + </div> | |
| 1090 | + <?php endif; ?> | |
| 1237 | 1091 | </div> |
| 1238 | 1092 | <?php |
| 1239 | 1093 | } |
| 1240 | 1094 | |
| @@ -1251,13 +1105,10 @@ | ||
| 1251 | 1105 | * @access public |
| 1252 | 1106 | */ |
| 1253 | 1107 | public function get_panel_page_settings() { |
| 1254 | 1108 | return [ |
| 1255 | - 'title' => sprintf( | |
| 1256 | - /* translators: %s: Document title. */ | |
| 1257 | - esc_html__( '%s Settings', 'elementor' ), | |
| 1258 | - static::get_title() | |
| 1259 | - ), | |
| 1109 | + /* translators: %s: Document title. */ | |
| 1110 | + 'title' => sprintf( esc_html__( '%s Settings', 'elementor' ), static::get_title() ), | |
| 1260 | 1111 | ]; |
| 1261 | 1112 | } |
| 1262 | 1113 | |
| 1263 | 1114 | /** |
| @@ -1297,41 +1148,25 @@ | ||
| 1297 | 1148 | |
| 1298 | 1149 | return $deleted && ! is_wp_error( $deleted ); |
| 1299 | 1150 | } |
| 1300 | 1151 | |
| 1301 | - public function force_delete() { | |
| 1302 | - $deleted = wp_delete_post( $this->post->ID, true ); | |
| 1303 | - | |
| 1304 | - return $deleted && ! is_wp_error( $deleted ); | |
| 1305 | - } | |
| 1306 | - | |
| 1307 | 1152 | /** |
| 1308 | - * On import update dynamic content (e.g. post and term IDs). | |
| 1309 | 1153 | * |
| 1310 | - * @since 3.8.0 | |
| 1154 | + * @since 3.6.0 | |
| 1311 | 1155 | * |
| 1312 | - * @param array $config The config of the passed element. | |
| 1313 | - * @param array $data The data that requires updating/replacement when imported. | |
| 1314 | - * @param array|null $controls The available controls. | |
| 1156 | + * @param array $config | |
| 1315 | 1157 | * |
| 1316 | - * @return array Element data. | |
| 1158 | + * @param array $map_old_new_post_ids | |
| 1317 | 1159 | */ |
| 1318 | - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array { | |
| 1160 | + public static function on_import_replace_dynamic_content( $config, $map_old_new_post_ids ) { | |
| 1319 | 1161 | foreach ( $config as &$element_config ) { |
| 1320 | 1162 | $element_instance = Plugin::$instance->elements_manager->create_element_instance( $element_config ); |
| 1321 | 1163 | |
| 1322 | - if ( is_null( $element_instance ) ) { | |
| 1323 | - continue; | |
| 1324 | - } | |
| 1164 | + if ( $element_instance ) { | |
| 1165 | + $element_config = $element_instance::on_import_replace_dynamic_content( $element_config, $map_old_new_post_ids ); | |
| 1325 | 1166 | |
| 1326 | - if ( $element_instance->has_own_method( 'on_import_replace_dynamic_content' ) ) { | |
| 1327 | - // TODO: Remove this check in the future. | |
| 1328 | - $element_config = $element_instance::on_import_replace_dynamic_content( $element_config, $data['post_ids'] ); | |
| 1329 | - } else { | |
| 1330 | - $element_config = $element_instance::on_import_update_dynamic_content( $element_config, $data, $element_instance->get_controls() ); | |
| 1167 | + $element_config['elements'] = static::on_import_replace_dynamic_content( $element_config['elements'], $map_old_new_post_ids ); | |
| 1331 | 1168 | } |
| 1332 | - | |
| 1333 | - $element_config['elements'] = static::on_import_update_dynamic_content( $element_config['elements'], $data ); | |
| 1334 | 1169 | } |
| 1335 | 1170 | |
| 1336 | 1171 | return $config; |
| 1337 | 1172 | } |
| @@ -1336,39 +1171,8 @@ | ||
| 1336 | 1171 | return $config; |
| 1337 | 1172 | } |
| 1338 | 1173 | |
| 1339 | 1174 | /** |
| 1340 | - * Update dynamic settings in the document for import. | |
| 1341 | - * | |
| 1342 | - * @param array $settings The settings of the document. | |
| 1343 | - * @param array $config Import config to update the settings. | |
| 1344 | - * | |
| 1345 | - * @return array | |
| 1346 | - */ | |
| 1347 | - public function on_import_update_settings( array $settings, array $config ): array { | |
| 1348 | - $controls = $this->get_controls(); | |
| 1349 | - $controls_manager = Plugin::$instance->controls_manager; | |
| 1350 | - | |
| 1351 | - foreach ( $settings as $key => $value ) { | |
| 1352 | - | |
| 1353 | - if ( ! isset( $controls[ $key ] ) ) { | |
| 1354 | - continue; | |
| 1355 | - } | |
| 1356 | - | |
| 1357 | - $control = $controls[ $key ]; | |
| 1358 | - $control_instance = $controls_manager->get_control( $control['type'] ); | |
| 1359 | - | |
| 1360 | - if ( ! $control_instance ) { | |
| 1361 | - continue; | |
| 1362 | - } | |
| 1363 | - | |
| 1364 | - $settings[ $key ] = $control_instance->on_import_update_settings( $value, $control, $config ); | |
| 1365 | - } | |
| 1366 | - | |
| 1367 | - return $settings; | |
| 1368 | - } | |
| 1369 | - | |
| 1370 | - /** | |
| 1371 | 1175 | * Save editor elements. |
| 1372 | 1176 | * |
| 1373 | 1177 | * Save data from the editor to the database. |
| 1374 | 1178 | * |
| @@ -1383,9 +1187,9 @@ | ||
| 1383 | 1187 | // We need the `wp_slash` in order to avoid the unslashing during the `update_post_meta` |
| 1384 | 1188 | $json_value = wp_slash( wp_json_encode( $editor_data ) ); |
| 1385 | 1189 | |
| 1386 | 1190 | // Don't use `update_post_meta` that can't handle `revision` post type |
| 1387 | - $is_meta_updated = update_metadata( 'post', $this->post->ID, self::ELEMENTOR_DATA_META_KEY, $json_value ); | |
| 1191 | + $is_meta_updated = update_metadata( 'post', $this->post->ID, '_elementor_data', $json_value ); | |
| 1388 | 1192 | |
| 1389 | 1193 | /** |
| 1390 | 1194 | * Before saving data. |
| 1391 | 1195 | * |
| @@ -1453,8 +1257,9 @@ | ||
| 1453 | 1257 | * |
| 1454 | 1258 | * @since 2.5.12 |
| 1455 | 1259 | * |
| 1456 | 1260 | * @param \Elementor\Core\Base\Document $this The current document. |
| 1261 | + * | |
| 1457 | 1262 | */ |
| 1458 | 1263 | do_action( 'elementor/document/save_version', $this ); |
| 1459 | 1264 | } |
| 1460 | 1265 | } |
| @@ -1491,9 +1296,9 @@ | ||
| 1491 | 1296 | * @since 2.0.4 |
| 1492 | 1297 | * @access public |
| 1493 | 1298 | * |
| 1494 | 1299 | * @param string $key Meta data key. |
| 1495 | - * @param mixed $value Meta data value. | |
| 1300 | + * @param string $value Meta data value. | |
| 1496 | 1301 | * |
| 1497 | 1302 | * @return bool|int |
| 1498 | 1303 | */ |
| 1499 | 1304 | public function update_main_meta( $key, $value ) { |
| @@ -1568,21 +1373,13 @@ | ||
| 1568 | 1373 | $date = date_i18n( _x( 'M j, H:i', 'revision date format', 'elementor' ), strtotime( $post->post_modified ) ); |
| 1569 | 1374 | $display_name = get_the_author_meta( 'display_name', $post->post_author ); |
| 1570 | 1375 | |
| 1571 | 1376 | if ( $autosave_post || 'revision' === $post->post_type ) { |
| 1572 | - $last_edited = sprintf( | |
| 1573 | - /* translators: 1: Saving date, 2: Author display name. */ | |
| 1574 | - esc_html__( 'Draft saved on %1$s by %2$s', 'elementor' ), | |
| 1575 | - '<time>' . $date . '</time>', | |
| 1576 | - $display_name | |
| 1577 | - ); | |
| 1377 | + /* translators: 1: Saving date, 2: Author display name. */ | |
| 1378 | + $last_edited = sprintf( esc_html__( 'Draft saved on %1$s by %2$s', 'elementor' ), '<time>' . $date . '</time>', $display_name ); | |
| 1578 | 1379 | } else { |
| 1579 | - $last_edited = sprintf( | |
| 1580 | - /* translators: 1: Editing date, 2: Author display name. */ | |
| 1581 | - esc_html__( 'Last edited on %1$s by %2$s', 'elementor' ), | |
| 1582 | - '<time>' . $date . '</time>', | |
| 1583 | - $display_name | |
| 1584 | - ); | |
| 1380 | + /* translators: 1: Editing date, 2: Author display name. */ | |
| 1381 | + $last_edited = sprintf( esc_html__( 'Last edited on %1$s by %2$s', 'elementor' ), '<time>' . $date . '</time>', $display_name ); | |
| 1585 | 1382 | } |
| 1586 | 1383 | |
| 1587 | 1384 | return $last_edited; |
| 1588 | 1385 | } |
| @@ -1621,9 +1418,9 @@ | ||
| 1621 | 1418 | } else { |
| 1622 | 1419 | $this->post = get_post( $data['post_id'] ); |
| 1623 | 1420 | |
| 1624 | 1421 | if ( ! $this->post ) { |
| 1625 | - throw new \Exception( sprintf( 'Post ID #%s does not exist.', esc_html( $data['post_id'] ) ), Exceptions::NOT_FOUND ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped | |
| 1422 | + throw new \Exception( sprintf( 'Post ID #%s does not exist.', $data['post_id'] ), Exceptions::NOT_FOUND ); | |
| 1626 | 1423 | } |
| 1627 | 1424 | } |
| 1628 | 1425 | |
| 1629 | 1426 | // Each Control_Stack is based on a unique ID. |
| @@ -1641,9 +1438,9 @@ | ||
| 1641 | 1438 | |
| 1642 | 1439 | parent::__construct( $data ); |
| 1643 | 1440 | } |
| 1644 | 1441 | |
| 1645 | - /** | |
| 1442 | + /* | |
| 1646 | 1443 | * Get Export Data |
| 1647 | 1444 | * |
| 1648 | 1445 | * Filters a document's data on export |
| 1649 | 1446 | * |
| @@ -1655,13 +1452,11 @@ | ||
| 1655 | 1452 | public function get_export_data() { |
| 1656 | 1453 | $content = Plugin::$instance->db->iterate_data( $this->get_elements_data(), function( $element_data ) { |
| 1657 | 1454 | $element_data['id'] = Utils::generate_random_string(); |
| 1658 | 1455 | |
| 1659 | - $element_data = apply_filters( 'elementor/document/element/replace_id', $element_data ); | |
| 1660 | - | |
| 1661 | 1456 | $element = Plugin::$instance->elements_manager->create_element_instance( $element_data ); |
| 1662 | 1457 | |
| 1663 | - // If the widget/element does not exist, like a plugin that creates a widget but deactivated. | |
| 1458 | + // If the widget/element isn't exist, like a plugin that creates a widget but deactivated | |
| 1664 | 1459 | if ( ! $element ) { |
| 1665 | 1460 | return null; |
| 1666 | 1461 | } |
| 1667 | 1462 | |
| @@ -1682,9 +1477,9 @@ | ||
| 1682 | 1477 | 'thumbnail' => get_the_post_thumbnail_url( $this->post ), |
| 1683 | 1478 | ]; |
| 1684 | 1479 | } |
| 1685 | 1480 | |
| 1686 | - /** | |
| 1481 | + /* | |
| 1687 | 1482 | * Get Import Data |
| 1688 | 1483 | * |
| 1689 | 1484 | * Filters a document's data on import |
| 1690 | 1485 | * |
| @@ -1749,12 +1544,10 @@ | ||
| 1749 | 1544 | } |
| 1750 | 1545 | } |
| 1751 | 1546 | } |
| 1752 | 1547 | |
| 1753 | - public function process_element_import_export( Controls_Stack $element, $method, $element_data = null ) { | |
| 1754 | - if ( null === $element_data ) { | |
| 1755 | - $element_data = $element->get_data(); | |
| 1756 | - } | |
| 1548 | + private function process_element_import_export( Controls_Stack $element, $method ) { | |
| 1549 | + $element_data = $element->get_data(); | |
| 1757 | 1550 | |
| 1758 | 1551 | if ( method_exists( $element, $method ) ) { |
| 1759 | 1552 | // TODO: Use the internal element data without parameters. |
| 1760 | 1553 | $element_data = $element->{$method}( $element_data ); |
| @@ -1767,17 +1560,10 @@ | ||
| 1767 | 1560 | if ( ! $control_class ) { |
| 1768 | 1561 | return $element_data; |
| 1769 | 1562 | } |
| 1770 | 1563 | |
| 1771 | - // Do not add default value to the final settings, if there is no value at the | |
| 1772 | - // data before the methods `on_import` or `on_export` called. | |
| 1773 | - $has_value = isset( $element_data['settings'][ $control['name'] ] ); | |
| 1774 | - | |
| 1775 | - if ( $has_value && method_exists( $control_class, $method ) ) { | |
| 1776 | - $element_data['settings'][ $control['name'] ] = $control_class->{$method}( | |
| 1777 | - $element_data['settings'][ $control['name'] ], | |
| 1778 | - $control | |
| 1779 | - ); | |
| 1564 | + if ( method_exists( $control_class, $method ) ) { | |
| 1565 | + $element_data['settings'][ $control['name'] ] = $control_class->{$method}( $element->get_settings( $control['name'] ), $control ); | |
| 1780 | 1566 | } |
| 1781 | 1567 | |
| 1782 | 1568 | // On Export, check if the control has an argument 'export' => false. |
| 1783 | 1569 | if ( 'on_export' === $method && isset( $control['export'] ) && false === $control['export'] ) { |
| @@ -1828,92 +1614,18 @@ | ||
| 1828 | 1614 | } |
| 1829 | 1615 | |
| 1830 | 1616 | /** |
| 1831 | 1617 | * @since 2.1.3 |
| 1832 | - * @access public | |
| 1618 | + * @access protected | |
| 1833 | 1619 | */ |
| 1834 | - public function print_elements( $elements_data ) { | |
| 1835 | - $is_element_cache_active = 'disable' !== get_option( 'elementor_element_cache_ttl', '' ); | |
| 1836 | - if ( ! $is_element_cache_active ) { | |
| 1837 | - ob_start(); | |
| 1620 | + protected function print_elements( $elements_data ) { | |
| 1621 | + // Collect all data updaters that should be updated on runtime. | |
| 1622 | + $runtime_elements_iteration_actions = $this->get_runtime_elements_iteration_actions(); | |
| 1838 | 1623 | |
| 1839 | - $this->do_print_elements( $elements_data ); | |
| 1840 | - | |
| 1841 | - $content = ob_get_clean(); | |
| 1842 | - | |
| 1843 | - if ( has_blocks( $content ) ) { | |
| 1844 | - $content = do_blocks( $content ); | |
| 1845 | - } | |
| 1846 | - | |
| 1847 | - echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1848 | - | |
| 1849 | - return; | |
| 1624 | + if ( $runtime_elements_iteration_actions ) { | |
| 1625 | + $this->iterate_elements( $elements_data, $runtime_elements_iteration_actions, 'render' ); | |
| 1850 | 1626 | } |
| 1851 | 1627 | |
| 1852 | - $cached_data = $this->get_document_cache(); | |
| 1853 | - | |
| 1854 | - if ( false === $cached_data ) { | |
| 1855 | - add_filter( 'elementor/element/should_render_shortcode', '__return_true' ); | |
| 1856 | - | |
| 1857 | - $scripts_to_queue = []; | |
| 1858 | - $styles_to_queue = []; | |
| 1859 | - | |
| 1860 | - global $wp_scripts, $wp_styles; | |
| 1861 | - | |
| 1862 | - $should_store_scripts = $wp_scripts instanceof \WP_Scripts && $wp_styles instanceof \WP_Styles; | |
| 1863 | - if ( $should_store_scripts ) { | |
| 1864 | - $scripts_ignored = $wp_scripts->queue; | |
| 1865 | - $styles_ignored = $wp_styles->queue; | |
| 1866 | - } | |
| 1867 | - | |
| 1868 | - ob_start(); | |
| 1869 | - | |
| 1870 | - $this->do_print_elements( $elements_data ); | |
| 1871 | - | |
| 1872 | - if ( $should_store_scripts ) { | |
| 1873 | - $scripts_to_queue = array_values( array_diff( $wp_scripts->queue, $scripts_ignored ) ); | |
| 1874 | - $styles_to_queue = array_values( array_diff( $wp_styles->queue, $styles_ignored ) ); | |
| 1875 | - } | |
| 1876 | - | |
| 1877 | - $cached_data = [ | |
| 1878 | - 'content' => ob_get_clean(), | |
| 1879 | - 'scripts' => $scripts_to_queue, | |
| 1880 | - 'styles' => $styles_to_queue, | |
| 1881 | - ]; | |
| 1882 | - | |
| 1883 | - if ( $this->should_store_cache_elements() ) { | |
| 1884 | - $this->set_document_cache( $cached_data ); | |
| 1885 | - } | |
| 1886 | - | |
| 1887 | - remove_filter( 'elementor/element/should_render_shortcode', '__return_true' ); | |
| 1888 | - } else { | |
| 1889 | - if ( ! empty( $cached_data['scripts'] ) ) { | |
| 1890 | - foreach ( $cached_data['scripts'] as $script_handle ) { | |
| 1891 | - wp_enqueue_script( $script_handle ); | |
| 1892 | - } | |
| 1893 | - } | |
| 1894 | - | |
| 1895 | - if ( ! empty( $cached_data['styles'] ) ) { | |
| 1896 | - foreach ( $cached_data['styles'] as $style_handle ) { | |
| 1897 | - wp_enqueue_style( $style_handle ); | |
| 1898 | - } | |
| 1899 | - } | |
| 1900 | - } | |
| 1901 | - | |
| 1902 | - if ( ! empty( $cached_data['content'] ) ) { | |
| 1903 | - $content = do_shortcode( $cached_data['content'] ); | |
| 1904 | - | |
| 1905 | - if ( has_blocks( $content ) ) { | |
| 1906 | - $content = do_blocks( $content ); | |
| 1907 | - } | |
| 1908 | - | |
| 1909 | - echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1910 | - } | |
| 1911 | - } | |
| 1912 | - | |
| 1913 | - protected function do_print_elements( $elements_data ) { | |
| 1914 | - $this->update_runtime_elements( $elements_data ); | |
| 1915 | - | |
| 1916 | 1628 | foreach ( $elements_data as $element_data ) { |
| 1917 | 1629 | $element = Plugin::$instance->elements_manager->create_element_instance( $element_data ); |
| 1918 | 1630 | |
| 1919 | 1631 | if ( ! $element ) { |
| @@ -1923,75 +1635,8 @@ | ||
| 1923 | 1635 | $element->print_element(); |
| 1924 | 1636 | } |
| 1925 | 1637 | } |
| 1926 | 1638 | |
| 1927 | - public function update_runtime_elements( $elements_data = null ) { | |
| 1928 | - if ( null === $elements_data ) { | |
| 1929 | - $elements_data = $this->get_elements_data(); | |
| 1930 | - } | |
| 1931 | - | |
| 1932 | - // Collect all data updaters that should be updated on runtime. | |
| 1933 | - $runtime_elements_iteration_actions = $this->get_runtime_elements_iteration_actions(); | |
| 1934 | - | |
| 1935 | - if ( $runtime_elements_iteration_actions ) { | |
| 1936 | - $this->iterate_elements( $elements_data, $runtime_elements_iteration_actions, 'render' ); | |
| 1937 | - } | |
| 1938 | - } | |
| 1939 | - | |
| 1940 | - public function set_document_cache( $value ) { | |
| 1941 | - $expiration_hours = get_option( 'elementor_element_cache_ttl', '' ); | |
| 1942 | - | |
| 1943 | - if ( empty( $expiration_hours ) || ! is_numeric( $expiration_hours ) ) { | |
| 1944 | - $expiration_hours = '24'; | |
| 1945 | - } | |
| 1946 | - | |
| 1947 | - $expiration_hours = absint( $expiration_hours ); | |
| 1948 | - | |
| 1949 | - $expiration = '+' . $expiration_hours . ' hours'; | |
| 1950 | - | |
| 1951 | - $data = [ | |
| 1952 | - 'timeout' => strtotime( $expiration, current_time( 'timestamp' ) ), | |
| 1953 | - 'value' => $value, | |
| 1954 | - ]; | |
| 1955 | - | |
| 1956 | - $this->update_json_meta( static::CACHE_META_KEY, $data ); | |
| 1957 | - } | |
| 1958 | - | |
| 1959 | - private function get_document_cache() { | |
| 1960 | - $cache = $this->get_json_meta( static::CACHE_META_KEY ); | |
| 1961 | - | |
| 1962 | - if ( empty( $cache['timeout'] ) ) { | |
| 1963 | - return false; | |
| 1964 | - } | |
| 1965 | - | |
| 1966 | - if ( current_time( 'timestamp' ) > $cache['timeout'] ) { | |
| 1967 | - return false; | |
| 1968 | - } | |
| 1969 | - | |
| 1970 | - if ( ! is_array( $cache['value'] ) ) { | |
| 1971 | - return false; | |
| 1972 | - } | |
| 1973 | - | |
| 1974 | - return $cache['value']; | |
| 1975 | - } | |
| 1976 | - | |
| 1977 | - protected function delete_cache() { | |
| 1978 | - $this->delete_meta( static::CACHE_META_KEY ); | |
| 1979 | - } | |
| 1980 | - | |
| 1981 | - private function should_store_cache_elements() { | |
| 1982 | - static $should_store_cache_elements = null; | |
| 1983 | - | |
| 1984 | - if ( null === $should_store_cache_elements ) { | |
| 1985 | - $should_store_cache_elements = ( | |
| 1986 | - ! is_admin() | |
| 1987 | - && ! Plugin::$instance->preview->is_preview_mode() | |
| 1988 | - ); | |
| 1989 | - } | |
| 1990 | - | |
| 1991 | - return $should_store_cache_elements; | |
| 1992 | - } | |
| 1993 | - | |
| 1994 | 1639 | protected function register_document_controls() { |
| 1995 | 1640 | $this->start_controls_section( |
| 1996 | 1641 | 'document_settings', |
| 1997 | 1642 | [ |
| @@ -2122,10 +1767,6 @@ | ||
| 2122 | 1767 | $this->elements_iteration_actions[] = new Assets_Iteration_Action( $this ); |
| 2123 | 1768 | } |
| 2124 | 1769 | |
| 2125 | 1770 | return $this->elements_iteration_actions; |
| 2126 | - } | |
| 2127 | - | |
| 2128 | - public function get_elementor_version() { | |
| 2129 | - return $this->get_main_meta( '_elementor_version' ); | |
| 2130 | 1771 | } |
| 2131 | 1772 | } |