@@ -93,11 +93,11 @@ |
||
| 93 | 93 | throw new Exception('stream name [' . $name . '] should be an alpha numeric string'); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($width <= 0) { |
|
| 96 | + if ($width <= 0) { |
|
| 97 | 97 | throw new Exception('width [' . $width . '] should be a positive number'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if($height <= 0) { |
|
| 100 | + if ($height <= 0) { |
|
| 101 | 101 | throw new Exception('height [' . $height . '] should be a positive number'); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -35,17 +35,13 @@ discard block |
||
| 35 | 35 | if ($mime) { |
| 36 | 36 | if (strstr($mime, 'image/')) { |
| 37 | 37 | return LaruploadEnum::IMAGE; |
| 38 | - } |
|
| 39 | - else if (strstr($mime, 'video/')) { |
|
| 38 | + } else if (strstr($mime, 'video/')) { |
|
| 40 | 39 | return LaruploadEnum::VIDEO; |
| 41 | - } |
|
| 42 | - else if (strstr($mime, 'audio/')) { |
|
| 40 | + } else if (strstr($mime, 'audio/')) { |
|
| 43 | 41 | return LaruploadEnum::AUDIO; |
| 44 | - } |
|
| 45 | - else if ($mime == 'application/pdf') { |
|
| 42 | + } else if ($mime == 'application/pdf') { |
|
| 46 | 43 | return LaruploadEnum::PDF; |
| 47 | - } |
|
| 48 | - else if ($mime == 'application/zip' or $mime == 'application/x-rar-compressed') { |
|
| 44 | + } else if ($mime == 'application/zip' or $mime == 'application/x-rar-compressed') { |
|
| 49 | 45 | return LaruploadEnum::COMPRESSED; |
| 50 | 46 | } |
| 51 | 47 | } |
@@ -94,11 +90,9 @@ discard block |
||
| 94 | 90 | { |
| 95 | 91 | if (ini_get('upload_tmp_dir')) { |
| 96 | 92 | $path = ini_get('upload_tmp_dir'); |
| 97 | - } |
|
| 98 | - else if (getenv('temp')) { |
|
| 93 | + } else if (getenv('temp')) { |
|
| 99 | 94 | $path = getenv('temp'); |
| 100 | - } |
|
| 101 | - else { |
|
| 95 | + } else { |
|
| 102 | 96 | $path = sys_get_temp_dir(); |
| 103 | 97 | } |
| 104 | 98 | |
@@ -67,8 +67,7 @@ discard block |
||
| 67 | 67 | $this->type = $this->output['type']; |
| 68 | 68 | |
| 69 | 69 | return true; |
| 70 | - } |
|
| 71 | - else { |
|
| 70 | + } else { |
|
| 72 | 71 | return false; |
| 73 | 72 | } |
| 74 | 73 | } |
@@ -86,8 +85,7 @@ discard block |
||
| 86 | 85 | $this->type = $this->output['type']; |
| 87 | 86 | |
| 88 | 87 | return true; |
| 89 | - } |
|
| 90 | - else { |
|
| 88 | + } else { |
|
| 91 | 89 | return false; |
| 92 | 90 | } |
| 93 | 91 | } |
@@ -107,8 +105,7 @@ discard block |
||
| 107 | 105 | if (isset($this->file)) { |
| 108 | 106 | if ($this->file == LARUPLOAD_NULL) { |
| 109 | 107 | $this->clean($model->id); |
| 110 | - } |
|
| 111 | - else { |
|
| 108 | + } else { |
|
| 112 | 109 | if (!$this->keepOldFiles) { |
| 113 | 110 | $this->clean($model->id); |
| 114 | 111 | } |
@@ -121,8 +118,7 @@ discard block |
||
| 121 | 118 | } |
| 122 | 119 | |
| 123 | 120 | $model = $this->setAttributes($model); |
| 124 | - } |
|
| 125 | - else if (isset($this->cover)) { |
|
| 121 | + } else if (isset($this->cover)) { |
|
| 126 | 122 | $this->setCover($model->id); |
| 127 | 123 | |
| 128 | 124 | $model = $this->setAttributes($model); |
@@ -214,8 +210,7 @@ discard block |
||
| 214 | 210 | if ($style == LaruploadEnum::COVER_FOLDER and $this->generateCover === false) { |
| 215 | 211 | $styles->{$style} = null; |
| 216 | 212 | continue; |
| 217 | - } |
|
| 218 | - else if ($style == LaruploadEnum::STREAM_FOLDER and empty($this->streams)) { |
|
| 213 | + } else if ($style == LaruploadEnum::STREAM_FOLDER and empty($this->streams)) { |
|
| 219 | 214 | unset($styles->{$style}); |
| 220 | 215 | continue; |
| 221 | 216 | } |
@@ -409,8 +404,7 @@ discard block |
||
| 409 | 404 | case LaruploadEnum::VIDEO: |
| 410 | 405 | if ($this->ffmpegQueue) { |
| 411 | 406 | $this->initializeFFMpegQueue($id, $class, $standalone); |
| 412 | - } |
|
| 413 | - else { |
|
| 407 | + } else { |
|
| 414 | 408 | $this->handleVideoStyles($id); |
| 415 | 409 | } |
| 416 | 410 | |
@@ -462,8 +456,7 @@ discard block |
||
| 462 | 456 | |
| 463 | 457 | if ($maxQueueNum == 0) { |
| 464 | 458 | $flag = true; |
| 465 | - } |
|
| 466 | - else { |
|
| 459 | + } else { |
|
| 467 | 460 | $availableQueues = DB::table(LaruploadEnum::FFMPEG_QUEUE_TABLE)->where('status', 0)->count(); |
| 468 | 461 | |
| 469 | 462 | if ($availableQueues < $maxQueueNum) { |
@@ -497,8 +490,7 @@ discard block |
||
| 497 | 490 | |
| 498 | 491 | |
| 499 | 492 | ProcessFFMpeg::dispatch($queueId, $id, $this->name, $class, $serializedClass); |
| 500 | - } |
|
| 501 | - else { |
|
| 493 | + } else { |
|
| 502 | 494 | throw new HttpResponseException(redirect(URL::previous())->withErrors([ |
| 503 | 495 | 'ffmpeg_queue_max_num' => trans('larupload::messages.max-queue-num-exceeded') |
| 504 | 496 | ])); |
@@ -532,8 +524,7 @@ discard block |
||
| 532 | 524 | foreach ($this->output as $key => $value) { |
| 533 | 525 | $model->{"{$this->name}_file_$key"} = $value; |
| 534 | 526 | } |
| 535 | - } |
|
| 536 | - else { |
|
| 527 | + } else { |
|
| 537 | 528 | $model->{"{$this->name}_file_name"} = $this->output['name'] ?? null; |
| 538 | 529 | $model->{"{$this->name}_file_meta"} = json_encode($this->output); |
| 539 | 530 | } |
@@ -566,8 +557,7 @@ discard block |
||
| 566 | 557 | } |
| 567 | 558 | |
| 568 | 559 | return null; |
| 569 | - } |
|
| 570 | - else if ($name and $this->styleHasFile($style)) { |
|
| 560 | + } else if ($name and $this->styleHasFile($style)) { |
|
| 571 | 561 | $name = $this->fixExceptionNames($name, $style); |
| 572 | 562 | $path = $this->getBasePath($this->id, $style); |
| 573 | 563 | $path = "$path/$name"; |