/** * Bulk actions */ public function bulk() { check_admin_referer('bulk-exports', '_wpnonce_bulk-exports'); if ($this->input->post('doaction2')) { $this->data['action'] = $action = $this->input->post('bulk-action2'); } else { $this->data['action'] = $action = $this->input->post('bulk-action'); } $this->data['ids'] = $ids = $this->input->post('items'); $this->data['items'] = $items = new PMXE_Export_List(); if (empty($action) or !in_array($action, array('delete')) or empty($ids) or $items->getBy('id', $ids)->isEmpty()) { wp_redirect($this->baseUrl); die; } if ($this->input->post('is_confirmed')) { foreach ($items->convertRecords() as $item) { if ($item->attch_id) { wp_delete_attachment($item->attch_id, true); } $item->delete(); } wp_redirect(add_query_arg('pmxe_nt', urlencode(sprintf(__('%d %s deleted', 'pmxe_plugin'), $items->count(), _n('export', 'exports', $items->count(), 'pmxe_plugin'))), $this->baseUrl)); die; } $this->render(); }