Completed
Push — develop ( e6bcf2...351294 )
by Dmytro
06:18
created
manager/media/browser/mcpuk/core/browser.php 4 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -783,6 +783,9 @@  discard block
 block discarded – undo
783 783
         }
784 784
     }
785 785
 
786
+    /**
787
+     * @param string $dir
788
+     */
786 789
     protected function moveUploadFile($file, $dir)
787 790
     {
788 791
         $message = $this->checkUploadedFile($file);
@@ -817,6 +820,9 @@  discard block
 block discarded – undo
817 820
         return "/" . basename($target);
818 821
     }
819 822
 
823
+    /**
824
+     * @param string $file
825
+     */
820 826
     protected function sendDefaultThumb($file=null)
821 827
     {
822 828
         if ($file !== null) {
@@ -1028,6 +1034,9 @@  discard block
 block discarded – undo
1028 1034
         return "";
1029 1035
     }
1030 1036
 
1037
+    /**
1038
+     * @param string $message
1039
+     */
1031 1040
     protected function errorMsg($message, array $data=null)
1032 1041
     {
1033 1042
         if (in_array($this->action, array("thumb", "upload", "download", "downloadDir"))) {
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Browser actions class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Browser actions class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class browser extends uploader
16 16
 {
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $this->get['dir'] = $dir;
39 39
         }
40 40
 
41
-        $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
41
+        $thumbsDir = $this->config['uploadDir']."/".$this->config['thumbsDir'];
42 42
         if ((
43 43
                 !is_dir($thumbsDir) &&
44 44
                 !@mkdir($thumbsDir, $this->config['dirPerms'])
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $this->session['dir'] = $this->type;
109 109
         } else {
110 110
             $type = $this->getTypeFromPath($this->session['dir']);
111
-            $dir = $this->config['uploadDir'] . "/" . $this->session['dir'];
111
+            $dir = $this->config['uploadDir']."/".$this->session['dir'];
112 112
             if (($type != $this->type) || !is_dir($dir) || !is_readable($dir)) {
113 113
                 $this->session['dir'] = $this->type;
114 114
             }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         }
173 173
         $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/$file";
174 174
         if (!is_file($file) || !is_readable($file)) {
175
-            $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file);
175
+            $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/".basename($file);
176 176
             if (!is_file($file) || !is_readable($file)) {
177 177
                 $this->sendDefaultThumb($file);
178 178
             }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     protected function act_chDir()
206 206
     {
207 207
         $this->postDir(); // Just for existing check
208
-        $this->session['dir'] = $this->type . "/" . $this->post['dir'];
208
+        $this->session['dir'] = $this->type."/".$this->post['dir'];
209 209
         $dirWritable = dir::isWritable("{$this->config['uploadDir']}/{$this->session['dir']}");
210 210
         return json_encode(array(
211 211
             'files' => $this->getFiles($this->session['dir']),
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
         if (substr($newName, 0, 1) == ".") {
263 263
             $this->errorMsg("Folder name shouldn't begins with '.'");
264 264
         }
265
-        if (!@rename($dir, dirname($dir) . "/$newName")) {
265
+        if (!@rename($dir, dirname($dir)."/$newName")) {
266 266
             $this->errorMsg("Cannot rename the folder.");
267 267
         }
268 268
         $thumbDir = "$this->thumbsTypeDir/{$this->post['dir']}";
269 269
         if (is_dir($thumbDir)) {
270
-            @rename($thumbDir, dirname($thumbDir) . "/$newName");
270
+            @rename($thumbDir, dirname($thumbDir)."/$newName");
271 271
         }
272 272
         return json_encode(array('name' => $newName));
273 273
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         $dir = $this->postDir();
333 333
         if (!isset($this->post['dir']) ||
334 334
             !isset($this->post['file']) ||
335
-            strpos($this->post['file'], '../')!==false ||
335
+            strpos($this->post['file'], '../') !== false ||
336 336
             (false === ($file = "$dir/{$this->post['file']}")) ||
337 337
             !file_exists($file) || !is_readable($file)
338 338
         ) {
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
345 345
         header("Cache-Control: private", false);
346 346
         header("Content-Type: application/octet-stream");
347
-        header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $this->post['file']) . '"');
347
+        header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $this->post['file']).'"');
348 348
         header("Content-Transfer-Encoding:­ binary");
349
-        header("Content-Length: " . filesize($file));
349
+        header("Content-Length: ".filesize($file));
350 350
         readfile($file);
351 351
         die;
352 352
     }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
         if (!$this->config['access']['files']['rename'] ||
358 358
             !isset($this->post['dir']) ||
359 359
             !isset($this->post['file']) ||
360
-            strpos($this->post['file'], '../')!==false ||
360
+            strpos($this->post['file'], '../') !== false ||
361 361
             !isset($this->post['newName']) ||
362 362
             (false === ($file = "$dir/{$this->post['file']}")) ||
363 363
             !file_exists($file) || !is_readable($file) || !file::isWritable($file)
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
         $thumbFile = "$thumbDir/{$this->post['file']}";
401 401
 
402 402
         if (file_exists($thumbFile)) {
403
-            @rename($thumbFile, "$thumbDir/" . basename($newName));
403
+            @rename($thumbFile, "$thumbDir/".basename($newName));
404 404
         }
405 405
         return true;
406 406
     }
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         if (!$this->config['access']['files']['delete'] ||
412 412
             !isset($this->post['dir']) ||
413 413
             !isset($this->post['file']) ||
414
-            strpos($this->post['file'], '../')!==false ||
414
+            strpos($this->post['file'], '../') !== false ||
415 415
             (false === ($file = "$dir/{$this->post['file']}")) ||
416 416
             !file_exists($file) || !is_readable($file) || !file::isWritable($file) ||
417 417
             !@unlink($file)
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
             if (!file_exists($path)) {
457 457
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
458 458
             } elseif (substr($base, 0, 1) == ".") {
459
-                $error[] = "$base: " . $this->label("File name shouldn't begins with '.'");
459
+                $error[] = "$base: ".$this->label("File name shouldn't begins with '.'");
460 460
             } elseif (!$this->validateExtension($ext, $type)) {
461
-                $error[] = "$base: " . $this->label("Denied file extension.");
461
+                $error[] = "$base: ".$this->label("Denied file extension.");
462 462
             } elseif (file_exists("$dir/$base")) {
463
-                $error[] = "$base: " . $this->label("A file or folder with that name already exists.");
463
+                $error[] = "$base: ".$this->label("A file or folder with that name already exists.");
464 464
             } elseif (!is_readable($path) || !is_file($path)) {
465 465
                 $error[] = $this->label("Cannot read '{file}'.", $replace);
466 466
             } elseif (!@copy($path, "$dir/$base")) {
@@ -516,11 +516,11 @@  discard block
 block discarded – undo
516 516
             if (!file_exists($path)) {
517 517
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
518 518
             } elseif (substr($base, 0, 1) == ".") {
519
-                $error[] = "$base: " . $this->label("File name shouldn't begins with '.'");
519
+                $error[] = "$base: ".$this->label("File name shouldn't begins with '.'");
520 520
             } elseif (!$this->validateExtension($ext, $type)) {
521
-                $error[] = "$base: " . $this->label("Denied file extension.");
521
+                $error[] = "$base: ".$this->label("Denied file extension.");
522 522
             } elseif (file_exists("$dir/$base")) {
523
-                $error[] = "$base: " . $this->label("A file or folder with that name already exists.");
523
+                $error[] = "$base: ".$this->label("A file or folder with that name already exists.");
524 524
             } elseif (!is_readable($path) || !is_file($path)) {
525 525
                 $error[] = $this->label("Cannot read '{file}'.", $replace);
526 526
             } elseif (!file::isWritable($path) || !@rename($path, "$dir/$base")) {
@@ -593,15 +593,15 @@  discard block
 block discarded – undo
593 593
         if (!isset($this->post['dir']) || $this->config['denyZipDownload']) {
594 594
             $this->errorMsg("Unknown error.");
595 595
         }
596
-        $filename = basename($dir) . ".zip";
596
+        $filename = basename($dir).".zip";
597 597
         do {
598
-            $file = md5(time() . session_id());
598
+            $file = md5(time().session_id());
599 599
             $file = "{$this->config['uploadDir']}/$file.zip";
600 600
         } while (file_exists($file));
601 601
         new zipFolder($file, $dir);
602 602
         header("Content-Type: application/x-zip");
603
-        header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $filename) . '"');
604
-        header("Content-Length: " . filesize($file));
603
+        header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $filename).'"');
604
+        header("Content-Length: ".filesize($file));
605 605
         readfile($file);
606 606
         unlink($file);
607 607
         die;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
         }
633 633
 
634 634
         do {
635
-            $file = md5(time() . session_id());
635
+            $file = md5(time().session_id());
636 636
             $file = "{$this->config['uploadDir']}/$file.zip";
637 637
         } while (file_exists($file));
638 638
 
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
             $zip->close();
646 646
         }
647 647
         header("Content-Type: application/x-zip");
648
-        header('Content-Disposition: attachment; filename="selected_files_' . basename($file) . '"');
649
-        header("Content-Length: " . filesize($file));
648
+        header('Content-Disposition: attachment; filename="selected_files_'.basename($file).'"');
649
+        header("Content-Length: ".filesize($file));
650 650
         readfile($file);
651 651
         unlink($file);
652 652
         die;
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
             if ($type != $this->type) {
673 673
                 continue;
674 674
             }
675
-            $file = $this->config['uploadDir'] . "/$file";
675
+            $file = $this->config['uploadDir']."/$file";
676 676
             if (!is_file($file) || !is_readable($file)) {
677 677
                 continue;
678 678
             }
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
         }
681 681
 
682 682
         do {
683
-            $file = md5(time() . session_id());
683
+            $file = md5(time().session_id());
684 684
             $file = "{$this->config['uploadDir']}/$file.zip";
685 685
         } while (file_exists($file));
686 686
 
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
             $zip->close();
694 694
         }
695 695
         header("Content-Type: application/x-zip");
696
-        header('Content-Disposition: attachment; filename="clipboard_' . basename($file) . '"');
697
-        header("Content-Length: " . filesize($file));
696
+        header('Content-Disposition: attachment; filename="clipboard_'.basename($file).'"');
697
+        header("Content-Length: ".filesize($file));
698 698
         readfile($file);
699 699
         unlink($file);
700 700
         die;
@@ -746,23 +746,23 @@  discard block
 block discarded – undo
746 746
         } elseif (
747 747
             function_exists("curl_init") &&
748 748
             (false !== ($curl = @curl_init($url))) &&
749
-            (@ob_start()                 ||  (@curl_close($curl) && false)) &&
750
-            (@curl_exec($curl)           ||  (@curl_close($curl) && false)) &&
751
-            ((false !== ($ver = @ob_get_clean())) ||  (@curl_close($curl) && false)) &&
752
-            (@curl_close($curl)          ||  true) &&
749
+            (@ob_start() || (@curl_close($curl) && false)) &&
750
+            (@curl_exec($curl) || (@curl_close($curl) && false)) &&
751
+            ((false !== ($ver = @ob_get_clean())) || (@curl_close($curl) && false)) &&
752
+            (@curl_close($curl) || true) &&
753 753
             preg_match($pattern, $ver)
754 754
 
755 755
         // Socket extension
756 756
         ) {
757 757
         } elseif (function_exists('socket_create')) {
758 758
             $cmd =
759
-                "GET $path " . strtoupper($protocol) . "/1.1\r\n" .
760
-                "Host: $host\r\n" .
759
+                "GET $path ".strtoupper($protocol)."/1.1\r\n".
760
+                "Host: $host\r\n".
761 761
                 "Connection: Close\r\n\r\n";
762 762
 
763 763
             if ((false !== ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) &&
764
-                (false !==    @socket_connect($socket, $host, $port)) &&
765
-                (false !==    @socket_write($socket, $cmd, strlen($cmd))) &&
764
+                (false !== @socket_connect($socket, $host, $port)) &&
765
+                (false !== @socket_write($socket, $cmd, strlen($cmd))) &&
766 766
                 (false !== ($ver = @socket_read($socket, 2048))) &&
767 767
                 preg_match($responsePattern, $ver, $match)
768 768
             ) {
@@ -795,14 +795,14 @@  discard block
 block discarded – undo
795 795
         }
796 796
 
797 797
         $filename = $this->normalizeFilename($file['name']);
798
-        $target = "$dir/" . file::getInexistantFilename($filename, $dir);
798
+        $target = "$dir/".file::getInexistantFilename($filename, $dir);
799 799
 
800 800
         if (!@move_uploaded_file($file['tmp_name'], $target) &&
801 801
             !@rename($file['tmp_name'], $target) &&
802 802
             !@copy($file['tmp_name'], $target)
803 803
         ) {
804 804
             @unlink($file['tmp_name']);
805
-            return "{$file['name']}: " . $this->label("Cannot move uploaded file to target folder.");
805
+            return "{$file['name']}: ".$this->label("Cannot move uploaded file to target folder.");
806 806
         } elseif (function_exists('chmod')) {
807 807
             chmod($target, $this->config['filePerms']);
808 808
         }
@@ -814,10 +814,10 @@  discard block
 block discarded – undo
814 814
 
815 815
         $this->makeThumb($target);
816 816
 
817
-        return "/" . basename($target);
817
+        return "/".basename($target);
818 818
     }
819 819
 
820
-    protected function sendDefaultThumb($file=null)
820
+    protected function sendDefaultThumb($file = null)
821 821
     {
822 822
         if ($file !== null) {
823 823
             $ext = file::getExtension($file);
@@ -844,10 +844,10 @@  discard block
 block discarded – undo
844 844
         foreach ($files as $file) {
845 845
             $ext = file::getExtension($file);
846 846
             $smallThumb = false;
847
-            if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg' ))) {
847
+            if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg'))) {
848 848
                 $size = @getimagesize($file);
849 849
                 if (is_array($size) && count($size)) {
850
-                    $thumb_file = "$thumbDir/" . basename($file);
850
+                    $thumb_file = "$thumbDir/".basename($file);
851 851
                     if (!is_file($thumb_file) || filemtime($file) > filemtime($thumb_file)) {
852 852
                         $this->makeThumb($file);
853 853
                     }
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
             }
864 864
             $name = basename($file);
865 865
             $types = $this->config['types'];
866
-            $types = explode(' ', $types['images'] . ' ' . $types['image']);
866
+            $types = explode(' ', $types['images'].' '.$types['image']);
867 867
             if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) {
868 868
                 continue;
869 869
             }
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
         return $return;
890 890
     }
891 891
 
892
-    protected function getTree($dir, $index=0)
892
+    protected function getTree($dir, $index = 0)
893 893
     {
894 894
         $path = explode("/", $dir);
895 895
 
@@ -927,11 +927,11 @@  discard block
 block discarded – undo
927 927
         return $dirs;
928 928
     }
929 929
 
930
-    protected function postDir($existent=true)
930
+    protected function postDir($existent = true)
931 931
     {
932 932
         $dir = $this->typeDir;
933 933
         if (isset($this->post['dir'])) {
934
-            $dir .= "/" . $this->post['dir'];
934
+            $dir .= "/".$this->post['dir'];
935 935
         }
936 936
         if ($existent && (!is_dir($dir) || !is_readable($dir))) {
937 937
             $this->errorMsg("Inexistant or inaccessible folder.");
@@ -939,11 +939,11 @@  discard block
 block discarded – undo
939 939
         return $dir;
940 940
     }
941 941
 
942
-    protected function getDir($existent=true)
942
+    protected function getDir($existent = true)
943 943
     {
944 944
         $dir = $this->typeDir;
945 945
         if (isset($this->get['dir'])) {
946
-            $dir .= "/" . $this->get['dir'];
946
+            $dir .= "/".$this->get['dir'];
947 947
         }
948 948
         if ($existent && (!is_dir($dir) || !is_readable($dir))) {
949 949
             $this->errorMsg("Inexistant or inaccessible folder.");
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
         return $return;
970 970
     }
971 971
 
972
-    protected function getDirInfo($dir, $removable=false)
972
+    protected function getDirInfo($dir, $removable = false)
973 973
     {
974 974
         if ((substr(basename($dir), 0, 1) == ".") || !is_dir($dir) || !is_readable($dir)) {
975 975
             return false;
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
         return $info;
1003 1003
     }
1004 1004
 
1005
-    protected function output($data=null, $template=null)
1005
+    protected function output($data = null, $template = null)
1006 1006
     {
1007 1007
         if (!is_array($data)) {
1008 1008
             $data = array();
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
         return "";
1029 1029
     }
1030 1030
 
1031
-    protected function errorMsg($message, array $data=null)
1031
+    protected function errorMsg($message, array $data = null)
1032 1032
     {
1033 1033
         if (in_array($this->action, array("thumb", "upload", "download", "downloadDir"))) {
1034 1034
             die($this->label($message, $data));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -756,7 +756,7 @@
 block discarded – undo
756 756
         ) {
757 757
         } elseif (function_exists('socket_create')) {
758 758
             $cmd =
759
-                "GET $path " . strtoupper($protocol) . "/1.1\r\n" .
759
+                "get $path " . strtoupper($protocol) . "/1.1\r\n" .
760 760
                 "Host: $host\r\n" .
761 761
                 "Connection: Close\r\n\r\n";
762 762
 
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/uploader.php 3 patches
Doc Comments   +18 added lines patch added patch discarded remove patch
@@ -427,6 +427,9 @@  discard block
 block discarded – undo
427 427
     }
428 428
 
429 429
 
430
+    /**
431
+     * @return string
432
+     */
430 433
     protected function normalizeFilename($filename)
431 434
     {
432 435
         if ($this->getTransaliasSettings()) {
@@ -437,6 +440,9 @@  discard block
 block discarded – undo
437 440
         return $filename;
438 441
     }
439 442
 
443
+    /**
444
+     * @param string $dirname
445
+     */
440 446
     protected function normalizeDirname($dirname)
441 447
     {
442 448
         return $this->modx->stripAlias($dirname);
@@ -566,6 +572,9 @@  discard block
 block discarded – undo
566 572
         return (is_dir($path) && is_readable($path)) ? $return : false;
567 573
     }
568 574
 
575
+    /**
576
+     * @param string $ext
577
+     */
569 578
     protected function validateExtension($ext, $type)
570 579
     {
571 580
         $ext = trim(strtolower($ext));
@@ -595,12 +604,18 @@  discard block
 block discarded – undo
595 604
         return in_array($ext, $exts);
596 605
     }
597 606
 
607
+    /**
608
+     * @return string
609
+     */
598 610
     protected function getTypeFromPath($path)
599 611
     {
600 612
         return preg_match('/^([^\/]*)\/.*$/', $path, $patt)
601 613
             ? $patt[1] : $path;
602 614
     }
603 615
 
616
+    /**
617
+     * @param string $path
618
+     */
604 619
     protected function removeTypeFromPath($path)
605 620
     {
606 621
         return preg_match('/^[^\/]*\/(.*)$/', $path, $patt)
@@ -811,6 +826,9 @@  discard block
 block discarded – undo
811 826
         die;
812 827
     }
813 828
 
829
+    /**
830
+     * @param string $url
831
+     */
814 832
     protected function callBack($url, $message="")
815 833
     {
816 834
         $message = text::jsValue($message);
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Uploader class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Uploader class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class uploader
16 16
 {
@@ -19,92 +19,92 @@  discard block
 block discarded – undo
19 19
     const VERSION = "2.54";
20 20
 
21 21
     /** Config session-overrided settings
22
-      * @var array */
22
+     * @var array */
23 23
     protected $config = array();
24 24
 
25 25
     /** Default image driver
26
-      * @var string */
26
+     * @var string */
27 27
     protected $imageDriver = "gd";
28 28
 
29 29
     /** Opener applocation properties
30
-      *   $opener['name']                 Got from $_GET['opener'];
31
-      *   $opener['CKEditor']['funcNum']  CKEditor function number (got from $_GET)
32
-      *   $opener['TinyMCE']              Boolean
33
-      * @var array */
30
+     *   $opener['name']                 Got from $_GET['opener'];
31
+     *   $opener['CKEditor']['funcNum']  CKEditor function number (got from $_GET)
32
+     *   $opener['TinyMCE']              Boolean
33
+     * @var array */
34 34
     protected $opener = array();
35 35
 
36 36
     /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant
37
-      * @var string */
37
+     * @var string */
38 38
     protected $type;
39 39
 
40 40
     /** Helper property. Local filesystem path to the Type Directory
41
-      * Equivalent: $config['uploadDir'] . "/" . $type
42
-      * @var string */
41
+     * Equivalent: $config['uploadDir'] . "/" . $type
42
+     * @var string */
43 43
     protected $typeDir;
44 44
 
45 45
     /** Helper property. Web URL to the Type Directory
46
-      * Equivalent: $config['uploadURL'] . "/" . $type
47
-      * @var string */
46
+     * Equivalent: $config['uploadURL'] . "/" . $type
47
+     * @var string */
48 48
     protected $typeURL;
49 49
 
50 50
     /** Linked to $config['types']
51
-      * @var array */
51
+     * @var array */
52 52
     protected $types = array();
53 53
 
54 54
     /** Settings which can override default settings if exists as keys in $config['types'][$type] array
55
-      * @var array */
55
+     * @var array */
56 56
     protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark');
57 57
 
58 58
     /** Got from language file
59
-      * @var string */
59
+     * @var string */
60 60
     protected $charset;
61 61
 
62 62
     /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property
63
-      * @var string */
63
+     * @var string */
64 64
     protected $lang = 'en';
65 65
 
66 66
     /** Possible language $_GET keys
67
-      * @var array */
67
+     * @var array */
68 68
     protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code');
69 69
 
70 70
     /** Uploaded file(s) info. Linked to first $_FILES element
71
-      * @var array */
71
+     * @var array */
72 72
     protected $file;
73 73
 
74 74
     /** Next three properties are got from the current language file
75
-      * @var string */
75
+     * @var string */
76 76
     protected $dateTimeFull;   // Currently not used
77 77
     protected $dateTimeMid;    // Currently not used
78 78
     protected $dateTimeSmall;
79 79
 
80 80
     /** Contain Specified language labels
81
-      * @var array */
81
+     * @var array */
82 82
     protected $labels = array();
83 83
 
84 84
     /** Contain unprocessed $_GET array. Please use this instead of $_GET
85
-      * @var array */
85
+     * @var array */
86 86
     protected $get;
87 87
 
88 88
     /** Contain unprocessed $_POST array. Please use this instead of $_POST
89
-      * @var array */
89
+     * @var array */
90 90
     protected $post;
91 91
 
92 92
     /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE
93
-      * @var array */
93
+     * @var array */
94 94
     protected $cookie;
95 95
 
96 96
     /** Session array. Please use this property instead of $_SESSION
97
-      * @var array */
97
+     * @var array */
98 98
     protected $session;
99 99
 
100 100
     /** CMS integration attribute (got from $_GET['cms'])
101
-      * @var string */
101
+     * @var string */
102 102
     protected $cms = "";
103 103
 
104 104
     protected $modx = null;
105 105
     /** Magic method which allows read-only access to protected or private class properties
106
-      * @param string $property
107
-      * @return mixed */
106
+     * @param string $property
107
+     * @return mixed */
108 108
     public function __get($property)
109 109
     {
110 110
         return property_exists($this, $property) ? $this->$property : null;
Please login to merge, or discard this patch.
Spacing   +26 added lines, -27 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 
74 74
     /** Next three properties are got from the current language file
75 75
       * @var string */
76
-    protected $dateTimeFull;   // Currently not used
77
-    protected $dateTimeMid;    // Currently not used
76
+    protected $dateTimeFull; // Currently not used
77
+    protected $dateTimeMid; // Currently not used
78 78
     protected $dateTimeSmall;
79 79
 
80 80
     /** Contain Specified language labels
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         // COOKIES INIT
229 229
         $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
230
-        $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/';
230
+        $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/';
231 231
         if (preg_match($ip, $_SERVER['HTTP_HOST']) ||
232 232
             preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST'])
233 233
         ) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         ) {
248 248
             list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
249 249
             $path = path::normalize($path);
250
-            $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path";
250
+            $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path";
251 251
             $this->config['uploadDir'] = strlen($this->config['uploadDir'])
252 252
                 ? path::normalize($this->config['uploadDir'])
253 253
                 : path::url2fullPath("/$path");
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         foreach ($this->langInputNames as $key) {
294 294
             if (isset($this->get[$key]) &&
295 295
                 preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) &&
296
-                file_exists("lang/" . strtolower($this->get[$key]) . ".php")
296
+                file_exists("lang/".strtolower($this->get[$key]).".php")
297 297
             ) {
298 298
                 $this->lang = $this->get[$key];
299 299
                 break;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                 }
365 365
 
366 366
                 $filename = $this->normalizeFilename($file['name']);
367
-                $target = file::getInexistantFilename($dir . $filename);
367
+                $target = file::getInexistantFilename($dir.$filename);
368 368
 
369 369
                 if (!@move_uploaded_file($file['tmp_name'], $target) &&
370 370
                     !@rename($file['tmp_name'], $target) &&
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
                     if (isset($udir)) {
381 381
                         $url .= "/$udir";
382 382
                     }
383
-                    $url .= "/" . basename($target);
383
+                    $url .= "/".basename($target);
384 384
                     if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) {
385 385
                         list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
386
-                        $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/";
387
-                        $url = $base . path::urlPathEncode($path);
386
+                        $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/";
387
+                        $url = $base.path::urlPathEncode($path);
388 388
                     } else {
389 389
                         $url = path::urlPathEncode($url);
390 390
                     }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 
413 413
         // Cleaning uploaded filename?
414 414
         $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
415
-        if ($modx->db->getValue($setting)>0) {
415
+        if ($modx->db->getValue($setting) > 0) {
416 416
             // Transalias plugin active?
417 417
             $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
418 418
             if ($properties = $modx->db->getValue($res)) {
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         if ($this->getTransaliasSettings()) {
433 433
             $format = strrchr($filename, ".");
434 434
             $filename = str_replace($format, "", $filename);
435
-            $filename = $this->modx->stripAlias($filename) . $format;
435
+            $filename = $this->modx->stripAlias($filename).$format;
436 436
         }
437 437
         return $filename;
438 438
     }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
         return $this->modx->stripAlias($dirname);
443 443
     }
444 444
 
445
-    protected function checkUploadedFile(array $aFile=null)
445
+    protected function checkUploadedFile(array $aFile = null)
446 446
     {
447 447
         $config = &$this->config;
448 448
         $file = ($aFile === null) ? $this->file : $aFile;
@@ -484,8 +484,7 @@  discard block
 block discarded – undo
484 484
                 ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ?
485 485
                     $this->label("Missing a temporary folder.") : (
486 486
                 ($file['error'] == UPLOAD_ERR_CANT_WRITE) ?
487
-                    $this->label("Failed to write file.") :
488
-                    $this->label("Unknown error.")
487
+                    $this->label("Failed to write file.") : $this->label("Unknown error.")
489 488
             )))));
490 489
         }
491 490
 
@@ -527,15 +526,15 @@  discard block
 block discarded – undo
527 526
 
528 527
 
529 528
         // CHECK FOR MODX MAX FILE SIZE
530
-        $actualfilesize=filesize($file['tmp_name']);
529
+        $actualfilesize = filesize($file['tmp_name']);
531 530
         if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) {
532
-            return $this->label("File is too big: " . $actualfilesize . " Bytes. (max " . $this->config['maxfilesize'] . " Bytes)");
531
+            return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
533 532
         }
534 533
 
535 534
         return true;
536 535
     }
537 536
 
538
-    protected function checkInputDir($dir, $inclType=true, $existing=true)
537
+    protected function checkInputDir($dir, $inclType = true, $existing = true)
539 538
     {
540 539
         $dir = path::normalize($dir);
541 540
         if (substr($dir, 0, 1) == "/") {
@@ -607,7 +606,7 @@  discard block
 block discarded – undo
607 606
             ? $patt[1] : "";
608 607
     }
609 608
 
610
-    protected function imageResize($image, $file=null)
609
+    protected function imageResize($image, $file = null)
611 610
     {
612 611
         if (!($image instanceof image)) {
613 612
             $img = image::factory($this->imageDriver, $image);
@@ -702,7 +701,7 @@  discard block
 block discarded – undo
702 701
             $img->watermark($this->config['watermark']['file'], $left, $top);
703 702
         }
704 703
 
705
-        $options = array( 'file' => $file );
704
+        $options = array('file' => $file);
706 705
 
707 706
         $type = exif_imagetype($file);
708 707
 
@@ -714,11 +713,11 @@  discard block
 block discarded – undo
714 713
                 return $img->output('png', $options);
715 714
 
716 715
             default:
717
-                return $img->output('jpeg', array_merge($options, array( 'quality' => $this->config['jpegQuality'] )));
716
+                return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality'])));
718 717
         }
719 718
     }
720 719
 
721
-    protected function makeThumb($file, $overwrite=true)
720
+    protected function makeThumb($file, $overwrite = true)
722 721
     {
723 722
         $img = image::factory($this->imageDriver, $file);
724 723
 
@@ -728,7 +727,7 @@  discard block
 block discarded – undo
728 727
         }
729 728
 
730 729
         $thumb = substr($file, strlen($this->config['uploadDir']));
731
-        $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb;
730
+        $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb;
732 731
         $thumb = path::normalize($thumb);
733 732
         $thumbDir = dirname($thumb);
734 733
         if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) {
@@ -757,8 +756,8 @@  discard block
 block discarded – undo
757 756
         if ($this->imageDriver == 'gd') {
758 757
             $width  = imagesx($img->image);
759 758
             $height = imagesy($img->image);
760
-            $back   = image::factory($this->imageDriver, array( $width, $height ));
761
-            $tile   = image::factory($this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png');
759
+            $back   = image::factory($this->imageDriver, array($width, $height));
760
+            $tile   = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png');
762 761
 
763 762
             imagesettile($back->image, $tile->image);
764 763
             imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED);
@@ -790,7 +789,7 @@  discard block
 block discarded – undo
790 789
         $this->labels = $lang;
791 790
     }
792 791
 
793
-    protected function label($string, array $data=null)
792
+    protected function label($string, array $data = null)
794 793
     {
795 794
         $return = isset($this->labels[$string]) ? $this->labels[$string] : $string;
796 795
         if (is_array($data)) {
@@ -801,7 +800,7 @@  discard block
 block discarded – undo
801 800
         return $return;
802 801
     }
803 802
 
804
-    protected function backMsg($message, array $data=null)
803
+    protected function backMsg($message, array $data = null)
805 804
     {
806 805
         $message = $this->label($message, $data);
807 806
         if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) {
@@ -811,7 +810,7 @@  discard block
 block discarded – undo
811 810
         die;
812 811
     }
813 812
 
814
-    protected function callBack($url, $message="")
813
+    protected function callBack($url, $message = "")
815 814
     {
816 815
         $message = text::jsValue($message);
817 816
         $CKfuncNum = isset($this->opener['CKEditor']['funcNum'])
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_fastImage.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -177,6 +177,9 @@  discard block
 block discarded – undo
177 177
     }
178 178
 
179 179
 
180
+    /**
181
+     * @param integer $n
182
+     */
180 183
     private function getChars($n)
181 184
     {
182 185
         $response = null;
@@ -214,6 +217,9 @@  discard block
 block discarded – undo
214 217
     }
215 218
 
216 219
 
220
+    /**
221
+     * @param false|string $str
222
+     */
217 223
     private function readInt($str)
218 224
     {
219 225
         $size = unpack("C*", $str);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
                     return $this->type = 'bmp';
68 68
                 case "GI":
69 69
                     return $this->type = 'gif';
70
-                case chr(0xFF) . chr(0xd8):
70
+                case chr(0xFF).chr(0xd8):
71 71
                     return $this->type = 'jpeg';
72
-                case chr(0x89) . 'P':
72
+                case chr(0x89).'P':
73 73
                     return $this->type = 'png';
74 74
                 default:
75 75
                     return false;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $response = null;
183 183
 
184 184
         // do we need more data?
185
-        if ($this->strpos + $n -1 >= strlen($this->str)) {
185
+        if ($this->strpos + $n - 1 >= strlen($this->str)) {
186 186
             $end = ($this->strpos + $n);
187 187
 
188 188
             while (strlen($this->str) < $end && $response !== false) {
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_gd.php 4 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
       * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes.
180 180
       * The other dimension (height or width) will be calculated autamaticaly
181 181
       * @param integer $bigger_size
182
-      * @return array */
182
+      * @return integer[] */
183 183
 
184 184
     public function get_prop_size($bigger_size)
185 185
     {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
       * no samo po edno (x ili y) izmerenie
278 278
       * @param integer $width
279 279
       * @param integer $height
280
-      * @return bool */
280
+      * @return gd */
281 281
 
282 282
     public function resize_overflow($width, $height)
283 283
     {
@@ -437,6 +437,12 @@  discard block
 block discarded – undo
437 437
         }
438 438
     }
439 439
 
440
+    /**
441
+     * @param integer $x1
442
+     * @param integer $y1
443
+     * @param integer $x2
444
+     * @param integer $y2
445
+     */
440 446
     public function imagefilledrectangle($x1, $y1, $x2, $y2, $color)
441 447
     {
442 448
         $color = $this->gd_color($color);
Please login to merge, or discard this patch.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc GD extension class
6
-  *   @package KCFinder
7
-  *   @version 2.51
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010, 2011 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc GD extension class
6
+ *   @package KCFinder
7
+ *   @version 2.51
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010, 2011 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class gd
16 16
 {
17 17
 
18
-  /** GD resource
19
-    * @var resource */
18
+    /** GD resource
19
+     * @var resource */
20 20
     protected $image;
21 21
 
22 22
     /** Image width
23
-      * @var integer */
23
+     * @var integer */
24 24
     protected $width;
25 25
 
26 26
     /** Image height
27
-      * @var integer */
27
+     * @var integer */
28 28
     protected $height;
29 29
 
30 30
     /** Init error
31
-      * @var bool */
31
+     * @var bool */
32 32
     public $init_error = false;
33 33
 
34 34
     /** Last builded image type constant (IMAGETYPE_XXX)
35
-      * @var integer */
35
+     * @var integer */
36 36
     public $type;
37 37
 
38 38
     /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height.
39
-      * Returns FALSE on failure. The only one parameter $image can be an instance of this class,
40
-      * a GD resource, an array(width, height) or path to image file.
41
-      * @param mixed $image
42
-      * @return array */
39
+     * Returns FALSE on failure. The only one parameter $image can be an instance of this class,
40
+     * a GD resource, an array(width, height) or path to image file.
41
+     * @param mixed $image
42
+     * @return array */
43 43
 
44 44
     protected function build_image($image)
45 45
     {
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
     }
89 89
 
90 90
     /** Parameter $image can be:
91
-      *   1. An instance of this class (copy instance).
92
-      *   2. A GD resource.
93
-      *   3. An array with two elements. First - width, second - height. Create a blank image.
94
-      *   4. A filename string. Get image form file.
95
-      * The non-required parameter $bigger_size is the bigger dimension (width or height) the image
96
-      * will be resized to. The other dimension (height or width) will be calculated autamaticaly
97
-      * @param mixed $image
98
-      * @param integer $bigger_size
99
-      * @return gd */
91
+     *   1. An instance of this class (copy instance).
92
+     *   2. A GD resource.
93
+     *   3. An array with two elements. First - width, second - height. Create a blank image.
94
+     *   4. A filename string. Get image form file.
95
+     * The non-required parameter $bigger_size is the bigger dimension (width or height) the image
96
+     * will be resized to. The other dimension (height or width) will be calculated autamaticaly
97
+     * @param mixed $image
98
+     * @param integer $bigger_size
99
+     * @return gd */
100 100
 
101 101
     public function __construct($image, $bigger_size=null)
102 102
     {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     /** Returns the GD resource
129
-      * @return resource */
129
+     * @return resource */
130 130
 
131 131
     public function get_image()
132 132
     {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 
136 136
     /** Returns the image width
137
-      * @return integer */
137
+     * @return integer */
138 138
 
139 139
     public function get_width()
140 140
     {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     }
143 143
 
144 144
     /** Returns the image height
145
-      * @return integer */
145
+     * @return integer */
146 146
 
147 147
     public function get_height()
148 148
     {
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
     }
151 151
 
152 152
     /** Returns calculated proportional width from the given height
153
-      * @param integer $resized_height
154
-      * @return integer */
153
+     * @param integer $resized_height
154
+     * @return integer */
155 155
 
156 156
     public function get_prop_width($resized_height)
157 157
     {
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
     }
164 164
 
165 165
     /** Returns calculated proportional height from the given width
166
-      * @param integer $resized_width
167
-      * @return integer */
166
+     * @param integer $resized_width
167
+     * @return integer */
168 168
 
169 169
     public function get_prop_height($resized_width)
170 170
     {
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
     /** Returns an array with calculated proportional width & height.
179
-      * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes.
180
-      * The other dimension (height or width) will be calculated autamaticaly
181
-      * @param integer $bigger_size
182
-      * @return array */
179
+     * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes.
180
+     * The other dimension (height or width) will be calculated autamaticaly
181
+     * @param integer $bigger_size
182
+     * @return array */
183 183
 
184 184
     public function get_prop_size($bigger_size)
185 185
     {
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
     }
198 198
 
199 199
     /** Resize image. Returns TRUE on success or FALSE on failure
200
-      * @param integer $width
201
-      * @param integer $height
202
-      * @return bool */
200
+     * @param integer $width
201
+     * @param integer $height
202
+     * @return bool */
203 203
 
204 204
     public function resize($width, $height)
205 205
     {
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
     }
220 220
 
221 221
     /** Resize the given image source (GD, gd object or image file path) to fit in the own image.
222
-      * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure
223
-      * @param mixed $src
224
-      * @return bool */
222
+     * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure
223
+     * @param mixed $src
224
+     * @return bool */
225 225
 
226 226
     public function resize_crop($src)
227 227
     {
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
     }
250 250
 
251 251
     /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure
252
-      * @param integer $width
253
-      * @param integer $height
254
-      * @return bool */
252
+     * @param integer $width
253
+     * @param integer $height
254
+     * @return bool */
255 255
 
256 256
     public function resize_fit($width, $height)
257 257
     {
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
     }
274 274
 
275 275
     /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height.
276
-      * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik,
277
-      * no samo po edno (x ili y) izmerenie
278
-      * @param integer $width
279
-      * @param integer $height
280
-      * @return bool */
276
+     * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik,
277
+     * no samo po edno (x ili y) izmerenie
278
+     * @param integer $width
279
+     * @param integer $height
280
+     * @return bool */
281 281
 
282 282
     public function resize_overflow($width, $height)
283 283
     {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
             $image = imagecreatetruecolor($width, $height);
57 57
         } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
58 58
             $image =
59
-                ($type == IMAGETYPE_GIF)      ? @imagecreatefromgif($image)  : (
60
-                ($type == IMAGETYPE_WBMP)     ? @imagecreatefromwbmp($image) : (
61
-                ($type == IMAGETYPE_JPEG)     ? @imagecreatefromjpeg($image) : (
59
+                ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : (
60
+                ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : (
61
+                ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : (
62 62
                 ($type == IMAGETYPE_JPEG2000) ? @imagecreatefromjpeg($image) : (
63
-                ($type == IMAGETYPE_PNG)      ? @imagecreatefrompng($image)  : (
64
-                ($type == IMAGETYPE_XBM)      ? @imagecreatefromxbm($image)  : false
63
+                ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : (
64
+                ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false
65 65
             )))));
66 66
 
67 67
             if ($type == IMAGETYPE_PNG) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
       * @param integer $bigger_size
99 99
       * @return gd */
100 100
 
101
-    public function __construct($image, $bigger_size=null)
101
+    public function __construct($image, $bigger_size = null)
102 102
     {
103 103
         $this->image = $this->width = $this->height = null;
104 104
 
@@ -347,11 +347,11 @@  discard block
 block discarded – undo
347 347
 
348 348
     public function imagecopy(
349 349
         $src,
350
-        $dst_x=0, $dst_y=0,
351
-        $src_x=0, $src_y=0,
352
-        $dst_w=null, $dst_h=null,
353
-        $src_w=null, $src_h=null
354
-    ) {
350
+        $dst_x = 0, $dst_y = 0,
351
+        $src_x = 0, $src_y = 0,
352
+        $dst_w = null, $dst_h = null,
353
+        $src_w = null, $src_h = null
354
+    ){
355 355
         $image_details = $this->build_image($src);
356 356
 
357 357
         if ($image_details !== false) {
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
 
378 378
     public function imagecopyresampled(
379 379
         $src,
380
-        $dst_x=0, $dst_y=0,
381
-        $src_x=0, $src_y=0,
382
-        $dst_w=null, $dst_h=null,
383
-        $src_w=null, $src_h=null
384
-    ) {
380
+        $dst_x = 0, $dst_y = 0,
381
+        $src_x = 0, $src_y = 0,
382
+        $dst_w = null, $dst_h = null,
383
+        $src_w = null, $src_h = null
384
+    ){
385 385
         $image_details = $this->build_image($src);
386 386
 
387 387
         if ($image_details !== false) {
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
                 imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex);
419 419
                 imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
420 420
                 imagecolortransparent($this->image, $transindex);
421
-                for ($y=0; $y<$dst_h; ++$y) {
422
-                    for ($x=0; $x<$dst_w; ++$x) {
423
-                        if (((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) {
421
+                for ($y = 0; $y < $dst_h; ++$y) {
422
+                    for ($x = 0; $x < $dst_w; ++$x) {
423
+                        if (((imagecolorat($this->image, $x, $y) >> 24) & 0x7F) >= 100) {
424 424
                             imagesetpixel($this->image, $x, $y, $transindex);
425 425
                         }
426 426
                     }
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
         return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color);
447 447
     }
448 448
 
449
-    public function imagepng($filename=null, $quality=null, $filters=null)
449
+    public function imagepng($filename = null, $quality = null, $filters = null)
450 450
     {
451 451
         if (is_null($filename) && !headers_sent()) {
452 452
             header("Content-Type: image/png");
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         return imagepng($this->image, $filename, $quality, $filters);
456 456
     }
457 457
 
458
-    public function imagejpeg($filename=null, $quality=75)
458
+    public function imagejpeg($filename = null, $quality = 75)
459 459
     {
460 460
         if (is_null($filename) && !headers_sent()) {
461 461
             header("Content-Type: image/jpeg");
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         return imagejpeg($this->image, $filename, $quality);
464 464
     }
465 465
 
466
-    public function imagegif($filename=null)
466
+    public function imagegif($filename = null)
467 467
     {
468 468
         if (is_null($filename) && !headers_sent()) {
469 469
             header("Content-Type: image/gif");
Please login to merge, or discard this patch.
Braces   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class gd
16
-{
15
+class gd
16
+{
17 17
 
18 18
   /** GD resource
19 19
     * @var resource */
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
       * @param mixed $image
42 42
       * @return array */
43 43
 
44
-    protected function build_image($image)
45
-    {
46
-        if ($image instanceof gd) {
44
+    protected function build_image($image)
45
+    {
46
+        if ($image instanceof gd) {
47 47
             $width = $image->get_width();
48 48
             $height = $image->get_height();
49 49
             $image = $image->get_image();
50
-        } elseif (is_resource($image) && (get_resource_type($image) == "gd")) {
50
+        } elseif (is_resource($image) && (get_resource_type($image) == "gd")) {
51 51
             $width = @imagesx($image);
52 52
             $height = @imagesy($image);
53
-        } elseif (is_array($image)) {
53
+        } elseif (is_array($image)) {
54 54
             list($key, $width) = each($image);
55 55
             list($key, $height) = each($image);
56 56
             $image = imagecreatetruecolor($width, $height);
57
-        } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
57
+        } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
58 58
             $image =
59 59
                 ($type == IMAGETYPE_GIF)      ? @imagecreatefromgif($image)  : (
60 60
                 ($type == IMAGETYPE_WBMP)     ? @imagecreatefromwbmp($image) : (
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 ($type == IMAGETYPE_XBM)      ? @imagecreatefromxbm($image)  : false
65 65
             )))));
66 66
 
67
-            if ($type == IMAGETYPE_PNG) {
67
+            if ($type == IMAGETYPE_PNG) {
68 68
                 imagealphablending($image, false);
69 69
             }
70 70
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             ? array($image, $width, $height)
81 81
             : false;
82 82
 
83
-        if (($return !== false) && isset($type)) {
83
+        if (($return !== false) && isset($type)) {
84 84
             $this->type = $type;
85 85
         }
86 86
 
@@ -98,22 +98,22 @@  discard block
 block discarded – undo
98 98
       * @param integer $bigger_size
99 99
       * @return gd */
100 100
 
101
-    public function __construct($image, $bigger_size=null)
102
-    {
101
+    public function __construct($image, $bigger_size=null)
102
+    {
103 103
         $this->image = $this->width = $this->height = null;
104 104
 
105 105
         $image_details = $this->build_image($image);
106 106
 
107
-        if ($image_details !== false) {
107
+        if ($image_details !== false) {
108 108
             list($this->image, $this->width, $this->height) = $image_details;
109
-        } else {
109
+        } else {
110 110
             $this->init_error = true;
111 111
         }
112 112
 
113 113
         if (!is_null($this->image) &&
114 114
             !is_null($bigger_size) &&
115 115
             (preg_match('/^[1-9][0-9]*$/', $bigger_size) !== false)
116
-        ) {
116
+        ) {
117 117
             $image = $this->image;
118 118
             list($width, $height) = $this->get_prop_size($bigger_size);
119 119
             $this->image = imagecreatetruecolor($width, $height);
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
     /** Returns the GD resource
129 129
       * @return resource */
130 130
 
131
-    public function get_image()
132
-    {
131
+    public function get_image()
132
+    {
133 133
         return $this->image;
134 134
     }
135 135
 
136 136
     /** Returns the image width
137 137
       * @return integer */
138 138
 
139
-    public function get_width()
140
-    {
139
+    public function get_width()
140
+    {
141 141
         return $this->width;
142 142
     }
143 143
 
144 144
     /** Returns the image height
145 145
       * @return integer */
146 146
 
147
-    public function get_height()
148
-    {
147
+    public function get_height()
148
+    {
149 149
         return $this->height;
150 150
     }
151 151
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
       * @param integer $resized_height
154 154
       * @return integer */
155 155
 
156
-    public function get_prop_width($resized_height)
157
-    {
156
+    public function get_prop_width($resized_height)
157
+    {
158 158
         $width = intval(($this->width * $resized_height) / $this->height);
159
-        if (!$width) {
159
+        if (!$width) {
160 160
             $width = 1;
161 161
         }
162 162
         return $width;
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
       * @param integer $resized_width
167 167
       * @return integer */
168 168
 
169
-    public function get_prop_height($resized_width)
170
-    {
169
+    public function get_prop_height($resized_width)
170
+    {
171 171
         $height = intval(($this->height * $resized_width) / $this->width);
172
-        if (!$height) {
172
+        if (!$height) {
173 173
             $height = 1;
174 174
         }
175 175
         return $height;
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
       * @param integer $bigger_size
182 182
       * @return array */
183 183
 
184
-    public function get_prop_size($bigger_size)
185
-    {
186
-        if ($this->width > $this->height) {
184
+    public function get_prop_size($bigger_size)
185
+    {
186
+        if ($this->width > $this->height) {
187 187
             $width = $bigger_size;
188 188
             $height = $this->get_prop_height($width);
189
-        } elseif ($this->height > $this->width) {
189
+        } elseif ($this->height > $this->width) {
190 190
             $height = $bigger_size;
191 191
             $width = $this->get_prop_width($height);
192
-        } else {
192
+        } else {
193 193
             $width = $height = $bigger_size;
194 194
         }
195 195
 
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
       * @param integer $height
202 202
       * @return bool */
203 203
 
204
-    public function resize($width, $height)
205
-    {
206
-        if (!$width) {
204
+    public function resize($width, $height)
205
+    {
206
+        if (!$width) {
207 207
             $width = 1;
208 208
         }
209
-        if (!$height) {
209
+        if (!$height) {
210 210
             $height = 1;
211 211
         }
212 212
         return (
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
       * @param mixed $src
224 224
       * @return bool */
225 225
 
226
-    public function resize_crop($src)
227
-    {
226
+    public function resize_crop($src)
227
+    {
228 228
         $image_details = $this->build_image($src);
229 229
 
230
-        if ($image_details !== false) {
230
+        if ($image_details !== false) {
231 231
             list($src, $src_width, $src_height) = $image_details;
232 232
 
233
-            if (($src_width / $src_height) > ($this->width / $this->height)) {
233
+            if (($src_width / $src_height) > ($this->width / $this->height)) {
234 234
                 $src_w = $this->get_prop_width($src_height);
235 235
                 $src_h = $src_height;
236 236
                 $src_x = intval(($src_width - $src_w) / 2);
237 237
                 $src_y = 0;
238
-            } else {
238
+            } else {
239 239
                 $src_w = $src_width;
240 240
                 $src_h = $this->get_prop_height($src_width);
241 241
                 $src_x = 0;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             }
244 244
 
245 245
             return imagecopyresampled($this->image, $src, 0, 0, $src_x, $src_y, $this->width, $this->height, $src_w, $src_h);
246
-        } else {
246
+        } else {
247 247
             return false;
248 248
         }
249 249
     }
@@ -253,20 +253,20 @@  discard block
 block discarded – undo
253 253
       * @param integer $height
254 254
       * @return bool */
255 255
 
256
-    public function resize_fit($width, $height)
257
-    {
258
-        if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) {
256
+    public function resize_fit($width, $height)
257
+    {
258
+        if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) {
259 259
             return true;
260 260
         }
261
-        if (!$width || (($height / $width) < ($this->height / $this->width))) {
261
+        if (!$width || (($height / $width) < ($this->height / $this->width))) {
262 262
             $width = intval(($this->width * $height) / $this->height);
263
-        } elseif (!$height || (($width / $height) < ($this->width / $this->height))) {
263
+        } elseif (!$height || (($width / $height) < ($this->width / $this->height))) {
264 264
             $height = intval(($this->height * $width) / $this->width);
265 265
         }
266
-        if (!$width) {
266
+        if (!$width) {
267 267
             $width = 1;
268 268
         }
269
-        if (!$height) {
269
+        if (!$height) {
270 270
             $height = 1;
271 271
         }
272 272
         return $this->resize($width, $height);
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
       * @param integer $height
280 280
       * @return bool */
281 281
 
282
-    public function resize_overflow($width, $height)
283
-    {
282
+    public function resize_overflow($width, $height)
283
+    {
284 284
         $big = (($this->width / $this->height) > ($width / $height))
285 285
             ? ($this->width * $height) / $this->height
286 286
             : ($this->height * $width) / $this->width;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
         $return = ($img = new gd($this->image, $big));
290 290
 
291
-        if ($return) {
291
+        if ($return) {
292 292
             $this->image = $img->get_image();
293 293
             $this->width = $img->get_width();
294 294
             $this->height = $img->get_height();
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
         return $return;
298 298
     }
299 299
 
300
-    public function gd_color()
301
-    {
300
+    public function gd_color()
301
+    {
302 302
         $args = func_get_args();
303 303
 
304 304
         $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i';
@@ -306,20 +306,20 @@  discard block
 block discarded – undo
306 306
         $expr_hex2 = '/^\#?([0-9a-f])([0-9a-f])([0-9a-f])$/i';
307 307
         $expr_byte = '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/';
308 308
 
309
-        if (!isset($args[0])) {
309
+        if (!isset($args[0])) {
310 310
             return false;
311 311
         }
312 312
 
313
-        if (count($args[0]) == 3) {
313
+        if (count($args[0]) == 3) {
314 314
             list($r, $g, $b) = $args[0];
315
-        } elseif (preg_match($expr_rgb, $args[0])) {
315
+        } elseif (preg_match($expr_rgb, $args[0])) {
316 316
             list($r, $g, $b) = explode(" ", preg_replace($expr_rgb, "$1 $2 $3", $args[0]));
317
-        } elseif (preg_match($expr_hex1, $args[0])) {
317
+        } elseif (preg_match($expr_hex1, $args[0])) {
318 318
             list($r, $g, $b) = explode(" ", preg_replace($expr_hex1, "$1 $2 $3", $args[0]));
319 319
             $r = hexdec($r);
320 320
             $g = hexdec($g);
321 321
             $b = hexdec($b);
322
-        } elseif (preg_match($expr_hex2, $args[0])) {
322
+        } elseif (preg_match($expr_hex2, $args[0])) {
323 323
             list($r, $g, $b) = explode(" ", preg_replace($expr_hex2, "$1$1 $2$2 $3$3", $args[0]));
324 324
             $r = hexdec($r);
325 325
             $g = hexdec($g);
@@ -328,17 +328,17 @@  discard block
 block discarded – undo
328 328
             preg_match($expr_byte, $args[0]) &&
329 329
             preg_match($expr_byte, $args[1]) &&
330 330
             preg_match($expr_byte, $args[2])
331
-        ) {
331
+        ) {
332 332
             list($r, $g, $b) = $args;
333
-        } else {
333
+        } else {
334 334
             return false;
335 335
         }
336 336
 
337 337
         return imagecolorallocate($this->image, $r, $g, $b);
338 338
     }
339 339
 
340
-    public function fill_color($color)
341
-    {
340
+    public function fill_color($color)
341
+    {
342 342
         return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color);
343 343
     }
344 344
 
@@ -351,26 +351,26 @@  discard block
 block discarded – undo
351 351
         $src_x=0, $src_y=0,
352 352
         $dst_w=null, $dst_h=null,
353 353
         $src_w=null, $src_h=null
354
-    ) {
354
+    ) {
355 355
         $image_details = $this->build_image($src);
356 356
 
357
-        if ($image_details !== false) {
357
+        if ($image_details !== false) {
358 358
             list($src, $src_width, $src_height) = $image_details;
359 359
 
360
-            if (is_null($dst_w)) {
360
+            if (is_null($dst_w)) {
361 361
                 $dst_w = $this->width - $dst_x;
362 362
             }
363
-            if (is_null($dst_h)) {
363
+            if (is_null($dst_h)) {
364 364
                 $dst_h = $this->height - $dst_y;
365 365
             }
366
-            if (is_null($src_w)) {
366
+            if (is_null($src_w)) {
367 367
                 $src_w = $src_width - $src_x;
368 368
             }
369
-            if (is_null($src_h)) {
369
+            if (is_null($src_h)) {
370 370
                 $src_h = $src_height - $src_y;
371 371
             }
372 372
             return imagecopy($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
373
-        } else {
373
+        } else {
374 374
             return false;
375 375
         }
376 376
     }
@@ -381,22 +381,22 @@  discard block
 block discarded – undo
381 381
         $src_x=0, $src_y=0,
382 382
         $dst_w=null, $dst_h=null,
383 383
         $src_w=null, $src_h=null
384
-    ) {
384
+    ) {
385 385
         $image_details = $this->build_image($src);
386 386
 
387
-        if ($image_details !== false) {
387
+        if ($image_details !== false) {
388 388
             list($src, $src_width, $src_height) = $image_details;
389 389
 
390
-            if (is_null($dst_w)) {
390
+            if (is_null($dst_w)) {
391 391
                 $dst_w = $this->width - $dst_x;
392 392
             }
393
-            if (is_null($dst_h)) {
393
+            if (is_null($dst_h)) {
394 394
                 $dst_h = $this->height - $dst_y;
395 395
             }
396
-            if (is_null($src_w)) {
396
+            if (is_null($src_w)) {
397 397
                 $src_w = $src_width - $src_x;
398 398
             }
399
-            if (is_null($src_h)) {
399
+            if (is_null($src_h)) {
400 400
                 $src_h = $src_height - $src_y;
401 401
             }
402 402
             imagealphablending($this->image, false);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 
410 410
             $transindex = imagecolortransparent($src);
411 411
             $palletsize = imagecolorstotal($src);
412
-            if ($transindex >= 0 && $transindex < $palletsize) {
412
+            if ($transindex >= 0 && $transindex < $palletsize) {
413 413
                 $transcol = imagecolorsforindex($src, $transindex);
414 414
 
415 415
                 /*** end gif transparent fix ***/
@@ -418,54 +418,54 @@  discard block
 block discarded – undo
418 418
                 imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex);
419 419
                 imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
420 420
                 imagecolortransparent($this->image, $transindex);
421
-                for ($y=0; $y<$dst_h; ++$y) {
422
-                    for ($x=0; $x<$dst_w; ++$x) {
423
-                        if (((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) {
421
+                for ($y=0; $y<$dst_h; ++$y) {
422
+                    for ($x=0; $x<$dst_w; ++$x) {
423
+                        if (((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) {
424 424
                             imagesetpixel($this->image, $x, $y, $transindex);
425 425
                         }
426 426
                     }
427 427
                 }
428 428
                 imagetruecolortopalette($this->image, true, 255);
429
-            } else {
429
+            } else {
430 430
                 $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
431 431
                 imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent);
432 432
                 imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
433 433
             }
434 434
             return $this->image;
435
-        } else {
435
+        } else {
436 436
             return false;
437 437
         }
438 438
     }
439 439
 
440
-    public function imagefilledrectangle($x1, $y1, $x2, $y2, $color)
441
-    {
440
+    public function imagefilledrectangle($x1, $y1, $x2, $y2, $color)
441
+    {
442 442
         $color = $this->gd_color($color);
443
-        if ($color === false) {
443
+        if ($color === false) {
444 444
             return false;
445 445
         }
446 446
         return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color);
447 447
     }
448 448
 
449
-    public function imagepng($filename=null, $quality=null, $filters=null)
450
-    {
451
-        if (is_null($filename) && !headers_sent()) {
449
+    public function imagepng($filename=null, $quality=null, $filters=null)
450
+    {
451
+        if (is_null($filename) && !headers_sent()) {
452 452
             header("Content-Type: image/png");
453 453
         }
454 454
         @imagesavealpha($this->image, true);
455 455
         return imagepng($this->image, $filename, $quality, $filters);
456 456
     }
457 457
 
458
-    public function imagejpeg($filename=null, $quality=75)
459
-    {
460
-        if (is_null($filename) && !headers_sent()) {
458
+    public function imagejpeg($filename=null, $quality=75)
459
+    {
460
+        if (is_null($filename) && !headers_sent()) {
461 461
             header("Content-Type: image/jpeg");
462 462
         }
463 463
         return imagejpeg($this->image, $filename, $quality);
464 464
     }
465 465
 
466
-    public function imagegif($filename=null)
467
-    {
468
-        if (is_null($filename) && !headers_sent()) {
466
+    public function imagegif($filename=null)
467
+    {
468
+        if (is_null($filename) && !headers_sent()) {
469 469
             header("Content-Type: image/gif");
470 470
         }
471 471
         @imagesavealpha($this->image, true);
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,6 @@
 block discarded – undo
200 200
 
201 201
     /** Resize and crop the image to fit in given resolution. Returns TRUE on
202 202
       * success or FALSE on failure
203
-      * @param mixed $src
204 203
       * @param integer $offset
205 204
       * @return bool */
206 205
     abstract public function resizeCrop($width, $height, $offset=false);
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Abstract image driver class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Abstract image driver class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 abstract class image
16 16
 {
17 17
     const DEFAULT_JPEG_QUALITY = 75;
18 18
 
19 19
     /** Image resource or object
20
-      * @var mixed */
20
+     * @var mixed */
21 21
     protected $image;
22 22
 
23 23
     /** Image width in pixels
24
-      * @var integer */
24
+     * @var integer */
25 25
     protected $width;
26 26
 
27 27
     /** Image height in pixels
28
-      * @var integer */
28
+     * @var integer */
29 29
     protected $height;
30 30
 
31 31
     /** Init error
32
-      * @var bool */
32
+     * @var bool */
33 33
     protected $initError = false;
34 34
 
35 35
     /** Driver specific options
36
-      * @var array */
36
+     * @var array */
37 37
     protected $options = array();
38 38
 
39 39
 
40 40
     /** Magic method which allows read-only access to all protected or private
41
-      * class properties
42
-      * @param string $property
43
-      * @return mixed */
41
+     * class properties
42
+     * @param string $property
43
+     * @return mixed */
44 44
 
45 45
     final public function __get($property)
46 46
     {
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
     /** Constructor. Parameter $image should be:
52
-      *   1. An instance of image driver class (copy instance).
53
-      *   2. An image represented by the type of the $image property
54
-      *      (resource or object).
55
-      *   3. An array with two elements. First - width, second - height.
56
-      *      Creates a blank image.
57
-      *   4. A filename string. Get image form file.
58
-      * Second paramaeter is used by pass some specific image driver options
59
-      * @param mixed $image
60
-      * @param array $options */
52
+     *   1. An instance of image driver class (copy instance).
53
+     *   2. An image represented by the type of the $image property
54
+     *      (resource or object).
55
+     *   3. An array with two elements. First - width, second - height.
56
+     *      Creates a blank image.
57
+     *   4. A filename string. Get image form file.
58
+     * Second paramaeter is used by pass some specific image driver options
59
+     * @param mixed $image
60
+     * @param array $options */
61 61
 
62 62
     public function __construct($image, array $options=array())
63 63
     {
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 
75 75
 
76 76
     /** Factory pattern to load selected driver. $image and $options are passed
77
-      * to the constructor of the image driver
78
-      * @param string $driver
79
-      * @param mixed $image
80
-      * @return object */
77
+     * to the constructor of the image driver
78
+     * @param string $driver
79
+     * @param mixed $image
80
+     * @return object */
81 81
 
82 82
     final public static function factory($driver, $image, array $options=array())
83 83
     {
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 
88 88
 
89 89
     /** Checks if the drivers in the array parameter could be used. Returns first
90
-      * found one
91
-      * @param array $drivers
92
-      * @return string */
90
+     * found one
91
+     * @param array $drivers
92
+     * @return string */
93 93
 
94 94
     final public static function getDriver(array $drivers=array('gd'))
95 95
     {
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 
111 111
 
112 112
     /** Returns an array. Element 0 - image resource. Element 1 - width. Element 2 - height.
113
-      * Returns FALSE on failure.
114
-      * @param mixed $image
115
-      * @return array */
113
+     * Returns FALSE on failure.
114
+     * @param mixed $image
115
+     * @return array */
116 116
 
117 117
     final protected function buildImage($image)
118 118
     {
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 
138 138
 
139 139
     /** Returns calculated proportional width from the given height
140
-      * @param integer $resizedHeight
141
-      * @return integer */
140
+     * @param integer $resizedHeight
141
+     * @return integer */
142 142
 
143 143
     final public function getPropWidth($resizedHeight)
144 144
     {
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 
152 152
 
153 153
     /** Returns calculated proportional height from the given width
154
-      * @param integer $resizedWidth
155
-      * @return integer */
154
+     * @param integer $resizedWidth
155
+     * @return integer */
156 156
 
157 157
     final public function getPropHeight($resizedWidth)
158 158
     {
@@ -165,51 +165,51 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
     /** Checks if PHP needs some extra extensions to use the image driver. This
168
-      * static method should be implemented into driver classes like abstract
169
-      * methods
170
-      * @return bool */
168
+     * static method should be implemented into driver classes like abstract
169
+     * methods
170
+     * @return bool */
171 171
     public static function available()
172 172
     {
173 173
         return false;
174 174
     }
175 175
 
176 176
     /** Checks if file is an image. This static method should be implemented into
177
-      * driver classes like abstract methods
178
-      * @param string $file
179
-      * @return bool */
177
+     * driver classes like abstract methods
178
+     * @param string $file
179
+     * @return bool */
180 180
     public static function checkImage($file)
181 181
     {
182 182
         return false;
183 183
     }
184 184
 
185 185
     /** Resize image. Should return TRUE on success or FALSE on failure
186
-      * @param integer $width
187
-      * @param integer $height
188
-      * @return bool */
186
+     * @param integer $width
187
+     * @param integer $height
188
+     * @return bool */
189 189
     abstract public function resize($width, $height);
190 190
 
191 191
     /** Resize image to fit in given resolution. Should returns TRUE on success
192
-      * or FALSE on failure. If $background is set, the image size will be
193
-      * $width x $height and the empty spaces (if any) will be filled with defined
194
-      * color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255)
195
-      * @param integer $width
196
-      * @param integer $height
197
-      * @param mixed $background
198
-      * @return bool */
192
+     * or FALSE on failure. If $background is set, the image size will be
193
+     * $width x $height and the empty spaces (if any) will be filled with defined
194
+     * color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255)
195
+     * @param integer $width
196
+     * @param integer $height
197
+     * @param mixed $background
198
+     * @return bool */
199 199
     abstract public function resizeFit($width, $height, $background=false);
200 200
 
201 201
     /** Resize and crop the image to fit in given resolution. Returns TRUE on
202
-      * success or FALSE on failure
203
-      * @param mixed $src
204
-      * @param integer $offset
205
-      * @return bool */
202
+     * success or FALSE on failure
203
+     * @param mixed $src
204
+     * @param integer $offset
205
+     * @return bool */
206 206
     abstract public function resizeCrop($width, $height, $offset=false);
207 207
 
208 208
 
209 209
     /** Rotate image
210
-      * @param integer $angle
211
-      * @param string $background
212
-      * @return bool */
210
+     * @param integer $angle
211
+     * @param string $background
212
+     * @return bool */
213 213
     abstract public function rotate($angle, $background="#000000");
214 214
 
215 215
     abstract public function flipHorizontal();
@@ -217,43 +217,43 @@  discard block
 block discarded – undo
217 217
     abstract public function flipVertical();
218 218
 
219 219
     /** Apply a PNG or GIF watermark to the image. $top and $left parameters sets
220
-      * the offset of the watermark in pixels. Boolean and NULL values are possible
221
-      * too. In default case (FALSE, FALSE) the watermark should be applyed to
222
-      * the bottom right corner. NULL values means center aligning. If the
223
-      * watermark is bigger than the image or it's partialy or fully outside the
224
-      * image, it shoudn't be applied
225
-      * @param string $file
226
-      * @param mixed $top
227
-      * @param mixed $left
228
-      * @return bool */
220
+     * the offset of the watermark in pixels. Boolean and NULL values are possible
221
+     * too. In default case (FALSE, FALSE) the watermark should be applyed to
222
+     * the bottom right corner. NULL values means center aligning. If the
223
+     * watermark is bigger than the image or it's partialy or fully outside the
224
+     * image, it shoudn't be applied
225
+     * @param string $file
226
+     * @param mixed $top
227
+     * @param mixed $left
228
+     * @return bool */
229 229
     abstract public function watermark($file, $left=false, $top=false);
230 230
 
231 231
     /** Should output the image. Second parameter is used to pass some options like
232
-      *   'file' - if is set, the output will be written to a file
233
-      *   'quality' - compression quality
234
-      * It's possible to use extra specific options required by image type ($type)
235
-      * @param string $type
236
-      * @param array $options
237
-      * @return bool */
232
+     *   'file' - if is set, the output will be written to a file
233
+     *   'quality' - compression quality
234
+     * It's possible to use extra specific options required by image type ($type)
235
+     * @param string $type
236
+     * @param array $options
237
+     * @return bool */
238 238
     abstract public function output($type='jpeg', array $options=array());
239 239
 
240 240
     /** This method should create a blank image with selected size. Should returns
241
-      * resource or object related to the created image, which will be passed to
242
-      * $image property
243
-      * @param integer $width
244
-      * @param integer $height
245
-      * @return mixed */
241
+     * resource or object related to the created image, which will be passed to
242
+     * $image property
243
+     * @param integer $width
244
+     * @param integer $height
245
+     * @return mixed */
246 246
     abstract protected function getBlankImage($width, $height);
247 247
 
248 248
     /** This method should create an image from source image. Only first parameter
249
-      * ($image) is input. Its type should be filename string or a type of the
250
-      * $image property. See the constructor reference for details. The
251
-      * parametters $width and $height are output only. Should returns resource or
252
-      * object related to the created image, which will be passed to $image
253
-      * property
254
-      * @param mixed $image
255
-      * @param integer $width
256
-      * @param integer $height
257
-      * @return mixed */
249
+     * ($image) is input. Its type should be filename string or a type of the
250
+     * $image property. See the constructor reference for details. The
251
+     * parametters $width and $height are output only. Should returns resource or
252
+     * object related to the created image, which will be passed to $image
253
+     * property
254
+     * @param mixed $image
255
+     * @param integer $width
256
+     * @param integer $height
257
+     * @return mixed */
258 258
     abstract protected function getImage($image, &$width, &$height);
259 259
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
       * @param mixed $image
60 60
       * @param array $options */
61 61
 
62
-    public function __construct($image, array $options=array())
62
+    public function __construct($image, array $options = array())
63 63
     {
64 64
         $this->image = $this->width = $this->height = null;
65 65
         $imageDetails = $this->buildImage($image);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
       * @param mixed $image
80 80
       * @return object */
81 81
 
82
-    final public static function factory($driver, $image, array $options=array())
82
+    final public static function factory($driver, $image, array $options = array())
83 83
     {
84 84
         $class = "image_$driver";
85 85
         return new $class($image, $options);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
       * @param array $drivers
92 92
       * @return string */
93 93
 
94
-    final public static function getDriver(array $drivers=array('gd'))
94
+    final public static function getDriver(array $drivers = array('gd'))
95 95
     {
96 96
         foreach ($drivers as $driver) {
97 97
             if (!preg_match('/^[a-z0-9\_]+$/i', $driver)) {
@@ -196,21 +196,21 @@  discard block
 block discarded – undo
196 196
       * @param integer $height
197 197
       * @param mixed $background
198 198
       * @return bool */
199
-    abstract public function resizeFit($width, $height, $background=false);
199
+    abstract public function resizeFit($width, $height, $background = false);
200 200
 
201 201
     /** Resize and crop the image to fit in given resolution. Returns TRUE on
202 202
       * success or FALSE on failure
203 203
       * @param mixed $src
204 204
       * @param integer $offset
205 205
       * @return bool */
206
-    abstract public function resizeCrop($width, $height, $offset=false);
206
+    abstract public function resizeCrop($width, $height, $offset = false);
207 207
 
208 208
 
209 209
     /** Rotate image
210 210
       * @param integer $angle
211 211
       * @param string $background
212 212
       * @return bool */
213
-    abstract public function rotate($angle, $background="#000000");
213
+    abstract public function rotate($angle, $background = "#000000");
214 214
 
215 215
     abstract public function flipHorizontal();
216 216
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
       * @param mixed $top
227 227
       * @param mixed $left
228 228
       * @return bool */
229
-    abstract public function watermark($file, $left=false, $top=false);
229
+    abstract public function watermark($file, $left = false, $top = false);
230 230
 
231 231
     /** Should output the image. Second parameter is used to pass some options like
232 232
       *   'file' - if is set, the output will be written to a file
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
       * @param string $type
236 236
       * @param array $options
237 237
       * @return bool */
238
-    abstract public function output($type='jpeg', array $options=array());
238
+    abstract public function output($type = 'jpeg', array $options = array());
239 239
 
240 240
     /** This method should create a blank image with selected size. Should returns
241 241
       * resource or object related to the created image, which will be passed to
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image_gd.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -368,6 +368,11 @@
 block discarded – undo
368 368
         return imagecolorallocate($this->image, $r, $g, $b);
369 369
     }
370 370
 
371
+    /**
372
+     * @param integer $x1
373
+     * @param integer $y1
374
+     * @param boolean $color
375
+     */
371 376
     protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color)
372 377
     {
373 378
         $color = $this->gdColor($color);
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc GD image driver class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc GD image driver class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class image_gd extends image
16 16
 {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         );
36 36
     }
37 37
 
38
-    public function resizeFit($width, $height, $background=false)
38
+    public function resizeFit($width, $height, $background = false)
39 39
     {
40 40
         if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) {
41 41
             return true;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         }
80 80
     }
81 81
 
82
-    public function resizeCrop($width, $height, $offset=false)
82
+    public function resizeCrop($width, $height, $offset = false)
83 83
     {
84 84
         if (($this->width / $this->height) > ($width / $height)) {
85 85
             $h = $height;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         return $return;
139 139
     }
140 140
 
141
-    public function rotate($angle, $background="#000000")
141
+    public function rotate($angle, $background = "#000000")
142 142
     {
143 143
         $angle = -$angle;
144 144
         $img = @imagerotate($this->image, $angle, $this->gdColor($background));
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         return true;
178 178
     }
179 179
 
180
-    public function watermark($file, $left=false, $top=false)
180
+    public function watermark($file, $left = false, $top = false)
181 181
     {
182 182
         $info = getimagesize($file);
183 183
         list($w, $h, $t) = $info;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         return true;
220 220
     }
221 221
 
222
-    public function output($type='jpeg', array $options=array())
222
+    public function output($type = 'jpeg', array $options = array())
223 223
     {
224 224
         $method = "output_$type";
225 225
         if (!method_exists($this, $method)) {
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
             (false !== (list($width, $height, $t) = @getimagesize($image)))
253 253
         ) {
254 254
             $image =
255
-                ($t == IMAGETYPE_GIF)  ? @imagecreatefromgif($image)  : (
255
+                ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : (
256 256
                 ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : (
257 257
                 ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : (
258
-                ($t == IMAGETYPE_PNG)  ? @imagecreatefrompng($image)  : (
259
-                ($t == IMAGETYPE_XBM)  ? @imagecreatefromxbm($image)  : false
258
+                ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : (
259
+                ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false
260 260
             ))));
261 261
 
262 262
             return $image;
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
         }
283 283
 
284 284
         $img =
285
-            ($t == IMAGETYPE_GIF)  ? @imagecreatefromgif($file)  : (
285
+            ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : (
286 286
             ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : (
287 287
             ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : (
288
-            ($t == IMAGETYPE_PNG)  ? @imagecreatefrompng($file)  : (
289
-            ($t == IMAGETYPE_XBM)  ? @imagecreatefromxbm($file)  : false
288
+            ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : (
289
+            ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false
290 290
         ))));
291 291
 
292 292
         return ($img !== false);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
     // OWN METHODS
297 297
 
298
-    protected function output_png(array $options=array())
298
+    protected function output_png(array $options = array())
299 299
     {
300 300
         $file = isset($options['file']) ? $options['file'] : null;
301 301
         $quality = isset($options['quality']) ? $options['quality'] : null;
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         return imagepng($this->image, $file, $quality, $filters);
308 308
     }
309 309
 
310
-    protected function output_jpeg(array $options=array())
310
+    protected function output_jpeg(array $options = array())
311 311
     {
312 312
         $file = isset($options['file']) ? $options['file'] : null;
313 313
         $quality = isset($options['quality'])
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         return imagejpeg($this->image, $file, $quality);
320 320
     }
321 321
 
322
-    protected function output_gif(array $options=array())
322
+    protected function output_gif(array $options = array())
323 323
     {
324 324
         $file = isset($options['file']) ? $options['file'] : null;
325 325
         if (isset($options['file']) && !headers_sent()) {
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
     }
379 379
 
380 380
     protected function imageCopyResampled(
381
-        $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null
382
-    ) {
381
+        $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null
382
+    ){
383 383
         $imageDetails = $this->buildImage($src);
384 384
 
385 385
         if ($imageDetails === false) {
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_zipFolder.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -19,6 +19,9 @@  discard block
 block discarded – undo
19 19
     protected $root;
20 20
     protected $ignored;
21 21
 
22
+    /**
23
+     * @param string $folder
24
+     */
22 25
     public function __construct($file, $folder, $ignored=null)
23 26
     {
24 27
         $this->zip = new ZipArchive();
@@ -42,6 +45,9 @@  discard block
 block discarded – undo
42 45
         $this->zip->close();
43 46
     }
44 47
 
48
+    /**
49
+     * @param string $folder
50
+     */
45 51
     public function zip($folder, $parent=null)
46 52
     {
47 53
         $full_path = "{$this->root}$parent$folder";
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project. The class are taken from
4
-  * http://www.php.net/manual/en/function.ziparchive-addemptydir.php
5
-  *
6
-  *      @desc Directory to ZIP file archivator
7
-  *   @package KCFinder
8
-  *   @version 2.54
9
-  *    @author Pavel Tzonkov <[email protected]>
10
-  * @copyright 2010-2014 KCFinder Project
11
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
12
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
13
-  *      @link http://kcfinder.sunhater.com
14
-  */
4
+ * http://www.php.net/manual/en/function.ziparchive-addemptydir.php
5
+ *
6
+ *      @desc Directory to ZIP file archivator
7
+ *   @package KCFinder
8
+ *   @version 2.54
9
+ *    @author Pavel Tzonkov <[email protected]>
10
+ * @copyright 2010-2014 KCFinder Project
11
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
12
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
13
+ *      @link http://kcfinder.sunhater.com
14
+ */
15 15
 
16 16
 class zipFolder
17 17
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     protected $root;
20 20
     protected $ignored;
21 21
 
22
-    public function __construct($file, $folder, $ignored=null)
22
+    public function __construct($file, $folder, $ignored = null)
23 23
     {
24 24
         $this->zip = new ZipArchive();
25 25
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $this->zip->close();
43 43
     }
44 44
 
45
-    public function zip($folder, $parent=null)
45
+    public function zip($folder, $parent = null)
46 46
     {
47 47
         $full_path = "{$this->root}$parent$folder";
48 48
         $zip_path = "$parent$folder";
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_file.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,6 @@  discard block
 block discarded – undo
102 102
 
103 103
     /** Checks if the given file is really writable. The standard PHP function
104 104
       * is_writable() does not work properly on Windows servers.
105
-      * @param string $dir
106 105
       * @return bool */
107 106
 
108 107
     public static function isWritable($filename)
@@ -116,7 +115,6 @@  discard block
 block discarded – undo
116 115
     }
117 116
 
118 117
     /** Get the extension from filename
119
-      * @param string $file
120 118
       * @param bool $toLower
121 119
       * @return string */
122 120
 
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc File helper class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc File helper class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class file
16 16
 {
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
     );
102 102
 
103 103
     /** Checks if the given file is really writable. The standard PHP function
104
-      * is_writable() does not work properly on Windows servers.
105
-      * @param string $dir
106
-      * @return bool */
104
+     * is_writable() does not work properly on Windows servers.
105
+     * @param string $dir
106
+     * @return bool */
107 107
 
108 108
     public static function isWritable($filename)
109 109
     {
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     }
117 117
 
118 118
     /** Get the extension from filename
119
-      * @param string $file
120
-      * @param bool $toLower
121
-      * @return string */
119
+     * @param string $file
120
+     * @param bool $toLower
121
+     * @return string */
122 122
 
123 123
     public static function getExtension($filename, $toLower=true)
124 124
     {
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
     }
128 128
 
129 129
     /** Get MIME type of the given filename. If Fileinfo PHP extension is
130
-      * available the MIME type will be fetched by the file's content. The
131
-      * second parameter is optional and defines the magic file path. If you
132
-      * skip it, the default one will be loaded.
133
-      * If Fileinfo PHP extension is not available the MIME type will be fetched
134
-      * by filename extension regarding $MIME property. If the file extension
135
-      * does not exist there, returned type will be application/octet-stream
136
-      * @param string $filename
137
-      * @param string $magic
138
-      * @return string */
130
+     * available the MIME type will be fetched by the file's content. The
131
+     * second parameter is optional and defines the magic file path. If you
132
+     * skip it, the default one will be loaded.
133
+     * If Fileinfo PHP extension is not available the MIME type will be fetched
134
+     * by filename extension regarding $MIME property. If the file extension
135
+     * does not exist there, returned type will be application/octet-stream
136
+     * @param string $filename
137
+     * @param string $magic
138
+     * @return string */
139 139
 
140 140
     public static function getMimeType($filename, $magic=null)
141 141
     {
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
     }
155 155
 
156 156
     /** Get inexistant filename based on the given filename. If you skip $dir
157
-      * parameter the directory will be fetched from $filename and returned
158
-      * value will be full filename path. The third parameter is optional and
159
-      * defines the template, the filename will be renamed to. Default template
160
-      * is {name}({sufix}){ext}. Examples:
161
-      *
162
-      *   file::getInexistantFilename("/my/directory/myfile.txt");
163
-      *   If myfile.txt does not exist - returns the same path to the file
164
-      *   otherwise returns "/my/directory/myfile(1).txt"
165
-      *
166
-      *   file::getInexistantFilename("myfile.txt", "/my/directory");
167
-      *   returns "myfile.txt" or "myfile(1).txt" or "myfile(2).txt" etc...
168
-      *
169
-      *   file::getInexistantFilename("myfile.txt", "/dir", "{name}[{sufix}]{ext}");
170
-      *   returns "myfile.txt" or "myfile[1].txt" or "myfile[2].txt" etc...
171
-      *
172
-      * @param string $filename
173
-      * @param string $dir
174
-      * @param string $tpl
175
-      * @return string */
157
+     * parameter the directory will be fetched from $filename and returned
158
+     * value will be full filename path. The third parameter is optional and
159
+     * defines the template, the filename will be renamed to. Default template
160
+     * is {name}({sufix}){ext}. Examples:
161
+     *
162
+     *   file::getInexistantFilename("/my/directory/myfile.txt");
163
+     *   If myfile.txt does not exist - returns the same path to the file
164
+     *   otherwise returns "/my/directory/myfile(1).txt"
165
+     *
166
+     *   file::getInexistantFilename("myfile.txt", "/my/directory");
167
+     *   returns "myfile.txt" or "myfile(1).txt" or "myfile(2).txt" etc...
168
+     *
169
+     *   file::getInexistantFilename("myfile.txt", "/dir", "{name}[{sufix}]{ext}");
170
+     *   returns "myfile.txt" or "myfile[1].txt" or "myfile[2].txt" etc...
171
+     *
172
+     * @param string $filename
173
+     * @param string $dir
174
+     * @param string $tpl
175
+     * @return string */
176 176
 
177 177
     public static function getInexistantFilename($filename, $dir=null, $tpl=null)
178 178
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
       * @param bool $toLower
121 121
       * @return string */
122 122
 
123
-    public static function getExtension($filename, $toLower=true)
123
+    public static function getExtension($filename, $toLower = true)
124 124
     {
125 125
         return preg_match('/^.*\.([^\.]*)$/s', $filename, $patt)
126 126
             ? ($toLower ? strtolower($patt[1]) : $patt[1]) : "";
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
       * @param string $magic
138 138
       * @return string */
139 139
 
140
-    public static function getMimeType($filename, $magic=null)
140
+    public static function getMimeType($filename, $magic = null)
141 141
     {
142 142
         if (class_exists("finfo")) {
143 143
             $finfo = ($magic === null)
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
       * @param string $tpl
175 175
       * @return string */
176 176
 
177
-    public static function getInexistantFilename($filename, $dir=null, $tpl=null)
177
+    public static function getInexistantFilename($filename, $dir = null, $tpl = null)
178 178
     {
179 179
         if ($tpl === null) {
180 180
             $tpl = "{name}({sufix}){ext}";
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
         $i = 1;
197 197
         $file = "$dir/$filename";
198 198
         while (file_exists($file)) {
199
-            $file = "$dir/" . str_replace('{sufix}', $i++, $tpl);
199
+            $file = "$dir/".str_replace('{sufix}', $i++, $tpl);
200 200
         }
201 201
 
202 202
         return $fullPath
203 203
             ? $file
204 204
             : (strlen($fdir)
205
-                ? "$fdir/" . basename($file)
205
+                ? "$fdir/".basename($file)
206 206
                 : basename($file));
207 207
     }
208 208
 }
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * -----------------------------
46 46
  */
47 47
 
48
-$autoloader = __DIR__ . '/vendor/autoload.php';
48
+$autoloader = __DIR__.'/vendor/autoload.php';
49 49
 if (file_exists($autoloader) && is_readable($autoloader)) {
50 50
     include_once($autoloader);
51 51
 }
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
     $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
55 55
 }
56 56
 
57
-$base_path = str_replace('\\', '/', dirname(__FILE__)) . '/';
58
-if (is_file($base_path . 'assets/cache/siteManager.php')) {
59
-    include_once($base_path . 'assets/cache/siteManager.php');
57
+$base_path = str_replace('\\', '/', dirname(__FILE__)).'/';
58
+if (is_file($base_path.'assets/cache/siteManager.php')) {
59
+    include_once($base_path.'assets/cache/siteManager.php');
60 60
 }
61 61
 if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
62 62
     define('MGR_DIR', 'manager');
63 63
 }
64
-if (is_file($base_path . 'assets/cache/siteHostnames.php')) {
65
-    include_once($base_path . 'assets/cache/siteHostnames.php');
64
+if (is_file($base_path.'assets/cache/siteHostnames.php')) {
65
+    include_once($base_path.'assets/cache/siteHostnames.php');
66 66
 }
67 67
 if (!defined('MODX_SITE_HOSTNAMES')) {
68 68
     define('MODX_SITE_HOSTNAMES', '');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 $mstart = memory_get_usage();
73 73
 
74 74
 // harden it
75
-require_once(dirname(__FILE__) . '/' . MGR_DIR . '/includes/protect.inc.php');
75
+require_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/protect.inc.php');
76 76
 
77 77
 // set some settings, and address some IE issues
78 78
 @ini_set('url_rewriter.tags', '');
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  */
90 90
 
91 91
 define('IN_PARSER_MODE', true);
92
-if (! defined('IN_MANAGER_MODE')) {
92
+if (!defined('IN_MANAGER_MODE')) {
93 93
     define('IN_MANAGER_MODE', false);
94 94
 }
95 95
 if (!defined('MODX_API_MODE')) {
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 }
98 98
 
99 99
 // get the required includes
100
-if (!isset($database_user) || $database_user=="") {
101
-    $rt = @include_once(dirname(__FILE__) . '/' . MGR_DIR . '/includes/config.inc.php');
100
+if (!isset($database_user) || $database_user == "") {
101
+    $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php');
102 102
     // Be sure config.inc.php is there and that it contains some important values
103 103
     if (!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
104 104
         readfile('install/not_installed.tpl');
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     $modx = new $coreClass;
115 115
 }
116 116
 if (!isset($modx) || !($modx instanceof \DocumentParser)) {
117
-    include_once(MODX_MANAGER_PATH . 'includes/document.parser.class.inc.php');
117
+    include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php');
118 118
     $modx = DocumentParser::getInstance();
119 119
 }
120 120
 
Please login to merge, or discard this patch.