diff --git a/admin/admin-init_rvy.php b/admin/admin-init_rvy.php index c1288516..1488e09b 100644 --- a/admin/admin-init_rvy.php +++ b/admin/admin-init_rvy.php @@ -130,10 +130,17 @@ function rvy_admin_init() { exit; } - } elseif (isset($_REQUEST['action2']) && !empty($_REQUEST['page']) && ('revisionary-q' == $_REQUEST['page']) && !empty($_REQUEST['post'])) { + } elseif ( + (isset($_REQUEST['action2']) && !empty($_REQUEST['page']) && ('revisionary-q' == $_REQUEST['page']) && !empty($_REQUEST['post'])) + || (isset($_REQUEST['action']) && in_array($_REQUEST['action'], ['decline_revision'])) + ) { $doaction = (!empty($_REQUEST['action']) && !is_numeric($_REQUEST['action'])) ? sanitize_key($_REQUEST['action']) : sanitize_key($_REQUEST['action2']); - check_admin_referer('bulk-revision-queue'); + if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], ['decline_revision'])) { + check_admin_referer('decline-revision'); + } else { + check_admin_referer('bulk-revision-queue'); + } if (!$url = str_replace('#038;', '&', wp_get_referer())) { $url = admin_url("admin.php?page=revisionary-q"); @@ -160,7 +167,7 @@ function rvy_admin_init() { } elseif ( isset( $_REQUEST['ids'] ) ) { $post_ids = array_map('intval', explode( ',', sanitize_text_field($_REQUEST['ids']) )); } elseif ( !empty( $_REQUEST['post'] ) ) { - $post_ids = array_map('intval', $_REQUEST['post']); + $post_ids = array_map('intval', (array) $_REQUEST['post']); } if ( !isset( $post_ids ) ) { diff --git a/admin/admin_rvy.php b/admin/admin_rvy.php index bae3a4d9..0c04ff02 100644 --- a/admin/admin_rvy.php +++ b/admin/admin_rvy.php @@ -2,7 +2,7 @@ /** * @package PublishPress\Revisions\RevisionaryAdmin * @author PublishPress - * @copyright Copyright (c) 2023 PublishPress. All rights reserved. + * @copyright Copyright (c) 2024 PublishPress. All rights reserved. * @license GPLv2 or later * @since 1.0.0 * @@ -344,6 +344,11 @@ function flt_plugin_action_links($links, $file) { public function fltPublishPressCapsSection($section_caps) { $section_caps['PublishPress Revisions'] = ['edit_others_drafts', 'edit_others_revisions', 'list_others_revisions', 'manage_unsubmitted_revisions']; + + if (defined('PUBLISHPRESS_REVISIONS_PRO_VERSION') && rvy_get_option('revision_restore_require_cap')) { + $section_caps['PublishPress Revisions'] []= 'restore_revisions'; + } + return $section_caps; } diff --git a/admin/class-list-table_rvy.php b/admin/class-list-table_rvy.php index 6f0ae35e..d5703426 100644 --- a/admin/class-list-table_rvy.php +++ b/admin/class-list-table_rvy.php @@ -1332,6 +1332,14 @@ protected function handle_row_actions( $post, $column_name, $primary ) { ); } + if ($can_edit_post && ('pending-revision' == $post->post_mime_type)) { + $actions['decline'] = sprintf( + '%2$s', + wp_nonce_url(admin_url("post.php?post=$post->ID&action=decline_revision"), 'decline-revision'), + _x( 'Decline', 'revisions', 'revisionary' ) + ); + } + $actions = apply_filters('revisionary_queue_row_actions', $actions, $post); return $this->row_actions( $actions ); diff --git a/admin/edit-revision-classic-ui_rvy.php b/admin/edit-revision-classic-ui_rvy.php index 037860c3..371c9b9f 100644 --- a/admin/edit-revision-classic-ui_rvy.php +++ b/admin/edit-revision-classic-ui_rvy.php @@ -26,7 +26,7 @@ function hide_admin_divs() { $object_type = (!empty($post->post_type)) ? $post->post_type : awp_post_type_from_uri(); - $unrevisable_css_ids = apply_filters('rvy_hidden_meta_boxes', ['authordiv', 'visibility', 'postcustom', 'pagecustom']); + $unrevisable_css_ids = apply_filters('rvy_hidden_meta_boxes', ['authordiv', 'visibility']); if (rvy_in_revision_workflow($post)) { $unrevisable_css_ids = array_merge($unrevisable_css_ids, ['publish', 'slugdiv', 'edit-slug-box']); diff --git a/admin/edit-revision-ui_rvy.php b/admin/edit-revision-ui_rvy.php index 616f757e..fa92092e 100644 --- a/admin/edit-revision-ui_rvy.php +++ b/admin/edit-revision-ui_rvy.php @@ -35,15 +35,28 @@ function add_js() { if (!class_exists('DS_Public_Post_Preview')) { ?>