@@ -9,8 +9,10 @@ |
||
9 | 9 | <? if (isset($dynamicBrick)) : |
10 | 10 | $fieldSlug = $field->slug; |
11 | 11 | $value = isset($dynamicBrick->fields->$fieldSlug) ? current($dynamicBrick->fields->$fieldSlug) : ''; |
12 | - else : |
|
12 | + else { |
|
13 | + : |
|
13 | 14 | $value = ''; |
15 | + } |
|
14 | 16 | endif ?> |
15 | 17 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
16 | 18 | <ul class="grid-wrapper sortable"> |
@@ -61,7 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function calculateX($imageResource) |
63 | 63 | { |
64 | - if (intval($this->_x) === $this->_x) return $this->_x; |
|
64 | + if (intval($this->_x) === $this->_x) { |
|
65 | + return $this->_x; |
|
66 | + } |
|
65 | 67 | |
66 | 68 | $x = strtolower($this->_x); |
67 | 69 | |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | */ |
87 | 89 | public function calculateY($imageResource) |
88 | 90 | { |
89 | - if (intval($this->_y) === $this->_y) return $this->_y; |
|
91 | + if (intval($this->_y) === $this->_y) { |
|
92 | + return $this->_y; |
|
93 | + } |
|
90 | 94 | |
91 | 95 | $y = strtolower($this->_y); |
92 | 96 | |
@@ -123,7 +127,9 @@ discard block |
||
123 | 127 | */ |
124 | 128 | public function GetWatermark() |
125 | 129 | { |
126 | - if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
130 | + if ($this->_watermark == null) { |
|
131 | + throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
132 | + } |
|
127 | 133 | return $this->_watermark; |
128 | 134 | } |
129 | 135 |
@@ -26,7 +26,9 @@ |
||
26 | 26 | |
27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
28 | 28 | $ratio = min($hRatio, $wRatio); |
29 | - if($ratio > 1) $ratio = 1; |
|
29 | + if($ratio > 1) { |
|
30 | + $ratio = 1; |
|
31 | + } |
|
30 | 32 | |
31 | 33 | // Define sizes |
32 | 34 | $this->_destWidth = floor($originalWidth * $ratio); |
@@ -40,7 +40,9 @@ |
||
40 | 40 | |
41 | 41 | // Define which ratio will be used, depending on which is the biggest side |
42 | 42 | $ratio = $wRatio < $hRatio ? $wRatio : $hRatio; |
43 | - if ($ratio < 1) $ratio = 1; |
|
43 | + if ($ratio < 1) { |
|
44 | + $ratio = 1; |
|
45 | + } |
|
44 | 46 | |
45 | 47 | // Calculate the destination width, height, x and y |
46 | 48 | $this->_destWidth = $originalWidth / $ratio; |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <form method="<?= isset($documentType) ? 'post' : 'get' ?>" onsubmit="return processRtes();" action="<?=isset($formId) ? '#' . $formId : '' ?>"> |
2 | 2 | <? if (!isset($hideTitleAndState)) : ?> |
3 | 3 | <input type="hidden" name="path" value="<?=$request::$get['path']?>" /> |
4 | - <? else : ?> |
|
4 | + <? else { |
|
5 | + : ?> |
|
5 | 6 | <input type="hidden" name="formId" value="<?=$formId?>" /> |
6 | 7 | <a name="<?=$formId?>"></a> |
7 | 8 | <? endif ?> |
@@ -20,15 +21,19 @@ discard block |
||
20 | 21 | <input<?=isset($document) && $document->state == 'published' ? ' checked="checked"' : '' ?> type="checkbox" id="state" name="state" placeholder="State" /> |
21 | 22 | </div> |
22 | 23 | <? endif ?> |
23 | - <?$fieldPrefix='fields';?> |
|
24 | + <?$fieldPrefix='fields'; |
|
25 | +} |
|
26 | +?> |
|
24 | 27 | <? foreach ($documentType->fields as $field) : ?> |
25 | 28 | <div class="form-element"> |
26 | 29 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
27 | 30 | <? if (isset($document)) : |
28 | 31 | $fieldSlug = $field->slug; |
29 | 32 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; |
30 | - else : |
|
33 | + else { |
|
34 | + : |
|
31 | 35 | $value = ''; |
36 | + } |
|
32 | 37 | endif ?> |
33 | 38 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
34 | 39 | <ul class="grid-wrapper sortable"> |
@@ -138,8 +143,11 @@ discard block |
||
138 | 143 | </ul> |
139 | 144 | <a class="btn" onclick="addDynamicBrick(this, 'true', 'newBrickDropzone_<?=$static_brick_nr?>');">+</a> |
140 | 145 | <?$static_brick_nr += 1?> |
141 | - <? else : ?> |
|
142 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
146 | + <? else { |
|
147 | + : ?> |
|
148 | + <?$fieldPrefix='bricks[' . $brick->slug . '][fields]'; |
|
149 | +} |
|
150 | +?> |
|
143 | 151 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
144 | 152 | <? foreach ($brick->structure->fields as $field) : ?> |
145 | 153 | <div class="form-element"> |
@@ -148,8 +156,10 @@ discard block |
||
148 | 156 | $brickSlug = $brick->slug; |
149 | 157 | $fieldSlug = $field->slug; |
150 | 158 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; |
151 | - else : |
|
159 | + else { |
|
160 | + : |
|
152 | 161 | $value = ''; |
162 | + } |
|
153 | 163 | endif ?> |
154 | 164 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
155 | 165 | <ul class="grid-wrapper sortable"> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $error = error_get_last(); |
34 | 34 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
35 | 35 | errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
36 | - }elseif ($error['type'] == 1) { |
|
36 | + } elseif ($error['type'] == 1) { |
|
37 | 37 | dump($error); |
38 | 38 | } |
39 | 39 | } |
@@ -85,7 +85,9 @@ discard block |
||
85 | 85 | * @param string $httpHeader |
86 | 86 | */ |
87 | 87 | function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
88 | - if (ob_get_contents()) ob_end_clean(); |
|
88 | + if (ob_get_contents()) { |
|
89 | + ob_end_clean(); |
|
90 | + } |
|
89 | 91 | |
90 | 92 | if (canShowError()) { |
91 | 93 | $file_lines = file_exists($file) ? file($file) : array(); |
@@ -74,12 +74,15 @@ |
||
74 | 74 | * @return string |
75 | 75 | */ |
76 | 76 | function humanFileSize($size,$unit="") { |
77 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
78 | - return number_format($size/(1<<30),2)."GB"; |
|
79 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
80 | - return number_format($size/(1<<20),2)."MB"; |
|
81 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
82 | - return number_format($size/(1<<10),2)."KB"; |
|
77 | + if( (!$unit && $size >= 1<<30) || $unit == "GB") { |
|
78 | + return number_format($size/(1<<30),2)."GB"; |
|
79 | + } |
|
80 | + if( (!$unit && $size >= 1<<20) || $unit == "MB") { |
|
81 | + return number_format($size/(1<<20),2)."MB"; |
|
82 | + } |
|
83 | + if( (!$unit && $size >= 1<<10) || $unit == "KB") { |
|
84 | + return number_format($size/(1<<10),2)."KB"; |
|
85 | + } |
|
83 | 86 | return number_format($size)." bytes"; |
84 | 87 | } |
85 | 88 |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | return imagejpeg($imageResource, $path, $quality); |
62 | 62 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
63 | 63 | return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
64 | - } |
|
65 | - else { |
|
64 | + } else { |
|
66 | 65 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
67 | 66 | } |
68 | 67 | } |
@@ -103,8 +102,9 @@ discard block |
||
103 | 102 | // Load the image into a string |
104 | 103 | $file = fopen($p_sFile,"rb"); |
105 | 104 | $read = fread($file,10); |
106 | - while(!feof($file)&&($read<>"")) |
|
107 | - $read .= fread($file,1024); |
|
105 | + while(!feof($file)&&($read<>"")) { |
|
106 | + $read .= fread($file,1024); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | $temp = unpack("H*",$read); |
110 | 110 | $hex = $temp[1]; |
@@ -157,8 +157,9 @@ discard block |
||
157 | 157 | { |
158 | 158 | // If padding needed, ignore image-padding |
159 | 159 | // Shift i to the ending of the current 32-bit-block |
160 | - if ($usePadding) |
|
161 | - $i += $width%4; |
|
160 | + if ($usePadding) { |
|
161 | + $i += $width%4; |
|
162 | + } |
|
162 | 163 | |
163 | 164 | // Reset horizontal position |
164 | 165 | $x = 0; |
@@ -167,8 +168,9 @@ discard block |
||
167 | 168 | $y++; |
168 | 169 | |
169 | 170 | // Reached the image-height? Break the for-loop |
170 | - if ($y>$height) |
|
171 | - break; |
|
171 | + if ($y>$height) { |
|
172 | + break; |
|
173 | + } |
|
172 | 174 | } |
173 | 175 | |
174 | 176 | // Calculation of the RGB-pixel (defined as BGR in image-data) |