getClass("button"); $mbadmin = MB()->getClass("admin"); $collections = MB()->getClass('collections'); $collection = MB()->getClass('collection'); $view = (isset($_GET["view"])) ? sanitize_text_field($_GET["view"]) : "all"; // submit if (isset($_POST) && isset($_POST["mb-list-nonce"]) ) { $verify = wp_verify_nonce( $_POST['mb-list-nonce'], 'mb-list' ); if (! $verify ) echo " Nonce not verifed"; if ($verify && isset($_POST['button-id']) && isset($_POST['bulk-action-select'])) { if ($_POST['bulk-action-select'] == 'trash') { $count = 0; foreach ($_POST['button-id'] as $id) { $id = intval($id); $button->set($id); $button->setStatus('trash'); $count++; } if ($count == 1) { $result = __('Moved 1 button to the trash.', 'maxbuttons'); } if ($count > 1) { $result = __('Moved ', 'maxbuttons') . $count . __(' buttons to the trash.', 'maxbuttons'); } } } if ($verify && $_POST['bulk-action-select'] == 'restore') { $count = 0; foreach ($_POST['button-id'] as $id) { $id = intval($id); $set = $button->set($id,'','trash'); $button->setStatus('publish'); //maxbuttons_button_restore($id); $count++; } if ($count == 1) { $result = __('Restored 1 button.', 'maxbuttons'); } if ($count > 1) { $result = __('Restored ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons'); } $view = 'all'; // switch to normal list. } if ($verify && $_POST['bulk-action-select'] == 'delete') { $count = 0; foreach ($_POST['button-id'] as $id) { $id = intval($id); $button->delete($id); $count++; } if ($count == 1) { $result = __('Deleted 1 button.', 'maxbuttons'); } if ($count > 1) { $result = __('Deleted ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons'); } } } if (isset($_GET['message']) && $_GET['message'] == '1') { $result = __('Moved 1 button to the trash.', 'maxbuttons'); } if (isset($_GET['message']) && $_GET['message'] == '1restore') { $result = __('Restored 1 button.', 'maxbuttons'); } if (isset($_GET['message']) && $_GET['message'] == '1delete') { $result = __('Deleted 1 button.', 'maxbuttons'); } $args = array( "orderby" => "id", "order" => "DESC", ); if (isset($_GET["orderby"])) $args["orderby"] = sanitize_text_field($_GET["orderby"]); if (isset($_GET["order"])) $args["order"] = sanitize_text_field($_GET["order"]); if (isset($_GET["paged"]) && $_GET["paged"] != '') { $page = intval($_GET["paged"]); $args["paged"] = $page; } if ($view == 'trash') $args["status"] = "trash"; $published_buttons = $mbadmin->getButtons($args); $published_buttons_count = $mbadmin->getButtonCount(array()); $trashed_buttons_count = $mbadmin->getButtonCount(array("status" => "trash")); $args["view"] = $view; $page_args = $args; ?> " . __('Add New', 'maxbuttons') . ""; $mbadmin->get_header(array("title" => $page_title, "title_action" => $action)); ?>
" . __('All', 'maxbuttons') . ""; $trash_line = __("Trash", "maxbuttons"); } else { $all_line = __("All","maxbuttons"); $trash_line = "" . __("Trash","maxbuttons") . ""; } ?> () 0) { ?> | ()