@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | <div class="documentActions grid-box-2"> |
22 | 22 | <? if ($document->state == 'unpublished' || $document->unpublishedChanges) : ?> |
23 | 23 | <?renderAction('Publish', |
24 | - 'publish', |
|
25 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . $slugPrefix . $document->slug, |
|
26 | - 'check');?> |
|
24 | + 'publish', |
|
25 | + \library\cc\Request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . $slugPrefix . $document->slug, |
|
26 | + 'check');?> |
|
27 | 27 | <? endif ?> |
28 | 28 | <? if ($document->state == 'published') : ?> |
29 | 29 | <?renderAction('Unpublish', |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'error', |
41 | 41 | \library\cc\Request::$subfolders . $cmsPrefix . '/documents/delete-document?slug=' . $slugPrefix . $document->slug, |
42 | 42 | 'trash', |
43 | - 'return confirm(\'Are you sure you want to delete this document?\');');?> |
|
43 | + 'return confirm(\'Are you sure you want to delete this document?\');');?> |
|
44 | 44 | <? endif ?> |
45 | 45 | </div> |
46 | 46 | <?}?> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?> |
8 | 8 | <div class="grid-box-10"> |
9 | 9 | <h3> |
10 | - <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"> |
|
10 | + <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"> |
|
11 | 11 | <i class="fa fa-file-text-o"></i> |
12 | 12 | <small class="state <?=strtolower($document->state)?>"><i class="fa <?=$document->state == 'published' ? 'fa-check-circle-o' : 'fa-times-circle-o' ?>"></i></small> |
13 | 13 | <?=$document->title?> |
@@ -28,25 +28,25 @@ discard block |
||
28 | 28 | <? if ($document->state == 'unpublished' || $document->unpublishedChanges) : ?> |
29 | 29 | <?renderAction('Publish', |
30 | 30 | 'publish', |
31 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . $slugPrefix . $document->slug, |
|
32 | - 'check');?> |
|
31 | + \library\cc\Request::$subfolders.$cmsPrefix.'/documents/publish-document?slug='.$slugPrefix.$document->slug, |
|
32 | + 'check'); ?> |
|
33 | 33 | <? endif ?> |
34 | 34 | <? if ($document->state == 'published') : ?> |
35 | 35 | <?renderAction('Unpublish', |
36 | 36 | 'unpublish', |
37 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/unpublish-document?slug=' . $slugPrefix . $document->slug, |
|
38 | - 'times');?> |
|
37 | + \library\cc\Request::$subfolders.$cmsPrefix.'/documents/unpublish-document?slug='.$slugPrefix.$document->slug, |
|
38 | + 'times'); ?> |
|
39 | 39 | <? endif ?> |
40 | 40 | <?renderAction('Edit', |
41 | 41 | '', |
42 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/edit-document?slug=' . $slugPrefix . $document->slug, |
|
43 | - 'pencil');?> |
|
42 | + \library\cc\Request::$subfolders.$cmsPrefix.'/documents/edit-document?slug='.$slugPrefix.$document->slug, |
|
43 | + 'pencil'); ?> |
|
44 | 44 | <? if ($document->state == 'unpublished') : ?> |
45 | 45 | <?renderAction('Delete', |
46 | 46 | 'error', |
47 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/delete-document?slug=' . $slugPrefix . $document->slug, |
|
47 | + \library\cc\Request::$subfolders.$cmsPrefix.'/documents/delete-document?slug='.$slugPrefix.$document->slug, |
|
48 | 48 | 'trash', |
49 | - 'return confirm(\'Are you sure you want to delete this document?\');');?> |
|
49 | + 'return confirm(\'Are you sure you want to delete this document?\');'); ?> |
|
50 | 50 | <? endif ?> |
51 | 51 | </div> |
52 | 52 | <?}?> |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | </div> |
5 | 5 | <label><?=$brick->title?></label> |
6 | 6 | <?if ($static == true) { |
7 | - $fieldPrefix = 'bricks[' . $myBrickSlug . '][' . str_replace('.', '', str_replace(' ', '', microtime())) . '][fields]'; |
|
7 | + $fieldPrefix = 'bricks['.$myBrickSlug.']['.str_replace('.', '', str_replace(' ', '', microtime())).'][fields]'; |
|
8 | 8 | } else { |
9 | - $fieldPrefix = 'dynamicBricks[' . $brick->slug . '][' . str_replace('.', '', str_replace(' ', '', microtime())) . ']'; |
|
9 | + $fieldPrefix = 'dynamicBricks['.$brick->slug.']['.str_replace('.', '', str_replace(' ', '', microtime())).']'; |
|
10 | 10 | }?> |
11 | 11 | <? foreach ($brick->fields as $field) : ?> |
12 | 12 | <div class="form-element"> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
32 | 32 | <div class="form-element"> |
33 | 33 | <? endif ?> |
34 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
34 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
35 | 35 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
36 | 36 | |
37 | 37 | </div> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | <li class="grid-container"> |
54 | 54 | <div class="grid-box-10"> |
55 | 55 | <div class="grid-inner form-element"> |
56 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
56 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | <div class="grid-box-2"> |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | </div> |
64 | 64 | </div> |
65 | 65 | </li> |
66 | - <?$value='';?> |
|
66 | + <?$value = ''; ?> |
|
67 | 67 | <? endforeach ?> |
68 | 68 | <? endif ?> |
69 | 69 | </ul> |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | <a class="btn error js-deletemultiple"><i class="fa fa-trash"></i></a> |
81 | 81 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
82 | 82 | <div class="form-element"> |
83 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
83 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
84 | 84 | </div> |
85 | 85 | </li> |
86 | - <?$value='';?> |
|
86 | + <?$value = ''; ?> |
|
87 | 87 | <? endforeach ?> |
88 | 88 | <? endif ?> |
89 | 89 | </div> |
@@ -92,5 +92,5 @@ discard block |
||
92 | 92 | <a class="btn js-addrtemultiple">+</a> |
93 | 93 | <? endif ?> |
94 | 94 | </div> |
95 | - <?$value='';?> |
|
95 | + <?$value = ''; ?> |
|
96 | 96 | <? endforeach ?> |
@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | * @param string $slugPrefix |
6 | 6 | * @param bool $root |
7 | 7 | */ |
8 | -function renderFolder($document, $cmsPrefix, $slugPrefix ='', $root = false) {?> |
|
8 | +function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false) {?> |
|
9 | 9 | <div class="grid-box-8"> |
10 | 10 | <h3> |
11 | - <a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix . $document->slug?>" title="Open"> |
|
11 | + <a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix.$document->slug?>" title="Open"> |
|
12 | 12 | <i class="fa fa-folder-o "></i> <?=$document->title?> |
13 | 13 | </a> |
14 | 14 | </h3> |
@@ -16,21 +16,21 @@ discard block |
||
16 | 16 | <div class="documentActions grid-box-4"> |
17 | 17 | <?renderAction('Edit', |
18 | 18 | '', |
19 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug, |
|
20 | - 'pencil');?> |
|
19 | + \library\cc\Request::$subfolders.$cmsPrefix.'/documents/edit-folder?slug='.$slugPrefix.$document->slug, |
|
20 | + 'pencil'); ?> |
|
21 | 21 | <?renderAction('Delete', |
22 | 22 | 'error', |
23 | - \library\cc\Request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug, |
|
23 | + \library\cc\Request::$subfolders.$cmsPrefix.'/documents/delete-folder?slug='.$slugPrefix.$document->slug, |
|
24 | 24 | 'trash', |
25 | - 'return confirm(\'Are you sure you want to delete this document?\');');?> |
|
25 | + 'return confirm(\'Are you sure you want to delete this document?\');'); ?> |
|
26 | 26 | </div> |
27 | 27 | <ul class="documents grid-wrapper nested<?=$root ? ' root' : '' ?>"> |
28 | 28 | <? foreach ($document->content as $subDocument) : ?> |
29 | 29 | <li class="grid-container"> |
30 | 30 | <? if ($subDocument->type == 'document') : ?> |
31 | - <?renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?> |
|
31 | + <?renderDocument($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?> |
|
32 | 32 | <? elseif ($subDocument->type == 'folder') : ?> |
33 | - <?renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?> |
|
33 | + <?renderFolder($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?> |
|
34 | 34 | <? endif ?> |
35 | 35 | </li> |
36 | 36 | <? endforeach ?> |
@@ -12,83 +12,83 @@ |
||
12 | 12 | |
13 | 13 | class ValuelistsStorage extends AbstractStorage |
14 | 14 | { |
15 | - /** |
|
16 | - * Get all valuelists |
|
17 | - * |
|
18 | - * @return mixed |
|
19 | - */ |
|
20 | - public function getValuelists() |
|
21 | - { |
|
22 | - return $this->repository->valuelists; |
|
23 | - } |
|
15 | + /** |
|
16 | + * Get all valuelists |
|
17 | + * |
|
18 | + * @return mixed |
|
19 | + */ |
|
20 | + public function getValuelists() |
|
21 | + { |
|
22 | + return $this->repository->valuelists; |
|
23 | + } |
|
24 | 24 | |
25 | - public function addValuelist($postValues) |
|
26 | - { |
|
27 | - $valueListObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
28 | - $valuelists = $this->repository->valuelists; |
|
29 | - $valuelists[] = $valueListObject; |
|
30 | - $this->repository->valuelists = $valuelists; |
|
31 | - $this->save(); |
|
32 | - } |
|
25 | + public function addValuelist($postValues) |
|
26 | + { |
|
27 | + $valueListObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
28 | + $valuelists = $this->repository->valuelists; |
|
29 | + $valuelists[] = $valueListObject; |
|
30 | + $this->repository->valuelists = $valuelists; |
|
31 | + $this->save(); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Save changes to a valuelist |
|
36 | - * |
|
37 | - * @param $slug |
|
38 | - * @param $postValues |
|
39 | - * |
|
40 | - * @throws \Exception |
|
41 | - */ |
|
42 | - public function saveValuelist($slug, $postValues) |
|
43 | - { |
|
44 | - $valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
34 | + /** |
|
35 | + * Save changes to a valuelist |
|
36 | + * |
|
37 | + * @param $slug |
|
38 | + * @param $postValues |
|
39 | + * |
|
40 | + * @throws \Exception |
|
41 | + */ |
|
42 | + public function saveValuelist($slug, $postValues) |
|
43 | + { |
|
44 | + $valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues); |
|
45 | 45 | |
46 | - $valuelists = $this->repository->valuelists; |
|
47 | - foreach ($valuelists as $key => $valuelist) { |
|
48 | - if ($valuelist->slug == $slug) { |
|
49 | - $valuelists[$key] = $valuelistObject; |
|
50 | - } |
|
51 | - } |
|
52 | - $this->repository->valuelists = $valuelists; |
|
53 | - $this->save(); |
|
54 | - } |
|
46 | + $valuelists = $this->repository->valuelists; |
|
47 | + foreach ($valuelists as $key => $valuelist) { |
|
48 | + if ($valuelist->slug == $slug) { |
|
49 | + $valuelists[$key] = $valuelistObject; |
|
50 | + } |
|
51 | + } |
|
52 | + $this->repository->valuelists = $valuelists; |
|
53 | + $this->save(); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Get a valuelist by its slug |
|
58 | - * |
|
59 | - * @param $slug |
|
60 | - * |
|
61 | - * @return mixed |
|
62 | - */ |
|
63 | - public function getValuelistBySlug($slug) |
|
64 | - { |
|
65 | - $valuelists = $this->repository->valuelists; |
|
66 | - foreach ($valuelists as $valuelist) { |
|
67 | - if ($valuelist->slug == $slug) { |
|
68 | - return $valuelist; |
|
69 | - } |
|
70 | - } |
|
56 | + /** |
|
57 | + * Get a valuelist by its slug |
|
58 | + * |
|
59 | + * @param $slug |
|
60 | + * |
|
61 | + * @return mixed |
|
62 | + */ |
|
63 | + public function getValuelistBySlug($slug) |
|
64 | + { |
|
65 | + $valuelists = $this->repository->valuelists; |
|
66 | + foreach ($valuelists as $valuelist) { |
|
67 | + if ($valuelist->slug == $slug) { |
|
68 | + return $valuelist; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - return null; |
|
73 | - } |
|
72 | + return null; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Delete a sitemap item by its slug |
|
77 | - * |
|
78 | - * @param $slug |
|
79 | - * |
|
80 | - * @throws \Exception |
|
81 | - */ |
|
82 | - public function deleteValuelistBySlug($slug) |
|
83 | - { |
|
84 | - $valuelists = $this->repository->valuelists; |
|
85 | - foreach ($valuelists as $key => $valuelist) { |
|
86 | - if ($valuelist->slug == $slug) { |
|
87 | - unset($valuelists[$key]); |
|
88 | - } |
|
89 | - } |
|
90 | - $valuelists = array_values($valuelists); |
|
91 | - $this->repository->valuelists = $valuelists; |
|
92 | - $this->save(); |
|
93 | - } |
|
75 | + /** |
|
76 | + * Delete a sitemap item by its slug |
|
77 | + * |
|
78 | + * @param $slug |
|
79 | + * |
|
80 | + * @throws \Exception |
|
81 | + */ |
|
82 | + public function deleteValuelistBySlug($slug) |
|
83 | + { |
|
84 | + $valuelists = $this->repository->valuelists; |
|
85 | + foreach ($valuelists as $key => $valuelist) { |
|
86 | + if ($valuelist->slug == $slug) { |
|
87 | + unset($valuelists[$key]); |
|
88 | + } |
|
89 | + } |
|
90 | + $valuelists = array_values($valuelists); |
|
91 | + $this->repository->valuelists = $valuelists; |
|
92 | + $this->save(); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | \ No newline at end of file |
@@ -12,34 +12,34 @@ |
||
12 | 12 | |
13 | 13 | class ValuelistFactory |
14 | 14 | { |
15 | - /** |
|
16 | - * Create a sitemap item from post values |
|
17 | - * |
|
18 | - * @param $postValues |
|
19 | - * |
|
20 | - * @return \stdClass |
|
21 | - * @throws \Exception |
|
22 | - */ |
|
23 | - public static function createValuelistFromPostValues($postValues) |
|
24 | - { |
|
25 | - if (isset($postValues['title'])) { |
|
26 | - $valuelistObject = new \stdClass(); |
|
27 | - $valuelistObject->title = $postValues['title']; |
|
28 | - $valuelistObject->slug = StringUtil::slugify($postValues['title']); |
|
29 | - $valuelistObject->pairs = new \stdClass(); |
|
30 | - if (isset($postValues['keys'], $postValues['values'])) { |
|
31 | - foreach ($postValues['keys'] as $key => $value) { |
|
32 | - $valuelistObject->pairs->$value = $postValues['values'][$key]; |
|
33 | - } |
|
34 | - } |
|
35 | - $object_vars = get_object_vars($valuelistObject->pairs); |
|
36 | - ksort($object_vars); |
|
37 | - $valuelistObject->pairs = (object) $object_vars; |
|
15 | + /** |
|
16 | + * Create a sitemap item from post values |
|
17 | + * |
|
18 | + * @param $postValues |
|
19 | + * |
|
20 | + * @return \stdClass |
|
21 | + * @throws \Exception |
|
22 | + */ |
|
23 | + public static function createValuelistFromPostValues($postValues) |
|
24 | + { |
|
25 | + if (isset($postValues['title'])) { |
|
26 | + $valuelistObject = new \stdClass(); |
|
27 | + $valuelistObject->title = $postValues['title']; |
|
28 | + $valuelistObject->slug = StringUtil::slugify($postValues['title']); |
|
29 | + $valuelistObject->pairs = new \stdClass(); |
|
30 | + if (isset($postValues['keys'], $postValues['values'])) { |
|
31 | + foreach ($postValues['keys'] as $key => $value) { |
|
32 | + $valuelistObject->pairs->$value = $postValues['values'][$key]; |
|
33 | + } |
|
34 | + } |
|
35 | + $object_vars = get_object_vars($valuelistObject->pairs); |
|
36 | + ksort($object_vars); |
|
37 | + $valuelistObject->pairs = (object) $object_vars; |
|
38 | 38 | |
39 | - return $valuelistObject; |
|
40 | - } else { |
|
41 | - throw new \Exception('Trying to create valuelist with invalid data.'); |
|
42 | - } |
|
43 | - } |
|
39 | + return $valuelistObject; |
|
40 | + } else { |
|
41 | + throw new \Exception('Trying to create valuelist with invalid data.'); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -12,33 +12,33 @@ discard block |
||
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()->getDocumentsWithState()); |
|
26 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
|
27 | - } |
|
28 | - $this->documentRouting($request, $relativeCmsUri, $cmsComponent); |
|
29 | - $this->folderRouting($request, $relativeCmsUri, $cmsComponent); |
|
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()->getDocumentsWithState()); |
|
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 | 30 | $this->valuelistsRouting($request, $relativeCmsUri, $cmsComponent); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @param $request |
|
36 | - * @param $relativeCmsUri |
|
37 | - * @param CmsComponent $cmsComponent |
|
38 | - * @throws \Exception |
|
39 | - */ |
|
40 | - private function documentRouting($request, $relativeCmsUri, $cmsComponent) |
|
41 | - { |
|
34 | + /** |
|
35 | + * @param $request |
|
36 | + * @param $relativeCmsUri |
|
37 | + * @param CmsComponent $cmsComponent |
|
38 | + * @throws \Exception |
|
39 | + */ |
|
40 | + private function documentRouting($request, $relativeCmsUri, $cmsComponent) |
|
41 | + { |
|
42 | 42 | if ($relativeCmsUri == '/documents/new-document' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
43 | 43 | $this->documentNewRoute($request, $cmsComponent); |
44 | 44 | } elseif (isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])){ |
@@ -50,23 +50,23 @@ discard block |
||
50 | 50 | case '/documents/unpublish-document': $this->unpublishDocumentRoute($request, $cmsComponent); break; |
51 | 51 | } |
52 | 52 | } |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param $request |
|
57 | - * @param $relativeCmsUri |
|
58 | - * @param CmsComponent $cmsComponent |
|
59 | - */ |
|
60 | - private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
|
61 | - { |
|
62 | - if ($relativeCmsUri == '/documents/new-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
55 | + /** |
|
56 | + * @param $request |
|
57 | + * @param $relativeCmsUri |
|
58 | + * @param CmsComponent $cmsComponent |
|
59 | + */ |
|
60 | + private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
|
61 | + { |
|
62 | + if ($relativeCmsUri == '/documents/new-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
63 | 63 | $this->newFolderRoute($request, $cmsComponent); |
64 | - } else if ($relativeCmsUri == '/documents/edit-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
64 | + } else if ($relativeCmsUri == '/documents/edit-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
65 | 65 | $this->editFolderRoute($request, $cmsComponent); |
66 | - } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
66 | + } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
67 | 67 | $this->deleteFolderRoute($request, $cmsComponent); |
68 | - } |
|
69 | - } |
|
68 | + } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | private function valuelistsRouting($request, $relativeCmsUri, $cmsComponent) |
72 | 72 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | if ($relativeCmsUri == '/documents/new-document' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
43 | 43 | $this->documentNewRoute($request, $cmsComponent); |
44 | - } elseif (isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])){ |
|
44 | + } elseif (isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
45 | 45 | switch ($relativeCmsUri) { |
46 | 46 | case '/documents/edit-document': $this->editDocumentRoute($request, $cmsComponent); break; |
47 | 47 | case '/documents/get-brick': $this->getBrickRoute($request, $cmsComponent); break; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | if (isset($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE])) { |
96 | 96 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], $request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
97 | 97 | $cmsComponent->storage->getDocuments()->addDocument($request::$post); |
98 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
98 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
99 | 99 | exit; |
100 | 100 | } |
101 | 101 | $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPE, $cmsComponent->storage->getDocumentTypes()->getDocumentTypeBySlug($request::$get[CmsComponent::PARAMETER_DOCUMENT_TYPE], true)); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } else { |
104 | 104 | $documentTypes = $cmsComponent->storage->getDocumentTypes()->getDocumentTypes(); |
105 | 105 | if (count($documentTypes) < 1) { |
106 | - 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>'); |
|
106 | + 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>'); |
|
107 | 107 | } |
108 | 108 | $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT_TYPES, $documentTypes); |
109 | 109 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $cmsComponent->setParameter(CmsComponent::PARAMETER_SMALLEST_IMAGE, $cmsComponent->storage->getImageSet()->getSmallestImageSet()->slug); |
121 | 121 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
122 | 122 | $cmsComponent->storage->getDocuments()->saveDocument($request::$post); |
123 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
123 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
124 | 124 | exit; |
125 | 125 | } |
126 | 126 | $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENT, $cmsComponent->storage->getDocuments()->getDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG], 'unpublished')); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | private function deleteDocumentRoute($request, $cmsComponent) |
158 | 158 | { |
159 | 159 | $cmsComponent->storage->getDocuments()->deleteDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
160 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
160 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
161 | 161 | exit; |
162 | 162 | } |
163 | 163 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
172 | 172 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::GET_PARAMETER_PATH])) { |
173 | 173 | $cmsComponent->storage->addDocumentFolder($request::$post); |
174 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
174 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
175 | 175 | exit; |
176 | 176 | } |
177 | 177 | } |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | array_pop($path); |
191 | 191 | $path = implode('/', $path); |
192 | 192 | |
193 | - $request::$get[CmsComponent::GET_PARAMETER_PATH] = '/' . $path; |
|
193 | + $request::$get[CmsComponent::GET_PARAMETER_PATH] = '/'.$path; |
|
194 | 194 | |
195 | 195 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post['content'])) { |
196 | 196 | $cmsComponent->storage->saveDocumentFolder($request::$post); |
197 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
197 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
198 | 198 | exit; |
199 | 199 | } |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | private function deleteFolderRoute($request, $cmsComponent) |
210 | 210 | { |
211 | 211 | $cmsComponent->storage->deleteDocumentFolderBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
212 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
212 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
213 | 213 | exit; |
214 | 214 | } |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | private function publishDocumentRoute($request, $cmsComponent) |
221 | 221 | { |
222 | 222 | $cmsComponent->storage->publishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
223 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
223 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
224 | 224 | exit; |
225 | 225 | } |
226 | 226 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | private function unpublishDocumentRoute($request, $cmsComponent) |
232 | 232 | { |
233 | 233 | $cmsComponent->storage->unpublishDocumentBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
234 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents'); |
|
234 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents'); |
|
235 | 235 | exit; |
236 | 236 | } |
237 | 237 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
249 | 249 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE])) { |
250 | 250 | $cmsComponent->storage->getValuelists()->addValuelist($request::$post); |
251 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents/valuelists'); |
|
251 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents/valuelists'); |
|
252 | 252 | exit; |
253 | 253 | } |
254 | 254 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
262 | 262 | $cmsComponent->storage->getValuelists()->saveValuelist($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post); |
263 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents/valuelists'); |
|
263 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents/valuelists'); |
|
264 | 264 | exit; |
265 | 265 | } |
266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | private function deleteValuelistRoute($request, $cmsComponent) |
272 | 272 | { |
273 | 273 | $cmsComponent->storage->getValuelists()->deleteValuelistBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
274 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/documents/valuelists'); |
|
274 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/documents/valuelists'); |
|
275 | 275 | exit; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | \ No newline at end of file |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | class NotFoundComponent extends BaseComponent |
14 | 14 | { |
15 | - public function run(Storage $storage) |
|
16 | - { |
|
17 | - parent::run($storage); |
|
18 | - header("HTTP/1.0 404 Not Found"); |
|
19 | - } |
|
15 | + public function run(Storage $storage) |
|
16 | + { |
|
17 | + parent::run($storage); |
|
18 | + header("HTTP/1.0 404 Not Found"); |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -10,91 +10,91 @@ |
||
10 | 10 | |
11 | 11 | class RedirectsStorage extends AbstractStorage |
12 | 12 | { |
13 | - /** |
|
14 | - * Get all redirects |
|
15 | - * |
|
16 | - * @return mixed |
|
17 | - */ |
|
18 | - public function getRedirects() |
|
19 | - { |
|
20 | - $redirects = $this->repository->redirects; |
|
21 | - usort($redirects, array($this, 'cmp')); |
|
22 | - return $redirects; |
|
23 | - } |
|
13 | + /** |
|
14 | + * Get all redirects |
|
15 | + * |
|
16 | + * @return mixed |
|
17 | + */ |
|
18 | + public function getRedirects() |
|
19 | + { |
|
20 | + $redirects = $this->repository->redirects; |
|
21 | + usort($redirects, array($this, 'cmp')); |
|
22 | + return $redirects; |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Add a new redirect |
|
27 | - * @param $postValues |
|
28 | - */ |
|
29 | - public function addRedirect($postValues) { |
|
30 | - $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues); |
|
31 | - $redirects = $this->repository->redirects; |
|
32 | - $redirects[] = $redirectObject; |
|
33 | - $this->repository->redirects = $redirects; |
|
34 | - $this->save(); |
|
35 | - } |
|
25 | + /** |
|
26 | + * Add a new redirect |
|
27 | + * @param $postValues |
|
28 | + */ |
|
29 | + public function addRedirect($postValues) { |
|
30 | + $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues); |
|
31 | + $redirects = $this->repository->redirects; |
|
32 | + $redirects[] = $redirectObject; |
|
33 | + $this->repository->redirects = $redirects; |
|
34 | + $this->save(); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Get a redirect by it's slug |
|
39 | - * |
|
40 | - * @param $slug |
|
41 | - * @return \stdClass|null |
|
42 | - */ |
|
43 | - public function getRedirectBySlug($slug) |
|
44 | - { |
|
45 | - $redirects = $this->repository->redirects; |
|
46 | - foreach ($redirects as $redirect) { |
|
47 | - if ($redirect->slug == $slug) { |
|
48 | - return $redirect; |
|
49 | - } |
|
50 | - } |
|
37 | + /** |
|
38 | + * Get a redirect by it's slug |
|
39 | + * |
|
40 | + * @param $slug |
|
41 | + * @return \stdClass|null |
|
42 | + */ |
|
43 | + public function getRedirectBySlug($slug) |
|
44 | + { |
|
45 | + $redirects = $this->repository->redirects; |
|
46 | + foreach ($redirects as $redirect) { |
|
47 | + if ($redirect->slug == $slug) { |
|
48 | + return $redirect; |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - return null; |
|
53 | - } |
|
52 | + return null; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Save a redirect by it's slug |
|
57 | - * @param $slug |
|
58 | - * @param $postValues |
|
59 | - */ |
|
60 | - public function saveRedirect($slug, $postValues) |
|
61 | - { |
|
62 | - $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues); |
|
55 | + /** |
|
56 | + * Save a redirect by it's slug |
|
57 | + * @param $slug |
|
58 | + * @param $postValues |
|
59 | + */ |
|
60 | + public function saveRedirect($slug, $postValues) |
|
61 | + { |
|
62 | + $redirectObject = RedirectsFactory::createRedirectFromPostValues($postValues); |
|
63 | 63 | |
64 | - $redirects = $this->repository->redirects; |
|
65 | - foreach ($redirects as $key => $redirect) { |
|
66 | - if ($redirect->slug == $slug) { |
|
67 | - $redirects[$key] = $redirectObject; |
|
68 | - } |
|
69 | - } |
|
70 | - $this->repository->redirects = $redirects; |
|
71 | - $this->save(); |
|
72 | - } |
|
64 | + $redirects = $this->repository->redirects; |
|
65 | + foreach ($redirects as $key => $redirect) { |
|
66 | + if ($redirect->slug == $slug) { |
|
67 | + $redirects[$key] = $redirectObject; |
|
68 | + } |
|
69 | + } |
|
70 | + $this->repository->redirects = $redirects; |
|
71 | + $this->save(); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * Delete a redirect by it's slug |
|
76 | - * @param $slug |
|
77 | - */ |
|
78 | - public function deleteRedirectBySlug($slug) |
|
79 | - { |
|
80 | - $redirects = $this->repository->redirects; |
|
81 | - foreach ($redirects as $key => $redirect) { |
|
82 | - if ($redirect->slug == $slug) { |
|
83 | - unset($redirects[$key]); |
|
84 | - } |
|
85 | - } |
|
86 | - $redirects = array_values($redirects); |
|
87 | - $this->repository->redirects = $redirects; |
|
88 | - $this->save(); |
|
89 | - } |
|
74 | + /** |
|
75 | + * Delete a redirect by it's slug |
|
76 | + * @param $slug |
|
77 | + */ |
|
78 | + public function deleteRedirectBySlug($slug) |
|
79 | + { |
|
80 | + $redirects = $this->repository->redirects; |
|
81 | + foreach ($redirects as $key => $redirect) { |
|
82 | + if ($redirect->slug == $slug) { |
|
83 | + unset($redirects[$key]); |
|
84 | + } |
|
85 | + } |
|
86 | + $redirects = array_values($redirects); |
|
87 | + $this->repository->redirects = $redirects; |
|
88 | + $this->save(); |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Compare a redirect by it's title |
|
93 | - * @param $a |
|
94 | - * @param $b |
|
95 | - * @return int |
|
96 | - */ |
|
97 | - public static function cmp($a, $b) { |
|
98 | - return strcmp($a->title, $b->title); |
|
99 | - } |
|
91 | + /** |
|
92 | + * Compare a redirect by it's title |
|
93 | + * @param $a |
|
94 | + * @param $b |
|
95 | + * @return int |
|
96 | + */ |
|
97 | + public static function cmp($a, $b) { |
|
98 | + return strcmp($a->title, $b->title); |
|
99 | + } |
|
100 | 100 | } |
101 | 101 | \ No newline at end of file |
@@ -10,26 +10,26 @@ |
||
10 | 10 | |
11 | 11 | class RedirectsFactory |
12 | 12 | { |
13 | - /** |
|
14 | - * Create a new redirect object from postvalues |
|
15 | - * |
|
16 | - * @param $postValues |
|
17 | - * @return \stdClass |
|
18 | - * @throws \Exception |
|
19 | - */ |
|
20 | - public static function createRedirectFromPostValues($postValues) |
|
21 | - { |
|
22 | - if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) { |
|
23 | - $redirectObject = new \stdClass(); |
|
24 | - $redirectObject->title = $postValues['title']; |
|
25 | - $redirectObject->slug = StringUtil::slugify($postValues['title']); |
|
26 | - $redirectObject->fromUrl = $postValues['fromUrl']; |
|
27 | - $redirectObject->toUrl = $postValues['toUrl']; |
|
28 | - $redirectObject->type = $postValues['type']; |
|
13 | + /** |
|
14 | + * Create a new redirect object from postvalues |
|
15 | + * |
|
16 | + * @param $postValues |
|
17 | + * @return \stdClass |
|
18 | + * @throws \Exception |
|
19 | + */ |
|
20 | + public static function createRedirectFromPostValues($postValues) |
|
21 | + { |
|
22 | + if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) { |
|
23 | + $redirectObject = new \stdClass(); |
|
24 | + $redirectObject->title = $postValues['title']; |
|
25 | + $redirectObject->slug = StringUtil::slugify($postValues['title']); |
|
26 | + $redirectObject->fromUrl = $postValues['fromUrl']; |
|
27 | + $redirectObject->toUrl = $postValues['toUrl']; |
|
28 | + $redirectObject->type = $postValues['type']; |
|
29 | 29 | |
30 | - return $redirectObject; |
|
31 | - } else { |
|
32 | - throw new \Exception('Trying to create valuelist with invalid data.'); |
|
33 | - } |
|
34 | - } |
|
30 | + return $redirectObject; |
|
31 | + } else { |
|
32 | + throw new \Exception('Trying to create valuelist with invalid data.'); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | \ No newline at end of file |