| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Maximum number of revisions to display. |
| 26 | 26 | */ |
| 27 | - const MAX_REVISIONS_TO_DISPLAY = 50; | |
| 27 | + const MAX_REVISIONS_TO_DISPLAY = 100; | |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Authors list. |
| 31 | 31 | * |
| @@ -175,11 +175,11 @@ | ||
| 175 | 175 | 'author' => self::$authors[ $revision->post_author ]['display_name'], |
| 176 | 176 | 'timestamp' => strtotime( $revision->post_modified ), |
| 177 | 177 | 'date' => sprintf( |
| 178 | 178 | /* translators: 1: Human readable time difference, 2: Date. */ |
| 179 | - esc_html__( '%1$s ago (%2$s)', 'elementor' ), | |
| 180 | - '<time>' . $human_time . '</time>', | |
| 181 | - '<time>' . $date . '</time>' | |
| 179 | + __( '%1$s ago (%2$s)', 'elementor' ), | |
| 180 | + $human_time, | |
| 181 | + $date | |
| 182 | 182 | ), |
| 183 | 183 | 'type' => $type, |
| 184 | 184 | 'typeLabel' => $type_label, |
| 185 | 185 | 'gravatar' => self::$authors[ $revision->post_author ]['avatar'], |
| @@ -246,9 +246,9 @@ | ||
| 246 | 246 | * |
| 247 | 247 | * @param $data |
| 248 | 248 | * |
| 249 | 249 | * @return array |
| 250 | - * @throws \Exception If the revision ID is not set. | |
| 250 | + * @throws \Exception | |
| 251 | 251 | */ |
| 252 | 252 | public static function ajax_get_revision_data( array $data ) { |
| 253 | 253 | if ( ! isset( $data['id'] ) ) { |
| 254 | 254 | throw new \Exception( 'You must set the revision ID.' ); |
| @@ -253,14 +253,24 @@ | ||
| 253 | 253 | if ( ! isset( $data['id'] ) ) { |
| 254 | 254 | throw new \Exception( 'You must set the revision ID.' ); |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $revision = Plugin::$instance->documents->get_with_permissions( $data['id'] ); | |
| 257 | + $revision = Plugin::$instance->documents->get( $data['id'] ); | |
| 258 | 258 | |
| 259 | - return [ | |
| 259 | + if ( ! $revision ) { | |
| 260 | + throw new \Exception( 'Invalid revision.' ); | |
| 261 | + } | |
| 262 | + | |
| 263 | + if ( ! current_user_can( 'edit_post', $revision->get_id() ) ) { | |
| 264 | + throw new \Exception( esc_html__( 'Access denied.', 'elementor' ) ); | |
| 265 | + } | |
| 266 | + | |
| 267 | + $revision_data = [ | |
| 260 | 268 | 'settings' => $revision->get_settings(), |
| 261 | 269 | 'elements' => $revision->get_elements_data(), |
| 262 | 270 | ]; |
| 271 | + | |
| 272 | + return $revision_data; | |
| 263 | 273 | } |
| 264 | 274 | |
| 265 | 275 | /** |
| 266 | 276 | * @since 1.7.0 |
| @@ -277,9 +287,9 @@ | ||
| 277 | 287 | /** |
| 278 | 288 | * @since 2.0.0 |
| 279 | 289 | * @access public |
| 280 | 290 | * @static |
| 281 | - * @param array $return_data | |
| 291 | + * @param array $return_data | |
| 282 | 292 | * @param Document $document |
| 283 | 293 | * |
| 284 | 294 | * @return array |
| 285 | 295 | */ |
| @@ -345,11 +355,11 @@ | ||
| 345 | 355 | * |
| 346 | 356 | * Fired by `elementor/editor/editor_settings` filter. |
| 347 | 357 | * |
| 348 | 358 | * @since 1.7.0 |
| 349 | - * @deprecated 3.1.0 | |
| 350 | 359 | * @access public |
| 351 | 360 | * @static |
| 361 | + * @deprecated 3.1.0 | |
| 352 | 362 | */ |
| 353 | 363 | public static function editor_settings() { |
| 354 | 364 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' ); |
| 355 | 365 | |
| @@ -355,14 +365,9 @@ | ||
| 355 | 365 | |
| 356 | 366 | return []; |
| 357 | 367 | } |
| 358 | 368 | |
| 359 | - /** | |
| 360 | - * @throws \Exception If the user doesn't have permissions or not found. | |
| 361 | - */ | |
| 362 | - public static function ajax_get_revisions( $data ) { | |
| 363 | - Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); | |
| 364 | - | |
| 369 | + public static function ajax_get_revisions() { | |
| 365 | 370 | return self::get_revisions(); |
| 366 | 371 | } |
| 367 | 372 | |
| 368 | 373 | /** |