PluginProbe
Elementor Website Builder – more than just a page builder / 3.29.0-dev4
Elementor Website Builder – more than just a page builder v3.29.0-dev4
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 +25 -57 4.2.43.29.0-dev4 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;
@@ -19,8 +18,9 @@
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 21 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
22 +use Elementor\Modules\AtomicWidgets\Module as Atomic_Widgets_Module;
23 23
24 24 if ( ! defined( 'ABSPATH' ) ) {
25 25 exit; // Exit if accessed directly.
26 26 }
@@ -46,10 +46,8 @@
46 46 const BUILT_WITH_ELEMENTOR_META_KEY = '_elementor_edit_mode';
47 47
48 48 const CACHE_META_KEY = '_elementor_element_cache';
49 49
50 - const UNEDITABLE_WITH_ELEMENTOR_TYPES = [ 'kit' ];
51 -
52 50 /**
53 51 * Document publish status.
54 52 */
55 53 const STATUS_PUBLISH = 'publish';
@@ -232,16 +230,9 @@
232 230 *
233 231 * @return array
234 232 */
235 233 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 ) {
234 + if ( ! $has_pro ) {
244 235 $categories[ $index ]['promotion'] = Filtered_Promotions_Manager::get_filtered_promotion_data(
245 236 $promotion,
246 237 'elementor/panel/' . $index . '/custom_promotion',
247 238 'url'
@@ -617,12 +608,8 @@
617 608
618 609 if ( $autosave_id ) {
619 610 $document = Plugin::$instance->documents->get( $autosave_id );
620 611 } elseif ( $create ) {
621 - if ( ! function_exists( 'wp_create_post_autosave' ) ) {
622 - require_once ABSPATH . 'wp-admin/includes/post.php';
623 - }
624 -
625 612 $autosave_id = wp_create_post_autosave( [
626 613 'post_ID' => $this->post->ID,
627 614 'post_type' => $this->post->post_type,
628 615 'post_title' => $this->post->post_title,
@@ -651,14 +638,14 @@
651 638 * Fired by `post_row_actions` and `page_row_actions` filters.
652 639 *
653 640 * @access public
654 641 *
655 - * @param array $actions An array of row action links.
642 + * @param array $actions An array of row action links.
656 643 *
657 644 * @return array An updated array of row action links.
658 645 */
659 646 public function filter_admin_row_actions( $actions ) {
660 - if ( $this->is_editable_with_elementor() ) {
647 + if ( $this->is_built_with_elementor() && $this->is_editable_by_current_user() ) {
661 648 $actions['edit_with_elementor'] = sprintf(
662 649 '<a href="%1$s">%2$s</a>',
663 650 $this->get_edit_url(),
664 651 __( 'Edit with Elementor', 'elementor' )
@@ -667,16 +654,8 @@
667 654
668 655 return $actions;
669 656 }
670 657
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 658 /**
680 659 * @since 2.0.0
681 660 * @access public
682 661 */
@@ -746,16 +725,26 @@
746 725
747 726 do_action( 'elementor/document/before_get_config', $this );
748 727
749 728 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();
729 + $container_config = [];
754 730
731 + if ( Plugin::$instance->experiments->is_feature_active( 'container' ) ) {
732 + $container_config['container'] =
733 + Plugin::$instance->elements_manager->get_element_types( 'container' )->get_config();
734 + }
735 +
736 + if ( Plugin::$instance->experiments->is_feature_active( Atomic_Widgets_Module::EXPERIMENT_NAME ) ) {
737 + // Order reflects the order in the editor.
738 + $atomic_elements = [ 'e-flexbox', 'e-div-block' ];
739 +
740 + foreach ( $atomic_elements as $element ) {
741 + $container_config[ $element ] = Plugin::$instance->elements_manager->get_element_types( $element )->get_config();
742 + }
743 + }
744 +
755 745 $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() );
746 + $config['widgets'] = $container_config + Plugin::$instance->widgets_manager->get_widget_types_config();
758 747 }
759 748
760 749 $additional_config = [];
761 750
@@ -853,9 +842,9 @@
853 842 */
854 843 do_action( 'elementor/document/before_save', $this, $data );
855 844
856 845 if ( ! current_user_can( 'unfiltered_html' ) ) {
857 - $data = Utils::kses_post_deep( $data );
846 + $data = wp_kses_post_deep( $data );
858 847 }
859 848
860 849 if ( ! empty( $data['settings'] ) ) {
861 850 if ( isset( $data['settings']['post_status'] ) && self::STATUS_AUTOSAVE === $data['settings']['post_status'] ) {
@@ -1067,10 +1056,8 @@
1067 1056 * @param null $data
1068 1057 * @param bool $with_html_content
1069 1058 *
1070 1059 * @return array
1071 - *
1072 - * @throws \Exception If elements retrieval fails or data processing errors occur.
1073 1060 */
1074 1061 public function get_elements_raw_data( $data = null, $with_html_content = false ) {
1075 1062 if ( ! static::get_property( 'has_elements' ) ) {
1076 1063 return [];
@@ -1079,23 +1066,8 @@
1079 1066 if ( is_null( $data ) ) {
1080 1067 $data = $this->get_elements_data();
1081 1068 }
1082 1069
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 1070 // Change the current documents, so widgets can use `documents->get_current` and other post data
1099 1071 Plugin::$instance->documents->switch_to_document( $this );
1100 1072
1101 1073 $editor_data = [];
@@ -1491,9 +1463,9 @@
1491 1463 * @since 2.0.4
1492 1464 * @access public
1493 1465 *
1494 1466 * @param string $key Meta data key.
1495 - * @param mixed $value Meta data value.
1467 + * @param mixed $value Meta data value.
1496 1468 *
1497 1469 * @return bool|int
1498 1470 */
1499 1471 public function update_main_meta( $key, $value ) {
@@ -1828,12 +1800,12 @@
1828 1800 }
1829 1801
1830 1802 /**
1831 1803 * @since 2.1.3
1832 - * @access public
1804 + * @access protected
1833 1805 */
1834 - public function print_elements( $elements_data ) {
1835 - $is_element_cache_active = 'disable' !== get_option( 'elementor_element_cache_ttl', '' );
1806 + protected function print_elements( $elements_data ) {
1807 + $is_element_cache_active = Plugin::$instance->experiments->is_feature_active( 'e_element_cache' ) && 'disable' !== get_option( 'elementor_element_cache_ttl', '' );
1836 1808 if ( ! $is_element_cache_active ) {
1837 1809 ob_start();
1838 1810
1839 1811 $this->do_print_elements( $elements_data );
@@ -2122,10 +2094,6 @@
2122 2094 $this->elements_iteration_actions[] = new Assets_Iteration_Action( $this );
2123 2095 }
2124 2096
2125 2097 return $this->elements_iteration_actions;
2126 - }
2127 -
2128 - public function get_elementor_version() {
2129 - return $this->get_main_meta( '_elementor_version' );
2130 2098 }
2131 2099 }