untrashed', 'deleted', 'locked', 'ids'], wp_get_referer()); $sendback = add_query_arg('paged', $pagenum, $sendback); if ('delete_all' == $doaction) { global $wpdb; $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", CAS_App::TYPE_SIDEBAR, 'trash')); $doaction = 'delete'; } elseif (isset($_REQUEST['ids'])) { $post_ids = explode(',', $_REQUEST['ids']); } elseif (!empty($_REQUEST['post'])) { $post_ids = array_map('intval', $_REQUEST['post']); } if (!isset($post_ids)) { wp_redirect($sendback); exit; } $post_ids = (array)$post_ids; $handled = 0; switch ($doaction) { case 'activate': case 'deactivate': $locked = 0; foreach ($post_ids as $post_id) { if (!current_user_can('edit_post', $post_id)) { wp_die(__('You are not allowed to update this item.')); } if (wp_check_post_lock($post_id)) { $locked++; continue; } if ($doaction == 'activate') { $data = [ 'ID' => $post_id, 'post_status' => CAS_App::STATUS_ACTIVE, 'post_date' => current_time('mysql'), 'post_date_gmt' => current_time('mysql', true) ]; } else { $data = [ 'ID' => $post_id, 'post_status' => CAS_App::STATUS_INACTIVE ]; } if (!wp_update_post($data)) { wp_die(__('Error in updating status.')); } $handled++; } $sendback = add_query_arg([$doaction . 'd' => $handled, 'ids' => join(',', $post_ids), 'locked' => $locked], $sendback); break; case 'trash': $locked = 0; foreach ($post_ids as $post_id) { if (!current_user_can('delete_post', $post_id)) { wp_die(__('You are not allowed to move this item to the Trash.')); } if (wp_check_post_lock($post_id)) { $locked++; continue; } if (!wp_trash_post($post_id)) { wp_die(__('Error in moving to Trash.')); } $handled++; } $sendback = add_query_arg(['trashed' => $handled, 'ids' => join(',', $post_ids), 'locked' => $locked], $sendback); break; case 'untrash': foreach ($post_ids as $post_id) { if (!current_user_can('delete_post', $post_id)) { wp_die(__('You are not allowed to restore this item from the Trash.')); } if (!wp_untrash_post($post_id)) { wp_die(__('Error in restoring from Trash.')); } $handled++; } $sendback = add_query_arg('untrashed', $handled, $sendback); break; case 'delete': foreach ($post_ids as $post_id) { if (!current_user_can('delete_post', $post_id)) { wp_die(__('You are not allowed to delete this item.')); } if (!wp_delete_post($post_id)) { wp_die(__('Error in deleting.')); } $handled++; } $sendback = add_query_arg('deleted', $handled, $sendback); break; default: break; } $sendback = remove_query_arg(['action', 'action2', 'post_status', 'post', 'bulk_edit'], $sendback); wp_safe_redirect($sendback); exit; } if (!empty($_REQUEST['_wp_http_referer'])) { wp_safe_redirect(remove_query_arg(['_wp_http_referer', '_wpnonce'], wp_unslash($_SERVER['REQUEST_URI']))); exit; } } /** * Set screen options on save * * @since 3.4 * @param string $status * @param string $option * @param string $value */ public function set_screen_option($status, $option, $value) { if ($option == 'cas_sidebars_per_page') { return $value; } return $status; } public function bulk_messages() { $bulk_messages = [ 'updated' => _n_noop('%s sidebar updated.', '%s sidebars updated.', 'content-aware-sidebars'), 'locked' => _n_noop('%s sidebar not updated, somebody is editing it.', '%s sidebars not updated, somebody is editing them.', 'content-aware-sidebars'), 'activated' => _n_noop('%s sidebar activated.', '%s sidebars activated.', 'content-aware-sidebars'), 'deactivated' => _n_noop('%s sidebar deactivated.', '%s sidebars deactivated.', 'content-aware-sidebars'), 'deleted' => _n_noop('%s sidebar permanently deleted.', '%s sidebars permanently deleted.', 'content-aware-sidebars'), 'trashed' => _n_noop('%s sidebar moved to the Trash.', '%s sidebars moved to the Trash.', 'content-aware-sidebars'), 'untrashed' => _n_noop('%s sidebar restored from the Trash.', '%s sidebars restored from the Trash.', 'content-aware-sidebars'), ]; $bulk_messages = apply_filters('cas/admin/bulk_messages', $bulk_messages); $messages = []; foreach ($bulk_messages as $key => $message) { if (isset($_REQUEST[$key])) { $count = absint($_REQUEST[$key]); if ($count) { $messages[] = sprintf( translate_nooped_plural($message, $count), number_format_i18n($count) ); if ($key == 'trashed' && isset($_REQUEST['ids'])) { $ids = preg_replace('/[^0-9,]/', '', $_REQUEST['ids']); $messages[] = '' . __('Undo') . ''; } } } } if ($messages) { echo '

' . join(' ', $messages) . '

'; } } /** * Register and enqueue scripts styles * for screen * * @since 3.4 */ public function add_scripts_styles() { } } Kommentare für Selfmade-Bands https://www.selfmade-bands.de Eine andere WordPress-Site. Wed, 25 Jun 2025 19:50:01 +0000 hourly 1 https://wordpress.org/?v=6.5