@@ -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 | { |
@@ -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 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * be inlined into a data: URI. Defaults to 4096, passed through |
| 283 | 283 | * `autoptimize_filter_css_datauri_maxsize` filter. |
| 284 | 284 | * |
| 285 | - * @return mixed |
|
| 285 | + * @return integer|null |
|
| 286 | 286 | */ |
| 287 | 287 | private function get_datauri_maxsize() |
| 288 | 288 | { |
@@ -303,6 +303,9 @@ discard block |
||
| 303 | 303 | return $max_size; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | + /** |
|
| 307 | + * @param false|string $url |
|
| 308 | + */ |
|
| 306 | 309 | private function check_datauri_exclude_list( $url ) |
| 307 | 310 | { |
| 308 | 311 | static $exclude_list = null; |
@@ -328,6 +331,9 @@ discard block |
||
| 328 | 331 | return $matched; |
| 329 | 332 | } |
| 330 | 333 | |
| 334 | + /** |
|
| 335 | + * @param false|string $path |
|
| 336 | + */ |
|
| 331 | 337 | private function build_or_get_datauri_image( $path ) |
| 332 | 338 | { |
| 333 | 339 | /** |
@@ -746,6 +752,11 @@ discard block |
||
| 746 | 752 | return true; |
| 747 | 753 | } |
| 748 | 754 | |
| 755 | + /** |
|
| 756 | + * @param string $code |
|
| 757 | + * |
|
| 758 | + * @return string |
|
| 759 | + */ |
|
| 749 | 760 | public function run_minifier_on( $code ) |
| 750 | 761 | { |
| 751 | 762 | if ( ! $this->alreadyminified ) { |
@@ -945,6 +956,9 @@ discard block |
||
| 945 | 956 | return $code; |
| 946 | 957 | } |
| 947 | 958 | |
| 959 | + /** |
|
| 960 | + * @param string $tag |
|
| 961 | + */ |
|
| 948 | 962 | private function ismovable( $tag ) |
| 949 | 963 | { |
| 950 | 964 | if ( ! $this->aggregate ) { |
@@ -1005,7 +1019,7 @@ discard block |
||
| 1005 | 1019 | * @param string $filepath Filepath. |
| 1006 | 1020 | * @param bool $cache_miss Optional. Force a cache miss. Default false. |
| 1007 | 1021 | * |
| 1008 | - * @return bool|string Url pointing to the minified css file or false. |
|
| 1022 | + * @return false|string Url pointing to the minified css file or false. |
|
| 1009 | 1023 | */ |
| 1010 | 1024 | public function minify_single( $filepath, $cache_miss = false ) |
| 1011 | 1025 | { |
@@ -1057,6 +1071,9 @@ discard block |
||
| 1057 | 1071 | $this->options = $options; |
| 1058 | 1072 | } |
| 1059 | 1073 | |
| 1074 | + /** |
|
| 1075 | + * @param string $name |
|
| 1076 | + */ |
|
| 1060 | 1077 | public function setOption( $name, $value ) |
| 1061 | 1078 | { |
| 1062 | 1079 | $this->options[$name] = $value; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @param bool|null $override Allows overriding the decision. |
| 16 | 16 | * |
| 17 | - * @return bool |
|
| 17 | + * @return boolean|null |
|
| 18 | 18 | */ |
| 19 | 19 | public static function mbstring_available( $override = null ) |
| 20 | 20 | { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @param bool $override Allows overriding the decision when needed. |
| 132 | 132 | * |
| 133 | - * @return bool |
|
| 133 | + * @return boolean|null |
|
| 134 | 134 | */ |
| 135 | 135 | public static function siteurl_not_root( $override = null ) |
| 136 | 136 | { |
@@ -128,6 +128,9 @@ |
||
| 128 | 128 | parent::tearDown(); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | + /** |
|
| 132 | + * @return string |
|
| 133 | + */ |
|
| 131 | 134 | protected function get_test_markup() |
| 132 | 135 | { |
| 133 | 136 | $siteurl = $this->get_urls()['siteurl']; |
@@ -798,6 +798,9 @@ discard block |
||
| 798 | 798 | return $preload_onload; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | + /** |
|
| 802 | + * @param string $key |
|
| 803 | + */ |
|
| 801 | 804 | public function get( $key ) |
| 802 | 805 | { |
| 803 | 806 | if ( ! is_array( $this->config ) ) { |
@@ -824,6 +827,9 @@ discard block |
||
| 824 | 827 | return false; |
| 825 | 828 | } |
| 826 | 829 | |
| 830 | + /** |
|
| 831 | + * @param string $url |
|
| 832 | + */ |
|
| 827 | 833 | private function get_futtta_feeds( $url ) { |
| 828 | 834 | if ( $this->settings_screen_do_remote_http ) { |
| 829 | 835 | $rss = fetch_feed( $url ); |
@@ -837,10 +837,13 @@ |
||
| 837 | 837 | <ul> |
| 838 | 838 | <?php if ( 0 == $maxitems ) : ?> |
| 839 | 839 | <li><?php _e( 'No items', 'autoptimize' ); ?></li> |
| 840 | - <?php else : ?> |
|
| 840 | + <?php else { |
|
| 841 | + : ?> |
|
| 841 | 842 | <?php foreach ( $rss_items as $item ) : ?> |
| 842 | 843 | <li> |
| 843 | - <a href="<?php echo esc_url( $item->get_permalink() ); ?>" |
|
| 844 | + <a href="<?php echo esc_url( $item->get_permalink() ); |
|
| 845 | +} |
|
| 846 | +?>" |
|
| 844 | 847 | <?php // translators: the variable contains a date. ?> |
| 845 | 848 | title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date( 'j F Y | g:i a' ) ); ?>"> |
| 846 | 849 | <?php echo esc_html( $item->get_title() ); ?> |
@@ -370,6 +370,9 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | + /** |
|
| 374 | + * @return string |
|
| 375 | + */ |
|
| 373 | 376 | private function get_imgopt_base_url() |
| 374 | 377 | { |
| 375 | 378 | static $imgopt_base_url = null; |
@@ -718,6 +721,9 @@ discard block |
||
| 718 | 721 | return $out; |
| 719 | 722 | } |
| 720 | 723 | |
| 724 | + /** |
|
| 725 | + * @param string $tag |
|
| 726 | + */ |
|
| 721 | 727 | public function add_lazyload( $tag, $placeholder = '' ) { |
| 722 | 728 | // adds actual lazyload-attributes to an image node. |
| 723 | 729 | if ( str_ireplace( $this->get_lazyload_exclusions(), '', $tag ) === $tag ) { |
@@ -897,6 +903,9 @@ discard block |
||
| 897 | 903 | return $out; |
| 898 | 904 | } |
| 899 | 905 | |
| 906 | + /** |
|
| 907 | + * @return string |
|
| 908 | + */ |
|
| 900 | 909 | public function process_bgimage( $in ) { |
| 901 | 910 | if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) { |
| 902 | 911 | $out = preg_replace_callback( |
@@ -1239,7 +1248,7 @@ discard block |
||
| 1239 | 1248 | /** |
| 1240 | 1249 | * Determines and returns the service launch status. |
| 1241 | 1250 | * |
| 1242 | - * @return bool |
|
| 1251 | + * @return null|boolean |
|
| 1243 | 1252 | */ |
| 1244 | 1253 | public function launch_ok() |
| 1245 | 1254 | { |