@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function config() |
65 | 65 | { |
66 | - $configPath = __DIR__ . '/../../config.json'; |
|
66 | + $configPath = __DIR__.'/../../config.json'; |
|
67 | 67 | if (realpath($configPath) !== false) { |
68 | 68 | $json = file_get_contents($configPath); |
69 | 69 | $this->config = json_decode($json); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | private function sitemapMatching($request) |
91 | 91 | { |
92 | 92 | $sitemap = $this->storage->getSitemap()->getSitemap(); |
93 | - $relativeUri = '/' . $request::$relativeUri; |
|
93 | + $relativeUri = '/'.$request::$relativeUri; |
|
94 | 94 | |
95 | 95 | foreach ($sitemap as $sitemapItem) { |
96 | 96 | 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 (AutoloadUtil::autoLoad($libraryComponentName, false)) { |
162 | 162 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
163 | 163 | } elseif (AutoloadUtil::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) { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | public function setCachingHeaders() |
223 | 223 | { |
224 | 224 | header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days |
225 | - header("Cache-Control: max-age=" . (60 * 60 * 24 * 2)); |
|
225 | + header("Cache-Control: max-age=".(60 * 60 * 24 * 2)); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -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 |
@@ -13,26 +13,26 @@ |
||
13 | 13 | class ImagesRouting implements CmsRouting |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * ImagesRouting constructor. |
|
18 | - * @param \library\cc\Request $request |
|
19 | - * @param mixed|string $relativeCmsUri |
|
20 | - * @param CmsComponent $cmsComponent |
|
21 | - */ |
|
22 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
23 | - { |
|
24 | - if ($relativeCmsUri == '/images') { |
|
16 | + /** |
|
17 | + * ImagesRouting constructor. |
|
18 | + * @param \library\cc\Request $request |
|
19 | + * @param mixed|string $relativeCmsUri |
|
20 | + * @param CmsComponent $cmsComponent |
|
21 | + */ |
|
22 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
23 | + { |
|
24 | + if ($relativeCmsUri == '/images') { |
|
25 | 25 | $this->overviewRoute($cmsComponent); |
26 | - } elseif ($relativeCmsUri == '/images.json') { |
|
26 | + } elseif ($relativeCmsUri == '/images.json') { |
|
27 | 27 | $this->jsonRoute($cmsComponent); |
28 | - } elseif ($relativeCmsUri == '/images/new') { |
|
28 | + } elseif ($relativeCmsUri == '/images/new') { |
|
29 | 29 | $this->newRoute($request, $cmsComponent); |
30 | - } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
30 | + } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
31 | 31 | $this->deleteRoute($request, $cmsComponent); |
32 | - } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
32 | + } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
33 | 33 | $this->showRoute($request, $cmsComponent); |
34 | - } |
|
35 | - } |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @param CmsComponent $cmsComponent |
@@ -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 |
@@ -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 { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param $request |
|
71 | + * @param Request $request |
|
72 | 72 | * @param CmsComponent $cmsComponent |
73 | 73 | */ |
74 | 74 | private function newRoute($request, $cmsComponent) |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * @param $request |
|
86 | + * @param Request $request |
|
87 | 87 | * @param CmsComponent $cmsComponent |
88 | 88 | */ |
89 | 89 | private function deleteRoute($request, $cmsComponent) |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | private function downloadRoute($slug, $cmsComponent) |
40 | 40 | { |
41 | 41 | $file = $cmsComponent->storage->getFiles()->getFileByName($slug); |
42 | - $path = realpath(__DIR__ . '/../../../www/files/'); |
|
43 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
44 | - $size = filesize($path . '/' . $file->file); |
|
42 | + $path = realpath(__DIR__.'/../../../www/files/'); |
|
43 | + $quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\')); |
|
44 | + $size = filesize($path.'/'.$file->file); |
|
45 | 45 | |
46 | 46 | header('Content-Description: File Transfer'); |
47 | - header('Content-Type: ' . $file->type); |
|
48 | - header('Content-Disposition: attachment; filename=' . $quoted); |
|
47 | + header('Content-Type: '.$file->type); |
|
48 | + header('Content-Disposition: attachment; filename='.$quoted); |
|
49 | 49 | header('Content-Transfer-Encoding: binary'); |
50 | 50 | header('Connection: Keep-Alive'); |
51 | 51 | header('Expires: 0'); |
52 | 52 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
53 | 53 | header('Pragma: public'); |
54 | - header('Content-Length: ' . $size); |
|
54 | + header('Content-Length: '.$size); |
|
55 | 55 | |
56 | - readfile($path . '/' . $file->file); |
|
56 | + readfile($path.'/'.$file->file); |
|
57 | 57 | exit; |
58 | 58 | } |
59 | 59 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_FILES); |
78 | 78 | if (isset($_FILES[CmsComponent::FILES_PARAMETER_FILE])) { |
79 | 79 | $cmsComponent->storage->getFiles()->addFile($_FILES[CmsComponent::FILES_PARAMETER_FILE]); |
80 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
80 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function deleteRoute($request, $cmsComponent) |
90 | 90 | { |
91 | 91 | $cmsComponent->storage->getFiles()->deleteFileByName($request::$get[CmsComponent::FILES_PARAMETER_FILE]); |
92 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
92 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
93 | 93 | exit; |
94 | 94 | } |
95 | 95 |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function addFile($postValues) |
27 | 27 | { |
28 | - $destinationPath = realpath(__DIR__ . '/../../../www/files/'); |
|
28 | + $destinationPath = realpath(__DIR__.'/../../../www/files/'); |
|
29 | 29 | |
30 | 30 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
31 | - $destination = $destinationPath . '/' . $filename; |
|
31 | + $destination = $destinationPath.'/'.$filename; |
|
32 | 32 | |
33 | 33 | if ($postValues['error'] != '0') { |
34 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
34 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function deleteFileByName($filename) |
75 | 75 | { |
76 | - $destinationPath = realpath(__DIR__ . '/../../../www/files/'); |
|
77 | - $destination = $destinationPath . '/' . $filename; |
|
76 | + $destinationPath = realpath(__DIR__.'/../../../www/files/'); |
|
77 | + $destination = $destinationPath.'/'.$filename; |
|
78 | 78 | |
79 | 79 | if (file_exists($destination)) { |
80 | 80 | $files = $this->getFiles(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_CONFIGURATION); |
57 | 57 | if (isset($request::$post[CmsComponent::POST_PARAMETER_USERNAME])) { |
58 | 58 | $cmsComponent->storage->getUsers()->addUser($request::$post); |
59 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/users'); |
|
59 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/users'); |
|
60 | 60 | exit; |
61 | 61 | } |
62 | 62 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | private function deleteRoute($request, $cmsComponent) |
69 | 69 | { |
70 | 70 | $cmsComponent->storage->getUsers()->deleteUserBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
71 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/users'); |
|
71 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/users'); |
|
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $cmsComponent->setParameter(CmsComponent::PARAMETER_USER, $cmsComponent->storage->getUsers()->getUserBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG])); |
84 | 84 | if (isset($_POST[CmsComponent::POST_PARAMETER_USERNAME])) { |
85 | 85 | $cmsComponent->storage->getUsers()->saveUser($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post); |
86 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/users'); |
|
86 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/users'); |
|
87 | 87 | exit; |
88 | 88 | } |
89 | 89 | } |
@@ -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 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
34 | - * @param $request |
|
35 | - * @param $relativeCmsUri |
|
34 | + * @param \library\cc\Request $request |
|
35 | + * @param string $relativeCmsUri |
|
36 | 36 | * @param CmsComponent $cmsComponent |
37 | 37 | * @throws \Exception |
38 | 38 | */ |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * @param $request |
|
54 | - * @param $relativeCmsUri |
|
53 | + * @param \library\cc\Request $request |
|
54 | + * @param string $relativeCmsUri |
|
55 | 55 | * @param CmsComponent $cmsComponent |
56 | 56 | */ |
57 | 57 | private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
@@ -12,58 +12,58 @@ |
||
12 | 12 | |
13 | 13 | class DocumentRouting implements CmsRouting |
14 | 14 | { |
15 | - /** |
|
16 | - * DocumentRouting constructor. |
|
17 | - * @param $request |
|
18 | - * @param $relativeCmsUri |
|
19 | - * @param CmsComponent $cmsComponent |
|
20 | - */ |
|
21 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
22 | - { |
|
23 | - if ($relativeCmsUri == '/documents') { |
|
24 | - $cmsComponent->subTemplate = 'cms/documents'; |
|
25 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENTS, $cmsComponent->storage->getDocuments()->getDocuments()); |
|
26 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
|
27 | - } |
|
28 | - $this->documentRouting($request, $relativeCmsUri, $cmsComponent); |
|
29 | - $this->folderRouting($request, $relativeCmsUri, $cmsComponent); |
|
30 | - } |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @param $request |
|
35 | - * @param $relativeCmsUri |
|
36 | - * @param CmsComponent $cmsComponent |
|
37 | - * @throws \Exception |
|
38 | - */ |
|
39 | - private function documentRouting($request, $relativeCmsUri, $cmsComponent) |
|
40 | - { |
|
41 | - if ($relativeCmsUri == '/documents/new-document' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
15 | + /** |
|
16 | + * DocumentRouting constructor. |
|
17 | + * @param $request |
|
18 | + * @param $relativeCmsUri |
|
19 | + * @param CmsComponent $cmsComponent |
|
20 | + */ |
|
21 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
22 | + { |
|
23 | + if ($relativeCmsUri == '/documents') { |
|
24 | + $cmsComponent->subTemplate = 'cms/documents'; |
|
25 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENTS, $cmsComponent->storage->getDocuments()->getDocuments()); |
|
26 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
|
27 | + } |
|
28 | + $this->documentRouting($request, $relativeCmsUri, $cmsComponent); |
|
29 | + $this->folderRouting($request, $relativeCmsUri, $cmsComponent); |
|
30 | + } |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @param $request |
|
35 | + * @param $relativeCmsUri |
|
36 | + * @param CmsComponent $cmsComponent |
|
37 | + * @throws \Exception |
|
38 | + */ |
|
39 | + private function documentRouting($request, $relativeCmsUri, $cmsComponent) |
|
40 | + { |
|
41 | + if ($relativeCmsUri == '/documents/new-document' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
42 | 42 | $this->documentOverviewRoute($request, $cmsComponent); |
43 | - } elseif ($relativeCmsUri == '/documents/edit-document' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
43 | + } elseif ($relativeCmsUri == '/documents/edit-document' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
44 | 44 | $this->editDocumentRoute($request, $cmsComponent); |
45 | - } elseif ($relativeCmsUri == '/documents/get-brick' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
45 | + } elseif ($relativeCmsUri == '/documents/get-brick' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
46 | 46 | $this->getBrickRoute($request, $cmsComponent); |
47 | - } else if ($relativeCmsUri == '/documents/delete-document' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
47 | + } else if ($relativeCmsUri == '/documents/delete-document' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
48 | 48 | $this->deleteDocumentRoute($request, $cmsComponent); |
49 | - } |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @param $request |
|
54 | - * @param $relativeCmsUri |
|
55 | - * @param CmsComponent $cmsComponent |
|
56 | - */ |
|
57 | - private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
|
58 | - { |
|
59 | - if ($relativeCmsUri == '/documents/new-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
49 | + } |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @param $request |
|
54 | + * @param $relativeCmsUri |
|
55 | + * @param CmsComponent $cmsComponent |
|
56 | + */ |
|
57 | + private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
|
58 | + { |
|
59 | + if ($relativeCmsUri == '/documents/new-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
60 | 60 | $this->newFolderRoute($request, $cmsComponent); |
61 | - } else if ($relativeCmsUri == '/documents/edit-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
61 | + } else if ($relativeCmsUri == '/documents/edit-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
62 | 62 | $this->editFolderRoute($request, $cmsComponent); |
63 | - } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
63 | + } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
64 | 64 | $this->deleteFolderRoute($request, $cmsComponent); |
65 | - } |
|
66 | - } |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @param $request |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (isset($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE])) { |
80 | 80 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], $request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
81 | 81 | $cmsComponent->storage->getDocuments()->addDocument($request::$post); |
82 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
82 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
83 | 83 | exit; |
84 | 84 | } |
85 | 85 | $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPE, $cmsComponent->storage->getDocumentTypeBySlug($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], true)); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } else { |
88 | 88 | $documentTypes = $cmsComponent->storage->getDocumentTypes(); |
89 | 89 | if (count($documentTypes) < 1) { |
90 | - throw new \Exception('No Document Types defined yet. <a href="' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/configuration/document-types/new">Please do so first.</a>'); |
|
90 | + throw new \Exception('No Document Types defined yet. <a href="'.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/configuration/document-types/new">Please do so first.</a>'); |
|
91 | 91 | } |
92 | 92 | $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPES, $documentTypes); |
93 | 93 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $cmsComponent->setParameter(CmsComponent::PARAMETER_SMALLEST_IMAGE, $cmsComponent->storage->getImageSet()->getSmallestImageSet()->slug); |
105 | 105 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
106 | 106 | $cmsComponent->storage->getDocuments()->saveDocument($request::$post); |
107 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
107 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
108 | 108 | exit; |
109 | 109 | } |
110 | 110 | $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT, $cmsComponent->storage->getDocuments()->getDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG])); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | private function deleteDocumentRoute($request, $cmsComponent) |
142 | 142 | { |
143 | 143 | $cmsComponent->storage->getDocuments()->deleteDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
144 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
144 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
145 | 145 | exit; |
146 | 146 | } |
147 | 147 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
156 | 156 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::GET_PARAMETER_PATH])) { |
157 | 157 | $cmsComponent->storage->addDocumentFolder($request::$post); |
158 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
158 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
159 | 159 | exit; |
160 | 160 | } |
161 | 161 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | array_pop($path); |
175 | 175 | $path = implode('/', $path); |
176 | 176 | |
177 | - $request::$get[CmsComponent::GET_PARAMETER_PATH] = '/' . $path; |
|
177 | + $request::$get[CmsComponent::GET_PARAMETER_PATH] = '/'.$path; |
|
178 | 178 | |
179 | 179 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post['content'])) { |
180 | 180 | $cmsComponent->storage->saveDocumentFolder($request::$post); |
181 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
181 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
182 | 182 | exit; |
183 | 183 | } |
184 | 184 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | private function deleteFolderRoute($request, $cmsComponent) |
194 | 194 | { |
195 | 195 | $cmsComponent->storage->deleteDocumentFolderBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
196 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
196 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
197 | 197 | exit; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | \ No newline at end of file |