@@ -47,10 +47,10 @@ |
||
| 47 | 47 | { |
| 48 | 48 | global $rootPath; |
| 49 | 49 | |
| 50 | - self::$subfolders = '/' . str_replace('//', '/', str_replace(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), "", $rootPath)); |
|
| 50 | + self::$subfolders = '/'.str_replace('//', '/', str_replace(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), "", $rootPath)); |
|
| 51 | 51 | self::$requestUri = $_SERVER['REQUEST_URI']; |
| 52 | 52 | self::$queryString = $_SERVER['QUERY_STRING']; |
| 53 | - self::$relativeUri = str_replace('?' . self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
| 53 | + self::$relativeUri = str_replace('?'.self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
| 54 | 54 | self::$requestParameters = explode('/', self::$relativeUri); |
| 55 | 55 | |
| 56 | 56 | self::$get = $_GET; |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | private function config() |
| 67 | 67 | { |
| 68 | - $configPath = __DIR__ . '/../../config.json'; |
|
| 68 | + $configPath = __DIR__.'/../../config.json'; |
|
| 69 | 69 | if (realpath($configPath) !== false) { |
| 70 | 70 | $json = file_get_contents($configPath); |
| 71 | 71 | $this->config = json_decode($json); |
| 72 | 72 | } else { |
| 73 | - throw new \Exception('Couldn\'t find config file in path ' . $configPath); |
|
| 73 | + throw new \Exception('Couldn\'t find config file in path '.$configPath); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | private function sitemapMatching($request) |
| 94 | 94 | { |
| 95 | 95 | $sitemap = $this->storage->getSitemap(); |
| 96 | - $relativeUri = '/' . $request::$relativeUri; |
|
| 96 | + $relativeUri = '/'.$request::$relativeUri; |
|
| 97 | 97 | |
| 98 | 98 | foreach ($sitemap as $sitemapItem) { |
| 99 | 99 | if ($sitemapItem->regex) { |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | * @return mixed |
| 154 | 154 | * @throws \Exception |
| 155 | 155 | */ |
| 156 | - private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
|
| 156 | + private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) |
|
| 157 | 157 | { |
| 158 | - $libraryComponentName = '\\library\\components\\' . $class; |
|
| 159 | - $userComponentName = '\\components\\' . $class; |
|
| 158 | + $libraryComponentName = '\\library\\components\\'.$class; |
|
| 159 | + $userComponentName = '\\components\\'.$class; |
|
| 160 | 160 | |
| 161 | 161 | if (\autoLoad($libraryComponentName, false)) { |
| 162 | 162 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
| 163 | 163 | } elseif (\autoLoad($userComponentName, false)) { |
| 164 | 164 | $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
| 165 | 165 | } else { |
| 166 | - throw new \Exception('Could not load component ' . $class); |
|
| 166 | + throw new \Exception('Could not load component '.$class); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | if (!$component instanceof Component) { |
@@ -62,8 +62,8 @@ |
||
| 62 | 62 | |
| 63 | 63 | // Preserve transparency |
| 64 | 64 | imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); |
| 65 | - imagealphablending($new, false); |
|
| 66 | - imagesavealpha($new, true); |
|
| 65 | + imagealphablending($new, false); |
|
| 66 | + imagesavealpha($new, true); |
|
| 67 | 67 | |
| 68 | 68 | imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight); |
| 69 | 69 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | return $returnFileNames; |
| 49 | 49 | } else { |
| 50 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 50 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * @return string |
| 59 | 59 | * @throws \Exception |
| 60 | 60 | */ |
| 61 | - public function resize($imagePath='', $width='',$height='') |
|
| 61 | + public function resize($imagePath = '', $width = '', $height = '') |
|
| 62 | 62 | { |
| 63 | - $modifier = '-r' . $width . 'x' . $height; |
|
| 63 | + $modifier = '-r'.$width.'x'.$height; |
|
| 64 | 64 | $destination = $this->modifyName($imagePath, $modifier); |
| 65 | 65 | if (file_exists($imagePath)) { |
| 66 | 66 | $image = new Image(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
| 75 | 75 | return basename($destination); |
| 76 | 76 | } else { |
| 77 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 77 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @return string |
| 86 | 86 | * @throws \Exception |
| 87 | 87 | */ |
| 88 | - public function smartcrop($imagePath='', $width='',$height='') |
|
| 88 | + public function smartcrop($imagePath = '', $width = '', $height = '') |
|
| 89 | 89 | { |
| 90 | - $modifier = '-s' . $width . 'x' . $height; |
|
| 90 | + $modifier = '-s'.$width.'x'.$height; |
|
| 91 | 91 | $destination = $this->modifyName($imagePath, $modifier); |
| 92 | 92 | if (file_exists($imagePath)) { |
| 93 | 93 | $image = new Image(); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
| 102 | 102 | return basename($destination); |
| 103 | 103 | } else { |
| 104 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 104 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | * @return string |
| 113 | 113 | * @throws \Exception |
| 114 | 114 | */ |
| 115 | - public function boxcrop($imagePath='', $width='',$height='') |
|
| 115 | + public function boxcrop($imagePath = '', $width = '', $height = '') |
|
| 116 | 116 | { |
| 117 | - $modifier = '-b' . $width . 'x' . $height; |
|
| 117 | + $modifier = '-b'.$width.'x'.$height; |
|
| 118 | 118 | $destination = $this->modifyName($imagePath, $modifier); |
| 119 | 119 | if (file_exists($imagePath)) { |
| 120 | 120 | $image = new Image(); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
| 129 | 129 | return basename($destination); |
| 130 | 130 | } else { |
| 131 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
| 131 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @return string |
| 140 | 140 | */ |
| 141 | - private function modifyName($imagePath, $modifier='') |
|
| 141 | + private function modifyName($imagePath, $modifier = '') |
|
| 142 | 142 | { |
| 143 | 143 | $filename = basename($imagePath); |
| 144 | 144 | $path = dirname($imagePath); |
@@ -148,25 +148,25 @@ discard block |
||
| 148 | 148 | array_pop($fileParts); |
| 149 | 149 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 150 | 150 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
| 151 | - $filename = $fileNameWithoutExtension . $modifier . '.' . $extension; |
|
| 151 | + $filename = $fileNameWithoutExtension.$modifier.'.'.$extension; |
|
| 152 | 152 | } else { |
| 153 | 153 | $filename = slugify($filename); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (file_exists($path . '/' . $filename)) { |
|
| 156 | + if (file_exists($path.'/'.$filename)) { |
|
| 157 | 157 | $fileParts = explode('.', $filename); |
| 158 | 158 | if (count($fileParts) > 1) { |
| 159 | 159 | $extension = end($fileParts); |
| 160 | 160 | array_pop($fileParts); |
| 161 | 161 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 162 | 162 | $fileNameWithoutExtension .= '-copy'; |
| 163 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 163 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 164 | 164 | } else { |
| 165 | 165 | $filename .= '-copy'; |
| 166 | 166 | } |
| 167 | - return $this->modifyName($path . '/' . $filename); |
|
| 167 | + return $this->modifyName($path.'/'.$filename); |
|
| 168 | 168 | } |
| 169 | - return $path . '/' . $filename; |
|
| 169 | + return $path.'/'.$filename; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | \ No newline at end of file |