@@ -49,7 +49,7 @@ |
||
49 | 49 | $output = ''; |
50 | 50 | for ($i = 0; $i < $count; $i += 16) { |
51 | 51 | $random_state = |
52 | - md5(microtime() . $random_state); |
|
52 | + md5(microtime().$random_state); |
|
53 | 53 | $output .= |
54 | 54 | pack('H*', md5($random_state)); |
55 | 55 | } |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | } |
7 | 7 | ?> |
8 | 8 | <div class="rte"> |
9 | - <div id="summernote_<?=str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>" class="summernote"><?=isset($value) ? $value : '' ?></div> |
|
9 | + <div id="summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>" class="summernote"><?=isset($value) ? $value : '' ?></div> |
|
10 | 10 | </div> |
11 | 11 | <textarea style="display:none;" id="summernote_<?=$field->slug?>_container_<?=$summernoteInstances?>" name="<?=$fieldPrefix?>[<?=$field->slug?>][]"></textarea> |
12 | 12 | <script> |
13 | 13 | $(document).ready(function () { |
14 | - $('#summernote_<?=str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
14 | + $('#summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
15 | 15 | height: 300, |
16 | 16 | toolbar: [ |
17 | 17 | //[groupname, [button list]] |
@@ -29,4 +29,4 @@ discard block |
||
29 | 29 | if (!isset($GLOBALS['rteList'])) { |
30 | 30 | $GLOBALS['rteList'] = array(); |
31 | 31 | } |
32 | -$GLOBALS['rteList'][] = 'summernote_' . str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug . '_rte_' . $summernoteInstances ?> |
|
32 | +$GLOBALS['rteList'][] = 'summernote_'.str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug.'_rte_'.$summernoteInstances ?> |
@@ -105,7 +105,7 @@ |
||
105 | 105 | /** |
106 | 106 | * Detect if the language is switched manually |
107 | 107 | * |
108 | - * @param $request |
|
108 | + * @param Request $request |
|
109 | 109 | */ |
110 | 110 | private function checkLanguageSwitch($request) |
111 | 111 | { |
@@ -99,9 +99,9 @@ |
||
99 | 99 | $this->sessionValues = $_SESSION['LanguageComponent']; |
100 | 100 | |
101 | 101 | if ($this->forceRedirect === true) { |
102 | - if (substr($request::$relativeUri, 0, 2) !== $lang ) { |
|
102 | + if (substr($request::$relativeUri, 0, 2) !== $lang) { |
|
103 | 103 | if ($lang !== $this->defaultLanguage) { |
104 | - header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); |
|
104 | + header('Location: '.$request::$subfolders.$lang.'/'.$request::$relativeUri); |
|
105 | 105 | exit; |
106 | 106 | } |
107 | 107 | } |
@@ -6,124 +6,124 @@ |
||
6 | 6 | |
7 | 7 | class LanguageComponent implements Component |
8 | 8 | { |
9 | - protected $request; |
|
10 | - protected $parameters; |
|
11 | - |
|
12 | - protected $defaultLanguage = 'en'; |
|
13 | - protected $acceptedLanguages = null; |
|
14 | - protected $languageParameterName = 'language'; |
|
15 | - protected $forceRedirect = false; |
|
16 | - protected $sessionValues; |
|
17 | - |
|
18 | - /** |
|
19 | - * Component constructor. |
|
20 | - * |
|
21 | - * @param $template |
|
22 | - * @param Request $request |
|
23 | - * @param $parameters |
|
24 | - * @param $matchedSitemapItem |
|
25 | - */ |
|
26 | - public function __construct($template, Request $request, $parameters, $matchedSitemapItem) |
|
27 | - { |
|
28 | - $this->parameters = (array) $parameters; |
|
29 | - $this->checkParameters(); |
|
30 | - |
|
31 | - $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2); |
|
32 | - $_SESSION['LanguageComponent']['detectedLanguage'] = $lang; |
|
33 | - |
|
34 | - $this->checkLanguageSwitch($request); |
|
35 | - |
|
36 | - if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) { |
|
37 | - $this->detectLanguage($lang, $request); |
|
38 | - } else { |
|
39 | - if ($this->forceRedirect === true) { |
|
40 | - $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request); |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName]; |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Checks to see if any parameters are given from the configuration in the CMS |
|
49 | - */ |
|
50 | - private function checkParameters() |
|
51 | - { |
|
52 | - if (isset($this->parameters['defaultLanguage'])) { |
|
53 | - $this->defaultLanguage = $this->parameters['defaultLanguage']; |
|
54 | - unset($this->parameters['defaultLanguage']); |
|
55 | - } |
|
56 | - if (isset($this->parameters['acceptedLanguages'])) { |
|
57 | - $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']); |
|
58 | - unset($this->parameters['acceptedLanguages']); |
|
59 | - } |
|
60 | - if (isset($this->parameters['languageParameterName'])) { |
|
61 | - $this->languageParameterName = $this->parameters['languageParameterName']; |
|
62 | - unset($this->parameters['languageParameterName']); |
|
63 | - } |
|
64 | - if (isset($this->parameters['forceRedirect'])) { |
|
65 | - $this->forceRedirect = (bool) $this->parameters['forceRedirect']; |
|
66 | - unset($this->parameters['forceRedirect']); |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function getParameters() |
|
74 | - { |
|
75 | - return $this->parameters; |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Check if the found language is allowed and |
|
81 | - * if an action is to be taken. |
|
82 | - * |
|
83 | - * @param $lang |
|
84 | - * @param $request |
|
85 | - */ |
|
86 | - private function detectLanguage($lang, $request) |
|
87 | - { |
|
88 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage; |
|
89 | - |
|
90 | - if ($this->acceptedLanguages === null) { |
|
91 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
92 | - } else if (in_array($lang, $this->acceptedLanguages)) { |
|
93 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
94 | - } else { |
|
95 | - $lang = $this->defaultLanguage; |
|
96 | - } |
|
97 | - |
|
98 | - $this->sessionValues = $_SESSION['LanguageComponent']; |
|
99 | - |
|
100 | - if ($this->forceRedirect === true) { |
|
101 | - if (substr($request::$relativeUri, 0, 2) !== $lang ) { |
|
102 | - if ($lang !== $this->defaultLanguage) { |
|
103 | - header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); |
|
104 | - exit; |
|
105 | - } |
|
106 | - } |
|
107 | - } |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * Detect if the language is switched manually |
|
112 | - * |
|
113 | - * @param $request |
|
114 | - */ |
|
115 | - private function checkLanguageSwitch($request) |
|
116 | - { |
|
117 | - if (isset($request::$get['langSwitch'])) { |
|
118 | - $this->forceRedirect = true; |
|
119 | - $this->detectLanguage($request::$get['langSwitch'], $request); |
|
120 | - } |
|
121 | - } |
|
122 | - |
|
123 | - /* |
|
9 | + protected $request; |
|
10 | + protected $parameters; |
|
11 | + |
|
12 | + protected $defaultLanguage = 'en'; |
|
13 | + protected $acceptedLanguages = null; |
|
14 | + protected $languageParameterName = 'language'; |
|
15 | + protected $forceRedirect = false; |
|
16 | + protected $sessionValues; |
|
17 | + |
|
18 | + /** |
|
19 | + * Component constructor. |
|
20 | + * |
|
21 | + * @param $template |
|
22 | + * @param Request $request |
|
23 | + * @param $parameters |
|
24 | + * @param $matchedSitemapItem |
|
25 | + */ |
|
26 | + public function __construct($template, Request $request, $parameters, $matchedSitemapItem) |
|
27 | + { |
|
28 | + $this->parameters = (array) $parameters; |
|
29 | + $this->checkParameters(); |
|
30 | + |
|
31 | + $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2); |
|
32 | + $_SESSION['LanguageComponent']['detectedLanguage'] = $lang; |
|
33 | + |
|
34 | + $this->checkLanguageSwitch($request); |
|
35 | + |
|
36 | + if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) { |
|
37 | + $this->detectLanguage($lang, $request); |
|
38 | + } else { |
|
39 | + if ($this->forceRedirect === true) { |
|
40 | + $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request); |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName]; |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Checks to see if any parameters are given from the configuration in the CMS |
|
49 | + */ |
|
50 | + private function checkParameters() |
|
51 | + { |
|
52 | + if (isset($this->parameters['defaultLanguage'])) { |
|
53 | + $this->defaultLanguage = $this->parameters['defaultLanguage']; |
|
54 | + unset($this->parameters['defaultLanguage']); |
|
55 | + } |
|
56 | + if (isset($this->parameters['acceptedLanguages'])) { |
|
57 | + $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']); |
|
58 | + unset($this->parameters['acceptedLanguages']); |
|
59 | + } |
|
60 | + if (isset($this->parameters['languageParameterName'])) { |
|
61 | + $this->languageParameterName = $this->parameters['languageParameterName']; |
|
62 | + unset($this->parameters['languageParameterName']); |
|
63 | + } |
|
64 | + if (isset($this->parameters['forceRedirect'])) { |
|
65 | + $this->forceRedirect = (bool) $this->parameters['forceRedirect']; |
|
66 | + unset($this->parameters['forceRedirect']); |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function getParameters() |
|
74 | + { |
|
75 | + return $this->parameters; |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Check if the found language is allowed and |
|
81 | + * if an action is to be taken. |
|
82 | + * |
|
83 | + * @param $lang |
|
84 | + * @param $request |
|
85 | + */ |
|
86 | + private function detectLanguage($lang, $request) |
|
87 | + { |
|
88 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage; |
|
89 | + |
|
90 | + if ($this->acceptedLanguages === null) { |
|
91 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
92 | + } else if (in_array($lang, $this->acceptedLanguages)) { |
|
93 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; |
|
94 | + } else { |
|
95 | + $lang = $this->defaultLanguage; |
|
96 | + } |
|
97 | + |
|
98 | + $this->sessionValues = $_SESSION['LanguageComponent']; |
|
99 | + |
|
100 | + if ($this->forceRedirect === true) { |
|
101 | + if (substr($request::$relativeUri, 0, 2) !== $lang ) { |
|
102 | + if ($lang !== $this->defaultLanguage) { |
|
103 | + header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); |
|
104 | + exit; |
|
105 | + } |
|
106 | + } |
|
107 | + } |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * Detect if the language is switched manually |
|
112 | + * |
|
113 | + * @param $request |
|
114 | + */ |
|
115 | + private function checkLanguageSwitch($request) |
|
116 | + { |
|
117 | + if (isset($request::$get['langSwitch'])) { |
|
118 | + $this->forceRedirect = true; |
|
119 | + $this->detectLanguage($request::$get['langSwitch'], $request); |
|
120 | + } |
|
121 | + } |
|
122 | + |
|
123 | + /* |
|
124 | 124 | * These functions are required by the interface, but not for the functionality |
125 | 125 | */ |
126 | - public function run(JsonStorage $storage) {} |
|
127 | - public function render() {} |
|
128 | - public function get() {} |
|
126 | + public function run(JsonStorage $storage) {} |
|
127 | + public function render() {} |
|
128 | + public function get() {} |
|
129 | 129 | } |
130 | 130 | \ No newline at end of file |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script> |
4 | 4 | <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"> |
5 | 5 | <script>var smallestImage = '<?=$smallestImage?>';</script> |
6 | -<?$copyable=''?> |
|
6 | +<?$copyable = ''?> |
|
7 | 7 | <section class="documents"> |
8 | 8 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
9 | 9 | <nav class="actions"> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | </div> |
24 | 24 | </li> |
25 | 25 | </ul> |
26 | - <?include('document-form-form.php');?> |
|
26 | + <?include('document-form-form.php'); ?> |
|
27 | 27 | </section> |
28 | 28 | |
29 | 29 | <script> |
@@ -47,21 +47,21 @@ |
||
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::$subfolders = str_replace('//', '/', self::$subfolders); |
52 | 52 | if (PHP_SAPI === 'cli') { |
53 | 53 | global $argv; |
54 | 54 | array_shift($argv); |
55 | 55 | self::$queryString = ''; |
56 | - self::$requestUri = self::$subfolders . implode('/', $argv); |
|
56 | + self::$requestUri = self::$subfolders.implode('/', $argv); |
|
57 | 57 | } else { |
58 | 58 | self::$requestUri = $_SERVER['REQUEST_URI']; |
59 | 59 | self::$queryString = $_SERVER['QUERY_STRING']; |
60 | 60 | } |
61 | 61 | if (self::$subfolders === '/') { |
62 | - self::$relativeUri = str_replace('?' . self::$queryString, '', substr(self::$requestUri,1)); |
|
62 | + self::$relativeUri = str_replace('?'.self::$queryString, '', substr(self::$requestUri, 1)); |
|
63 | 63 | } else { |
64 | - self::$relativeUri = str_replace('?' . self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
64 | + self::$relativeUri = str_replace('?'.self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | self::$requestParameters = explode('/', self::$relativeUri); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#' . $formId : '' ?>"> |
|
1 | +<form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#'.$formId : '' ?>"> |
|
2 | 2 | <? if (!isset($hideTitleAndState)) : ?> |
3 | 3 | <input type="hidden" name="path" value="<?=$request::$get['path']?>" /> |
4 | 4 | <? else : ?> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | <input<?=isset($document) && $document->state == 'published' ? ' checked="checked"' : '' ?> type="checkbox" id="state" name="state" placeholder="State" /> |
21 | 21 | </div> |
22 | 22 | <? endif ?> |
23 | - <?$fieldPrefix='fields';?> |
|
23 | + <?$fieldPrefix = 'fields'; ?> |
|
24 | 24 | <? foreach ($documentType->fields as $field) : ?> |
25 | 25 | <div class="form-element"> |
26 | 26 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
45 | 45 | <div class="form-element"> |
46 | 46 | <? endif ?> |
47 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
47 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
48 | 48 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
49 | 49 | |
50 | 50 | </div> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <li class="grid-container"> |
67 | 67 | <div class="grid-box-10"> |
68 | 68 | <div class="grid-inner form-element"> |
69 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
69 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
70 | 70 | </div> |
71 | 71 | </div> |
72 | 72 | <div class="grid-box-2"> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | </div> |
77 | 77 | </div> |
78 | 78 | </li> |
79 | - <?$value='';?> |
|
79 | + <?$value = ''; ?> |
|
80 | 80 | <? endforeach ?> |
81 | 81 | <? endif ?> |
82 | 82 | </ul> |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
94 | 94 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
95 | 95 | <div class="form-element"> |
96 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
96 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
97 | 97 | </div> |
98 | 98 | </li> |
99 | - <?$value='';?> |
|
99 | + <?$value = ''; ?> |
|
100 | 100 | <? endforeach ?> |
101 | 101 | <? endif ?> |
102 | 102 | </div> |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | <a class="btn js-addrtemultiple">+</a> |
106 | 106 | <? endif ?> |
107 | 107 | </div> |
108 | - <?$value='';?> |
|
108 | + <?$value = ''; ?> |
|
109 | 109 | <? endforeach ?> |
110 | 110 | <hr /> |
111 | - <? $static_brick_nr = 0;?> |
|
111 | + <? $static_brick_nr = 0; ?> |
|
112 | 112 | <? foreach ($documentType->bricks as $brick) : ?> |
113 | 113 | <div class="brick"> |
114 | 114 | <label><?=$brick->title?></label> |
115 | 115 | <? if ($brick->multiple == 'true') : ?> |
116 | 116 | <input type="hidden" value="<?=$brick->brickSlug?>"/> |
117 | 117 | <input type="hidden" value="<?=$brick->slug?>"/> |
118 | - <?$myBrickSlug=$brick->slug;?> |
|
118 | + <?$myBrickSlug = $brick->slug; ?> |
|
119 | 119 | <ul id="newBrickDropzone_<?=$static_brick_nr?>" class="dynamicBricks sortable"> |
120 | 120 | <? if (isset($document)) : ?> |
121 | 121 | <? foreach ($document->bricks as $currentBrickSlug => $brickArray) : ?> |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | <li class="brick form-element"> |
130 | 130 | <label><?=$brick->title?></label> |
131 | 131 | <?$static = true; ?> |
132 | - <?include(__DIR__ . '/brick.php')?> |
|
132 | + <?include(__DIR__.'/brick.php')?> |
|
133 | 133 | </li> |
134 | 134 | <? endif ?> |
135 | 135 | <? endforeach ?> |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> |
140 | 140 | <?$static_brick_nr += 1?> |
141 | 141 | <? else : ?> |
142 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
142 | + <?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?> |
|
143 | 143 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
144 | 144 | <? foreach ($brick->structure->fields as $field) : ?> |
145 | 145 | <div class="form-element"> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
166 | 166 | <div class="form-element"> |
167 | 167 | <? endif ?> |
168 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
168 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
169 | 169 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
170 | 170 | |
171 | 171 | </div> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | <li class="grid-container"> |
189 | 189 | <div class="grid-box-10"> |
190 | 190 | <div class="grid-inner form-element"> |
191 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
191 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <div class="grid-box-2"> |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | </div> |
199 | 199 | </div> |
200 | 200 | </li> |
201 | - <?$value='';?> |
|
201 | + <?$value = ''; ?> |
|
202 | 202 | <? endforeach ?> |
203 | 203 | <? endif ?> |
204 | 204 | </ul> |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
217 | 217 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
218 | 218 | <div class="form-element"> |
219 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
219 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
220 | 220 | </div> |
221 | 221 | </li> |
222 | - <?$value='';?> |
|
222 | + <?$value = ''; ?> |
|
223 | 223 | <? endforeach ?> |
224 | 224 | <? endif ?> |
225 | 225 | </div> |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | <a class="btn js-addrtemultiple">+</a> |
229 | 229 | <? endif ?> |
230 | 230 | </div> |
231 | - <?$value='';?> |
|
231 | + <?$value = ''; ?> |
|
232 | 232 | <? endforeach ?> |
233 | 233 | <? endif ?> |
234 | 234 | </div> |
235 | 235 | <hr /> |
236 | - <? endforeach;?> |
|
236 | + <? endforeach; ?> |
|
237 | 237 | |
238 | 238 | |
239 | 239 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | <li class="brick form-element"> |
257 | 257 | <label><?=$brick->title?></label> |
258 | 258 | <?$static = false; ?> |
259 | - <?include(__DIR__ . '/brick.php')?> |
|
259 | + <?include(__DIR__.'/brick.php')?> |
|
260 | 260 | </li> |
261 | 261 | <? endforeach ?> |
262 | 262 | <? endif ?> |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#' . $formId : '' ?>"> |
2 | 2 | <? if (!isset($hideTitleAndState)) : ?> |
3 | 3 | <input type="hidden" name="path" value="<?=$request::$get['path']?>" /> |
4 | - <? else : ?> |
|
4 | + <? else { |
|
5 | + : ?> |
|
5 | 6 | <input type="hidden" name="formId" value="<?=$formId?>" /> |
6 | 7 | <a name="<?=$formId?>"></a> |
7 | 8 | <? endif ?> |
@@ -20,15 +21,19 @@ discard block |
||
20 | 21 | <input<?=isset($document) && $document->state == 'published' ? ' checked="checked"' : '' ?> type="checkbox" id="state" name="state" placeholder="State" /> |
21 | 22 | </div> |
22 | 23 | <? endif ?> |
23 | - <?$fieldPrefix='fields';?> |
|
24 | + <?$fieldPrefix='fields'; |
|
25 | +} |
|
26 | +?> |
|
24 | 27 | <? foreach ($documentType->fields as $field) : ?> |
25 | 28 | <div class="form-element"> |
26 | 29 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
27 | 30 | <? if (isset($document)) : |
28 | 31 | $fieldSlug = $field->slug; |
29 | 32 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; |
30 | - else : |
|
33 | + else { |
|
34 | + : |
|
31 | 35 | $value = ''; |
36 | + } |
|
32 | 37 | endif ?> |
33 | 38 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
34 | 39 | <ul class="grid-wrapper sortable"> |
@@ -138,8 +143,11 @@ discard block |
||
138 | 143 | </ul> |
139 | 144 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> |
140 | 145 | <?$static_brick_nr += 1?> |
141 | - <? else : ?> |
|
142 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
146 | + <? else { |
|
147 | + : ?> |
|
148 | + <?$fieldPrefix='bricks[' . $brick->slug . '][fields]'; |
|
149 | +} |
|
150 | +?> |
|
143 | 151 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
144 | 152 | <? foreach ($brick->structure->fields as $field) : ?> |
145 | 153 | <div class="form-element"> |
@@ -148,8 +156,10 @@ discard block |
||
148 | 156 | $brickSlug = $brick->slug; |
149 | 157 | $fieldSlug = $field->slug; |
150 | 158 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; |
151 | - else : |
|
159 | + else { |
|
160 | + : |
|
152 | 161 | $value = ''; |
162 | + } |
|
153 | 163 | endif ?> |
154 | 164 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
155 | 165 | <ul class="grid-wrapper sortable"> |
@@ -14,24 +14,24 @@ |
||
14 | 14 | class SitemapRouting implements CmsRouting |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * SitemapRouting constructor. |
|
19 | - * @param \library\cc\Request $request |
|
20 | - * @param mixed|string $relativeCmsUri |
|
21 | - * @param CmsComponent $cmsComponent |
|
22 | - */ |
|
23 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
24 | - { |
|
25 | - if ($relativeCmsUri == '/sitemap') { |
|
17 | + /** |
|
18 | + * SitemapRouting constructor. |
|
19 | + * @param \library\cc\Request $request |
|
20 | + * @param mixed|string $relativeCmsUri |
|
21 | + * @param CmsComponent $cmsComponent |
|
22 | + */ |
|
23 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
24 | + { |
|
25 | + if ($relativeCmsUri == '/sitemap') { |
|
26 | 26 | $this->overviewRoute($request, $cmsComponent); |
27 | - } elseif ($relativeCmsUri == '/sitemap/new') { |
|
27 | + } elseif ($relativeCmsUri == '/sitemap/new') { |
|
28 | 28 | $this->newRoute($request, $cmsComponent); |
29 | - } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
29 | + } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
30 | 30 | $this->editRoute($request, $cmsComponent); |
31 | - } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
31 | + } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
32 | 32 | $this->deleteRoute($request, $cmsComponent); |
33 | - } |
|
34 | - } |
|
33 | + } |
|
34 | + } |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @param $request |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
58 | 58 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_TEMPLATE], $request::$post[CmsComponent::POST_PARAMETER_COMPONENT])) { |
59 | 59 | $cmsComponent->storage->getSitemap()->addSitemapItem($request::$post); |
60 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap'); |
|
60 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap'); |
|
61 | 61 | exit; |
62 | 62 | } |
63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $sitemapItem = $cmsComponent->storage->getSitemap()->getSitemapItemBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
74 | 74 | if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_TEMPLATE], $request::$post[CmsComponent::POST_PARAMETER_COMPONENT])) { |
75 | 75 | $cmsComponent->storage->getSitemap()->saveSitemapItem($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post); |
76 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap'); |
|
76 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap'); |
|
77 | 77 | exit; |
78 | 78 | } |
79 | 79 | $cmsComponent->setParameter(CmsComponent::PARAMETER_SITEMAP_ITEM, $sitemapItem); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | private function deleteRoute($request, $cmsComponent) |
87 | 87 | { |
88 | 88 | $cmsComponent->storage->getSitemap()->deleteSitemapItemBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
89 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap'); |
|
89 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/sitemap'); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | if (isset($_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID])) { |
163 | 163 | $this->formId = $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID]; |
164 | 164 | } else { |
165 | - $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] = (string)microtime(true); |
|
165 | + $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID] = (string) microtime(true); |
|
166 | 166 | $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName]['submitted'] = false; |
167 | 167 | $this->formId = $_SESSION[self::SESSION_PARAMETER_FORM_COMPONENT][$this->formParameterName][self::PARAMETER_FORM_ID]; |
168 | 168 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $postValues = $request::$post; |
191 | 191 | $postValues[self::PARAMETER_DOCUMENT_TYPE] = $this->documentType; |
192 | 192 | $postValues[self::GET_PARAMETER_PATH] = $this->responseFolder; |
193 | - $postValues['title'] = date('r') . ' - From: ' . $request::$requestUri; |
|
193 | + $postValues['title'] = date('r').' - From: '.$request::$requestUri; |
|
194 | 194 | |
195 | 195 | return $postValues; |
196 | 196 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | private function setFormParameter($form) |
326 | 326 | { |
327 | 327 | if ($this->isFormSubmitted($this->request) || $this->isSubmitAllowed() === false) { |
328 | - $this->parameters[$this->formParameterName] = '<a name="' . $this->formId . '"></a>' . $this->thankYouMessage; |
|
328 | + $this->parameters[$this->formParameterName] = '<a name="'.$this->formId.'"></a>'.$this->thankYouMessage; |
|
329 | 329 | } else { |
330 | 330 | $this->parameters[$this->formParameterName] = $form; |
331 | 331 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * submitting the form |
148 | 148 | * |
149 | 149 | * @param $postValues |
150 | - * @param $storage |
|
150 | + * @param Storage $storage |
|
151 | 151 | */ |
152 | 152 | protected function postSubmit($postValues, $storage) |
153 | 153 | {} |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
320 | - * @param $form |
|
320 | + * @param string|null $form |
|
321 | 321 | */ |
322 | 322 | private function setFormParameter($form) |
323 | 323 | { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]); |
160 | 160 | $whitelistIps = array_map("trim", $whitelistIps); |
161 | 161 | if (!in_array($remoteAddress, $whitelistIps)) { |
162 | - throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist'); |
|
162 | + throw new \Exception('Ip address '.$remoteAddress.' is not on whitelist'); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]); |
176 | 176 | $blacklistIps = array_map("trim", $blacklistIps); |
177 | 177 | if (in_array($remoteAddress, $blacklistIps)) { |
178 | - throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist'); |
|
178 | + throw new \Exception('Ip address '.$remoteAddress.' is on blacklist'); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | if ($relativeCmsUri == '/log-off') { |
220 | 220 | $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null; |
221 | 221 | unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]); |
222 | - header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
222 | + header('Location: '.$request::$subfolders.$this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
223 | 223 | exit; |
224 | 224 | } |
225 | 225 | } |