PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.3
Elementor Website Builder – more than just a page builder v3.5.3
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/settings/page/manager.php +10 -36 4.1.0-dev13.5.3 View file →
@@ -97,13 +97,13 @@
97 97 public function ajax_before_save_settings( array $data, $id ) {
98 98 $post = get_post( $id );
99 99
100 100 if ( empty( $post ) ) {
101 - throw new \Exception( 'Invalid post.', Exceptions::NOT_FOUND ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
101 + throw new \Exception( 'Invalid post.', Exceptions::NOT_FOUND );
102 102 }
103 103
104 104 if ( ! Utils::is_wp_cli() && ! current_user_can( 'edit_post', $id ) ) {
105 - throw new \Exception( 'Access denied.', Exceptions::FORBIDDEN ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
105 + throw new \Exception( 'Access denied.', Exceptions::FORBIDDEN );
106 106 }
107 107
108 108 // Avoid save empty post title.
109 109 if ( ! empty( $data['post_title'] ) ) {
@@ -113,24 +113,16 @@
113 113 if ( isset( $data['post_excerpt'] ) && post_type_supports( $post->post_type, 'excerpt' ) ) {
114 114 $post->post_excerpt = $data['post_excerpt'];
115 115 }
116 116
117 - if ( isset( $data['menu_order'] ) && is_post_type_hierarchical( $post->post_type ) ) {
118 - $post->menu_order = $data['menu_order'];
119 - }
120 -
121 117 if ( isset( $data['post_status'] ) ) {
122 118 $this->save_post_status( $id, $data['post_status'] );
123 119 unset( $post->post_status );
124 120 }
125 121
126 - if ( isset( $data['comment_status'] ) && post_type_supports( $post->post_type, 'comments' ) ) {
127 - $post->comment_status = $data['comment_status'];
128 - }
129 -
130 122 wp_update_post( $post );
131 123
132 - // Check updated status.
124 + // Check updated status
133 125 if ( Document::STATUS_PUBLISH === get_post_status( $id ) ) {
134 126 $autosave = wp_get_post_autosave( $post->ID );
135 127 if ( $autosave ) {
136 128 wp_delete_post_revision( $autosave->ID );
@@ -137,13 +129,8 @@
137 129 }
138 130 }
139 131
140 132 if ( isset( $data['post_featured_image'] ) && post_type_supports( $post->post_type, 'thumbnail' ) ) {
141 - // Check if the user is at least an Author before allowing them to modify the thumbnail.
142 - if ( ! current_user_can( 'publish_posts' ) ) {
143 - throw new \Exception( 'You do not have permission to modify the featured image.', Exceptions::FORBIDDEN ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
144 - }
145 -
146 133 if ( empty( $data['post_featured_image']['id'] ) ) {
147 134 delete_post_thumbnail( $post->ID );
148 135 } else {
149 136 set_post_thumbnail( $post->ID, $data['post_featured_image']['id'] );
@@ -179,11 +166,11 @@
179 166 if ( Object.values( tabs ).length > 1 ) { #>
180 167 <div class="elementor-panel-navigation">
181 168 <# _.each( tabs, function( tabTitle, tabSlug ) {
182 169 $e.bc.ensureTab( 'panel/page-settings', tabSlug ); #>
183 - <button class="elementor-component-tab elementor-panel-navigation-tab elementor-tab-control-{{ tabSlug }}" data-tab="{{ tabSlug }}">
184 - <span>{{{ tabTitle }}}</span>
185 - </button>
170 + <div class="elementor-component-tab elementor-panel-navigation-tab elementor-tab-control-{{ tabSlug }}" data-tab="{{ tabSlug }}">
171 + <a href="#">{{{ tabTitle }}}</a>
172 + </div>
186 173 <# } ); #>
187 174 </div>
188 175 <# } #>
189 176 <div id="elementor-panel-<?php echo esc_attr( $name ); ?>-settings-controls"></div>
@@ -320,10 +307,8 @@
320 307 'post_status',
321 308 'template',
322 309 'post_excerpt',
323 310 'post_featured_image',
324 - 'menu_order',
325 - 'comment_status',
326 311 ];
327 312 }
328 313
329 314 /**
@@ -328,14 +313,17 @@
328 313
329 314 /**
330 315 * @since 2.0.0
331 316 * @access public
317 + *
318 + * @param $post_id
319 + * @param $status
332 320 */
333 321 public function save_post_status( $post_id, $status ) {
334 322 $parent_id = wp_is_post_revision( $post_id );
335 323
336 324 if ( $parent_id ) {
337 - // Don't update revisions post-status.
325 + // Don't update revisions post-status
338 326 return;
339 327 }
340 328
341 329 $parent_id = $post_id;
@@ -343,14 +331,8 @@
343 331 $post = get_post( $parent_id );
344 332
345 333 $allowed_post_statuses = get_post_statuses();
346 334
347 - if ( $this->is_contributor_user() && $this->has_invalid_post_status_for_contributor( $status ) ) {
348 - // If the status is not allowed, set it to 'pending' by default.
349 - $status = 'pending';
350 - $post->post_status = $status;
351 - }
352 -
353 335 if ( isset( $allowed_post_statuses[ $status ] ) ) {
354 336 $post_type_object = get_post_type_object( $post->post_type );
355 337 if ( 'publish' !== $status || current_user_can( $post_type_object->cap->publish_posts ) ) {
356 338 $post->post_status = $status;
@@ -357,14 +339,6 @@
357 339 }
358 340 }
359 341
360 342 wp_update_post( $post );
361 - }
362 -
363 - private function is_contributor_user(): bool {
364 - return current_user_can( 'edit_posts' ) && ! current_user_can( 'publish_posts' );
365 - }
366 -
367 - private function has_invalid_post_status_for_contributor( $status ): bool {
368 - return 'draft' !== $status && 'pending' !== $status;
369 343 }
370 344 }