Passed
Branch develop (8cbda1)
by Jens
02:45
created
cloudcontrol/templates/cms/documents/brick.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 	<a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a>
3 3
 	<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
4 4
 </div>
5
-<?$fieldPrefix = 'dynamicBricks[' . $brick->slug . '][' . time() . ']'?>
5
+<?$fieldPrefix = 'dynamicBricks['.$brick->slug.']['.time().']'?>
6 6
 <? foreach ($brick->fields as $field) : ?>
7 7
 			<div class="form-element">
8 8
 				<label for="<?=$field->slug?>"><?=$field->title?></label>
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 							<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
27 27
 							<div class="form-element">
28 28
 				<? endif ?>
29
-					<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
29
+					<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
30 30
 				<? if ($field->multiple == true && $field->type != 'Rich Text') : ?>
31 31
 
32 32
 							</div>
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 						<li class="grid-container">
49 49
 							<div class="grid-box-10">
50 50
 								<div class="grid-inner form-element">
51
-									<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
51
+									<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
52 52
 								</div>
53 53
 							</div>
54 54
 							<div class="grid-box-2">
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 								</div>
59 59
 							</div>
60 60
 						</li>
61
-						<?$value='';?>
61
+						<?$value = ''; ?>
62 62
 						<? endforeach ?>
63 63
 					<? endif ?>
64 64
 				</ul>
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 							<a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a>
76 76
 							<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
77 77
 							<div class="form-element">
78
-							<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
78
+							<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
79 79
 							</div>
80 80
 						</li>
81
-						<?$value='';?>
81
+						<?$value = ''; ?>
82 82
 					<? endforeach ?>
83 83
 					<? endif ?>
84 84
 					</div>
@@ -87,5 +87,5 @@  discard block
 block discarded – undo
87 87
 				<a class="btn js-addrtemultiple">+</a>
88 88
 				<? endif ?>
89 89
 			</div>
90
-			<?$value='';?>
90
+			<?$value = ''; ?>
91 91
 		<? endforeach ?>
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents/document-form.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,13 +123,13 @@  discard block
 block discarded – undo
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 129
 			<? foreach ($documentType->bricks as $brick) : ?>
130 130
 			<div class="brick">
131 131
 				<label><?=$brick->title?></label>
132
-				<?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?>
132
+				<?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?>
133 133
 				<input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" />
134 134
 				<? foreach ($brick->structure->fields as $field) : ?>
135 135
 					<div class="form-element">
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 								<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
156 156
 								<div class="form-element">
157 157
 					<? endif ?>
158
-						<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
158
+						<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
159 159
 					<? if ($field->multiple == true && $field->type != 'Rich Text') : ?>
160 160
 
161 161
 								</div>
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 							<li class="grid-container">
179 179
 								<div class="grid-box-10">
180 180
 									<div class="grid-inner form-element">
181
-										<? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?>
181
+										<? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?>
182 182
 									</div>
183 183
 								</div>
184 184
 								<div class="grid-box-2">
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 									</div>
189 189
 								</div>
190 190
 							</li>
191
-							<?$value='';?>
191
+							<?$value = ''; ?>
192 192
 							<? endforeach ?>
193 193
 						<? endif ?>
194 194
 					</ul>
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 								<a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a>
207 207
 								<a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a>
208 208
 								<div class="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
 							</li>
212
-							<?$value='';?>
212
+							<?$value = ''; ?>
213 213
 						<? endforeach ?>
214 214
 						<? endif ?>
215 215
 						</div>
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 					<a class="btn js-addrtemultiple">+</a>
219 219
 					<? endif ?>
220 220
 				</div>
221
-				<?$value='';?>
221
+				<?$value = ''; ?>
222 222
 				<? endforeach ?>
223 223
 				</div>
224 224
 				<hr />
225
-			<? endforeach;?>
225
+			<? endforeach; ?>
226 226
 			<? if (count($documentType->dynamicBricks) > 0) : ?>
227 227
 			<div class="dynamicBrickWrapper">
228 228
 				<label>Dynamic Bricks</label>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 						endforeach ?>
242 242
 						<li class="brick form-element">
243 243
 							<label><?=$brick->title?></label>
244
-							<?include(__DIR__ . '/brick.php')?>
244
+							<?include(__DIR__.'/brick.php')?>
245 245
 						</li>
246 246
 					<? endforeach ?>
247 247
 				<? endif ?>
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents/fieldTypes/Rich-Text.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 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]]
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents/fieldTypes/Image.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 	<div class="grid-container">
3 3
 		<div class="grid-box-2">
4 4
 			<div class="grid-inner">
5
-				<div<?=isset($value) ? ' style="background-image:url(\'' . $request::$subfolders . 'images/' . $value . '\');"' : '' ?> class="selected-image" id="<?=$field->slug?>_selectedImage"></div>
5
+				<div<?=isset($value) ? ' style="background-image:url(\''.$request::$subfolders.'images/'.$value.'\');"' : '' ?> class="selected-image" id="<?=$field->slug?>_selectedImage"></div>
6 6
 			</div>
7 7
 		</div>
8 8
 		<div class="grid-box-10">
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/images/show.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
10 10
 	<div class="show-image">
11 11
 		<label>File</label>
12 12
 		<div class="value">
13
-			<?=isset($image)? $image->file : '' ?>
13
+			<?=isset($image) ? $image->file : '' ?>
14 14
 		</div>
15 15
 		<label>Type</label>
16 16
 		<div class="value">
17
-			<?=isset($image)? $image->type : '' ?>
17
+			<?=isset($image) ? $image->type : '' ?>
18 18
 		</div>
19 19
 		<label>Size</label>
20 20
 		<div class="value">
21
-			<?=isset($image)? humanFileSize($image->size) : '' ?>
21
+			<?=isset($image) ? humanFileSize($image->size) : '' ?>
22 22
 		</div>
23 23
 		<label>Set</label>
24 24
 		<? if (isset($image)) : ?>
25 25
 			<? foreach ($image->set as $key => $set) : ?>
26 26
 				<div class="sets">
27 27
 					<label><?=$key?></label>
28
-					<img src="<?=\library\cc\Request::$subfolders . 'images/' . $set?>" />
28
+					<img src="<?=\library\cc\Request::$subfolders.'images/'.$set?>" />
29 29
 				</div>
30 30
 			<? endforeach ?>
31 31
 		<? endif ?>
Please login to merge, or discard this patch.
cloudcontrol/templates/cms/documents.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders . $cmsPrefix?>/documents?path=/');};</script>
1
+<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders.$cmsPrefix?>/documents?path=/');};</script>
2 2
 <section class="documents">
3 3
 	<h2><i class="fa fa-file-text-o"></i> Documents</h2>
4 4
 	<nav class="actions">
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 			<? foreach ($documents as $document) : ?>
25 25
 				<li class="grid-container">
26 26
 					<? if ($document->type == 'document') : ?>
27
-						<?renderDocument($document, $cmsPrefix);?>
27
+						<?renderDocument($document, $cmsPrefix); ?>
28 28
 					<? elseif ($document->type == 'folder') : ?>
29
-						<?renderFolder($document, $cmsPrefix, '', true);?>
29
+						<?renderFolder($document, $cmsPrefix, '', true); ?>
30 30
 					<? endif ?>
31 31
 				</li>
32 32
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 <? function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?>
38 38
 <div class="grid-box-10">
39 39
 	<h3>
40
-		<a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit">
40
+		<a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit">
41 41
 			<i class="fa fa-file-text-o"></i> <?=$document->title?>
42 42
 		</a>
43 43
 		<small class="small state <?=strtolower($document->state)?>"><?=ucfirst($document->state)?></small>
@@ -53,29 +53,29 @@  discard block
 block discarded – undo
53 53
 	</h3>
54 54
 </div>
55 55
 <div class="documentActions grid-box-2">
56
-	<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
57
-	<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-times"></i></a>
56
+	<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
57
+	<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-times"></i></a>
58 58
 </div>
59 59
 <?}?>
60
-<? function renderFolder($document, $cmsPrefix, $slugPrefix ='', $root = false) {?>
60
+<? function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false) {?>
61 61
 <div class="grid-box-8">
62 62
 	<h3>
63
-		<a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix . $document->slug?>" title="Open">
63
+		<a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix.$document->slug?>" title="Open">
64 64
 			<i class="fa fa-folder-o "></i> <?=$document->title?>
65 65
 		</a>
66 66
 	</h3>
67 67
 </div>
68 68
 <div class="documentActions grid-box-4">
69
-	<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
70
-	<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-times"></i></a>
69
+	<a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a>
70
+	<a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-times"></i></a>
71 71
 </div>
72 72
 <ul class="documents grid-wrapper nested<?=$root ? ' root' : '' ?>">
73 73
 	<? foreach ($document->content as $subDocument) : ?>
74 74
 		<li class="grid-container">
75 75
 			<? if ($subDocument->type == 'document') : ?>
76
-				<?renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?>
76
+				<?renderDocument($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?>
77 77
 			<? elseif ($subDocument->type == 'folder') : ?>
78
-				<?renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?>
78
+				<?renderFolder($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?>
79 79
 			<? endif ?>
80 80
 		</li>
81 81
 	<? endforeach ?>
Please login to merge, or discard this patch.
cloudcontrol/templates/cms.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				</li>
63 63
 				<? $nrOfMenuItems += 1 ?>
64 64
 				<? endif ?>
65
-				<li class="grid-box-<?=6 + (5-$nrOfMenuItems)?> log-off-box">
65
+				<li class="grid-box-<?=6 + (5 - $nrOfMenuItems)?> log-off-box">
66 66
 					<a class="btn log-off grid-inner" href="<?=$request::$subfolders?><?=$cmsPrefix?>/log-off">
67 67
 						<i class="fa fa-power-off"></i>
68 68
 						<span>Log off</span>
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	</main>
87 87
 <script>
88 88
 var subfolders = '<?=$request::$subfolders?>',
89
-	cmsSubfolders = '<?=$request::$subfolders . $cmsPrefix?>';
89
+	cmsSubfolders = '<?=$request::$subfolders.$cmsPrefix?>';
90 90
 </script>
91 91
 <script src="<?=$request::$subfolders?>js/cms.js"></script>
92 92
 </body>
Please login to merge, or discard this patch.
cloudcontrol/library/images/Image.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,84 +99,84 @@  discard block
 block discarded – undo
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); 
107
+			$temp = unpack("H*", $read); 
108
+			$hex = $temp[1]; 
109
+			$header = substr($hex, 0, 108); 
110 110
 			
111 111
 			//    Process the header 
112 112
 			//    Structure: http://www.fastgraph.com/help/bmp_header_format.html 
113
-			if (substr($header,0,4)=="424d") 
113
+			if (substr($header, 0, 4) == "424d") 
114 114
 			{ 
115 115
 				//    Cut it in parts of 2 bytes 
116
-				$header_parts    =    str_split($header,2); 
116
+				$header_parts = str_split($header, 2); 
117 117
 				
118 118
 				//    Get the width        4 bytes 
119
-				$width            =    hexdec($header_parts[19].$header_parts[18]); 
119
+				$width = hexdec($header_parts[19].$header_parts[18]); 
120 120
 				
121 121
 				//    Get the height        4 bytes 
122
-				$height            =    hexdec($header_parts[23].$header_parts[22]); 
122
+				$height = hexdec($header_parts[23].$header_parts[22]); 
123 123
 				
124 124
 				//    Unset the header params 
125 125
 				unset($header_parts); 
126 126
 			} 
127 127
 			
128 128
 			//    Define starting X and Y 
129
-			$x                =    0; 
130
-			$y                =    1; 
129
+			$x                = 0; 
130
+			$y                = 1; 
131 131
 			
132 132
 			//    Create newimage 
133
-			$image            =    imagecreatetruecolor($width,$height); 
133
+			$image            = imagecreatetruecolor($width, $height); 
134 134
 			
135 135
 			//    Grab the body from the image 
136
-			$body            =    substr($hex,108); 
136
+			$body = substr($hex, 108); 
137 137
 
138 138
 			//    Calculate if padding at the end-line is needed 
139 139
 			//    Divided by two to keep overview. 
140 140
 			//    1 byte = 2 HEX-chars 
141
-			$body_size        =    (strlen($body)/2); 
142
-			$header_size    =    ($width*$height); 
141
+			$body_size = (strlen($body) / 2); 
142
+			$header_size = ($width * $height); 
143 143
 
144 144
 			//    Use end-line padding? Only when needed 
145
-			$usePadding        =    ($body_size>($header_size*3)+4); 
145
+			$usePadding = ($body_size > ($header_size * 3) + 4); 
146 146
 			
147 147
 			//    Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption 
148 148
 			//    Calculate the next DWORD-position in the body 
149
-			for ($i=0;$i<$body_size;$i+=3) 
149
+			for ($i = 0; $i < $body_size; $i += 3) 
150 150
 			{ 
151 151
 				//    Calculate line-ending and padding 
152
-				if ($x>=$width) 
152
+				if ($x >= $width) 
153 153
 				{ 
154 154
 					//    If padding needed, ignore image-padding 
155 155
 					//    Shift i to the ending of the current 32-bit-block 
156 156
 					if ($usePadding) 
157
-						$i    +=    $width%4; 
157
+						$i += $width % 4; 
158 158
 					
159 159
 					//    Reset horizontal position 
160
-					$x    =    0; 
160
+					$x = 0; 
161 161
 					
162 162
 					//    Raise the height-position (bottom-up) 
163 163
 					$y++; 
164 164
 					
165 165
 					//    Reached the image-height? Break the for-loop 
166
-					if ($y>$height) 
166
+					if ($y > $height) 
167 167
 						break; 
168 168
 				} 
169 169
 				
170 170
 				//    Calculation of the RGB-pixel (defined as BGR in image-data) 
171 171
 				//    Define $i_pos as absolute position in the body 
172
-				$i_pos    =    $i*2; 
173
-				$r        =    hexdec($body[$i_pos+4].$body[$i_pos+5]); 
174
-				$g        =    hexdec($body[$i_pos+2].$body[$i_pos+3]); 
175
-				$b        =    hexdec($body[$i_pos].$body[$i_pos+1]); 
172
+				$i_pos    = $i * 2; 
173
+				$r        = hexdec($body[$i_pos + 4].$body[$i_pos + 5]); 
174
+				$g        = hexdec($body[$i_pos + 2].$body[$i_pos + 3]); 
175
+				$b        = hexdec($body[$i_pos].$body[$i_pos + 1]); 
176 176
 				
177 177
 				//    Calculate and draw the pixel 
178
-				$color    =    imagecolorallocate($image,$r,$g,$b); 
179
-				imagesetpixel($image,$x,$height-$y,$color); 
178
+				$color    = imagecolorallocate($image, $r, $g, $b); 
179
+				imagesetpixel($image, $x, $height - $y, $color); 
180 180
 				
181 181
 				//    Raise the horizontal position 
182 182
 				$x++; 
Please login to merge, or discard this patch.
cloudcontrol/library/images/ImageResizer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 				}
41 41
 				return $returnFileNames;
42 42
 			} else {
43
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
43
+				throw new \Exception('Image doesnt exist: '.$imagePath);
44 44
 			}
45 45
 		}
46 46
 
47
-		public function resize($imagePath='', $width='',$height='')
47
+		public function resize($imagePath = '', $width = '', $height = '')
48 48
 		{
49
-			$modifier = '-r' . $width . 'x' . $height;
49
+			$modifier = '-r'.$width.'x'.$height;
50 50
 			$destination = $this->modifyName($imagePath, $modifier);
51 51
 			if (file_exists($imagePath)) {
52 52
 				$image = new Image();
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 				$resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80);
61 61
 				return basename($destination);
62 62
 			} else {
63
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
63
+				throw new \Exception('Image doesnt exist: '.$imagePath);
64 64
 			}
65 65
 		}
66 66
 
67
-		public function smartcrop($imagePath='', $width='',$height='')
67
+		public function smartcrop($imagePath = '', $width = '', $height = '')
68 68
 		{
69
-			$modifier = '-s' . $width . 'x' . $height;
69
+			$modifier = '-s'.$width.'x'.$height;
70 70
 			$destination = $this->modifyName($imagePath, $modifier);
71 71
 			if (file_exists($imagePath)) {
72 72
 				$image = new Image();
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 				$resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80);
81 81
 				return basename($destination);
82 82
 			} else {
83
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
83
+				throw new \Exception('Image doesnt exist: '.$imagePath);
84 84
 			}
85 85
 		}
86 86
 
87
-		public function boxcrop($imagePath='', $width='',$height='')
87
+		public function boxcrop($imagePath = '', $width = '', $height = '')
88 88
 		{
89
-			$modifier = '-b' . $width . 'x' . $height;
89
+			$modifier = '-b'.$width.'x'.$height;
90 90
 			$destination = $this->modifyName($imagePath, $modifier);
91 91
 			if (file_exists($imagePath)) {
92 92
 				$image = new Image();
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 				$resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80);
101 101
 				return basename($destination);
102 102
 			} else {
103
-				throw new \Exception('Image doesnt exist: ' . $imagePath);
103
+				throw new \Exception('Image doesnt exist: '.$imagePath);
104 104
 			}
105 105
 		}
106 106
 
@@ -114,25 +114,25 @@  discard block
 block discarded – undo
114 114
 				array_pop($fileParts);
115 115
 				$fileNameWithoutExtension = implode('-', $fileParts);
116 116
 				$fileNameWithoutExtension = slugify($fileNameWithoutExtension);
117
-				$filename = $fileNameWithoutExtension . $modifier  . '.' . $extension;
117
+				$filename = $fileNameWithoutExtension.$modifier.'.'.$extension;
118 118
 			} else {
119 119
 				$filename = slugify($filename);
120 120
 			}
121 121
 
122
-			if (file_exists($path . '/' . $filename)) {
122
+			if (file_exists($path.'/'.$filename)) {
123 123
 				$fileParts = explode('.', $filename);
124 124
 				if (count($fileParts) > 1) {
125 125
 					$extension = end($fileParts);
126 126
 					array_pop($fileParts);
127 127
 					$fileNameWithoutExtension = implode('-', $fileParts);
128 128
 					$fileNameWithoutExtension .= '-copy';
129
-					$filename = $fileNameWithoutExtension . '.' . $extension;
129
+					$filename = $fileNameWithoutExtension.'.'.$extension;
130 130
 				} else {
131 131
 					$filename .= '-copy';
132 132
 				}
133
-				return $this->modifyName($path . '/' . $filename);
133
+				return $this->modifyName($path.'/'.$filename);
134 134
 			}
135
-			return $path . '/' . $filename;
135
+			return $path.'/'.$filename;
136 136
 		}
137 137
 
138 138
 		private function validateFilename($filename, $path)
Please login to merge, or discard this patch.