@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | * array offset \ArrayAccess |
| 135 | 135 | * unused |
| 136 | 136 | */ |
| 137 | - public function offsetSet($offset, $value){}
|
|
| 138 | - public function offsetExists($offset){}
|
|
| 139 | - public function offsetUnset($offset){}
|
|
| 137 | + public function offsetSet($offset, $value) {}
|
|
| 138 | + public function offsetExists($offset) {}
|
|
| 139 | + public function offsetUnset($offset) {}
|
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * Gets array value \ArrayAccess |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | public function setLocation($dir = "bulletproof", $permission = 0666) |
| 214 | 214 | {
|
| 215 | 215 | if (!file_exists($dir) && !is_dir($dir) && !$this->location) {
|
| 216 | - $createFolder = @mkdir("" . $dir, (int) $permission, true);
|
|
| 216 | + $createFolder = @mkdir("".$dir, (int) $permission, true);
|
|
| 217 | 217 | if (!$createFolder) {
|
| 218 | 218 | $this->error = sprintf($this->error_messages['location'], $dir); |
| 219 | 219 | return; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function setErrorMessages($new_error_messages) |
| 249 | 249 | {
|
| 250 | - if($new_array = array_replace_recursive($this->error_messages, $new_error_messages)) {
|
|
| 250 | + if ($new_array = array_replace_recursive($this->error_messages, $new_error_messages)) {
|
|
| 251 | 251 | $this->error_messages = $new_array; |
| 252 | 252 | }; |
| 253 | 253 | return $this; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | public function getName() |
| 262 | 262 | {
|
| 263 | 263 | if (!$this->name) {
|
| 264 | - return uniqid(true) . "_" . str_shuffle(implode(range("e", "q")));
|
|
| 264 | + return uniqid(true)."_".str_shuffle(implode(range("e", "q")));
|
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | return $this->name; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | public function getFullPath() |
| 276 | 276 | {
|
| 277 | - $this->fullPath = $this->location . "/" . $this->name . "." . $this->mime; |
|
| 277 | + $this->fullPath = $this->location."/".$this->name.".".$this->mime; |
|
| 278 | 278 | return $this->fullPath; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function getLocation() |
| 327 | 327 | {
|
| 328 | - if(!$this->location){
|
|
| 328 | + if (!$this->location) {
|
|
| 329 | 329 | $this->setLocation(); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * |
| 358 | 358 | * @return string|bool |
| 359 | 359 | */ |
| 360 | - public function getError(){
|
|
| 360 | + public function getError() {
|
|
| 361 | 361 | return $this->error != "" ? $this->error : false; |
| 362 | 362 | } |
| 363 | 363 | |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | list($minSize, $maxSize) = $image->size; |
| 395 | 395 | |
| 396 | 396 | /* check for common upload errors */ |
| 397 | - if($image->error = $image->uploadErrors($files["error"])){
|
|
| 398 | - return ; |
|
| 397 | + if ($image->error = $image->uploadErrors($files["error"])) {
|
|
| 398 | + return; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /* check image for valid mime types and return mime */ |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | if (!in_array($image->mime, $image->mimeTypes)) {
|
| 406 | 406 | $ext = implode(", ", $image->mimeTypes);
|
| 407 | 407 | $image->error = sprintf($this->error_messages['mime_type'], $ext); |
| 408 | - return ; |
|
| 408 | + return; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /* check image size based on the settings */ |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $min = intval($minSize / 1000) ?: 1; $max = intval($maxSize / 1000); |
| 414 | 414 | |
| 415 | 415 | $image->error = sprintf($this->error_messages['file_size'], $min, $max); |
| 416 | - return ; |
|
| 416 | + return; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /* check image dimension */ |
@@ -421,16 +421,16 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | if ($image->height > $allowedHeight || $image->width > $allowedWidth) {
|
| 423 | 423 | $image->error = sprintf($this->error_messages['dimensions'], $allowedHeight, $allowedWidth); |
| 424 | - return ; |
|
| 424 | + return; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - if($image->height < 4 || $image->width < 4){
|
|
| 427 | + if ($image->height < 4 || $image->width < 4) {
|
|
| 428 | 428 | $image->error = $this->error_messages['too_small']; |
| 429 | - return ; |
|
| 429 | + return; |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | /* set and get folder name */ |
| 433 | - $image->fullPath = $image->location. "/" . $image->name . "." . $image->mime; |
|
| 433 | + $image->fullPath = $image->location."/".$image->name.".".$image->mime; |
|
| 434 | 434 | |
| 435 | 435 | /* gather image info for json storage */ |
| 436 | 436 | $image->serialize = array( |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - $image->error = $this->error_messages['unknown']; |
|
| 453 | + $image->error = $this->error_messages['unknown']; |
|
| 454 | 454 | return false; |
| 455 | 455 | } |
| 456 | 456 | |