Version Description
- Updated Copy / Trash / Delete interfaces
- Fixed issue with refresh page warning when removing buttons
- Fixed Social Share Facebook count
- Fixed lower save button not working in social share
- Fixed layout issue in Social Share
Download this release
Release Info
Developer | basszje |
Plugin | WordPress Button Plugin MaxButtons |
Version | 6.12 |
Comparing to | |
See all releases |
Code changes from version 6.11.1 to 6.12
- assets/scss/_global.scss +0 -13
- classes/buttons.php +45 -0
- classes/social-networks.php +3 -2
- collections/layout-block.php +5 -4
- collections/picker-block.php +1 -1
- collections/social-block.php +1 -0
- includes/maxbuttons-button.php +30 -8
- includes/maxbuttons-collection-edit.php +2 -1
- includes/maxbuttons-controller.php +0 -12
- includes/maxbuttons-copy.php +0 -16
- includes/maxbuttons-delete.php +0 -23
- includes/maxbuttons-list.php +9 -4
- includes/maxbuttons-restore.php +0 -12
- includes/maxbuttons-trash.php +0 -14
- js/maxbuttons-admin.js +53 -8
- js/maxmodal.js +3 -7
- js/min/maxbuttons-admin.js +1 -1
- maxbuttons.php +3 -3
- readme.txt +9 -1
assets/scss/_global.scss
CHANGED
@@ -1,20 +1,7 @@
|
|
1 |
// WARNING : This will load -outside- the #maxbutton namespacing, potentially affecting WP in general
|
2 |
|
3 |
/* Modal */
|
4 |
-
/*
|
5 |
-
#lean_overlay {
|
6 |
|
7 |
-
position: fixed;
|
8 |
-
z-index: 100;
|
9 |
-
top: 0px;
|
10 |
-
left: 0px;
|
11 |
-
height: 100%;
|
12 |
-
width: 100%;
|
13 |
-
background: #000000;
|
14 |
-
display: none;
|
15 |
-
|
16 |
-
}
|
17 |
-
*/
|
18 |
// colorpicker
|
19 |
.mb_colorpicker {
|
20 |
z-index: 200;
|
1 |
// WARNING : This will load -outside- the #maxbutton namespacing, potentially affecting WP in general
|
2 |
|
3 |
/* Modal */
|
|
|
|
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
// colorpicker
|
6 |
.mb_colorpicker {
|
7 |
z-index: 200;
|
classes/buttons.php
CHANGED
@@ -112,5 +112,50 @@ class maxButtons
|
|
112 |
}
|
113 |
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
} // class
|
112 |
}
|
113 |
|
114 |
}
|
115 |
+
|
116 |
+
public static function ajax_action()
|
117 |
+
{
|
118 |
+
$action = sanitize_text_field($_POST['button_action']);
|
119 |
+
$check = wp_verify_nonce($_POST['nonce'], 'button-' . $action);
|
120 |
+
$button_id = intval($_POST["button_id"]);
|
121 |
+
$button = new maxButton();
|
122 |
+
|
123 |
+
if (! $check)
|
124 |
+
exit('Invalid Nonce');
|
125 |
+
|
126 |
+
switch($action)
|
127 |
+
{
|
128 |
+
case "delete":
|
129 |
+
$button->delete($button_id);
|
130 |
+
$redirect_url = admin_url() . 'admin.php?page=maxbuttons-controller&action=list&message=1delete';
|
131 |
+
break;
|
132 |
+
|
133 |
+
case "trash":
|
134 |
+
$result = $button->set($button_id);
|
135 |
+
if ($result)
|
136 |
+
$button->setStatus('trash');
|
137 |
+
$redirect_url = admin_url() . 'admin.php?page=maxbuttons-controller&action=list&message=1';
|
138 |
+
break;
|
139 |
+
case "restore":
|
140 |
+
$set = $button->set($button_id,'','trash');
|
141 |
+
$button->setStatus("publish");
|
142 |
+
$redirect_url = admin_url() . 'admin.php?page=maxbuttons-controller&action=list&status=trash&message=1restore';
|
143 |
+
break;
|
144 |
+
case "copy":
|
145 |
+
$button->set($button_id);
|
146 |
+
$new_id = $button->copy();
|
147 |
+
$redirect_url = admin_url() . 'admin.php?page=maxbuttons-controller&action=button&id=' . $new_id;
|
148 |
+
break;
|
149 |
+
|
150 |
+
}
|
151 |
+
|
152 |
+
if (isset($redirect_url)) {
|
153 |
+
$response = array('redirection' => $redirect_url);
|
154 |
+
echo json_encode($response);
|
155 |
+
exit();
|
156 |
+
}
|
157 |
+
|
158 |
+
exit(true);
|
159 |
+
}
|
160 |
|
161 |
} // class
|
classes/social-networks.php
CHANGED
@@ -13,6 +13,7 @@ class maxSN
|
|
13 |
|
14 |
}
|
15 |
|
|
|
16 |
public function setNetwork($network)
|
17 |
{
|
18 |
|
@@ -48,7 +49,7 @@ class maxSN
|
|
48 |
case "facebook":
|
49 |
$network_data["share_url"] = 'https://www.facebook.com/sharer.php?u={url}';
|
50 |
$network_data["count_api"] = "https://graph.facebook.com/{url}";
|
51 |
-
$network_data["json_return_var"] = "
|
52 |
break;
|
53 |
case "google-plus":
|
54 |
$network_data["share_url"] = 'https://plus.google.com/share?url={url}';
|
@@ -167,7 +168,7 @@ class maxSN
|
|
167 |
$network = $this->network;
|
168 |
//$count = get_transient('mb-col-' . $network . '-' . $share_url . '-shares');
|
169 |
$count = maxUtils::get_transient('mbcol-shares-' . $network . '-' . $share_url);
|
170 |
-
|
171 |
if ($args["force_share_update"])
|
172 |
$count = -1; // force an update
|
173 |
|
13 |
|
14 |
}
|
15 |
|
16 |
+
/* Set the network variables to be using for this inquery */
|
17 |
public function setNetwork($network)
|
18 |
{
|
19 |
|
49 |
case "facebook":
|
50 |
$network_data["share_url"] = 'https://www.facebook.com/sharer.php?u={url}';
|
51 |
$network_data["count_api"] = "https://graph.facebook.com/{url}";
|
52 |
+
$network_data["json_return_var"] = "share|share_count";
|
53 |
break;
|
54 |
case "google-plus":
|
55 |
$network_data["share_url"] = 'https://plus.google.com/share?url={url}';
|
168 |
$network = $this->network;
|
169 |
//$count = get_transient('mb-col-' . $network . '-' . $share_url . '-shares');
|
170 |
$count = maxUtils::get_transient('mbcol-shares-' . $network . '-' . $share_url);
|
171 |
+
|
172 |
if ($args["force_share_update"])
|
173 |
$count = -1; // force an update
|
174 |
|
collections/layout-block.php
CHANGED
@@ -291,8 +291,8 @@ class layoutCollectionBlock extends collectionBlock
|
|
291 |
<label for="ignore_container"><?php _e("Remove container width and margins","maxbuttons"); ?></label>
|
292 |
<input type="checkbox" name="ignore_container" value="1" <?php checked($ignore_container,1) ?>>
|
293 |
<div class="help fa fa-question-circle ">
|
294 |
-
|
295 |
-
|
296 |
</div>
|
297 |
|
298 |
</div>
|
@@ -302,8 +302,9 @@ class layoutCollectionBlock extends collectionBlock
|
|
302 |
$condition = array("target" => "placement", "values" => array("static-left","static-right","static-top", "static-bottom")) ;
|
303 |
$static_conditional = htmlentities(json_encode($condition ));
|
304 |
?>
|
305 |
-
<
|
306 |
-
|
|
|
307 |
<div class="inside">
|
308 |
<?php
|
309 |
$condition = array("target" => "placement", "values" => array("static-left","static-right")) ;
|
291 |
<label for="ignore_container"><?php _e("Remove container width and margins","maxbuttons"); ?></label>
|
292 |
<input type="checkbox" name="ignore_container" value="1" <?php checked($ignore_container,1) ?>>
|
293 |
<div class="help fa fa-question-circle ">
|
294 |
+
<span><?php _e("Removes the margins and widths of the button container.", "maxbuttons"); ?>
|
295 |
+
</span>
|
296 |
</div>
|
297 |
|
298 |
</div>
|
302 |
$condition = array("target" => "placement", "values" => array("static-left","static-right","static-top", "static-bottom")) ;
|
303 |
$static_conditional = htmlentities(json_encode($condition ));
|
304 |
?>
|
305 |
+
<br>
|
306 |
+
<div class='conditional-option option-container' data-show="<?php echo $static_conditional ?>">
|
307 |
+
<div class="title"> <?php _e("Static positioning","maxbuttons"); ?></div>
|
308 |
<div class="inside">
|
309 |
<?php
|
310 |
$condition = array("target" => "placement", "values" => array("static-left","static-right")) ;
|
collections/picker-block.php
CHANGED
@@ -224,7 +224,7 @@ class pickerCollectionBlock extends collectionBlock
|
|
224 |
<div class="title">
|
225 |
<span class="dashicons dashicons-list-view"></span>
|
226 |
<span class='title'><?php _e("Buttons", "maxbuttons"); ?></span>
|
227 |
-
<button name="picker_popup" type="button" class="button"><?php _e("Select Social Share Icons","maxbuttons"); ?></button>
|
228 |
<span class='right'><button name="save" type="submit" data-form='collection_edit' class="button button-primary"><?php _e("Save All","maxbuttons"); ?></button>
|
229 |
</span>
|
230 |
</div>
|
224 |
<div class="title">
|
225 |
<span class="dashicons dashicons-list-view"></span>
|
226 |
<span class='title'><?php _e("Buttons", "maxbuttons"); ?></span>
|
227 |
+
<button name="picker_popup" type="button" class="button-primary"><?php _e("Select Social Share Icons","maxbuttons"); ?></button>
|
228 |
<span class='right'><button name="save" type="submit" data-form='collection_edit' class="button button-primary"><?php _e("Save All","maxbuttons"); ?></button>
|
229 |
</span>
|
230 |
</div>
|
collections/social-block.php
CHANGED
@@ -125,6 +125,7 @@ class socialCollectionBlock extends collectionBlock
|
|
125 |
$count = $maxSN->getShareCount(array("url" => $share_url,
|
126 |
"preview" => $this->is_preview,
|
127 |
));
|
|
|
128 |
if ($count === false) // signal for remote check
|
129 |
{
|
130 |
$this->social_data["onload"][$document_id] = array("network" => $network, "share_url" => esc_url($share_url), "count_threshold" => $count_threshold, "text" => $text, "text2" => $text2 );
|
125 |
$count = $maxSN->getShareCount(array("url" => $share_url,
|
126 |
"preview" => $this->is_preview,
|
127 |
));
|
128 |
+
|
129 |
if ($count === false) // signal for remote check
|
130 |
{
|
131 |
$this->social_data["onload"][$document_id] = array("network" => $network, "share_url" => esc_url($share_url), "count_threshold" => $count_threshold, "text" => $text, "text2" => $text2 );
|
includes/maxbuttons-button.php
CHANGED
@@ -55,30 +55,49 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
|
|
55 |
<form id="new-button-form" action="<?php echo admin_url('admin.php?page=maxbuttons-controller&action=button&noheader=true'); ?>" method="post">
|
56 |
<input type="hidden" name="button_id" value="<?php echo $button_id ?>">
|
57 |
<?php wp_nonce_field("button-edit","maxbuttons_button") ?>
|
|
|
|
|
|
|
58 |
|
59 |
<div class="form-actions">
|
60 |
<a class="button-primary button button-save" href='javascript:void(0);'><?php _e('Save', 'maxbuttons') ?></a>
|
61 |
<?php if ($button_id > 0): ?>
|
62 |
<a id="button-copy" class="maxmodal button" data-modal='copy-button' href="javascript:void(0)"><?php _e('Copy', 'maxbuttons') ?></a>
|
63 |
-
<a id="button-trash" class="button" href="
|
64 |
<a class="button maxmodal" href="javascript:void(0);" data-modal='delete-button'><?php _e("Delete","maxbuttons"); ?> </a>
|
65 |
<?php endif; // button_id > 0 ?>
|
66 |
|
67 |
<?php do_action('mb/editor/form-actions', $button); ?>
|
68 |
</div>
|
69 |
|
|
|
70 |
<div class="maxmodal-data" id="delete-button">
|
71 |
<span class='title'><?php _e("Removing button","maxbuttons"); ?></span>
|
72 |
<span class="content"><p><?php _e("You are about to permanently remove this button. Are you sure?", "maxbuttons"); ?></p></span>
|
73 |
<div class='controls'>
|
74 |
-
<
|
75 |
-
|
|
|
76 |
<a class="modal_close button-primary"><?php _e("No", "maxbuttons"); ?></a>
|
77 |
|
78 |
</div>
|
79 |
</div>
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
<span class='title'><?php _e("Copy this button","maxbuttons"); ?></span>
|
83 |
<span class="content"><p><?php _e("Do you want to copy this button to a new button?","maxbuttons"); ?></p>
|
84 |
<p><?php _e('Did you know you can use shortcodes for text and links?', 'maxbuttons'); ?></p>
|
@@ -92,12 +111,15 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
|
|
92 |
[maxbutton id="<?php echo $button_id ?>" text="yourtext"]
|
93 |
</p>
|
94 |
|
|
|
|
|
95 |
</span>
|
96 |
-
<span class="controls"
|
|
|
|
|
|
|
97 |
<a class='button modal_close'><?php _e("Cancel",'maxbuttons'); ?></a>
|
98 |
</span>
|
99 |
-
|
100 |
-
|
101 |
</div>
|
102 |
|
103 |
<?php
|
55 |
<form id="new-button-form" action="<?php echo admin_url('admin.php?page=maxbuttons-controller&action=button&noheader=true'); ?>" method="post">
|
56 |
<input type="hidden" name="button_id" value="<?php echo $button_id ?>">
|
57 |
<?php wp_nonce_field("button-edit","maxbuttons_button") ?>
|
58 |
+
<?php wp_nonce_field("button-copy","copy_nonce"); ?>
|
59 |
+
<?php wp_nonce_field("button-delete","delete_nonce"); ?>
|
60 |
+
<?php wp_nonce_field('button-trash', 'trash_nonce'); ?>
|
61 |
|
62 |
<div class="form-actions">
|
63 |
<a class="button-primary button button-save" href='javascript:void(0);'><?php _e('Save', 'maxbuttons') ?></a>
|
64 |
<?php if ($button_id > 0): ?>
|
65 |
<a id="button-copy" class="maxmodal button" data-modal='copy-button' href="javascript:void(0)"><?php _e('Copy', 'maxbuttons') ?></a>
|
66 |
+
<a id="button-trash" class="maxmodal button" data-modal = 'trash-button' href="javascript:void(0);"><?php _e('Move to Trash', 'maxbuttons') ?></a>
|
67 |
<a class="button maxmodal" href="javascript:void(0);" data-modal='delete-button'><?php _e("Delete","maxbuttons"); ?> </a>
|
68 |
<?php endif; // button_id > 0 ?>
|
69 |
|
70 |
<?php do_action('mb/editor/form-actions', $button); ?>
|
71 |
</div>
|
72 |
|
73 |
+
<!-- delete modal -->
|
74 |
<div class="maxmodal-data" id="delete-button">
|
75 |
<span class='title'><?php _e("Removing button","maxbuttons"); ?></span>
|
76 |
<span class="content"><p><?php _e("You are about to permanently remove this button. Are you sure?", "maxbuttons"); ?></p></span>
|
77 |
<div class='controls'>
|
78 |
+
<button class='button-primary' data-buttonaction='delete' data-buttonid='<?php echo $button_id ?>'>
|
79 |
+
<?php _e('Yes','maxbuttons'); ?></button>
|
80 |
+
|
81 |
<a class="modal_close button-primary"><?php _e("No", "maxbuttons"); ?></a>
|
82 |
|
83 |
</div>
|
84 |
</div>
|
85 |
+
|
86 |
+
<!-- trash modal -->
|
87 |
+
<div class="maxmodal-data" id="trash-button">
|
88 |
+
<span class='title'><?php _e("Trash button","maxbuttons"); ?></span>
|
89 |
+
<span class="content"><p><?php _e("The button will be moved to trash. It can be recovered from the trash bin later. Continue?", "maxbuttons"); ?></p></span>
|
90 |
+
<div class='controls'>
|
91 |
+
<button class='button-primary' data-buttonaction='trash' data-buttonid='<?php echo $button_id ?>'>
|
92 |
+
<?php _e('Yes','maxbuttons'); ?></button>
|
93 |
+
|
94 |
+
<a class="modal_close button-primary"><?php _e("No", "maxbuttons"); ?></a>
|
95 |
+
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
<!-- copy modal -->
|
100 |
+
<div class='maxmodal-data' id='copy-button' data-load='window.maxFoundry.maxadmin.checkCopyModal'>
|
101 |
<span class='title'><?php _e("Copy this button","maxbuttons"); ?></span>
|
102 |
<span class="content"><p><?php _e("Do you want to copy this button to a new button?","maxbuttons"); ?></p>
|
103 |
<p><?php _e('Did you know you can use shortcodes for text and links?', 'maxbuttons'); ?></p>
|
111 |
[maxbutton id="<?php echo $button_id ?>" text="yourtext"]
|
112 |
</p>
|
113 |
|
114 |
+
<div class='mb-message mb-notice copy-notice hidden'><p><?php _e('Your button has not been saved. Any changes will be lost!','maxbuttons'); ?></p>
|
115 |
+
</div>
|
116 |
</span>
|
117 |
+
<span class="controls">
|
118 |
+
<button class='button-primary' data-buttonaction='copy' data-buttonid='<?php echo $button_id ?>'>
|
119 |
+
<?php _e('Copy','maxbuttons'); ?></button>
|
120 |
+
|
121 |
<a class='button modal_close'><?php _e("Cancel",'maxbuttons'); ?></a>
|
122 |
</span>
|
|
|
|
|
123 |
</div>
|
124 |
|
125 |
<?php
|
includes/maxbuttons-collection-edit.php
CHANGED
@@ -82,11 +82,12 @@ $button = MB()->getClass("button");
|
|
82 |
<input type="hidden" name="block_nonce" value="<?php echo $block_nonce ?>">
|
83 |
<input type="hidden" name="tab" value="<?php echo $tab ?>" />
|
84 |
<input type="hidden" name="collection_type" value="<?php echo $collection_type ?>" >
|
85 |
-
</form>
|
86 |
|
87 |
<div class="form-actions">
|
88 |
<input type="submit" data-form='collection_edit' name="submit" value="<?php _e('Save All', 'maxbuttons') ?>" class="button-primary ">
|
89 |
</div>
|
|
|
|
|
90 |
<?php
|
91 |
|
92 |
$admin->get_footer();
|
82 |
<input type="hidden" name="block_nonce" value="<?php echo $block_nonce ?>">
|
83 |
<input type="hidden" name="tab" value="<?php echo $tab ?>" />
|
84 |
<input type="hidden" name="collection_type" value="<?php echo $collection_type ?>" >
|
|
|
85 |
|
86 |
<div class="form-actions">
|
87 |
<input type="submit" data-form='collection_edit' name="submit" value="<?php _e('Save All', 'maxbuttons') ?>" class="button-primary ">
|
88 |
</div>
|
89 |
+
</form>
|
90 |
+
|
91 |
<?php
|
92 |
|
93 |
$admin->get_footer();
|
includes/maxbuttons-controller.php
CHANGED
@@ -10,18 +10,6 @@ if (isset($_GET['action']) && $_GET['action'] != '') {
|
|
10 |
else
|
11 |
include_once 'maxbuttons-button.php';
|
12 |
break;
|
13 |
-
case 'copy':
|
14 |
-
include_once 'maxbuttons-copy.php';
|
15 |
-
break;
|
16 |
-
case 'delete':
|
17 |
-
include_once 'maxbuttons-delete.php';
|
18 |
-
break;
|
19 |
-
case 'trash':
|
20 |
-
include_once 'maxbuttons-trash.php';
|
21 |
-
break;
|
22 |
-
case 'restore':
|
23 |
-
include_once 'maxbuttons-restore.php';
|
24 |
-
break;
|
25 |
|
26 |
default:
|
27 |
include_once 'maxbuttons-list.php';
|
10 |
else
|
11 |
include_once 'maxbuttons-button.php';
|
12 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
default:
|
15 |
include_once 'maxbuttons-list.php';
|
includes/maxbuttons-copy.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (isset($_GET['id']) && $_GET['id'] != '') {
|
3 |
-
$button_id = intval($_GET["id"]); // validation
|
4 |
-
$button = new maxButton();
|
5 |
-
$button->set($button_id);
|
6 |
-
$new_id = $button->copy();
|
7 |
-
|
8 |
-
}
|
9 |
-
?>
|
10 |
-
<script type="text/javascript">
|
11 |
-
<?php if (isset($new_id)) { ?>
|
12 |
-
window.location = "<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=button&id=<?php echo $new_id ?>";
|
13 |
-
<?php } else { ?>
|
14 |
-
window.location = "<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=list";
|
15 |
-
<?php } ?>
|
16 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/maxbuttons-delete.php
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*if (! check_admin_referer("button-edit","maxbuttons_button"))
|
3 |
-
{
|
4 |
-
exit("Request not valid");
|
5 |
-
}*/
|
6 |
-
|
7 |
-
if (isset($_GET['id']) && $_GET['id'] != '') {
|
8 |
-
|
9 |
-
$button = new maxButton();
|
10 |
-
$button_id = intval($_GET["id"]); // validation
|
11 |
-
|
12 |
-
$button->delete($button_id);
|
13 |
-
|
14 |
-
}
|
15 |
-
// not great.
|
16 |
-
$_GET['message'] = '1delete';
|
17 |
-
$_GET['status'] = 'trash';
|
18 |
-
include_once 'maxbuttons-list.php';
|
19 |
-
return;
|
20 |
-
?>
|
21 |
-
<script type="text/javascript">
|
22 |
-
window.location = "<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=list&status=trash&message=1delete";
|
23 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/maxbuttons-list.php
CHANGED
@@ -180,6 +180,11 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
|
|
180 |
|
181 |
?>
|
182 |
<form method="post">
|
|
|
|
|
|
|
|
|
|
|
183 |
<input type="hidden" name="view" value="<?php echo $view ?>" />
|
184 |
<?php wp_nonce_field("mb-list","mb-list-nonce"); ?>
|
185 |
|
@@ -265,15 +270,15 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
|
|
265 |
<?php if($view == 'all') : ?>
|
266 |
<a href="<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=button&id=<?php echo $id ?>"><?php _e('Edit', 'maxbuttons') ?></a>
|
267 |
<span class="separator">|</span>
|
268 |
-
<a href=
|
269 |
<span class="separator">|</span>
|
270 |
-
<a href="
|
271 |
<?php endif;
|
272 |
if ($view == 'trash'):
|
273 |
?>
|
274 |
-
<a href="
|
275 |
<span class="separator">|</span>
|
276 |
-
<a href="
|
277 |
<?php endif; ?>
|
278 |
</div>
|
279 |
|
180 |
|
181 |
?>
|
182 |
<form method="post">
|
183 |
+
<?php wp_nonce_field("button-copy","copy_nonce"); ?>
|
184 |
+
<?php wp_nonce_field("button-delete","delete_nonce"); ?>
|
185 |
+
<?php wp_nonce_field('button-trash', 'trash_nonce'); ?>
|
186 |
+
<?php wp_nonce_field('button-restore', 'restore_nonce'); ?>
|
187 |
+
|
188 |
<input type="hidden" name="view" value="<?php echo $view ?>" />
|
189 |
<?php wp_nonce_field("mb-list","mb-list-nonce"); ?>
|
190 |
|
270 |
<?php if($view == 'all') : ?>
|
271 |
<a href="<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=button&id=<?php echo $id ?>"><?php _e('Edit', 'maxbuttons') ?></a>
|
272 |
<span class="separator">|</span>
|
273 |
+
<a href='javascript:void(0);' data-buttonaction='copy' data-buttonid="<?php echo $id ?>"><?php _e('Copy', 'maxbuttons') ?></a>
|
274 |
<span class="separator">|</span>
|
275 |
+
<a href="javascript:void(0)" data-buttonaction='trash' data-buttonid="<?php echo $id ?>"><?php _e('Move to Trash', 'maxbuttons') ?></a>
|
276 |
<?php endif;
|
277 |
if ($view == 'trash'):
|
278 |
?>
|
279 |
+
<a href="javascript:void(0);" data-buttonaction='restore' data-buttonid="<?php echo $id ?>"><?php _e('Restore', 'maxbuttons') ?></a>
|
280 |
<span class="separator">|</span>
|
281 |
+
<a href="javascript:void(0);" data-buttonaction='delete' data-buttonid="<?php echo $id ?>"><?php _e('Delete Permanently', 'maxbuttons') ?></a>
|
282 |
<?php endif; ?>
|
283 |
</div>
|
284 |
|
includes/maxbuttons-restore.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (isset($_GET['id']) && $_GET['id'] != '') {
|
3 |
-
$button_id = intval($_GET["id"]); // validation
|
4 |
-
$button = new maxButton();
|
5 |
-
$set = $button->set($button_id,'','trash');
|
6 |
-
if (! $set) exit("Restore failed");
|
7 |
-
$button->setStatus("publish");
|
8 |
-
}
|
9 |
-
?>
|
10 |
-
<script type="text/javascript">
|
11 |
-
window.location = "<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=list&status=trash&message=1restore";
|
12 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/maxbuttons-trash.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (isset($_GET['id']) && $_GET['id'] != '') {
|
3 |
-
$button_id = intval($_GET["id"]); // validation
|
4 |
-
$button = new maxButton();
|
5 |
-
|
6 |
-
$result = $button->set($button_id);
|
7 |
-
if ($result)
|
8 |
-
$button->setStatus('trash');
|
9 |
-
|
10 |
-
}
|
11 |
-
?>
|
12 |
-
<script type="text/javascript">
|
13 |
-
window.location = "<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=list&message=1";
|
14 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/maxbuttons-admin.js
CHANGED
@@ -36,7 +36,9 @@ maxAdmin.prototype.init = function () {
|
|
36 |
});
|
37 |
|
38 |
$(document).on('submit', 'form.mb_ajax_save', $.proxy(this.formAjaxSave, this));
|
39 |
-
|
|
|
|
|
40 |
|
41 |
// conditionals
|
42 |
$(document).on('reInitConditionals', $.proxy(this.initConditionials, this));
|
@@ -100,8 +102,6 @@ maxAdmin.prototype.init = function () {
|
|
100 |
// Expand shortcode tabs for more examples.
|
101 |
$('.shortcode-expand').on('click', this.toggleShortcode);
|
102 |
|
103 |
-
// Delete Button dialog
|
104 |
-
$(document).on('click', '#delete-button-yes', $.proxy(this.delete_button,this) );
|
105 |
|
106 |
}; // INIT
|
107 |
|
@@ -167,12 +167,54 @@ maxAdmin.prototype.select_field = function(e)
|
|
167 |
$(e.target).select();
|
168 |
}
|
169 |
|
170 |
-
maxAdmin.prototype.
|
171 |
{
|
172 |
-
|
173 |
-
var
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
|
178 |
maxAdmin.prototype.toggle_preview = function (e)
|
@@ -640,14 +682,17 @@ maxAdmin.prototype.formAjaxSave = function (e)
|
|
640 |
}).done($.proxy(this.saveDone, this));
|
641 |
}
|
642 |
|
|
|
643 |
maxAdmin.prototype.buttonSubmit = function (e)
|
644 |
{
|
|
|
645 |
e.preventDefault();
|
646 |
$('[data-form]').prop('disabled', true);
|
647 |
var formName = $(e.target).data('form');
|
648 |
$('#' + formName).submit();
|
649 |
|
650 |
}
|
|
|
651 |
|
652 |
maxAdmin.prototype.saveDone = function (res)
|
653 |
{
|
36 |
});
|
37 |
|
38 |
$(document).on('submit', 'form.mb_ajax_save', $.proxy(this.formAjaxSave, this));
|
39 |
+
|
40 |
+
// copy / delete / trash action buttons via ajax
|
41 |
+
$(document).on('click', '[data-buttonaction]', $.proxy(this.button_action, this ));
|
42 |
|
43 |
// conditionals
|
44 |
$(document).on('reInitConditionals', $.proxy(this.initConditionials, this));
|
102 |
// Expand shortcode tabs for more examples.
|
103 |
$('.shortcode-expand').on('click', this.toggleShortcode);
|
104 |
|
|
|
|
|
105 |
|
106 |
}; // INIT
|
107 |
|
167 |
$(e.target).select();
|
168 |
}
|
169 |
|
170 |
+
maxAdmin.prototype.button_action = function(e)
|
171 |
{
|
172 |
+
e.preventDefault();
|
173 |
+
var action = $(e.target).data('buttonaction');
|
174 |
+
|
175 |
+
this.form_updated = false;
|
176 |
+
|
177 |
+
var button_id = $(e.target).data('buttonid');
|
178 |
+
var nonce = $('input[name="' + action + '_nonce"]').val();
|
179 |
+
|
180 |
+
var url = mb_ajax.ajaxurl;
|
181 |
+
var data =
|
182 |
+
{
|
183 |
+
action: 'mb_button_action',
|
184 |
+
button_action: action,
|
185 |
+
button_id: button_id,
|
186 |
+
nonce: nonce,
|
187 |
+
|
188 |
+
};
|
189 |
+
|
190 |
+
$.post({
|
191 |
+
url: url,
|
192 |
+
data: data,
|
193 |
+
success: function (data) {
|
194 |
+
response = JSON.parse(data);
|
195 |
+
|
196 |
+
if (typeof response.redirection != 'undefined')
|
197 |
+
{
|
198 |
+
window.location = response.redirection;
|
199 |
+
|
200 |
+
}
|
201 |
+
},
|
202 |
+
error: function () {
|
203 |
+
console.log('error in button action' + action);
|
204 |
+
},
|
205 |
+
});
|
206 |
+
}
|
207 |
+
|
208 |
+
/* Check the copy modal and display a warning if the button has been changes */
|
209 |
+
maxAdmin.prototype.checkCopyModal = function(modal)
|
210 |
+
{
|
211 |
+
if (this.form_updated)
|
212 |
+
{
|
213 |
+
modal.currentModal.find('.mb-message').show();
|
214 |
+
|
215 |
+
}
|
216 |
+
else
|
217 |
+
$(modal.currentModal).find('.mb-message').hide();
|
218 |
}
|
219 |
|
220 |
maxAdmin.prototype.toggle_preview = function (e)
|
682 |
}).done($.proxy(this.saveDone, this));
|
683 |
}
|
684 |
|
685 |
+
/*
|
686 |
maxAdmin.prototype.buttonSubmit = function (e)
|
687 |
{
|
688 |
+
|
689 |
e.preventDefault();
|
690 |
$('[data-form]').prop('disabled', true);
|
691 |
var formName = $(e.target).data('form');
|
692 |
$('#' + formName).submit();
|
693 |
|
694 |
}
|
695 |
+
*/
|
696 |
|
697 |
maxAdmin.prototype.saveDone = function (res)
|
698 |
{
|
js/maxmodal.js
CHANGED
@@ -77,8 +77,6 @@ jQuery(document).ready(function($) {
|
|
77 |
this.currentModal.css('left', left + 'px');
|
78 |
this.currentModal.css('top', top + 'px');
|
79 |
this.currentModal.css('height', modalHeight);
|
80 |
-
|
81 |
-
|
82 |
|
83 |
this.currentModal.show();
|
84 |
|
@@ -105,7 +103,6 @@ jQuery(document).ready(function($) {
|
|
105 |
this.currentModal.removeAttr('style');
|
106 |
this.currentModal.find('.modal_content').removeAttr('style');
|
107 |
// redo sizes, repaint.
|
108 |
-
|
109 |
|
110 |
this.show();
|
111 |
}
|
@@ -218,6 +215,7 @@ jQuery(document).ready(function($) {
|
|
218 |
this.setTitle(title)
|
219 |
this.setContent(content);
|
220 |
this.setControls(controls);
|
|
|
221 |
|
222 |
// callback on init
|
223 |
if (typeof data.data('load') !== 'undefined')
|
@@ -241,7 +239,6 @@ jQuery(document).ready(function($) {
|
|
241 |
|
242 |
try
|
243 |
{
|
244 |
-
|
245 |
callFunc(this);
|
246 |
}
|
247 |
catch(err)
|
@@ -249,9 +246,8 @@ jQuery(document).ready(function($) {
|
|
249 |
console.log('MB Modal Callback Error: ' + err.message);
|
250 |
}
|
251 |
}
|
252 |
-
|
253 |
this.show();
|
254 |
-
|
255 |
}
|
256 |
|
257 |
maxModal.prototype.newModal = function(id)
|
@@ -274,7 +270,7 @@ jQuery(document).ready(function($) {
|
|
274 |
$(modal).draggable({
|
275 |
handle: '.modal_header'
|
276 |
});
|
277 |
-
|
278 |
this.modals.push(modal);
|
279 |
this.currentModal = modal;
|
280 |
this.controls = [];
|
77 |
this.currentModal.css('left', left + 'px');
|
78 |
this.currentModal.css('top', top + 'px');
|
79 |
this.currentModal.css('height', modalHeight);
|
|
|
|
|
80 |
|
81 |
this.currentModal.show();
|
82 |
|
103 |
this.currentModal.removeAttr('style');
|
104 |
this.currentModal.find('.modal_content').removeAttr('style');
|
105 |
// redo sizes, repaint.
|
|
|
106 |
|
107 |
this.show();
|
108 |
}
|
215 |
this.setTitle(title)
|
216 |
this.setContent(content);
|
217 |
this.setControls(controls);
|
218 |
+
|
219 |
|
220 |
// callback on init
|
221 |
if (typeof data.data('load') !== 'undefined')
|
239 |
|
240 |
try
|
241 |
{
|
|
|
242 |
callFunc(this);
|
243 |
}
|
244 |
catch(err)
|
246 |
console.log('MB Modal Callback Error: ' + err.message);
|
247 |
}
|
248 |
}
|
249 |
+
|
250 |
this.show();
|
|
|
251 |
}
|
252 |
|
253 |
maxModal.prototype.newModal = function(id)
|
270 |
$(modal).draggable({
|
271 |
handle: '.modal_header'
|
272 |
});
|
273 |
+
|
274 |
this.modals.push(modal);
|
275 |
this.currentModal = modal;
|
276 |
this.controls = [];
|
js/min/maxbuttons-admin.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var maxAdmin;jQuery(document).ready(function($){maxAdmin=function(){return this},maxAdmin.prototype={colorUpdateTime:!0,fields:null,button_id:null,form_updated:!1,tabs:null},maxAdmin.prototype.init=function(){this.button_id=$('input[name="button_id"]').val(),$(document).on("click",".maxbutton-preview",function(t){t.preventDefault()}),$(document).on("click",".output .preview-toggle",$.proxy(this.toggle_preview,this)),$("#maxbuttons .input-paging").on("change",$.proxy(this.do_paging,this)),$(".manual-toggle").on("click",$.proxy(this.toggleManual,this)),$(".manual-entry").draggable({cancel:"p, li"}),$(document).on("submit","form.mb_ajax_save",$.proxy(this.formAjaxSave,this)),$(document).on("reInitConditionals",$.proxy(this.initConditionials,this)),this.initConditionials(),0!=$("#new-button-form").length&&(this.button_id>0&&$("#maxbuttons .mb-message").show(),this.initResponsive(),$("#maxbuttons .output").draggable({cancel:".nodrag"}),$(".color-field").wpColorPicker({width:300,change:$.proxy(_.throttle(function(t,e){t.preventDefault();var a=e.color.toString();this.update_color(t,e,a)},200),this)}),$(".input.color .arrows").on("click",$.proxy(this.copyColor,this)),$("#radius_toggle").on("click",$.proxy(this.toggleRadiusLock,this)),"undefined"!=typeof buttonFieldMap&&(this.fields=$.parseJSON(buttonFieldMap)),$("input").not(".color-field").on("keyup change",$.proxy(this.update_preview,this)),$("input.color-field").on("focus",$.proxy(this.select_field,this)),$("select").on("change",$.proxy(this.update_preview,this)),$(window).on("beforeunload",$.proxy(function(){return this.form_updated?maxcol_wp.leave_page:void 0},this)),$(".button-save").click($.proxy(function(){return this.saveIndicator(!1),$("#new-button-form").submit(),!1},this)),$(".shortcode-expand").on("click",this.toggleShortcode),$(document).on("click","#delete-button-yes",$.proxy(this.delete_button,this)))},maxAdmin.prototype.repaint_preview=function(){$('.mb_tab input[type="text"]').trigger("change"),$('.mb_tab input[type="number"]').trigger("change"),$(".mb_tab select").trigger("change"),$('.mb_tab input[type="hidden"]').trigger("change"),$('.mb_tab input[type="radio"]:checked').trigger("change"),$('.mb_tab input[type="checkbox"]:checked').trigger("change")},maxAdmin.prototype.update_preview=function(e){e.preventDefault(),this.saveIndicator(!0);var target=$(e.target),field=$(target).data("field");if("undefined"==typeof field)var id=$(target).attr("id");else var id=field;var data=this.fields[id];"undefined"!=typeof data&&("undefined"!=typeof data.css&&(value=target.val(),"undefined"!=typeof data.css_unit&&-1==value.indexOf(data.css_unit)&&(value+=data.css_unit),target.is(":checkbox")&&!target.is(":checked")&&(value=""),this.putCSS(data,value)),"undefined"!=typeof data.attr&&$(".output .result").find("a").attr(data.attr,target.val()),"undefined"!=typeof data.func&&eval("this."+data.func+"(target)"))},maxAdmin.prototype.select_field=function(t){$(t.target).select()},maxAdmin.prototype.delete_button=function(t){this.form_updated=!1;$(t.target).data("id")},maxAdmin.prototype.toggle_preview=function(){$(".output .inner").is(":hidden")?($(".output .inner").show(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up")):($(".output .inner").hide(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"))},maxAdmin.prototype.putCSS=function(t,e,a){a=a||"both";var o=".maxbutton";if("hover"==a?o="a.hover ":"normal"==a&&(o="a.normal "),"undefined"!=typeof t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var r=n[i],d=o+" ."+r;$(".output .result").find(d).css(t.css,e)}}else $(".output .result").find(o).css(t.css,e)},maxAdmin.prototype.update_color=function(t,e,a){t.preventDefault(),this.saveIndicator(!0);var o=$(t.target);-1===a.indexOf("#")&&(a="#"+a);var i=o.attr("id");if($("#"+i).val(a),-1!==i.indexOf("box_shadow"))this.updateBoxShadow(o);else if(-1!==i.indexOf("text_shadow"))this.updateTextShadow(o);else if(-1!==i.indexOf("gradient"))-1==i.indexOf("hover")?this.updateGradient():this.updateGradient(!0);else{if("button_preview"!=i){state=-1==i.indexOf("hover")?"normal":"hover";var n=this.fields[i];return void this.putCSS(n,a,state)}$(".output .result").css("backgroundColor",a)}},maxAdmin.prototype.copyColor=function(t){t.preventDefault(),t.stopPropagation();var e=$(t.target),a=$(t.target).parents("[data-bind]"),o="#"+a.data("id"),i="#"+a.data("bind");if(e.hasClass("arrow-right"))var n="right";else var n="left";if(a.hasClass("right"))var r="left";else var r="right";"left"==r?copy="right"==n?!0:!1:"right"==r&&(copy="right"==n?!1:!0),copy?($(i).val($(o).val()),$(i).trigger("change"),$(i).wpColorPicker("color",$(o).val())):($(o).val($(i).val()),$(o).trigger("change"),$(o).wpColorPicker("color",$(i).val()))},maxAdmin.prototype.updateGradient=function(t){t=t||!1;var e="";t&&(e="_hover");var a=parseInt($("#gradient_stop").val());isNaN(a)&&(a=45);var o=$("#use_gradient").prop("checked"),i=this.hexToRgb($("#gradient_start_color"+e).val()),n=this.hexToRgb($("#gradient_end_color"+e).val()),r=parseInt($("#gradient_start_opacity"+e).val()),d=parseInt($("#gradient_end_opacity"+e).val());if(o||(n=i,d=r),isNaN(r)&&(r=100),isNaN(d)&&(d=100),t)var s=$(".output .result").find("a.hover");else var s=$(".output .result").find("a.normal");s.css("background","linear-gradient( rgba("+i+","+r/100+") "+a+"%, rgba("+n+","+d/100+") )"),s.css("background","-moz-linear-gradient( rgba("+i+","+r/100+") "+a+"%, rgba("+n+","+d/100+") )"),s.css("background","-o-linear-gradient( rgba("+i+","+r/100+") "+a+"%, rgba("+n+","+d/100+") )"),s.css("background","-webkit-gradient(linear, left top, left bottom, color-stop("+a+"%, rgba("+i+","+r/100+")), color-stop(1, rgba("+n+","+d/100+") ));")},maxAdmin.prototype.hexToRgb=function(t){t=t.replace("#","");var e=parseInt(t,16),a=e>>16&255,o=e>>8&255,i=255&e;return a+","+o+","+i},maxAdmin.prototype.updateBoxShadow=function(t){t=t||null;var e=$("#box_shadow_offset_left").val(),a=$("#box_shadow_offset_top").val(),o=$("#box_shadow_width").val(),i=$("#box_shadow_spread").val(),n=$("#box_shadow_color").val(),r=$("#box_shadow_color_hover").val();$(".output .result").find("a.normal").css("boxShadow",e+"px "+a+"px "+o+"px "+i+"px "+n),$(".output .result").find("a.hover").css("boxShadow",e+"px "+a+"px "+o+"px "+i+"px "+r)},maxAdmin.prototype.updateTextShadow=function(t,e){e=e||!1;var a=$("#text_shadow_offset_left").val(),o=$("#text_shadow_offset_top").val(),i=$("#text_shadow_width").val(),n=$("#text_shadow_color").val(),r=$("#text_shadow_color_hover").val(),d=$(t).attr("id"),s=this.fields[d];s.css="textShadow";var l=a+"px "+o+"px "+i+"px "+n;this.putCSS(s,l,"normal"),l=a+"px "+o+"px "+i+"px "+r,this.putCSS(s,l,"hover")},maxAdmin.prototype.updateAnchorText=function(t){var e=$(".output .result").find("a .mb-text");0===e.length&&($(".output .result").find("a").append('<span class="mb-text"></span>'),$(".output .result").find("a .mb-text").css({display:"block","line-height":"1em","box-sizing":"border-box"}),this.repaint_preview()),$(".output .result").find("a .mb-text").text(t.val())},maxAdmin.prototype.updateGradientOpacity=function(){this.updateGradient(!0),this.updateGradient(!1)},maxAdmin.prototype.updateDimension=function(t){var e=$(t).val(),a=$(t).attr("id"),o=this.fields[a];e>0?this.putCSS(o,e):this.putCSS(o,"auto")},maxAdmin.prototype.updateRadius=function(t){var e=t.val(),a=["radius_bottom_left","radius_bottom_right","radius_top_left","radius_top_right"];if("lock"==$("#radius_toggle").data("lock"))for(i=0;i<a.length;i++){var o=a[i];$("#"+o).val(e);var n=this.fields[o];this.putCSS(n,e+"px")}},maxAdmin.prototype.toggleRadiusLock=function(t){var e=$(t.target),a=$(e).data("lock");"lock"==a?($(e).removeClass("dashicons-lock").addClass("dashicons-unlock"),$(e).data("lock","unlock")):"unlock"==a&&($(e).removeClass("dashicons-unlock").addClass("dashicons-lock"),$(e).data("lock","lock"))},maxAdmin.prototype.initResponsive=function(){window.maxFoundry.maxadmin.responsive=new mbResponsive($),window.maxFoundry.maxadmin.responsive.init(this)},maxAdmin.prototype.do_paging=function(t){var e=parseInt($(t.target).val());if(e<=parseInt($(t.target).attr("max"))){var a=$(t.target).data("url");window.location=a+"&paged="+e}},maxAdmin.prototype.toggleShortcode=function(){$(".shortcode-expand").hasClass("closed")?($(" .mb-message.shortcode .expanded").css("display","inline-block"),$(".shortcode-expand span").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"),$(".shortcode-expand").removeClass("closed").addClass("open")):($(" .mb-message.shortcode .expanded").css("display","none"),$(".shortcode-expand span").addClass("dashicons-arrow-down").removeClass("dashicons-arrow-up"),$(".shortcode-expand").addClass("closed").removeClass("open"))},maxAdmin.prototype.toggleManual=function(t){t.preventDefault();var e=$(t.target),a=e.data("target"),o=$('.manual-entry[data-manual="'+a+'"]');if(o.is(":visible"))return o.hide(),!0;var i=$('[data-options="'+a+'"]').position(),n=i.top+e.height();o.css("top",n),o.css("right",15),o.css("left","auto"),o.show()},maxAdmin.prototype.initConditionials=function(){var t=this;$("[data-show]").each(function(){var e=$(this).data("show"),a=e.target,o=e.values;$(document).on("change",'[name="'+a+'"]',{child:this,values:o},$.proxy(t.updateConditional,t)),$('[name="'+a+'"]').trigger("change")})},maxAdmin.prototype.updateConditional=function(t){var e=t.data,a=e.values,o=e.child,i=$(t.currentTarget),n=$(i).val();if("checkbox"===i.attr("type")){var r=$(i).prop("checked");n="checked"==a&&r?"checked":"unchecked"!=a||r?0:"unchecked"}a.indexOf(n)>=0?($(o).fadeIn("fast"),$(o).find("input, select").trigger("change")):($(o).fadeOut("fast"),$(o).find("input, select").trigger("change"))},maxAdmin.prototype.saveIndicator=function(t){this.form_updated=t?!0:!1},maxAdmin.prototype.formAjaxSave=function(t){t.preventDefault();var e=mb_ajax.ajaxurl,a=$(t.target),o=a.serialize();$.ajax({type:"POST",url:e,data:o}).done($.proxy(this.saveDone,this))},maxAdmin.prototype.buttonSubmit=function(t){t.preventDefault(),$("[data-form]").prop("disabled",!0);var e=$(t.target).data("form");$("#"+e).submit()},maxAdmin.prototype.saveDone=function(t){$("[data-form]").prop("disabled",!1);var e=$.parseJSON(t),a=e.result,o=e.title,i=e.data.id;if("undefined"!=typeof e.data.new_nonce){{e.data.new_nonce}$('input[name="nonce"]').val(e.data.new_nonce)}if(a){$('input[name="collection_id"]').val(i);var n=window.location.href;-1===n.indexOf("collection_id")&&window.history.replaceState({},"",n+"&collection_id="+i),$(document).trigger("mbFormSaved");var r=$('input[name="sorted"]').val();$('input[name="previous_selection"]').val(r),e.data.reload&&document.location.reload(!0)}a||($modal=window.maxFoundry.maxmodal,$modal.newModal("collection_error"),$modal.setTitle(o),$modal.setContent(e.body),$modal.setControls('<button class="modal_close button-primary">'+e.close_text+"</button>"),$modal.show())}});
|
1 |
+
var maxAdmin;jQuery(document).ready(function($){maxAdmin=function(){return this},maxAdmin.prototype={colorUpdateTime:!0,fields:null,button_id:null,form_updated:!1,tabs:null},maxAdmin.prototype.init=function(){this.button_id=$('input[name="button_id"]').val(),$(document).on("click",".maxbutton-preview",function(t){t.preventDefault()}),$(document).on("click",".output .preview-toggle",$.proxy(this.toggle_preview,this)),$("#maxbuttons .input-paging").on("change",$.proxy(this.do_paging,this)),$(".manual-toggle").on("click",$.proxy(this.toggleManual,this)),$(".manual-entry").draggable({cancel:"p, li"}),$(document).on("submit","form.mb_ajax_save",$.proxy(this.formAjaxSave,this)),$(document).on("click","[data-buttonaction]",$.proxy(this.button_action,this)),$(document).on("reInitConditionals",$.proxy(this.initConditionials,this)),this.initConditionials(),0!=$("#new-button-form").length&&(this.button_id>0&&$("#maxbuttons .mb-message").show(),this.initResponsive(),$("#maxbuttons .output").draggable({cancel:".nodrag"}),$(".color-field").wpColorPicker({width:300,change:$.proxy(_.throttle(function(t,e){t.preventDefault();var a=e.color.toString();this.update_color(t,e,a)},200),this)}),$(".input.color .arrows").on("click",$.proxy(this.copyColor,this)),$("#radius_toggle").on("click",$.proxy(this.toggleRadiusLock,this)),"undefined"!=typeof buttonFieldMap&&(this.fields=$.parseJSON(buttonFieldMap)),$("input").not(".color-field").on("keyup change",$.proxy(this.update_preview,this)),$("input.color-field").on("focus",$.proxy(this.select_field,this)),$("select").on("change",$.proxy(this.update_preview,this)),$(window).on("beforeunload",$.proxy(function(){return this.form_updated?maxcol_wp.leave_page:void 0},this)),$(".button-save").click($.proxy(function(){return this.saveIndicator(!1),$("#new-button-form").submit(),!1},this)),$(".shortcode-expand").on("click",this.toggleShortcode))},maxAdmin.prototype.repaint_preview=function(){$('.mb_tab input[type="text"]').trigger("change"),$('.mb_tab input[type="number"]').trigger("change"),$(".mb_tab select").trigger("change"),$('.mb_tab input[type="hidden"]').trigger("change"),$('.mb_tab input[type="radio"]:checked').trigger("change"),$('.mb_tab input[type="checkbox"]:checked').trigger("change")},maxAdmin.prototype.update_preview=function(e){e.preventDefault(),this.saveIndicator(!0);var target=$(e.target),field=$(target).data("field");if("undefined"==typeof field)var id=$(target).attr("id");else var id=field;var data=this.fields[id];"undefined"!=typeof data&&("undefined"!=typeof data.css&&(value=target.val(),"undefined"!=typeof data.css_unit&&-1==value.indexOf(data.css_unit)&&(value+=data.css_unit),target.is(":checkbox")&&!target.is(":checked")&&(value=""),this.putCSS(data,value)),"undefined"!=typeof data.attr&&$(".output .result").find("a").attr(data.attr,target.val()),"undefined"!=typeof data.func&&eval("this."+data.func+"(target)"))},maxAdmin.prototype.select_field=function(t){$(t.target).select()},maxAdmin.prototype.button_action=function(t){t.preventDefault();var e=$(t.target).data("buttonaction");this.form_updated=!1;var a=$(t.target).data("buttonid"),o=$('input[name="'+e+'_nonce"]').val(),n=mb_ajax.ajaxurl,i={action:"mb_button_action",button_action:e,button_id:a,nonce:o};$.post({url:n,data:i,success:function(t){response=JSON.parse(t),"undefined"!=typeof response.redirection&&(window.location=response.redirection)},error:function(){console.log("error in button action"+e)}})},maxAdmin.prototype.checkCopyModal=function(t){this.form_updated?t.currentModal.find(".mb-message").show():$(t.currentModal).find(".mb-message").hide()},maxAdmin.prototype.toggle_preview=function(){$(".output .inner").is(":hidden")?($(".output .inner").show(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up")):($(".output .inner").hide(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"))},maxAdmin.prototype.putCSS=function(t,e,a){a=a||"both";var o=".maxbutton";if("hover"==a?o="a.hover ":"normal"==a&&(o="a.normal "),"undefined"!=typeof t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var r=n[i],d=o+" ."+r;$(".output .result").find(d).css(t.css,e)}}else $(".output .result").find(o).css(t.css,e)},maxAdmin.prototype.update_color=function(t,e,a){t.preventDefault(),this.saveIndicator(!0);var o=$(t.target);-1===a.indexOf("#")&&(a="#"+a);var n=o.attr("id");if($("#"+n).val(a),-1!==n.indexOf("box_shadow"))this.updateBoxShadow(o);else if(-1!==n.indexOf("text_shadow"))this.updateTextShadow(o);else if(-1!==n.indexOf("gradient"))-1==n.indexOf("hover")?this.updateGradient():this.updateGradient(!0);else{if("button_preview"!=n){state=-1==n.indexOf("hover")?"normal":"hover";var i=this.fields[n];return void this.putCSS(i,a,state)}$(".output .result").css("backgroundColor",a)}},maxAdmin.prototype.copyColor=function(t){t.preventDefault(),t.stopPropagation();var e=$(t.target),a=$(t.target).parents("[data-bind]"),o="#"+a.data("id"),n="#"+a.data("bind");if(e.hasClass("arrow-right"))var i="right";else var i="left";if(a.hasClass("right"))var r="left";else var r="right";"left"==r?copy="right"==i?!0:!1:"right"==r&&(copy="right"==i?!1:!0),copy?($(n).val($(o).val()),$(n).trigger("change"),$(n).wpColorPicker("color",$(o).val())):($(o).val($(n).val()),$(o).trigger("change"),$(o).wpColorPicker("color",$(n).val()))},maxAdmin.prototype.updateGradient=function(t){t=t||!1;var e="";t&&(e="_hover");var a=parseInt($("#gradient_stop").val());isNaN(a)&&(a=45);var o=$("#use_gradient").prop("checked"),n=this.hexToRgb($("#gradient_start_color"+e).val()),i=this.hexToRgb($("#gradient_end_color"+e).val()),r=parseInt($("#gradient_start_opacity"+e).val()),d=parseInt($("#gradient_end_opacity"+e).val());if(o||(i=n,d=r),isNaN(r)&&(r=100),isNaN(d)&&(d=100),t)var s=$(".output .result").find("a.hover");else var s=$(".output .result").find("a.normal");s.css("background","linear-gradient( rgba("+n+","+r/100+") "+a+"%, rgba("+i+","+d/100+") )"),s.css("background","-moz-linear-gradient( rgba("+n+","+r/100+") "+a+"%, rgba("+i+","+d/100+") )"),s.css("background","-o-linear-gradient( rgba("+n+","+r/100+") "+a+"%, rgba("+i+","+d/100+") )"),s.css("background","-webkit-gradient(linear, left top, left bottom, color-stop("+a+"%, rgba("+n+","+r/100+")), color-stop(1, rgba("+i+","+d/100+") ));")},maxAdmin.prototype.hexToRgb=function(t){t=t.replace("#","");var e=parseInt(t,16),a=e>>16&255,o=e>>8&255,n=255&e;return a+","+o+","+n},maxAdmin.prototype.updateBoxShadow=function(t){t=t||null;var e=$("#box_shadow_offset_left").val(),a=$("#box_shadow_offset_top").val(),o=$("#box_shadow_width").val(),n=$("#box_shadow_spread").val(),i=$("#box_shadow_color").val(),r=$("#box_shadow_color_hover").val();$(".output .result").find("a.normal").css("boxShadow",e+"px "+a+"px "+o+"px "+n+"px "+i),$(".output .result").find("a.hover").css("boxShadow",e+"px "+a+"px "+o+"px "+n+"px "+r)},maxAdmin.prototype.updateTextShadow=function(t,e){e=e||!1;var a=$("#text_shadow_offset_left").val(),o=$("#text_shadow_offset_top").val(),n=$("#text_shadow_width").val(),i=$("#text_shadow_color").val(),r=$("#text_shadow_color_hover").val(),d=$(t).attr("id"),s=this.fields[d];s.css="textShadow";var p=a+"px "+o+"px "+n+"px "+i;this.putCSS(s,p,"normal"),p=a+"px "+o+"px "+n+"px "+r,this.putCSS(s,p,"hover")},maxAdmin.prototype.updateAnchorText=function(t){var e=$(".output .result").find("a .mb-text");0===e.length&&($(".output .result").find("a").append('<span class="mb-text"></span>'),$(".output .result").find("a .mb-text").css({display:"block","line-height":"1em","box-sizing":"border-box"}),this.repaint_preview()),$(".output .result").find("a .mb-text").text(t.val())},maxAdmin.prototype.updateGradientOpacity=function(){this.updateGradient(!0),this.updateGradient(!1)},maxAdmin.prototype.updateDimension=function(t){var e=$(t).val(),a=$(t).attr("id"),o=this.fields[a];e>0?this.putCSS(o,e):this.putCSS(o,"auto")},maxAdmin.prototype.updateRadius=function(t){var e=t.val(),a=["radius_bottom_left","radius_bottom_right","radius_top_left","radius_top_right"];if("lock"==$("#radius_toggle").data("lock"))for(i=0;i<a.length;i++){var o=a[i];$("#"+o).val(e);var n=this.fields[o];this.putCSS(n,e+"px")}},maxAdmin.prototype.toggleRadiusLock=function(t){var e=$(t.target),a=$(e).data("lock");"lock"==a?($(e).removeClass("dashicons-lock").addClass("dashicons-unlock"),$(e).data("lock","unlock")):"unlock"==a&&($(e).removeClass("dashicons-unlock").addClass("dashicons-lock"),$(e).data("lock","lock"))},maxAdmin.prototype.initResponsive=function(){window.maxFoundry.maxadmin.responsive=new mbResponsive($),window.maxFoundry.maxadmin.responsive.init(this)},maxAdmin.prototype.do_paging=function(t){var e=parseInt($(t.target).val());if(e<=parseInt($(t.target).attr("max"))){var a=$(t.target).data("url");window.location=a+"&paged="+e}},maxAdmin.prototype.toggleShortcode=function(){$(".shortcode-expand").hasClass("closed")?($(" .mb-message.shortcode .expanded").css("display","inline-block"),$(".shortcode-expand span").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"),$(".shortcode-expand").removeClass("closed").addClass("open")):($(" .mb-message.shortcode .expanded").css("display","none"),$(".shortcode-expand span").addClass("dashicons-arrow-down").removeClass("dashicons-arrow-up"),$(".shortcode-expand").addClass("closed").removeClass("open"))},maxAdmin.prototype.toggleManual=function(t){t.preventDefault();var e=$(t.target),a=e.data("target"),o=$('.manual-entry[data-manual="'+a+'"]');if(o.is(":visible"))return o.hide(),!0;var n=$('[data-options="'+a+'"]').position(),i=n.top+e.height();o.css("top",i),o.css("right",15),o.css("left","auto"),o.show()},maxAdmin.prototype.initConditionials=function(){var t=this;$("[data-show]").each(function(){var e=$(this).data("show"),a=e.target,o=e.values;$(document).on("change",'[name="'+a+'"]',{child:this,values:o},$.proxy(t.updateConditional,t)),$('[name="'+a+'"]').trigger("change")})},maxAdmin.prototype.updateConditional=function(t){var e=t.data,a=e.values,o=e.child,n=$(t.currentTarget),i=$(n).val();if("checkbox"===n.attr("type")){var r=$(n).prop("checked");i="checked"==a&&r?"checked":"unchecked"!=a||r?0:"unchecked"}a.indexOf(i)>=0?($(o).fadeIn("fast"),$(o).find("input, select").trigger("change")):($(o).fadeOut("fast"),$(o).find("input, select").trigger("change"))},maxAdmin.prototype.saveIndicator=function(t){this.form_updated=t?!0:!1},maxAdmin.prototype.formAjaxSave=function(t){t.preventDefault();var e=mb_ajax.ajaxurl,a=$(t.target),o=a.serialize();$.ajax({type:"POST",url:e,data:o}).done($.proxy(this.saveDone,this))},maxAdmin.prototype.saveDone=function(t){$("[data-form]").prop("disabled",!1);var e=$.parseJSON(t),a=e.result,o=e.title,n=e.data.id;if("undefined"!=typeof e.data.new_nonce){{e.data.new_nonce}$('input[name="nonce"]').val(e.data.new_nonce)}if(a){$('input[name="collection_id"]').val(n);var i=window.location.href;-1===i.indexOf("collection_id")&&window.history.replaceState({},"",i+"&collection_id="+n),$(document).trigger("mbFormSaved");var r=$('input[name="sorted"]').val();$('input[name="previous_selection"]').val(r),e.data.reload&&document.location.reload(!0)}a||($modal=window.maxFoundry.maxmodal,$modal.newModal("collection_error"),$modal.setTitle(o),$modal.setContent(e.body),$modal.setControls('<button class="modal_close button-primary">'+e.close_text+"</button>"),$modal.show())}});
|
maxbuttons.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MaxButtons
|
4 |
Plugin URI: http://maxbuttons.com
|
5 |
Description: The best WordPress button generator. This is the free version; the Pro version <a href="http://maxbuttons.com/?ref=mbfree">can be found here</a>.
|
6 |
-
Version: 6.
|
7 |
Author: Max Foundry
|
8 |
Author URI: http://maxfoundry.com
|
9 |
Text Domain: maxbuttons
|
@@ -45,8 +45,8 @@ if (function_exists("MB"))
|
|
45 |
|
46 |
|
47 |
define("MAXBUTTONS_ROOT_FILE", __FILE__);
|
48 |
-
define('MAXBUTTONS_VERSION_NUM', '6.
|
49 |
-
define('MAXBUTTONS_RELEASE',"
|
50 |
|
51 |
// In case of development, copy this to wp-config.php
|
52 |
// define("MAXBUTTONS_DEBUG", true);
|
3 |
Plugin Name: MaxButtons
|
4 |
Plugin URI: http://maxbuttons.com
|
5 |
Description: The best WordPress button generator. This is the free version; the Pro version <a href="http://maxbuttons.com/?ref=mbfree">can be found here</a>.
|
6 |
+
Version: 6.12
|
7 |
Author: Max Foundry
|
8 |
Author URI: http://maxfoundry.com
|
9 |
Text Domain: maxbuttons
|
45 |
|
46 |
|
47 |
define("MAXBUTTONS_ROOT_FILE", __FILE__);
|
48 |
+
define('MAXBUTTONS_VERSION_NUM', '6.12');
|
49 |
+
define('MAXBUTTONS_RELEASE',"30 Dec 2016");
|
50 |
|
51 |
// In case of development, copy this to wp-config.php
|
52 |
// define("MAXBUTTONS_DEBUG", true);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: maxfoundry, basszje, arcware, johnbhartley
|
|
3 |
Tags: wordpress button plugin, best wordpress button plugin, wordpress button, wordpress buttons, wordpress buttons plugin, social share, wp button creator, button generator, css3 button plugin, css3 button generator, css wordpress button, css3 wordpress button, create button icon, button shortcode, social icon, button, buttons, sharing, sharing buttons, widget, sidebar, Visual Composer, siteorigin, Contact Form 7, Beaver Builder, Easy Digital Download, contact form, page builder, wordpress button generator, css3 button plugin, css3 button generator, css wordpress button, css3 wordpress button, simple social buttons, wp button plugin, button generator, create button icon, font awesome, fontawesome, responsive, responsive buttons, google, google event tracking, google analytics, facebook, facebook icon, facebook like, floating social media, icon, icons,like, linkedin, linkedin icon, social media, css button generator, social icons, social media icons, social media plugin, social profiles, tweet, twitter, tweet button, gradient
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.7
|
6 |
-
Stable tag: 6.
|
7 |
|
8 |
WordPress button plugin so powerful and easy to use anyone can create beautiful buttons and social share icons.
|
9 |
|
@@ -228,6 +228,14 @@ This depends on the slider plugin you are using. Most of the well-known ones are
|
|
228 |
|
229 |
== Changelog ==
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
= 6.11.1 =
|
232 |
|
233 |
* Removed holiday sale
|
3 |
Tags: wordpress button plugin, best wordpress button plugin, wordpress button, wordpress buttons, wordpress buttons plugin, social share, wp button creator, button generator, css3 button plugin, css3 button generator, css wordpress button, css3 wordpress button, create button icon, button shortcode, social icon, button, buttons, sharing, sharing buttons, widget, sidebar, Visual Composer, siteorigin, Contact Form 7, Beaver Builder, Easy Digital Download, contact form, page builder, wordpress button generator, css3 button plugin, css3 button generator, css wordpress button, css3 wordpress button, simple social buttons, wp button plugin, button generator, create button icon, font awesome, fontawesome, responsive, responsive buttons, google, google event tracking, google analytics, facebook, facebook icon, facebook like, floating social media, icon, icons,like, linkedin, linkedin icon, social media, css button generator, social icons, social media icons, social media plugin, social profiles, tweet, twitter, tweet button, gradient
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.7
|
6 |
+
Stable tag: 6.12
|
7 |
|
8 |
WordPress button plugin so powerful and easy to use anyone can create beautiful buttons and social share icons.
|
9 |
|
228 |
|
229 |
== Changelog ==
|
230 |
|
231 |
+
= 6.12 =
|
232 |
+
|
233 |
+
* Updated Copy / Trash / Delete interfaces
|
234 |
+
* Fixed issue with refresh page warning when removing buttons
|
235 |
+
* Fixed Social Share Facebook count
|
236 |
+
* Fixed lower save button not working in social share
|
237 |
+
* Fixed layout issue in Social Share
|
238 |
+
|
239 |
= 6.11.1 =
|
240 |
|
241 |
* Removed holiday sale
|