PluginProbe
MaxButtons – Create buttons / 6.27
MaxButtons – Create buttons v6.27
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / includes / maxbuttons-list-trash.php

maxbuttons-list-trash.php in MaxButtons – Create buttons 6.27, at includes/maxbuttons-list-trash.php

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