Passed
Push — develop ( 92a637...7ee7eb )
by Jens
12:26
created
cloudcontrol/library/crypt/Crypt.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 				$output = '';
50 50
 				for ($i = 0; $i < $count; $i += 16) {
51 51
 					$random_state =
52
-						md5(microtime() . $random_state);
52
+						md5(microtime().$random_state);
53 53
 					$output .=
54 54
 						pack('H*', md5($random_state));
55 55
 				}
Please login to merge, or discard this patch.
cloudcontrol/library/cc/autoloader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
cloudcontrol/library/cc/cc.php 3 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,12 +61,15 @@
 block discarded – undo
61 61
 }
62 62
 
63 63
 function humanFileSize($size,$unit="") {
64
-	if( (!$unit && $size >= 1<<30) || $unit == "GB")
65
-		return number_format($size/(1<<30),2)."GB";
66
-	if( (!$unit && $size >= 1<<20) || $unit == "MB")
67
-		return number_format($size/(1<<20),2)."MB";
68
-	if( (!$unit && $size >= 1<<10) || $unit == "KB")
69
-		return number_format($size/(1<<10),2)."KB";
64
+	if( (!$unit && $size >= 1<<30) || $unit == "GB") {
65
+			return number_format($size/(1<<30),2)."GB";
66
+	}
67
+	if( (!$unit && $size >= 1<<20) || $unit == "MB") {
68
+			return number_format($size/(1<<20),2)."MB";
69
+	}
70
+	if( (!$unit && $size >= 1<<10) || $unit == "KB") {
71
+			return number_format($size/(1<<10),2)."KB";
72
+	}
70 73
 	return number_format($size)." bytes";
71 74
 }
72 75
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
  * @param array  $replace
117 117
  * @param string $delimiter
118 118
  *
119
- * @return mixed|string
119
+ * @return string
120 120
  */
121 121
 function slugify($str, $replace=array(), $delimiter='-') {
122 122
 	if( !empty($replace) ) {
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 		return '0 seconds';
39 39
 	}
40 40
 
41
-	$a = array( 365 * 24 * 60 * 60  =>  'year',
41
+	$a = array(365 * 24 * 60 * 60  =>  'year',
42 42
 				30 * 24 * 60 * 60  =>  'month',
43 43
 				24 * 60 * 60  =>  'day',
44 44
 				60 * 60  =>  'hour',
45 45
 				60  =>  'minute',
46 46
 				1  =>  'second'
47 47
 	);
48
-	$a_plural = array( 'year'   => 'years',
48
+	$a_plural = array('year'   => 'years',
49 49
 					   'month'  => 'months',
50 50
 					   'day'    => 'days',
51 51
 					   'hour'   => 'hours',
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
 		if ($d >= 1)
60 60
 		{
61 61
 			$r = round($d);
62
-			return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago';
62
+			return $r.' '.($r > 1 ? $a_plural[$str] : $str).' ago';
63 63
 		}
64 64
 	}
65 65
 	return 0;
66 66
 }
67 67
 
68
-function humanFileSize($size,$unit="") {
69
-	if( (!$unit && $size >= 1<<30) || $unit == "GB")
70
-		return number_format($size/(1<<30),2)."GB";
71
-	if( (!$unit && $size >= 1<<20) || $unit == "MB")
72
-		return number_format($size/(1<<20),2)."MB";
73
-	if( (!$unit && $size >= 1<<10) || $unit == "KB")
74
-		return number_format($size/(1<<10),2)."KB";
68
+function humanFileSize($size, $unit = "") {
69
+	if ((!$unit && $size >= 1 << 30) || $unit == "GB")
70
+		return number_format($size / (1 << 30), 2)."GB";
71
+	if ((!$unit && $size >= 1 << 20) || $unit == "MB")
72
+		return number_format($size / (1 << 20), 2)."MB";
73
+	if ((!$unit && $size >= 1 << 10) || $unit == "KB")
74
+		return number_format($size / (1 << 10), 2)."KB";
75 75
 	return number_format($size)." bytes";
76 76
 }
77 77
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @return mixed|string
120 120
  */
121
-function slugify($str, $replace=array(), $delimiter='-') {
122
-	if( !empty($replace) ) {
123
-		$str = str_replace((array)$replace, ' ', $str);
121
+function slugify($str, $replace = array(), $delimiter = '-') {
122
+	if (!empty($replace)) {
123
+		$str = str_replace((array) $replace, ' ', $str);
124 124
 	}
125 125
 
126 126
 	$clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 {
144 144
 	$debug_backtrace = current(debug_backtrace());
145 145
 	if (PHP_SAPI == 'cli') {
146
-		echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n";
146
+		echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n";
147 147
 		foreach (func_get_args() as $data) {
148 148
 			var_dump($data);
149 149
 		}
150 150
 	} else {
151 151
 		ob_clean();
152
-		echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>";
152
+		echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>";
153 153
 		echo '<pre>';
154 154
 		foreach (func_get_args() as $data) {
155 155
 			echo "<code>";
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 
191 191
 function utf8Convert($array)
192 192
 {
193
-	array_walk_recursive($array, function(&$item, $key){
194
-		if(!mb_detect_encoding($item, 'utf-8', true)){
193
+	array_walk_recursive($array, function(&$item, $key) {
194
+		if (!mb_detect_encoding($item, 'utf-8', true)) {
195 195
 			$item = utf8_encode($item);
196 196
 		}
197 197
 	});
Please login to merge, or discard this patch.
cloudcontrol/library/images/methods/Crop.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
62 62
 
63 63
 			// Preserve transparency
64 64
 			imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
65
-            imagealphablending($new, false);
66
-            imagesavealpha($new, true);
65
+			imagealphablending($new, false);
66
+			imagesavealpha($new, true);
67 67
 			
68 68
 			imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight);
69 69
 			
Please login to merge, or discard this patch.
cloudcontrol/library/storage/JsonStorage.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 		/**
787 787
 		 * @param $filename
788 788
 		 * @return null
789
-         */
789
+		 */
790 790
 		public function getImageByName($filename)
791 791
 		{
792 792
 			$images = $this->getImages();
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		/**
877 877
 		 * @param $filename
878 878
 		 * @return null
879
-         */
879
+		 */
880 880
 		public function getFileByName($filename)
881 881
 		{
882 882
 			$files = $this->getFiles();
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 		/**
892 892
 		 * @param $filename
893 893
 		 * @throws \Exception
894
-         */
894
+		 */
895 895
 		public function deleteFileByName($filename)
896 896
 		{
897 897
 			$destinationPath = realpath(__DIR__ . '/../../www/files/');
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		 */
184 184
 		public function getDocumentBySlug($slug)
185 185
 		{
186
-			$documentContainer = $this->getDocumentContainerByPath('/' . $slug);
186
+			$documentContainer = $this->getDocumentContainerByPath('/'.$slug);
187 187
 			$indices = $documentContainer['indices'];
188 188
 
189 189
 			if ($indices === null) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				// Check for duplicates
229 229
 				foreach ($this->repository->documents as $index => $document) {
230 230
 					if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') {
231
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
231
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
232 232
 					}
233 233
 				}
234 234
 				$this->repository->documents[end($indices)] = $documentFolderObject;
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 				// Check for duplicates
237 237
 				foreach ($previousFolder->content as $index => $document) {
238 238
 					if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') {
239
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
239
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
240 240
 					}
241 241
 				}
242
-				$previousFolder->content[end($indices)] = $documentFolderObject ;
242
+				$previousFolder->content[end($indices)] = $documentFolderObject;
243 243
 			}
244 244
 
245 245
 			$this->save();
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 				foreach ($this->repository->documents as $document) {
254 254
 					if ($document->slug == $documentFolderObject->slug && $document->type == 'document') {
255 255
 						// TODO make it so it doesnt throw an exception, but instead shows a warning
256
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
256
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
257 257
 					}
258 258
 				}
259 259
 				$this->repository->documents[] = $documentFolderObject;
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 					foreach ($containerFolder->content as $document) {
265 265
 						if ($document->slug == $documentFolderObject->slug && $document->type == 'document') {
266 266
 							// TODO make it so it doesnt throw an exception, but instead shows a warning
267
-							throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
267
+							throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
268 268
 						}
269 269
 					}
270 270
 				}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 				foreach ($this->repository->documents as $document) {
381 381
 					if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') {
382 382
 						// TODO make it so it doesnt throw an exception, but instead shows a warning
383
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
383
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
384 384
 					}
385 385
 				}
386 386
 				$this->repository->documents[] = $documentFolderObject;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 				foreach ($containerFolder->content as $document) {
402 402
 					if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') {
403 403
 						// TODO make it so it doesnt throw an exception, but instead shows a warning
404
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
404
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
405 405
 					}
406 406
 				}
407 407
 				$folder->content[] = $documentFolderObject;
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 		 */
454 454
 		public function getDocumentFolderBySlug($slug)
455 455
 		{
456
-			$documentContainer = $this->getDocumentContainerByPath('/' . $slug);
456
+			$documentContainer = $this->getDocumentContainerByPath('/'.$slug);
457 457
 			$indices = $documentContainer['indices'];
458 458
 
459 459
 			$folder = $this->repository->documents;
460 460
 			if ($indices === null) {
461
-				throw new \Exception('Can\'t find folder with slug `' . $slug . '`');
461
+				throw new \Exception('Can\'t find folder with slug `'.$slug.'`');
462 462
 			}
463 463
 			foreach ($indices as $index) {
464 464
 				if ($folder === $this->repository->documents) {
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 				// Check for duplicates
501 501
 				foreach ($this->repository->documents as $index => $document) {
502 502
 					if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') {
503
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
503
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
504 504
 					}
505 505
 				}
506 506
 				$this->repository->documents[end($indices)] = $documentFolderObject;
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 				// Check for duplicates
509 509
 				foreach ($previousFolder->content as $index => $document) {
510 510
 					if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') {
511
-						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
511
+						throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']);
512 512
 					}
513 513
 				}
514
-				$previousFolder->content[end($indices)] = $documentFolderObject ;
514
+				$previousFolder->content[end($indices)] = $documentFolderObject;
515 515
 			}
516 516
 
517 517
 			$this->save();
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 					'previousDocument' => $previousDocument
581 581
 				);
582 582
 			} else {
583
-				throw new \Exception('Invalid path: ' . $path);
583
+				throw new \Exception('Invalid path: '.$path);
584 584
 			}
585 585
 		}
586 586
 
@@ -765,13 +765,13 @@  discard block
 block discarded – undo
765 765
 
766 766
 		public function addImage($postValues)
767 767
 		{
768
-			$destinationPath = realpath(__DIR__ . '/../../www/images/');
768
+			$destinationPath = realpath(__DIR__.'/../../www/images/');
769 769
 
770 770
 			$filename = $this->validateFilename($postValues['name'], $destinationPath);
771
-			$destination = $destinationPath . '/' . $filename;
771
+			$destination = $destinationPath.'/'.$filename;
772 772
 
773 773
 			if ($postValues['error'] != '0') {
774
-				throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
774
+				throw new \Exception('Error uploading file. Error code: '.$postValues['error']);
775 775
 			}
776 776
 
777 777
 			if (move_uploaded_file($postValues['tmp_name'], $destination)) {
@@ -793,14 +793,14 @@  discard block
 block discarded – undo
793 793
 
794 794
 		public function deleteImageByName($filename)
795 795
 		{
796
-			$destinationPath = realpath(__DIR__ . '/../../www/images/');
796
+			$destinationPath = realpath(__DIR__.'/../../www/images/');
797 797
 
798 798
 			$images = $this->getImages();
799 799
 
800 800
 			foreach ($images as $key => $image) {
801 801
 				if ($image->file == $filename) {
802 802
 					foreach ($image->set as $imageSetFilename) {
803
-						$destination = $destinationPath . '/' . $imageSetFilename;
803
+						$destination = $destinationPath.'/'.$imageSetFilename;
804 804
 						if (file_exists($destination)) {
805 805
 							unlink($destination);
806 806
 						} else {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 		 */
843 843
 		public function getFiles()
844 844
 		{
845
-			$files =  $this->repository->files;
845
+			$files = $this->repository->files;
846 846
 			usort($files, array($this, 'compareFiles'));
847 847
 			return $files;
848 848
 		}
@@ -854,13 +854,13 @@  discard block
 block discarded – undo
854 854
 
855 855
 		public function addFile($postValues)
856 856
 		{
857
-			$destinationPath = realpath(__DIR__ . '/../../www/files/');
857
+			$destinationPath = realpath(__DIR__.'/../../www/files/');
858 858
 
859 859
 			$filename = $this->validateFilename($postValues['name'], $destinationPath);
860
-			$destination = $destinationPath . '/' . $filename;
860
+			$destination = $destinationPath.'/'.$filename;
861 861
 
862 862
 			if ($postValues['error'] != '0') {
863
-				throw new \Exception('Error uploading file. Error code: ' . $postValues['error']);
863
+				throw new \Exception('Error uploading file. Error code: '.$postValues['error']);
864 864
 			}
865 865
 
866 866
 			if (move_uploaded_file($postValues['tmp_name'], $destination)) {
@@ -884,23 +884,23 @@  discard block
 block discarded – undo
884 884
 				array_pop($fileParts);
885 885
 				$fileNameWithoutExtension = implode('-', $fileParts);
886 886
 				$fileNameWithoutExtension = slugify($fileNameWithoutExtension);
887
-				$filename = $fileNameWithoutExtension . '.' . $extension;
887
+				$filename = $fileNameWithoutExtension.'.'.$extension;
888 888
 			} else {
889 889
 				$filename = slugify($filename);
890 890
 			}
891 891
 
892
-			if (file_exists($path . '/' . $filename)) {
892
+			if (file_exists($path.'/'.$filename)) {
893 893
 				$fileParts = explode('.', $filename);
894 894
 				if (count($fileParts) > 1) {
895 895
 					$extension = end($fileParts);
896 896
 					array_pop($fileParts);
897 897
 					$fileNameWithoutExtension = implode('-', $fileParts);
898 898
 					$fileNameWithoutExtension .= '-copy';
899
-					$filename = $fileNameWithoutExtension . '.' . $extension;
899
+					$filename = $fileNameWithoutExtension.'.'.$extension;
900 900
 				} else {
901 901
 					$filename .= '-copy';
902 902
 				}
903
-				return $this->validateFilename($filename,$path);
903
+				return $this->validateFilename($filename, $path);
904 904
 			}
905 905
 			return $filename;
906 906
 		}
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
          */
927 927
 		public function deleteFileByName($filename)
928 928
 		{
929
-			$destinationPath = realpath(__DIR__ . '/../../www/files/');
930
-			$destination = $destinationPath . '/' . $filename;
929
+			$destinationPath = realpath(__DIR__.'/../../www/files/');
930
+			$destination = $destinationPath.'/'.$filename;
931 931
 
932 932
 			if (file_exists($destination)) {
933 933
 				$files = $this->getFiles();
@@ -1223,12 +1223,12 @@  discard block
 block discarded – undo
1223 1223
 		 * @throws \Exception
1224 1224
 		 */
1225 1225
 		private function save() {
1226
-			$storagePath = __DIR__ . $this->storagePath;
1226
+			$storagePath = __DIR__.$this->storagePath;
1227 1227
 			if (realpath($storagePath) !== false) {
1228
-				copy($storagePath, $storagePath . '.bak');
1228
+				copy($storagePath, $storagePath.'.bak');
1229 1229
 				file_put_contents($storagePath, json_encode($this->repository));
1230 1230
 			} else {
1231
-				throw new \Exception('Couldnt find storagePath ' . $storagePath);
1231
+				throw new \Exception('Couldnt find storagePath '.$storagePath);
1232 1232
 			}
1233 1233
 		}
1234 1234
 
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents/fieldTypes/Rich-Text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 ?>
Please login to merge, or discard this patch.
cloudcontrol/library/components/BaseComponent.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @throws \Exception
69 69
 		 */
70
-		public function render($application=null)
70
+		public function render($application = null)
71 71
 		{
72 72
 			$this->renderedContent = $this->renderTemplate($this->template, true, $application);
73 73
 		}
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 		 * @return string
94 94
 		 * @throws \Exception
95 95
 		 */
96
-		public function renderTemplate($template='', $obClean = true, $application=null)
96
+		public function renderTemplate($template = '', $obClean = true, $application = null)
97 97
 		{
98
-			$templatePath = __DIR__ . '/../../templates/' . $template . '.php';
98
+			$templatePath = __DIR__.'/../../templates/'.$template.'.php';
99 99
 			if (realpath($templatePath) !== false) {
100 100
 				if ($obClean) {
101 101
 					ob_clean();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 				return ob_get_contents();
113 113
 			} else {
114 114
 				if ($template !== null) { // If template is null, its a application component, which doesnt have a template
115
-					throw new \Exception('Couldnt find template ' . $templatePath);
115
+					throw new \Exception('Couldnt find template '.$templatePath);
116 116
 				}
117 117
 			}
118 118
 		}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		 * @return string
128 128
 		 * @throws \Exception
129 129
 		 */
130
-		public function includeTemplate($template='', $parameters = array())
130
+		public function includeTemplate($template = '', $parameters = array())
131 131
 		{
132 132
 			if (is_array($parameters)) {
133 133
 				foreach ($parameters as $name => $value) {
Please login to merge, or discard this patch.
cloudcontrol/library/components/LanguageComponent.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
     /**
106 106
      * Detect if the language is switched manually
107 107
      *
108
-     * @param $request
108
+     * @param Request $request
109 109
      */
110 110
     private function checkLanguageSwitch($request)
111 111
     {
Please login to merge, or discard this patch.
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -7,124 +7,124 @@
 block discarded – undo
7 7
 
8 8
 class LanguageComponent implements Component
9 9
 {
10
-    protected $request;
11
-    protected $parameters;
12
-
13
-    protected $defaultLanguage = 'en';
14
-    protected $acceptedLanguages = null;
15
-    protected $languageParameterName = 'language';
16
-    protected $forceRedirect = false;
17
-    protected $sessionValues;
18
-
19
-    /**
20
-     * Component constructor.
21
-     *
22
-     * @param                     $template
23
-     * @param Request $request
24
-     * @param                     $parameters
25
-     * @param                     $matchedSitemapItem
26
-     */
27
-    public function __construct($template, Request $request, $parameters, $matchedSitemapItem)
28
-    {
29
-        $this->parameters = (array) $parameters;
30
-        $this->checkParameters();
31
-
32
-        $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2);
33
-        $_SESSION['LanguageComponent']['detectedLanguage'] = $lang;
34
-
35
-        $this->checkLanguageSwitch($request);
36
-
37
-        if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) {
38
-            $this->detectLanguage($lang, $request);
39
-        } else {
40
-            if ($this->forceRedirect === true) {
41
-                $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request);
42
-            }
43
-        }
44
-
45
-        $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName];
46
-    }
47
-
48
-    /**
49
-     * Checks to see if any parameters are given from the configuration in the CMS
50
-     */
51
-    private function checkParameters()
52
-    {
53
-        if (isset($this->parameters['defaultLanguage'])) {
54
-            $this->defaultLanguage = $this->parameters['defaultLanguage'];
55
-            unset($this->parameters['defaultLanguage']);
56
-        }
57
-        if (isset($this->parameters['acceptedLanguages'])) {
58
-            $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']);
59
-            unset($this->parameters['acceptedLanguages']);
60
-        }
61
-        if (isset($this->parameters['languageParameterName'])) {
62
-            $this->languageParameterName = $this->parameters['languageParameterName'];
63
-            unset($this->parameters['languageParameterName']);
64
-        }
65
-        if (isset($this->parameters['forceRedirect'])) {
66
-            $this->forceRedirect = (bool) $this->parameters['forceRedirect'];
67
-            unset($this->parameters['forceRedirect']);
68
-        }
69
-    }
70
-
71
-    /**
72
-     * @return array
73
-     */
74
-    public function getParameters()
75
-    {
76
-        return $this->parameters;
77
-    }
78
-
79
-
80
-    /**
81
-     * Check if the found language is allowed and
82
-     * if an action is to be taken.
83
-     *
84
-     * @param $lang
85
-     * @param $request
86
-     */
87
-    private function detectLanguage($lang, $request)
88
-    {
89
-        $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage;
90
-
91
-        if ($this->acceptedLanguages === null) {
92
-            $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
93
-        } else if (in_array($lang, $this->acceptedLanguages)) {
94
-            $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
95
-        } else {
96
-            $lang = $this->defaultLanguage;
97
-        }
98
-
99
-        $this->sessionValues = $_SESSION['LanguageComponent'];
100
-
101
-        if ($this->forceRedirect === true) {
102
-            if (substr($request::$relativeUri, 0, 2) !== $lang ) {
103
-                if ($lang !== $this->defaultLanguage) {
104
-                    header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri);
105
-                    exit;
106
-                }
107
-            }
108
-        }
109
-    }
110
-
111
-    /**
112
-     * Detect if the language is switched manually
113
-     *
114
-     * @param $request
115
-     */
116
-    private function checkLanguageSwitch($request)
117
-    {
118
-        if (isset($request::$get['langSwitch'])) {
119
-            $this->forceRedirect = true;
120
-            $this->detectLanguage($request::$get['langSwitch'], $request);
121
-        }
122
-    }
123
-
124
-    /*
10
+	protected $request;
11
+	protected $parameters;
12
+
13
+	protected $defaultLanguage = 'en';
14
+	protected $acceptedLanguages = null;
15
+	protected $languageParameterName = 'language';
16
+	protected $forceRedirect = false;
17
+	protected $sessionValues;
18
+
19
+	/**
20
+	 * Component constructor.
21
+	 *
22
+	 * @param                     $template
23
+	 * @param Request $request
24
+	 * @param                     $parameters
25
+	 * @param                     $matchedSitemapItem
26
+	 */
27
+	public function __construct($template, Request $request, $parameters, $matchedSitemapItem)
28
+	{
29
+		$this->parameters = (array) $parameters;
30
+		$this->checkParameters();
31
+
32
+		$lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2);
33
+		$_SESSION['LanguageComponent']['detectedLanguage'] = $lang;
34
+
35
+		$this->checkLanguageSwitch($request);
36
+
37
+		if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) {
38
+			$this->detectLanguage($lang, $request);
39
+		} else {
40
+			if ($this->forceRedirect === true) {
41
+				$this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request);
42
+			}
43
+		}
44
+
45
+		$this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName];
46
+	}
47
+
48
+	/**
49
+	 * Checks to see if any parameters are given from the configuration in the CMS
50
+	 */
51
+	private function checkParameters()
52
+	{
53
+		if (isset($this->parameters['defaultLanguage'])) {
54
+			$this->defaultLanguage = $this->parameters['defaultLanguage'];
55
+			unset($this->parameters['defaultLanguage']);
56
+		}
57
+		if (isset($this->parameters['acceptedLanguages'])) {
58
+			$this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']);
59
+			unset($this->parameters['acceptedLanguages']);
60
+		}
61
+		if (isset($this->parameters['languageParameterName'])) {
62
+			$this->languageParameterName = $this->parameters['languageParameterName'];
63
+			unset($this->parameters['languageParameterName']);
64
+		}
65
+		if (isset($this->parameters['forceRedirect'])) {
66
+			$this->forceRedirect = (bool) $this->parameters['forceRedirect'];
67
+			unset($this->parameters['forceRedirect']);
68
+		}
69
+	}
70
+
71
+	/**
72
+	 * @return array
73
+	 */
74
+	public function getParameters()
75
+	{
76
+		return $this->parameters;
77
+	}
78
+
79
+
80
+	/**
81
+	 * Check if the found language is allowed and
82
+	 * if an action is to be taken.
83
+	 *
84
+	 * @param $lang
85
+	 * @param $request
86
+	 */
87
+	private function detectLanguage($lang, $request)
88
+	{
89
+		$_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage;
90
+
91
+		if ($this->acceptedLanguages === null) {
92
+			$_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
93
+		} else if (in_array($lang, $this->acceptedLanguages)) {
94
+			$_SESSION['LanguageComponent'][$this->languageParameterName] = $lang;
95
+		} else {
96
+			$lang = $this->defaultLanguage;
97
+		}
98
+
99
+		$this->sessionValues = $_SESSION['LanguageComponent'];
100
+
101
+		if ($this->forceRedirect === true) {
102
+			if (substr($request::$relativeUri, 0, 2) !== $lang ) {
103
+				if ($lang !== $this->defaultLanguage) {
104
+					header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri);
105
+					exit;
106
+				}
107
+			}
108
+		}
109
+	}
110
+
111
+	/**
112
+	 * Detect if the language is switched manually
113
+	 *
114
+	 * @param $request
115
+	 */
116
+	private function checkLanguageSwitch($request)
117
+	{
118
+		if (isset($request::$get['langSwitch'])) {
119
+			$this->forceRedirect = true;
120
+			$this->detectLanguage($request::$get['langSwitch'], $request);
121
+		}
122
+	}
123
+
124
+	/*
125 125
      * These functions are required by the interface, but not for the functionality
126 126
      */
127
-    public function run(Storage $storage) {}
128
-    public function render() {}
129
-    public function get() {}
127
+	public function run(Storage $storage) {}
128
+	public function render() {}
129
+	public function get() {}
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@
 block discarded – undo
99 99
         $this->sessionValues = $_SESSION['LanguageComponent'];
100 100
 
101 101
         if ($this->forceRedirect === true) {
102
-            if (substr($request::$relativeUri, 0, 2) !== $lang ) {
102
+            if (substr($request::$relativeUri, 0, 2) !== $lang) {
103 103
                 if ($lang !== $this->defaultLanguage) {
104
-                    header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri);
104
+                    header('Location: '.$request::$subfolders.$lang.'/'.$request::$relativeUri);
105 105
                     exit;
106 106
                 }
107 107
             }
Please login to merge, or discard this patch.
cloudcontrol/library/components/DocumentComponent.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			if (isset($this->parameters['document'])) {
84 84
 				$this->runByDocumentParameter();
85 85
 			} else {
86
-				throw new \Exception('When not using a regex, you need to set the parameter `document` with the path to the document in this sitemap item: ' . $this->matchedSitemapItem->title);
86
+				throw new \Exception('When not using a regex, you need to set the parameter `document` with the path to the document in this sitemap item: '.$this->matchedSitemapItem->title);
87 87
 			}
88 88
 		}
89 89
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 				$relativeDocumentUri = current($this->matchedSitemapItem->matches[1]);
101 101
 				if (isset($this->parameters['folder'])) {
102 102
 					if (substr($this->parameters['folder'], -1) !== '/') {
103
-						$this->parameters['folder'] = $this->parameters['folder'] . '/';
103
+						$this->parameters['folder'] = $this->parameters['folder'].'/';
104 104
 					}
105
-					$relativeDocumentUri = $this->parameters['folder'] . $relativeDocumentUri;
105
+					$relativeDocumentUri = $this->parameters['folder'].$relativeDocumentUri;
106 106
 				}
107 107
 
108 108
 				$document = $this->storage->getDocumentBySlug($relativeDocumentUri);
Please login to merge, or discard this patch.