diff --git a/includes/class-delete-all.php b/includes/class-delete-all.php index a7d15c765f08225acf36c446eacb438816b121d8..14744d79c88d4761f040b132526f49245b9c7f1a 100644 --- a/includes/class-delete-all.php +++ b/includes/class-delete-all.php @@ -120,7 +120,7 @@ class Delete_All { if ( 'edit' === $screen->base && isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { if ( Main::get_action_next_scheduled( self::ACTION, $screen->post_type ) ) { $type = 'warning'; - $message = __( 'A pending request to empty the trash will be processed soon.', 'bulk-actions-cron-offload' ); + $message = self::admin_notice_hidden_pending_processing(); } } @@ -145,6 +145,15 @@ class Delete_All { return __( 'A request to empty the trash is already pending for this post type.', 'bulk-actions-cron-offload' ); } + /** + * Provide translated message when posts are hidden pending processing + * + * @return string + */ + public static function admin_notice_hidden_pending_processing() { + return __( 'A pending request to empty the trash will be processed soon.', 'bulk-actions-cron-offload' ); + } + /** * When a delete is pending for a given post type, hide those posts in the admin * diff --git a/includes/class-delete-permanently.php b/includes/class-delete-permanently.php index 74005932a2c9c912ff3d907cd77f49a617f6a979..7221433e485b4d3133a6acd10b1f527fbe569904 100644 --- a/includes/class-delete-permanently.php +++ b/includes/class-delete-permanently.php @@ -88,7 +88,7 @@ class Delete_Permanently { if ( 'edit' === $screen->base && isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { if ( Main::get_post_ids_for_pending_events( self::ACTION, $screen->post_type, 'trash' ) ) { $type = 'warning'; - $message = __( 'Some items that would normally be shown here are waiting to be deleted permanently. These items are hidden until then.', 'bulk-actions-cron-offload' ); + $message = self::admin_notice_hidden_pending_processing(); } } @@ -113,6 +113,15 @@ class Delete_Permanently { return __( 'The selected posts are already scheduled to be deleted.', 'bulk-actions-cron-offload' ); } + /** + * Provide translated message when posts are hidden pending processing + * + * @return string + */ + public static function admin_notice_hidden_pending_processing() { + return __( 'Some items that would normally be shown here are waiting to be deleted permanently. These items are hidden until then.', 'bulk-actions-cron-offload' ); + } + /** * When a delete is pending for a given post type, hide those posts in the admin * diff --git a/includes/class-move-to-trash.php b/includes/class-move-to-trash.php index 74588f750f8d4fcc2ea9258fe0a4810f6aa56185..92f372d95e1832e685984632818a565c07fd5a60 100644 --- a/includes/class-move-to-trash.php +++ b/includes/class-move-to-trash.php @@ -74,34 +74,6 @@ class Move_To_Trash { } } - /** - * Let the user know what's going on - * - * Not used for post-request redirect - */ - public static function admin_notices() { - $screen = get_current_screen(); - - $type = ''; - $message = ''; - - if ( 'edit' === $screen->base ) { - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { - return; - } - - $status = isset( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; - $pending = Main::get_post_ids_for_pending_events( self::ACTION, $screen->post_type, $status ); - - if ( ! empty( $pending ) ) { - $type = 'warning'; - $message = __( 'Some items that would normally be shown here are waiting to be moved to the trash. These items are hidden until they are moved.', 'bulk-actions-cron-offload' ); - } - } - - Main::render_admin_notice( $type, $message ); - } - /** * Provide post-redirect success message * @@ -121,25 +93,12 @@ class Move_To_Trash { } /** - * When a move is pending for a given post type, hide those posts in the admin + * Provide translated message when posts are hidden pending move * - * @param string $where Posts' WHERE clause. - * @param object $q WP_Query object. * @return string */ - public static function hide_posts( $where, $q ) { - if ( 'trash' === $q->get( 'post_status' ) ) { - return $where; - } - - $post__not_in = Main::get_post_ids_for_pending_events( self::ACTION, $q->get( 'post_type' ), $q->get( 'post_status' ) ); - - if ( ! empty( $post__not_in ) ) { - $post__not_in = implode( ',', $post__not_in ); - $where .= ' AND ID NOT IN(' . $post__not_in . ')'; - } - - return $where; + public static function admin_notice_hidden_pending_processing() { + return __( 'Some items that would normally be shown here are waiting to be moved to the trash. These items are hidden until they are moved.', 'bulk-actions-cron-offload' ); } } diff --git a/includes/class-restore-from-trash.php b/includes/class-restore-from-trash.php index c3bc23459d392864795a1278e9399697aadbb23b..7a65393a853b7dfd638471b044b374d99c8ab8f4 100644 --- a/includes/class-restore-from-trash.php +++ b/includes/class-restore-from-trash.php @@ -88,7 +88,7 @@ class Restore_From_Trash { if ( 'edit' === $screen->base && isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { if ( Main::get_post_ids_for_pending_events( self::ACTION, $screen->post_type, 'trash' ) ) { $type = 'warning'; - $message = __( 'Some items that would normally be shown here are waiting to be restored from the trash. These items are hidden until they are restored.', 'bulk-actions-cron-offload' ); + $message = self::admin_notice_hidden_pending_processing(); } } @@ -113,6 +113,15 @@ class Restore_From_Trash { return __( 'The selected posts are already scheduled to be restored.', 'bulk-actions-cron-offload' ); } + /** + * Provide translated message when posts are hidden pending restoration + * + * @return string + */ + public static function admin_notice_hidden_pending_processing() { + return __( 'Some items that would normally be shown here are waiting to be restored from the trash. These items are hidden until they are restored.', 'bulk-actions-cron-offload' );; + } + /** * When a restore is pending for a given post type, hide those posts in the admin *