@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function widthTopLeft() { |
135 | 135 | $o = $this->getOrientation(); |
136 | - $this->logger->debug('OC_Image->widthTopLeft() Orientation: ' . $o, array('app' => 'core')); |
|
136 | + $this->logger->debug('OC_Image->widthTopLeft() Orientation: '.$o, array('app' => 'core')); |
|
137 | 137 | switch ($o) { |
138 | 138 | case -1: |
139 | 139 | case 1: |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function heightTopLeft() { |
159 | 159 | $o = $this->getOrientation(); |
160 | - $this->logger->debug('OC_Image->heightTopLeft() Orientation: ' . $o, array('app' => 'core')); |
|
160 | + $this->logger->debug('OC_Image->heightTopLeft() Orientation: '.$o, array('app' => 'core')); |
|
161 | 161 | switch ($o) { |
162 | 162 | case -1: |
163 | 163 | case 1: |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | if ($mimeType === null) { |
185 | 185 | $mimeType = $this->mimeType(); |
186 | 186 | } |
187 | - header('Content-Type: ' . $mimeType); |
|
187 | + header('Content-Type: '.$mimeType); |
|
188 | 188 | return $this->_output(null, $mimeType); |
189 | 189 | } |
190 | 190 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | if ($filePath === null) { |
204 | 204 | if ($this->filePath === null) { |
205 | - $this->logger->error(__METHOD__ . '(): called with no path.', array('app' => 'core')); |
|
205 | + $this->logger->error(__METHOD__.'(): called with no path.', array('app' => 'core')); |
|
206 | 206 | return false; |
207 | 207 | } else { |
208 | 208 | $filePath = $this->filePath; |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | } |
227 | 227 | $isWritable = is_writable(dirname($filePath)); |
228 | 228 | if (!$isWritable) { |
229 | - $this->logger->error(__METHOD__ . '(): Directory \'' . dirname($filePath) . '\' is not writable.', array('app' => 'core')); |
|
229 | + $this->logger->error(__METHOD__.'(): Directory \''.dirname($filePath).'\' is not writable.', array('app' => 'core')); |
|
230 | 230 | return false; |
231 | 231 | } elseif ($isWritable && file_exists($filePath) && !is_writable($filePath)) { |
232 | - $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', array('app' => 'core')); |
|
232 | + $this->logger->error(__METHOD__.'(): File \''.$filePath.'\' is not writable.', array('app' => 'core')); |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $imageType = IMAGETYPE_BMP; |
258 | 258 | break; |
259 | 259 | default: |
260 | - throw new Exception('\OC_Image::_output(): "' . $mimeType . '" is not supported when forcing a specific output format'); |
|
260 | + throw new Exception('\OC_Image::_output(): "'.$mimeType.'" is not supported when forcing a specific output format'); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | return; |
437 | 437 | } |
438 | 438 | |
439 | - $exif = @exif_read_data('data://image/jpeg;base64,' . base64_encode($data)); |
|
439 | + $exif = @exif_read_data('data://image/jpeg;base64,'.base64_encode($data)); |
|
440 | 440 | if (!$exif) { |
441 | 441 | return; |
442 | 442 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function fixOrientation() { |
456 | 456 | $o = $this->getOrientation(); |
457 | - $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, array('app' => 'core')); |
|
457 | + $this->logger->debug('OC_Image->fixOrientation() Orientation: '.$o, array('app' => 'core')); |
|
458 | 458 | $rotate = 0; |
459 | 459 | $flip = false; |
460 | 460 | switch ($o) { |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $rotate = 90; |
490 | 490 | break; |
491 | 491 | } |
492 | - if($flip && function_exists('imageflip')) { |
|
492 | + if ($flip && function_exists('imageflip')) { |
|
493 | 493 | imageflip($this->resource, IMG_FLIP_HORIZONTAL); |
494 | 494 | } |
495 | 495 | if ($rotate) { |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | imagealphablending($this->resource, true); |
552 | 552 | imagesavealpha($this->resource, true); |
553 | 553 | } else { |
554 | - $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: ' . $imagePath, array('app' => 'core')); |
|
554 | + $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: '.$imagePath, array('app' => 'core')); |
|
555 | 555 | } |
556 | 556 | break; |
557 | 557 | case IMAGETYPE_JPEG: |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | if (getimagesize($imagePath) !== false) { |
560 | 560 | $this->resource = @imagecreatefromjpeg($imagePath); |
561 | 561 | } else { |
562 | - $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, array('app' => 'core')); |
|
562 | + $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: '.$imagePath, array('app' => 'core')); |
|
563 | 563 | } |
564 | 564 | } else { |
565 | - $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, array('app' => 'core')); |
|
565 | + $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: '.$imagePath, array('app' => 'core')); |
|
566 | 566 | } |
567 | 567 | break; |
568 | 568 | case IMAGETYPE_PNG: |
@@ -572,21 +572,21 @@ discard block |
||
572 | 572 | imagealphablending($this->resource, true); |
573 | 573 | imagesavealpha($this->resource, true); |
574 | 574 | } else { |
575 | - $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: ' . $imagePath, array('app' => 'core')); |
|
575 | + $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: '.$imagePath, array('app' => 'core')); |
|
576 | 576 | } |
577 | 577 | break; |
578 | 578 | case IMAGETYPE_XBM: |
579 | 579 | if (imagetypes() & IMG_XPM) { |
580 | 580 | $this->resource = @imagecreatefromxbm($imagePath); |
581 | 581 | } else { |
582 | - $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: ' . $imagePath, array('app' => 'core')); |
|
582 | + $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath, array('app' => 'core')); |
|
583 | 583 | } |
584 | 584 | break; |
585 | 585 | case IMAGETYPE_WBMP: |
586 | 586 | if (imagetypes() & IMG_WBMP) { |
587 | 587 | $this->resource = @imagecreatefromwbmp($imagePath); |
588 | 588 | } else { |
589 | - $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: ' . $imagePath, array('app' => 'core')); |
|
589 | + $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: '.$imagePath, array('app' => 'core')); |
|
590 | 590 | } |
591 | 591 | break; |
592 | 592 | case IMAGETYPE_BMP: |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | */ |
697 | 697 | private function imagecreatefrombmp($fileName) { |
698 | 698 | if (!($fh = fopen($fileName, 'rb'))) { |
699 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, array('app' => 'core')); |
|
699 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName, array('app' => 'core')); |
|
700 | 700 | return false; |
701 | 701 | } |
702 | 702 | // read file header |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | // check for bitmap |
705 | 705 | if ($meta['type'] != 19778) { |
706 | 706 | fclose($fh); |
707 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', array('app' => 'core')); |
|
707 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName.' is not a bitmap!', array('app' => 'core')); |
|
708 | 708 | return false; |
709 | 709 | } |
710 | 710 | // read image header |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $meta['imagesize'] = @filesize($fileName) - $meta['offset']; |
729 | 729 | if ($meta['imagesize'] < 1) { |
730 | 730 | fclose($fh); |
731 | - $this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', array('app' => 'core')); |
|
731 | + $this->logger->warning('imagecreatefrombmp: Can not obtain file size of '.$fileName.' is not a bitmap!', array('app' => 'core')); |
|
732 | 732 | return false; |
733 | 733 | } |
734 | 734 | } |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // read color palette |
739 | 739 | $palette = array(); |
740 | 740 | if ($meta['bits'] < 16) { |
741 | - $palette = unpack('l' . $meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
741 | + $palette = unpack('l'.$meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
742 | 742 | // in rare cases the color value is signed |
743 | 743 | if ($palette[1] < 0) { |
744 | 744 | foreach ($palette as $i => $color) { |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | if ($im == false) { |
752 | 752 | fclose($fh); |
753 | 753 | $this->logger->warning( |
754 | - 'imagecreatefrombmp: imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'], |
|
754 | + 'imagecreatefrombmp: imagecreatetruecolor failed for file "'.$fileName.'" with dimensions '.$meta['width'].'x'.$meta['height'], |
|
755 | 755 | array('app' => 'core')); |
756 | 756 | return false; |
757 | 757 | } |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | $p = 0; |
761 | 761 | $vide = chr(0); |
762 | 762 | $y = $meta['height'] - 1; |
763 | - $error = 'imagecreatefrombmp: ' . $fileName . ' has not enough data!'; |
|
763 | + $error = 'imagecreatefrombmp: '.$fileName.' has not enough data!'; |
|
764 | 764 | // loop through the image data beginning with the lower left corner |
765 | 765 | while ($y >= 0) { |
766 | 766 | $x = 0; |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | $this->logger->warning($error, array('app' => 'core')); |
773 | 773 | return $im; |
774 | 774 | } |
775 | - $color = @unpack('V', $part . $vide); |
|
775 | + $color = @unpack('V', $part.$vide); |
|
776 | 776 | break; |
777 | 777 | case 16: |
778 | 778 | if (!($part = substr($data, $p, 2))) { |
@@ -784,16 +784,16 @@ discard block |
||
784 | 784 | $color[1] = (($color[1] & 0xf800) >> 8) * 65536 + (($color[1] & 0x07e0) >> 3) * 256 + (($color[1] & 0x001f) << 3); |
785 | 785 | break; |
786 | 786 | case 8: |
787 | - $color = @unpack('n', $vide . ($data[$p] ?? '')); |
|
787 | + $color = @unpack('n', $vide.($data[$p] ?? '')); |
|
788 | 788 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
789 | 789 | break; |
790 | 790 | case 4: |
791 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
791 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
792 | 792 | $color[1] = ($p * 2) % 2 == 0 ? $color[1] >> 4 : $color[1] & 0x0F; |
793 | 793 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
794 | 794 | break; |
795 | 795 | case 1: |
796 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
796 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
797 | 797 | switch (($p * 8) % 8) { |
798 | 798 | case 0: |
799 | 799 | $color[1] = $color[1] >> 7; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | break; |
825 | 825 | default: |
826 | 826 | fclose($fh); |
827 | - $this->logger->warning('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', array('app' => 'core')); |
|
827 | + $this->logger->warning('imagecreatefrombmp: '.$fileName.' has '.$meta['bits'].' bits and this is not supported!', array('app' => 'core')); |
|
828 | 828 | return false; |
829 | 829 | } |
830 | 830 | imagesetpixel($im, $x, $y, $color[1]); |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | */ |
847 | 847 | public function resize($maxSize) { |
848 | 848 | if (!$this->valid()) { |
849 | - $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core')); |
|
849 | + $this->logger->error(__METHOD__.'(): No image loaded', array('app' => 'core')); |
|
850 | 850 | return false; |
851 | 851 | } |
852 | 852 | $widthOrig = imagesx($this->resource); |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | $newHeight = $maxSize; |
862 | 862 | } |
863 | 863 | |
864 | - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); |
|
864 | + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); |
|
865 | 865 | return true; |
866 | 866 | } |
867 | 867 | |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | */ |
873 | 873 | public function preciseResize(int $width, int $height): bool { |
874 | 874 | if (!$this->valid()) { |
875 | - $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core')); |
|
875 | + $this->logger->error(__METHOD__.'(): No image loaded', array('app' => 'core')); |
|
876 | 876 | return false; |
877 | 877 | } |
878 | 878 | $widthOrig = imagesx($this->resource); |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $process = imagecreatetruecolor($width, $height); |
881 | 881 | |
882 | 882 | if ($process == false) { |
883 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core')); |
|
883 | + $this->logger->error(__METHOD__.'(): Error creating true color image', array('app' => 'core')); |
|
884 | 884 | imagedestroy($process); |
885 | 885 | return false; |
886 | 886 | } |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | |
895 | 895 | imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); |
896 | 896 | if ($process == false) { |
897 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image', array('app' => 'core')); |
|
897 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image', array('app' => 'core')); |
|
898 | 898 | imagedestroy($process); |
899 | 899 | return false; |
900 | 900 | } |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | |
953 | 953 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); |
954 | 954 | if ($process == false) { |
955 | - $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, array('app' => 'core')); |
|
955 | + $this->logger->error('OC_Image->centerCrop, Error re-sampling process image '.$width.'x'.$height, array('app' => 'core')); |
|
956 | 956 | imagedestroy($process); |
957 | 957 | return false; |
958 | 958 | } |
@@ -972,12 +972,12 @@ discard block |
||
972 | 972 | */ |
973 | 973 | public function crop(int $x, int $y, int $w, int $h): bool { |
974 | 974 | if (!$this->valid()) { |
975 | - $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core')); |
|
975 | + $this->logger->error(__METHOD__.'(): No image loaded', array('app' => 'core')); |
|
976 | 976 | return false; |
977 | 977 | } |
978 | 978 | $process = imagecreatetruecolor($w, $h); |
979 | 979 | if ($process == false) { |
980 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', array('app' => 'core')); |
|
980 | + $this->logger->error(__METHOD__.'(): Error creating true color image', array('app' => 'core')); |
|
981 | 981 | imagedestroy($process); |
982 | 982 | return false; |
983 | 983 | } |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | |
992 | 992 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); |
993 | 993 | if ($process == false) { |
994 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, array('app' => 'core')); |
|
994 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image '.$w.'x'.$h, array('app' => 'core')); |
|
995 | 995 | imagedestroy($process); |
996 | 996 | return false; |
997 | 997 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | */ |
1012 | 1012 | public function fitIn($maxWidth, $maxHeight) { |
1013 | 1013 | if (!$this->valid()) { |
1014 | - $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core')); |
|
1014 | + $this->logger->error(__METHOD__.'(): No image loaded', array('app' => 'core')); |
|
1015 | 1015 | return false; |
1016 | 1016 | } |
1017 | 1017 | $widthOrig = imagesx($this->resource); |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | $newWidth = min($maxWidth, $ratio * $maxHeight); |
1022 | 1022 | $newHeight = min($maxHeight, $maxWidth / $ratio); |
1023 | 1023 | |
1024 | - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); |
|
1024 | + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); |
|
1025 | 1025 | return true; |
1026 | 1026 | } |
1027 | 1027 | |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | */ |
1035 | 1035 | public function scaleDownToFit($maxWidth, $maxHeight) { |
1036 | 1036 | if (!$this->valid()) { |
1037 | - $this->logger->error(__METHOD__ . '(): No image loaded', array('app' => 'core')); |
|
1037 | + $this->logger->error(__METHOD__.'(): No image loaded', array('app' => 'core')); |
|
1038 | 1038 | return false; |
1039 | 1039 | } |
1040 | 1040 | $widthOrig = imagesx($this->resource); |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | if ($bit <= 8) { |
1093 | 1093 | for ($i = 0; $i < $colorsNum; $i++) { |
1094 | 1094 | $colors = imagecolorsforindex($im, $i); |
1095 | - $rgbQuad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0"; |
|
1095 | + $rgbQuad .= chr($colors['blue']).chr($colors['green']).chr($colors['red'])."\0"; |
|
1096 | 1096 | } |
1097 | 1097 | $bmpData = ''; |
1098 | 1098 | if ($compression == 0 || $bit < 8) { |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | $index = imagecolorat($im, $i, $j); |
1126 | 1126 | if ($index !== $lastIndex || $sameNum > 255) { |
1127 | 1127 | if ($sameNum != 0) { |
1128 | - $bmpData .= chr($sameNum) . chr($lastIndex); |
|
1128 | + $bmpData .= chr($sameNum).chr($lastIndex); |
|
1129 | 1129 | } |
1130 | 1130 | $lastIndex = $index; |
1131 | 1131 | $sameNum = 1; |
@@ -1166,15 +1166,15 @@ discard block |
||
1166 | 1166 | $sizeData = strlen($bmpData); |
1167 | 1167 | $colorsNum = 0; |
1168 | 1168 | } |
1169 | - $fileHeader = 'BM' . pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1169 | + $fileHeader = 'BM'.pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1170 | 1170 | $infoHeader = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $sizeData, 0, 0, $colorsNum, 0); |
1171 | 1171 | if ($fileName != '') { |
1172 | 1172 | $fp = fopen($fileName, 'wb'); |
1173 | - fwrite($fp, $fileHeader . $infoHeader . $rgbQuad . $bmpData); |
|
1173 | + fwrite($fp, $fileHeader.$infoHeader.$rgbQuad.$bmpData); |
|
1174 | 1174 | fclose($fp); |
1175 | 1175 | return true; |
1176 | 1176 | } |
1177 | - echo $fileHeader . $infoHeader . $rgbQuad . $bmpData; |
|
1177 | + echo $fileHeader.$infoHeader.$rgbQuad.$bmpData; |
|
1178 | 1178 | return true; |
1179 | 1179 | } |
1180 | 1180 | } |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | $this->storageId = self::adjustStorageId($this->storageId); |
70 | 70 | |
71 | 71 | if ($row = self::getStorageById($this->storageId)) { |
72 | - $this->numericId = (int)$row['numeric_id']; |
|
72 | + $this->numericId = (int) $row['numeric_id']; |
|
73 | 73 | } else { |
74 | 74 | $connection = \OC::$server->getDatabaseConnection(); |
75 | 75 | $available = $isAvailable ? 1 : 0; |
76 | 76 | if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) { |
77 | - $this->numericId = (int)$connection->lastInsertId('*PREFIX*storages'); |
|
77 | + $this->numericId = (int) $connection->lastInsertId('*PREFIX*storages'); |
|
78 | 78 | } else { |
79 | 79 | if ($row = self::getStorageById($this->storageId)) { |
80 | - $this->numericId = (int)$row['numeric_id']; |
|
80 | + $this->numericId = (int) $row['numeric_id']; |
|
81 | 81 | } else { |
82 | 82 | throw new \RuntimeException('Storage could neither be inserted nor be selected from the database'); |
83 | 83 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $storageId = self::adjustStorageId($storageId); |
143 | 143 | |
144 | 144 | if ($row = self::getStorageById($storageId)) { |
145 | - return (int)$row['numeric_id']; |
|
145 | + return (int) $row['numeric_id']; |
|
146 | 146 | } else { |
147 | 147 | return null; |
148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public function getAvailability() { |
155 | 155 | if ($row = self::getStorageById($this->storageId)) { |
156 | 156 | return [ |
157 | - 'available' => (int)$row['available'] === 1, |
|
157 | + 'available' => (int) $row['available'] === 1, |
|
158 | 158 | 'last_checked' => $row['last_checked'] |
159 | 159 | ]; |
160 | 160 | } else { |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | $params = array(); |
94 | 94 | if (count($ids) == 1 && isset($uidOwner)) { |
95 | 95 | // FIXME: don't concat $parents, use Docrine's PARAM_INT_ARRAY approach |
96 | - $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' . |
|
97 | - '`item_target`, `file_target`, `parent` ' . |
|
98 | - 'FROM `*PREFIX*share` ' . |
|
96 | + $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '. |
|
97 | + '`item_target`, `file_target`, `parent` '. |
|
98 | + 'FROM `*PREFIX*share` '. |
|
99 | 99 | 'WHERE `parent` IN ('.$parents.') AND `uid_owner` = ? '; |
100 | 100 | $params[] = $uidOwner; |
101 | 101 | } else { |
102 | - $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, ' . |
|
103 | - '`item_target`, `file_target`, `parent`, `uid_owner` ' . |
|
102 | + $queryString = 'SELECT `id`, `share_with`, `item_type`, `share_type`, '. |
|
103 | + '`item_target`, `file_target`, `parent`, `uid_owner` '. |
|
104 | 104 | 'FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') '; |
105 | 105 | } |
106 | 106 | if ($excludeGroupChildren) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'shareWith' => $item['share_with'], |
118 | 118 | 'itemTarget' => $item['item_target'], |
119 | 119 | 'itemType' => $item['item_type'], |
120 | - 'shareType' => (int)$item['share_type'], |
|
120 | + 'shareType' => (int) $item['share_type'], |
|
121 | 121 | ); |
122 | 122 | if (isset($item['file_target'])) { |
123 | 123 | $tmpItem['fileTarget'] = $item['file_target']; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | if ($defaultExpireDate === 'yes') { |
169 | 169 | $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); |
170 | 170 | $defaultExpireSettings['defaultExpireDateSet'] = true; |
171 | - $defaultExpireSettings['expireAfterDays'] = (int)$config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
171 | + $defaultExpireSettings['expireAfterDays'] = (int) $config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
172 | 172 | $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes'; |
173 | 173 | } |
174 | 174 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @since 9.1.0 |
38 | 38 | */ |
39 | - const KEY_ADMIN_SECTION = 'admin-section'; |
|
39 | + const KEY_ADMIN_SECTION = 'admin-section'; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @since 13.0.0 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @since 13.0.0 |
48 | 48 | */ |
49 | - const KEY_PERSONAL_SECTION = 'personal-section'; |
|
49 | + const KEY_PERSONAL_SECTION = 'personal-section'; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param string $type 'admin' or 'personal' |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @since 4.0.0 |
54 | 54 | * @deprecated 14.0.0 Use settings section in appinfo.xml to register personal admin sections |
55 | 55 | */ |
56 | - public static function registerPersonal( $app, $page ) { |
|
57 | - \OC_App::registerPersonal( $app, $page ); |
|
56 | + public static function registerPersonal($app, $page) { |
|
57 | + \OC_App::registerPersonal($app, $page); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @since 4.0.0 |
66 | 66 | * @deprecated 14.0.0 Use settings section in appinfo.xml to register admin sections |
67 | 67 | */ |
68 | - public static function registerAdmin( $app, $page ) { |
|
69 | - \OC_App::registerAdmin( $app, $page ); |
|
68 | + public static function registerAdmin($app, $page) { |
|
69 | + \OC_App::registerAdmin($app, $page); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @deprecated 14.0.0 ise \OC::$server->getAppManager()->getAppInfo($appId) |
78 | 78 | * @since 4.0.0 |
79 | 79 | */ |
80 | - public static function getAppInfo( $app, $path=false ) { |
|
81 | - return \OC_App::getAppInfo( $app, $path); |
|
80 | + public static function getAppInfo($app, $path = false) { |
|
81 | + return \OC_App::getAppInfo($app, $path); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @since 4.0.0 |
91 | 91 | * @deprecated 13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId) |
92 | 92 | */ |
93 | - public static function isEnabled( $app ) { |
|
94 | - return \OC::$server->getAppManager()->isEnabledForUser( $app ); |
|
93 | + public static function isEnabled($app) { |
|
94 | + return \OC::$server->getAppManager()->isEnabledForUser($app); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @since 4.0.0 |
102 | 102 | * @deprecated 9.0.0 ownCloud core will handle disabled apps and redirects to valid URLs |
103 | 103 | */ |
104 | - public static function checkAppEnabled( $app ) { |
|
104 | + public static function checkAppEnabled($app) { |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @since 4.0.0 |
112 | 112 | * @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppVersion($appId) |
113 | 113 | */ |
114 | - public static function getAppVersion( $app ) { |
|
114 | + public static function getAppVersion($app) { |
|
115 | 115 | return \OC::$server->getAppManager()->getAppVersion($app); |
116 | 116 | } |
117 | 117 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | class Streamer { |
32 | 32 | // array of regexp. Matching user agents will get tar instead of zip |
33 | - private $preferTarFor = [ '/macintosh|mac os x/i' ]; |
|
33 | + private $preferTarFor = ['/macintosh|mac os x/i']; |
|
34 | 34 | |
35 | 35 | // streamer instance |
36 | 36 | private $streamerInstance; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param int $numberOfFiles The number of files (and directories) that will |
44 | 44 | * be included in the streamed file |
45 | 45 | */ |
46 | - public function __construct(IRequest $request, int $size, int $numberOfFiles){ |
|
46 | + public function __construct(IRequest $request, int $size, int $numberOfFiles) { |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * zip32 constraints for a basic (without compression, volumes nor |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * Send HTTP headers |
81 | 81 | * @param string $name |
82 | 82 | */ |
83 | - public function sendHeaders($name){ |
|
83 | + public function sendHeaders($name) { |
|
84 | 84 | $extension = $this->streamerInstance instanceof ZipStreamer ? '.zip' : '.tar'; |
85 | - $fullName = $name . $extension; |
|
85 | + $fullName = $name.$extension; |
|
86 | 86 | $this->streamerInstance->sendHeaders($fullName); |
87 | 87 | } |
88 | 88 | |
@@ -91,27 +91,27 @@ discard block |
||
91 | 91 | * @param string $dir |
92 | 92 | * @param string $internalDir |
93 | 93 | */ |
94 | - public function addDirRecursive($dir, $internalDir='') { |
|
94 | + public function addDirRecursive($dir, $internalDir = '') { |
|
95 | 95 | $dirname = basename($dir); |
96 | - $rootDir = $internalDir . $dirname; |
|
96 | + $rootDir = $internalDir.$dirname; |
|
97 | 97 | if (!empty($rootDir)) { |
98 | 98 | $this->streamerInstance->addEmptyDir($rootDir); |
99 | 99 | } |
100 | - $internalDir .= $dirname . '/'; |
|
100 | + $internalDir .= $dirname.'/'; |
|
101 | 101 | // prevent absolute dirs |
102 | 102 | $internalDir = ltrim($internalDir, '/'); |
103 | 103 | |
104 | - $files= \OC\Files\Filesystem::getDirectoryContent($dir); |
|
105 | - foreach($files as $file) { |
|
104 | + $files = \OC\Files\Filesystem::getDirectoryContent($dir); |
|
105 | + foreach ($files as $file) { |
|
106 | 106 | $filename = $file['name']; |
107 | - $file = $dir . '/' . $filename; |
|
108 | - if(\OC\Files\Filesystem::is_file($file)) { |
|
107 | + $file = $dir.'/'.$filename; |
|
108 | + if (\OC\Files\Filesystem::is_file($file)) { |
|
109 | 109 | $filesize = \OC\Files\Filesystem::filesize($file); |
110 | 110 | $fileTime = \OC\Files\Filesystem::filemtime($file); |
111 | 111 | $fh = \OC\Files\Filesystem::fopen($file, 'r'); |
112 | - $this->addFileFromStream($fh, $internalDir . $filename, $filesize, $fileTime); |
|
112 | + $this->addFileFromStream($fh, $internalDir.$filename, $filesize, $fileTime); |
|
113 | 113 | fclose($fh); |
114 | - }elseif(\OC\Files\Filesystem::is_dir($file)) { |
|
114 | + }elseif (\OC\Files\Filesystem::is_dir($file)) { |
|
115 | 115 | $this->addDirRecursive($file, $internalDir); |
116 | 116 | } |
117 | 117 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $dirName Directory Path and name to be added to the archive. |
148 | 148 | * @return bool $success |
149 | 149 | */ |
150 | - public function addEmptyDir($dirName){ |
|
150 | + public function addEmptyDir($dirName) { |
|
151 | 151 | return $this->streamerInstance->addEmptyDir($dirName); |
152 | 152 | } |
153 | 153 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * closing, the file is completely written to the output stream. |
158 | 158 | * @return bool $success |
159 | 159 | */ |
160 | - public function finalize(){ |
|
160 | + public function finalize() { |
|
161 | 161 | return $this->streamerInstance->finalize(); |
162 | 162 | } |
163 | 163 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $results = $folder->search($query); |
159 | 159 | |
160 | 160 | /** @var SearchResult[] $nodes */ |
161 | - $nodes = array_map(function (Node $node) { |
|
161 | + $nodes = array_map(function(Node $node) { |
|
162 | 162 | if ($node instanceof Folder) { |
163 | 163 | $davNode = new \OCA\DAV\Connector\Sabre\Directory($this->view, $node, $this->tree, $this->shareManager); |
164 | 164 | } else { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | }, $results); |
171 | 171 | |
172 | 172 | // Sort again, since the result from multiple storages is appended and not sorted |
173 | - usort($nodes, function (SearchResult $a, SearchResult $b) use ($search) { |
|
173 | + usort($nodes, function(SearchResult $a, SearchResult $b) use ($search) { |
|
174 | 174 | return $this->sort($a, $b, $search->orderBy); |
175 | 175 | }); |
176 | 176 | |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | * @return string |
260 | 260 | */ |
261 | 261 | private function getHrefForNode(Node $node) { |
262 | - $base = '/files/' . $this->user->getUID(); |
|
263 | - return $base . $this->view->getRelativePath($node->getPath()); |
|
262 | + $base = '/files/'.$this->user->getUID(); |
|
263 | + return $base.$this->view->getRelativePath($node->getPath()); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // TODO offset |
272 | 272 | $limit = $query->limit; |
273 | 273 | $orders = array_map([$this, 'mapSearchOrder'], $query->orderBy); |
274 | - return new SearchQuery($this->transformSearchOperation($query->where), (int)$limit->maxResults, 0, $orders, $this->user); |
|
274 | + return new SearchQuery($this->transformSearchOperation($query->where), (int) $limit->maxResults, 0, $orders, $this->user); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -301,19 +301,19 @@ discard block |
||
301 | 301 | case Operator::OPERATION_LESS_THAN: |
302 | 302 | case Operator::OPERATION_IS_LIKE: |
303 | 303 | if (count($operator->arguments) !== 2) { |
304 | - throw new \InvalidArgumentException('Invalid number of arguments for ' . $trimmedType . ' operation'); |
|
304 | + throw new \InvalidArgumentException('Invalid number of arguments for '.$trimmedType.' operation'); |
|
305 | 305 | } |
306 | 306 | if (!($operator->arguments[0] instanceof SearchPropertyDefinition)) { |
307 | - throw new \InvalidArgumentException('Invalid argument 1 for ' . $trimmedType . ' operation, expected property'); |
|
307 | + throw new \InvalidArgumentException('Invalid argument 1 for '.$trimmedType.' operation, expected property'); |
|
308 | 308 | } |
309 | 309 | if (!($operator->arguments[1] instanceof Literal)) { |
310 | - throw new \InvalidArgumentException('Invalid argument 2 for ' . $trimmedType . ' operation, expected literal'); |
|
310 | + throw new \InvalidArgumentException('Invalid argument 2 for '.$trimmedType.' operation, expected literal'); |
|
311 | 311 | } |
312 | 312 | return new SearchComparison($trimmedType, $this->mapPropertyNameToColumn($operator->arguments[0]), $this->castValue($operator->arguments[0], $operator->arguments[1]->value)); |
313 | 313 | case Operator::OPERATION_IS_COLLECTION: |
314 | 314 | return new SearchComparison('eq', 'mimetype', ICacheEntry::DIRECTORY_MIMETYPE); |
315 | 315 | default: |
316 | - throw new \InvalidArgumentException('Unsupported operation ' . $trimmedType . ' (' . $operator->type . ')'); |
|
316 | + throw new \InvalidArgumentException('Unsupported operation '.$trimmedType.' ('.$operator->type.')'); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | case FilesPlugin::INTERNAL_FILEID_PROPERTYNAME: |
339 | 339 | return 'fileid'; |
340 | 340 | default: |
341 | - throw new \InvalidArgumentException('Unsupported property for search or order: ' . $property->name); |
|
341 | + throw new \InvalidArgumentException('Unsupported property for search or order: '.$property->name); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 |
@@ -164,7 +164,7 @@ |
||
164 | 164 | * @since 14.0.0 |
165 | 165 | */ |
166 | 166 | public function render(): string { |
167 | - $detailContent = ($this->detail !== '') ? ' <span class="download-size">(' . Util::sanitizeHTML($this->detail) . ')</span>' : ''; |
|
167 | + $detailContent = ($this->detail !== '') ? ' <span class="download-size">('.Util::sanitizeHTML($this->detail).')</span>' : ''; |
|
168 | 168 | return sprintf( |
169 | 169 | '<li id="%s"><a href="%s"><span class="icon %s"></span>%s %s</a></li>', |
170 | 170 | Util::sanitizeHTML($this->id), Util::sanitizeHTML($this->link), Util::sanitizeHTML($this->icon), Util::sanitizeHTML($this->label), $detailContent |
@@ -57,17 +57,17 @@ |
||
57 | 57 | $result = ['wide' => [], 'exact' => []]; |
58 | 58 | |
59 | 59 | $groups = $this->groupManager->search($search, $limit, $offset); |
60 | - $groupIds = array_map(function (IGroup $group) { return $group->getGID(); }, $groups); |
|
60 | + $groupIds = array_map(function(IGroup $group) { return $group->getGID(); }, $groups); |
|
61 | 61 | |
62 | 62 | if (!$this->shareeEnumeration || count($groups) < $limit) { |
63 | 63 | $hasMoreResults = true; |
64 | 64 | } |
65 | 65 | |
66 | - $userGroups = []; |
|
66 | + $userGroups = []; |
|
67 | 67 | if (!empty($groups) && $this->shareWithGroupOnly) { |
68 | 68 | // Intersect all the groups that match with the groups this user is a member of |
69 | 69 | $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); |
70 | - $userGroups = array_map(function (IGroup $group) { return $group->getGID(); }, $userGroups); |
|
70 | + $userGroups = array_map(function(IGroup $group) { return $group->getGID(); }, $userGroups); |
|
71 | 71 | $groupIds = array_intersect($groupIds, $userGroups); |
72 | 72 | } |
73 | 73 |