@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @param string $url URL to transform. |
| 66 | 66 | * |
| 67 | - * @return bool|string |
|
| 67 | + * @return false|string |
|
| 68 | 68 | */ |
| 69 | 69 | public function getpath( $url ) |
| 70 | 70 | { |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | /** |
| 611 | 611 | * Logs given `$data` for debugging purposes (when debug logging is on). |
| 612 | 612 | * |
| 613 | - * @param mixed $data Data to log. |
|
| 613 | + * @param string $data Data to log. |
|
| 614 | 614 | * |
| 615 | 615 | * @return void |
| 616 | 616 | */ |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | * |
| 633 | 633 | * @param string $filepath Filepath. |
| 634 | 634 | * |
| 635 | - * @return bool|string to be minified code or false. |
|
| 635 | + * @return false|string to be minified code or false. |
|
| 636 | 636 | */ |
| 637 | 637 | protected function prepare_minify_single( $filepath ) |
| 638 | 638 | { |
@@ -434,7 +434,7 @@ |
||
| 434 | 434 | * size = total filesize (in bytes) of found files |
| 435 | 435 | * timestamp = unix timestamp when the scan was last performed/finished. |
| 436 | 436 | * |
| 437 | - * @return array |
|
| 437 | + * @return integer[] |
|
| 438 | 438 | */ |
| 439 | 439 | protected static function stats_scan() |
| 440 | 440 | { |
@@ -752,6 +752,9 @@ discard block |
||
| 752 | 752 | return $preload_onload; |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | + /** |
|
| 756 | + * @param string $key |
|
| 757 | + */ |
|
| 755 | 758 | public function get($key) |
| 756 | 759 | { |
| 757 | 760 | if ( ! is_array( $this->config ) ) { |
@@ -778,6 +781,9 @@ discard block |
||
| 778 | 781 | return false; |
| 779 | 782 | } |
| 780 | 783 | |
| 784 | + /** |
|
| 785 | + * @param string $url |
|
| 786 | + */ |
|
| 781 | 787 | private function getFutttaFeeds($url) { |
| 782 | 788 | if ( $this->settings_screen_do_remote_http ) { |
| 783 | 789 | $rss = fetch_feed( $url ); |
@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + exit; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly. |
|
| 3 | 6 | |
| 4 | 7 | class autoptimizeConfig |
| 5 | 8 | { |
@@ -791,10 +794,13 @@ discard block |
||
| 791 | 794 | <ul> |
| 792 | 795 | <?php if ( $maxitems == 0 ) : ?> |
| 793 | 796 | <li><?php _e( 'No items', 'autoptimize' ); ?></li> |
| 794 | - <?php else : ?> |
|
| 797 | + <?php else { |
|
| 798 | + : ?> |
|
| 795 | 799 | <?php foreach ( $rss_items as $item ) : ?> |
| 796 | 800 | <li> |
| 797 | - <a href="<?php echo esc_url( $item->get_permalink() ); ?>" |
|
| 801 | + <a href="<?php echo esc_url( $item->get_permalink() ); |
|
| 802 | +} |
|
| 803 | +?>" |
|
| 798 | 804 | title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date('j F Y | g:i a') ); ?>"> |
| 799 | 805 | <?php echo esc_html( $item->get_title() ); ?> |
| 800 | 806 | </a> |
@@ -437,6 +437,9 @@ |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | + /** |
|
| 441 | + * @return string |
|
| 442 | + */ |
|
| 440 | 443 | private function get_imgopt_base_url() |
| 441 | 444 | { |
| 442 | 445 | static $imgopt_base_url = null; |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | /** |
| 105 | 105 | * Doesn't do much in case of HTML (no cache in css/js sense there) |
| 106 | 106 | * |
| 107 | - * @return true |
|
| 107 | + * @return boolean |
|
| 108 | 108 | */ |
| 109 | 109 | public function cache() |
| 110 | 110 | { |
@@ -253,7 +253,7 @@ |
||
| 253 | 253 | * |
| 254 | 254 | * @param bool $doing_tests Allows overriding the optimization of only |
| 255 | 255 | * deciding once per request (for use in tests). |
| 256 | - * @return bool |
|
| 256 | + * @return boolean|null |
|
| 257 | 257 | */ |
| 258 | 258 | public function should_buffer( $doing_tests = false ) |
| 259 | 259 | { |
@@ -418,6 +418,10 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Checks against the white- and blacklists |
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * @param string $tag |
|
| 424 | + */ |
|
| 421 | 425 | private function ismergeable($tag) |
| 422 | 426 | { |
| 423 | 427 | if ( ! $this->aggregate ) { |
@@ -457,6 +461,10 @@ discard block |
||
| 457 | 461 | } |
| 458 | 462 | |
| 459 | 463 | // Checks agains the blacklist |
| 464 | + |
|
| 465 | + /** |
|
| 466 | + * @param string $tag |
|
| 467 | + */ |
|
| 460 | 468 | private function ismovable($tag) |
| 461 | 469 | { |
| 462 | 470 | if ( true !== $this->include_inline || apply_filters( 'autoptimize_filter_js_unmovable', true ) ) { |
@@ -538,7 +546,7 @@ discard block |
||
| 538 | 546 | * @param string $filepath Filepath. |
| 539 | 547 | * @param bool $cache_miss Optional. Force a cache miss. Default false. |
| 540 | 548 | * |
| 541 | - * @return bool|string Url pointing to the minified js file or false. |
|
| 549 | + * @return false|string Url pointing to the minified js file or false. |
|
| 542 | 550 | */ |
| 543 | 551 | public function minify_single( $filepath, $cache_miss = false ) |
| 544 | 552 | { |
@@ -1,10 +1,12 @@ discard block |
||
| 1 | 1 | <?php exit; |
| 2 | 2 | |
| 3 | 3 | //Check everything exists before using it |
| 4 | -if(!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) |
|
| 4 | +if(!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { |
|
| 5 | 5 | $_SERVER['HTTP_ACCEPT_ENCODING'] = ''; |
| 6 | -if(!isset($_SERVER['HTTP_USER_AGENT'])) |
|
| 6 | +} |
|
| 7 | +if(!isset($_SERVER['HTTP_USER_AGENT'])) { |
|
| 7 | 8 | $_SERVER['HTTP_USER_AGENT'] = ''; |
| 9 | +} |
|
| 8 | 10 | |
| 9 | 11 | // Determine supported compression method |
| 10 | 12 | $gzip = strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'); |
@@ -19,16 +21,19 @@ discard block |
||
| 19 | 21 | { |
| 20 | 22 | $version = floatval($matches[1]); |
| 21 | 23 | |
| 22 | - if ($version < 6) |
|
| 23 | - $encoding = 'none'; |
|
| 24 | + if ($version < 6) { |
|
| 25 | + $encoding = 'none'; |
|
| 26 | + } |
|
| 24 | 27 | |
| 25 | - if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1')) |
|
| 26 | - $encoding = 'none'; |
|
| 27 | -} |
|
| 28 | + if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1')) { |
|
| 29 | + $encoding = 'none'; |
|
| 30 | + } |
|
| 31 | + } |
|
| 28 | 32 | |
| 29 | 33 | //Some servers compress the output of PHP - Don't break in those cases |
| 30 | -if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1) |
|
| 34 | +if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1) { |
|
| 31 | 35 | $encoding = 'none'; |
| 36 | +} |
|
| 32 | 37 | |
| 33 | 38 | $iscompressed = file_exists(__FILE__.'.'.$encoding); |
| 34 | 39 | if($encoding != 'none' && $iscompressed == false) |
@@ -36,7 +41,7 @@ discard block |
||
| 36 | 41 | $flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE); |
| 37 | 42 | $code = file_get_contents(__FILE__.'.none'); |
| 38 | 43 | $contents = gzencode($code,9,$flag); |
| 39 | -}else{ |
|
| 44 | +} else{ |
|
| 40 | 45 | //Get data |
| 41 | 46 | $contents = file_get_contents(__FILE__.'.'.$encoding); |
| 42 | 47 | } |
@@ -52,7 +52,9 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | public static function load_script() { |
| 54 | 54 | |
| 55 | - if(is_customize_preview()) return; |
|
| 55 | + if(is_customize_preview()) { |
|
| 56 | + return; |
|
| 57 | + } |
|
| 56 | 58 | |
| 57 | 59 | wp_enqueue_script( |
| 58 | 60 | 'dismissible-notices', |