getClass("button"); $button_id = 0; if ($_POST) { if (! check_admin_referer("button-edit","maxbuttons_button")) { exit("Request not valid"); } $button_id = intval($_POST["button_id"]); if ($button_id > 0) $button->set($button_id); $return = $button->save($_POST); if (is_int($return) && $button_id <= 0) $button_id = $return; if ($button_id === 0) { error_log(__("Maxbuttons Error: Button id should never be zero","maxbuttons")); } $button->set($button_id); wp_redirect(admin_url('admin.php?page=maxbuttons-controller&action=button&id=' . $button_id)); exit(); } if (isset($_GET['id']) && $_GET['id'] != '') { $button = MB()->getClass('button'); // reset $button_id = intval($_GET["id"]); if ($button_id == 0) { $error = __("Maxbuttons button id is zero. Your data is not saved correctly! Please check your database.","maxbuttons"); MB()->add_notice('error', $error); } // returns bool $return = $button->set($button_id); if ($return === false) { $error = __("MaxButtons could not find this button in the database. It might not be possible to save this button! Please check your database or contact support! ", "maxbuttons"); MB()->add_notice('error', $error); } } $admin = MB()->getClass('admin'); $page_title = __("Button editor","maxbuttons"); $action = "" . __('Add New', 'maxbuttons') . ""; $admin->get_header(array("title" => $page_title, "title_action" => $action) ); ?>
get_footer(); ?>