@@ -33,8 +33,8 @@ |
||
| 33 | 33 | |
| 34 | 34 | $element = new Element('meta'); |
| 35 | 35 | |
| 36 | - $element->attributes[ 'name' ] = $property; |
|
| 37 | - $element->attributes[ 'content' ] = (is_array($content) ? implode(', ', $content) : trim($content)); |
|
| 36 | + $element->attributes['name'] = $property; |
|
| 37 | + $element->attributes['content'] = (is_array($content) ? implode(', ', $content) : trim($content)); |
|
| 38 | 38 | |
| 39 | 39 | $this->store($property, $element); |
| 40 | 40 | |
@@ -37,8 +37,8 @@ |
||
| 37 | 37 | $config = presenter()->getConfig('assets'); |
| 38 | 38 | |
| 39 | 39 | $webpack = false; |
| 40 | - if (isset($config[ 'webpack' ])) { |
|
| 41 | - $webpack = (bool)$config[ 'webpack' ]; |
|
| 40 | + if (isset($config['webpack'])) { |
|
| 41 | + $webpack = (bool)$config['webpack']; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $output = []; |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | $config = presenter()->getConfig('assets'); |
| 43 | 43 | |
| 44 | 44 | $webpack = false; |
| 45 | - if (isset($config[ 'webpack' ])) { |
|
| 46 | - $webpack = (bool)$config[ 'webpack' ]; |
|
| 45 | + if (isset($config['webpack'])) { |
|
| 46 | + $webpack = (bool)$config['webpack']; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $output = []; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | if (count($subPackages)) { |
| 86 | 86 | |
| 87 | 87 | if (array_key_exists('libraries', $subPackages)) { |
| 88 | - foreach ($subPackages[ 'libraries' ] as $subPackageFile) { |
|
| 88 | + foreach ($subPackages['libraries'] as $subPackageFile) { |
|
| 89 | 89 | $pluginDir = $packageDir . 'libraries' . DIRECTORY_SEPARATOR; |
| 90 | 90 | $pluginName = $subPackageFile; |
| 91 | 91 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - unset($subPackages[ 'libraries' ]); |
|
| 99 | + unset($subPackages['libraries']); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $this->head->loadFile($packageDir . $package . '.css'); |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | if (is_array($item)) { |
| 190 | 190 | foreach ($item as $filename) { |
| 191 | 191 | if (array_key_exists($filename, $this->{$type . 'Assets'})) { |
| 192 | - unset($this->{$type . 'Assets'}[ $filename ]); |
|
| 192 | + unset($this->{$type . 'Assets'}[$filename]); |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } elseif (is_string($item)) { |
| 196 | 196 | if (array_key_exists($item, $this->{$type . 'Assets'})) { |
| 197 | - unset($this->{$type . 'Assets'}[ $item ]); |
|
| 197 | + unset($this->{$type . 'Assets'}[$item]); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -284,19 +284,19 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Valet path fixes |
| 287 | - if (isset($_SERVER[ 'SCRIPT_FILENAME' ])) { |
|
| 288 | - $valetPath = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR; |
|
| 287 | + if (isset($_SERVER['SCRIPT_FILENAME'])) { |
|
| 288 | + $valetPath = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR; |
|
| 289 | 289 | } else { |
| 290 | - $PATH_ROOT = $_SERVER[ 'DOCUMENT_ROOT' ]; |
|
| 291 | - |
|
| 292 | - if (isset($_SERVER[ 'PHP_SELF' ])) { |
|
| 293 | - $valetPath = $PATH_ROOT . dirname($_SERVER[ 'PHP_SELF' ]) . DIRECTORY_SEPARATOR; |
|
| 294 | - } elseif (isset($_SERVER[ 'DOCUMENT_URI' ])) { |
|
| 295 | - $valetPath = $PATH_ROOT . dirname($_SERVER[ 'DOCUMENT_URI' ]) . DIRECTORY_SEPARATOR; |
|
| 296 | - } elseif (isset($_SERVER[ 'REQUEST_URI' ])) { |
|
| 297 | - $valetPath = $PATH_ROOT . dirname($_SERVER[ 'REQUEST_URI' ]) . DIRECTORY_SEPARATOR; |
|
| 298 | - } elseif (isset($_SERVER[ 'SCRIPT_NAME' ])) { |
|
| 299 | - $valetPath = $PATH_ROOT . dirname($_SERVER[ 'SCRIPT_NAME' ]) . DIRECTORY_SEPARATOR; |
|
| 290 | + $PATH_ROOT = $_SERVER['DOCUMENT_ROOT']; |
|
| 291 | + |
|
| 292 | + if (isset($_SERVER['PHP_SELF'])) { |
|
| 293 | + $valetPath = $PATH_ROOT . dirname($_SERVER['PHP_SELF']) . DIRECTORY_SEPARATOR; |
|
| 294 | + } elseif (isset($_SERVER['DOCUMENT_URI'])) { |
|
| 295 | + $valetPath = $PATH_ROOT . dirname($_SERVER['DOCUMENT_URI']) . DIRECTORY_SEPARATOR; |
|
| 296 | + } elseif (isset($_SERVER['REQUEST_URI'])) { |
|
| 297 | + $valetPath = $PATH_ROOT . dirname($_SERVER['REQUEST_URI']) . DIRECTORY_SEPARATOR; |
|
| 298 | + } elseif (isset($_SERVER['SCRIPT_NAME'])) { |
|
| 299 | + $valetPath = $PATH_ROOT . dirname($_SERVER['SCRIPT_NAME']) . DIRECTORY_SEPARATOR; |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
@@ -51,28 +51,28 @@ |
||
| 51 | 51 | $element = new Element('meta'); |
| 52 | 52 | |
| 53 | 53 | if ($offset === 'http-equiv') { |
| 54 | - $element->attributes[ 'http-equiv' ] = $value[ 'property' ]; |
|
| 55 | - $element->attributes[ 'content' ] = $value[ 'content' ]; |
|
| 56 | - parent::store(camelcase('http_equiv_' . $value[ 'property' ]), $element); |
|
| 54 | + $element->attributes['http-equiv'] = $value['property']; |
|
| 55 | + $element->attributes['content'] = $value['content']; |
|
| 56 | + parent::store(camelcase('http_equiv_' . $value['property']), $element); |
|
| 57 | 57 | } else { |
| 58 | - $element->attributes[ 'name' ] = $offset; |
|
| 58 | + $element->attributes['name'] = $offset; |
|
| 59 | 59 | |
| 60 | 60 | if (is_array($value)) { |
| 61 | 61 | if (is_numeric(key($value))) { |
| 62 | - $element->attributes[ 'content' ] = implode(', ', $value); |
|
| 62 | + $element->attributes['content'] = implode(', ', $value); |
|
| 63 | 63 | } else { |
| 64 | 64 | $newValue = []; |
| 65 | 65 | foreach ($value as $key => $val) { |
| 66 | 66 | $newValue[] = $key . '=' . $val; |
| 67 | 67 | } |
| 68 | - $element->attributes[ 'content' ] = implode(', ', $newValue); |
|
| 68 | + $element->attributes['content'] = implode(', ', $newValue); |
|
| 69 | 69 | } |
| 70 | 70 | } else { |
| 71 | - $element->attributes[ 'content' ] = $value; |
|
| 71 | + $element->attributes['content'] = $value; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if (in_array($offset, ['description']) and $this->opengraph instanceof Meta\Opengraph) { |
| 75 | - $this->opengraph->setObject($element->attributes[ 'name' ], $element->attributes[ 'content' ]); |
|
| 75 | + $this->opengraph->setObject($element->attributes['name'], $element->attributes['content']); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | parent::store(camelcase($offset), $element); |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function __construct() |
| 154 | 154 | { |
| 155 | - if (isset($_SERVER[ 'HTTP_USER_AGENT' ])) { |
|
| 156 | - $this->string = trim($_SERVER[ 'HTTP_USER_AGENT' ]); |
|
| 155 | + if (isset($_SERVER['HTTP_USER_AGENT'])) { |
|
| 156 | + $this->string = trim($_SERVER['HTTP_USER_AGENT']); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if ($this->string !== null && $this->loadAgentFile()) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // Check for a specific browser |
| 273 | - return (isset(static::$browsers[ $key ]) && $this->browser === static::$browsers[ $key ]); |
|
| 273 | + return (isset(static::$browsers[$key]) && $this->browser === static::$browsers[$key]); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // -------------------------------------------------------------------- |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // Check for a specific robot |
| 297 | - return (isset(static::$robots[ $key ]) && $this->robot === static::$robots[ $key ]); |
|
| 297 | + return (isset(static::$robots[$key]) && $this->robot === static::$robots[$key]); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // -------------------------------------------------------------------- |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | // Check for a specific robot |
| 321 | - return (isset(static::$mobiles[ $key ]) && $this->mobile === static::$mobiles[ $key ]); |
|
| 321 | + return (isset(static::$mobiles[$key]) && $this->mobile === static::$mobiles[$key]); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // -------------------------------------------------------------------- |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | public function isReferral() |
| 332 | 332 | { |
| 333 | 333 | if ( ! isset($this->referer)) { |
| 334 | - if (empty($_SERVER[ 'HTTP_REFERER' ])) { |
|
| 334 | + if (empty($_SERVER['HTTP_REFERER'])) { |
|
| 335 | 335 | $this->referer = false; |
| 336 | 336 | } else { |
| 337 | - $referer_host = @parse_url($_SERVER[ 'HTTP_REFERER' ], PHP_URL_HOST); |
|
| 337 | + $referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); |
|
| 338 | 338 | $own_host = parse_url(o2system()->config->base_url(), PHP_URL_HOST); |
| 339 | 339 | |
| 340 | 340 | $this->referer = ($referer_host && $referer_host !== $own_host); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | */ |
| 426 | 426 | public function referrer() |
| 427 | 427 | { |
| 428 | - return empty($_SERVER[ 'HTTP_REFERER' ]) ? '' : trim($_SERVER[ 'HTTP_REFERER' ]); |
|
| 428 | + return empty($_SERVER['HTTP_REFERER']) ? '' : trim($_SERVER['HTTP_REFERER']); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // -------------------------------------------------------------------- |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | */ |
| 468 | 468 | protected function setLanguages() |
| 469 | 469 | { |
| 470 | - if ((count($this->languages) === 0) && ! empty($_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ])) { |
|
| 470 | + if ((count($this->languages) === 0) && ! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 471 | 471 | $this->languages = explode( |
| 472 | 472 | ',', |
| 473 | 473 | preg_replace( |
| 474 | 474 | '/(;\s?q=[0-9\.]+)|\s/i', |
| 475 | 475 | '', |
| 476 | - strtolower(trim($_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ])) |
|
| 476 | + strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
| 477 | 477 | ) |
| 478 | 478 | ); |
| 479 | 479 | } |
@@ -521,13 +521,13 @@ discard block |
||
| 521 | 521 | */ |
| 522 | 522 | protected function setCharsets() |
| 523 | 523 | { |
| 524 | - if ((count($this->charsets) === 0) && ! empty($_SERVER[ 'HTTP_ACCEPT_CHARSET' ])) { |
|
| 524 | + if ((count($this->charsets) === 0) && ! empty($_SERVER['HTTP_ACCEPT_CHARSET'])) { |
|
| 525 | 525 | $this->charsets = explode( |
| 526 | 526 | ',', |
| 527 | 527 | preg_replace( |
| 528 | 528 | '/(;\s?q=.+)|\s/i', |
| 529 | 529 | '', |
| 530 | - strtolower(trim($_SERVER[ 'HTTP_ACCEPT_CHARSET' ])) |
|
| 530 | + strtolower(trim($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
| 531 | 531 | ) |
| 532 | 532 | ); |
| 533 | 533 | } |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | foreach (static::$browsers as $key => $val) { |
| 579 | 579 | if (preg_match('|' . $key . '.*?([0-9\.]+)|i', $this->string, $match)) { |
| 580 | 580 | $this->isBrowser = true; |
| 581 | - $this->version = $match[ 1 ]; |
|
| 581 | + $this->version = $match[1]; |
|
| 582 | 582 | $this->browser = $val; |
| 583 | 583 | $this->setMobile(); |
| 584 | 584 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | if (false !== ($key = array_search('download', $segments))) { |
| 48 | 48 | $download = true; |
| 49 | - unset($segments[ $key ]); |
|
| 49 | + unset($segments[$key]); |
|
| 50 | 50 | $segments = array_values($segments); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | |
| 36 | 36 | $viewFilePath = 'error-code'; |
| 37 | 37 | |
| 38 | - if(is_dir(modules()->current()->getDir('Views/errors'))) { |
|
| 39 | - $viewFilePath = 'errors/'.$viewFilePath; |
|
| 38 | + if (is_dir(modules()->current()->getDir('Views/errors'))) { |
|
| 39 | + $viewFilePath = 'errors/' . $viewFilePath; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (presenter()->theme->use === true) { |
@@ -56,24 +56,24 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this->imageFilePath = $this->imageNotFound; |
| 58 | 58 | |
| 59 | - $this->imageSize[ 'width' ] = input()->get('width'); |
|
| 60 | - $this->imageSize[ 'height' ] = input()->get('height'); |
|
| 59 | + $this->imageSize['width'] = input()->get('width'); |
|
| 60 | + $this->imageSize['height'] = input()->get('height'); |
|
| 61 | 61 | $this->imageScale = input()->get('scale'); |
| 62 | 62 | $this->imageQuality = input()->get('quality'); |
| 63 | 63 | $this->imageCrop = input()->get('crop'); |
| 64 | 64 | |
| 65 | 65 | if (false !== ($key = array_search('crop', $segments))) { |
| 66 | 66 | $this->imageCrop = true; |
| 67 | - unset($segments[ $key ]); |
|
| 67 | + unset($segments[$key]); |
|
| 68 | 68 | $segments = array_values($segments); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if (count($segments) == 1) { |
| 72 | 72 | $this->imageFilePath = $this->imagePath . end($segments); |
| 73 | 73 | } elseif (count($segments) >= 2) { |
| 74 | - if (preg_match("/(\d+)(x)(\d+)/", $segments[ count($segments) - 2 ], $matches)) { |
|
| 75 | - $this->imageSize[ 'width' ] = $matches[ 1 ]; |
|
| 76 | - $this->imageSize[ 'height' ] = $matches[ 3 ]; |
|
| 74 | + if (preg_match("/(\d+)(x)(\d+)/", $segments[count($segments) - 2], $matches)) { |
|
| 75 | + $this->imageSize['width'] = $matches[1]; |
|
| 76 | + $this->imageSize['height'] = $matches[3]; |
|
| 77 | 77 | |
| 78 | 78 | if (count($segments) == 2) { |
| 79 | 79 | $this->imageFilePath = $this->imagePath . end($segments); |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | array_slice($segments, 0, |
| 83 | 83 | count($segments) - 2)) . DIRECTORY_SEPARATOR . end($segments); |
| 84 | 84 | } |
| 85 | - } elseif (preg_match("/(\d+)(p)/", $segments[ count($segments) - 2 ], |
|
| 86 | - $matches) or is_numeric($segments[ count($segments) - 2 ]) |
|
| 85 | + } elseif (preg_match("/(\d+)(p)/", $segments[count($segments) - 2], |
|
| 86 | + $matches) or is_numeric($segments[count($segments) - 2]) |
|
| 87 | 87 | ) { |
| 88 | - $this->imageScale = isset($matches[ 1 ]) ? $matches[ 1 ] : $segments[ count($segments) - 2 ]; |
|
| 88 | + $this->imageScale = isset($matches[1]) ? $matches[1] : $segments[count($segments) - 2]; |
|
| 89 | 89 | if (count($segments) == 2) { |
| 90 | 90 | $this->imageFilePath = $this->imagePath . end($segments); |
| 91 | 91 | } else { |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $imageFilePath = $this->imageFilePath; |
| 102 | - $extensions[ 0 ] = pathinfo($imageFilePath, PATHINFO_EXTENSION); |
|
| 102 | + $extensions[0] = pathinfo($imageFilePath, PATHINFO_EXTENSION); |
|
| 103 | 103 | |
| 104 | 104 | for ($i = 0; $i < 2; $i++) { |
| 105 | 105 | $extension = pathinfo($imageFilePath, PATHINFO_EXTENSION); |
| 106 | 106 | |
| 107 | 107 | if ($extension !== '') { |
| 108 | - $extensions[ $i ] = $extension; |
|
| 109 | - $imageFilePath = str_replace('.' . $extensions[ $i ], '', $imageFilePath); |
|
| 108 | + $extensions[$i] = $extension; |
|
| 109 | + $imageFilePath = str_replace('.' . $extensions[$i], '', $imageFilePath); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | 120 | if (count($extensions) == 2) { |
| 121 | - $this->imageFilePath = $imageFilePath . '.' . $extensions[ 1 ]; |
|
| 121 | + $this->imageFilePath = $imageFilePath . '.' . $extensions[1]; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if (array_key_exists($extension = reset($extensions), $mimes)) { |
| 125 | - $this->imageFileMime = $mimes[ $extension ]; |
|
| 125 | + $this->imageFileMime = $mimes[$extension]; |
|
| 126 | 126 | } elseif (array_key_exists($extension = pathinfo($this->imageFilePath, PATHINFO_EXTENSION), $mimes)) { |
| 127 | - $this->imageFileMime = $mimes[ $extension ]; |
|
| 127 | + $this->imageFileMime = $mimes[$extension]; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if ( ! is_file($this->imageFilePath)) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | if ( ! empty($this->imageScale)) { |
| 135 | 135 | $this->scale(); |
| 136 | - } elseif ( ! empty($this->imageSize[ 'width' ]) || ! empty($this->imageSize[ 'height' ])) { |
|
| 136 | + } elseif ( ! empty($this->imageSize['width']) || ! empty($this->imageSize['height'])) { |
|
| 137 | 137 | $this->resize(); |
| 138 | 138 | } else { |
| 139 | 139 | $this->original(); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } else { |
| 210 | 210 | $manipulation = new Manipulation($config); |
| 211 | 211 | $manipulation->setImageFile($this->imageFilePath); |
| 212 | - $manipulation->resizeImage($this->imageSize[ 'width' ], $this->imageSize[ 'height' ], |
|
| 212 | + $manipulation->resizeImage($this->imageSize['width'], $this->imageSize['height'], |
|
| 213 | 213 | (bool)$this->imageCrop); |
| 214 | 214 | $cacheItemPool->save(new Item($cacheImageKey, $manipulation->getBlobImage(), false)); |
| 215 | 215 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $manipulation = new Manipulation($config); |
| 224 | 224 | $manipulation->setImageFile($this->imageFilePath); |
| 225 | - $manipulation->resizeImage($this->imageSize[ 'width' ], $this->imageSize[ 'height' ], (bool)$this->imageCrop); |
|
| 225 | + $manipulation->resizeImage($this->imageSize['width'], $this->imageSize['height'], (bool)$this->imageCrop); |
|
| 226 | 226 | $manipulation->displayImage(intval($this->imageQuality), $this->imageFileMime); |
| 227 | 227 | exit(EXIT_SUCCESS); |
| 228 | 228 | } |