| @@ -32,12 +32,11 @@ | ||
| 32 | 32 | $plugin_action = isset($_POST['plugin_action']) ? sanitize_text_field($_POST['plugin_action']) : ''; |
| 33 | 33 | $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : false; |
| 34 | 34 | $message = __( sprintf("No Handler found for action %s ", $plugin_action), 'maxbuttons'); |
| 35 | 35 | |
| 36 | - | |
| 37 | 36 | if (! wp_verify_nonce($nonce, 'maxajax') ) |
| 38 | 37 | { |
| 39 | - $message = __('Nonce not verified (' . $nonce . ')', 'maxbuttons'); | |
| 38 | + $message = __('Nonce not verified', 'maxbuttons'); | |
| 40 | 39 | } |
| 41 | 40 | else |
| 42 | 41 | { |
| 43 | 42 | do_action('maxbuttons/ajax/' . $plugin_action, $_POST); |
| @@ -42,15 +41,13 @@ | ||
| 42 | 41 | { |
| 43 | 42 | do_action('maxbuttons/ajax/' . $plugin_action, $_POST); |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | - /*echo json_encode( array( 'status' => $status, | |
| 45 | + echo json_encode( array( 'status' => $status, | |
| 47 | 46 | 'message' => $message, |
| 48 | 47 | ) |
| 49 | - ); */ | |
| 50 | - | |
| 51 | - wp_send_json_error( array('message' => $message) ); | |
| 52 | - | |
| 48 | + ); | |
| 49 | + wp_die(); | |
| 53 | 50 | } |
| 54 | 51 | |
| 55 | 52 | public static function translit($string) |
| 56 | 53 | { |
| @@ -56,9 +53,8 @@ | ||
| 56 | 53 | { |
| 57 | 54 | require_once(MB()->get_plugin_path() . "assets/libraries/url_slug.php"); |
| 58 | 55 | |
| 59 | 56 | $string = mb_url_slug($string, array("transliterate" => true)); |
| 60 | - | |
| 61 | 57 | return $string; |
| 62 | 58 | } |
| 63 | 59 | |
| 64 | 60 | public static function selectify($name, $array, $selected, $target = '', $class = '') |
| @@ -116,11 +112,9 @@ | ||
| 116 | 112 | return 'rgba(' . $rgb . ', ' . $alpha . ')'; |
| 117 | 113 | } |
| 118 | 114 | |
| 119 | 115 | static function strip_px($value) { |
| 120 | - $value = rtrim( intval($value), 'px'); | |
| 121 | - $value = rtrim( intval($value), '%'); | |
| 122 | - return $value; | |
| 116 | + return rtrim( intval($value), 'px'); | |
| 123 | 117 | } |
| 124 | 118 | |
| 125 | 119 | static function generate_font_sizes($start, $end, $step = 1) |
| 126 | 120 | { |
| @@ -150,16 +144,16 @@ | ||
| 150 | 144 | "large_desktop" => "only screen and (min-width : 1824px)", |
| 151 | 145 | ); |
| 152 | 146 | |
| 153 | 147 | $query_names = array( |
| 154 | - "phone" => __("Small phones, < 480px","maxbuttons"), | |
| 155 | - "phone_land" => __("Small phones (landscape) ","maxbuttons"), | |
| 156 | - "phone_portrait" => __("Small phones (portrait), < 320px ","maxbuttons"), | |
| 157 | - "medium_phone" => __("Medium-size (smart)phone (480px-768px)","maxbuttons"), | |
| 158 | - "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"), | |
| 159 | 153 | "ipad_land" => __("Ipad landscape","maxbuttons"), |
| 160 | 154 | "ipad_portrait" => __("Ipad portrait","maxbuttons"), |
| 161 | - "desktop" => __("Desktop, > 1224px","maxbuttons"), | |
| 155 | + "desktop" => __("Desktop","maxbuttons"), | |
| 162 | 156 | "large_desktop" => __("Large desktops","maxbuttons"), |
| 163 | 157 | "custom" => __("Custom size","maxbuttons"), |
| 164 | 158 | ); |
| 165 | 159 | |
| @@ -298,9 +292,8 @@ | ||
| 298 | 292 | |
| 299 | 293 | } |
| 300 | 294 | |
| 301 | 295 | /** Function will try to unload any FA scripts other than MB from WP. In case of conflict */ |
| 302 | - /* 7.0 note - this function is currently not in use due to dynamic font library loading */ | |
| 303 | 296 | static function fixFAConflict() |
| 304 | 297 | { |
| 305 | 298 | $forcefa = get_option('maxbuttons_forcefa'); |
| 306 | 299 | |
| @@ -315,9 +308,8 @@ | ||
| 315 | 308 | { |
| 316 | 309 | if ($script == 'mbpro-font-awesome') |
| 317 | 310 | { |
| 318 | 311 | $our_fa_there = true; |
| 319 | - | |
| 320 | 312 | break; |
| 321 | 313 | } |
| 322 | 314 | } |
| 323 | 315 | |
| @@ -322,12 +314,11 @@ | ||
| 322 | 314 | } |
| 323 | 315 | |
| 324 | 316 | // fix nothing on pages where we are not loading. |
| 325 | 317 | if (! $our_fa_there) |
| 326 | - { | |
| 327 | 318 | return; |
| 328 | - } | |
| 329 | 319 | |
| 320 | + | |
| 330 | 321 | // Loop through all registered styles and remove any that appear to be Font Awesome. |
| 331 | 322 | foreach ( $wp_styles->registered as $script => $details ) { |
| 332 | 323 | $src = isset($details->src) ? $details->src : false; |
| 333 | 324 | |
| @@ -336,14 +327,11 @@ | ||
| 336 | 327 | $mbpro_src = $src; |
| 337 | 328 | continue; // exclude us |
| 338 | 329 | } |
| 339 | 330 | |
| 340 | - // look at script handle | |
| 341 | - | |
| 342 | 331 | if ( false !== strpos( $script, 'fontawesome' ) || false !== strpos( $script, 'font-awesome' ) ) { |
| 343 | 332 | wp_dequeue_style( $script ); |
| 344 | 333 | } |
| 345 | - // look at file source | |
| 346 | 334 | if ($src && ( false !== strpos($src, 'font-awesome') || false !== strpos($src, 'fontawesome') ) ) |
| 347 | 335 | { |
| 348 | 336 | wp_dequeue_style( $script ); |
| 349 | 337 | } |
| @@ -385,9 +373,8 @@ | ||
| 385 | 373 | return; |
| 386 | 374 | |
| 387 | 375 | self::$time_operations[$operation][] = array("start" => microtime(true), |
| 388 | 376 | "end" => 0, |
| 389 | - 'memory_start' => memory_get_usage(), | |
| 390 | 377 | ); |
| 391 | 378 | |
| 392 | 379 | } |
| 393 | 380 | |
| @@ -401,9 +388,8 @@ | ||
| 401 | 388 | { |
| 402 | 389 | if (self::$time_operations[$operation][$i]["end"] == 0) |
| 403 | 390 | { |
| 404 | 391 | self::$time_operations[$operation][$i]["end"] = microtime(true); |
| 405 | - self::$time_operations[$operation][$i]["memory_end"] = memory_get_usage(); | |
| 406 | 392 | break; |
| 407 | 393 | } |
| 408 | 394 | } |
| 409 | 395 | |
| @@ -408,16 +394,10 @@ | ||
| 408 | 394 | } |
| 409 | 395 | |
| 410 | 396 | } |
| 411 | 397 | |
| 412 | - public static function convert_memory($size) | |
| 398 | + static function showTime() | |
| 413 | 399 | { |
| 414 | - $unit=array('b','kb','mb','gb','tb','pb'); | |
| 415 | - return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; | |
| 416 | - } | |
| 417 | - | |
| 418 | - public static function showTime() | |
| 419 | - { | |
| 420 | 400 | if ( ! defined('MAXBUTTONS_BENCHMARK') || MAXBUTTONS_BENCHMARK !== true) |
| 421 | 401 | return; |
| 422 | 402 | |
| 423 | 403 | $timer = self::$timer; |
| @@ -431,16 +411,16 @@ | ||
| 431 | 411 | { |
| 432 | 412 | $start = $data["start"]; |
| 433 | 413 | $end = $data["end"]; |
| 434 | 414 | $duration = $end - $start; |
| 435 | - $mem_start = $data['memory_start']; | |
| 436 | - $mem_end = $data['memory_end']; | |
| 437 | 415 | |
| 438 | 416 | |
| 439 | 417 | $text .= "<span class='first'>$duration</span> |
| 440 | 418 | <span class='second'>$operation</span> |
| 441 | - <span class='third'>" . self::convert_memory($mem_start) . " - " . self::convert_memory($mem_end) . "</span><br /> | |
| 419 | + <span class='third'> </span><br /> | |
| 442 | 420 | "; |
| 421 | + | |
| 422 | + | |
| 443 | 423 | } |
| 444 | 424 | } |
| 445 | 425 | |
| 446 | 426 | |