@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function _read($bytes = 1) |
92 | 92 | { |
93 | - if (0 < $bytes = abs($bytes)) { |
|
93 | + if(0 < $bytes = abs($bytes)) { |
|
94 | 94 | return fread($this->_handle, $bytes); |
95 | 95 | } |
96 | 96 | return null; |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function load($file = null) |
171 | 171 | { |
172 | - if (!isset($file)) { |
|
172 | + if(!isset($file)) { |
|
173 | 173 | $file = $this->file; |
174 | 174 | } |
175 | 175 | |
176 | 176 | // open MO file |
177 | - if (!is_resource($this->_handle = @fopen($file, 'rb'))) { |
|
177 | + if(!is_resource($this->_handle = @fopen($file, 'rb'))) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | // lock MO file shared |
181 | - if (!@flock($this->_handle, LOCK_SH)) { |
|
181 | + if(!@flock($this->_handle, LOCK_SH)) { |
|
182 | 182 | @fclose($this->_handle); |
183 | 183 | return false; |
184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | //unpack returns a reference???? |
189 | 189 | $unpacked = unpack('c', $this->_read(4)); |
190 | - switch ($magic = array_shift($unpacked)) |
|
190 | + switch($magic = array_shift($unpacked)) |
|
191 | 191 | { |
192 | 192 | case -34: |
193 | 193 | $be = false; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | // check file format revision - we currently only support 0 |
205 | - if (0 !== ($_rev = $this->_readInt($be))) { |
|
205 | + if(0 !== ($_rev = $this->_readInt($be))) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | fseek($this->_handle, $offset_original); |
219 | 219 | // read lengths and offsets of msgids |
220 | 220 | $original = []; |
221 | - for ($i = 0; $i < $count; $i++) { |
|
221 | + for($i = 0; $i < $count; $i++) { |
|
222 | 222 | $original[$i] = [ |
223 | 223 | 'length' => $this->_readInt($be), |
224 | 224 | 'offset' => $this->_readInt($be) |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | fseek($this->_handle, $offset_translat); |
230 | 230 | // read lengths and offsets of msgstrs |
231 | 231 | $translat = []; |
232 | - for ($i = 0; $i < $count; $i++) { |
|
232 | + for($i = 0; $i < $count; $i++) { |
|
233 | 233 | $translat[$i] = [ |
234 | 234 | 'length' => $this->_readInt($be), |
235 | 235 | 'offset' => $this->_readInt($be) |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | // read all |
240 | - for ($i = 0; $i < $count; $i++) { |
|
240 | + for($i = 0; $i < $count; $i++) { |
|
241 | 241 | $this->strings[$this->_readStr($original[$i])] = |
242 | 242 | $this->_readStr($translat[$i]); |
243 | 243 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $this->_handle = null; |
249 | 249 | |
250 | 250 | // check for meta info |
251 | - if (isset($this->strings[''])) { |
|
251 | + if(isset($this->strings[''])) { |
|
252 | 252 | $this->meta = parent::meta2array($this->strings['']); |
253 | 253 | unset($this->strings['']); |
254 | 254 | } |
@@ -265,22 +265,22 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function save($file = null) |
267 | 267 | { |
268 | - if (!isset($file)) { |
|
268 | + if(!isset($file)) { |
|
269 | 269 | $file = $this->file; |
270 | 270 | } |
271 | 271 | |
272 | 272 | // open MO file |
273 | - if (!is_resource($this->_handle = @fopen($file, 'wb'))) { |
|
273 | + if(!is_resource($this->_handle = @fopen($file, 'wb'))) { |
|
274 | 274 | return false; |
275 | 275 | } |
276 | 276 | // lock MO file exclusively |
277 | - if (!@flock($this->_handle, LOCK_EX)) { |
|
277 | + if(!@flock($this->_handle, LOCK_EX)) { |
|
278 | 278 | @fclose($this->_handle); |
279 | 279 | return false; |
280 | 280 | } |
281 | 281 | |
282 | 282 | // write magic number |
283 | - if ($this->writeBigEndian) { |
|
283 | + if($this->writeBigEndian) { |
|
284 | 284 | $this->_write(pack('c*', 0x95, 0x04, 0x12, 0xde)); |
285 | 285 | } else { |
286 | 286 | $this->_write(pack('c*', 0xde, 0x12, 0x04, 0x95)); |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | $this->_writeInt($offset); |
310 | 310 | |
311 | 311 | // unshift meta info |
312 | - if ($this->meta) { |
|
312 | + if($this->meta) { |
|
313 | 313 | $meta = ''; |
314 | - foreach ($this->meta as $key => $val) { |
|
314 | + foreach($this->meta as $key => $val) { |
|
315 | 315 | $meta .= $key . ': ' . $val . "\n"; |
316 | 316 | } |
317 | 317 | $strings = ['' => $meta] + $this->strings; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | // write offsets for original strings |
323 | - foreach (array_keys($strings) as $o) { |
|
323 | + foreach(array_keys($strings) as $o) { |
|
324 | 324 | $len = strlen($o); |
325 | 325 | $this->_writeInt($len); |
326 | 326 | $this->_writeInt($offset); |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | // write offsets for translated strings |
331 | - foreach ($strings as $t) { |
|
331 | + foreach($strings as $t) { |
|
332 | 332 | $len = strlen($t); |
333 | 333 | $this->_writeInt($len); |
334 | 334 | $this->_writeInt($offset); |
@@ -336,12 +336,12 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | // write original strings |
339 | - foreach (array_keys($strings) as $o) { |
|
339 | + foreach(array_keys($strings) as $o) { |
|
340 | 340 | $this->_writeStr($o); |
341 | 341 | } |
342 | 342 | |
343 | 343 | // write translated strings |
344 | - foreach ($strings as $t) { |
|
344 | + foreach($strings as $t) { |
|
345 | 345 | $this->_writeStr($t); |
346 | 346 | } |
347 | 347 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setLifeTime($time) |
78 | 78 | { |
79 | - $this->lifetime = (int)$time; |
|
79 | + $this->lifetime = (int) $time; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return false; |
122 | 122 | |
123 | 123 | |
124 | - $lastmodified = (int)$lastmodified; |
|
124 | + $lastmodified = (int) $lastmodified; |
|
125 | 125 | |
126 | 126 | if($lastmodified <= 0 || $lastmodified > filemtime($cache)) |
127 | 127 | return false; |
@@ -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 | /** |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | |
77 | 77 | foreach($translationUnit as $k => $unit) |
78 | 78 | { |
79 | - $source = (string)$unit['source']; |
|
80 | - $translations[$source][] = (string)$unit['target']; |
|
81 | - $translations[$source][] = (string)$k; |
|
82 | - $translations[$source][] = array_key_exists('note', $unit) ? (string)$unit['note'] : ''; |
|
79 | + $source = (string) $unit['source']; |
|
80 | + $translations[$source][] = (string) $unit['target']; |
|
81 | + $translations[$source][] = (string) $k; |
|
82 | + $translations[$source][] = array_key_exists('note', $unit) ? (string) $unit['note'] : ''; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return $translations; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | if(isset($variants[$i]{0})) |
135 | 135 | { |
136 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
136 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
137 | 137 | $catalogues[] = $catalogue . $this->dataSeparator . $variant . $this->dataExt; |
138 | 138 | } |
139 | 139 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | if(isset($variants[$i]{0})) |
161 | 161 | { |
162 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
162 | + $variant .= ($variant) ? '_' . $variants[$i] : $variants[$i]; |
|
163 | 163 | $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
164 | 164 | } |
165 | 165 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | protected function getCatalogues($dir = null, $variant = null) |
188 | 188 | { |
189 | - $dir = $dir?$dir:$this->source; |
|
189 | + $dir = $dir ? $dir : $this->source; |
|
190 | 190 | $files = scandir($dir); |
191 | 191 | $catalogue = []; |
192 | 192 |
@@ -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 | } |
@@ -126,7 +126,7 @@ |
||
126 | 126 | */ |
127 | 127 | public static function &factory($type, $source = '.', $filename = '') |
128 | 128 | { |
129 | - $types = ['XLIFF','PHP','gettext','Database']; |
|
129 | + $types = ['XLIFF', 'PHP', 'gettext', 'Database']; |
|
130 | 130 | |
131 | 131 | if(empty($filename) && !in_array($type, $types)) |
132 | 132 | throw new Exception('Invalid type "' . $type . '", valid types are ' . |
@@ -138,7 +138,7 @@ |
||
138 | 138 | $filename = dirname(__FILE__) . '/' . $class . '.php'; |
139 | 139 | |
140 | 140 | if(is_file($filename) == false) |
141 | - throw new Exception("File $filename not found"); |
|
141 | + throw new Exception("file $filename not found"); |
|
142 | 142 | |
143 | 143 | include_once $filename; |
144 | 144 |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | { |
238 | 238 | if(!empty($culture)) |
239 | 239 | { |
240 | - if (!preg_match('/^[_\\w]+$/', $culture)) |
|
240 | + if(!preg_match('/^[_\\w]+$/', $culture)) |
|
241 | 241 | throw new Exception('Invalid culture supplied: ' . $culture); |
242 | 242 | } |
243 | 243 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $value = $index[$i]; |
356 | 356 | if($i < $k - 1 && isset($array[$value])) |
357 | 357 | $array = $array[$value]; |
358 | - elseif ($i == $k - 1 && isset($array[$value])) |
|
358 | + elseif($i == $k - 1 && isset($array[$value])) |
|
359 | 359 | return $array[$value]; |
360 | 360 | } |
361 | 361 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $elements = $this->findInfo('NumberElements'); |
486 | 486 | $patterns = $this->findInfo('NumberPatterns'); |
487 | 487 | $currencies = $this->getCurrencies(); |
488 | - $data = [ 'NumberElements' => $elements, |
|
488 | + $data = ['NumberElements' => $elements, |
|
489 | 489 | 'NumberPatterns' => $patterns, |
490 | 490 | 'Currencies' => $currencies]; |
491 | 491 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $neutral = []; |
536 | 536 | $specific = []; |
537 | 537 | |
538 | - while (false !== ($entry = $dir->read())) |
|
538 | + while(false !== ($entry = $dir->read())) |
|
539 | 539 | { |
540 | 540 | if(is_file($dataDir . $entry) |
541 | 541 | && substr($entry, -4) == $dataExt |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class TFirebugLogRoute extends TBrowserLogRoute |
26 | 26 | { |
27 | - protected function renderHeader () |
|
27 | + protected function renderHeader() |
|
28 | 28 | { |
29 | 29 | $string = <<<EOD |
30 | 30 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | return $string; |
40 | 40 | } |
41 | 41 | |
42 | - protected function renderMessage ($log, $info) |
|
42 | + protected function renderMessage($log, $info) |
|
43 | 43 | { |
44 | 44 | $logfunc = $this->getFirebugLoggingFunction($log[1]); |
45 | 45 | $total = sprintf('%0.6f', $info['total']); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | - protected function renderFooter () |
|
56 | + protected function renderFooter() |
|
57 | 57 | { |
58 | 58 | $string = <<<EOD |
59 | 59 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | protected function getFirebugLoggingFunction($level) |
69 | 69 | { |
70 | - switch ($level) |
|
70 | + switch($level) |
|
71 | 71 | { |
72 | 72 | case TLogger::DEBUG: |
73 | 73 | case TLogger::INFO: |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | console.log ("[Cumulated Time] [Time] [Level] [Category] [Message]"); |
36 | 36 | |
37 | -EOD; |
|
37 | +eod; |
|
38 | 38 | |
39 | 39 | return $string; |
40 | 40 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | </script> |
62 | 62 | |
63 | -EOD; |
|
63 | +eod; |
|
64 | 64 | |
65 | 65 | return $string; |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $ctl = null; |
77 | 77 | } else |
78 | 78 | $ctl = null; |
79 | - $this->_logs[] = [$message,$level,$category,microtime(true),memory_get_usage(),$ctl]; |
|
79 | + $this->_logs[] = [$message, $level, $category, microtime(true), memory_get_usage(), $ctl]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | return $this->_logs; |
123 | 123 | $logs = $this->_logs; |
124 | 124 | if(!empty($levels)) |
125 | - $logs = array_values(array_filter(array_filter($logs, [$this,'filterByLevels']))); |
|
125 | + $logs = array_values(array_filter(array_filter($logs, [$this, 'filterByLevels']))); |
|
126 | 126 | if(!empty($categories)) |
127 | - $logs = array_values(array_filter(array_filter($logs, [$this,'filterByCategories']))); |
|
127 | + $logs = array_values(array_filter(array_filter($logs, [$this, 'filterByCategories']))); |
|
128 | 128 | if(!empty($controls)) |
129 | - $logs = array_values(array_filter(array_filter($logs, [$this,'filterByControl']))); |
|
129 | + $logs = array_values(array_filter(array_filter($logs, [$this, 'filterByControl']))); |
|
130 | 130 | if(null !== $timestamp) |
131 | - $logs = array_values(array_filter(array_filter($logs, [$this,'filterByTimeStamp']))); |
|
131 | + $logs = array_values(array_filter(array_filter($logs, [$this, 'filterByTimeStamp']))); |
|
132 | 132 | return $logs; |
133 | 133 | } |
134 | 134 | |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | } |
170 | 170 | $logs = $this->_logs; |
171 | 171 | if(!empty($levels)) |
172 | - $logs = array_filter(array_filter($logs, [$this,'filterByLevels'])); |
|
172 | + $logs = array_filter(array_filter($logs, [$this, 'filterByLevels'])); |
|
173 | 173 | if(!empty($categories)) |
174 | - $logs = array_filter(array_filter($logs, [$this,'filterByCategories'])); |
|
174 | + $logs = array_filter(array_filter($logs, [$this, 'filterByCategories'])); |
|
175 | 175 | if(!empty($controls)) |
176 | - $logs = array_filter(array_filter($logs, [$this,'filterByControl'])); |
|
176 | + $logs = array_filter(array_filter($logs, [$this, 'filterByControl'])); |
|
177 | 177 | if(null !== $timestamp) |
178 | - $logs = array_filter(array_filter($logs, [$this,'filterByTimeStamp'])); |
|
178 | + $logs = array_filter(array_filter($logs, [$this, 'filterByTimeStamp'])); |
|
179 | 179 | $this->_logs = array_values(array_diff_key($this->_logs, $logs)); |
180 | 180 | } |
181 | 181 |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function getLevelName($level) |
140 | 140 | { |
141 | - return isset(self::$_levelNames[$level])?self::$_levelNames[$level]:'Unknown'; |
|
141 | + return isset(self::$_levelNames[$level]) ?self::$_levelNames[$level] : 'Unknown'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function getLevelValue($level) |
149 | 149 | { |
150 | - return isset(self::$_levelValues[$level])?self::$_levelValues[$level]:0; |
|
150 | + return isset(self::$_levelValues[$level]) ?self::$_levelValues[$level] : 0; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -83,7 +83,7 @@ |
||
83 | 83 | */ |
84 | 84 | public function getOptions() |
85 | 85 | { |
86 | - if (($options = $this->getViewState('JuiOptions')) === null) |
|
86 | + if(($options = $this->getViewState('JuiOptions')) === null) |
|
87 | 87 | { |
88 | 88 | $options = new TJuiControlOptions($this); |
89 | 89 | $this->setViewState('JuiOptions', $options); |