@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | /** |
| 331 | 331 | * Convert path to indeces |
| 332 | 332 | * |
| 333 | - * @param $path |
|
| 333 | + * @param string $path |
|
| 334 | 334 | * |
| 335 | 335 | * @return array |
| 336 | 336 | * @throws \Exception |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | * |
| 584 | 584 | */ |
| 585 | 585 | /** |
| 586 | - * @return array |
|
| 586 | + * @return \stdClass[] |
|
| 587 | 587 | */ |
| 588 | 588 | public function getBricks() |
| 589 | 589 | { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | private function config() |
| 59 | 59 | { |
| 60 | - $storagePath = __DIR__ . '/../../' . $this->storageDir; |
|
| 60 | + $storagePath = __DIR__.'/../../'.$this->storageDir; |
|
| 61 | 61 | if (realpath($storagePath) === false) { |
| 62 | 62 | initFramework(); |
| 63 | 63 | if (Repository::create($storagePath)) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $repository->init(); |
| 66 | 66 | $this->repository = $repository; |
| 67 | 67 | } else { |
| 68 | - throw new \Exception('Could not create repository directory: ' . $storagePath); |
|
| 68 | + throw new \Exception('Could not create repository directory: '.$storagePath); |
|
| 69 | 69 | } |
| 70 | 70 | } else { |
| 71 | 71 | $this->repository = new Repository($storagePath); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function getDocumentBySlug($slug) |
| 230 | 230 | { |
| 231 | - $path = '/' . $slug; |
|
| 231 | + $path = '/'.$slug; |
|
| 232 | 232 | |
| 233 | 233 | return $this->repository->getDocumentByPath($path); |
| 234 | 234 | } |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function saveDocument($postValues) |
| 240 | 240 | { |
| 241 | - $oldPath = '/' . $postValues['path']; |
|
| 241 | + $oldPath = '/'.$postValues['path']; |
|
| 242 | 242 | |
| 243 | 243 | $container = $this->getDocumentContainerByPath($oldPath); |
| 244 | 244 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this); |
| 245 | 245 | if ($container->path === '/') { |
| 246 | - $newPath = $container->path . $documentObject->slug; |
|
| 246 | + $newPath = $container->path.$documentObject->slug; |
|
| 247 | 247 | } else { |
| 248 | - $newPath = $container->path . '/' . $documentObject->slug; |
|
| 248 | + $newPath = $container->path.'/'.$documentObject->slug; |
|
| 249 | 249 | } |
| 250 | 250 | $documentObject->path = $newPath; |
| 251 | 251 | $this->repository->saveDocument($documentObject); |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this); |
| 257 | 257 | if ($postValues['path'] === '/') { |
| 258 | - $documentObject->path = $postValues['path'] . $documentObject->slug; |
|
| 258 | + $documentObject->path = $postValues['path'].$documentObject->slug; |
|
| 259 | 259 | } else { |
| 260 | - $documentObject->path = $postValues['path'] . '/' . $documentObject->slug; |
|
| 260 | + $documentObject->path = $postValues['path'].'/'.$documentObject->slug; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $this->repository->saveDocument($documentObject); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | public function deleteDocumentBySlug($slug) |
| 267 | 267 | { |
| 268 | - $path = '/' . $slug; |
|
| 268 | + $path = '/'.$slug; |
|
| 269 | 269 | $this->repository->deleteDocumentByPath($path); |
| 270 | 270 | } |
| 271 | 271 | |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | { |
| 281 | 281 | $documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues); |
| 282 | 282 | if ($postValues['path'] === '/') { |
| 283 | - $documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug; |
|
| 283 | + $documentFolderObject->path = $postValues['path'].$documentFolderObject->slug; |
|
| 284 | 284 | } else { |
| 285 | - $documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug; |
|
| 285 | + $documentFolderObject->path = $postValues['path'].'/'.$documentFolderObject->slug; |
|
| 286 | 286 | } |
| 287 | 287 | $this->repository->saveDocument($documentFolderObject); |
| 288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | public function deleteDocumentFolderBySlug($slug) |
| 298 | 298 | { |
| 299 | - $path = '/' . $slug; |
|
| 299 | + $path = '/'.$slug; |
|
| 300 | 300 | $this->repository->deleteDocumentByPath($path); |
| 301 | 301 | } |
| 302 | 302 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function getDocumentFolderBySlug($slug) |
| 312 | 312 | { |
| 313 | - $path = '/' . $slug; |
|
| 313 | + $path = '/'.$slug; |
|
| 314 | 314 | |
| 315 | 315 | return $this->repository->getDocumentByPath($path); |
| 316 | 316 | } |
@@ -407,13 +407,13 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | public function addFile($postValues) |
| 409 | 409 | { |
| 410 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
| 410 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
| 411 | 411 | |
| 412 | 412 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
| 413 | - $destination = $destinationPath . '/' . $filename; |
|
| 413 | + $destination = $destinationPath.'/'.$filename; |
|
| 414 | 414 | |
| 415 | 415 | if ($postValues['error'] != '0') { |
| 416 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
| 416 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | public function deleteFileByName($filename) |
| 457 | 457 | { |
| 458 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
| 459 | - $destination = $destinationPath . '/' . $filename; |
|
| 458 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
| 459 | + $destination = $destinationPath.'/'.$filename; |
|
| 460 | 460 | |
| 461 | 461 | if (file_exists($destination)) { |
| 462 | 462 | $files = $this->getFiles(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_IMAGES); |
| 65 | 65 | if (isset($_FILES[CmsComponent::FILES_PARAMETER_FILE])) { |
| 66 | 66 | $cmsComponent->storage->getImages()->addImage($_FILES[CmsComponent::FILES_PARAMETER_FILE]); |
| 67 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/images'); |
|
| 67 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/images'); |
|
| 68 | 68 | exit; |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | private function deleteRoute($request, $cmsComponent) |
| 77 | 77 | { |
| 78 | 78 | $cmsComponent->storage->getImages()->deleteImageByName($request::$get[CmsComponent::FILES_PARAMETER_FILE]); |
| 79 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/images'); |
|
| 79 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/images'); |
|
| 80 | 80 | exit; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $imageSet = $cmsComponent->storage->getImageSet()->getImageSetBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
| 57 | 57 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE])) { |
| 58 | 58 | $cmsComponent->storage->getImageSet()->saveImageSet($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post); |
| 59 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/image-set'); |
|
| 59 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/image-set'); |
|
| 60 | 60 | exit; |
| 61 | 61 | } |
| 62 | 62 | $cmsComponent->setParameter(CmsComponent::PARAMETER_IMAGE_SET, $imageSet); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_CONFIGURATION); |
| 73 | 73 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE])) { |
| 74 | 74 | $cmsComponent->storage->getImageSet()->addImageSet($request::$post); |
| 75 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/image-set'); |
|
| 75 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/image-set'); |
|
| 76 | 76 | exit; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | private function deleteRoute($request, $cmsComponent) |
| 85 | 85 | { |
| 86 | 86 | $cmsComponent->storage->getImageSet()->deleteImageSetBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
| 87 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/image-set'); |
|
| 87 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/image-set'); |
|
| 88 | 88 | exit; |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |
@@ -35,19 +35,19 @@ |
||
| 35 | 35 | array_pop($fileParts); |
| 36 | 36 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 37 | 37 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
| 38 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 38 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 39 | 39 | } else { |
| 40 | 40 | $filename = slugify($filename); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (file_exists($path . '/' . $filename)) { |
|
| 43 | + if (file_exists($path.'/'.$filename)) { |
|
| 44 | 44 | $fileParts = explode('.', $filename); |
| 45 | 45 | if (count($fileParts) > 1) { |
| 46 | 46 | $extension = end($fileParts); |
| 47 | 47 | array_pop($fileParts); |
| 48 | 48 | $fileNameWithoutExtension = implode('-', $fileParts); |
| 49 | 49 | $fileNameWithoutExtension .= '-copy'; |
| 50 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
| 50 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
| 51 | 51 | } else { |
| 52 | 52 | $filename .= '-copy'; |
| 53 | 53 | } |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function addImage($postValues) |
| 35 | 35 | { |
| 36 | - $destinationPath = realpath(__DIR__ . '/../../../www/images/'); |
|
| 36 | + $destinationPath = realpath(__DIR__.'/../../../www/images/'); |
|
| 37 | 37 | |
| 38 | 38 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
| 39 | - $destination = $destinationPath . '/' . $filename; |
|
| 39 | + $destination = $destinationPath.'/'.$filename; |
|
| 40 | 40 | |
| 41 | 41 | if ($postValues['error'] != '0') { |
| 42 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
| 42 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function deleteImageByName($filename) |
| 66 | 66 | { |
| 67 | - $destinationPath = realpath(__DIR__ . '/../../../www/images/'); |
|
| 67 | + $destinationPath = realpath(__DIR__.'/../../../www/images/'); |
|
| 68 | 68 | |
| 69 | 69 | $images = $this->getImages(); |
| 70 | 70 | |
| 71 | 71 | foreach ($images as $key => $image) { |
| 72 | 72 | if ($image->file == $filename) { |
| 73 | 73 | foreach ($image->set as $imageSetFilename) { |
| 74 | - $destination = $destinationPath . '/' . $imageSetFilename; |
|
| 74 | + $destination = $destinationPath.'/'.$imageSetFilename; |
|
| 75 | 75 | if (file_exists($destination)) { |
| 76 | 76 | unlink($destination); |
| 77 | 77 | } else { |