@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | } elseif ($name === 'content') { |
54 | 54 | if ($this->dbHandle === null) { |
55 | - throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')'); |
|
55 | + throw new \Exception('Document doesnt have a dbHandle handle. (path: '.$this->path.')'); |
|
56 | 56 | } else { |
57 | 57 | if ($this->content === null) { |
58 | 58 | return $this->getContent(); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function __toString() |
99 | 99 | { |
100 | - return 'Document:' . $this->title; |
|
100 | + return 'Document:'.$this->title; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function getDocuments($state = 'published') |
22 | 22 | { |
23 | 23 | if (!in_array($state, Document::$DOCUMENT_STATES)) { |
24 | - throw new \Exception('Unsupported document state: ' . $state); |
|
24 | + throw new \Exception('Unsupported document state: '.$state); |
|
25 | 25 | } |
26 | 26 | return $this->repository->getDocuments($state); |
27 | 27 | } |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | public function getDocumentBySlug($slug, $state = 'published') |
51 | 51 | { |
52 | 52 | if (!in_array($state, Document::$DOCUMENT_STATES)) { |
53 | - throw new \Exception('Unsupported document state: ' . $state); |
|
53 | + throw new \Exception('Unsupported document state: '.$state); |
|
54 | 54 | } |
55 | - $path = '/' . $slug; |
|
55 | + $path = '/'.$slug; |
|
56 | 56 | |
57 | 57 | return $this->repository->getDocumentByPath($path, $state); |
58 | 58 | } |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | public function saveDocument($postValues, $state = 'unpublished') |
67 | 67 | { |
68 | 68 | if (!in_array($state, Document::$DOCUMENT_STATES)) { |
69 | - throw new \Exception('Unsupported document state: ' . $state); |
|
69 | + throw new \Exception('Unsupported document state: '.$state); |
|
70 | 70 | } |
71 | - $oldPath = '/' . $postValues['path']; |
|
71 | + $oldPath = '/'.$postValues['path']; |
|
72 | 72 | |
73 | 73 | $container = $this->getDocumentContainerByPath($oldPath); |
74 | 74 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository)); |
75 | 75 | if ($container->path === '/') { |
76 | - $newPath = $container->path . $documentObject->slug; |
|
76 | + $newPath = $container->path.$documentObject->slug; |
|
77 | 77 | } else { |
78 | - $newPath = $container->path . '/' . $documentObject->slug; |
|
78 | + $newPath = $container->path.'/'.$documentObject->slug; |
|
79 | 79 | } |
80 | 80 | $documentObject->path = $newPath; |
81 | 81 | $this->repository->saveDocument($documentObject, $state); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | { |
90 | 90 | $documentObject = DocumentFactory::createDocumentFromPostValues($postValues, new DocumentTypesStorage($this->repository)); |
91 | 91 | if ($postValues['path'] === '/') { |
92 | - $documentObject->path = $postValues['path'] . $documentObject->slug; |
|
92 | + $documentObject->path = $postValues['path'].$documentObject->slug; |
|
93 | 93 | } else { |
94 | - $documentObject->path = $postValues['path'] . '/' . $documentObject->slug; |
|
94 | + $documentObject->path = $postValues['path'].'/'.$documentObject->slug; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $this->repository->saveDocument($documentObject, $state); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function deleteDocumentBySlug($slug) |
104 | 104 | { |
105 | - $path = '/' . $slug; |
|
105 | + $path = '/'.$slug; |
|
106 | 106 | $this->repository->deleteDocumentByPath($path); |
107 | 107 | } |
108 | 108 |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $destinationPath = $this->getDestinationPath(); |
46 | 46 | |
47 | 47 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
48 | - $destination = $destinationPath . DIRECTORY_SEPARATOR . $filename; |
|
48 | + $destination = $destinationPath.DIRECTORY_SEPARATOR.$filename; |
|
49 | 49 | |
50 | 50 | if ($postValues['error'] != '0') { |
51 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
51 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | foreach ($images as $key => $image) { |
81 | 81 | if ($image->file == $filename) { |
82 | 82 | foreach ($image->set as $imageSetFilename) { |
83 | - $destination = $destinationPath . '/' . $imageSetFilename; |
|
83 | + $destination = $destinationPath.'/'.$imageSetFilename; |
|
84 | 84 | if (file_exists($destination)) { |
85 | 85 | unlink($destination); |
86 | 86 | } else { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function getDestinationPath() |
130 | 130 | { |
131 | - $destinationPath = realpath($this->imagesDir . DIRECTORY_SEPARATOR); |
|
131 | + $destinationPath = realpath($this->imagesDir.DIRECTORY_SEPARATOR); |
|
132 | 132 | return $destinationPath; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | \ No newline at end of file |
@@ -38,19 +38,19 @@ |
||
38 | 38 | array_pop($fileParts); |
39 | 39 | $fileNameWithoutExtension = implode('-', $fileParts); |
40 | 40 | $fileNameWithoutExtension = StringUtil::slugify($fileNameWithoutExtension); |
41 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
41 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
42 | 42 | } else { |
43 | 43 | $filename = StringUtil::slugify($filename); |
44 | 44 | } |
45 | 45 | |
46 | - if (file_exists($path . '/' . $filename)) { |
|
46 | + if (file_exists($path.'/'.$filename)) { |
|
47 | 47 | $fileParts = explode('.', $filename); |
48 | 48 | if (count($fileParts) > 1) { |
49 | 49 | $extension = end($fileParts); |
50 | 50 | array_pop($fileParts); |
51 | 51 | $fileNameWithoutExtension = implode('-', $fileParts); |
52 | 52 | $fileNameWithoutExtension .= '-copy'; |
53 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
53 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
54 | 54 | } else { |
55 | 55 | $filename .= '-copy'; |
56 | 56 | } |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | $destinationPath = $this->getDestinationPath(); |
38 | 38 | |
39 | 39 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
40 | - $destination = $destinationPath . '/' . $filename; |
|
40 | + $destination = $destinationPath.'/'.$filename; |
|
41 | 41 | |
42 | 42 | if ($postValues['error'] != '0') { |
43 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
43 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function deleteFileByName($filename) |
84 | 84 | { |
85 | 85 | $destinationPath = $this->getDestinationPath(); |
86 | - $destination = $destinationPath . '/' . $filename; |
|
86 | + $destination = $destinationPath.'/'.$filename; |
|
87 | 87 | |
88 | 88 | if (file_exists($destination)) { |
89 | 89 | $files = $this->getFiles(); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | protected function getDestinationPath() |
115 | 115 | { |
116 | - $destinationPath = realpath($this->filesDir . DIRECTORY_SEPARATOR); |
|
116 | + $destinationPath = realpath($this->filesDir.DIRECTORY_SEPARATOR); |
|
117 | 117 | return $destinationPath; |
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param array $parameters |
42 | 42 | * @param $matchedSitemapItem |
43 | 43 | */ |
44 | - public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem) |
|
44 | + public function __construct($template = '', Request $request, $parameters = array(), $matchedSitemapItem) |
|
45 | 45 | { |
46 | 46 | $this->template = $template; |
47 | 47 | $this->request = $request; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @throws \Exception |
68 | 68 | */ |
69 | - public function render($application=null) |
|
69 | + public function render($application = null) |
|
70 | 70 | { |
71 | 71 | $this->renderedContent = $this->renderTemplate($this->template, true, $application); |
72 | 72 | } |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | * @return string |
93 | 93 | * @throws \Exception |
94 | 94 | */ |
95 | - public function renderTemplate($template='', $obClean = true, $application=null) |
|
95 | + public function renderTemplate($template = '', $obClean = true, $application = null) |
|
96 | 96 | { |
97 | 97 | $templateDir = $this->getTemplateDir($template, $application); |
98 | 98 | if ($application !== null) { |
99 | 99 | $rootDir = $application->getRootDir(); |
100 | 100 | if (strpos($templateDir, $rootDir) === false) { |
101 | - $templatePath = $rootDir . DIRECTORY_SEPARATOR . $templateDir; |
|
101 | + $templatePath = $rootDir.DIRECTORY_SEPARATOR.$templateDir; |
|
102 | 102 | } else { |
103 | 103 | $templatePath = $templateDir; |
104 | 104 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return ob_get_contents(); |
122 | 122 | } else { |
123 | 123 | if ($template !== null) { // If template is null, its a application component, which doesnt have a template |
124 | - throw new \Exception('Couldnt find template ' . $templatePath); |
|
124 | + throw new \Exception('Couldnt find template '.$templatePath); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return string |
137 | 137 | * @throws \Exception |
138 | 138 | */ |
139 | - public function includeTemplate($template='', $parameters = array()) |
|
139 | + public function includeTemplate($template = '', $parameters = array()) |
|
140 | 140 | { |
141 | 141 | if (is_array($parameters)) { |
142 | 142 | foreach ($parameters as $name => $value) { |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * @param null | Application $application |
157 | 157 | * @return string |
158 | 158 | */ |
159 | - protected function getTemplateDir($template, $application=null) |
|
159 | + protected function getTemplateDir($template, $application = null) |
|
160 | 160 | { |
161 | 161 | $templatePath = ''; |
162 | 162 | if ($application !== null) { |
163 | 163 | $templatePath = $application->getTemplateDir(); |
164 | 164 | } |
165 | - $templatePath = $templatePath . $template . '.php'; |
|
165 | + $templatePath = $templatePath.$template.'.php'; |
|
166 | 166 | return $templatePath; |
167 | 167 | } |
168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]); |
171 | 171 | $whitelistIps = array_map("trim", $whitelistIps); |
172 | 172 | if (!in_array($remoteAddress, $whitelistIps)) { |
173 | - throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist'); |
|
173 | + throw new \Exception('Ip address '.$remoteAddress.' is not on whitelist'); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]); |
187 | 187 | $blacklistIps = array_map("trim", $blacklistIps); |
188 | 188 | if (in_array($remoteAddress, $blacklistIps)) { |
189 | - throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist'); |
|
189 | + throw new \Exception('Ip address '.$remoteAddress.' is on blacklist'); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if ($relativeCmsUri == '/log-off') { |
231 | 231 | $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null; |
232 | 232 | unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]); |
233 | - header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
233 | + header('Location: '.$request::$subfolders.$this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
234 | 234 | exit; |
235 | 235 | } |
236 | 236 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | protected function getTemplateDir($template, $application = null) |
373 | 373 | { |
374 | - return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php'; |
|
374 | + return __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$template.'.php'; |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | } |
378 | 378 | \ No newline at end of file |
@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | { |
41 | 41 | $file = $cmsComponent->storage->getFiles()->getFileByName($slug); |
42 | 42 | $path = realpath($cmsComponent->storage->getFiles()->getFilesDir()); |
43 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
44 | - $size = filesize($path . '/' . $file->file); |
|
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 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | $debug_backtrace = current(debug_backtrace()); |
13 | 13 | if (PHP_SAPI == 'cli') { |
14 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
14 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
15 | 15 | foreach (func_get_args() as $data) { |
16 | 16 | var_dump($data); |
17 | 17 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <body> |
30 | 30 | END; |
31 | 31 | |
32 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
32 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
33 | 33 | echo '<pre>'; |
34 | 34 | foreach (func_get_args() as $data) { |
35 | 35 | echo "<code>"; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | if (!isset($_GET['unsanitized'])) { |
57 | 57 | $search = array( |
58 | - '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
59 | - '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
60 | - '/(\s)+/s', // shorten multiple whitespace sequences |
|
58 | + '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
59 | + '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
60 | + '/(\s)+/s', // shorten multiple whitespace sequences |
|
61 | 61 | '/<!--(.|\s)*?-->/' // Remove HTML comments |
62 | 62 | ); |
63 | 63 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function utf8Convert($array) |
87 | 87 | { |
88 | - array_walk_recursive($array, function (&$item) { |
|
88 | + array_walk_recursive($array, function(&$item) { |
|
89 | 89 | if (!mb_detect_encoding($item, 'utf-8', true)) { |
90 | 90 | $item = utf8_encode($item); |
91 | 91 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | function getRelativePath($from, $to) |
106 | 106 | { |
107 | 107 | // some compatibility fixes for Windows paths |
108 | - $from = is_dir($from) ? rtrim($from, '\/') . DIRECTORY_SEPARATOR : $from; |
|
109 | - $to = is_dir($to) ? rtrim($to, '\/') . DIRECTORY_SEPARATOR : $to; |
|
108 | + $from = is_dir($from) ? rtrim($from, '\/').DIRECTORY_SEPARATOR : $from; |
|
109 | + $to = is_dir($to) ? rtrim($to, '\/').DIRECTORY_SEPARATOR : $to; |
|
110 | 110 | $from = str_replace('\\', DIRECTORY_SEPARATOR, $from); |
111 | 111 | $to = str_replace('\\', DIRECTORY_SEPARATOR, $to); |
112 | 112 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | $relPath = array_pad($relPath, $padLength, '..'); |
129 | 129 | break; |
130 | 130 | } else { |
131 | - $relPath[0] = '.' . DIRECTORY_SEPARATOR . $relPath[0]; |
|
131 | + $relPath[0] = '.'.DIRECTORY_SEPARATOR.$relPath[0]; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
135 | 135 | $relPath = implode(DIRECTORY_SEPARATOR, $relPath); |
136 | - while (strpos($relPath, '.' . DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR) !== false) { |
|
137 | - $relPath = str_replace('.' . DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR, '.' . DIRECTORY_SEPARATOR, $relPath); |
|
136 | + while (strpos($relPath, '.'.DIRECTORY_SEPARATOR.'.'.DIRECTORY_SEPARATOR) !== false) { |
|
137 | + $relPath = str_replace('.'.DIRECTORY_SEPARATOR.'.'.DIRECTORY_SEPARATOR, '.'.DIRECTORY_SEPARATOR, $relPath); |
|
138 | 138 | } |
139 | 139 | return $relPath; |
140 | 140 | } |
141 | 141 | \ No newline at end of file |