WordPress Button Plugin MaxButtons - Version 6.19

Version Description

  • Fixed minor security issue regarding cross-site scripting (JVN#70411623). Thanks to JPCert for responsible disclosure.
  • Fixed fatal error in settings function 'reset cache'
Download this release

Release Info

Developer basszje
Plugin Icon 128x128 WordPress Button Plugin MaxButtons
Version 6.19
Comparing to
See all releases

Code changes from version 6.18 to 6.19

blocks/icon.php CHANGED
@@ -170,4 +170,3 @@ class iconBlock extends maxBlock
170
 
171
  } // class
172
 
173
- ?>
170
 
171
  } // class
172
 
 
classes/max-utils.php CHANGED
@@ -9,14 +9,40 @@ class maxUtils
9
  protected static $time_operations = array();
10
  protected static $timer = 0;
11
 
12
- static function translit($string)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  {
14
  require_once(MB()->get_plugin_path() . "assets/libraries/url_slug.php");
15
  $string = mb_url_slug($string, array("transliterate" => true));
16
  return $string;
17
  }
18
 
19
- static function selectify($name, $array, $selected, $target = '', $class = '')
20
  {
21
  // optional target for js updating
22
  if ($target != '' )
9
  protected static $time_operations = array();
10
  protected static $timer = 0;
11
 
12
+ // central ajax action handler
13
+ public static function ajax_action()
14
+ {
15
+ $status = 'error';
16
+ $message = __( sprintf("No Handler found for action %s", $action), 'maxbuttons');
17
+
18
+ $plugin_action = isset($_POST['plugin_action']) ? sanitize_text_field($_POST['plugin_action']) : '';
19
+ $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : false;
20
+
21
+ if (! wp_verify_nonce($nonce, 'maxajax') )
22
+ {
23
+ $message = __('Nonce not verified', 'maxbuttons');
24
+ }
25
+ else
26
+ {
27
+ var_dump($plugin_action);
28
+ do_action('maxbuttons/ajax/' . $plugin_action, $_POST);
29
+ }
30
+
31
+ echo json_encode( array( 'status' => $status,
32
+ 'message' => $message,
33
+ )
34
+ );
35
+ wp_die();
36
+ }
37
+
38
+ public static function translit($string)
39
  {
40
  require_once(MB()->get_plugin_path() . "assets/libraries/url_slug.php");
41
  $string = mb_url_slug($string, array("transliterate" => true));
42
  return $string;
43
  }
44
 
45
+ public static function selectify($name, $array, $selected, $target = '', $class = '')
46
  {
47
  // optional target for js updating
48
  if ($target != '' )
classes/maxbuttons-class.php CHANGED
@@ -76,6 +76,8 @@ class maxButtonsPlugin
76
  add_action("wp_ajax_collection-edit", array("maxCollections", "ajax_save"));
77
  add_action('wp_ajax_mbpro_collection_block', array("maxCollections", "ajax_action")); // all block level ajax stuff - for logged in users - backend
78
  add_action('wp_ajax_mb_button_action', array('maxButtons', "ajax_action"));
 
 
79
  }
80
  // FRONT AJAX
81
  add_action('wp_ajax_mbpro_collection_block_front', array("maxCollections", "ajax_action_front")); // front end for all users
@@ -357,6 +359,16 @@ class maxButtonsPlugin
357
  wp_enqueue_script('maxbuttons-tabs', $js_url . 'maxtabs.js', array('jquery'),$version, true);
358
  wp_enqueue_script('maxbuttons-responsive', $js_url . 'responsive.js', array('maxbutton-admin'), $version, true );
359
 
 
 
 
 
 
 
 
 
 
 
360
  wp_register_script('maxcollections', $js_url . 'maxcollections.js',
361
  array('jquery', 'maxbutton-admin', 'jquery-ui-sortable'),$version, true );
362
 
76
  add_action("wp_ajax_collection-edit", array("maxCollections", "ajax_save"));
77
  add_action('wp_ajax_mbpro_collection_block', array("maxCollections", "ajax_action")); // all block level ajax stuff - for logged in users - backend
78
  add_action('wp_ajax_mb_button_action', array('maxButtons', "ajax_action"));
79
+
80
+ add_action('wp_ajax_maxajax', array('maxUtils', 'ajax_action'));
81
  }
82
  // FRONT AJAX
83
  add_action('wp_ajax_mbpro_collection_block_front', array("maxCollections", "ajax_action_front")); // front end for all users
359
  wp_enqueue_script('maxbuttons-tabs', $js_url . 'maxtabs.js', array('jquery'),$version, true);
360
  wp_enqueue_script('maxbuttons-responsive', $js_url . 'responsive.js', array('maxbutton-admin'), $version, true );
361
 
362
+ wp_register_script('maxbuttons-ajax', $js_url . 'maxajax.js', array('maxbutton-admin'), $version, true);
363
+ wp_localize_script('maxbuttons-ajax', 'maxajax',
364
+ array(
365
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
366
+ 'ajax_action' => 'maxajax',
367
+ 'nonce' => wp_create_nonce('maxajax'),
368
+ ));
369
+
370
+ wp_enqueue_script('maxbuttons-ajax');
371
+
372
  wp_register_script('maxcollections', $js_url . 'maxcollections.js',
373
  array('jquery', 'maxbutton-admin', 'jquery-ui-sortable'),$version, true );
374
 
includes/admin_header.php CHANGED
@@ -2,8 +2,8 @@
2
  defined('ABSPATH') or die('No direct access permitted');
3
 
4
 
5
- $mainclass = isset($_REQUEST["page"]) ? $_REQUEST["page"] : '';
6
- $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : $action;
7
  if ($action !== '')
8
  $mainclass .= '-' . $action;
9
  ?>
2
  defined('ABSPATH') or die('No direct access permitted');
3
 
4
 
5
+ $mainclass = isset($_REQUEST["page"]) ? sanitize_text_field($_REQUEST["page"]) : '';
6
+ $action = isset($_REQUEST["action"]) ? sanitize_text_field($_REQUEST["action"]) : $action;
7
  if ($action !== '')
8
  $mainclass .= '-' . $action;
9
  ?>
includes/maxbuttons-controller.php CHANGED
@@ -2,15 +2,13 @@
2
  defined('ABSPATH') or die('No direct access permitted');
3
 
4
  if (isset($_GET['action']) && $_GET['action'] != '') {
5
- switch ($_GET['action']) {
 
 
 
6
  case 'button':
7
  case 'edit':
8
- if (isset($_GET["popup"]) && $_GET["popup"] == true) // bugs with save function to name something
9
- include_once 'button_editor_popup.php';
10
- else
11
  include_once 'maxbuttons-button.php';
12
- break;
13
-
14
  default:
15
  include_once 'maxbuttons-list.php';
16
  break;
2
  defined('ABSPATH') or die('No direct access permitted');
3
 
4
  if (isset($_GET['action']) && $_GET['action'] != '') {
5
+ // extra safety.
6
+ $action = sanitize_text_field($_GET['action']);
7
+
8
+ switch ($action) {
9
  case 'button':
10
  case 'edit':
 
 
 
11
  include_once 'maxbuttons-button.php';
 
 
12
  default:
13
  include_once 'maxbuttons-list.php';
14
  break;
includes/maxbuttons-settings.php CHANGED
@@ -23,7 +23,7 @@ if(isset($_POST['alter_charset'])) {
23
 
24
  if (isset($_POST["reset_cache"]))
25
  {
26
- $button = new maxButton();
27
  $button->reset_cache();
28
 
29
  }
23
 
24
  if (isset($_POST["reset_cache"]))
25
  {
26
+ $button = new \maxButton();
27
  $button->reset_cache();
28
 
29
  }
js/maxajax.js ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /** New AJAX Call methods
3
+ /* Get the standard AJAX vars for this plugin */
4
+
5
+ var maxAjax = function(jquery) {
6
+ $ = jquery;
7
+
8
+ }
9
+
10
+ maxAjax.prototype.init = function()
11
+ {
12
+
13
+ // default actions that trigger ajax action.
14
+ $(document).on('click', '.mb-ajax-form .mb-ajax-submit', $.proxy(this.ajaxForm, this ));
15
+ $(document).on('click', '.mb-ajax-action', $.proxy(this.ajaxCall, this ));
16
+ $(document).on('change', '.mb-ajax-action-change', $.proxy(this.ajaxCall, this));
17
+ $(document).trigger('maxajax_init'); // for hanging in other actions.
18
+ }
19
+
20
+ maxAjax.prototype.ajaxInit = function()
21
+ {
22
+ data = {
23
+ action: maxajax.ajax_action,
24
+ nonce: maxajax.nonce,
25
+ }
26
+
27
+ return data;
28
+ }
29
+
30
+ maxAjax.prototype.ajaxForm = function (e)
31
+ {
32
+ var target = $(e.target);
33
+ var form = $(target).parents('form');
34
+ var action = $(target).data('action');
35
+
36
+ var data = this.ajaxInit();
37
+ data['form'] = form.serialize();
38
+ data['plugin_action'] = action;
39
+ // data['action'] = 'mb_button_action';
40
+
41
+ this.showSpinner(target);
42
+
43
+ this.ajaxPost(data);
44
+
45
+
46
+ }
47
+
48
+ /* Ajax call functionality */
49
+ maxAjax.prototype.ajaxCall = function (e)
50
+ {
51
+
52
+ e.preventDefault();
53
+ var target = e.target;
54
+
55
+ var param = false;
56
+ var plugin_action = $(target).data('action');
57
+ var check_param = $(target).data('param');
58
+ var param_input = $(target).data('param-input');
59
+
60
+ if (typeof check_param !== 'undefined')
61
+ param = check_param;
62
+ if (typeof param_input !== 'undefined')
63
+ param = $(param_input).val();
64
+
65
+ data = this.ajaxInit();
66
+
67
+ data['plugin_action'] = plugin_action;
68
+ data['param'] = param;
69
+ data['post'] = $('form').serialize(); // send it all
70
+
71
+ this.showSpinner(target);
72
+
73
+ this.ajaxPost(data);
74
+ }
75
+
76
+ maxAjax.prototype.showSpinner = function(target)
77
+ {
78
+ var spinner = '<div class="ajax-load-spinner"></div>';
79
+ $('.ajax-load-spinner').remove();
80
+ $(target).after(spinner);
81
+ //return spinner;
82
+ }
83
+
84
+ maxAjax.prototype.ajaxPost = function(data, successHandler, errorHandler)
85
+ {
86
+
87
+ if (typeof successHandler == 'undefined')
88
+ {
89
+ var action = data['plugin_action'];
90
+
91
+ var successHandler = this.defaultSuccessHandler;
92
+
93
+ }
94
+
95
+ if (typeof errorHandler == 'undefined')
96
+ {
97
+ var errorHandler = this.defaultErrorHandler;
98
+ }
99
+
100
+
101
+ $.ajax({
102
+ type: "POST",
103
+ url: maxajax.ajax_url,
104
+ data: data,
105
+ success: successHandler,
106
+ error: errorHandler,
107
+ });
108
+ }
109
+
110
+ maxAjax.prototype.defaultSuccessHandler = function (result, status, object)
111
+ {
112
+ /// console.log(one);
113
+ // console.log(two);
114
+ // console.log(three);
115
+ console.log(result);
116
+ //$(data['spinner']).remove();
117
+ // $(document).trigger('maxajax_success',[ action, data ]);
118
+ // $(document).trigger('maxajax_success_' + action, data);
119
+ }
120
+
121
+ maxAjax.prototype.defaultErrorHandler = function(jq,status,error)
122
+ {
123
+ $(document).trigger('maxajax_error_' + action, jq, status, error);
124
+ console.log(jq);
125
+ console.log(status);
126
+ console.log(error);
127
+ }
128
+
129
+
130
+ jQuery(document).ready(function($) {
131
+
132
+ if (typeof window.maxFoundry === 'undefined')
133
+ window.maxFoundry = {} ;
134
+
135
+ window.maxFoundry.maxAjax = new maxAjax($);
136
+
137
+ window.maxFoundry.maxAjax.init();
138
+
139
+ }); /* END OF JQUERY */
140
+
js/maxbuttons-admin.js CHANGED
@@ -755,92 +755,6 @@ maxAdmin.prototype.saveDone = function (res)
755
  }
756
  }
757
 
758
- /** New AJAX Call methods
759
- /* Get the standard AJAX vars for this plugin */
760
- maxAdmin.prototype.ajaxInit = function()
761
- {
762
- data = {
763
- action: mb_ajax.ajax_action,
764
- nonce: mb_ajax.nonce,
765
- }
766
-
767
- return data;
768
- }
769
-
770
- /* Ajax call functionality for modules etc. */
771
- maxAdmin.prototype.ajaxCall = function (e)
772
- {
773
-
774
- e.preventDefault();
775
- var target = e.target;
776
-
777
- var param = false;
778
- var plugin_action = $(target).data('action');
779
- var check_param = $(target).data('param');
780
- var param_input = $(target).data('param-input');
781
-
782
- if (typeof check_param !== 'undefined')
783
- param = check_param;
784
- if (typeof param_input !== 'undefined')
785
- param = $(param_input).val();
786
-
787
- data = this.ajaxInit();
788
-
789
- data['plugin_action'] = plugin_action;
790
- data['param'] = param;
791
- data['post'] = $('form').serialize(); // send it all
792
-
793
- this.showSpinner(target);
794
-
795
- this.ajaxPost(data);
796
- }
797
-
798
- maxAdmin.prototype.showSpinner = function(target)
799
- {
800
- var spinner = '<div class="ajax-load-spinner"></div>';
801
- $('.ajax-load-spinner').remove();
802
- $(target).after(spinner);
803
- //return spinner;
804
- }
805
-
806
- maxAdmin.prototype.ajaxPost = function(data, successHandler, errorHandler)
807
- {
808
-
809
- if (typeof successHandler == 'undefined')
810
- {
811
-
812
- var action = data['plugin_action'];
813
-
814
- var successHandler = function(data)
815
- {
816
-
817
- //$(data['spinner']).remove();
818
- $(document).trigger('mb_ajax_success',[ action, data ]);
819
- $(document).trigger('mb_ajax_success_' + action, data);
820
- };
821
- }
822
-
823
- if (typeof errorHandler == 'undefined')
824
- {
825
- var errorHandler = function (jq,status,error)
826
- {
827
- $(document).trigger('mb_ajax_error_' + action, jq, status, error);
828
- console.log(jq);
829
- console.log(status);
830
- console.log(error);
831
- };
832
- }
833
-
834
-
835
- $.ajax({
836
- type: "POST",
837
- url: mb_ajax.ajaxurl,
838
- data: data,
839
- success: successHandler,
840
- error: errorHandler,
841
- });
842
- }
843
-
844
 
845
  }); /* END OF JQUERY */
846
 
755
  }
756
  }
757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
 
759
  }); /* END OF JQUERY */
760
 
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("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)),$(document).on("keyup","input",function(t){return t.keyCode&&13==t.keyCode?($(":input")[$(":input").index(document.activeElement)+1].focus(),!1):void 0}),$(".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())}});
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"}),$("#maxbuttons .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)),$(document).on("keyup","input",function(t){return t.keyCode&&13==t.keyCode?($(":input")[$(":input").index(document.activeElement)+1].focus(),!1):void 0}),$(".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.18
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: maxbuttons
@@ -13,8 +13,8 @@ Copyright 2017 Max Foundry, LLC (http://maxfoundry.com)
13
  */
14
 
15
  define("MAXBUTTONS_ROOT_FILE", __FILE__);
16
- define('MAXBUTTONS_VERSION_NUM', '6.18');
17
- define('MAXBUTTONS_RELEASE',"10 Apr 2017");
18
 
19
 
20
  if (! function_exists('maxbuttons_php52_nono'))
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.19
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: maxbuttons
13
  */
14
 
15
  define("MAXBUTTONS_ROOT_FILE", __FILE__);
16
+ define('MAXBUTTONS_VERSION_NUM', '6.19');
17
+ define('MAXBUTTONS_RELEASE',"27 Apr 2017");
18
 
19
 
20
  if (! function_exists('maxbuttons_php52_nono'))
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: maxfoundry, basszje, arcware, johnbhartley
3
  Tags: wordpress buttons, wordpress buttons plugin, social icons, css3 button generator, responsive buttons, css wordpress button
4
  Requires at least: 4.0
5
- Tested up to: 4.7.3
6
- Stable tag: 6.18
7
 
8
  WordPress button plugin so powerful and easy to use anyone can create beautiful buttons and social share icons.
9
 
@@ -245,6 +245,11 @@ This depends on the slider plugin you are using. Most of the well-known ones are
245
 
246
  == Changelog ==
247
 
 
 
 
 
 
248
  = 6.18 =
249
 
250
  * Fixed bug where scrollbar didn't show in Add Button dialog
2
  Contributors: maxfoundry, basszje, arcware, johnbhartley
3
  Tags: wordpress buttons, wordpress buttons plugin, social icons, css3 button generator, responsive buttons, css wordpress button
4
  Requires at least: 4.0
5
+ Tested up to: 4.7.4
6
+ Stable tag: 6.19
7
 
8
  WordPress button plugin so powerful and easy to use anyone can create beautiful buttons and social share icons.
9
 
245
 
246
  == Changelog ==
247
 
248
+ = 6.19 =
249
+
250
+ * Fixed minor security issue regarding cross-site scripting (JVN#70411623). Thanks to JPCert for responsible disclosure.
251
+ * Fixed fatal error in settings function 'reset cache'
252
+
253
  = 6.18 =
254
 
255
  * Fixed bug where scrollbar didn't show in Add Button dialog