@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $server->on('report', [$this, 'report']); |
80 | 80 | |
81 | - $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] = |
|
81 | + $server->xml->elementMap['{'.self::NS_Nextcloud.'}calendar-search'] = |
|
82 | 82 | CalendarSearchReport::class; |
83 | 83 | } |
84 | 84 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function report($reportName, $report, $path) { |
94 | 94 | switch ($reportName) { |
95 | - case '{' . self::NS_Nextcloud . '}calendar-search': |
|
95 | + case '{'.self::NS_Nextcloud.'}calendar-search': |
|
96 | 96 | $this->server->transactionType = 'report-nc-calendar-search'; |
97 | 97 | $this->calendarSearch($report); |
98 | 98 | return false; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $reports = []; |
116 | 116 | if ($node instanceof CalendarHome) { |
117 | - $reports[] = '{' . self::NS_Nextcloud . '}calendar-search'; |
|
117 | + $reports[] = '{'.self::NS_Nextcloud.'}calendar-search'; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return $reports; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | foreach ($nodePaths as $path) { |
146 | 146 | list($properties) = $this->server->getPropertiesForPath( |
147 | - $this->server->getRequestUri() . '/' . $path, |
|
147 | + $this->server->getRequestUri().'/'.$path, |
|
148 | 148 | $report->properties); |
149 | 149 | $result[] = $properties; |
150 | 150 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | public function get($key) { |
54 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
55 | - if ($result === false && !self::$cache->exists($this->getNameSpace() . $key)) { |
|
54 | + $result = self::$cache->get($this->getNameSpace().$key); |
|
55 | + if ($result === false && !self::$cache->exists($this->getNameSpace().$key)) { |
|
56 | 56 | return null; |
57 | 57 | } else { |
58 | 58 | return json_decode($result, true); |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | |
62 | 62 | public function set($key, $value, $ttl = 0) { |
63 | 63 | if ($ttl > 0) { |
64 | - return self::$cache->setex($this->getNameSpace() . $key, $ttl, json_encode($value)); |
|
64 | + return self::$cache->setex($this->getNameSpace().$key, $ttl, json_encode($value)); |
|
65 | 65 | } else { |
66 | - return self::$cache->set($this->getNameSpace() . $key, json_encode($value)); |
|
66 | + return self::$cache->set($this->getNameSpace().$key, json_encode($value)); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | public function hasKey($key) { |
71 | - return self::$cache->exists($this->getNameSpace() . $key); |
|
71 | + return self::$cache->exists($this->getNameSpace().$key); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function remove($key) { |
75 | - if (self::$cache->del($this->getNameSpace() . $key)) { |
|
75 | + if (self::$cache->del($this->getNameSpace().$key)) { |
|
76 | 76 | return true; |
77 | 77 | } else { |
78 | 78 | return false; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | public function clear($prefix = '') { |
83 | - $prefix = $this->getNameSpace() . $prefix . '*'; |
|
83 | + $prefix = $this->getNameSpace().$prefix.'*'; |
|
84 | 84 | $keys = self::$cache->keys($prefix); |
85 | 85 | $deleted = self::$cache->del($keys); |
86 | 86 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if (!is_int($value)) { |
101 | 101 | $value = json_encode($value); |
102 | 102 | } |
103 | - return self::$cache->setnx($this->getPrefix() . $key, $value); |
|
103 | + return self::$cache->setnx($this->getPrefix().$key, $value); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return int | bool |
112 | 112 | */ |
113 | 113 | public function inc($key, $step = 1) { |
114 | - return self::$cache->incrBy($this->getNameSpace() . $key, $step); |
|
114 | + return self::$cache->incrBy($this->getNameSpace().$key, $step); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | if (!$this->hasKey($key)) { |
126 | 126 | return false; |
127 | 127 | } |
128 | - return self::$cache->decrBy($this->getNameSpace() . $key, $step); |
|
128 | + return self::$cache->decrBy($this->getNameSpace().$key, $step); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | if (!is_int($new)) { |
141 | 141 | $new = json_encode($new); |
142 | 142 | } |
143 | - self::$cache->watch($this->getNameSpace() . $key); |
|
143 | + self::$cache->watch($this->getNameSpace().$key); |
|
144 | 144 | if ($this->get($key) === $old) { |
145 | 145 | $result = self::$cache->multi() |
146 | - ->set($this->getNameSpace() . $key, $new) |
|
146 | + ->set($this->getNameSpace().$key, $new) |
|
147 | 147 | ->exec(); |
148 | 148 | return $result !== false; |
149 | 149 | } |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | * @return bool |
160 | 160 | */ |
161 | 161 | public function cad($key, $old) { |
162 | - self::$cache->watch($this->getNameSpace() . $key); |
|
162 | + self::$cache->watch($this->getNameSpace().$key); |
|
163 | 163 | if ($this->get($key) === $old) { |
164 | 164 | $result = self::$cache->multi() |
165 | - ->del($this->getNameSpace() . $key) |
|
165 | + ->del($this->getNameSpace().$key) |
|
166 | 166 | ->exec(); |
167 | 167 | return $result !== false; |
168 | 168 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | public function setTTL($key, $ttl) { |
174 | - self::$cache->expire($this->getNameSpace() . $key, $ttl); |
|
174 | + self::$cache->expire($this->getNameSpace().$key, $ttl); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | static public function isAvailable() { |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | $input = $host; |
63 | 63 | if (strpos($host, '://') === false) { |
64 | 64 | // add a protocol to fix parse_url behavior with ipv6 |
65 | - $host = 'http://' . $host; |
|
65 | + $host = 'http://'.$host; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $parsed = parse_url($host); |
69 | - if(is_array($parsed) && isset($parsed['port'])) { |
|
69 | + if (is_array($parsed) && isset($parsed['port'])) { |
|
70 | 70 | return [$parsed['host'], $parsed['port']]; |
71 | 71 | } else if (is_array($parsed)) { |
72 | 72 | return [$parsed['host'], 22]; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // Register sftp:// |
83 | 83 | Stream::register(); |
84 | 84 | |
85 | - $parsedHost = $this->splitHost($params['host']); |
|
85 | + $parsedHost = $this->splitHost($params['host']); |
|
86 | 86 | |
87 | 87 | $this->host = $parsedHost[0]; |
88 | 88 | $this->port = $parsedHost[1]; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $this->root |
104 | 104 | = isset($params['root']) ? $this->cleanPath($params['root']) : '/'; |
105 | 105 | |
106 | - $this->root = '/' . ltrim($this->root, '/'); |
|
107 | - $this->root = rtrim($this->root, '/') . '/'; |
|
106 | + $this->root = '/'.ltrim($this->root, '/'); |
|
107 | + $this->root = rtrim($this->root, '/').'/'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * {@inheritdoc} |
156 | 156 | */ |
157 | - public function getId(){ |
|
158 | - $id = 'sftp::' . $this->user . '@' . $this->host; |
|
157 | + public function getId() { |
|
158 | + $id = 'sftp::'.$this->user.'@'.$this->host; |
|
159 | 159 | if ($this->port !== 22) { |
160 | - $id .= ':' . $this->port; |
|
160 | + $id .= ':'.$this->port; |
|
161 | 161 | } |
162 | 162 | // note: this will double the root slash, |
163 | 163 | // we should not change it to keep compatible with |
164 | 164 | // old storage ids |
165 | - $id .= '/' . $this->root; |
|
165 | + $id .= '/'.$this->root; |
|
166 | 166 | return $id; |
167 | 167 | } |
168 | 168 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return string |
193 | 193 | */ |
194 | 194 | private function absPath($path) { |
195 | - return $this->root . $this->cleanPath($path); |
|
195 | + return $this->root.$this->cleanPath($path); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | try { |
203 | 203 | $storage_view = \OCP\Files::getStorage('files_external'); |
204 | 204 | if ($storage_view) { |
205 | - return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . |
|
206 | - $storage_view->getAbsolutePath('') . |
|
205 | + return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'). |
|
206 | + $storage_view->getAbsolutePath(''). |
|
207 | 207 | 'ssh_hostKeys'; |
208 | 208 | } |
209 | 209 | } catch (\Exception $e) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if ($keyPath && file_exists($keyPath)) { |
222 | 222 | $fp = fopen($keyPath, 'w'); |
223 | 223 | foreach ($keys as $host => $key) { |
224 | - fwrite($fp, $host . '::' . $key . "\n"); |
|
224 | + fwrite($fp, $host.'::'.$key."\n"); |
|
225 | 225 | } |
226 | 226 | fclose($fp); |
227 | 227 | return true; |
@@ -293,15 +293,15 @@ discard block |
||
293 | 293 | return false; |
294 | 294 | } |
295 | 295 | |
296 | - $id = md5('sftp:' . $path); |
|
296 | + $id = md5('sftp:'.$path); |
|
297 | 297 | $dirStream = array(); |
298 | - foreach($list as $file) { |
|
298 | + foreach ($list as $file) { |
|
299 | 299 | if ($file !== '.' && $file !== '..') { |
300 | 300 | $dirStream[] = $file; |
301 | 301 | } |
302 | 302 | } |
303 | 303 | return IteratorDirectory::wrap($dirStream); |
304 | - } catch(\Exception $e) { |
|
304 | + } catch (\Exception $e) { |
|
305 | 305 | return false; |
306 | 306 | } |
307 | 307 | } |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | public function fopen($path, $mode) { |
354 | 354 | try { |
355 | 355 | $absPath = $this->absPath($path); |
356 | - switch($mode) { |
|
356 | + switch ($mode) { |
|
357 | 357 | case 'r': |
358 | 358 | case 'rb': |
359 | - if ( !$this->file_exists($path)) { |
|
359 | + if (!$this->file_exists($path)) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | case 'w': |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * {@inheritdoc} |
385 | 385 | */ |
386 | - public function touch($path, $mtime=null) { |
|
386 | + public function touch($path, $mtime = null) { |
|
387 | 387 | try { |
388 | 388 | if (!is_null($mtime)) { |
389 | 389 | return false; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | // Do not pass the password here. We want to use the Net_SFTP object |
459 | 459 | // supplied via stream context or fail. We only supply username and |
460 | 460 | // hostname because this might show up in logs (they are not used). |
461 | - $url = 'sftp://' . urlencode($this->user) . '@' . $this->host . ':' . $this->port . $this->root . $path; |
|
461 | + $url = 'sftp://'.urlencode($this->user).'@'.$this->host.':'.$this->port.$this->root.$path; |
|
462 | 462 | return $url; |
463 | 463 | } |
464 | 464 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | public static function extendJsConfig($settings) { |
58 | 58 | $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
59 | 59 | |
60 | - $maxChunkSize = (int)\OC::$server->getConfig()->getAppValue('files', 'max_chunk_size', 10 * 1024 * 1024); |
|
60 | + $maxChunkSize = (int) \OC::$server->getConfig()->getAppValue('files', 'max_chunk_size', 10 * 1024 * 1024); |
|
61 | 61 | $appConfig['files'] = [ |
62 | 62 | 'max_chunk_size' => $maxChunkSize |
63 | 63 | ]; |
@@ -100,7 +100,7 @@ |
||
100 | 100 | |
101 | 101 | $params = get_defined_vars(); |
102 | 102 | $configs = []; |
103 | - foreach($params as $key => $value) { |
|
103 | + foreach ($params as $key => $value) { |
|
104 | 104 | $configs[$key] = empty($value) ? null : $value; |
105 | 105 | } |
106 | 106 |
@@ -26,8 +26,8 @@ |
||
26 | 26 | |
27 | 27 | ?> |
28 | 28 | |
29 | -<?php foreach($_['forms'] as $form) { |
|
29 | +<?php foreach ($_['forms'] as $form) { |
|
30 | 30 | if (isset($form['form'])) {?> |
31 | - <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
|
31 | + <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p(''); ?>"><?php print_unescaped($form['form']); ?></div> |
|
32 | 32 | <?php } |
33 | 33 | } ?> |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | //use the admin login data for the new database user |
64 | 64 | |
65 | 65 | //add prefix to the postgresql user name to prevent collisions |
66 | - $this->dbUser = 'oc_' . strtolower($username); |
|
66 | + $this->dbUser = 'oc_'.strtolower($username); |
|
67 | 67 | //create a new password so we don't need to store the admin config in the config file |
68 | - $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
68 | + $this->dbPassword = \OC::$server->getSecureRandom()->generate(30, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
69 | 69 | |
70 | 70 | $this->createDBUser($connection); |
71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | //create the database |
79 | 79 | $this->createDatabase($connection); |
80 | 80 | $query = $connection->prepare("select count(*) FROM pg_class WHERE relname=? limit 1"); |
81 | - $query->execute([$this->tablePrefix . "users"]); |
|
81 | + $query->execute([$this->tablePrefix."users"]); |
|
82 | 82 | $tablesSetup = $query->fetchColumn() > 0; |
83 | 83 | |
84 | 84 | // the connection to dbname=postgres is not needed anymore |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | private function createDatabase(IDBConnection $connection) { |
110 | 110 | if (!$this->databaseExists($connection)) { |
111 | 111 | //The database does not exists... let's create it |
112 | - $query = $connection->prepare("CREATE DATABASE " . addslashes($this->dbName) . " OWNER " . addslashes($this->dbUser)); |
|
112 | + $query = $connection->prepare("CREATE DATABASE ".addslashes($this->dbName)." OWNER ".addslashes($this->dbUser)); |
|
113 | 113 | try { |
114 | 114 | $query->execute(); |
115 | 115 | } catch (DatabaseException $e) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $this->logger->logException($e); |
118 | 118 | } |
119 | 119 | } else { |
120 | - $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE " . addslashes($this->dbName) . " FROM PUBLIC"); |
|
120 | + $query = $connection->prepare("REVOKE ALL PRIVILEGES ON DATABASE ".addslashes($this->dbName)." FROM PUBLIC"); |
|
121 | 121 | try { |
122 | 122 | $query->execute(); |
123 | 123 | } catch (DatabaseException $e) { |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | $i = 1; |
154 | 154 | while ($this->userExists($connection)) { |
155 | 155 | $i++; |
156 | - $this->dbUser = $dbUser . $i; |
|
156 | + $this->dbUser = $dbUser.$i; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // create the user |
160 | - $query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'"); |
|
160 | + $query = $connection->prepare("CREATE USER ".addslashes($this->dbUser)." CREATEDB PASSWORD '".addslashes($this->dbPassword)."'"); |
|
161 | 161 | $query->execute(); |
162 | 162 | } catch (DatabaseException $e) { |
163 | 163 | $this->logger->error('Error while trying to create database user'); |
@@ -56,8 +56,8 @@ |
||
56 | 56 | */ |
57 | 57 | public function postConnect(ConnectionEventArgs $args) { |
58 | 58 | $sensitive = $this->caseSensitiveLike ? 'true' : 'false'; |
59 | - $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive); |
|
60 | - $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode); |
|
59 | + $args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = '.$sensitive); |
|
60 | + $args->getConnection()->executeUpdate('PRAGMA journal_mode = '.$this->journalMode); |
|
61 | 61 | /** @var \PDO $pdo */ |
62 | 62 | $pdo = $args->getConnection()->getWrappedConnection(); |
63 | 63 | $pdo->sqliteCreateFunction('md5', 'md5', 1); |
@@ -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 | } |