add(__('Opt-In deleted', 'double-opt-in'), 'success'); break; case 'not-deleted': Messages::getInstance()->add(__('Opt-In not-deleted', 'double-opt-in'), 'error'); break; default: break; } } } /** * Hide this page in the menu. * * @return bool */ public function hideInMenu() { return true; } /** * Render the license subpage content */ protected function theContent($slug, $page, $settings) { /* * Ensure that the hash is given */ if (!isset($_GET['hash'])) { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin'); } $this->maybeSave(); $hash = sanitize_text_field($_GET['hash']); /* * Load the assigned Category */ $Optin = Optin::get_by_hash($hash); if (null === $Optin) { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin'); } /* * Render the Template */ ?>

get_hash()); ?>

renderTemplate('view-optin', array( 'domain' => $this->domain, 'optin' => $Optin )); } /** * Update the Optin if the category has been submitted. * @return void */ private function maybeSave(){ if(!isset($_POST['hash']) || !wp_verify_nonce($_POST['doi_settings_nonce'], 'doi_settings_action')){ return; } $category = (int)$_POST['category']; $hash = sanitize_text_field($_POST['hash']); if(!$category){ return; } $Optin = OptIn::get_by_hash($hash); $Optin->set_category($category); $Optin->save(); } protected function theSidebar($slug, $page) { /* * Ensure that the ID for the Categorie is set */ if (!isset($_GET['hash'])) { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin'); } $hash = sanitize_text_field($_GET['hash']); /* * Load the OptIn */ $Optin = OptIn::get_by_hash($hash); if (!$Optin) { wp_redirect(admin_url('admin.php') . '?page=f12-cf7-doubleoptin'); } ?>

select_category($Optin->get_category()), array('select' => array('name' => array()), 'option' => array('value' => array(), 'selected' => array()))); ?>

get_link_optin()); ?>