@@ -42,6 +42,9 @@ discard block |
||
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | |
45 | + /** |
|
46 | + * @param string $mime |
|
47 | + */ |
|
45 | 48 | public function cache($code,$mime) { |
46 | 49 | if($this->nogzip == false) { |
47 | 50 | $file = ($this->delayed ? 'delayed.php' : 'default.php'); |
@@ -240,6 +243,9 @@ discard block |
||
240 | 243 | return true; |
241 | 244 | } |
242 | 245 | |
246 | + /** |
|
247 | + * @param string $dir |
|
248 | + */ |
|
243 | 249 | static function checkCacheDir($dir) { |
244 | 250 | // Check and create if not exists |
245 | 251 | if(!file_exists($dir)) { |
@@ -625,6 +625,9 @@ |
||
625 | 625 | return false; |
626 | 626 | } |
627 | 627 | |
628 | + /** |
|
629 | + * @param string $url |
|
630 | + */ |
|
628 | 631 | private function getFutttaFeeds($url) { |
629 | 632 | if (apply_filters('autoptimize_settingsscreen_remotehttp',true)) { |
630 | 633 | $rss = fetch_feed( $url ); |
@@ -53,7 +53,7 @@ |
||
53 | 53 | * |
54 | 54 | * @param array $options (currently ignored) |
55 | 55 | * |
56 | - * @return null |
|
56 | + * @return string |
|
57 | 57 | */ |
58 | 58 | private function __construct($options) { |
59 | 59 | $this->_options = $options; |
@@ -686,6 +686,11 @@ discard block |
||
686 | 686 | * --------------------------------------------------------------------------------------------- |
687 | 687 | */ |
688 | 688 | |
689 | + /** |
|
690 | + * @param double $v1 |
|
691 | + * @param double $v2 |
|
692 | + * @param integer $vh |
|
693 | + */ |
|
689 | 694 | private function hue_to_rgb($v1, $v2, $vh) |
690 | 695 | { |
691 | 696 | $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh); |
@@ -700,6 +705,10 @@ discard block |
||
700 | 705 | return intval(floor(floatval($n) + 0.5), 10); |
701 | 706 | } |
702 | 707 | |
708 | + /** |
|
709 | + * @param integer $min |
|
710 | + * @param integer $max |
|
711 | + */ |
|
703 | 712 | private function clamp_number($n, $min, $max) |
704 | 713 | { |
705 | 714 | return min(max($n, $min), $max); |
@@ -728,7 +737,7 @@ discard block |
||
728 | 737 | * |
729 | 738 | * @param string $str |
730 | 739 | * @param int $start index |
731 | - * @param int|bool $end index (optional) |
|
740 | + * @param integer $end index (optional) |
|
732 | 741 | * @return string |
733 | 742 | */ |
734 | 743 | private function str_slice($str, $start = 0, $end = FALSE) |
@@ -610,6 +610,9 @@ |
||
610 | 610 | return $code; |
611 | 611 | } |
612 | 612 | |
613 | + /** |
|
614 | + * @param string $tag |
|
615 | + */ |
|
613 | 616 | private function ismovable($tag) { |
614 | 617 | if ( apply_filters('autoptimize_filter_css_dontaggregate', false) ) { |
615 | 618 | return false; |
@@ -139,10 +139,18 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // hide everything between noptimize-comment tags |
142 | + |
|
143 | + /** |
|
144 | + * @param string $noptimize_in |
|
145 | + */ |
|
142 | 146 | protected function hide_noptimize($noptimize_in) { |
143 | 147 | if ( preg_match( '/<!--\s?noptimize\s?-->/', $noptimize_in ) ) { |
144 | 148 | $noptimize_out = preg_replace_callback( |
145 | 149 | '#<!--\s?noptimize\s?-->.*?<!--\s?/\s?noptimize\s?-->#is', |
150 | + |
|
151 | + /** |
|
152 | + * @param string $matches |
|
153 | + */ |
|
146 | 154 | function ($matches) {return "%%NOPTIMIZE" . AUTOPTIMIZE_HASH . "%%" . base64_encode($matches[0]) . "%%NOPTIMIZE%%";}, |
147 | 155 | $noptimize_in |
148 | 156 | ); |
@@ -268,6 +276,9 @@ discard block |
||
268 | 276 | } |
269 | 277 | } |
270 | 278 | |
279 | + /** |
|
280 | + * @param string $tag |
|
281 | + */ |
|
271 | 282 | protected function isremovable($tag, $removables) { |
272 | 283 | foreach ($removables as $match) { |
273 | 284 | if (strpos($tag,$match)!==false) { |
@@ -278,10 +289,18 @@ discard block |
||
278 | 289 | } |
279 | 290 | |
280 | 291 | // inject already minified code in optimized JS/CSS |
292 | + |
|
293 | + /** |
|
294 | + * @return string |
|
295 | + */ |
|
281 | 296 | protected function inject_minified($in) { |
282 | 297 | if ( strpos( $in, '%%INJECTLATER%%' ) !== false ) { |
283 | 298 | $out = preg_replace_callback( |
284 | 299 | '#\/\*\!%%INJECTLATER'.AUTOPTIMIZE_HASH.'%%(.*?)%%INJECTLATER%%\*\/#is', |
300 | + |
|
301 | + /** |
|
302 | + * @return string |
|
303 | + */ |
|
285 | 304 | function ($matches) {$filepath = base64_decode(strtok($matches[1], "|")); |
286 | 305 | $filecontent = file_get_contents($filepath); |
287 | 306 | |
@@ -320,6 +339,9 @@ discard block |
||
320 | 339 | return $out; |
321 | 340 | } |
322 | 341 | |
342 | + /** |
|
343 | + * @param string $pathIn |
|
344 | + */ |
|
323 | 345 | protected function minify_single($pathIn) { |
324 | 346 | // determine JS or CSS and set var (also mimetype), return false if neither |
325 | 347 | if ( $this->str_ends_in($pathIn,".js") === true ) { |
@@ -385,6 +407,9 @@ discard block |
||
385 | 407 | return $_CachedMinifiedUrl; |
386 | 408 | } |
387 | 409 | |
410 | + /** |
|
411 | + * @param string $needle |
|
412 | + */ |
|
388 | 413 | protected function str_ends_in($haystack,$needle) { |
389 | 414 | $needleLength = strlen($needle); |
390 | 415 | $haystackLength = strlen($haystack); |