| 1 |
<?php |
| 2 |
$result = ''; |
| 3 |
|
| 4 |
exit("Not used"); |
| 5 |
|
| 6 |
$button = new maxButton(); |
| 7 |
|
| 8 |
if ($_POST) { |
| 9 |
if (isset($_POST['button-id']) && isset($_POST['bulk-action-select'])) { |
| 10 |
if ($_POST['bulk-action-select'] == 'restore') { |
| 11 |
$count = 0; |
| 12 |
|
| 13 |
foreach ($_POST['button-id'] as $id) { |
| 14 |
$button->set($id); |
| 15 |
$button->setStatus('publish'); |
| 16 |
|
| 17 |
//maxbuttons_button_restore($id); |
| 18 |
$count++; |
| 19 |
} |
| 20 |
|
| 21 |
if ($count == 1) { |
| 22 |
$result = __('Restored 1 button.', 'maxbuttons'); |
| 23 |
} |
| 24 |
|
| 25 |
if ($count > 1) { |
| 26 |
$result = __('Restored ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons'); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
if ($_POST['bulk-action-select'] == 'delete') { |
| 31 |
$count = 0; |
| 32 |
|
| 33 |
foreach ($_POST['button-id'] as $id) { |
| 34 |
$button->delete($id); |
| 35 |
$count++; |
| 36 |
} |
| 37 |
|
| 38 |
if ($count == 1) { |
| 39 |
$result = __('Deleted 1 button.', 'maxbuttons'); |
| 40 |
} |
| 41 |
|
| 42 |
if ($count > 1) { |
| 43 |
$result = __('Deleted ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons'); |
| 44 |
} |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
if (isset($_GET['message']) && $_GET['message'] == '1restore') { |
| 50 |
$result = __('Restored 1 button.', 'maxbuttons'); |
| 51 |
} |
| 52 |
|
| 53 |
if (isset($_GET['message']) && $_GET['message'] == '1delete') { |
| 54 |
$result = __('Deleted 1 button.', 'maxbuttons'); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
$args = array(); |
| 60 |
if (isset($_GET["orderby"])) |
| 61 |
$args["orderby"] = $_GET["orderby"]; |
| 62 |
if (isset($_GET["order"])) |
| 63 |
$args["order"] = $_GET["order"]; |
| 64 |
|
| 65 |
$mbadmin = MB()->getClass('admin'); |
| 66 |
|
| 67 |
$args["status"] = "trash"; |
| 68 |
$args["limit"] = -1; |
| 69 |
|
| 70 |
//$published_buttons = $mbadmin->getButtons($args); |
| 71 |
$published_buttons_count = $mbadmin->getButtonCount($args); |
| 72 |
|
| 73 |
$trashed_buttons = $mbadmin->getButtons($args); |
| 74 |
$trashed_buttons_count = $mbadmin->getButtonCount($args); |
| 75 |
|
| 76 |
$pagination = $mbadmin->getButtonPages($args); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
?> |
| 81 |
|
| 82 |
<script type="text/javascript"> |
| 83 |
jQuery(document).ready(function() { |
| 84 |
jQuery("#bulk-action-all").click(function() { |
| 85 |
jQuery("#maxbuttons input[name='button-id[]']").each(function() { |
| 86 |
if (jQuery("#bulk-action-all").is(":checked")) { |
| 87 |
jQuery(this).attr("checked", "checked"); |
| 88 |
} |
| 89 |
else { |
| 90 |
jQuery(this).removeAttr("checked"); |
| 91 |
} |
| 92 |
}); |
| 93 |
}); |
| 94 |
|
| 95 |
<?php if ($result != '') { ?> |
| 96 |
jQuery("#maxbuttons .message").show(); |
| 97 |
<?php } ?> |
| 98 |
}); |
| 99 |
</script> |
| 100 |
|
| 101 |
<div id="maxbuttons"> |
| 102 |
<div class="wrap"> |
| 103 |
<div class="icon32"> |
| 104 |
<a href="https://maxbuttons.com" target="_blank"><img src="<?php echo MAXBUTTONS_PLUGIN_URL ?>/images/mb-32.png" alt="MaxButtons" /></a> |
| 105 |
</div> |
| 106 |
|
| 107 |
<h2 class="title"><?php _e('MaxButtons: Button List', 'maxbuttons') ?></h2> |
| 108 |
|
| 109 |
<div class="logo"> |
| 110 |
<?php do_action("mb-display-logo"); ?> |
| 111 |
</div> |
| 112 |
|
| 113 |
<div class="clear"></div> |
| 114 |
<?php do_action('mb-display-tabs'); ?> |
| 115 |
|
| 116 |
<div class="form-actions"> |
| 117 |
<a class="button-primary" href="<?php echo admin_url() ?>admin.php?page=maxbuttons-controller&action=button"><?php _e('Add New', 'maxbuttons') ?></a> |
| 118 |
</div> |
| 119 |
|
| 120 |
<?php if ($result != '') { ?> |
| 121 |
<div class="message"><?php echo $result ?></div> |
| 122 |
<?php } ?> |
| 123 |
|
| 124 |
<p class="status"> |
| 125 |
<a href="<?php echo admin_url() ?>admin.php?page=maxbuttons-controller&action=list"><?php _e('All', 'maxbuttons') ?></a> <span class="count">(<?php echo $published_buttons_count ?>)</span> |
| 126 |
<span class="separator">|</span> |
| 127 |
<strong><?php _e('Trash', 'maxbuttons') ?></strong> <span class="count">(<?php echo $trashed_buttons_count ?>)</span> |
| 128 |
</p> |
| 129 |
|
| 130 |
<form method="post"> |
| 131 |
<select name="bulk-action-select" id="bulk-action-select"> |
| 132 |
<option value=""><?php _e('Bulk Actions', 'maxbuttons') ?></option> |
| 133 |
<option value="restore"><?php _e('Restore', 'maxbuttons') ?></option> |
| 134 |
<option value="delete"><?php _e('Delete Permanently', 'maxbuttons') ?></option> |
| 135 |
</select> |
| 136 |
<input type="submit" class="button" value="<?php _e('Apply', 'maxbuttons') ?>" /> |
| 137 |
|
| 138 |
<div class="button-list"> |
| 139 |
<table cellpadding="0" cellspacing="0" width="100%"> |
| 140 |
<tr> |
| 141 |
<th><input type="checkbox" name="bulk-action-all" id="bulk-action-all" /></th> |
| 142 |
<th><?php _e('Button', 'maxbuttons') ?></th> |
| 143 |
<th><?php _e('Name and Description', 'maxbuttons') ?></th> |
| 144 |
<th><?php _e('Shortcode', 'maxbuttons') ?></th> |
| 145 |
<th><?php _e('Actions', 'maxbuttons') ?></th> |
| 146 |
</tr> |
| 147 |
<?php foreach ($trashed_buttons as $b) { |
| 148 |
|
| 149 |
$id = $b["id"]; |
| 150 |
$button->set($id,'','trash'); |
| 151 |
?> |
| 152 |
<tr> |
| 153 |
<td valign="center"> |
| 154 |
<input type="checkbox" name="button-id[]" id="button-id-<?php echo $id ?>" value="<?php echo $id ?>" /> |
| 155 |
</td> |
| 156 |
<td> |
| 157 |
<div class="shortcode-container"> |
| 158 |
<?php//echo do_shortcode('[maxbutton id="' . $id . '" externalcss="false" ignorecontainer="true"]') ?> |
| 159 |
<?php $button->display( array("preview" => true, "preview_part" => "full") ); ?> |
| 160 |
</div> |
| 161 |
</td> |
| 162 |
<td> |
| 163 |
<strong><?php echo $button->getName() ?></strong> |
| 164 |
<br /> |
| 165 |
<p><?php echo $button->getDescription() ?></p> |
| 166 |
</td> |
| 167 |
<td> |
| 168 |
[maxbutton id="<?php echo $id ?>"] |
| 169 |
</td> |
| 170 |
<td> |
| 171 |
<a href="<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=restore&id=<?php echo $id ?>"><?php _e('Restore', 'maxbuttons') ?></a> |
| 172 |
<span class="separator">|</span> |
| 173 |
<a href="<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=delete&id=<?php echo $id ?>"><?php _e('Delete Permanently', 'maxbuttons') ?></a> |
| 174 |
</td> |
| 175 |
</tr> |
| 176 |
<?php } ?> |
| 177 |
</table> |
| 178 |
</div> |
| 179 |
</form> |
| 180 |
</div> |
| 181 |
<div class="ad-wrap"> |
| 182 |
<?php do_action("mb-display-ads"); ?> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
|
| 186 |
|