@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | // load dirs in defined order. No recursion. |
| 29 | 29 | foreach ($def['dirs'] as $dir) { |
| 30 | - $dirAbs = __DIR__ . '/' . $def['root'] . '/' . $dir; |
|
| 30 | + $dirAbs = __DIR__ . '/' . $def['root'] . '/' . $dir; |
|
| 31 | 31 | $files = glob($dirAbs . '/*.php'); |
| 32 | 32 | foreach ($files as $file) { |
| 33 | 33 | // only require files that begins with uppercase (A-Z) |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | } elseif ($uploadMaxSize < $fileSize) { |
| 118 | 118 | throw new ConversionFailedException( |
| 119 | 119 | 'File is larger than your max upload (set in your php.ini). File size:' . |
| 120 | - round($fileSize/1024) . ' kb. ' . |
|
| 120 | + round($fileSize / 1024) . ' kb. ' . |
|
| 121 | 121 | 'upload_max_filesize in php.ini: ' . ini_get('upload_max_filesize') . |
| 122 | - ' (parsed as ' . round($uploadMaxSize/1024) . ' kb)' |
|
| 122 | + ' (parsed as ' . round($uploadMaxSize / 1024) . ' kb)' |
|
| 123 | 123 | ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } elseif ($postMaxSize < $fileSize) { |
| 130 | 130 | throw new ConversionFailedException( |
| 131 | 131 | 'File is larger than your post_max_size limit (set in your php.ini). File size:' . |
| 132 | - round($fileSize/1024) . ' kb. ' . |
|
| 132 | + round($fileSize / 1024) . ' kb. ' . |
|
| 133 | 133 | 'post_max_size in php.ini: ' . ini_get('post_max_size') . |
| 134 | - ' (parsed as ' . round($postMaxSize/1024) . ' kb)' |
|
| 134 | + ' (parsed as ' . round($postMaxSize / 1024) . ' kb)' |
|
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | set_error_handler( |
| 26 | 26 | array('\\WebPConvert\\Helpers\\WarningsIntoExceptions', "warningHandler"), |
| 27 | 27 | E_WARNING | E_USER_WARNING |
| 28 | - ); // E_USER_WARNING E_ALL |
|
| 28 | + ); // E_USER_WARNING E_ALL |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function deactivate() |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | /** |
| 100 | 100 | * Prepare options. |
| 101 | 101 | */ |
| 102 | - /* |
|
| 102 | + /* |
|
| 103 | 103 | private function prepareOptions() |
| 104 | 104 | { |
| 105 | 105 | //$defaultOptions = self::$defaultOptions; |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | abstract protected function getMimeTypeOfSource(); |
| 21 | 21 | |
| 22 | 22 | public static $optionDefinitionsBasic = [ |
| 23 | - ['quality', 'number|string', 'auto'], // PS: Default is altered to 85 for PNG in ::getDefaultOptions() |
|
| 23 | + ['quality', 'number|string', 'auto'], // PS: Default is altered to 85 for PNG in ::getDefaultOptions() |
|
| 24 | 24 | ['max-quality', 'number', 85], |
| 25 | - ['default-quality', 'number', 75], // PS: Default is altered to 85 for PNG in ::getDefaultOptions() |
|
| 25 | + ['default-quality', 'number', 75], // PS: Default is altered to 85 for PNG in ::getDefaultOptions() |
|
| 26 | 26 | ['metadata', 'string', 'none'], |
| 27 | - ['lossless', 'boolean|string', false], // PS: Default is altered to "auto" for PNG in ::getDefaultOptions() |
|
| 27 | + ['lossless', 'boolean|string', false], // PS: Default is altered to "auto" for PNG in ::getDefaultOptions() |
|
| 28 | 28 | ['skip', 'boolean', false], |
| 29 | 29 | ]; |
| 30 | 30 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (($optionName == 'lossless') && ($actualType == 'string') && ($optionValue != 'auto')) { |
|
| 117 | + if (($optionName == 'lossless') && ($actualType == 'string') && ($optionValue != 'auto')) { |
|
| 118 | 118 | throw new InvalidOptionTypeException( |
| 119 | 119 | 'Lossless option must be true, false or "auto". It was set to: "' . $optionValue . '"' |
| 120 | 120 | ); |
@@ -106,14 +106,14 @@ |
||
| 106 | 106 | return false; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - //change the RGB values if you need, but leave alpha at 127 |
|
| 109 | + //change the RGB values if you need, but leave alpha at 127 |
|
| 110 | 110 | $transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127); |
| 111 | 111 | |
| 112 | 112 | if ($transparent === false) { |
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - //simpler than flood fill |
|
| 116 | + //simpler than flood fill |
|
| 117 | 117 | if (imagefilledrectangle($dst, 0, 0, imagesx($image), imagesy($image), $transparent) === false) { |
| 118 | 118 | return false; |
| 119 | 119 | } |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | $sourceSize = @filesize($source); |
| 239 | 239 | if ($sourceSize !== false) { |
| 240 | 240 | $msg .= ', reducing file size with ' . |
| 241 | - round((filesize($source) - filesize($destination))/filesize($source) * 100) . '% '; |
|
| 241 | + round((filesize($source) - filesize($destination)) / filesize($source) * 100) . '% '; |
|
| 242 | 242 | |
| 243 | 243 | if ($sourceSize < 10000) { |
| 244 | 244 | $msg .= '(went from ' . round(filesize($source)) . ' bytes to '; |
| 245 | 245 | $msg .= round(filesize($destination)) . ' bytes)'; |
| 246 | 246 | } else { |
| 247 | - $msg .= '(went from ' . round(filesize($source)/1024) . ' kb to '; |
|
| 248 | - $msg .= round(filesize($destination)/1024) . ' kb)'; |
|
| 247 | + $msg .= '(went from ' . round(filesize($source) / 1024) . ' kb to '; |
|
| 248 | + $msg .= round(filesize($destination) / 1024) . ' kb)'; |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | $this->logLn($msg); |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | if ($this->processLosslessAuto && ($this->options['lossless'] === 'auto') && $this->supportsLossless) { |
| 260 | 260 | $destination = $this->destination; |
| 261 | - $destinationLossless = $this->destination . '.lossless.webp'; |
|
| 262 | - $destinationLossy = $this->destination . '.lossy.webp'; |
|
| 261 | + $destinationLossless = $this->destination . '.lossless.webp'; |
|
| 262 | + $destinationLossy = $this->destination . '.lossy.webp'; |
|
| 263 | 263 | |
| 264 | 264 | $this->logLn( |
| 265 | 265 | 'Lossless is set to auto. Converting to both lossless and lossy and selecting the smallest file' |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $this->options['lossless'] = false; |
| 273 | 273 | $this->doActualConvert(); |
| 274 | 274 | $this->logLn('Reduction: ' . |
| 275 | - round((filesize($this->source) - filesize($this->destination))/filesize($this->source) * 100) . '% '); |
|
| 275 | + round((filesize($this->source) - filesize($this->destination)) / filesize($this->source) * 100) . '% '); |
|
| 276 | 276 | |
| 277 | 277 | $this->ln(); |
| 278 | 278 | $this->logLn('Converting to lossless'); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $this->options['lossless'] = true; |
| 281 | 281 | $this->doActualConvert(); |
| 282 | 282 | $this->logLn('Reduction: ' . |
| 283 | - round((filesize($this->source) - filesize($this->destination))/filesize($this->source) * 100) . '% '); |
|
| 283 | + round((filesize($this->source) - filesize($this->destination)) / filesize($this->source) * 100) . '% '); |
|
| 284 | 284 | |
| 285 | 285 | $this->ln(); |
| 286 | 286 | if (filesize($destinationLossless) > filesize($destinationLossy)) { |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | 18 | ['smart-subsample', 'boolean', false], |
| 19 | - ['alpha-quality', 'integer', 80], // alpha quality in lossless mode |
|
| 19 | + ['alpha-quality', 'integer', 80], // alpha quality in lossless mode |
|
| 20 | 20 | ['near-lossless', 'integer', 60], |
| 21 | - ['preset', 'integer', 0], // preset. 0:default, 1:picture, 2:photo, 3:drawing, 4:icon, 5:text, 6:last |
|
| 21 | + ['preset', 'integer', 0], // preset. 0:default, 1:picture, 2:photo, 3:drawing, 4:icon, 5:text, 6:last |
|
| 22 | 22 | ]; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $options = array_merge(self::$defaultOptions, $options); |
| 35 | 35 | |
| 36 | 36 | if ($options['set-last-modified-header'] === true) { |
| 37 | - Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) ." GMT"); |
|
| 37 | + Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) . " GMT"); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ($options['set-content-type-header'] === true) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // Check string for something like this: max-age:86400 |
| 54 | 54 | if (preg_match('#max-age\\s*=\\s*(\\d*)#', $options['cache-control-header'], $matches)) { |
| 55 | 55 | $seconds = $matches[1]; |
| 56 | - Header::setHeader('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + intval($seconds))); |
|
| 56 | + Header::setHeader('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + intval($seconds))); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | protected function getOptionDefinitionsExtra() |
| 24 | 24 | { |
| 25 | 25 | return [ |
| 26 | - ['api-version', 'number', 0], /* Can currently be 0 or 1 */ |
|
| 27 | - ['secret', 'string', '', true], /* only in api v.0 */ |
|
| 28 | - ['api-key', 'string', '', true], /* new in api v.1 (renamed 'secret' to 'api-key') */ |
|
| 26 | + ['api-version', 'number', 0], /* Can currently be 0 or 1 */ |
|
| 27 | + ['secret', 'string', '', true], /* only in api v.0 */ |
|
| 28 | + ['api-key', 'string', '', true], /* new in api v.1 (renamed 'secret' to 'api-key') */ |
|
| 29 | 29 | ['url', 'string', '', true, true], |
| 30 | - ['crypt-api-key-in-transfer', 'boolean', false], /* new in api v.1 */ |
|
| 30 | + ['crypt-api-key-in-transfer', 'boolean', false], /* new in api v.1 */ |
|
| 31 | 31 | ]; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ['.', '/'] |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | - for ($i=0; $i<22; $i++) { |
|
| 44 | + for ($i = 0; $i < 22; $i++) { |
|
| 45 | 45 | $salt .= $validCharsForSalt[array_rand($validCharsForSalt)]; |
| 46 | 46 | } |
| 47 | 47 | return $salt; |