@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | public function __toString() |
49 | 49 | { |
50 | - return (string)$this->_s; |
|
50 | + return (string) $this->_s; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function toJavaScriptLiteral() |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | class THttpUtility |
22 | 22 | { |
23 | - private static $_encodeTable = ['<' => '<','>' => '>','"' => '"']; |
|
24 | - private static $_decodeTable = ['<' => '<','>' => '>','"' => '"']; |
|
25 | - private static $_stripTable = ['<' => '','>' => '','"' => '']; |
|
23 | + private static $_encodeTable = ['<' => '<', '>' => '>', '"' => '"']; |
|
24 | + private static $_decodeTable = ['<' => '<', '>' => '>', '"' => '"']; |
|
25 | + private static $_stripTable = ['<' => '', '>' => '', '"' => '']; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * HTML-encodes a string. |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | nspname = :schema)) |
138 | 138 | AND a.attnum > 0 AND NOT a.attisdropped |
139 | 139 | ORDER BY a.attnum |
140 | -EOD; |
|
140 | +eod; |
|
141 | 141 | $this->getDbConnection()->setActive(true); |
142 | 142 | $command = $this->getDbConnection()->createCommand($sql); |
143 | 143 | $command->bindValue(':table', $tableName); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | SELECT count(c.relname) FROM pg_catalog.pg_class c |
198 | 198 | LEFT JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace) |
199 | 199 | WHERE (n.nspname=:schema) AND (c.relkind = 'v'::"char") AND c.relname = :table |
200 | -EOD; |
|
200 | +eod; |
|
201 | 201 | $this->getDbConnection()->setActive(true); |
202 | 202 | $command = $this->getDbConnection()->createCommand($sql); |
203 | 203 | $command->bindValue(':schema', $schemaName); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | WHERE nspname=:schema)) |
333 | 333 | ORDER BY |
334 | 334 | 1 |
335 | -EOD; |
|
335 | +eod; |
|
336 | 336 | $this->getDbConnection()->setActive(true); |
337 | 337 | $command = $this->getDbConnection()->createCommand($sql); |
338 | 338 | $command->bindValue(':table', $tableName); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ) |
374 | 374 | AND attnum IN ({$index}) |
375 | -EOD; |
|
375 | +eod; |
|
376 | 376 | $command = $this->getDbConnection()->createCommand($sql); |
377 | 377 | $command->bindValue(':table', $tableName); |
378 | 378 | $command->bindValue(':schema', $schemaName); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $sql = <<<EOD |
435 | 435 | SELECT table_name, table_schema FROM information_schema.tables |
436 | 436 | WHERE table_schema=:schema AND table_type='BASE TABLE' |
437 | -EOD; |
|
437 | +eod; |
|
438 | 438 | $command = $this->getDbConnection()->createCommand($sql); |
439 | 439 | $command->bindParam(':schema', $schema); |
440 | 440 | $rows = $command->queryAll(); |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function getSchemaTableName($table) |
91 | 91 | { |
92 | - if (count($parts = explode('.', str_replace('"', '', $table))) > 1) { |
|
92 | + if(count($parts = explode('.', str_replace('"', '', $table))) > 1) { |
|
93 | 93 | return [$parts[0], $parts[1]]; |
94 | 94 | } else { |
95 | - return [$this->getDefaultSchema(),$parts[0]]; |
|
95 | + return [$this->getDefaultSchema(), $parts[0]]; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $command->bindValue(':schema', $schemaName); |
145 | 145 | $tableInfo = $this->createNewTableInfo($schemaName, $tableName); |
146 | 146 | $index = 0; |
147 | - foreach ($command->query() as $col) { |
|
147 | + foreach($command->query() as $col) { |
|
148 | 148 | $col['index'] = $index++; |
149 | 149 | $this->processColumn($tableInfo, $col); |
150 | 150 | } |
151 | - if ($index === 0) { |
|
151 | + if($index === 0) { |
|
152 | 152 | throw new TDbException('dbmetadata_invalid_table_view', $table); |
153 | 153 | } |
154 | 154 | return $tableInfo; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $info['SchemaName'] = $this->assertIdentifier($schemaName); |
165 | 165 | $info['TableName'] = $this->assertIdentifier($tableName); |
166 | - if ($this->getIsView($schemaName, $tableName)) { |
|
166 | + if($this->getIsView($schemaName, $tableName)) { |
|
167 | 167 | $info['IsView'] = true; |
168 | 168 | } |
169 | 169 | list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function assertIdentifier($name) |
180 | 180 | { |
181 | - if (strpos($name, '"') !== false) { |
|
181 | + if(strpos($name, '"') !== false) { |
|
182 | 182 | $ref = 'http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS'; |
183 | 183 | throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref); |
184 | 184 | } |
@@ -216,34 +216,34 @@ discard block |
||
216 | 216 | $info['ColumnName'] = '"' . $columnId . '"'; //quote the column names! |
217 | 217 | $info['ColumnId'] = $columnId; |
218 | 218 | $info['ColumnIndex'] = $col['index']; |
219 | - if (!$col['attnotnull']) { |
|
219 | + if(!$col['attnotnull']) { |
|
220 | 220 | $info['AllowNull'] = true; |
221 | 221 | } |
222 | - if (in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
222 | + if(in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
223 | 223 | $info['IsPrimaryKey'] = true; |
224 | 224 | } |
225 | - if ($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
225 | + if($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
226 | 226 | $info['IsForeignKey'] = true; |
227 | 227 | } |
228 | 228 | |
229 | - if ($col['atttypmod'] > 0) { |
|
229 | + if($col['atttypmod'] > 0) { |
|
230 | 230 | $info['ColumnSize'] = $col['atttypmod'] - 4; |
231 | 231 | } |
232 | - if ($col['atthasdef']) { |
|
232 | + if($col['atthasdef']) { |
|
233 | 233 | $info['DefaultValue'] = $col['adsrc']; |
234 | 234 | } |
235 | - if ($col['attisserial'] || substr($col['adsrc'], 0, 8) === 'nextval(') { |
|
236 | - if (($sequence = $this->getSequenceName($tableInfo, $col['adsrc'])) !== null) { |
|
235 | + if($col['attisserial'] || substr($col['adsrc'], 0, 8) === 'nextval(') { |
|
236 | + if(($sequence = $this->getSequenceName($tableInfo, $col['adsrc'])) !== null) { |
|
237 | 237 | $info['SequenceName'] = $sequence; |
238 | 238 | unset($info['DefaultValue']); |
239 | 239 | } |
240 | 240 | } |
241 | 241 | $matches = []; |
242 | - if (preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) { |
|
242 | + if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) { |
|
243 | 243 | $info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']); |
244 | - if ($this->isPrecisionType($info['DbType'])) { |
|
244 | + if($this->isPrecisionType($info['DbType'])) { |
|
245 | 245 | $info['NumericPrecision'] = intval($matches[1]); |
246 | - if (count($matches) > 2) { |
|
246 | + if(count($matches) > 2) { |
|
247 | 247 | $info['NumericScale'] = intval($matches[2]); |
248 | 248 | } |
249 | 249 | } else { |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | protected function getSequenceName($tableInfo, $src) |
263 | 263 | { |
264 | 264 | $matches = []; |
265 | - if (preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) { |
|
266 | - if (is_int(strpos($matches[1], '.'))) { |
|
265 | + if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) { |
|
266 | + if(is_int(strpos($matches[1], '.'))) { |
|
267 | 267 | return $matches[1]; |
268 | 268 | } else { |
269 | 269 | return $tableInfo->getSchemaName() . '.' . $matches[1]; |
@@ -341,19 +341,19 @@ discard block |
||
341 | 341 | $command->bindValue(':schema', $schemaName); |
342 | 342 | $primary = []; |
343 | 343 | $foreign = []; |
344 | - foreach ($command->query() as $row) { |
|
345 | - switch ($row['contype']) { |
|
344 | + foreach($command->query() as $row) { |
|
345 | + switch($row['contype']) { |
|
346 | 346 | case 'p': |
347 | 347 | $primary = $this->getPrimaryKeys($tableName, $schemaName, $row['indkey']); |
348 | 348 | break; |
349 | 349 | case 'f': |
350 | - if (($fkey = $this->getForeignKeys($row['consrc'])) !== null) { |
|
350 | + if(($fkey = $this->getForeignKeys($row['consrc'])) !== null) { |
|
351 | 351 | $foreign[] = $fkey; |
352 | 352 | } |
353 | 353 | break; |
354 | 354 | } |
355 | 355 | } |
356 | - return [$primary,$foreign]; |
|
356 | + return [$primary, $foreign]; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $command->bindValue(':schema', $schemaName); |
380 | 380 | // $command->bindValue(':columnIndex', join(', ', explode(' ', $columnIndex))); |
381 | 381 | $primary = []; |
382 | - foreach ($command->query() as $row) { |
|
382 | + foreach($command->query() as $row) { |
|
383 | 383 | $primary[] = $row['attname']; |
384 | 384 | } |
385 | 385 | |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | $matches = []; |
397 | 397 | $brackets = '\(([^\)]+)\)'; |
398 | 398 | $find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i"; |
399 | - if (preg_match($find, $src, $matches)) { |
|
399 | + if(preg_match($find, $src, $matches)) { |
|
400 | 400 | $keys = preg_split('/,\s+/', $matches[1]); |
401 | 401 | $fkeys = []; |
402 | - foreach (preg_split('/,\s+/', $matches[3]) as $i => $fkey) { |
|
402 | + foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) { |
|
403 | 403 | $fkeys[$keys[$i]] = $fkey; |
404 | 404 | } |
405 | 405 | return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys]; |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | */ |
414 | 414 | protected function isForeignKeyColumn($columnId, $tableInfo) |
415 | 415 | { |
416 | - foreach ($tableInfo->getForeignKeys() as $fk) { |
|
417 | - if (in_array($columnId, array_keys($fk['keys']))) { |
|
416 | + foreach($tableInfo->getForeignKeys() as $fk) { |
|
417 | + if(in_array($columnId, array_keys($fk['keys']))) { |
|
418 | 418 | return true; |
419 | 419 | } |
420 | 420 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function findTableNames($schema = 'public') |
431 | 431 | { |
432 | - if ($schema === '') { |
|
432 | + if($schema === '') { |
|
433 | 433 | $schema = self::DEFAULT_SCHEMA; |
434 | 434 | } |
435 | 435 | $sql = <<<EOD |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | $command->bindParam(':schema', $schema); |
441 | 441 | $rows = $command->queryAll(); |
442 | 442 | $names = []; |
443 | - foreach ($rows as $row) { |
|
444 | - if ($schema === self::DEFAULT_SCHEMA) { |
|
443 | + foreach($rows as $row) { |
|
444 | + if($schema === self::DEFAULT_SCHEMA) { |
|
445 | 445 | $names[] = $row['table_name']; |
446 | 446 | } else { |
447 | 447 | $names[] = $row['table_schema'] . '.' . $row['table_name']; |
@@ -56,7 +56,7 @@ |
||
56 | 56 | * @var TActiveRecordInvalidFinderResult |
57 | 57 | * @since 3.1.5 |
58 | 58 | */ |
59 | - private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null; |
|
59 | + private $_invalidFinderResult = TActiveRecordInvalidFinderResult::null; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @return ICache application cache. |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | public static function getInstance($self = null) |
96 | 96 | { |
97 | 97 | static $instance; |
98 | - if ($self !== null) { |
|
98 | + if($self !== null) { |
|
99 | 99 | $instance = $self; |
100 | - } elseif ($instance === null) { |
|
100 | + } elseif($instance === null) { |
|
101 | 101 | $instance = new self; |
102 | 102 | } |
103 | 103 | return $instance; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getRecordGateway() |
110 | 110 | { |
111 | - if ($this->_gateway === null) { |
|
111 | + if($this->_gateway === null) { |
|
112 | 112 | $this->_gateway = $this->createRecordGateway(); |
113 | 113 | } |
114 | 114 | return $this->_gateway; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function setGatewayClass($value) |
130 | 130 | { |
131 | 131 | $this->_gateway = null; |
132 | - $this->_gatewayClass = (string)$value; |
|
132 | + $this->_gatewayClass = (string) $value; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -102,7 +102,7 @@ |
||
102 | 102 | * @var TActiveRecordInvalidFinderResult |
103 | 103 | * @since 3.1.5 |
104 | 104 | */ |
105 | - private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null; |
|
105 | + private $_invalidFinderResult = TActiveRecordInvalidFinderResult::null; |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Initialize the active record manager. |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | parent::init($xml); |
113 | 113 | $manager = $this -> getManager(); |
114 | - if ($this->getEnableCache()) { |
|
114 | + if($this->getEnableCache()) { |
|
115 | 115 | $manager->setCache($this->getApplication()->getCache()); |
116 | 116 | } |
117 | 117 | $manager->setDbConnection($this->getDbConnection()); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getManager() |
126 | 126 | { |
127 | - if ($this->_manager === null) { |
|
127 | + if($this->_manager === null) { |
|
128 | 128 | $this->_manager = Prado::createComponent($this -> getManagerClass()); |
129 | 129 | } |
130 | 130 | return TActiveRecordManager::getInstance($this->_manager); |
@@ -328,7 +328,7 @@ |
||
328 | 328 | { |
329 | 329 | $req = $this->recaptcha_qsencode($data); |
330 | 330 | |
331 | - $http_request = "POST $path HTTP/1.0\r\n"; |
|
331 | + $http_request = "post $path HTTP/1.0\r\n"; |
|
332 | 332 | $http_request .= "Host: $host\r\n"; |
333 | 333 | $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; |
334 | 334 | $http_request .= "Content-Length: " . strlen($req) . "\r\n"; |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | public function getClientSideOptions() |
168 | 168 | { |
169 | 169 | $options = []; |
170 | - if ($theme = $this->getThemeName()) { |
|
170 | + if($theme = $this->getThemeName()) { |
|
171 | 171 | $options['theme'] = $theme; |
172 | 172 | } |
173 | - if ($lang = $this->getLanguage()) { |
|
173 | + if($lang = $this->getLanguage()) { |
|
174 | 174 | $options['lang'] = $lang; |
175 | 175 | } |
176 | - if ($trans = $this->getCustomTranslations()) { |
|
176 | + if($trans = $this->getCustomTranslations()) { |
|
177 | 177 | $options['custom_translations'] = $trans; |
178 | 178 | } |
179 | 179 | return $options; |
@@ -181,8 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | public function validate() |
183 | 183 | { |
184 | - if (! |
|
185 | - ( |
|
184 | + if(!( |
|
186 | 185 | ($challenge = @$_POST[$this->getChallengeFieldName()]) |
187 | 186 | and |
188 | 187 | ($response = @$_POST[$this->getResponseFieldName()]) |
@@ -207,10 +206,10 @@ discard block |
||
207 | 206 | { |
208 | 207 | parent::onPreRender($param); |
209 | 208 | |
210 | - if ("" == $this->getPublicKey()) { |
|
209 | + if("" == $this->getPublicKey()) { |
|
211 | 210 | throw new TConfigurationException('recaptcha_publickey_unknown'); |
212 | 211 | } |
213 | - if ("" == $this->getPrivateKey()) { |
|
212 | + if("" == $this->getPrivateKey()) { |
|
214 | 213 | throw new TConfigurationException('recaptcha_privatekey_unknown'); |
215 | 214 | } |
216 | 215 | |
@@ -230,7 +229,7 @@ discard block |
||
230 | 229 | { |
231 | 230 | // if we're in a callback, then schedule re-rendering of the control |
232 | 231 | // if not, don't do anything, because a new challenge will be rendered anyway |
233 | - if ($this->Page->IsCallback) { |
|
232 | + if($this->Page->IsCallback) { |
|
234 | 233 | $this->Page->CallbackClient->jQuery($this->getClientID() . ' #recaptcha_reload', 'click'); |
235 | 234 | } |
236 | 235 | } |
@@ -243,7 +242,7 @@ discard block |
||
243 | 242 | $divid = $id . '_1_recaptchadiv'; |
244 | 243 | $writer->write('<div id="' . htmlspecialchars($divid) . '">'); |
245 | 244 | |
246 | - if (!$this->Page->IsCallback) { |
|
245 | + if(!$this->Page->IsCallback) { |
|
247 | 246 | $writer->write(TJavaScript::renderScriptBlock( |
248 | 247 | 'var RecaptchaOptions = ' . TJavaScript::jsonEncode($this->getClientSideOptions()) . ';' |
249 | 248 | )); |
@@ -294,7 +293,7 @@ discard block |
||
294 | 293 | { |
295 | 294 | $server = $use_ssl ? self::RECAPTCHA_API_SECURE_SERVER : $server = self::RECAPTCHA_API_SERVER; |
296 | 295 | $errorpart = ''; |
297 | - if ($error) { |
|
296 | + if($error) { |
|
298 | 297 | $errorpart = "&error=" . $error; |
299 | 298 | } |
300 | 299 | |
@@ -314,7 +313,7 @@ discard block |
||
314 | 313 | private function recaptcha_qsencode($data) |
315 | 314 | { |
316 | 315 | $req = ""; |
317 | - foreach ($data as $key => $value) { |
|
316 | + foreach($data as $key => $value) { |
|
318 | 317 | $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
319 | 318 | } |
320 | 319 | |
@@ -344,13 +343,13 @@ discard block |
||
344 | 343 | $http_request .= $req; |
345 | 344 | |
346 | 345 | $response = ''; |
347 | - if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { |
|
346 | + if(false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { |
|
348 | 347 | die('Could not open socket'); |
349 | 348 | } |
350 | 349 | |
351 | 350 | fwrite($fs, $http_request); |
352 | 351 | |
353 | - while (!feof($fs)) { |
|
352 | + while(!feof($fs)) { |
|
354 | 353 | $response .= fgets($fs, 1160); |
355 | 354 | } // One TCP-IP packet |
356 | 355 | fclose($fs); |
@@ -371,7 +370,7 @@ discard block |
||
371 | 370 | private function recaptcha_check_answer($privkey, $remoteip, $challenge, $response, $extra_params = []) |
372 | 371 | { |
373 | 372 | //discard spam submissions |
374 | - if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { |
|
373 | + if($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { |
|
375 | 374 | return false; |
376 | 375 | } |
377 | 376 | |
@@ -388,7 +387,7 @@ discard block |
||
388 | 387 | |
389 | 388 | $answers = explode("\n", $response [1]); |
390 | 389 | |
391 | - if (trim($answers [0]) == 'true') { |
|
390 | + if(trim($answers [0]) == 'true') { |
|
392 | 391 | return true; |
393 | 392 | } else { |
394 | 393 | return false; |
@@ -523,7 +523,7 @@ |
||
523 | 523 | </body> |
524 | 524 | </file> |
525 | 525 | </xliff> |
526 | -EOD; |
|
526 | +eod; |
|
527 | 527 | return $xml; |
528 | 528 | } |
529 | 529 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function __construct($source) |
60 | 60 | { |
61 | - $this->source = (string)$source; |
|
61 | + $this->source = (string) $source; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | protected function &loadData($filename) |
70 | 70 | { |
71 | 71 | //load it. |
72 | - if (false === ($XML = simplexml_load_file($filename))) { |
|
72 | + if(false === ($XML = simplexml_load_file($filename))) { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | $translations = []; |
79 | 79 | |
80 | - foreach ($translationUnit as $unit) { |
|
81 | - $source = (string)$unit->source; |
|
82 | - $translations[$source][] = (string)$unit->target; |
|
83 | - $translations[$source][] = (string)$unit['id']; |
|
84 | - $translations[$source][] = (string)$unit->note; |
|
80 | + foreach($translationUnit as $unit) { |
|
81 | + $source = (string) $unit->source; |
|
82 | + $translations[$source][] = (string) $unit->target; |
|
83 | + $translations[$source][] = (string) $unit['id']; |
|
84 | + $translations[$source][] = (string) $unit->note; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return $translations; |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | $catalogues = [$source]; |
132 | 132 | $variant = null; |
133 | 133 | |
134 | - for ($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
135 | - if (isset($variants[$i]{0})) { |
|
134 | + for($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
135 | + if(isset($variants[$i]{0})) { |
|
136 | 136 | $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
137 | 137 | $catalogues[] = $catalogue . $this->dataSeparator . $variant . $this->dataExt; |
138 | 138 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $catalogues = array_merge($byDir, array_reverse($catalogues)); |
143 | 143 | $files = []; |
144 | 144 | |
145 | - foreach ($catalogues as $file) { |
|
145 | + foreach($catalogues as $file) { |
|
146 | 146 | $files[] = $file; |
147 | 147 | $files[] = preg_replace('/\.xml$/', '.xlf', $file); |
148 | 148 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $catalogues = []; |
164 | 164 | $variant = null; |
165 | 165 | |
166 | - for ($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
167 | - if (isset($variants[$i]{0})) { |
|
166 | + for($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
167 | + if(isset($variants[$i]{0})) { |
|
168 | 168 | $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
169 | 169 | $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
170 | 170 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | $files = scandir($dir); |
197 | 197 | $catalogue = []; |
198 | 198 | |
199 | - foreach ($files as $file) { |
|
200 | - if (is_dir($dir . '/' . $file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) { |
|
199 | + foreach($files as $file) { |
|
200 | + if(is_dir($dir . '/' . $file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) { |
|
201 | 201 | $catalogue = array_merge( |
202 | 202 | $catalogue, |
203 | 203 | $this->getCatalogues($dir . '/' . $file, $file) |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | $pos = strpos($file, $this->dataExt); |
208 | - if ($pos > 0 && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt) { |
|
208 | + if($pos > 0 && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt) { |
|
209 | 209 | $name = substr($file, 0, $pos); |
210 | 210 | $dot = strrpos($name, $this->dataSeparator); |
211 | 211 | $culture = $variant; |
212 | 212 | $cat = $name; |
213 | 213 | |
214 | - if (is_int($dot)) { |
|
214 | + if(is_int($dot)) { |
|
215 | 215 | $culture = substr($name, $dot + 1, strlen($name)); |
216 | 216 | $cat = substr($name, 0, $dot); |
217 | 217 | } |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | */ |
236 | 236 | private function getVariants($catalogue = 'messages') |
237 | 237 | { |
238 | - if ($catalogue === null) { |
|
238 | + if($catalogue === null) { |
|
239 | 239 | $catalogue = 'messages'; |
240 | 240 | } |
241 | 241 | |
242 | - foreach ($this->getCatalogueList($catalogue) as $variant) { |
|
242 | + foreach($this->getCatalogueList($catalogue) as $variant) { |
|
243 | 243 | $file = $this->getSource($variant); |
244 | - if (is_file($file)) { |
|
244 | + if(is_file($file)) { |
|
245 | 245 | return [$variant, $file]; |
246 | 246 | } |
247 | 247 | } |
@@ -258,19 +258,19 @@ discard block |
||
258 | 258 | public function save($catalogue = 'messages') |
259 | 259 | { |
260 | 260 | $messages = $this->untranslated; |
261 | - if (count($messages) <= 0) { |
|
261 | + if(count($messages) <= 0) { |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | 265 | $variants = $this->getVariants($catalogue); |
266 | 266 | |
267 | - if ($variants) { |
|
267 | + if($variants) { |
|
268 | 268 | list($variant, $filename) = $variants; |
269 | 269 | } else { |
270 | 270 | list($variant, $filename) = $this->createMessageTemplate($catalogue); |
271 | 271 | } |
272 | 272 | |
273 | - if (is_writable($filename) == false) { |
|
273 | + if(is_writable($filename) == false) { |
|
274 | 274 | throw new TIOException("Unable to save to file {$filename}, file must be writable."); |
275 | 275 | } |
276 | 276 | |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | $body = $xpath->query('//body')->item(0); |
284 | 284 | |
285 | 285 | $lastNodes = $xpath->query('//trans-unit[last()]'); |
286 | - if (($last = $lastNodes->item(0)) !== null) { |
|
287 | - $count = (int)$last->getAttribute('id'); |
|
286 | + if(($last = $lastNodes->item(0)) !== null) { |
|
287 | + $count = (int) $last->getAttribute('id'); |
|
288 | 288 | } else { |
289 | 289 | $count = 0; |
290 | 290 | } |
291 | 291 | |
292 | 292 | //for each message add it to the XML file using DOM |
293 | - foreach ($messages as $message) { |
|
293 | + foreach($messages as $message) { |
|
294 | 294 | $unit = $dom->createElement('trans-unit'); |
295 | 295 | $unit->setAttribute('id', ++$count); |
296 | 296 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | //save it and clear the cache for this variant |
319 | 319 | $dom->save($filename); |
320 | - if (!empty($this->cache)) { |
|
320 | + if(!empty($this->cache)) { |
|
321 | 321 | $this->cache->clean($variant, $this->culture); |
322 | 322 | } |
323 | 323 | |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | { |
337 | 337 | $variants = $this->getVariants($catalogue); |
338 | 338 | |
339 | - if ($variants) { |
|
339 | + if($variants) { |
|
340 | 340 | list($variant, $filename) = $variants; |
341 | 341 | } else { |
342 | 342 | return false; |
343 | 343 | } |
344 | 344 | |
345 | - if (is_writable($filename) == false) { |
|
345 | + if(is_writable($filename) == false) { |
|
346 | 346 | throw new TIOException("Unable to update file {$filename}, file must be writable."); |
347 | 347 | } |
348 | 348 | |
@@ -354,29 +354,29 @@ discard block |
||
354 | 354 | $units = $xpath->query('//trans-unit'); |
355 | 355 | |
356 | 356 | //for each of the existin units |
357 | - foreach ($units as $unit) { |
|
357 | + foreach($units as $unit) { |
|
358 | 358 | $found = false; |
359 | 359 | $targetted = false; |
360 | 360 | $commented = false; |
361 | 361 | |
362 | 362 | //in each unit, need to find the source, target and comment nodes |
363 | 363 | //it will assume that the source is before the target. |
364 | - foreach ($unit->childNodes as $node) { |
|
364 | + foreach($unit->childNodes as $node) { |
|
365 | 365 | //source node |
366 | - if ($node->nodeName == 'source' && $node->firstChild->wholeText == $text) { |
|
366 | + if($node->nodeName == 'source' && $node->firstChild->wholeText == $text) { |
|
367 | 367 | $found = true; |
368 | 368 | } |
369 | 369 | |
370 | 370 | //found source, get the target and notes |
371 | - if ($found) { |
|
371 | + if($found) { |
|
372 | 372 | //set the new translated string |
373 | - if ($node->nodeName == 'target') { |
|
373 | + if($node->nodeName == 'target') { |
|
374 | 374 | $node->nodeValue = $target; |
375 | 375 | $targetted = true; |
376 | 376 | } |
377 | 377 | |
378 | 378 | //set the notes |
379 | - if (!empty($comments) && $node->nodeName == 'note') { |
|
379 | + if(!empty($comments) && $node->nodeName == 'note') { |
|
380 | 380 | $node->nodeValue = $comments; |
381 | 381 | $commented = true; |
382 | 382 | } |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | //append a target |
387 | - if ($found && !$targetted) { |
|
387 | + if($found && !$targetted) { |
|
388 | 388 | $unit->appendChild($dom->createElement('target', $target)); |
389 | 389 | } |
390 | 390 | |
391 | 391 | //append a note |
392 | - if ($found && !$commented && !empty($comments)) { |
|
392 | + if($found && !$commented && !empty($comments)) { |
|
393 | 393 | $unit->appendChild($dom->createElement('note', $comments)); |
394 | 394 | } |
395 | 395 | |
396 | 396 | //finished searching |
397 | - if ($found) { |
|
397 | + if($found) { |
|
398 | 398 | break; |
399 | 399 | } |
400 | 400 | } |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | $fileNode = $xpath->query('//file')->item(0); |
403 | 403 | $fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z')); |
404 | 404 | |
405 | - if ($dom->save($filename) > 0) { |
|
406 | - if (!empty($this->cache)) { |
|
405 | + if($dom->save($filename) > 0) { |
|
406 | + if(!empty($this->cache)) { |
|
407 | 407 | $this->cache->clean($variant, $this->culture); |
408 | 408 | } |
409 | 409 | |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | public function delete($message, $catalogue = 'messages') |
423 | 423 | { |
424 | 424 | $variants = $this->getVariants($catalogue); |
425 | - if ($variants) { |
|
425 | + if($variants) { |
|
426 | 426 | list($variant, $filename) = $variants; |
427 | 427 | } else { |
428 | 428 | return false; |
429 | 429 | } |
430 | 430 | |
431 | - if (is_writable($filename) == false) { |
|
431 | + if(is_writable($filename) == false) { |
|
432 | 432 | throw new TIOException("Unable to modify file {$filename}, file must be writable."); |
433 | 433 | } |
434 | 434 | |
@@ -440,19 +440,19 @@ discard block |
||
440 | 440 | $units = $xpath->query('//trans-unit'); |
441 | 441 | |
442 | 442 | //for each of the existin units |
443 | - foreach ($units as $unit) { |
|
443 | + foreach($units as $unit) { |
|
444 | 444 | //in each unit, need to find the source, target and comment nodes |
445 | 445 | //it will assume that the source is before the target. |
446 | - foreach ($unit->childNodes as $node) { |
|
446 | + foreach($unit->childNodes as $node) { |
|
447 | 447 | //source node |
448 | - if ($node->nodeName == 'source' && $node->firstChild->wholeText == $message) { |
|
448 | + if($node->nodeName == 'source' && $node->firstChild->wholeText == $message) { |
|
449 | 449 | //we found it, remove and save the xml file. |
450 | 450 | $unit->parentNode->removeChild($unit); |
451 | 451 | $fileNode = $xpath->query('//file')->item(0); |
452 | 452 | $fileNode->setAttribute('date', @date('Y-m-d\TH:i:s\Z')); |
453 | 453 | |
454 | - if (false !== $dom->save($filename)) { |
|
455 | - if (!empty($this->cache)) { |
|
454 | + if(false !== $dom->save($filename)) { |
|
455 | + if(!empty($this->cache)) { |
|
456 | 456 | $this->cache->clean($variant, $this->culture); |
457 | 457 | } |
458 | 458 | return true; |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | protected function createMessageTemplate($catalogue) |
470 | 470 | { |
471 | - if ($catalogue === null) { |
|
471 | + if($catalogue === null) { |
|
472 | 472 | $catalogue = 'messages'; |
473 | 473 | } |
474 | 474 | |
@@ -477,12 +477,12 @@ discard block |
||
477 | 477 | $file = $this->getSource($variant); |
478 | 478 | $dir = dirname($file); |
479 | 479 | |
480 | - if (!is_dir($dir)) { |
|
480 | + if(!is_dir($dir)) { |
|
481 | 481 | @mkdir($dir); |
482 | 482 | @chmod($dir, PRADO_CHMOD); |
483 | 483 | } |
484 | 484 | |
485 | - if (!is_dir($dir)) { |
|
485 | + if(!is_dir($dir)) { |
|
486 | 486 | throw new TException("Unable to create directory $dir"); |
487 | 487 | } |
488 | 488 |
@@ -126,7 +126,7 @@ |
||
126 | 126 | public static function poFile2moFile($pofile, $mofile) |
127 | 127 | { |
128 | 128 | if (!is_file($pofile)) { |
129 | - throw new Exception("File $pofile doesn't exist."); |
|
129 | + throw new Exception("file $pofile doesn't exist."); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | include_once dirname(__FILE__) . '/PO.php'; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | $format = strToUpper($format); |
104 | 104 | $filename = dirname(__FILE__) . '/' . $format . '.php'; |
105 | - if (is_file($filename) == false) { |
|
105 | + if(is_file($filename) == false) { |
|
106 | 106 | throw new Exception("Class file $file not found"); |
107 | 107 | } |
108 | 108 | |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public static function poFile2moFile($pofile, $mofile) |
128 | 128 | { |
129 | - if (!is_file($pofile)) { |
|
129 | + if(!is_file($pofile)) { |
|
130 | 130 | throw new Exception("File $pofile doesn't exist."); |
131 | 131 | } |
132 | 132 | |
133 | 133 | include_once dirname(__FILE__) . '/PO.php'; |
134 | 134 | |
135 | 135 | $PO = new TGettext_PO($pofile); |
136 | - if (true !== ($e = $PO->load())) { |
|
136 | + if(true !== ($e = $PO->load())) { |
|
137 | 137 | return $e; |
138 | 138 | } |
139 | 139 | |
140 | 140 | $MO = $PO->toMO(); |
141 | - if (true !== ($e = $MO->save($mofile))) { |
|
141 | + if(true !== ($e = $MO->save($mofile))) { |
|
142 | 142 | return $e; |
143 | 143 | } |
144 | 144 | unset($PO, $MO); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public static function prepare($string, $reverse = false) |
159 | 159 | { |
160 | - if ($reverse) { |
|
160 | + if($reverse) { |
|
161 | 161 | $smap = ['"', "\n", "\t", "\r"]; |
162 | 162 | $rmap = ['\"', '\\n"' . "\n" . '"', '\\t', '\\r']; |
163 | 163 | return (string) str_replace($smap, $rmap, $string); |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | public static function meta2array($meta) |
181 | 181 | { |
182 | 182 | $array = []; |
183 | - foreach (explode("\n", $meta) as $info) { |
|
184 | - if ($info = trim($info)) { |
|
183 | + foreach(explode("\n", $meta) as $info) { |
|
184 | + if($info = trim($info)) { |
|
185 | 185 | list($key, $value) = explode(':', $info, 2); |
186 | 186 | $array[trim($key)] = trim($value); |
187 | 187 | } |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function fromArray($array) |
247 | 247 | { |
248 | - if (!array_key_exists('strings', $array)) { |
|
249 | - if (count($array) != 2) { |
|
248 | + if(!array_key_exists('strings', $array)) { |
|
249 | + if(count($array) != 2) { |
|
250 | 250 | return false; |
251 | 251 | } else { |
252 | 252 | list($this->meta, $this->strings) = $array; |
@@ -418,7 +418,7 @@ |
||
418 | 418 | 'trans-unit' => array( |
419 | 419 | ) |
420 | 420 | ); |
421 | -EOD; |
|
421 | +eod; |
|
422 | 422 | return $php; |
423 | 423 | } |
424 | 424 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function __construct($source) |
57 | 57 | { |
58 | - $this->source = (string)$source; |
|
58 | + $this->source = (string) $source; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | protected function &loadData($filename) |
67 | 67 | { |
68 | 68 | //load it. |
69 | - if (false === ($php = include($filename))) { |
|
69 | + if(false === ($php = include($filename))) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | |
75 | 75 | $translations = []; |
76 | 76 | |
77 | - foreach ($translationUnit as $k => $unit) { |
|
78 | - $source = (string)$unit['source']; |
|
79 | - $translations[$source][] = (string)$unit['target']; |
|
80 | - $translations[$source][] = (string)$k; |
|
81 | - $translations[$source][] = array_key_exists('note', $unit) ? (string)$unit['note'] : ''; |
|
77 | + foreach($translationUnit as $k => $unit) { |
|
78 | + $source = (string) $unit['source']; |
|
79 | + $translations[$source][] = (string) $unit['target']; |
|
80 | + $translations[$source][] = (string) $k; |
|
81 | + $translations[$source][] = array_key_exists('note', $unit) ? (string) $unit['note'] : ''; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $translations; |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | $catalogues = [$source]; |
129 | 129 | $variant = null; |
130 | 130 | |
131 | - for ($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
132 | - if (isset($variants[$i]{0})) { |
|
131 | + for($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
132 | + if(isset($variants[$i]{0})) { |
|
133 | 133 | $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
134 | 134 | $catalogues[] = $catalogue . $this->dataSeparator . $variant . $this->dataExt; |
135 | 135 | } |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | $catalogues = []; |
153 | 153 | $variant = null; |
154 | 154 | |
155 | - for ($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
156 | - if (isset($variants[$i]{0})) { |
|
155 | + for($i = 0, $k = count($variants); $i < $k; ++$i) { |
|
156 | + if(isset($variants[$i]{0})) { |
|
157 | 157 | $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
158 | 158 | $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
159 | 159 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | $files = scandir($dir); |
186 | 186 | $catalogue = []; |
187 | 187 | |
188 | - foreach ($files as $file) { |
|
189 | - if (is_dir($dir . '/' . $file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) { |
|
188 | + foreach($files as $file) { |
|
189 | + if(is_dir($dir . '/' . $file) && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) { |
|
190 | 190 | $catalogue = array_merge( |
191 | 191 | $catalogue, |
192 | 192 | $this->getCatalogues($dir . '/' . $file, $file) |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | $pos = strpos($file, $this->dataExt); |
197 | - if ($pos > 0 && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt) { |
|
197 | + if($pos > 0 && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt) { |
|
198 | 198 | $name = substr($file, 0, $pos); |
199 | 199 | $dot = strrpos($name, $this->dataSeparator); |
200 | 200 | $culture = $variant; |
201 | 201 | $cat = $name; |
202 | 202 | |
203 | - if (is_int($dot)) { |
|
203 | + if(is_int($dot)) { |
|
204 | 204 | $culture = substr($name, $dot + 1, strlen($name)); |
205 | 205 | $cat = substr($name, 0, $dot); |
206 | 206 | } |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | */ |
225 | 225 | private function getVariants($catalogue = 'messages') |
226 | 226 | { |
227 | - if ($catalogue === null) { |
|
227 | + if($catalogue === null) { |
|
228 | 228 | $catalogue = 'messages'; |
229 | 229 | } |
230 | 230 | |
231 | - foreach ($this->getCatalogueList($catalogue) as $variant) { |
|
231 | + foreach($this->getCatalogueList($catalogue) as $variant) { |
|
232 | 232 | $file = $this->getSource($variant); |
233 | - if (is_file($file)) { |
|
233 | + if(is_file($file)) { |
|
234 | 234 | return [$variant, $file]; |
235 | 235 | } |
236 | 236 | } |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | $php['info']['date'] = @date('Y-m-d\TH:i:s\Z'); |
243 | 243 | |
244 | 244 | //save it and clear the cache for this variant |
245 | - if (false === file_put_contents($filename, "<?php\nreturn " . var_export($php, true) . ';')) { |
|
245 | + if(false === file_put_contents($filename, "<?php\nreturn " . var_export($php, true) . ';')) { |
|
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | |
249 | - if (!empty($this->cache)) { |
|
249 | + if(!empty($this->cache)) { |
|
250 | 250 | $this->cache->clean($variant, $this->culture); |
251 | 251 | } |
252 | 252 | |
@@ -263,19 +263,19 @@ discard block |
||
263 | 263 | public function save($catalogue = 'messages') |
264 | 264 | { |
265 | 265 | $messages = $this->untranslated; |
266 | - if (count($messages) <= 0) { |
|
266 | + if(count($messages) <= 0) { |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | |
270 | 270 | $variants = $this->getVariants($catalogue); |
271 | 271 | |
272 | - if ($variants) { |
|
272 | + if($variants) { |
|
273 | 273 | list($variant, $filename) = $variants; |
274 | 274 | } else { |
275 | 275 | list($variant, $filename) = $this->createMessageTemplate($catalogue); |
276 | 276 | } |
277 | 277 | |
278 | - if (is_writable($filename) == false) { |
|
278 | + if(is_writable($filename) == false) { |
|
279 | 279 | throw new TIOException("Unable to save to file {$filename}, file must be writable."); |
280 | 280 | } |
281 | 281 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $php = include($filename); |
284 | 284 | |
285 | 285 | //for each message add it to the XML file using DOM |
286 | - foreach ($messages as $message) { |
|
286 | + foreach($messages as $message) { |
|
287 | 287 | $php['trans-unit'][] = [ |
288 | 288 | 'source' => $message, |
289 | 289 | 'target' => '', |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | { |
306 | 306 | $variants = $this->getVariants($catalogue); |
307 | 307 | |
308 | - if ($variants) { |
|
308 | + if($variants) { |
|
309 | 309 | list($variant, $filename) = $variants; |
310 | 310 | } else { |
311 | 311 | return false; |
312 | 312 | } |
313 | 313 | |
314 | - if (is_writable($filename) == false) { |
|
314 | + if(is_writable($filename) == false) { |
|
315 | 315 | throw new TIOException("Unable to update file {$filename}, file must be writable."); |
316 | 316 | } |
317 | 317 | |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | $php = include($filename); |
320 | 320 | |
321 | 321 | //for each of the existin units |
322 | - foreach ($php['trans-unit'] as $k => $unit) { |
|
323 | - if ($unit['source'] == $text) { |
|
322 | + foreach($php['trans-unit'] as $k => $unit) { |
|
323 | + if($unit['source'] == $text) { |
|
324 | 324 | $php['trans-unit'][$k]['target'] = $target; |
325 | - if (!empty($comments)) { |
|
325 | + if(!empty($comments)) { |
|
326 | 326 | $php['trans-unit'][$k]['note'] = $comments; |
327 | 327 | } |
328 | 328 | |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | public function delete($message, $catalogue = 'messages') |
343 | 343 | { |
344 | 344 | $variants = $this->getVariants($catalogue); |
345 | - if ($variants) { |
|
345 | + if($variants) { |
|
346 | 346 | list($variant, $filename) = $variants; |
347 | 347 | } else { |
348 | 348 | return false; |
349 | 349 | } |
350 | 350 | |
351 | - if (is_writable($filename) == false) { |
|
351 | + if(is_writable($filename) == false) { |
|
352 | 352 | throw new TIOException("Unable to modify file {$filename}, file must be writable."); |
353 | 353 | } |
354 | 354 | |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | $php = include($filename); |
357 | 357 | |
358 | 358 | //for each of the existin units |
359 | - foreach ($php['trans-unit'] as $k => $unit) { |
|
360 | - if ($unit['source'] == $message) { |
|
359 | + foreach($php['trans-unit'] as $k => $unit) { |
|
360 | + if($unit['source'] == $message) { |
|
361 | 361 | unset($php['trans-unit'][$k]); |
362 | 362 | return $this->internalSaveFile($php, $filename, $variant); |
363 | 363 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | protected function createMessageTemplate($catalogue) |
370 | 370 | { |
371 | - if ($catalogue === null) { |
|
371 | + if($catalogue === null) { |
|
372 | 372 | $catalogue = 'messages'; |
373 | 373 | } |
374 | 374 | |
@@ -377,12 +377,12 @@ discard block |
||
377 | 377 | $file = $this->getSource($variant); |
378 | 378 | $dir = dirname($file); |
379 | 379 | |
380 | - if (!is_dir($dir)) { |
|
380 | + if(!is_dir($dir)) { |
|
381 | 381 | @mkdir($dir); |
382 | 382 | @chmod($dir, PRADO_CHMOD); |
383 | 383 | } |
384 | 384 | |
385 | - if (!is_dir($dir)) { |
|
385 | + if(!is_dir($dir)) { |
|
386 | 386 | throw new TException("Unable to create directory $dir"); |
387 | 387 | } |
388 | 388 |