@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * Loop through sitemap items and see if one matches the requestUri. |
85 | 85 | * If it does, add it tot the matchedSitemapItems array |
86 | 86 | * |
87 | - * @param $request |
|
87 | + * @param Request $request |
|
88 | 88 | */ |
89 | 89 | private function sitemapMatching($request) |
90 | 90 | { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string $template |
147 | 147 | * @param array $parameters |
148 | 148 | * |
149 | - * @return mixed |
|
149 | + * @return \library\components\Component |
|
150 | 150 | * @throws \Exception |
151 | 151 | */ |
152 | 152 | private function getComponentObject($class='', $template='', $parameters=array()) |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private function config() |
63 | 63 | { |
64 | - $configPath = __DIR__ . '../../../config.json'; |
|
64 | + $configPath = __DIR__.'../../../config.json'; |
|
65 | 65 | if (realpath($configPath) !== false) { |
66 | 66 | $json = file_get_contents($configPath); |
67 | 67 | $this->config = json_decode($json); |
68 | 68 | } else { |
69 | - throw new \Exception('Couldn\'t find config file in path ' . $configPath); |
|
69 | + throw new \Exception('Couldn\'t find config file in path '.$configPath); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function sitemapMatching($request) |
90 | 90 | { |
91 | 91 | $sitemap = $this->storage->getSitemap(); |
92 | - $relativeUri = '/' . $request::$relativeUri; |
|
92 | + $relativeUri = '/'.$request::$relativeUri; |
|
93 | 93 | |
94 | 94 | foreach ($sitemap as $sitemapItem) { |
95 | 95 | if ($sitemapItem->regex) { |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | * @return mixed |
150 | 150 | * @throws \Exception |
151 | 151 | */ |
152 | - private function getComponentObject($class='', $template='', $parameters=array()) |
|
152 | + private function getComponentObject($class = '', $template = '', $parameters = array()) |
|
153 | 153 | { |
154 | - $libraryComponentName = '\\library\\components\\' . $class; |
|
155 | - $userComponentName = '\\components\\' . $class; |
|
154 | + $libraryComponentName = '\\library\\components\\'.$class; |
|
155 | + $userComponentName = '\\components\\'.$class; |
|
156 | 156 | |
157 | 157 | if (\autoLoad($libraryComponentName, false)) { |
158 | 158 | $component = new $libraryComponentName($template, $this->request, $parameters); |
159 | 159 | } elseif (\autoLoad($userComponentName, false)) { |
160 | 160 | $component = new $userComponentName($template, $this->request, $parameters); |
161 | 161 | } else { |
162 | - throw new \Exception('Could not load component ' . $class); |
|
162 | + throw new \Exception('Could not load component '.$class); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (!$component instanceof \library\components\Component) { |
@@ -29,7 +29,6 @@ |
||
29 | 29 | * Dumps a var_dump of the passed arguments with <pre> tags surrounding it. |
30 | 30 | * Dies afterwards |
31 | 31 | * |
32 | - * @param mixed $data The data to be displayed |
|
33 | 32 | */ |
34 | 33 | function dump() |
35 | 34 | { |
@@ -35,13 +35,13 @@ |
||
35 | 35 | { |
36 | 36 | $debug_backtrace = current(debug_backtrace()); |
37 | 37 | if (PHP_SAPI == 'cli') { |
38 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
38 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
39 | 39 | foreach (func_get_args() as $data) { |
40 | 40 | var_dump($data); |
41 | 41 | } |
42 | 42 | } else { |
43 | 43 | ob_clean(); |
44 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
44 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
45 | 45 | echo '<pre>'; |
46 | 46 | foreach (func_get_args() as $data) { |
47 | 47 | echo "<code>"; |
@@ -17,6 +17,7 @@ |
||
17 | 17 | * @param $template |
18 | 18 | * @param Request $request |
19 | 19 | * @param $parameters |
20 | + * @return void |
|
20 | 21 | */ |
21 | 22 | function __construct($template, Request $request, $parameters); |
22 | 23 |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function shutdownHandler () { |
33 | 33 | $error = error_get_last(); |
34 | - if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
35 | - errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
36 | - }elseif ($error['type'] == 1) { |
|
37 | - dump($error); |
|
38 | - } |
|
34 | + if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
35 | + errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
36 | + }elseif ($error['type'] == 1) { |
|
37 | + dump($error); |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -49,28 +49,28 @@ discard block |
||
49 | 49 | $jsonErrorNr = json_last_error(); |
50 | 50 | $errstr = ''; |
51 | 51 | switch ($jsonErrorNr) { |
52 | - case JSON_ERROR_NONE: |
|
53 | - $errstr .= ' - No errors' . PHP_EOL; |
|
54 | - break; |
|
55 | - case JSON_ERROR_DEPTH: |
|
56 | - $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
57 | - break; |
|
58 | - case JSON_ERROR_STATE_MISMATCH: |
|
59 | - $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
60 | - break; |
|
61 | - case JSON_ERROR_CTRL_CHAR: |
|
62 | - $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
63 | - break; |
|
64 | - case JSON_ERROR_SYNTAX: |
|
65 | - $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
66 | - break; |
|
67 | - case JSON_ERROR_UTF8: |
|
68 | - $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
69 | - break; |
|
70 | - default: |
|
71 | - $errstr = ' - Unknown error' . PHP_EOL; |
|
72 | - break; |
|
73 | - } |
|
52 | + case JSON_ERROR_NONE: |
|
53 | + $errstr .= ' - No errors' . PHP_EOL; |
|
54 | + break; |
|
55 | + case JSON_ERROR_DEPTH: |
|
56 | + $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
57 | + break; |
|
58 | + case JSON_ERROR_STATE_MISMATCH: |
|
59 | + $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
60 | + break; |
|
61 | + case JSON_ERROR_CTRL_CHAR: |
|
62 | + $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
63 | + break; |
|
64 | + case JSON_ERROR_SYNTAX: |
|
65 | + $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
66 | + break; |
|
67 | + case JSON_ERROR_UTF8: |
|
68 | + $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
69 | + break; |
|
70 | + default: |
|
71 | + $errstr = ' - Unknown error' . PHP_EOL; |
|
72 | + break; |
|
73 | + } |
|
74 | 74 | errorHandler ($jsonErrorNr, $errstr, $file, $line); |
75 | 75 | } |
76 | 76 | |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
88 | 88 | $file_lines = file_exists($file) ? file($file) : array(); |
89 | - $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
|
90 | - $lines = array(); |
|
89 | + $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
|
90 | + $lines = array(); |
|
91 | 91 | |
92 | - foreach ($range as $line_number) { |
|
93 | - if(isset($file_lines[$line_number-1])) { |
|
94 | - $lines[$line_number] = $file_lines[$line_number-1]; |
|
95 | - } |
|
96 | - } |
|
92 | + foreach ($range as $line_number) { |
|
93 | + if(isset($file_lines[$line_number-1])) { |
|
94 | + $lines[$line_number] = $file_lines[$line_number-1]; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | if (ob_get_contents()) ob_end_clean(); |
98 | 98 | $error = array( |
99 | 99 | 'message' => $message, |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @param $e |
11 | 11 | */ |
12 | -function exceptionHandler ($e) { |
|
13 | - renderError($e->getMessage(),$e->getFile(),$e->getLine(),$e->getCode(),$e->getTrace()); |
|
12 | +function exceptionHandler($e) { |
|
13 | + renderError($e->getMessage(), $e->getFile(), $e->getLine(), $e->getCode(), $e->getTrace()); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | * @param $errfile |
22 | 22 | * @param $errline |
23 | 23 | */ |
24 | -function errorHandler ($errno, $errstr, $errfile, $errline) { |
|
25 | - renderError($errstr,$errfile,$errline,$errno,debug_backtrace()); |
|
24 | +function errorHandler($errno, $errstr, $errfile, $errline) { |
|
25 | + renderError($errstr, $errfile, $errline, $errno, debug_backtrace()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * When an error occurs that kills the process, still try |
30 | 30 | * to show it using a shutdownHandler. |
31 | 31 | */ |
32 | -function shutdownHandler () { |
|
32 | +function shutdownHandler() { |
|
33 | 33 | $error = error_get_last(); |
34 | 34 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
35 | - errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
35 | + errorHandler($error['type'], $error['message'], $error['file'], $error['line']); |
|
36 | 36 | }elseif ($error['type'] == 1) { |
37 | 37 | dump($error); |
38 | 38 | } |
@@ -50,28 +50,28 @@ discard block |
||
50 | 50 | $errstr = ''; |
51 | 51 | switch ($jsonErrorNr) { |
52 | 52 | case JSON_ERROR_NONE: |
53 | - $errstr .= ' - No errors' . PHP_EOL; |
|
53 | + $errstr .= ' - No errors'.PHP_EOL; |
|
54 | 54 | break; |
55 | 55 | case JSON_ERROR_DEPTH: |
56 | - $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
56 | + $errstr .= ' - Maximum stack depth exceeded'.PHP_EOL; |
|
57 | 57 | break; |
58 | 58 | case JSON_ERROR_STATE_MISMATCH: |
59 | - $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
59 | + $errstr .= ' - Underflow or the modes mismatch'.PHP_EOL; |
|
60 | 60 | break; |
61 | 61 | case JSON_ERROR_CTRL_CHAR: |
62 | - $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
62 | + $errstr .= ' - Unexpected control character found'.PHP_EOL; |
|
63 | 63 | break; |
64 | 64 | case JSON_ERROR_SYNTAX: |
65 | - $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
65 | + $errstr .= ' - Syntax error, malformed JSON'.PHP_EOL; |
|
66 | 66 | break; |
67 | 67 | case JSON_ERROR_UTF8: |
68 | - $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
68 | + $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded'.PHP_EOL; |
|
69 | 69 | break; |
70 | 70 | default: |
71 | - $errstr = ' - Unknown error' . PHP_EOL; |
|
71 | + $errstr = ' - Unknown error'.PHP_EOL; |
|
72 | 72 | break; |
73 | 73 | } |
74 | - errorHandler ($jsonErrorNr, $errstr, $file, $line); |
|
74 | + errorHandler($jsonErrorNr, $errstr, $file, $line); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | * @param array $trace |
85 | 85 | * @param string $httpHeader |
86 | 86 | */ |
87 | -function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
|
87 | +function renderError($message = '', $file = '', $line = '', $code = 0, $trace = array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
|
88 | 88 | $file_lines = file_exists($file) ? file($file) : array(); |
89 | 89 | $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
90 | 90 | $lines = array(); |
91 | 91 | |
92 | 92 | foreach ($range as $line_number) { |
93 | - if(isset($file_lines[$line_number-1])) { |
|
94 | - $lines[$line_number] = $file_lines[$line_number-1]; |
|
93 | + if (isset($file_lines[$line_number - 1])) { |
|
94 | + $lines[$line_number] = $file_lines[$line_number - 1]; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | if (ob_get_contents()) ob_end_clean(); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | 'trace' => $trace, |
105 | 105 | 'httpHeader' => $httpHeader, |
106 | 106 | ); |
107 | - if (file_exists(realpath(__DIR__) . '/errorview.php')) { |
|
108 | - include(realpath(__DIR__) . '/errorview.php'); |
|
107 | + if (file_exists(realpath(__DIR__).'/errorview.php')) { |
|
108 | + include(realpath(__DIR__).'/errorview.php'); |
|
109 | 109 | } else { |
110 | 110 | header('Content-type: application/json'); |
111 | 111 | die(json_encode($error)); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $error = error_get_last(); |
34 | 34 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
35 | 35 | errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
36 | - }elseif ($error['type'] == 1) { |
|
36 | + } elseif ($error['type'] == 1) { |
|
37 | 37 | dump($error); |
38 | 38 | } |
39 | 39 | } |
@@ -94,7 +94,9 @@ discard block |
||
94 | 94 | $lines[$line_number] = $file_lines[$line_number-1]; |
95 | 95 | } |
96 | 96 | } |
97 | - if (ob_get_contents()) ob_end_clean(); |
|
97 | + if (ob_get_contents()) { |
|
98 | + ob_end_clean(); |
|
99 | + } |
|
98 | 100 | $error = array( |
99 | 101 | 'message' => $message, |
100 | 102 | 'file' => $file, |
@@ -47,10 +47,10 @@ |
||
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::$requestUri = $_SERVER['REQUEST_URI']; |
52 | 52 | self::$queryString = $_SERVER['QUERY_STRING']; |
53 | - self::$relativeUri = str_replace('?' . self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
53 | + self::$relativeUri = str_replace('?'.self::$queryString, '', str_replace(self::$subfolders, '', self::$requestUri)); |
|
54 | 54 | self::$requestParameters = explode('/', self::$relativeUri); |
55 | 55 | |
56 | 56 | self::$get = $_GET; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | spl_autoload_extensions('.php'); |
3 | 3 | spl_autoload_register("autoloader"); |
4 | 4 | |
5 | -$rootPath = str_replace('\\', '/', realpath(str_replace('\\', '/', dirname(__FILE__)) . '/../../') . '/'); |
|
5 | +$rootPath = str_replace('\\', '/', realpath(str_replace('\\', '/', dirname(__FILE__)).'/../../').'/'); |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * The function to be registered as the default autoload functino |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | global $rootPath; |
35 | - $file = $rootPath . str_replace('\\', '/', $class) . ".php"; |
|
35 | + $file = $rootPath.str_replace('\\', '/', $class).".php"; |
|
36 | 36 | $debug_backtrace = debug_backtrace(); |
37 | 37 | |
38 | 38 | if (file_exists($file)) { |
39 | 39 | require_once($file); |
40 | 40 | if ($throwException) { |
41 | 41 | if (class_exists($class, false) == false && interface_exists($class, false) == false) { |
42 | - throw new \Exception('Could not load class "' . $class . '" in file ' . $file); |
|
42 | + throw new \Exception('Could not load class "'.$class.'" in file '.$file); |
|
43 | 43 | } else { |
44 | 44 | return true; |
45 | 45 | } |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | } else { |
49 | 49 | if (isset($debug_backtrace[2]) && isset($debug_backtrace[2]['file']) && isset($debug_backtrace[2]['line'])) { |
50 | 50 | if ($throwException) { |
51 | - errorHandler(0, 'Could not load class \'' . $class . '\' in file ' . $rootPath . $file, $debug_backtrace[2]['file'], $debug_backtrace[2]['line']); |
|
51 | + errorHandler(0, 'Could not load class \''.$class.'\' in file '.$rootPath.$file, $debug_backtrace[2]['file'], $debug_backtrace[2]['line']); |
|
52 | 52 | } else { |
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | } else { |
56 | 56 | if ($throwException) { |
57 | - throw new \Exception('Could not load class "' . $class . '" in file ' . $file . "\n" . 'Called from unknown origin.'); |
|
57 | + throw new \Exception('Could not load class "'.$class.'" in file '.$file."\n".'Called from unknown origin.'); |
|
58 | 58 | } else { |
59 | 59 | return false; |
60 | 60 | } |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | private function config() |
20 | 20 | { |
21 | - $storagePath = __DIR__ . $this->storagePath; |
|
21 | + $storagePath = __DIR__.$this->storagePath; |
|
22 | 22 | if (realpath($storagePath) !== false) { |
23 | 23 | $jsonString = file_get_contents($storagePath); |
24 | 24 | $this->repository = json_decode($jsonString); |
25 | 25 | } else { |
26 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
26 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
@@ -320,17 +320,17 @@ discard block |
||
320 | 320 | * |
321 | 321 | */ |
322 | 322 | private function save() { |
323 | - $storagePath = __DIR__ . $this->storagePath; |
|
323 | + $storagePath = __DIR__.$this->storagePath; |
|
324 | 324 | if (realpath($storagePath) !== false) { |
325 | 325 | file_put_contents($storagePath, json_encode($this->repository)); |
326 | 326 | } else { |
327 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
327 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - private function slugify($str, $replace=array(), $delimiter='-') { |
|
332 | - if( !empty($replace) ) { |
|
333 | - $str = str_replace((array)$replace, ' ', $str); |
|
331 | + private function slugify($str, $replace = array(), $delimiter = '-') { |
|
332 | + if (!empty($replace)) { |
|
333 | + $str = str_replace((array) $replace, ' ', $str); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function showLogin() |
73 | 73 | { |
74 | - $loginTemplatePath = __DIR__ . '../../../templates/cms/login.php'; |
|
74 | + $loginTemplatePath = __DIR__.'../../../templates/cms/login.php'; |
|
75 | 75 | if (realpath($loginTemplatePath) !== false) { |
76 | 76 | ob_clean(); |
77 | 77 | extract($this->parameters); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ob_end_flush(); |
80 | 80 | exit; |
81 | 81 | } else { |
82 | - throw new \Exception('Cannot load login template ' . $loginTemplatePath); |
|
82 | + throw new \Exception('Cannot load login template '.$loginTemplatePath); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $this->parameters['mainNavClass'] = 'sitemap'; |
115 | 115 | if (isset($request::$post['title'], $request::$post['template'], $request::$post['component'])) { |
116 | 116 | $this->storage->addSitemapItem($request::$post); |
117 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
117 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
118 | 118 | exit; |
119 | 119 | } |
120 | 120 | } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get['slug'])) { |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | $sitemapItem = $this->storage->getSitemapItemBySlug($request::$get['slug']); |
124 | 124 | if (isset($request::$post['title'], $request::$post['template'], $request::$post['component'])) { |
125 | 125 | $this->storage->saveSitemapItem($request::$get['slug'], $request::$post); |
126 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
126 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
127 | 127 | exit; |
128 | 128 | } |
129 | 129 | $this->parameters['sitemapItem'] = $sitemapItem; |
130 | 130 | } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get['slug'])) { |
131 | 131 | $this->storage->deleteSitemapItemBySlug($request::$get['slug']); |
132 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
132 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
133 | 133 | exit; |
134 | 134 | } elseif ($relativeCmsUri == '/configuration') { |
135 | 135 | $template = 'cms/configuration'; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $bricks = $this->storage->getBricks(); |
145 | 145 | if (isset($request::$post['title'])) { |
146 | 146 | $this->storage->addDocumentType($request::$post); |
147 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
147 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
148 | 148 | exit; |
149 | 149 | } |
150 | 150 | $this->parameters['bricks'] = $bricks; |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | $bricks = $this->storage->getBricks(); |
156 | 156 | if (isset($request::$post['title'])) { |
157 | 157 | $this->storage->saveDocumentType($request::$get['slug'], $request::$post); |
158 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
158 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
159 | 159 | exit; |
160 | 160 | } |
161 | 161 | $this->parameters['documentType'] = $documentType; |
162 | 162 | $this->parameters['bricks'] = $bricks; |
163 | 163 | } elseif ($relativeCmsUri == '/configuration/document-types/delete' && isset($request::$get['slug'])) { |
164 | 164 | $this->storage->deleteDocumentTypeBySlug($request::$get['slug']); |
165 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
165 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
166 | 166 | exit; |
167 | 167 | } elseif ($relativeCmsUri == '/configuration/bricks') { |
168 | 168 | $template = 'cms/configuration/bricks'; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $this->parameters['mainNavClass'] = 'configuration'; |
174 | 174 | if (isset($request::$post['title'])) { |
175 | 175 | $this->storage->addBrick($request::$post); |
176 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
176 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
177 | 177 | exit; |
178 | 178 | } |
179 | 179 | } elseif ($relativeCmsUri == '/configuration/bricks/edit' && isset($request::$get['slug'])) { |
@@ -182,18 +182,18 @@ discard block |
||
182 | 182 | $brick = $this->storage->getBrickBySlug($request::$get['slug']); |
183 | 183 | if (isset($request::$post['title'])) { |
184 | 184 | $this->storage->saveBrick($request::$get['slug'], $request::$post); |
185 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
185 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
186 | 186 | exit; |
187 | 187 | } |
188 | 188 | $this->parameters['brick'] = $brick; |
189 | 189 | } elseif ($relativeCmsUri == '/configuration/bricks/delete' && isset($request::$get['slug'])) { |
190 | 190 | $this->storage->deleteBrickBySlug($request::$get['slug']); |
191 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
191 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
192 | 192 | exit; |
193 | 193 | } elseif ($relativeCmsUri == '/log-off') { |
194 | 194 | $_SESSION['cloudcontrol'] = null; |
195 | 195 | unset($_SESSION['cloudcontrol']); |
196 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix']); |
|
196 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix']); |
|
197 | 197 | exit; |
198 | 198 | } |
199 | 199 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param Request $request |
36 | 36 | * @param array $parameters |
37 | 37 | */ |
38 | - public function __construct($template='', Request $request, $parameters=array()) |
|
38 | + public function __construct($template = '', Request $request, $parameters = array()) |
|
39 | 39 | { |
40 | 40 | $this->template = $template; |
41 | 41 | $this->request = $request; |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | * @return string |
81 | 81 | * @throws \Exception |
82 | 82 | */ |
83 | - public function renderTemplate($template='') |
|
83 | + public function renderTemplate($template = '') |
|
84 | 84 | { |
85 | - $templatePath = __DIR__ . '../../../templates/' . $template . '.php'; |
|
85 | + $templatePath = __DIR__.'../../../templates/'.$template.'.php'; |
|
86 | 86 | if (realpath($templatePath) !== false) { |
87 | 87 | ob_clean(); |
88 | 88 | extract($this->parameters); |
89 | 89 | include($templatePath); |
90 | 90 | return ob_get_contents(); |
91 | 91 | } else { |
92 | - throw new \Exception('Couldnt find template ' . $templatePath); |
|
92 | + throw new \Exception('Couldnt find template '.$templatePath); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | } |