PluginProbe
Elementor Website Builder – more than just a page builder / 3.1.0-dev2
Elementor Website Builder – more than just a page builder v3.1.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 | includes/db.php +65 -39 3.1.0-dev13.1.0-dev2 View file →
@@ -1,7 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 +use Elementor\Core\Base\Document;
4 5 use Elementor\Core\DynamicTags\Manager;
5 6
6 7 if ( ! defined( 'ABSPATH' ) ) {
7 8 exit; // Exit if accessed directly.
@@ -23,30 +24,40 @@
23 24 const DB_VERSION = '0.4';
24 25
25 26 /**
26 27 * Post publish status.
28 + *
29 + * @deprecated 3.1.0 Use `Document::STATUS_PUBLISH` instead
27 30 */
28 - const STATUS_PUBLISH = 'publish';
31 + const STATUS_PUBLISH = Document::STATUS_PUBLISH;
29 32
30 33 /**
31 34 * Post draft status.
35 + *
36 + * @deprecated 3.1.0 Use `Document::STATUS_DRAFT` instead
32 37 */
33 - const STATUS_DRAFT = 'draft';
38 + const STATUS_DRAFT = Document::STATUS_DRAFT;
34 39
35 40 /**
36 41 * Post private status.
42 + *
43 + * @deprecated 3.1.0 Use `Document::STATUS_PRIVATE` instead
37 44 */
38 - const STATUS_PRIVATE = 'private';
45 + const STATUS_PRIVATE = Document::STATUS_PRIVATE;
39 46
40 47 /**
41 48 * Post autosave status.
49 + *
50 + * @deprecated 3.1.0 Use `Document::STATUS_AUTOSAVE` instead
42 51 */
43 - const STATUS_AUTOSAVE = 'autosave';
52 + const STATUS_AUTOSAVE = Document::STATUS_AUTOSAVE;
44 53
45 54 /**
46 55 * Post pending status.
56 + *
57 + * @deprecated 3.1.0 Use `Document::STATUS_PENDING` instead
47 58 */
48 - const STATUS_PENDING = 'pending';
59 + const STATUS_PENDING = Document::STATUS_PENDING;
49 60
50 61 /**
51 62 * Switched post data.
52 63 *
@@ -76,9 +87,9 @@
76 87 *
77 88 * Retrieve editor data from the database.
78 89 *
79 90 * @since 1.0.0
80 - *
91 + * @deprecated 3.1.0 Use `Plugin::$instance->documents->get( $post_id )->get_elements_raw_data( null, true )` OR `Plugin::$instance->documents->get_doc_or_auto_save( $post_id )->get_elements_raw_data( null, true )` instead
81 92 * @access public
82 93 *
83 94 * @param int $post_id Post ID.
84 95 * @param string $status Optional. Post status. Default is `publish`.
@@ -84,10 +95,19 @@
84 95 * @param string $status Optional. Post status. Default is `publish`.
85 96 *
86 97 * @return array Editor data.
87 98 */
88 - public function get_builder( $post_id, $status = self::STATUS_PUBLISH ) {
89 - if ( self::STATUS_DRAFT === $status ) {
99 + public function get_builder( $post_id, $status = Document::STATUS_PUBLISH ) {
100 + Plugin::$instance->modules_manager
101 + ->get_modules( 'dev-tools' )
102 + ->deprecation
103 + ->deprecated_function(
104 + __METHOD__,
105 + '3.1.0',
106 + '`Plugin::$instance->documents->get( $post_id )->get_elements_raw_data( null, true )` OR `Plugin::$instance->documents->get_doc_or_auto_save( $post_id )->get_elements_raw_data( null, true )`'
107 + );
108 +
109 + if ( Document::STATUS_DRAFT === $status ) {
90 110 $document = Plugin::$instance->documents->get_doc_or_auto_save( $post_id );
91 111 } else {
92 112 $document = Plugin::$instance->documents->get( $post_id );
93 113 }
@@ -128,39 +148,14 @@
128 148 return $meta;
129 149 }
130 150
131 151 /**
132 - * Get new editor from WordPress editor.
133 - *
134 - * When editing the with Elementor the first time, the current page content
135 - * is parsed into Text Editor Widget that contains the original data.
136 - *
137 - * @since 2.1.0
138 - * @deprecated 2.3.0 Use `Plugin::$instance->documents->get( $post_id )->convert_to_elementor()` instead
139 - * @access public
140 - *
141 - * @param int $post_id Post ID.
142 - *
143 - * @return array Content in Elementor format.
144 - */
145 - public function get_new_editor_from_wp_editor( $post_id ) {
146 - _deprecated_function( __METHOD__, '2.3.0', 'Plugin::$instance->documents->get( $post_id )->convert_to_elementor()' );
147 -
148 - $document = Plugin::$instance->documents->get( $post_id );
149 -
150 - if ( $document ) {
151 - return $document->convert_to_elementor();
152 - }
153 -
154 - return [];
155 - }
156 -
157 - /**
158 152 * Is using Elementor.
159 153 *
160 154 * Set whether the page is using Elementor or not.
161 155 *
162 156 * @since 1.5.0
157 + * @deprecated 3.1.0 Use `Plugin::$instance->documents->get( $post_id )->set_is_build_with_elementor( $is_elementor )` instead
163 158 * @access public
164 159 *
165 160 * @param int $post_id Post ID.
166 161 * @param bool $is_elementor Optional. Whether the page is elementor page.
@@ -166,14 +161,24 @@
166 161 * @param bool $is_elementor Optional. Whether the page is elementor page.
167 162 * Default is true.
168 163 */
169 164 public function set_is_elementor_page( $post_id, $is_elementor = true ) {
170 - if ( $is_elementor ) {
171 - // Use the string `builder` and not a boolean for rollback compatibility
172 - update_post_meta( $post_id, '_elementor_edit_mode', 'builder' );
173 - } else {
174 - delete_post_meta( $post_id, '_elementor_edit_mode' );
165 + Plugin::$instance->modules_manager
166 + ->get_modules( 'dev-tools' )
167 + ->deprecation
168 + ->deprecated_function(
169 + __METHOD__,
170 + '3.1.0',
171 + 'Plugin::$instance->documents->get( $post_id )->set_is_build_with_elementor( $is_elementor )'
172 + );
173 +
174 + $document = Plugin::$instance->documents->get( $post_id );
175 +
176 + if ( ! $document ) {
177 + return;
175 178 }
179 +
180 + $document->set_is_built_with_elementor( $is_elementor );
176 181 }
177 182
178 183 /**
179 184 * Render element plain content.
@@ -351,8 +356,29 @@
351 356 * @return bool Whether the post was built with Elementor.
352 357 */
353 358 public function is_built_with_elementor( $post_id ) {
354 359 return ! ! get_post_meta( $post_id, '_elementor_edit_mode', true );
360 + }
361 +
362 + /**
363 + * Is Elementor Landing Page.
364 + *
365 + * Check whether the post is an Elementor Landing Page.
366 + *
367 + * @since 3.1.0
368 + * @access public
369 + *
370 + * @param \WP_Post $post Post Object
371 + *
372 + * @return bool Whether the post was built with Elementor.
373 + */
374 + public function is_elementor_landing_page( $post ) {
375 + // If the post is not a page, save a call to the DB.
376 + if ( 'page' !== $post->post_type ) {
377 + return false;
378 + }
379 +
380 + return 'landing-page' === get_post_meta( $post->ID, '_elementor_template_type', true );
355 381 }
356 382
357 383 /**
358 384 * Switch to post.