WordPress Button Plugin MaxButtons - Version 7.1.1

Version Description

  • Fixed issue when other sources call jQuery.noConfict()
Download this release

Release Info

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

Code changes from version 7.1 to 7.1.1

classes/admin-class.php CHANGED
@@ -360,7 +360,7 @@ class maxButtonsAdmin
360
  return false;
361
 
362
  $file = fopen( trailingslashit($dir) . "/maxbuttons.log", "a+");
363
- $now = new DateTime() ;
364
  $now_format = $now->format("d/M/Y H:i:s");
365
 
366
  $write_string = "[" . $now_format . "] $action - $message ( $caller )";
360
  return false;
361
 
362
  $file = fopen( trailingslashit($dir) . "/maxbuttons.log", "a+");
363
+ $now = new \DateTime();
364
  $now_format = $now->format("d/M/Y H:i:s");
365
 
366
  $write_string = "[" . $now_format . "] $action - $message ( $caller )";
classes/social-networks.php DELETED
@@ -1,371 +0,0 @@
1
- <?php
2
- namespace MaxButtons;
3
- defined('ABSPATH') or die('No direct access permitted');
4
-
5
- class maxSN
6
- {
7
- protected $network = "";
8
- protected $network_data = array();
9
- protected $network_name = '';
10
-
11
- public function __construct($network)
12
- {
13
- $this->network = $network;
14
- $this->setNetWork($network);
15
-
16
- }
17
-
18
- /* Set the network variables to be using for this inquery */
19
- public function setNetwork($network)
20
- {
21
-
22
- $networks = $this->getSupportedNetworks();
23
- $this->network_name = $networks[$network];
24
-
25
- $network_data = array(
26
- "share_url" => '', // url to send share to (incl. var)
27
- "count_api" => '', // request url
28
- "count_function" => "jsonRequest", // which function to run.
29
- "json_return_var" => '', // which var is the count number?
30
- "count_check_time" => 4 * HOUR_IN_SECONDS, // how much time before checking again - in seconds
31
- "popup" => true, // button opens share popup
32
- "popup_dimensions" => array(400,300), // width - height of popup
33
- );
34
-
35
- switch($network)
36
- {
37
- case "bloglovin":
38
- $network_data["popup"] = false;
39
-
40
- break;
41
- case "digg":
42
- $network_data["share_url"] = "http://digg.com/submit?url={url}&title={title}";
43
- $network_data["count_api"] = '';
44
- $network_data["popup_dimensions"] = array(600,400);
45
- break;
46
- case "email":
47
- $network_data["share_url"] = 'mailto:?subject={title}&body={url}';
48
- $network_data["count_api"] = '';
49
- $network_data["popup"] = false;
50
- break;
51
- case "facebook":
52
- $network_data["share_url"] = 'https://www.facebook.com/sharer.php?u={url}';
53
- $network_data["count_api"] = "https://graph.facebook.com/{url}";
54
- $network_data["json_return_var"] = "share|share_count";
55
- break;
56
- case "google-plus":
57
- $network_data["share_url"] = 'https://plus.google.com/share?url={url}';
58
- $network_data["count_api"] = "{url}";
59
- $network_data["popup_dimensions"] = array(600,600);
60
- $network_data["count_function"] = "googlePlus";
61
-
62
- break;
63
- case "linkedin":
64
- $network_data["share_url"] = "https://www.linkedin.com/shareArticle?mini=true&url={url}";
65
- $network_data["count_api"] = "https://www.linkedin.com/countserv/count/share?url={url}&format=json";
66
- $network_data["json_return_var"] = "count";
67
- $network_data["popup_dimensions"] = array(700,500);
68
- break;
69
- case "pinterest":
70
- $network_data["share_url"] = "https://www.pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video=false&description={title}";
71
- $network_data["count_api"] = "https://api.pinterest.com/v1/urls/count.json?url={url}";
72
- $network_data["json_return_var"] = "count";
73
- $network_data["count_function"] = "pinterestCount";
74
- $network_data["popup_dimensions"] = array(750, 500);
75
- break;
76
- case "print":
77
- $network_data["share_url"] = 'javascript:window.print()';
78
- $network_data["count_api"] = '';
79
- $network_data["popup"] = false;
80
- break;
81
- case "stumbleupon":
82
- $network_data["share_url"] = "https://www.stumbleupon.com/submit?url={url}&title={title}";
83
- $network_data["count_api"] = "https://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}";
84
- $network_data["json_return_var"] = "result|views";
85
-
86
- break;
87
- case "reddit":
88
- $network_data["share_url"] = "https://reddit.com/submit?url={url}&title={title}";
89
- $network_data["count_api"] = "https://buttons.reddit.com/button_info.json?url={url}";
90
- $network_data["json_return_var"] = "data|children|0|data|score";
91
- $network_data["popup_dimensions"] = array(800, 500);
92
-
93
- break;
94
- case "twitter":
95
- $network_data["share_url"] = 'https://twitter.com/intent/tweet?url={url}';
96
- $network_data["count_api"] = "";
97
- $network_data["json_return_var"] = "";
98
- $network_data["popup_dimensions"] = array(550, 420);
99
- break;
100
- case "twitter-follow":
101
- $network_data["share_url"] = 'https://twitter.com/{user}';
102
- $network_data['count_api'] = '';
103
- $network_data['json_return_var'] = 'count';
104
-
105
-
106
- break;
107
- case "vkontakte":
108
- $network_data["share_url"] = "https://vkontakte.ru/share.php?url={url}";
109
- $network_data["count_api"] = "https://vk.com/share.php?act=count&url={url}";
110
- $network_data["count_function"] = "vKontakteCount";
111
- break;
112
- case "whatsapp":
113
- $network_data["share_url"] = "whatsapp://send?text={url} {title}";
114
- $network_data["count_api"] = '';
115
- break;
116
- default:
117
- $network_data['popup'] = false; // no network no popup.
118
- break;
119
-
120
- }
121
-
122
- $network_data = apply_filters("mb-collection-network-data", $network_data);
123
- $network_data = apply_filters("mb-collection-network-data-" . $network, $network_data);
124
-
125
- $this->network_data = $network_data;
126
- }
127
-
128
- public function getNetworkName()
129
- {
130
- return $this->network_name;
131
-
132
- }
133
-
134
- // the url to send shares to, by network.
135
- public function getShareURL()
136
- {
137
- return $this->network_data["share_url"];
138
- }
139
-
140
- public function checkPopup()
141
- {
142
- if (isset($this->network_data["popup"]) && $this->network_data["popup"] )
143
- return true;
144
- else
145
- return false;
146
- }
147
-
148
- public function getPopupDimensions()
149
- {
150
- if (isset($this->network_data["popup_dimensions"]))
151
- return $this->network_data["popup_dimensions"];
152
- else
153
- return array();
154
- }
155
-
156
- public function getShareCount($args = array())
157
- {
158
- if ( $this->network_data["count_api"] == '')
159
- return 0; // no api - count always zero.
160
-
161
- $defaults = array("url" => "",
162
- "preview" => false,
163
- "force_share_update" => false,
164
- );
165
-
166
- $args = wp_parse_args($args,$defaults);
167
-
168
- $share_url = esc_url($args["url"]);
169
-
170
- $network = $this->network;
171
- //$count = get_transient('mb-col-' . $network . '-' . $share_url . '-shares');
172
- $count = maxUtils::get_transient('mbcol-shares-' . $network . '-' . $share_url);
173
-
174
- if ($args["force_share_update"])
175
- $count = -1; // force an update
176
-
177
- if ( ($count === false || $count == -1) && ! $args["preview"])
178
- { // request from external - this is done via ajax on runtime.
179
- return false;
180
- }
181
-
182
- return $count;
183
-
184
- }
185
-
186
- public function getRemoteShareCount($share_url)
187
- {
188
- $count_api = $this->network_data["count_api"];
189
- if ($count_api == '') return false; // no api
190
-
191
- $network = $this->network;
192
- $timeout = 60; // prevent the same requests from running multiple times ( i.e. one page, many collections on same url ) .
193
- $locked = maxUtils::get_transient('mbcol-shares-' . $network . '-' . $share_url. '-lock');
194
-
195
- if ($locked == true)
196
- return 'locked'; // try again on next refresh.
197
-
198
- //lock out next request while this one is still running.
199
- maxUtils::set_transient('mbcol-shares-' . $network . '-' . $share_url . '-lock', true, $timeout );
200
-
201
- $count_api = str_replace("{url}", $share_url, $count_api);
202
-
203
- $func = $this->network_data["count_function"];
204
- $count = $this->$func($count_api);
205
- if (defined('MAXBUTTONS_DEBUG') && MAXBUTTONS_DEBUG)
206
- {
207
- $admin = MB()->getClass("admin");
208
-
209
- $admin->log("Get Remote Share", "Call: $count_api - Network : " . $this->network . " - Count: $count \n ");
210
- }
211
-
212
- if ($count !== false)
213
- {
214
- $network = $this->network;
215
- $check_time = $this->network_data["count_check_time"];
216
-
217
- // set count
218
- maxUtils::set_transient('mbcol-shares-' . $network . '-' . $share_url, $count, $check_time );
219
-
220
- }
221
-
222
- // remove lock
223
- maxUtils::delete_transient('mbcol-shares-' . $network . '-' . $share_url . '-lock');
224
-
225
- return $count;
226
- }
227
-
228
- protected function jsonRequest($url)
229
- {
230
-
231
- $response = wp_remote_get($url);
232
- $result_path = $this->network_data["json_return_var"];
233
- $result_array = explode("|",$result_path);
234
- if (count($result_array) == 0)
235
- $result_array = array($result_path);
236
-
237
-
238
- if (is_wp_error($response) || $response['response']['code'] != 200) {
239
- return false;
240
- }
241
- else {
242
- $result = wp_remote_retrieve_body($response);
243
- }
244
- $result = json_decode($result, true);
245
-
246
- foreach($result_array as $result_val)
247
- {
248
- if (isset($result[$result_val]))
249
- $result = $result[$result_val];
250
-
251
- }
252
- if (is_int($result))
253
- return $result;
254
-
255
- return 0; // some networks don't return the json return var. Only return false on network errors
256
-
257
- }
258
-
259
- protected function googlePlus($url)
260
- {
261
- $args = array(
262
- 'method' => 'POST',
263
- 'headers' => array(
264
- // setup content type to JSON
265
- 'Content-Type' => 'application/json',
266
- ),
267
- // setup POST options to Google API
268
- 'body' => json_encode(array(
269
- 'method' => 'pos.plusones.get',
270
- 'id' => 'p',
271
- 'method' => 'pos.plusones.get',
272
- 'jsonrpc' => '2.0',
273
- 'key' => 'p',
274
- 'apiVersion' => 'v1',
275
- 'params' => array(
276
- 'nolog' => true,
277
- 'id' => $url,
278
- 'source' => 'widget',
279
- 'userId' => '@viewer',
280
- 'groupId' => '@self',
281
- ),
282
- )),
283
-
284
- 'sslverify' => false,
285
- );
286
- $response = wp_remote_post('https://clients6.google.com/rpc', $args);
287
-
288
-
289
- if (is_wp_error($response) || $response['response']['code'] != 200) {
290
- return false;
291
- }
292
- else {
293
- $result = wp_remote_retrieve_body($response);
294
- }
295
-
296
- $result = json_decode($result, true);
297
- $count = 0;
298
- if (isset($result['result']['metadata']['globalCounts']['count']))
299
- { $count = intval($result['result']['metadata']['globalCounts']['count']);
300
- return $count;
301
- }
302
-
303
- return 0;
304
-
305
- }
306
-
307
- protected function vKontakteCount($url)
308
- {
309
- $response = wp_remote_get($url);
310
-
311
- if (is_wp_error($response) || $response['response']['code'] != 200) {
312
- return false;
313
- }
314
- else {
315
- $result = wp_remote_retrieve_body($response);
316
- }
317
-
318
- preg_match('/(\d+),\s+(\d+)/i', $result, $matches);
319
- if (isset($matches[2])) // 0 is both patterns, one is first number (not used?).
320
- { $count = $matches[2];
321
- return $count;
322
- }
323
- return 0;
324
- }
325
-
326
- protected function pinterestCount($url)
327
- {
328
- $response = wp_remote_get($url);
329
-
330
- if (is_wp_error($response) || $response['response']['code'] != 200) {
331
- return false;
332
- }
333
- else {
334
- $result = wp_remote_retrieve_body($response);
335
- }
336
-
337
- // remove the callback wrapper.
338
- $result = str_replace("receiveCount(","",$result);
339
- $result = substr($result,0,(strlen($result) -1) ); // remove last char.
340
- $json = json_decode($result, true);
341
-
342
- if (isset($json["count"]))
343
- return $json["count"];
344
-
345
- return 0;
346
- }
347
-
348
- public static function getSupportedNetworks()
349
- {
350
- // alphabetic
351
- $supported_networks = array(
352
- "none" => __("Select a network","maxbuttons"),
353
- "bloglovin" => __("Bloglovin","maxbuttons"),
354
- "digg" => __("Digg","maxbuttons"),
355
- "email" => __("Email","maxbuttons"),
356
- "facebook" => __("Facebook","maxbuttons"),
357
- "google-plus" => __("Google +","maxbuttons"),
358
- "linkedin" => __("LinkedIn","maxbuttons"),
359
- "pinterest" => __("Pinterest","maxbuttons"),
360
- "print" => __("Print this page","maxbuttons"),
361
- "reddit" => __("Reddit", "maxbuttons"),
362
- "stumbleupon" => __("StumbleUpon","maxbuttons"),
363
- "twitter" => __("Twitter","maxbuttons"),
364
- "vkontakte" => __("Vkontakte","maxbuttons"),
365
- "whatsapp" => __("Whatsapp", "maxbuttons"),
366
- );
367
- $supported_networks = apply_filters("mb-collection-supported-networks", $supported_networks);
368
- return $supported_networks;
369
- }
370
-
371
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/init.js CHANGED
@@ -1,9 +1,12 @@
1
  var $ = jQuery;
2
 
3
- jQuery(document).ready(function($) {
 
 
4
 
5
  function runMaxInit()
6
  {
 
7
  if (typeof window.maxFoundry === 'undefined')
8
  window.maxFoundry = {};
9
 
@@ -16,7 +19,7 @@ jQuery(document).ready(function($) {
16
  window.maxFoundry.maxAjax = new maxAjax();
17
  window.maxFoundry.maxAjax.init();
18
 
19
- window.maxFoundry.maxTabs = new maxTabs();
20
  window.maxFoundry.maxTabs.init();
21
 
22
  //window.maxFoundry.maxcollection = new maxCollection();
1
  var $ = jQuery;
2
 
3
+ jQuery(document).ready(function(jq) {
4
+
5
+ $ = jq; // to counter noConflict bandits
6
 
7
  function runMaxInit()
8
  {
9
+
10
  if (typeof window.maxFoundry === 'undefined')
11
  window.maxFoundry = {};
12
 
19
  window.maxFoundry.maxAjax = new maxAjax();
20
  window.maxFoundry.maxAjax.init();
21
 
22
+ window.maxFoundry.maxTabs = new maxTabs();
23
  window.maxFoundry.maxTabs.init();
24
 
25
  //window.maxFoundry.maxcollection = new maxCollection();
js/maxajax.js CHANGED
@@ -41,8 +41,6 @@ maxAjax.prototype.ajaxForm = function (e)
41
  e.preventDefault();
42
 
43
  var target = $(e.target);
44
-
45
-
46
  var form = $(target).parents('form');
47
  var action = $(target).data('action');
48
 
41
  e.preventDefault();
42
 
43
  var target = $(e.target);
 
 
44
  var form = $(target).parents('form');
45
  var action = $(target).data('action');
46
 
js/maxbuttons-admin.js CHANGED
@@ -1,3 +1,5 @@
 
 
1
  function maxAdmin()
2
  {
3
 
@@ -649,6 +651,7 @@ maxAdmin.prototype.initConditionials = function ()
649
  var target = condition.target;
650
  var values = condition.values;
651
 
 
652
  $('[name="' + target + '"]').on('change', {target: target, child: this, values: values}, $.proxy(mAP.updateHasConditional, mAP) );
653
 
654
  var targetdecl = '[name="' + target + '"]';
1
+ var $ = jQuery;
2
+
3
  function maxAdmin()
4
  {
5
 
651
  var target = condition.target;
652
  var values = condition.values;
653
 
654
+
655
  $('[name="' + target + '"]').on('change', {target: target, child: this, values: values}, $.proxy(mAP.updateHasConditional, mAP) );
656
 
657
  var targetdecl = '[name="' + target + '"]';
js/min/maxajax.js CHANGED
@@ -41,8 +41,6 @@ maxAjax.prototype.ajaxForm = function (e)
41
  e.preventDefault();
42
 
43
  var target = $(e.target);
44
-
45
-
46
  var form = $(target).parents('form');
47
  var action = $(target).data('action');
48
 
41
  e.preventDefault();
42
 
43
  var target = $(e.target);
 
 
44
  var form = $(target).parents('form');
45
  var action = $(target).data('action');
46
 
js/review-notice.js CHANGED
@@ -40,5 +40,4 @@ function mb_review_done()
40
 
41
  }
42
 
43
-
44
  }); /* END OF JQUERY */
40
 
41
  }
42
 
 
43
  }); /* END OF JQUERY */
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: 7.1
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: maxbuttons
@@ -16,9 +16,9 @@ namespace MaxButtons;
16
  if (! defined('MAXBUTTONS_ROOT_FILE'))
17
  define("MAXBUTTONS_ROOT_FILE", __FILE__);
18
  if (! defined('MAXBUTTONS_VERSION_NUM'))
19
- define('MAXBUTTONS_VERSION_NUM', '7.1');
20
 
21
- define('MAXBUTTONS_RELEASE',"10 Apr 2018");
22
 
23
 
24
  if (! function_exists('MaxButtons\maxbutton_double_load'))
@@ -52,7 +52,6 @@ require_once("classes/max-utils.php");
52
 
53
  // more core
54
  require_once("classes/block.php");
55
-
56
  require_once('classes/field.php');
57
  require_once('classes/blocks.php');
58
 
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: 7.1.1
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: maxbuttons
16
  if (! defined('MAXBUTTONS_ROOT_FILE'))
17
  define("MAXBUTTONS_ROOT_FILE", __FILE__);
18
  if (! defined('MAXBUTTONS_VERSION_NUM'))
19
+ define('MAXBUTTONS_VERSION_NUM', '7.1.1');
20
 
21
+ define('MAXBUTTONS_RELEASE',"25 Apr 2018");
22
 
23
 
24
  if (! function_exists('MaxButtons\maxbutton_double_load'))
52
 
53
  // more core
54
  require_once("classes/block.php");
 
55
  require_once('classes/field.php');
56
  require_once('classes/blocks.php');
57
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: wordpress button plugin, share button, wordpress buttons, css3 button gene
4
  Requires at least: 4.8
5
  Tested up to: 4.9.5
6
  Requires PHP: 5.3
7
- Stable tag: 7.1
8
 
9
  WordPress button plugin so powerful and easy to use anyone can create beautiful buttons, share buttons and social icons.
10
 
@@ -251,6 +251,10 @@ Secondly, please use latin only characters for button name ( Basic settings) and
251
 
252
  == Changelog ==
253
 
 
 
 
 
254
  = 7.1 =
255
 
256
  * Vertical align now working
4
  Requires at least: 4.8
5
  Tested up to: 4.9.5
6
  Requires PHP: 5.3
7
+ Stable tag: 7.1.1
8
 
9
  WordPress button plugin so powerful and easy to use anyone can create beautiful buttons, share buttons and social icons.
10
 
251
 
252
  == Changelog ==
253
 
254
+ = 7.1.1 =
255
+
256
+ * Fixed issue when other sources call jQuery.noConfict()
257
+
258
  = 7.1 =
259
 
260
  * Vertical align now working