@@ -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"> |
@@ -45,8 +45,10 @@ discard block |
||
| 45 | 45 | <? if (isset($document)) : |
| 46 | 46 | $fieldSlug = $field->slug; |
| 47 | 47 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; |
| 48 | - else : |
|
| 48 | + else { |
|
| 49 | + : |
|
| 49 | 50 | $value = ''; |
| 51 | + } |
|
| 50 | 52 | endif ?> |
| 51 | 53 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 52 | 54 | <ul class="grid-wrapper sortable"> |
@@ -138,8 +140,10 @@ discard block |
||
| 138 | 140 | $brickSlug = $brick->slug; |
| 139 | 141 | $fieldSlug = $field->slug; |
| 140 | 142 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; |
| 141 | - else : |
|
| 143 | + else { |
|
| 144 | + : |
|
| 142 | 145 | $value = ''; |
| 146 | + } |
|
| 143 | 147 | endif ?> |
| 144 | 148 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 145 | 149 | <ul class="grid-wrapper sortable"> |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | return imagejpeg($imageResource, $path, $quality); |
| 60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
| 61 | 61 | return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
| 65 | 64 | } |
| 66 | 65 | return false; |
@@ -101,8 +100,9 @@ discard block |
||
| 101 | 100 | // Load the image into a string |
| 102 | 101 | $file = fopen($p_sFile,"rb"); |
| 103 | 102 | $read = fread($file,10); |
| 104 | - while(!feof($file)&&($read<>"")) |
|
| 105 | - $read .= fread($file,1024); |
|
| 103 | + while(!feof($file)&&($read<>"")) { |
|
| 104 | + $read .= fread($file,1024); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | $temp = unpack("H*",$read); |
| 108 | 108 | $hex = $temp[1]; |
@@ -153,8 +153,9 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | // If padding needed, ignore image-padding |
| 155 | 155 | // Shift i to the ending of the current 32-bit-block |
| 156 | - if ($usePadding) |
|
| 157 | - $i += $width%4; |
|
| 156 | + if ($usePadding) { |
|
| 157 | + $i += $width%4; |
|
| 158 | + } |
|
| 158 | 159 | |
| 159 | 160 | // Reset horizontal position |
| 160 | 161 | $x = 0; |
@@ -163,8 +164,9 @@ discard block |
||
| 163 | 164 | $y++; |
| 164 | 165 | |
| 165 | 166 | // Reached the image-height? Break the for-loop |
| 166 | - if ($y>$height) |
|
| 167 | - break; |
|
| 167 | + if ($y>$height) { |
|
| 168 | + break; |
|
| 169 | + } |
|
| 168 | 170 | } |
| 169 | 171 | |
| 170 | 172 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
@@ -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); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * @param resource $imageResource |
| 19 | 19 | * @return resource |
| 20 | - */ |
|
| 20 | + */ |
|
| 21 | 21 | public function Execute($imageResource) |
| 22 | 22 | { |
| 23 | 23 | // Define the origial width and height |
@@ -62,8 +62,8 @@ |
||
| 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 | |
@@ -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; |
@@ -61,12 +61,15 @@ |
||
| 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 | |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function shutdownHandler () { |
| 33 | 33 | $error = error_get_last(); |
| 34 | - if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
| 35 | - errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
| 36 | - }elseif ($error['type'] == 1) { |
|
| 37 | - dump($error); |
|
| 38 | - } |
|
| 34 | + if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
|
| 35 | + errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
|
| 36 | + }elseif ($error['type'] == 1) { |
|
| 37 | + dump($error); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -49,28 +49,28 @@ discard block |
||
| 49 | 49 | $jsonErrorNr = json_last_error(); |
| 50 | 50 | $errstr = ''; |
| 51 | 51 | switch ($jsonErrorNr) { |
| 52 | - case JSON_ERROR_NONE: |
|
| 53 | - $errstr .= ' - No errors' . PHP_EOL; |
|
| 54 | - break; |
|
| 55 | - case JSON_ERROR_DEPTH: |
|
| 56 | - $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
| 57 | - break; |
|
| 58 | - case JSON_ERROR_STATE_MISMATCH: |
|
| 59 | - $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
| 60 | - break; |
|
| 61 | - case JSON_ERROR_CTRL_CHAR: |
|
| 62 | - $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
| 63 | - break; |
|
| 64 | - case JSON_ERROR_SYNTAX: |
|
| 65 | - $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
| 66 | - break; |
|
| 67 | - case JSON_ERROR_UTF8: |
|
| 68 | - $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
| 69 | - break; |
|
| 70 | - default: |
|
| 71 | - $errstr = ' - Unknown error' . PHP_EOL; |
|
| 72 | - break; |
|
| 73 | - } |
|
| 52 | + case JSON_ERROR_NONE: |
|
| 53 | + $errstr .= ' - No errors' . PHP_EOL; |
|
| 54 | + break; |
|
| 55 | + case JSON_ERROR_DEPTH: |
|
| 56 | + $errstr .= ' - Maximum stack depth exceeded' . PHP_EOL; |
|
| 57 | + break; |
|
| 58 | + case JSON_ERROR_STATE_MISMATCH: |
|
| 59 | + $errstr .= ' - Underflow or the modes mismatch' . PHP_EOL; |
|
| 60 | + break; |
|
| 61 | + case JSON_ERROR_CTRL_CHAR: |
|
| 62 | + $errstr .= ' - Unexpected control character found' . PHP_EOL; |
|
| 63 | + break; |
|
| 64 | + case JSON_ERROR_SYNTAX: |
|
| 65 | + $errstr .= ' - Syntax error, malformed JSON' . PHP_EOL; |
|
| 66 | + break; |
|
| 67 | + case JSON_ERROR_UTF8: |
|
| 68 | + $errstr .= ' - Malformed UTF-8 characters, possibly incorrectly encoded' . PHP_EOL; |
|
| 69 | + break; |
|
| 70 | + default: |
|
| 71 | + $errstr = ' - Unknown error' . PHP_EOL; |
|
| 72 | + break; |
|
| 73 | + } |
|
| 74 | 74 | errorHandler ($jsonErrorNr, $errstr, $file, $line); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function renderError ($message='', $file='', $line='', $code=0, $trace=array(), $httpHeader = 'HTTP/1.0 500 Internal Server Error') { |
| 88 | 88 | $file_lines = file_exists($file) ? file($file) : array(); |
| 89 | - $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
|
| 90 | - $lines = array(); |
|
| 89 | + $range = ($line - 15) < 0 ? range(1, 30) : range($line - 15, $line + 15); |
|
| 90 | + $lines = array(); |
|
| 91 | 91 | |
| 92 | - foreach ($range as $line_number) { |
|
| 93 | - if(isset($file_lines[$line_number-1])) { |
|
| 94 | - $lines[$line_number] = $file_lines[$line_number-1]; |
|
| 95 | - } |
|
| 96 | - } |
|
| 92 | + foreach ($range as $line_number) { |
|
| 93 | + if(isset($file_lines[$line_number-1])) { |
|
| 94 | + $lines[$line_number] = $file_lines[$line_number-1]; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | if (ob_get_contents()) ob_end_clean(); |
| 98 | 98 | $error = array( |
| 99 | 99 | 'message' => $message, |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $error = error_get_last(); |
| 34 | 34 | if (isset($error['type'], $error['message'], $error['file'], $error['line'])) { |
| 35 | 35 | errorHandler($error['type'],$error['message'],$error['file'],$error['line']); |
| 36 | - }elseif ($error['type'] == 1) { |
|
| 36 | + } elseif ($error['type'] == 1) { |
|
| 37 | 37 | dump($error); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -94,7 +94,9 @@ discard block |
||
| 94 | 94 | $lines[$line_number] = $file_lines[$line_number-1]; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - if (ob_get_contents()) ob_end_clean(); |
|
| 97 | + if (ob_get_contents()) { |
|
| 98 | + ob_end_clean(); |
|
| 99 | + } |
|
| 98 | 100 | $error = array( |
| 99 | 101 | 'message' => $message, |
| 100 | 102 | 'file' => $file, |
@@ -62,8 +62,8 @@ |
||
| 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 | |