hideSubmitButton(true); // Check for error message if (isset($_GET['status'])) { $status = sanitize_text_field($_GET['status']); switch ($status) { case 'category-deleted': Messages::getInstance()->add(__('Category deleted', 'double-opt-in'), 'success'); break; case 'category-not-deleted': Messages::getInstance()->add(__('Category not-deleted', 'double-opt-in'), 'error'); break; default: break; } } } /** * Check if the category should be deleted */ private function maybeDelete() { if (!isset($_GET['id'])) { return; } if (!isset($_GET['nonce'])) { return; } if (!isset($_GET['option'])) { return; } $option = sanitize_text_field($_GET['option']); $id = (int)$_GET['id']; $nonce = sanitize_text_field($_GET['nonce']); if ('delete' !== $option) { return; } $page = (int)$_GET['pageNum']; if (!wp_verify_nonce($_GET['nonce'], 'doi-delete-category-' . $id)) { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin_categories&pageNum=' . esc_attr($page) . '&status=category-not-deleted'); } if (Category::delete_by_id($id)) { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin_categories&pageNum=' . esc_attr($page) . '&status=category-deleted'); } else { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin_categories&pageNum=' . esc_attr($page) . '&status=category-not-deleted'); } wp_die(); } /** * Render the license subpage content */ protected function theContent($slug, $page, $settings) { // check for deletion $this->maybeDelete(); ?>
|
get_id()); ?>
|
get_name()); ?> | get_createtime('formatted')); ?> | get_updatetime('formatted')); ?> |