<?php if (isset($_GET['id']) && $_GET['id'] != '') { $button_id = intval($_GET["id"]); // validation $button = new maxButton(); $set = $button->set($button_id, '', 'trash'); if (!$set) { exit("Restore failed"); } $button->setStatus("publish"); } ?> <script type="text/javascript"> window.location = "<?php admin_url(); ?> admin.php?page=maxbuttons-controller&action=list&status=trash&message=1restore"; </script>
<?php $result = ''; exit("Not used"); $button = new maxButton(); if ($_POST) { if (isset($_POST['button-id']) && isset($_POST['bulk-action-select'])) { if ($_POST['bulk-action-select'] == 'restore') { $count = 0; foreach ($_POST['button-id'] as $id) { $button->set($id); $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'); } } if ($_POST['bulk-action-select'] == 'delete') { $count = 0; foreach ($_POST['button-id'] as $id) { $button->delete($id); $count++; } if ($count == 1) { $result = __('Deleted 1 button.', 'maxbuttons'); }
<?php if (isset($_GET['id']) && $_GET['id'] != '') { $button_id = intval($_GET["id"]); // validation $button = new maxButton(); $result = $button->set($button_id); if ($result) { $button->setStatus('trash'); } } ?> <script type="text/javascript"> window.location = "<?php admin_url(); ?> admin.php?page=maxbuttons-controller&action=list&message=1"; </script>