@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | // celle du texte) et public (spip_lang est la langue du texte) |
| 45 | 45 | $dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']); |
| 46 | 46 | |
| 47 | - $p = 'puce' . (test_espace_prive() ? '_prive' : ''); |
|
| 47 | + $p = 'puce'.(test_espace_prive() ? '_prive' : ''); |
|
| 48 | 48 | if ($dir == 'rtl') { |
| 49 | 49 | $p .= '_rtl'; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if (!isset($GLOBALS[$p])) { |
| 53 | - $GLOBALS[$p] = '<span class="spip-puce ' . $dir . '"><b>–</b></span>'; |
|
| 53 | + $GLOBALS[$p] = '<span class="spip-puce '.$dir.'"><b>–</b></span>'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $GLOBALS[$p]; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if (!defined('_BALISES_BLOCS_REGEXP')) { |
| 71 | - define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS'); |
|
| 71 | + define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Tester si on echappe en span ou en div |
| 87 | 87 | if (is_null($mode) or !in_array($mode, ['div', 'span'])) { |
| 88 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 88 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Decouper en morceaux, base64 a des probleme selon la taille de la pile |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ) { |
| 121 | 121 | foreach ($matches as $m) { |
| 122 | 122 | if ($m[1] === 'code') { |
| 123 | - $code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>'; |
|
| 123 | + $code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>'; |
|
| 124 | 124 | $pre = str_replace($m[0], $code, $pre); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | // Echapper les <code>...</ code> |
| 132 | 132 | function traiter_echap_code_dist($regs, $options = []) { |
| 133 | - [, , $att, $corps] = $regs; |
|
| 133 | + [,, $att, $corps] = $regs; |
|
| 134 | 134 | $echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code ! |
| 135 | 135 | |
| 136 | 136 | // ne pas mettre le <div...> s'il n'y a qu'une ligne |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $echap = nl2br($echap); |
| 142 | 142 | $echap = "<div style='text-align: left;' " |
| 143 | 143 | . "class='spip_code' dir='ltr'><code$att>" |
| 144 | - . $echap . '</code></div>'; |
|
| 144 | + . $echap.'</code></div>'; |
|
| 145 | 145 | } else { |
| 146 | - $echap = "<code$att class='spip_code' dir='ltr'>" . $echap . '</code>'; |
|
| 146 | + $echap = "<code$att class='spip_code' dir='ltr'>".$echap.'</code>'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $echap = str_replace("\t", ' ', $echap); |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | else { |
| 221 | 221 | $callback_secure_prefix = ($callback_options['secure_prefix'] ?? ''); |
| 222 | 222 | if ( |
| 223 | - function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1])) |
|
| 224 | - or function_exists($f = $f . '_dist') |
|
| 223 | + function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1])) |
|
| 224 | + or function_exists($f = $f.'_dist') |
|
| 225 | 225 | or ($callback_secure_prefix and ( |
| 226 | - function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1])) |
|
| 227 | - or function_exists($f = $f . '_dist') |
|
| 226 | + function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1])) |
|
| 227 | + or function_exists($f = $f.'_dist') |
|
| 228 | 228 | )) |
| 229 | 229 | ) { |
| 230 | 230 | $echap = $f($regs, $callback_options); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | // dans une callback autonommee |
| 247 | 247 | if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) { |
| 248 | 248 | if ( |
| 249 | - strpos($letexte, '<' . '?') !== false and preg_match_all( |
|
| 249 | + strpos($letexte, '<'.'?') !== false and preg_match_all( |
|
| 250 | 250 | ',<[?].*($|[?]>),UisS', |
| 251 | 251 | $letexte, |
| 252 | 252 | $matches, |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | strpos($letexte, '<') !== false |
| 279 | 279 | and |
| 280 | 280 | preg_match_all( |
| 281 | - ',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 281 | + ',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 282 | 282 | $letexte, |
| 283 | 283 | $regs, |
| 284 | 284 | PREG_SET_ORDER |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | if ($at) { |
| 298 | - $rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>'; |
|
| 298 | + $rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>'; |
|
| 299 | 299 | foreach ($at as $attr => $a) { |
| 300 | 300 | $rempl = inserer_attribut($rempl, $attr, $a); |
| 301 | 301 | } |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | $texte = nettoyer_raccourcis_typo($texte); |
| 377 | 377 | |
| 378 | 378 | // balises de sauts de ligne et paragraphe |
| 379 | - $texte = preg_replace('/<p( [^>]*)?' . '>/', "\r", $texte); |
|
| 380 | - $texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte); |
|
| 379 | + $texte = preg_replace('/<p( [^>]*)?'.'>/', "\r", $texte); |
|
| 380 | + $texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte); |
|
| 381 | 381 | |
| 382 | 382 | // on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier |
| 383 | 383 | $texte = str_replace("\n\n", "\r", $texte); |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | // supprimer les tags |
| 386 | 386 | $texte = supprimer_tags($texte); |
| 387 | 387 | $texte = trim(str_replace("\n", ' ', $texte)); |
| 388 | - $texte .= "\n"; // marquer la fin |
|
| 388 | + $texte .= "\n"; // marquer la fin |
|
| 389 | 389 | |
| 390 | 390 | // corriger la longueur de coupe |
| 391 | 391 | // en fonction de la presence de caracteres utf |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | // couper au mot precedent |
| 401 | 401 | $long = spip_substr($texte, 0, max($taille - 4, 1)); |
| 402 | 402 | $u = $GLOBALS['meta']['pcre_u']; |
| 403 | - $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 403 | + $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 404 | 404 | if (is_null($suite)) { |
| 405 | 405 | $suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : ' (...)'); |
| 406 | 406 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | if (spip_strlen($court) < max(0.75 * $taille, 2)) { |
| 411 | 411 | $points = ''; |
| 412 | 412 | $long = spip_substr($texte, 0, $taille); |
| 413 | - $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 413 | + $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 414 | 414 | // encore trop court ? couper au caractere |
| 415 | 415 | if (spip_strlen($texte) < 0.75 * $taille) { |
| 416 | 416 | $texte = $long; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | // supprimer l'eventuelle entite finale mal coupee |
| 430 | 430 | $texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte); |
| 431 | 431 | |
| 432 | - return quote_amp(trim($texte)) . $points; |
|
| 432 | + return quote_amp(trim($texte)).$points; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -441,16 +441,16 @@ discard block |
||
| 441 | 441 | define('_PROTEGE_JS_MODELES', creer_uniqid()); |
| 442 | 442 | } |
| 443 | 443 | foreach ($r as $regs) { |
| 444 | - $t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t); |
|
| 444 | + $t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | - if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 447 | + if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 448 | 448 | if (!defined('_PROTEGE_PHP_MODELES')) { |
| 449 | 449 | include_spip('inc/acces'); |
| 450 | 450 | define('_PROTEGE_PHP_MODELES', creer_uniqid()); |
| 451 | 451 | } |
| 452 | 452 | foreach ($r as $regs) { |
| 453 | - $t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t); |
|
| 453 | + $t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t); |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | if (!empty($options['wrap_suspect'])) { |
| 566 | 566 | $texte = wrap($texte, $options['wrap_suspect']); |
| 567 | 567 | } |
| 568 | - $texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte; |
|
| 568 | + $texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte; |
|
| 569 | 569 | } |
| 570 | 570 | $texte = modele_retablir_raccourcis_echappes($texte, $markidmodeles); |
| 571 | 571 | } |
@@ -677,11 +677,11 @@ discard block |
||
| 677 | 677 | **/ |
| 678 | 678 | function supprime_img($letexte, $message = null) { |
| 679 | 679 | if ($message === null) { |
| 680 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 680 | + $message = '('._T('img_indisponible').')'; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | return preg_replace( |
| 684 | - ',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 684 | + ',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 685 | 685 | $message, |
| 686 | 686 | $letexte |
| 687 | 687 | ); |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | |
| 122 | 122 | $offset_pos = 0; |
| 123 | 123 | foreach ($liens as $l) { |
| 124 | - $rempl = $markid . base64_encode($l['lien']) . '|@'; |
|
| 124 | + $rempl = $markid.base64_encode($l['lien']).'|@'; |
|
| 125 | 125 | $texte = substr_replace($texte, $rempl, $l['pos'] + $offset_pos, $l['length']); |
| 126 | 126 | $offset_pos += strlen($rempl) - $l['length']; |
| 127 | 127 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | protected $_lcount = 19; |
| 74 | 74 | protected $_vcount = 21; |
| 75 | 75 | protected $_tcount = 28; |
| 76 | - protected $_ncount = 588; // _vcount * _tcount |
|
| 76 | + protected $_ncount = 588; // _vcount * _tcount |
|
| 77 | 77 | protected $_scount = 11172; // _lcount * _tcount * _vcount |
| 78 | 78 | protected $_error = false; |
| 79 | 79 | protected static $_mb_string_overload = null; |
| 80 | 80 | // See {@link set_paramter()} for details of how to change the following |
| 81 | 81 | // settings from within your script / application |
| 82 | - protected $_api_encoding = 'utf8'; // Default input charset is UTF-8 |
|
| 83 | - protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden |
|
| 84 | - protected $_strict_mode = false; // Behave strict or not |
|
| 85 | - protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008 |
|
| 82 | + protected $_api_encoding = 'utf8'; // Default input charset is UTF-8 |
|
| 83 | + protected $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden |
|
| 84 | + protected $_strict_mode = false; // Behave strict or not |
|
| 85 | + protected $_idn_version = 2003; // Can be either 2003 (old, default) or 2008 |
|
| 86 | 86 | |
| 87 | 87 | protected $slast; |
| 88 | 88 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $this->_api_encoding = $v; |
| 143 | 143 | break; |
| 144 | 144 | default: |
| 145 | - $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k); |
|
| 145 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | break; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if (in_array($v, array('2003', '2008'))) { |
| 157 | 157 | $this->_idn_version = $v; |
| 158 | 158 | } else { |
| 159 | - $this->_error('Set Parameter: Unknown parameter ' . $v . ' for option ' . $k); |
|
| 159 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | case 'encode_german_sz': // Deprecated |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | default: |
| 170 | - $this->_error('Set Parameter: Unknown option ' . $k); |
|
| 170 | + $this->_error('Set Parameter: Unknown option '.$k); |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | case 'ucs4_array': |
| 191 | 191 | break; |
| 192 | 192 | default: |
| 193 | - $this->_error('Unknown encoding ' . $one_time_encoding); |
|
| 193 | + $this->_error('Unknown encoding '.$one_time_encoding); |
|
| 194 | 194 | return false; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | [$email_pref, $input] = explode('@', $input, 2); |
| 209 | 209 | $arr = explode('.', $input); |
| 210 | 210 | foreach ($arr as $k => $v) { |
| 211 | - if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) { |
|
| 211 | + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
|
| 212 | 212 | $conv = $this->_decode($v); |
| 213 | 213 | if ($conv) { |
| 214 | 214 | $arr[$k] = $conv; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $input = join('.', $arr); |
| 219 | 219 | $arr = explode('.', $email_pref); |
| 220 | 220 | foreach ($arr as $k => $v) { |
| 221 | - if (preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) { |
|
| 221 | + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { |
|
| 222 | 222 | $conv = $this->_decode($v); |
| 223 | 223 | if ($conv) { |
| 224 | 224 | $arr[$k] = $conv; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | $email_pref = join('.', $arr); |
| 229 | - $return = $email_pref . '@' . $input; |
|
| 229 | + $return = $email_pref.'@'.$input; |
|
| 230 | 230 | } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) |
| 231 | 231 | // No no in strict mode |
| 232 | 232 | if ($this->_strict_mode) { |
@@ -243,13 +243,13 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | $parsed['host'] = join('.', $arr); |
| 246 | - $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 247 | - (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@'). |
|
| 246 | + $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 247 | + (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@'). |
|
| 248 | 248 | $parsed['host']. |
| 249 | - (empty($parsed['port']) ? '' : ':' . $parsed['port']). |
|
| 249 | + (empty($parsed['port']) ? '' : ':'.$parsed['port']). |
|
| 250 | 250 | (empty($parsed['path']) ? '' : $parsed['path']). |
| 251 | - (empty($parsed['query']) ? '' : '?' . $parsed['query']). |
|
| 252 | - (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']); |
|
| 251 | + (empty($parsed['query']) ? '' : '?'.$parsed['query']). |
|
| 252 | + (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); |
|
| 253 | 253 | } else { // parse_url seems to have failed, try without it |
| 254 | 254 | $arr = explode('.', $input); |
| 255 | 255 | foreach ($arr as $k => $v) { |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | // The output is UTF-8 by default, other output formats need conversion here |
| 268 | 268 | // If one time encoding is given, use this, else the objects property |
| 269 | 269 | switch ($one_time_encoding ?: $this->_api_encoding) { |
| 270 | - case 'utf8': return $return; // break; |
|
| 271 | - case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break; |
|
| 270 | + case 'utf8' : return $return; // break; |
|
| 271 | + case 'ucs4_string': return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); // break; |
|
| 272 | 272 | case 'ucs4_array': return $this->_utf8_to_ucs4($return); // break; |
| 273 | 273 | default: $this->_error('Unsupported output format'); return false; |
| 274 | 274 | } |
@@ -285,15 +285,14 @@ discard block |
||
| 285 | 285 | // Forcing conversion of input to UCS4 array |
| 286 | 286 | // If one time encoding is given, use this, else the objects property |
| 287 | 287 | switch ($one_time_encoding ?: $this->_api_encoding) { |
| 288 | - case 'utf8': |
|
| 289 | - $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 288 | + case 'utf8' : $decoded = $this->_utf8_to_ucs4($decoded); |
|
| 290 | 289 | break; |
| 291 | 290 | case 'ucs4_string': |
| 292 | 291 | $decoded = $this->_ucs4_string_to_ucs4($decoded); |
| 293 | 292 | case 'ucs4_array': |
| 294 | 293 | break; |
| 295 | 294 | default: |
| 296 | - $this->_error('Unsupported input format: ' . ($one_time_encoding ?: $this->_api_encoding)); |
|
| 295 | + $this->_error('Unsupported input format: '.($one_time_encoding ?: $this->_api_encoding)); |
|
| 297 | 296 | return false; |
| 298 | 297 | } |
| 299 | 298 | |
@@ -382,13 +381,13 @@ discard block |
||
| 382 | 381 | } |
| 383 | 382 | } |
| 384 | 383 | $parsed['host'] = join('.', $arr); |
| 385 | - $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 386 | - (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@'). |
|
| 384 | + $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')). |
|
| 385 | + (empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@'). |
|
| 387 | 386 | $parsed['host']. |
| 388 | - (empty($parsed['port']) ? '' : ':' . $parsed['port']). |
|
| 387 | + (empty($parsed['port']) ? '' : ':'.$parsed['port']). |
|
| 389 | 388 | (empty($parsed['path']) ? '' : $parsed['path']). |
| 390 | - (empty($parsed['query']) ? '' : '?' . $parsed['query']). |
|
| 391 | - (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']); |
|
| 389 | + (empty($parsed['query']) ? '' : '?'.$parsed['query']). |
|
| 390 | + (empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); |
|
| 392 | 391 | return $return; |
| 393 | 392 | } |
| 394 | 393 | |
@@ -411,11 +410,11 @@ discard block |
||
| 411 | 410 | { |
| 412 | 411 | $decoded = array(); |
| 413 | 412 | // find the Punycode prefix |
| 414 | - if (!preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $encoded)) { |
|
| 413 | + if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { |
|
| 415 | 414 | $this->_error('This is not a punycode string'); |
| 416 | 415 | return false; |
| 417 | 416 | } |
| 418 | - $encode_test = preg_replace('!^' . preg_quote($this->_punycode_prefix, '!') . '!', '', $encoded); |
|
| 417 | + $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); |
|
| 419 | 418 | // If nothing left after removing the prefix, it is hopeless |
| 420 | 419 | if (!$encode_test) { |
| 421 | 420 | $this->_error('The given encoded string was empty'); |
@@ -441,8 +440,7 @@ discard block |
||
| 441 | 440 | for ($old_idx = $idx, $w = 1, $k = $this->_base; 1; $k += $this->_base) { |
| 442 | 441 | $digit = $this->_decode_digit($encoded[$enco_idx++]); |
| 443 | 442 | $idx += $digit * $w; |
| 444 | - $t = ($k <= $bias) ? $this->_tmin : |
|
| 445 | - (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 443 | + $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); |
|
| 446 | 444 | if ($digit < $t) { |
| 447 | 445 | break; |
| 448 | 446 | } |
@@ -515,7 +513,7 @@ discard block |
||
| 515 | 513 | return $encoded; // All codepoints were basic ones |
| 516 | 514 | } |
| 517 | 515 | // Start with the prefix; copy it to output |
| 518 | - $encoded = $this->_punycode_prefix . $encoded; |
|
| 516 | + $encoded = $this->_punycode_prefix.$encoded; |
|
| 519 | 517 | // If we have basic code points in output, add an hyphen to the end |
| 520 | 518 | if ($codecount) { |
| 521 | 519 | $encoded .= '-'; |
@@ -542,8 +540,7 @@ discard block |
||
| 542 | 540 | $delta++; |
| 543 | 541 | } elseif ($decoded[$i] == $cur_code) { |
| 544 | 542 | for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { |
| 545 | - $t = ($k <= $bias) ? $this->_tmin : |
|
| 546 | - (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 543 | + $t = ($k <= $bias) ? $this->_tmin : (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); |
|
| 547 | 544 | if ($q < $t) { |
| 548 | 545 | break; |
| 549 | 546 | } |
@@ -630,12 +627,12 @@ discard block |
||
| 630 | 627 | } |
| 631 | 628 | // Try to find prohibited input |
| 632 | 629 | if (in_array($v, self::$NP['prohibit']) || in_array($v, self::$NP['general_prohibited'])) { |
| 633 | - $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v)); |
|
| 630 | + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
|
| 634 | 631 | return false; |
| 635 | 632 | } |
| 636 | 633 | foreach (self::$NP['prohibit_ranges'] as $range) { |
| 637 | 634 | if ($range[0] <= $v && $v <= $range[1]) { |
| 638 | - $this->_error('NAMEPREP: Prohibited input U+' . sprintf('%08X', $v)); |
|
| 635 | + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); |
|
| 639 | 636 | return false; |
| 640 | 637 | } |
| 641 | 638 | } |
@@ -873,7 +870,7 @@ discard block |
||
| 873 | 870 | $output[$out_len] = $v; |
| 874 | 871 | ++$out_len; |
| 875 | 872 | if ('add' == $mode) { |
| 876 | - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
| 873 | + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
| 877 | 874 | return false; |
| 878 | 875 | } |
| 879 | 876 | continue; |
@@ -898,7 +895,7 @@ discard block |
||
| 898 | 895 | $next_byte = 4; |
| 899 | 896 | $v = ($v - 252) << 30; |
| 900 | 897 | } else { |
| 901 | - $this->_error('This might be UTF-8, but I don\'t understand it at byte ' . $k); |
|
| 898 | + $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k); |
|
| 902 | 899 | return false; |
| 903 | 900 | } |
| 904 | 901 | if ('add' == $mode) { |
@@ -911,7 +908,7 @@ discard block |
||
| 911 | 908 | if (!$this->_allow_overlong && $test == 'range') { |
| 912 | 909 | $test = 'none'; |
| 913 | 910 | if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { |
| 914 | - $this->_error('Bogus UTF-8 character detected (out of legal range) at byte ' . $k); |
|
| 911 | + $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k); |
|
| 915 | 912 | return false; |
| 916 | 913 | } |
| 917 | 914 | } |
@@ -920,7 +917,7 @@ discard block |
||
| 920 | 917 | $output[($out_len - 1)] += $v; |
| 921 | 918 | --$next_byte; |
| 922 | 919 | } else { |
| 923 | - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte ' . $k); |
|
| 920 | + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); |
|
| 924 | 921 | return false; |
| 925 | 922 | } |
| 926 | 923 | if ($next_byte < 0) { |
@@ -944,13 +941,13 @@ discard block |
||
| 944 | 941 | if ($v < 128) { // 7bit are transferred literally |
| 945 | 942 | $output .= chr($v); |
| 946 | 943 | } elseif ($v < (1 << 11)) { // 2 bytes |
| 947 | - $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 944 | + $output .= chr(192 + ($v >> 6)).chr(128 + ($v & 63)); |
|
| 948 | 945 | } elseif ($v < (1 << 16)) { // 3 bytes |
| 949 | - $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 946 | + $output .= chr(224 + ($v >> 12)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63)); |
|
| 950 | 947 | } elseif ($v < (1 << 21)) { // 4 bytes |
| 951 | - $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 948 | + $output .= chr(240 + ($v >> 18)).chr(128 + (($v >> 12) & 63)).chr(128 + (($v >> 6) & 63)).chr(128 + ($v & 63)); |
|
| 952 | 949 | } else { |
| 953 | - $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte ' . $k); |
|
| 950 | + $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); |
|
| 954 | 951 | return false; |
| 955 | 952 | } |
| 956 | 953 | } |
@@ -969,7 +966,7 @@ discard block |
||
| 969 | 966 | // Take array values and split output to 4 bytes per value |
| 970 | 967 | // The bit mask is 255, which reads &11111111 |
| 971 | 968 | foreach ($input as $v) { |
| 972 | - $output .= chr(($v >> 24) & 255) . chr(($v >> 16) & 255) . chr(($v >> 8) & 255) . chr($v & 255); |
|
| 969 | + $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); |
|
| 973 | 970 | } |
| 974 | 971 | return $output; |
| 975 | 972 | } |
@@ -999,7 +996,7 @@ discard block |
||
| 999 | 996 | $out_len++; |
| 1000 | 997 | $output[$out_len] = 0; |
| 1001 | 998 | } |
| 1002 | - $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4) ) ); |
|
| 999 | + $output[$out_len] += ord($input[$i]) << (8 * (3 - ($i % 4))); |
|
| 1003 | 1000 | } |
| 1004 | 1001 | return $output; |
| 1005 | 1002 | } |