PluginProbe
MaxButtons – Create buttons / 6.28
MaxButtons – Create buttons v6.28
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
← All changes | classes/max-utils.php +18 -47 7.13.36.28 View file →
@@ -34,9 +34,9 @@
34 34 $message = __( sprintf("No Handler found for action %s ", $plugin_action), 'maxbuttons');
35 35
36 36 if (! wp_verify_nonce($nonce, 'maxajax') )
37 37 {
38 - $message = __('Nonce not verified (' . $nonce . ')', 'maxbuttons');
38 + $message = __('Nonce not verified', 'maxbuttons');
39 39 }
40 40 else
41 41 {
42 42 do_action('maxbuttons/ajax/' . $plugin_action, $_POST);
@@ -41,10 +41,13 @@
41 41 {
42 42 do_action('maxbuttons/ajax/' . $plugin_action, $_POST);
43 43 }
44 44
45 - wp_send_json_error( array('message' => $message) );
46 -
45 + echo json_encode( array( 'status' => $status,
46 + 'message' => $message,
47 + )
48 + );
49 + wp_die();
47 50 }
48 51
49 52 public static function translit($string)
50 53 {
@@ -50,9 +53,8 @@
50 53 {
51 54 require_once(MB()->get_plugin_path() . "assets/libraries/url_slug.php");
52 55
53 56 $string = mb_url_slug($string, array("transliterate" => true));
54 -
55 57 return $string;
56 58 }
57 59
58 60 public static function selectify($name, $array, $selected, $target = '', $class = '')
@@ -76,13 +78,8 @@
76 78
77 79
78 80 static function hex2rgba($color, $opacity) {
79 81 // Grab the hex color and remove #
80 -
81 - /* Check if color is already rgba. This can happen with transparency. */
82 - if (strpos($color, 'rgba') !== false)
83 - return $color;
84 -
85 82 $hex = str_replace("#", "", $color);
86 83
87 84 // Convert hex to rgb
88 85 if(strlen($color) == 3) {
@@ -114,22 +111,10 @@
114 111 // Spits out rgba(0, 0, 0, 0.5) format
115 112 return 'rgba(' . $rgb . ', ' . $alpha . ')';
116 113 }
117 114
118 - // test if color value is in RGBA or not.
119 - static function isrgba($value)
120 - {
121 - if (strpos($value, 'rgb') >= 0 )
122 - return true;
123 - else {
124 - return false;
125 - }
126 - }
127 -
128 115 static function strip_px($value) {
129 - $value = rtrim( intval($value), 'px');
130 - $value = rtrim( intval($value), '%');
131 - return $value;
116 + return rtrim( intval($value), 'px');
132 117 }
133 118
134 119 static function generate_font_sizes($start, $end, $step = 1)
135 120 {
@@ -159,16 +144,16 @@
159 144 "large_desktop" => "only screen and (min-width : 1824px)",
160 145 );
161 146
162 147 $query_names = array(
163 - "phone" => __("Small phones, < 480px","maxbuttons"),
164 - "phone_land" => __("Small phones (landscape) ","maxbuttons"),
165 - "phone_portrait" => __("Small phones (portrait), < 320px ","maxbuttons"),
166 - "medium_phone" => __("Medium-size (smart)phone (480px-768px)","maxbuttons"),
167 - "ipad" => __("Ipad (all) / Large phones (768px-1024px)","maxbuttons"),
148 + "phone" => __("Small phones","maxbuttons"),
149 + "phone_land" => __("Small phones (landscape)","maxbuttons"),
150 + "phone_portrait" => __("Small phones (portrait)","maxbuttons"),
151 + "medium_phone" => __("Medium-size (smart)phone","maxbuttons"),
152 + "ipad" => __("Ipad (all) / Large phones","maxbuttons"),
168 153 "ipad_land" => __("Ipad landscape","maxbuttons"),
169 154 "ipad_portrait" => __("Ipad portrait","maxbuttons"),
170 - "desktop" => __("Desktop, > 1224px","maxbuttons"),
155 + "desktop" => __("Desktop","maxbuttons"),
171 156 "large_desktop" => __("Large desktops","maxbuttons"),
172 157 "custom" => __("Custom size","maxbuttons"),
173 158 );
174 159
@@ -307,9 +292,8 @@
307 292
308 293 }
309 294
310 295 /** Function will try to unload any FA scripts other than MB from WP. In case of conflict */
311 - /* 7.0 note - this function is currently not in use due to dynamic font library loading */
312 296 static function fixFAConflict()
313 297 {
314 298 $forcefa = get_option('maxbuttons_forcefa');
315 299
@@ -324,9 +308,8 @@
324 308 {
325 309 if ($script == 'mbpro-font-awesome')
326 310 {
327 311 $our_fa_there = true;
328 -
329 312 break;
330 313 }
331 314 }
332 315
@@ -331,12 +314,11 @@
331 314 }
332 315
333 316 // fix nothing on pages where we are not loading.
334 317 if (! $our_fa_there)
335 - {
336 318 return;
337 - }
338 319
320 +
339 321 // Loop through all registered styles and remove any that appear to be Font Awesome.
340 322 foreach ( $wp_styles->registered as $script => $details ) {
341 323 $src = isset($details->src) ? $details->src : false;
342 324
@@ -345,14 +327,11 @@
345 327 $mbpro_src = $src;
346 328 continue; // exclude us
347 329 }
348 330
349 - // look at script handle
350 -
351 331 if ( false !== strpos( $script, 'fontawesome' ) || false !== strpos( $script, 'font-awesome' ) ) {
352 332 wp_dequeue_style( $script );
353 333 }
354 - // look at file source
355 334 if ($src && ( false !== strpos($src, 'font-awesome') || false !== strpos($src, 'fontawesome') ) )
356 335 {
357 336 wp_dequeue_style( $script );
358 337 }
@@ -394,9 +373,8 @@
394 373 return;
395 374
396 375 self::$time_operations[$operation][] = array("start" => microtime(true),
397 376 "end" => 0,
398 - 'memory_start' => memory_get_usage(),
399 377 );
400 378
401 379 }
402 380
@@ -410,9 +388,8 @@
410 388 {
411 389 if (self::$time_operations[$operation][$i]["end"] == 0)
412 390 {
413 391 self::$time_operations[$operation][$i]["end"] = microtime(true);
414 - self::$time_operations[$operation][$i]["memory_end"] = memory_get_usage();
415 392 break;
416 393 }
417 394 }
418 395
@@ -417,16 +394,10 @@
417 394 }
418 395
419 396 }
420 397
421 - public static function convert_memory($size)
398 + static function showTime()
422 399 {
423 - $unit=array('b','kb','mb','gb','tb','pb');
424 - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
425 - }
426 -
427 - public static function showTime()
428 - {
429 400 if ( ! defined('MAXBUTTONS_BENCHMARK') || MAXBUTTONS_BENCHMARK !== true)
430 401 return;
431 402
432 403 $timer = self::$timer;
@@ -440,16 +411,16 @@
440 411 {
441 412 $start = $data["start"];
442 413 $end = $data["end"];
443 414 $duration = $end - $start;
444 - $mem_start = $data['memory_start'];
445 - $mem_end = $data['memory_end'];
446 415
447 416
448 417 $text .= "<span class='first'>$duration</span>
449 418 <span class='second'>$operation</span>
450 - <span class='third'>" . self::convert_memory($mem_start) . " - " . self::convert_memory($mem_end) . "</span><br />
419 + <span class='third'>&nbsp; </span><br />
451 420 ";
421 +
422 +
452 423 }
453 424 }
454 425
455 426