@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | var $error = 0; // public variable that holds error code (0 if no error) |
| 39 | 39 | |
| 40 | 40 | //private: |
| 41 | - var $BYTEORDER = 0; // 0: low endian, 1: big endian |
|
| 41 | + var $BYTEORDER = 0; // 0: low endian, 1: big endian |
|
| 42 | 42 | var $STREAM = NULL; |
| 43 | 43 | var $short_circuit = false; |
| 44 | 44 | var $enable_cache = false; |
| 45 | - var $originals = NULL; // offset of original table |
|
| 46 | - var $translations = NULL; // offset of translation table |
|
| 47 | - var $pluralheader = NULL; // cache header field for plural forms |
|
| 48 | - var $total = 0; // total string count |
|
| 49 | - var $table_originals = NULL; // table for original strings (offsets) |
|
| 50 | - var $table_translations = NULL; // table for translated strings (offsets) |
|
| 51 | - var $cache_translations = NULL; // original -> translation mapping |
|
| 45 | + var $originals = NULL; // offset of original table |
|
| 46 | + var $translations = NULL; // offset of translation table |
|
| 47 | + var $pluralheader = NULL; // cache header field for plural forms |
|
| 48 | + var $total = 0; // total string count |
|
| 49 | + var $table_originals = NULL; // table for original strings (offsets) |
|
| 50 | + var $table_translations = NULL; // table for translated strings (offsets) |
|
| 51 | + var $cache_translations = NULL; // original -> translation mapping |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* Methods */ |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | function readint() { |
| 64 | 64 | if ($this->BYTEORDER == 0) { |
| 65 | 65 | // low endian |
| 66 | - $input=unpack('V', $this->STREAM->read(4)); |
|
| 66 | + $input = unpack('V', $this->STREAM->read(4)); |
|
| 67 | 67 | return array_shift($input); |
| 68 | 68 | } else { |
| 69 | 69 | // big endian |
| 70 | - $input=unpack('N', $this->STREAM->read(4)); |
|
| 70 | + $input = unpack('N', $this->STREAM->read(4)); |
|
| 71 | 71 | return array_shift($input); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function __construct($Reader, $enable_cache = true) { |
| 102 | 102 | // If there isn't a StreamReader, turn on short circuit mode. |
| 103 | - if (! $Reader || isset($Reader->error) ) { |
|
| 103 | + if (!$Reader || isset($Reader->error)) { |
|
| 104 | 104 | $this->short_circuit = true; |
| 105 | 105 | return; |
| 106 | 106 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if ($this->enable_cache) { |
| 157 | - $this->cache_translations = array (); |
|
| 157 | + $this->cache_translations = array(); |
|
| 158 | 158 | /* read all strings in the cache */ |
| 159 | 159 | for ($i = 0; $i < $this->total; $i++) { |
| 160 | 160 | $this->STREAM->seekto($this->table_originals[$i * 2 + 2]); |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | function get_original_string($num) { |
| 177 | 177 | $length = $this->table_originals[$num * 2 + 1]; |
| 178 | 178 | $offset = $this->table_originals[$num * 2 + 2]; |
| 179 | - if (! $length) |
|
| 179 | + if (!$length) |
|
| 180 | 180 | return ''; |
| 181 | 181 | $this->STREAM->seekto($offset); |
| 182 | 182 | $data = $this->STREAM->read($length); |
| 183 | - return (string)$data; |
|
| 183 | + return (string) $data; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | function get_translation_string($num) { |
| 194 | 194 | $length = $this->table_translations[$num * 2 + 1]; |
| 195 | 195 | $offset = $this->table_translations[$num * 2 + 2]; |
| 196 | - if (! $length) |
|
| 196 | + if (!$length) |
|
| 197 | 197 | return ''; |
| 198 | 198 | $this->STREAM->seekto($offset); |
| 199 | 199 | $data = $this->STREAM->read($length); |
| 200 | - return (string)$data; |
|
| 200 | + return (string) $data; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | return $this->find_string($string, $end, $start); |
| 228 | 228 | } else { |
| 229 | 229 | // Divide table in two parts |
| 230 | - $half = (int)(($start + $end) / 2); |
|
| 230 | + $half = (int) (($start + $end) / 2); |
|
| 231 | 231 | $cmp = strcmp($string, $this->get_original_string($half)); |
| 232 | 232 | if ($cmp == 0) |
| 233 | 233 | // string is exactly in the middle => return it |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $res .= ') : ('; |
| 295 | 295 | break; |
| 296 | 296 | case ';': |
| 297 | - $res .= str_repeat( ')', $p) . ';'; |
|
| 297 | + $res .= str_repeat(')', $p).';'; |
|
| 298 | 298 | $p = 0; |
| 299 | 299 | break; |
| 300 | 300 | default: |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $this->load_tables(); |
| 331 | 331 | |
| 332 | 332 | // cache header field for plural forms |
| 333 | - if (! is_string($this->pluralheader)) { |
|
| 333 | + if (!is_string($this->pluralheader)) { |
|
| 334 | 334 | if ($this->enable_cache) { |
| 335 | 335 | $header = $this->cache_translations[""]; |
| 336 | 336 | } else { |
@@ -352,12 +352,12 @@ discard block |
||
| 352 | 352 | function select_string($n) { |
| 353 | 353 | if (!is_int($n)) { |
| 354 | 354 | throw new InvalidArgumentException( |
| 355 | - "Select_string only accepts integers: " . $n); |
|
| 355 | + "Select_string only accepts integers: ".$n); |
|
| 356 | 356 | } |
| 357 | 357 | $string = $this->get_plural_forms(); |
| 358 | - $string = str_replace('nplurals',"\$total",$string); |
|
| 359 | - $string = str_replace("n",$n,$string); |
|
| 360 | - $string = str_replace('plural',"\$plural",$string); |
|
| 358 | + $string = str_replace('nplurals', "\$total", $string); |
|
| 359 | + $string = str_replace("n", $n, $string); |
|
| 360 | + $string = str_replace('plural', "\$plural", $string); |
|
| 361 | 361 | |
| 362 | 362 | $total = 0; |
| 363 | 363 | $plural = 0; |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | $select = $this->select_string($number); |
| 389 | 389 | |
| 390 | 390 | // this should contains all strings separated by NULLs |
| 391 | - $key = $single . chr(0) . $plural; |
|
| 391 | + $key = $single.chr(0).$plural; |
|
| 392 | 392 | |
| 393 | 393 | |
| 394 | 394 | if ($this->enable_cache) { |
| 395 | - if (! array_key_exists($key, $this->cache_translations)) { |
|
| 395 | + if (!array_key_exists($key, $this->cache_translations)) { |
|
| 396 | 396 | return ($number != 1) ? $plural : $single; |
| 397 | 397 | } else { |
| 398 | 398 | $result = $this->cache_translations[$key]; |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | function pgettext($context, $msgid) { |
| 415 | - $key = $context . chr(4) . $msgid; |
|
| 415 | + $key = $context.chr(4).$msgid; |
|
| 416 | 416 | $ret = $this->translate($key); |
| 417 | 417 | if (strpos($ret, "\004") !== FALSE) { |
| 418 | 418 | return $msgid; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | function npgettext($context, $singular, $plural, $number) { |
| 425 | - $key = $context . chr(4) . $singular; |
|
| 425 | + $key = $context.chr(4).$singular; |
|
| 426 | 426 | $ret = $this->ngettext($key, $plural, $number); |
| 427 | 427 | if (strpos($ret, "\004") !== FALSE) { |
| 428 | 428 | return $singular; |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | // we need a separate check here because functions.php might get parsed |
| 13 | 13 | // incorrectly before 5.3 because of :: syntax. |
| 14 | 14 | if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
| 15 | - print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using " . PHP_VERSION . ".\n"; |
|
| 15 | + print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".\n"; |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
| 19 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
| 20 | 20 | get_include_path()); |
| 21 | 21 | |
| 22 | 22 | require_once "autoload.php"; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | function get_js() { |
| 16 | - return file_get_contents(__DIR__ . "/init.js"); |
|
| 16 | + return file_get_contents(__DIR__."/init.js"); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | function api_version() { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | function get_js() { |
| 16 | - return file_get_contents(__DIR__ . "/init.js"); |
|
| 16 | + return file_get_contents(__DIR__."/init.js"); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | function api_version() { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | function get_js() { |
| 16 | - return file_get_contents(__DIR__ . "/init.js"); |
|
| 16 | + return file_get_contents(__DIR__."/init.js"); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | function api_version() { |