@@ -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; |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $imageContent = file_get_contents($imageContainer); |
33 | 33 | $this->_imageResource = imagecreatefromstring($imageContent); |
34 | 34 | } |
35 | - } elseif(is_string($imageContainer)) { |
|
35 | + } elseif (is_string($imageContainer)) { |
|
36 | 36 | $this->_imageResource = imagecreatefromstring($imageContainer); |
37 | 37 | } else { |
38 | - throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>' . var_export($imageContainer, true) . '</pre>'); |
|
38 | + throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>'.var_export($imageContainer, true).'</pre>'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | |
56 | 56 | if ($mimeTypeConstantValue == IMAGETYPE_GIF) { |
57 | 57 | return imagegif($imageResource, $path); |
58 | - } elseif ($mimeTypeConstantValue == IMAGETYPE_JPEG) { |
|
58 | + } elseif ($mimeTypeConstantValue == IMAGETYPE_JPEG) { |
|
59 | 59 | return imagejpeg($imageResource, $path, $quality); |
60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
61 | - return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
|
61 | + return imagepng($imageResource, $path, (intval($quality / 10) - 1)); |
|
62 | 62 | } |
63 | 63 | else { |
64 | 64 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (function_exists('exif_imagetype')) { |
80 | 80 | $exif = exif_imagetype($imagePath); |
81 | 81 | } else { |
82 | - if ((list($width, $height, $type, $attr) = getimagesize($imagePath)) !== false ) { |
|
82 | + if ((list($width, $height, $type, $attr) = getimagesize($imagePath)) !== false) { |
|
83 | 83 | $exif = $type; |
84 | 84 | } else { |
85 | 85 | $exif = false; |
@@ -99,86 +99,86 @@ discard block |
||
99 | 99 | public function CreateImageFromBmp($p_sFile) |
100 | 100 | { |
101 | 101 | // Load the image into a string |
102 | - $file = fopen($p_sFile,"rb"); |
|
103 | - $read = fread($file,10); |
|
104 | - while(!feof($file)&&($read<>"")) |
|
105 | - $read .= fread($file,1024); |
|
102 | + $file = fopen($p_sFile, "rb"); |
|
103 | + $read = fread($file, 10); |
|
104 | + while (!feof($file) && ($read <> "")) |
|
105 | + $read .= fread($file, 1024); |
|
106 | 106 | |
107 | - $temp = unpack("H*",$read); |
|
108 | - $hex = $temp[1]; |
|
109 | - $header = substr($hex,0,108); |
|
110 | - $width=null; |
|
111 | - $height=null; |
|
107 | + $temp = unpack("H*", $read); |
|
108 | + $hex = $temp[1]; |
|
109 | + $header = substr($hex, 0, 108); |
|
110 | + $width = null; |
|
111 | + $height = null; |
|
112 | 112 | |
113 | 113 | // Process the header |
114 | 114 | // Structure: http://www.fastgraph.com/help/bmp_header_format.html |
115 | - if (substr($header,0,4)=="424d") |
|
115 | + if (substr($header, 0, 4) == "424d") |
|
116 | 116 | { |
117 | 117 | // Cut it in parts of 2 bytes |
118 | - $header_parts = str_split($header,2); |
|
118 | + $header_parts = str_split($header, 2); |
|
119 | 119 | |
120 | 120 | // Get the width 4 bytes |
121 | - $width = hexdec($header_parts[19].$header_parts[18]); |
|
121 | + $width = hexdec($header_parts[19].$header_parts[18]); |
|
122 | 122 | |
123 | 123 | // Get the height 4 bytes |
124 | - $height = hexdec($header_parts[23].$header_parts[22]); |
|
124 | + $height = hexdec($header_parts[23].$header_parts[22]); |
|
125 | 125 | |
126 | 126 | // Unset the header params |
127 | 127 | unset($header_parts); |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Define starting X and Y |
131 | - $x = 0; |
|
132 | - $y = 1; |
|
131 | + $x = 0; |
|
132 | + $y = 1; |
|
133 | 133 | |
134 | 134 | // Create newimage |
135 | - $image = imagecreatetruecolor($width,$height); |
|
135 | + $image = imagecreatetruecolor($width, $height); |
|
136 | 136 | |
137 | 137 | // Grab the body from the image |
138 | - $body = substr($hex,108); |
|
138 | + $body = substr($hex, 108); |
|
139 | 139 | |
140 | 140 | // Calculate if padding at the end-line is needed |
141 | 141 | // Divided by two to keep overview. |
142 | 142 | // 1 byte = 2 HEX-chars |
143 | - $body_size = (strlen($body)/2); |
|
144 | - $header_size = ($width*$height); |
|
143 | + $body_size = (strlen($body) / 2); |
|
144 | + $header_size = ($width * $height); |
|
145 | 145 | |
146 | 146 | // Use end-line padding? Only when needed |
147 | - $usePadding = ($body_size>($header_size*3)+4); |
|
147 | + $usePadding = ($body_size > ($header_size * 3) + 4); |
|
148 | 148 | |
149 | 149 | // Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption |
150 | 150 | // Calculate the next DWORD-position in the body |
151 | - for ($i=0;$i<$body_size;$i+=3) |
|
151 | + for ($i = 0; $i < $body_size; $i += 3) |
|
152 | 152 | { |
153 | 153 | // Calculate line-ending and padding |
154 | - if ($x>=$width) |
|
154 | + if ($x >= $width) |
|
155 | 155 | { |
156 | 156 | // If padding needed, ignore image-padding |
157 | 157 | // Shift i to the ending of the current 32-bit-block |
158 | 158 | if ($usePadding) |
159 | - $i += $width%4; |
|
159 | + $i += $width % 4; |
|
160 | 160 | |
161 | 161 | // Reset horizontal position |
162 | - $x = 0; |
|
162 | + $x = 0; |
|
163 | 163 | |
164 | 164 | // Raise the height-position (bottom-up) |
165 | 165 | $y++; |
166 | 166 | |
167 | 167 | // Reached the image-height? Break the for-loop |
168 | - if ($y>$height) |
|
168 | + if ($y > $height) |
|
169 | 169 | break; |
170 | 170 | } |
171 | 171 | |
172 | 172 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
173 | 173 | // Define $i_pos as absolute position in the body |
174 | - $i_pos = $i*2; |
|
175 | - $r = hexdec($body[$i_pos+4].$body[$i_pos+5]); |
|
176 | - $g = hexdec($body[$i_pos+2].$body[$i_pos+3]); |
|
177 | - $b = hexdec($body[$i_pos].$body[$i_pos+1]); |
|
174 | + $i_pos = $i * 2; |
|
175 | + $r = hexdec($body[$i_pos + 4].$body[$i_pos + 5]); |
|
176 | + $g = hexdec($body[$i_pos + 2].$body[$i_pos + 3]); |
|
177 | + $b = hexdec($body[$i_pos].$body[$i_pos + 1]); |
|
178 | 178 | |
179 | 179 | // Calculate and draw the pixel |
180 | - $color = imagecolorallocate($image,$r,$g,$b); |
|
181 | - imagesetpixel($image,$x,$height-$y,$color); |
|
180 | + $color = imagecolorallocate($image, $r, $g, $b); |
|
181 | + imagesetpixel($image, $x, $height - $y, $color); |
|
182 | 182 | |
183 | 183 | // Raise the horizontal position |
184 | 184 | $x++; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | return $returnFileNames; |
49 | 49 | } else { |
50 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
50 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @return string |
59 | 59 | * @throws \Exception |
60 | 60 | */ |
61 | - public function resize($imagePath='', $width='',$height='') |
|
61 | + public function resize($imagePath = '', $width = '', $height = '') |
|
62 | 62 | { |
63 | - $modifier = '-r' . $width . 'x' . $height; |
|
63 | + $modifier = '-r'.$width.'x'.$height; |
|
64 | 64 | $destination = $this->modifyName($imagePath, $modifier); |
65 | 65 | if (file_exists($imagePath)) { |
66 | 66 | $image = new Image(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
75 | 75 | return basename($destination); |
76 | 76 | } else { |
77 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
77 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * @return string |
86 | 86 | * @throws \Exception |
87 | 87 | */ |
88 | - public function smartcrop($imagePath='', $width='',$height='') |
|
88 | + public function smartcrop($imagePath = '', $width = '', $height = '') |
|
89 | 89 | { |
90 | - $modifier = '-s' . $width . 'x' . $height; |
|
90 | + $modifier = '-s'.$width.'x'.$height; |
|
91 | 91 | $destination = $this->modifyName($imagePath, $modifier); |
92 | 92 | if (file_exists($imagePath)) { |
93 | 93 | $image = new Image(); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
102 | 102 | return basename($destination); |
103 | 103 | } else { |
104 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
104 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | * @return string |
113 | 113 | * @throws \Exception |
114 | 114 | */ |
115 | - public function boxcrop($imagePath='', $width='',$height='') |
|
115 | + public function boxcrop($imagePath = '', $width = '', $height = '') |
|
116 | 116 | { |
117 | - $modifier = '-b' . $width . 'x' . $height; |
|
117 | + $modifier = '-b'.$width.'x'.$height; |
|
118 | 118 | $destination = $this->modifyName($imagePath, $modifier); |
119 | 119 | if (file_exists($imagePath)) { |
120 | 120 | $image = new Image(); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
129 | 129 | return basename($destination); |
130 | 130 | } else { |
131 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
131 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - private function modifyName($imagePath, $modifier='') |
|
141 | + private function modifyName($imagePath, $modifier = '') |
|
142 | 142 | { |
143 | 143 | $filename = basename($imagePath); |
144 | 144 | $path = dirname($imagePath); |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | array_pop($fileParts); |
149 | 149 | $fileNameWithoutExtension = implode('-', $fileParts); |
150 | 150 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
151 | - $filename = $fileNameWithoutExtension . $modifier . '.' . $extension; |
|
151 | + $filename = $fileNameWithoutExtension.$modifier.'.'.$extension; |
|
152 | 152 | } else { |
153 | 153 | $filename = slugify($filename); |
154 | 154 | } |
155 | 155 | |
156 | - if (file_exists($path . '/' . $filename)) { |
|
156 | + if (file_exists($path.'/'.$filename)) { |
|
157 | 157 | $fileParts = explode('.', $filename); |
158 | 158 | if (count($fileParts) > 1) { |
159 | 159 | $extension = end($fileParts); |
160 | 160 | array_pop($fileParts); |
161 | 161 | $fileNameWithoutExtension = implode('-', $fileParts); |
162 | 162 | $fileNameWithoutExtension .= '-copy'; |
163 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
163 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
164 | 164 | } else { |
165 | 165 | $filename .= '-copy'; |
166 | 166 | } |
167 | - return $this->modifyName($path . '/' . $filename); |
|
167 | + return $this->modifyName($path.'/'.$filename); |
|
168 | 168 | } |
169 | - return $path . '/' . $filename; |
|
169 | + return $path.'/'.$filename; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
173 | 173 | \ No newline at end of file |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
4 | 4 | </div> |
5 | 5 | <?if ($static == true) { |
6 | - $fieldPrefix = 'bricks[' . $myBrickSlug . '][' . str_replace('.', '', str_replace(' ', '', microtime())) . '][fields]'; |
|
6 | + $fieldPrefix = 'bricks['.$myBrickSlug.']['.str_replace('.', '', str_replace(' ', '', microtime())).'][fields]'; |
|
7 | 7 | } else { |
8 | - $fieldPrefix = 'dynamicBricks[' . $brick->slug . '][' . str_replace('.', '', str_replace(' ', '', microtime())) . ']'; |
|
8 | + $fieldPrefix = 'dynamicBricks['.$brick->slug.']['.str_replace('.', '', str_replace(' ', '', microtime())).']'; |
|
9 | 9 | }?> |
10 | 10 | <? foreach ($brick->fields as $field) : ?> |
11 | 11 | <div class="form-element"> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
31 | 31 | <div class="form-element"> |
32 | 32 | <? endif ?> |
33 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
33 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
34 | 34 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
35 | 35 | |
36 | 36 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | <li class="grid-container"> |
53 | 53 | <div class="grid-box-10"> |
54 | 54 | <div class="grid-inner form-element"> |
55 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
55 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
56 | 56 | </div> |
57 | 57 | </div> |
58 | 58 | <div class="grid-box-2"> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | </div> |
63 | 63 | </div> |
64 | 64 | </li> |
65 | - <?$value='';?> |
|
65 | + <?$value = ''; ?> |
|
66 | 66 | <? endforeach ?> |
67 | 67 | <? endif ?> |
68 | 68 | </ul> |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
80 | 80 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
81 | 81 | <div class="form-element"> |
82 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
82 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
83 | 83 | </div> |
84 | 84 | </li> |
85 | - <?$value='';?> |
|
85 | + <?$value = ''; ?> |
|
86 | 86 | <? endforeach ?> |
87 | 87 | <? endif ?> |
88 | 88 | </div> |
@@ -91,5 +91,5 @@ discard block |
||
91 | 91 | <a class="btn js-addrtemultiple">+</a> |
92 | 92 | <? endif ?> |
93 | 93 | </div> |
94 | - <?$value='';?> |
|
94 | + <?$value = ''; ?> |
|
95 | 95 | <? endforeach ?> |
@@ -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 ?> |
@@ -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"> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | <label for="state">Published</label> |
39 | 39 | <input<?=isset($document) && $document->state == 'published' ? ' checked="checked"' : '' ?> type="checkbox" id="state" name="state" placeholder="State" /> |
40 | 40 | </div> |
41 | - <?$fieldPrefix='fields';?> |
|
41 | + <?$fieldPrefix = 'fields'; ?> |
|
42 | 42 | <? foreach ($documentType->fields as $field) : ?> |
43 | 43 | <div class="form-element"> |
44 | 44 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
63 | 63 | <div class="form-element"> |
64 | 64 | <? endif ?> |
65 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
65 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
66 | 66 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
67 | 67 | |
68 | 68 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <li class="grid-container"> |
85 | 85 | <div class="grid-box-10"> |
86 | 86 | <div class="grid-inner form-element"> |
87 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
87 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
88 | 88 | </div> |
89 | 89 | </div> |
90 | 90 | <div class="grid-box-2"> |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | </div> |
95 | 95 | </div> |
96 | 96 | </li> |
97 | - <?$value='';?> |
|
97 | + <?$value = ''; ?> |
|
98 | 98 | <? endforeach ?> |
99 | 99 | <? endif ?> |
100 | 100 | </ul> |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
112 | 112 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
113 | 113 | <div class="form-element"> |
114 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
114 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
115 | 115 | </div> |
116 | 116 | </li> |
117 | - <?$value='';?> |
|
117 | + <?$value = ''; ?> |
|
118 | 118 | <? endforeach ?> |
119 | 119 | <? endif ?> |
120 | 120 | </div> |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | <a class="btn js-addrtemultiple">+</a> |
124 | 124 | <? endif ?> |
125 | 125 | </div> |
126 | - <?$value='';?> |
|
126 | + <?$value = ''; ?> |
|
127 | 127 | <? endforeach ?> |
128 | 128 | <hr /> |
129 | - <? $static_brick_nr = 0;?> |
|
129 | + <? $static_brick_nr = 0; ?> |
|
130 | 130 | <? foreach ($documentType->bricks as $brick) : ?> |
131 | 131 | <div class="brick"> |
132 | 132 | <label><?=$brick->title?></label> |
133 | 133 | <? if ($brick->multiple == 'true') : ?> |
134 | 134 | <input type="hidden" value="<?=$brick->brickSlug?>"/> |
135 | 135 | <input type="hidden" value="<?=$brick->slug?>"/> |
136 | - <?$myBrickSlug=$brick->slug;?> |
|
136 | + <?$myBrickSlug = $brick->slug; ?> |
|
137 | 137 | <ul id="newBrickDropzone_<?=$static_brick_nr?>" class="dynamicBricks sortable"> |
138 | 138 | <? if (isset($document)) : ?> |
139 | 139 | <? foreach ($document->bricks as $currentBrickSlug => $brickArray) : ?> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | <li class="brick form-element"> |
148 | 148 | <label><?=$brick->title?></label> |
149 | 149 | <?$static = true; ?> |
150 | - <?include(__DIR__ . '/brick.php')?> |
|
150 | + <?include(__DIR__.'/brick.php')?> |
|
151 | 151 | </li> |
152 | 152 | <? endif ?> |
153 | 153 | <? endforeach ?> |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> |
158 | 158 | <?$static_brick_nr += 1?> |
159 | 159 | <? else : ?> |
160 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
160 | + <?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?> |
|
161 | 161 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
162 | 162 | <? foreach ($brick->structure->fields as $field) : ?> |
163 | 163 | <div class="form-element"> |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
184 | 184 | <div class="form-element"> |
185 | 185 | <? endif ?> |
186 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
186 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
187 | 187 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
188 | 188 | |
189 | 189 | </div> |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | <li class="grid-container"> |
207 | 207 | <div class="grid-box-10"> |
208 | 208 | <div class="grid-inner form-element"> |
209 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
209 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
210 | 210 | </div> |
211 | 211 | </div> |
212 | 212 | <div class="grid-box-2"> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | </div> |
217 | 217 | </div> |
218 | 218 | </li> |
219 | - <?$value='';?> |
|
219 | + <?$value = ''; ?> |
|
220 | 220 | <? endforeach ?> |
221 | 221 | <? endif ?> |
222 | 222 | </ul> |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
235 | 235 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
236 | 236 | <div class="form-element"> |
237 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
237 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
238 | 238 | </div> |
239 | 239 | </li> |
240 | - <?$value='';?> |
|
240 | + <?$value = ''; ?> |
|
241 | 241 | <? endforeach ?> |
242 | 242 | <? endif ?> |
243 | 243 | </div> |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | <a class="btn js-addrtemultiple">+</a> |
247 | 247 | <? endif ?> |
248 | 248 | </div> |
249 | - <?$value='';?> |
|
249 | + <?$value = ''; ?> |
|
250 | 250 | <? endforeach ?> |
251 | 251 | <? endif ?> |
252 | 252 | </div> |
253 | 253 | <hr /> |
254 | - <? endforeach;?> |
|
254 | + <? endforeach; ?> |
|
255 | 255 | |
256 | 256 | |
257 | 257 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | <li class="brick form-element"> |
275 | 275 | <label><?=$brick->title?></label> |
276 | 276 | <?$static = false; ?> |
277 | - <?include(__DIR__ . '/brick.php')?> |
|
277 | + <?include(__DIR__.'/brick.php')?> |
|
278 | 278 | </li> |
279 | 279 | <? endforeach ?> |
280 | 280 | <? endif ?> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | private function config() |
35 | 35 | { |
36 | - $storagePath = __DIR__ . $this->storagePath; |
|
36 | + $storagePath = __DIR__.$this->storagePath; |
|
37 | 37 | if (realpath($storagePath) !== false) { |
38 | 38 | $jsonString = file_get_contents($storagePath); |
39 | 39 | $this->repository = json_decode($jsonString); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function getDocumentBySlug($slug) |
191 | 191 | { |
192 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
192 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
193 | 193 | $indices = $documentContainer['indices']; |
194 | 194 | |
195 | 195 | if ($indices === null) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // Check for duplicates |
235 | 235 | foreach ($this->repository->documents as $index => $document) { |
236 | 236 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
237 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
237 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | // Check for duplicates |
243 | 243 | foreach ($previousFolder->content as $index => $document) { |
244 | 244 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
245 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
245 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
246 | 246 | } |
247 | 247 | } |
248 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
248 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $this->save(); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | foreach ($this->repository->documents as $document) { |
260 | 260 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
261 | 261 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
262 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
262 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | $this->repository->documents[] = $documentFolderObject; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | foreach ($containerFolder->content as $document) { |
271 | 271 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
272 | 272 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
273 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
273 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | foreach ($this->repository->documents as $document) { |
386 | 386 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
387 | 387 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
388 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
388 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 | $this->repository->documents[] = $documentFolderObject; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | foreach ($containerFolder->content as $document) { |
407 | 407 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
408 | 408 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
409 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
409 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | $folder->content[] = $documentFolderObject; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | public function getDocumentFolderBySlug($slug) |
460 | 460 | { |
461 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
461 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
462 | 462 | $indices = $documentContainer['indices']; |
463 | 463 | |
464 | 464 | $folder = $this->repository->documents; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | // Check for duplicates |
503 | 503 | foreach ($this->repository->documents as $index => $document) { |
504 | 504 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
505 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
505 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -510,10 +510,10 @@ discard block |
||
510 | 510 | // Check for duplicates |
511 | 511 | foreach ($previousFolder->content as $index => $document) { |
512 | 512 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
513 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
513 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
514 | 514 | } |
515 | 515 | } |
516 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
516 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | $this->save(); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | 'previousDocument' => $previousDocument |
584 | 584 | ); |
585 | 585 | } else { |
586 | - throw new \Exception('Invalid path: ' . $path); |
|
586 | + throw new \Exception('Invalid path: '.$path); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | |
769 | 769 | public function addImage($postValues) |
770 | 770 | { |
771 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
771 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
772 | 772 | |
773 | 773 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
774 | - $destination = $destinationPath . '/' . $filename; |
|
774 | + $destination = $destinationPath.'/'.$filename; |
|
775 | 775 | |
776 | 776 | if ($postValues['error'] != '0') { |
777 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
777 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -796,14 +796,14 @@ discard block |
||
796 | 796 | |
797 | 797 | public function deleteImageByName($filename) |
798 | 798 | { |
799 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
799 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
800 | 800 | |
801 | 801 | $images = $this->getImages(); |
802 | 802 | |
803 | 803 | foreach ($images as $key => $image) { |
804 | 804 | if ($image->file == $filename) { |
805 | 805 | foreach ($image->set as $imageSetFilename) { |
806 | - $destination = $destinationPath . '/' . $imageSetFilename; |
|
806 | + $destination = $destinationPath.'/'.$imageSetFilename; |
|
807 | 807 | if (file_exists($destination)) { |
808 | 808 | unlink($destination); |
809 | 809 | } else { |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | */ |
846 | 846 | public function getFiles() |
847 | 847 | { |
848 | - $files = $this->repository->files; |
|
848 | + $files = $this->repository->files; |
|
849 | 849 | usort($files, array($this, 'compareFiles')); |
850 | 850 | return $files; |
851 | 851 | } |
@@ -857,13 +857,13 @@ discard block |
||
857 | 857 | |
858 | 858 | public function addFile($postValues) |
859 | 859 | { |
860 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
860 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
861 | 861 | |
862 | 862 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
863 | - $destination = $destinationPath . '/' . $filename; |
|
863 | + $destination = $destinationPath.'/'.$filename; |
|
864 | 864 | |
865 | 865 | if ($postValues['error'] != '0') { |
866 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
866 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -887,23 +887,23 @@ discard block |
||
887 | 887 | array_pop($fileParts); |
888 | 888 | $fileNameWithoutExtension = implode('-', $fileParts); |
889 | 889 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
890 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
890 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
891 | 891 | } else { |
892 | 892 | $filename = slugify($filename); |
893 | 893 | } |
894 | 894 | |
895 | - if (file_exists($path . '/' . $filename)) { |
|
895 | + if (file_exists($path.'/'.$filename)) { |
|
896 | 896 | $fileParts = explode('.', $filename); |
897 | 897 | if (count($fileParts) > 1) { |
898 | 898 | $extension = end($fileParts); |
899 | 899 | array_pop($fileParts); |
900 | 900 | $fileNameWithoutExtension = implode('-', $fileParts); |
901 | 901 | $fileNameWithoutExtension .= '-copy'; |
902 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
902 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
903 | 903 | } else { |
904 | 904 | $filename .= '-copy'; |
905 | 905 | } |
906 | - return $this->validateFilename($filename,$path); |
|
906 | + return $this->validateFilename($filename, $path); |
|
907 | 907 | } |
908 | 908 | return $filename; |
909 | 909 | } |
@@ -929,8 +929,8 @@ discard block |
||
929 | 929 | */ |
930 | 930 | public function deleteFileByName($filename) |
931 | 931 | { |
932 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
933 | - $destination = $destinationPath . '/' . $filename; |
|
932 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
933 | + $destination = $destinationPath.'/'.$filename; |
|
934 | 934 | |
935 | 935 | if (file_exists($destination)) { |
936 | 936 | $files = $this->getFiles(); |
@@ -1226,12 +1226,12 @@ discard block |
||
1226 | 1226 | * @throws \Exception |
1227 | 1227 | */ |
1228 | 1228 | private function save() { |
1229 | - $storagePath = __DIR__ . $this->storagePath; |
|
1229 | + $storagePath = __DIR__.$this->storagePath; |
|
1230 | 1230 | if (realpath($storagePath) !== false) { |
1231 | - copy($storagePath, $storagePath . '.bak'); |
|
1231 | + copy($storagePath, $storagePath.'.bak'); |
|
1232 | 1232 | file_put_contents($storagePath, json_encode($this->repository)); |
1233 | 1233 | } else { |
1234 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
1234 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
1235 | 1235 | } |
1236 | 1236 | } |
1237 | 1237 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->parameters['mainNavClass'] = 'documents'; |
125 | 125 | if (isset($request::$post['title'], $request::$post['path'])) { |
126 | 126 | $this->storage->addDocumentFolder($request::$post); |
127 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
127 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
128 | 128 | exit; |
129 | 129 | } |
130 | 130 | } elseif ($relativeCmsUri == '/documents/new-document' && isset($request::$get['path']) && in_array('documents', $userRights)) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if (isset($request::$get['documentType'])) { |
135 | 135 | if (isset($request::$post['title'], $request::$get['documentType'], $request::$get['path'])) { |
136 | 136 | $this->storage->addDocument($request::$post); |
137 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
137 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
138 | 138 | exit; |
139 | 139 | } |
140 | 140 | $this->parameters['documentType'] = $this->storage->getDocumentTypeBySlug($request::$get['documentType'], true); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->parameters['smallestImage'] = $this->storage->getSmallestImageSet()->slug; |
149 | 149 | if (isset($request::$post['title'], $request::$get['slug'])) { |
150 | 150 | $this->storage->saveDocument($request::$post); |
151 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
151 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
152 | 152 | exit; |
153 | 153 | } |
154 | 154 | $this->parameters['document'] = $this->storage->getDocumentBySlug($request::$get['slug']); |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | array_pop($path); |
180 | 180 | $path = implode('/', $path); |
181 | 181 | |
182 | - $request::$get['path'] = '/' . $path; |
|
182 | + $request::$get['path'] = '/'.$path; |
|
183 | 183 | |
184 | 184 | if (isset($request::$post['title'], $request::$post['content'])) { |
185 | 185 | $this->storage->saveDocumentFolder($request::$post); |
186 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
186 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
187 | 187 | exit; |
188 | 188 | } |
189 | 189 | |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $this->parameters['folder'] = $folder; |
192 | 192 | } else if ($relativeCmsUri == '/documents/delete-document' && isset($request::$get['slug']) && in_array('documents', $userRights)) { |
193 | 193 | $this->storage->deleteDocumentBySlug($request::$get['slug']); |
194 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
194 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
195 | 195 | exit; |
196 | 196 | } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get['slug']) && in_array('documents', $userRights)) { |
197 | 197 | $this->storage->deleteDocumentFolderBySlug($request::$get['slug']); |
198 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
198 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
199 | 199 | exit; |
200 | 200 | } elseif ($relativeCmsUri == '/sitemap' && in_array('sitemap', $userRights)) { |
201 | 201 | $template = 'cms/sitemap'; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $this->parameters['mainNavClass'] = 'sitemap'; |
210 | 210 | if (isset($request::$post['title'], $request::$post['template'], $request::$post['component'])) { |
211 | 211 | $this->storage->addSitemapItem($request::$post); |
212 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
212 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
213 | 213 | exit; |
214 | 214 | } |
215 | 215 | } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get['slug']) && in_array('sitemap', $userRights)) { |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | $sitemapItem = $this->storage->getSitemapItemBySlug($request::$get['slug']); |
219 | 219 | if (isset($request::$post['title'], $request::$post['template'], $request::$post['component'])) { |
220 | 220 | $this->storage->saveSitemapItem($request::$get['slug'], $request::$post); |
221 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
221 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
222 | 222 | exit; |
223 | 223 | } |
224 | 224 | $this->parameters['sitemapItem'] = $sitemapItem; |
225 | 225 | } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get['slug']) && in_array('sitemap', $userRights)) { |
226 | 226 | $this->storage->deleteSitemapItemBySlug($request::$get['slug']); |
227 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
227 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
228 | 228 | exit; |
229 | 229 | } elseif ($relativeCmsUri == '/images' && in_array('images', $userRights)) { |
230 | 230 | $template = 'cms/images'; |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | $this->parameters['mainNavClass'] = 'images'; |
240 | 240 | if (isset($_FILES['file'])) { |
241 | 241 | $this->storage->addImage($_FILES['file']); |
242 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/images'); |
|
242 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/images'); |
|
243 | 243 | exit; |
244 | 244 | } |
245 | 245 | } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get['file']) && in_array('images', $userRights)) { |
246 | 246 | $this->storage->deleteImageByName($request::$get['file']); |
247 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/images'); |
|
247 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/images'); |
|
248 | 248 | exit; |
249 | 249 | } elseif ($relativeCmsUri == '/images/show' && isset($request::$get['file']) && in_array('images', $userRights)) { |
250 | 250 | $template = 'cms/images/show'; |
@@ -262,30 +262,30 @@ discard block |
||
262 | 262 | $this->parameters['mainNavClass'] = 'files'; |
263 | 263 | if (isset($_FILES['file'])) { |
264 | 264 | $this->storage->addFile($_FILES['file']); |
265 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/files'); |
|
265 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/files'); |
|
266 | 266 | exit; |
267 | 267 | } |
268 | 268 | } elseif ($relativeCmsUri == '/files/get' && isset($request::$get['file']) && in_array('files', $userRights)) { |
269 | 269 | $file = $this->storage->getFileByName($request::$get['file']); |
270 | - $path = realpath(__DIR__ . '/../../www/files/'); |
|
271 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
272 | - $size = filesize($path . '/' . $file->file); |
|
270 | + $path = realpath(__DIR__.'/../../www/files/'); |
|
271 | + $quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\')); |
|
272 | + $size = filesize($path.'/'.$file->file); |
|
273 | 273 | |
274 | 274 | header('Content-Description: File Transfer'); |
275 | - header('Content-Type: ' . $file->type); |
|
276 | - header('Content-Disposition: attachment; filename=' . $quoted); |
|
275 | + header('Content-Type: '.$file->type); |
|
276 | + header('Content-Disposition: attachment; filename='.$quoted); |
|
277 | 277 | header('Content-Transfer-Encoding: binary'); |
278 | 278 | header('Connection: Keep-Alive'); |
279 | 279 | header('Expires: 0'); |
280 | 280 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
281 | 281 | header('Pragma: public'); |
282 | - header('Content-Length: ' . $size); |
|
282 | + header('Content-Length: '.$size); |
|
283 | 283 | |
284 | - readfile($path . '/' . $file->file); |
|
284 | + readfile($path.'/'.$file->file); |
|
285 | 285 | exit; |
286 | 286 | } elseif ($relativeCmsUri == '/files/delete' && isset($request::$get['file']) && in_array('files', $userRights)) { |
287 | 287 | $this->storage->deleteFileByName($request::$get['file']); |
288 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/files'); |
|
288 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/files'); |
|
289 | 289 | exit; |
290 | 290 | } elseif ($relativeCmsUri == '/configuration' && in_array('configuration', $userRights)) { |
291 | 291 | $template = 'cms/configuration'; |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | $this->parameters['mainNavClass'] = 'configuration'; |
300 | 300 | if (isset($_POST['username'])) { |
301 | 301 | $this->storage->addUser($request::$post); |
302 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/users'); |
|
302 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/users'); |
|
303 | 303 | exit; |
304 | 304 | } |
305 | 305 | } elseif ($relativeCmsUri == '/configuration/users/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
306 | 306 | $this->storage->deleteUserBySlug($request::$get['slug']); |
307 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/users'); |
|
307 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/users'); |
|
308 | 308 | exit; |
309 | 309 | } elseif ($relativeCmsUri == '/configuration/users/edit' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
310 | 310 | $template = 'cms/configuration/users-form'; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $this->parameters['user'] = $this->storage->getUserBySlug($request::$get['slug']); |
313 | 313 | if (isset($_POST['username'])) { |
314 | 314 | $this->storage->saveUser($request::$get['slug'], $request::$post); |
315 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/users'); |
|
315 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/users'); |
|
316 | 316 | exit; |
317 | 317 | } |
318 | 318 | } elseif ($relativeCmsUri == '/configuration/document-types' && in_array('configuration', $userRights)) { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $bricks = $this->storage->getBricks(); |
326 | 326 | if (isset($request::$post['title'])) { |
327 | 327 | $this->storage->addDocumentType($request::$post); |
328 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
328 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
329 | 329 | exit; |
330 | 330 | } |
331 | 331 | $this->parameters['bricks'] = $bricks; |
@@ -336,14 +336,14 @@ discard block |
||
336 | 336 | $bricks = $this->storage->getBricks(); |
337 | 337 | if (isset($request::$post['title'])) { |
338 | 338 | $this->storage->saveDocumentType($request::$get['slug'], $request::$post); |
339 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
339 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
340 | 340 | exit; |
341 | 341 | } |
342 | 342 | $this->parameters['documentType'] = $documentType; |
343 | 343 | $this->parameters['bricks'] = $bricks; |
344 | 344 | } elseif ($relativeCmsUri == '/configuration/document-types/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
345 | 345 | $this->storage->deleteDocumentTypeBySlug($request::$get['slug']); |
346 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
346 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
347 | 347 | exit; |
348 | 348 | } elseif ($relativeCmsUri == '/configuration/bricks' && in_array('configuration', $userRights)) { |
349 | 349 | $template = 'cms/configuration/bricks'; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->parameters['mainNavClass'] = 'configuration'; |
355 | 355 | if (isset($request::$post['title'])) { |
356 | 356 | $this->storage->addBrick($request::$post); |
357 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
357 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
358 | 358 | exit; |
359 | 359 | } |
360 | 360 | } elseif ($relativeCmsUri == '/configuration/bricks/edit' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | $brick = $this->storage->getBrickBySlug($request::$get['slug']); |
364 | 364 | if (isset($request::$post['title'])) { |
365 | 365 | $this->storage->saveBrick($request::$get['slug'], $request::$post); |
366 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
366 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
367 | 367 | exit; |
368 | 368 | } |
369 | 369 | $this->parameters['brick'] = $brick; |
370 | 370 | } elseif ($relativeCmsUri == '/configuration/bricks/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
371 | 371 | $this->storage->deleteBrickBySlug($request::$get['slug']); |
372 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
372 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
373 | 373 | exit; |
374 | 374 | } elseif ($relativeCmsUri == '/configuration/image-set' && in_array('configuration', $userRights)) { |
375 | 375 | $template = 'cms/configuration/image-set'; |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $imageSet = $this->storage->getImageSetBySlug($request::$get['slug']); |
382 | 382 | if (isset($request::$post['title'])) { |
383 | 383 | $this->storage->saveImageSet($request::$get['slug'], $request::$post); |
384 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/image-set'); |
|
384 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/image-set'); |
|
385 | 385 | exit; |
386 | 386 | } |
387 | 387 | $this->parameters['imageSet'] = $imageSet; |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | $this->parameters['mainNavClass'] = 'configuration'; |
391 | 391 | if (isset($request::$post['title'])) { |
392 | 392 | $this->storage->addImageSet($request::$post); |
393 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/image-set'); |
|
393 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/image-set'); |
|
394 | 394 | exit; |
395 | 395 | } |
396 | 396 | } elseif ($relativeCmsUri == '/configuration/image-set/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
397 | 397 | $this->storage->deleteImageSetBySlug($request::$get['slug']); |
398 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/image-set'); |
|
398 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/image-set'); |
|
399 | 399 | exit; |
400 | 400 | } elseif ($relativeCmsUri == '/configuration/application-components' && in_array('configuration', $userRights)) { |
401 | 401 | $template = 'cms/configuration/application-components'; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $this->parameters['mainNavClass'] = 'configuration'; |
407 | 407 | if (isset($request::$post['title'])) { |
408 | 408 | $this->storage->addApplicationComponent($request::$post); |
409 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/application-components'); |
|
409 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/application-components'); |
|
410 | 410 | exit; |
411 | 411 | } |
412 | 412 | } elseif ($relativeCmsUri == '/configuration/application-components/edit' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
@@ -415,18 +415,18 @@ discard block |
||
415 | 415 | $applicationComponent = $this->storage->getApplicationComponentBySlug($request::$get['slug']); |
416 | 416 | if (isset($request::$post['title'])) { |
417 | 417 | $this->storage->saveApplicationComponent($request::$get['slug'], $request::$post); |
418 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/application-components'); |
|
418 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/application-components'); |
|
419 | 419 | exit; |
420 | 420 | } |
421 | 421 | $this->parameters['applicationComponent'] = $applicationComponent; |
422 | 422 | } elseif ($relativeCmsUri == '/configuration/application-components/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
423 | 423 | $this->storage->deleteApplicationComponentBySlug($request::$get['slug']); |
424 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/application-components'); |
|
424 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/application-components'); |
|
425 | 425 | exit; |
426 | 426 | } elseif ($relativeCmsUri == '/log-off') { |
427 | 427 | $_SESSION['cloudcontrol'] = null; |
428 | 428 | unset($_SESSION['cloudcontrol']); |
429 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix']); |
|
429 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix']); |
|
430 | 430 | exit; |
431 | 431 | } |
432 | 432 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $whitelistIps = explode(',', $this->parameters['whitelistIps']); |
442 | 442 | $whitelistIps = array_map("trim", $whitelistIps); |
443 | 443 | if (!in_array($remoteAddress, $whitelistIps)) { |
444 | - throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist'); |
|
444 | + throw new \Exception('Ip address '.$remoteAddress.' is not on whitelist'); |
|
445 | 445 | } |
446 | 446 | } |
447 | 447 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $blacklistIps = explode(',', $this->parameters['blacklistIps']); |
453 | 453 | $blacklistIps = array_map("trim", $blacklistIps); |
454 | 454 | if (in_array($remoteAddress, $blacklistIps)) { |
455 | - throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist'); |
|
455 | + throw new \Exception('Ip address '.$remoteAddress.' is on blacklist'); |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | } |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | */ |
66 | 66 | private function config() |
67 | 67 | { |
68 | - $configPath = __DIR__ . '/../../config.json'; |
|
68 | + $configPath = __DIR__.'/../../config.json'; |
|
69 | 69 | if (realpath($configPath) !== false) { |
70 | 70 | $json = file_get_contents($configPath); |
71 | 71 | $this->config = json_decode($json); |
72 | 72 | } else { |
73 | - throw new \Exception('Couldn\'t find config file in path ' . $configPath); |
|
73 | + throw new \Exception('Couldn\'t find config file in path '.$configPath); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private function sitemapMatching($request) |
94 | 94 | { |
95 | 95 | $sitemap = $this->storage->getSitemap(); |
96 | - $relativeUri = '/' . $request::$relativeUri; |
|
96 | + $relativeUri = '/'.$request::$relativeUri; |
|
97 | 97 | |
98 | 98 | foreach ($sitemap as $sitemapItem) { |
99 | 99 | if ($sitemapItem->regex) { |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | * @return mixed |
157 | 157 | * @throws \Exception |
158 | 158 | */ |
159 | - private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
|
159 | + private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) |
|
160 | 160 | { |
161 | - $libraryComponentName = '\\library\\components\\' . $class; |
|
162 | - $userComponentName = '\\components\\' . $class; |
|
161 | + $libraryComponentName = '\\library\\components\\'.$class; |
|
162 | + $userComponentName = '\\components\\'.$class; |
|
163 | 163 | |
164 | 164 | if (\autoLoad($libraryComponentName, false)) { |
165 | 165 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
166 | 166 | } elseif (\autoLoad($userComponentName, false)) { |
167 | 167 | $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
168 | 168 | } else { |
169 | - throw new \Exception('Could not load component ' . $class); |
|
169 | + throw new \Exception('Could not load component '.$class); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | if (!$component instanceof Component) { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | public function setCachingHeaders() |
226 | 226 | { |
227 | 227 | header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 2))); // 2 days |
228 | - header("Cache-Control: max-age=" . (60 * 60 * 24 * 2)); |
|
228 | + header("Cache-Control: max-age=".(60 * 60 * 24 * 2)); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |