@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function setForce($force = false) |
82 | 82 | { |
83 | - $this->force = (bool) $force; |
|
83 | + $this->force = (bool)$force; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $prefix = \XoopsBaseConfig::get('db-prefix'); |
137 | 137 | if ($tablename != '') { |
138 | - return $prefix . '_' . $tablename; |
|
138 | + return $prefix.'_'.$tablename; |
|
139 | 139 | } else { |
140 | 140 | return $prefix; |
141 | 141 | } |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | $events->triggerEvent('core.database.query.end'); |
258 | 258 | } else { |
259 | 259 | //$events->triggerEvent('core.database.query.failure', (array('Not safe:'))); |
260 | - return (int) 0; |
|
260 | + return (int)0; |
|
261 | 261 | } |
262 | 262 | if ($result != 0) { |
263 | 263 | //$events->triggerEvent('core.database.query.success', (array($query))); |
264 | - return (int) $result; |
|
264 | + return (int)$result; |
|
265 | 265 | } else { |
266 | 266 | //$events->triggerEvent('core.database.query.failure', (array($query))); |
267 | - return (int) 0; |
|
267 | + return (int)0; |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $result = call_user_func_array(array('parent', 'query'), func_get_args()); |
332 | 332 | } catch (\Exception $e) { |
333 | 333 | $events->triggerEvent('core.exception', $e); |
334 | - $result=null; |
|
334 | + $result = null; |
|
335 | 335 | } |
336 | 336 | $events->triggerEvent('core.database.query.end'); |
337 | 337 | if ($result) { |
@@ -105,7 +105,7 @@ |
||
105 | 105 | public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) |
106 | 106 | { |
107 | 107 | if (!isset($this->schemaArray['tables'][$localTable->getName()]['constraint'])) { |
108 | - $this->schemaArray['tables'][$localTable->getName()]['constraint']=array(); |
|
108 | + $this->schemaArray['tables'][$localTable->getName()]['constraint'] = array(); |
|
109 | 109 | } |
110 | 110 | $this->schemaArray['tables'][$localTable->getName()]['constraint'][] = array( |
111 | 111 | 'name' => $fkConstraint->getName(), |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * constructor |
43 | 43 | */ |
44 | - public function __construct(array $tables=array(), array $sequences=array(), SchemaConfig $schemaConfig=null) |
|
44 | + public function __construct(array $tables = array(), array $sequences = array(), SchemaConfig $schemaConfig = null) |
|
45 | 45 | { |
46 | - $this->xPrefix = strtolower(\XoopsBaseConfig::get('db-prefix') . '_'); |
|
46 | + $this->xPrefix = strtolower(\XoopsBaseConfig::get('db-prefix').'_'); |
|
47 | 47 | $this->xDbName = strtolower(\XoopsBaseConfig::get('db-name')); |
48 | 48 | parent::__construct($tables, $sequences, $schemaConfig); |
49 | 49 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | try { |
76 | 76 | $name = $table->getName(); |
77 | 77 | $len = strlen($this->xPrefix); |
78 | - if (substr_compare($name, $this->xPrefix, 0, $len)===0) { |
|
78 | + if (substr_compare($name, $this->xPrefix, 0, $len) === 0) { |
|
79 | 79 | $name = substr($name, $len); |
80 | 80 | if (empty($this->tableList) || in_array($name, $this->tableList)) { |
81 | 81 | $idGeneratorType = 0; // how should we handle this? |
@@ -120,8 +120,8 @@ |
||
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - if (isset($tabledef['options'])) |
|
124 | - $options = $tabledef['options']; |
|
123 | + if (isset($tabledef['options'])) |
|
124 | + $options = $tabledef['options']; |
|
125 | 125 | $tables[] = new Table( |
126 | 126 | $tableName, |
127 | 127 | $columns, |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() |
45 | 45 | { |
46 | - $this->xPrefix = strtolower(\XoopsBaseConfig::get('db-prefix') . '_'); |
|
46 | + $this->xPrefix = strtolower(\XoopsBaseConfig::get('db-prefix').'_'); |
|
47 | 47 | $this->xDbName = strtolower(\XoopsBaseConfig::get('db-name')); |
48 | 48 | } |
49 | 49 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function importTables(array $tableArray) |
83 | 83 | { |
84 | - $tables=array(); |
|
84 | + $tables = array(); |
|
85 | 85 | foreach ($tableArray as $name => $tabledef) { |
86 | 86 | //echo '<h2>Table: ' . $name . '</h2>'; |
87 | 87 | //Debug::dump($tabledef); |
88 | - $tableName = $this->xPrefix . $name; |
|
88 | + $tableName = $this->xPrefix.$name; |
|
89 | 89 | $columns = array(); |
90 | 90 | $indexes = array(); |
91 | 91 | $fkConstraints = array(); |
@@ -120,8 +120,9 @@ |
||
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - if (isset($tabledef['options'])) |
|
124 | - $options = $tabledef['options']; |
|
123 | + if (isset($tabledef['options'])) { |
|
124 | + $options = $tabledef['options']; |
|
125 | + } |
|
125 | 126 | $tables[] = new Table( |
126 | 127 | $tableName, |
127 | 128 | $columns, |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | static $instance; |
53 | 53 | if (!isset($instance)) { |
54 | - $xoops = \Xoops::getInstance(); |
|
54 | + $xoops = \Xoops::getInstance(); |
|
55 | 55 | $config = new \Doctrine\DBAL\Configuration(); |
56 | 56 | $config->setSQLLogger(new XoopsDebugStack()); |
57 | 57 | $parameters = \XoopsBaseConfig::get('db-parameters'); |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | 'wrapperClass' => '\Xoops\Core\Database\Connection', |
71 | 71 | ); |
72 | 72 | // Support for other doctrine databases |
73 | - $xoops_db_port = \XoopsBaseConfig::get('db-port'); |
|
73 | + $xoops_db_port = \XoopsBaseConfig::get('db-port'); |
|
74 | 74 | if (!empty($xoops_db_port)) { |
75 | 75 | $connectionParams['port'] = $xoops_db_port; |
76 | 76 | } |
77 | - $xoops_db_socket = \XoopsBaseConfig::get('db-socket'); |
|
77 | + $xoops_db_socket = \XoopsBaseConfig::get('db-socket'); |
|
78 | 78 | if (!empty($xoops_db_socket)) { |
79 | 79 | $connectionParams['unix_socket'] = $xoops_db_socket; |
80 | 80 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $connectionParams = $parameters; |
60 | 60 | $connectionParams['wrapperClass'] = '\Xoops\Core\Database\Connection'; |
61 | 61 | } else { |
62 | - $driver = 'pdo_' . \XoopsBaseConfig::get('db-type'); |
|
62 | + $driver = 'pdo_'.\XoopsBaseConfig::get('db-type'); |
|
63 | 63 | $connectionParams = array( |
64 | 64 | 'dbname' => \XoopsBaseConfig::get('db-name'), |
65 | 65 | 'user' => \XoopsBaseConfig::get('db-user'), |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | $assetsPrefs = $xoops->cache()->read($this->assetsPrefsCacheKey); |
132 | 132 | $file = $xoops->path($this->assetsPrefsFilename); |
133 | 133 | $mtime = filemtime($file); |
134 | - if ($assetsPrefs===false || !isset($assetsPrefs['mtime']) || !$mtime |
|
135 | - || (isset($assetsPrefs['mtime']) && $assetsPrefs['mtime']<$mtime)) { |
|
134 | + if ($assetsPrefs === false || !isset($assetsPrefs['mtime']) || !$mtime |
|
135 | + || (isset($assetsPrefs['mtime']) && $assetsPrefs['mtime'] < $mtime)) { |
|
136 | 136 | if ($mtime) { |
137 | 137 | $assetsPrefs = Yaml::read($file); |
138 | 138 | if (!is_array($assetsPrefs)) { |
139 | 139 | $xoops->logger()->error("Invalid config in system_assets_prefs.yml"); |
140 | 140 | $assetsPrefs = array(); |
141 | 141 | } else { |
142 | - $assetsPrefs['mtime']=$mtime; |
|
142 | + $assetsPrefs['mtime'] = $mtime; |
|
143 | 143 | $xoops->cache()->write($this->assetsPrefsCacheKey, $assetsPrefs); |
144 | 144 | $this->copyBaseFileAssets(); |
145 | 145 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $assets = array($assets); // just a single path name |
213 | 213 | } |
214 | 214 | |
215 | - if ($filters==='default') { |
|
215 | + if ($filters === 'default') { |
|
216 | 216 | if (isset($this->default_filters[$type])) { |
217 | 217 | $filters = $this->default_filters[$type]; |
218 | 218 | } else { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $filters |
312 | 312 | ); |
313 | 313 | $asset_path = $asset->getTargetPath(); |
314 | - if (!is_readable($target_path . $asset_path)) { |
|
314 | + if (!is_readable($target_path.$asset_path)) { |
|
315 | 315 | $assetKey = 'Asset '.$asset_path; |
316 | 316 | $xoops->events()->triggerEvent('debug.timer.start', $assetKey); |
317 | 317 | $oldumask = umask(0002); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $xoops->events()->triggerEvent('debug.timer.stop', $assetKey); |
321 | 321 | } |
322 | 322 | |
323 | - return $xoops->url('assets/' . $asset_path); |
|
323 | + return $xoops->url('assets/'.$asset_path); |
|
324 | 324 | |
325 | 325 | } catch (\Exception $e) { |
326 | 326 | $xoops->events()->triggerEvent('core.exception', $e); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | try { |
362 | 362 | if (is_scalar($assets)) { |
363 | - $assets = array($assets); // just a single path name |
|
363 | + $assets = array($assets); // just a single path name |
|
364 | 364 | } |
365 | 365 | foreach ($assets as $a) { |
366 | 366 | // translate path if not a reference or absolute path |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | && (substr_compare($a, '/', 0, 1) != 0)) { |
369 | 369 | $a = $xoops->path($a); |
370 | 370 | } |
371 | - if (false===strpos($a, '*')) { |
|
371 | + if (false === strpos($a, '*')) { |
|
372 | 372 | $assetArray[] = new FileAsset($a); // single file |
373 | 373 | } else { |
374 | - $assetArray[] = new GlobAsset($a); // wild card match |
|
374 | + $assetArray[] = new GlobAsset($a); // wild card match |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | { |
453 | 453 | $xoops = \Xoops::getInstance(); |
454 | 454 | |
455 | - $fromPath = $xoops->path($fromPath) . '/'; |
|
456 | - $toPath = $xoops->path('assets') . '/' . $output . '/'; |
|
457 | - $from = glob($fromPath . '/' . $pattern); |
|
455 | + $fromPath = $xoops->path($fromPath).'/'; |
|
456 | + $toPath = $xoops->path('assets').'/'.$output.'/'; |
|
457 | + $from = glob($fromPath.'/'.$pattern); |
|
458 | 458 | |
459 | 459 | if (!is_dir($toPath)) { |
460 | 460 | $oldUmask = umask(0); |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | foreach ($from as $filepath) { |
469 | 469 | $xoops->events()->triggerEvent('debug.timer.start', $filepath); |
470 | 470 | $filename = basename($filepath); |
471 | - $status=copy($filepath, $toPath.$filename); |
|
472 | - if (false===$status) { |
|
471 | + $status = copy($filepath, $toPath.$filename); |
|
472 | + if (false === $status) { |
|
473 | 473 | $xoops->logger()->warning('Failed to copy asset '.$filename); |
474 | 474 | } else { |
475 | 475 | //$xoops->logger()->debug('Copied asset '.$filename); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | umask($oldUmask); |
481 | 481 | return $count; |
482 | 482 | } else { |
483 | - $xoops->logger()->warning('Asset directory is not writable. ' . $output); |
|
483 | + $xoops->logger()->warning('Asset directory is not writable. '.$output); |
|
484 | 484 | return false; |
485 | 485 | } |
486 | 486 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | switch ($count) { |
24 | 24 | case 1: |
25 | - return (string) ((int) $value->format('Y')); |
|
25 | + return (string)((int)$value->format('Y')); |
|
26 | 26 | case 2: |
27 | 27 | //return $value->format('y'); |
28 | 28 | default: |
@@ -39,34 +39,34 @@ |
||
39 | 39 | class LegacyCodes |
40 | 40 | { |
41 | 41 | private static $rawCodes = array( |
42 | - ['ar_SA', 'ar', 'ar-Arab-SA', ['arabic']], |
|
43 | - ['bg_BG', 'bg', 'bg-Cyrl-BG', ['bulgarian']], |
|
44 | - ['cs_CZ', 'cs', 'cs-Latn-CZ', ['czech']], |
|
45 | - ['da_DK', 'da', 'da-Latn-DK', ['danish']], |
|
46 | - ['de_DE', 'de', 'de-Latn-DE', ['german']], |
|
47 | - ['el_GR', 'el', 'el-Grek-GR', ['greek']], |
|
48 | - ['en_US', 'en', 'en-Latn-US', ['english']], |
|
49 | - ['es_ES', 'es', 'es-Latn-ES', ['spanish']], |
|
50 | - ['fa_IR', 'fa', 'fa-Arab-IR', ['persian']], |
|
51 | - ['fr_FR', 'fr', 'fr-Latn-FR', ['french']], |
|
52 | - ['hr_HR', 'hr', 'hr-Latn-HR', ['croatian']], |
|
53 | - ['hu_HU', 'hu', 'hu-Latn-HU', ['hungarian']], |
|
54 | - ['it_IT', 'it', 'it-Latn-IT', ['italian']], |
|
55 | - ['ja_JP', 'ja', 'ja-Jpan-JP', ['japanese']], |
|
56 | - ['ko_KR', 'ko', 'ko-Kore-KR', ['korean']], |
|
57 | - ['ms_MY', 'ms', 'ms-Latn-MY', ['malaysian']], |
|
58 | - ['nl_NL', 'nl', 'nl-Latn-NL', ['dutch']], |
|
59 | - ['no_NO', 'no', 'no-Latn-NO', ['norwegian']], |
|
60 | - ['pl_PL', 'pl', 'pl-Latn-PL', ['polish']], |
|
61 | - ['pt_BR', 'pt', 'pt-Latn-BR', ['portuguesebr', 'brazilian']], |
|
62 | - ['pt_PT', 'pt_PT', 'pt-Latn-PT', ['portuguese']], |
|
63 | - ['ru_RU', 'ru', 'ru-Cyrl-RU', ['russian']], |
|
64 | - ['sk_SK', 'sk', 'sk-Latn-SK', ['slovak']], |
|
65 | - ['sl_SI', 'sl', 'sl-Latn-SI', ['slovenian']], |
|
66 | - ['sv_SE', 'sv', 'sv-Latn-SE', ['swedish']], |
|
67 | - ['th_TH', 'th', 'th-Thai-TH', ['thai']], |
|
68 | - ['tr_TR', 'tr', 'tr-Latn-TR', ['turkish']], |
|
69 | - ['vi_VN', 'vi', 'vi-Latn-VN', ['vietnamese']], |
|
42 | + ['ar_SA', 'ar', 'ar-Arab-SA', ['arabic']], |
|
43 | + ['bg_BG', 'bg', 'bg-Cyrl-BG', ['bulgarian']], |
|
44 | + ['cs_CZ', 'cs', 'cs-Latn-CZ', ['czech']], |
|
45 | + ['da_DK', 'da', 'da-Latn-DK', ['danish']], |
|
46 | + ['de_DE', 'de', 'de-Latn-DE', ['german']], |
|
47 | + ['el_GR', 'el', 'el-Grek-GR', ['greek']], |
|
48 | + ['en_US', 'en', 'en-Latn-US', ['english']], |
|
49 | + ['es_ES', 'es', 'es-Latn-ES', ['spanish']], |
|
50 | + ['fa_IR', 'fa', 'fa-Arab-IR', ['persian']], |
|
51 | + ['fr_FR', 'fr', 'fr-Latn-FR', ['french']], |
|
52 | + ['hr_HR', 'hr', 'hr-Latn-HR', ['croatian']], |
|
53 | + ['hu_HU', 'hu', 'hu-Latn-HU', ['hungarian']], |
|
54 | + ['it_IT', 'it', 'it-Latn-IT', ['italian']], |
|
55 | + ['ja_JP', 'ja', 'ja-Jpan-JP', ['japanese']], |
|
56 | + ['ko_KR', 'ko', 'ko-Kore-KR', ['korean']], |
|
57 | + ['ms_MY', 'ms', 'ms-Latn-MY', ['malaysian']], |
|
58 | + ['nl_NL', 'nl', 'nl-Latn-NL', ['dutch']], |
|
59 | + ['no_NO', 'no', 'no-Latn-NO', ['norwegian']], |
|
60 | + ['pl_PL', 'pl', 'pl-Latn-PL', ['polish']], |
|
61 | + ['pt_BR', 'pt', 'pt-Latn-BR', ['portuguesebr', 'brazilian']], |
|
62 | + ['pt_PT', 'pt_PT', 'pt-Latn-PT', ['portuguese']], |
|
63 | + ['ru_RU', 'ru', 'ru-Cyrl-RU', ['russian']], |
|
64 | + ['sk_SK', 'sk', 'sk-Latn-SK', ['slovak']], |
|
65 | + ['sl_SI', 'sl', 'sl-Latn-SI', ['slovenian']], |
|
66 | + ['sv_SE', 'sv', 'sv-Latn-SE', ['swedish']], |
|
67 | + ['th_TH', 'th', 'th-Thai-TH', ['thai']], |
|
68 | + ['tr_TR', 'tr', 'tr-Latn-TR', ['turkish']], |
|
69 | + ['vi_VN', 'vi', 'vi-Latn-VN', ['vietnamese']], |
|
70 | 70 | ['zh_CN', 'zh_Hans', 'zh-Hans-CN', ['schinese']], |
71 | 71 | ['zh_TW', 'zh_Hant', 'zh-Hant-TW', ['tchinese', 'chinese_zh']], |
72 | 72 | ); |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | $this->output = array(); |
55 | 55 | $this->errors = array(); |
56 | 56 | |
57 | - $options = ' ' . trim($this->exeOptions) . ' '; |
|
57 | + $options = ' '.trim($this->exeOptions).' '; |
|
58 | 58 | |
59 | 59 | if (empty($this->exe)) { |
60 | 60 | $exeFinder = new PhpExecutableFinder(); |
61 | 61 | $foundExe = $exeFinder->find(); |
62 | 62 | if ($foundExe) { |
63 | - $this->exe = $foundExe . ' composer.phar'; |
|
63 | + $this->exe = $foundExe.' composer.phar'; |
|
64 | 64 | } else { |
65 | 65 | $this->errors[] = 'Cannot find PHP executable'; |
66 | 66 | return false; |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | set_time_limit(300); // don't want this script to timeout; |
76 | - $command = $this->exe . $options . $command_line; |
|
77 | - putenv('COMPOSER_HOME=' . \XoopsBaseConfig::get('var-path').'/composer'); |
|
76 | + $command = $this->exe.$options.$command_line; |
|
77 | + putenv('COMPOSER_HOME='.\XoopsBaseConfig::get('var-path').'/composer'); |
|
78 | 78 | $process = new Process($command); |
79 | 79 | //$process->setEnv(array('COMPOSER_HOME' => \XoopsBaseConfig::get('var-path').'/composer')); |
80 | 80 | $process->setTimeout(120); |
81 | 81 | try { |
82 | 82 | $process->run( |
83 | - function ($type, $buffer) use (&$errors, &$output) { |
|
83 | + function($type, $buffer) use (&$errors, &$output) { |
|
84 | 84 | if (Process::ERR === $type) { |
85 | 85 | $errors[] = $buffer; |
86 | 86 | } else { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | array_unshift($this->output, $process->getErrorOutput()); |
97 | 97 | return true; |
98 | 98 | } else { |
99 | - $this->errors[] = 'Failed: ' . $command; |
|
99 | + $this->errors[] = 'Failed: '.$command; |
|
100 | 100 | $this->errors[] = sprintf( |
101 | 101 | "Process exit code: %s, '%s'", |
102 | 102 | $process->getExitCode(), |