From 87e1a27fde1267921e0b4a025fec96395d83b6c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20M=C3=BCller?= Date: Mon, 10 Sep 2012 12:23:55 +0300 Subject: [PATCH] Respect coding style --- lib/archive/zip.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/archive/zip.php b/lib/archive/zip.php index 45992ee3d89..a2b07f1a35d 100644 --- a/lib/archive/zip.php +++ b/lib/archive/zip.php @@ -16,9 +16,9 @@ class OC_Archive_ZIP extends OC_Archive{ function __construct($source) { $this->path=$source; $this->zip=new ZipArchive(); - if($this->zip->open($source,ZipArchive::CREATE)) { + if($this->zip->open($source, ZipArchive::CREATE)) { }else{ - OCP\Util::writeLog('files_archive','Error while opening archive '.$source,OCP\Util::WARN); + OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, OCP\Util::WARN); } } /** @@ -37,9 +37,9 @@ class OC_Archive_ZIP extends OC_Archive{ */ function addFile($path,$source='') { if($source and $source[0]=='/' and file_exists($source)) { - $result=$this->zip->addFile($source,$path); + $result=$this->zip->addFile($source, $path); }else{ - $result=$this->zip->addFromString($path,$source); + $result=$this->zip->addFromString($path, $source); } if($result) { $this->zip->close();//close and reopen to save the zip @@ -56,7 +56,7 @@ class OC_Archive_ZIP extends OC_Archive{ function rename($source,$dest) { $source=$this->stripPath($source); $dest=$this->stripPath($dest); - $this->zip->renameName($source,$dest); + $this->zip->renameName($source, $dest); } /** * get the uncompressed size of a file in the archive @@ -85,9 +85,9 @@ class OC_Archive_ZIP extends OC_Archive{ $folderContent=array(); $pathLength=strlen($path); foreach($files as $file) { - if(substr($file,0,$pathLength)==$path and $file!=$path) { - if(strrpos(substr($file,0,-1),'/')<=$pathLength) { - $folderContent[]=substr($file,$pathLength); + if(substr($file, 0, $pathLength)==$path and $file!=$path) { + if(strrpos(substr($file, 0, -1),'/')<=$pathLength) { + $folderContent[]=substr($file, $pathLength); } } } @@ -121,7 +121,7 @@ class OC_Archive_ZIP extends OC_Archive{ */ function extractFile($path,$dest) { $fp = $this->zip->getStream($path); - file_put_contents($dest,$fp); + file_put_contents($dest, $fp); } /** * extract the archive @@ -162,18 +162,18 @@ class OC_Archive_ZIP extends OC_Archive{ if($mode=='r' or $mode=='rb') { return $this->zip->getStream($path); }else{//since we cant directly get a writable stream, make a temp copy of the file and put it back in the archive when the stream is closed - if(strrpos($path,'.')!==false) { - $ext=substr($path,strrpos($path,'.')); + if(strrpos($path, '.')!==false) { + $ext=substr($path, strrpos($path, '.')); }else{ $ext=''; } $tmpFile=OCP\Files::tmpFile($ext); OC_CloseStreamWrapper::$callBacks[$tmpFile]=array($this,'writeBack'); if($this->fileExists($path)) { - $this->extractFile($path,$tmpFile); + $this->extractFile($path, $tmpFile); } self::$tempFiles[$tmpFile]=$path; - return fopen('close://'.$tmpFile,$mode); + return fopen('close://'.$tmpFile, $mode); } } @@ -183,14 +183,14 @@ class OC_Archive_ZIP extends OC_Archive{ */ function writeBack($tmpFile) { if(isset(self::$tempFiles[$tmpFile])) { - $this->addFile(self::$tempFiles[$tmpFile],$tmpFile); + $this->addFile(self::$tempFiles[$tmpFile], $tmpFile); unlink($tmpFile); } } private function stripPath($path) { if(!$path || $path[0]=='/') { - return substr($path,1); + return substr($path, 1); }else{ return $path; } -- 2.39.5