@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | call_user_func_array(array('parent', '__construct'), func_get_args()); |
| 119 | 119 | |
| 120 | - $dataDir = __DIR__.'/../data/js/'; |
|
| 120 | + $dataDir = __DIR__ . '/../data/js/'; |
|
| 121 | 121 | $options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES; |
| 122 | - $this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options); |
|
| 123 | - $this->keywordsBefore = file($dataDir.'keywords_before.txt', $options); |
|
| 124 | - $this->keywordsAfter = file($dataDir.'keywords_after.txt', $options); |
|
| 125 | - $this->operators = file($dataDir.'operators.txt', $options); |
|
| 126 | - $this->operatorsBefore = file($dataDir.'operators_before.txt', $options); |
|
| 127 | - $this->operatorsAfter = file($dataDir.'operators_after.txt', $options); |
|
| 122 | + $this->keywordsReserved = file($dataDir . 'keywords_reserved.txt', $options); |
|
| 123 | + $this->keywordsBefore = file($dataDir . 'keywords_before.txt', $options); |
|
| 124 | + $this->keywordsAfter = file($dataDir . 'keywords_after.txt', $options); |
|
| 125 | + $this->operators = file($dataDir . 'operators.txt', $options); |
|
| 126 | + $this->operatorsBefore = file($dataDir . 'operators_before.txt', $options); |
|
| 127 | + $this->operatorsAfter = file($dataDir . 'operators_after.txt', $options); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * singe-line comment on the last line (in which case it would also |
| 150 | 150 | * be seen as part of that comment) |
| 151 | 151 | */ |
| 152 | - $content .= $js."\n;"; |
|
| 152 | + $content .= $js . "\n;"; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /* |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | // PHP only supports $this inside anonymous functions since 5.4 |
| 216 | 216 | $minifier = $this; |
| 217 | - $callback = function ($match) use ($minifier) { |
|
| 217 | + $callback = function($match) use ($minifier) { |
|
| 218 | 218 | $count = count($minifier->extracted); |
| 219 | - $placeholder = '/'.$count.'/'; |
|
| 219 | + $placeholder = '/' . $count . '/'; |
|
| 220 | 220 | $minifier->extracted[$placeholder] = $match[0]; |
| 221 | 221 | |
| 222 | 222 | return $placeholder; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | // likely part of a division, not a regex) |
| 230 | 230 | $after = '[\.,;\)\}]'; |
| 231 | 231 | $methods = '\.(exec|test|match|search|replace|split)\('; |
| 232 | - $this->registerPattern('/'.$pattern.'(?=\s*('.$after.'|'.$methods.'))/', $callback); |
|
| 232 | + $this->registerPattern('/' . $pattern . '(?=\s*(' . $after . '|' . $methods . '))/', $callback); |
|
| 233 | 233 | |
| 234 | 234 | // 1 more edge case: a regex can be followed by a lot more operators or |
| 235 | 235 | // keywords if there's a newline (ASI) in between, where the operator |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // (https://github.com/matthiasmullie/minify/issues/56) |
| 238 | 238 | $operators = $this->getOperatorsForRegex($this->operatorsBefore, '/'); |
| 239 | 239 | $operators += $this->getOperatorsForRegex($this->keywordsReserved, '/'); |
| 240 | - $this->registerPattern('/'.$pattern.'\s*\n(?=\s*('.implode('|', $operators).'))/', $callback); |
|
| 240 | + $this->registerPattern('/' . $pattern . '\s*\n(?=\s*(' . implode('|', $operators) . '))/', $callback); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | unset($operatorsBefore['+'], $operatorsBefore['-'], $operatorsAfter['+'], $operatorsAfter['-']); |
| 282 | 282 | $content = preg_replace( |
| 283 | 283 | array( |
| 284 | - '/('.implode('|', $operatorsBefore).')\s+/', |
|
| 285 | - '/\s+('.implode('|', $operatorsAfter).')/', |
|
| 284 | + '/(' . implode('|', $operatorsBefore) . ')\s+/', |
|
| 285 | + '/\s+(' . implode('|', $operatorsAfter) . ')/', |
|
| 286 | 286 | ), '\\1', $content |
| 287 | 287 | ); |
| 288 | 288 | |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | 297 | // collapse whitespace around reserved words into single space |
| 298 | - $content = preg_replace('/(^|[;\}\s])\K('.implode('|', $keywordsBefore).')\s+/', '\\2 ', $content); |
|
| 299 | - $content = preg_replace('/\s+('.implode('|', $keywordsAfter).')(?=([;\{\s]|$))/', ' \\1', $content); |
|
| 298 | + $content = preg_replace('/(^|[;\}\s])\K(' . implode('|', $keywordsBefore) . ')\s+/', '\\2 ', $content); |
|
| 299 | + $content = preg_replace('/\s+(' . implode('|', $keywordsAfter) . ')(?=([;\{\s]|$))/', ' \\1', $content); |
|
| 300 | 300 | |
| 301 | 301 | /* |
| 302 | 302 | * We didn't strip whitespace after a couple of operators because they |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | $operatorsDiffBefore = array_diff($operators, $operatorsBefore); |
| 308 | 308 | $operatorsDiffAfter = array_diff($operators, $operatorsAfter); |
| 309 | - $content = preg_replace('/('.implode('|', $operatorsDiffBefore).')[^\S\n]+/', '\\1', $content); |
|
| 310 | - $content = preg_replace('/[^\S\n]+('.implode('|', $operatorsDiffAfter).')/', '\\1', $content); |
|
| 309 | + $content = preg_replace('/(' . implode('|', $operatorsDiffBefore) . ')[^\S\n]+/', '\\1', $content); |
|
| 310 | + $content = preg_replace('/[^\S\n]+(' . implode('|', $operatorsDiffAfter) . ')/', '\\1', $content); |
|
| 311 | 311 | |
| 312 | 312 | /* |
| 313 | 313 | * Get rid of double semicolons, except where they can be used like: |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | // don't confuse = with other assignment shortcuts (e.g. +=) |
| 383 | 383 | $chars = preg_quote('+-*\=<>%&|'); |
| 384 | - $operators['='] = '(?<!['.$chars.'])\='; |
|
| 384 | + $operators['='] = '(?<![' . $chars . '])\='; |
|
| 385 | 385 | |
| 386 | 386 | return $operators; |
| 387 | 387 | } |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | $escaped = array_map('preg_quote', $keywords, $delimiter); |
| 403 | 403 | |
| 404 | 404 | // add word boundaries |
| 405 | - array_walk($keywords, function ($value) { |
|
| 406 | - return '\b'.$value.'\b'; |
|
| 405 | + array_walk($keywords, function($value) { |
|
| 406 | + return '\b' . $value . '\b'; |
|
| 407 | 407 | }); |
| 408 | 408 | |
| 409 | 409 | $keywords = array_combine($keywords, $escaped); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | // PHP only supports $this inside anonymous functions since 5.4 |
| 424 | 424 | $minifier = $this; |
| 425 | 425 | $keywords = $this->keywordsReserved; |
| 426 | - $callback = function ($match) use ($minifier, $keywords) { |
|
| 426 | + $callback = function($match) use ($minifier, $keywords) { |
|
| 427 | 427 | $property = trim($minifier->extracted[$match[1]], '\'"'); |
| 428 | 428 | |
| 429 | 429 | /* |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | * array['key-here'] can't be replaced by array.key-here since '-' |
| 441 | 441 | * is not a valid character there. |
| 442 | 442 | */ |
| 443 | - if (!preg_match('/^'.$minifier::REGEX_VARIABLE.'$/u', $property)) { |
|
| 443 | + if (!preg_match('/^' . $minifier::REGEX_VARIABLE . '$/u', $property)) { |
|
| 444 | 444 | return $match[0]; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - return '.'.$property; |
|
| 447 | + return '.' . $property; |
|
| 448 | 448 | }; |
| 449 | 449 | |
| 450 | 450 | /* |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | * separate look-behind assertions, one for each keyword. |
| 466 | 466 | */ |
| 467 | 467 | $keywords = $this->getKeywordsForRegex($keywords); |
| 468 | - $keywords = '(?<!'.implode(')(?<!', $keywords).')'; |
|
| 468 | + $keywords = '(?<!' . implode(')(?<!', $keywords) . ')'; |
|
| 469 | 469 | |
| 470 | - return preg_replace_callback('/(?<='.$previousChar.'|\])'.$keywords.'\[\s*(([\'"])[0-9]+\\2)\s*\]/u', $callback, $content); |
|
| 470 | + return preg_replace_callback('/(?<=' . $previousChar . '|\])' . $keywords . '\[\s*(([\'"])[0-9]+\\2)\s*\]/u', $callback, $content); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1098 | 1098 | ), |
| 1099 | 1099 | 'content' => '$1', |
| 1100 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1100 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1101 | 1101 | { |
| 1102 | 1102 | $returnContext = ''; |
| 1103 | 1103 | |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1135 | - $returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '"></a>'; |
|
| 1135 | + $returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '"></a>'; |
|
| 1136 | 1136 | else |
| 1137 | 1137 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . '/>'; |
| 1138 | 1138 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | 'type' => 'unparsed_content', |
| 1162 | 1162 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
| 1163 | 1163 | // @todo Maybe this can be simplified? |
| 1164 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1164 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | if (!isset($disabled['code'])) |
| 1167 | 1167 | { |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | 'type' => 'unparsed_equals_content', |
| 1199 | 1199 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
| 1200 | 1200 | // @todo Maybe this can be simplified? |
| 1201 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1201 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1202 | 1202 | { |
| 1203 | 1203 | if (!isset($disabled['code'])) |
| 1204 | 1204 | { |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | 'type' => 'unparsed_content', |
| 1243 | 1243 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1244 | 1244 | // @todo Should this respect guest_hideContacts? |
| 1245 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1245 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $data = strtr($data, array('<br>' => '')); |
| 1248 | 1248 | }, |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | 'type' => 'unparsed_commas_content', |
| 1262 | 1262 | 'test' => '\d+,\d+\]', |
| 1263 | 1263 | 'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">', |
| 1264 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1264 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1265 | 1265 | { |
| 1266 | 1266 | if (isset($disabled['url'])) |
| 1267 | 1267 | $tag['content'] = '$1'; |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1307 | 1307 | ), |
| 1308 | 1308 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1309 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1309 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1310 | 1310 | { |
| 1311 | 1311 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
| 1312 | 1312 | |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | 'tag' => 'img', |
| 1330 | 1330 | 'type' => 'unparsed_content', |
| 1331 | 1331 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1332 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1332 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
| 1335 | 1335 | |
@@ -1352,7 +1352,7 @@ discard block |
||
| 1352 | 1352 | 'tag' => 'iurl', |
| 1353 | 1353 | 'type' => 'unparsed_content', |
| 1354 | 1354 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1355 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1355 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1356 | 1356 | { |
| 1357 | 1357 | $data = strtr($data, array('<br>' => '')); |
| 1358 | 1358 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | 'quoted' => 'optional', |
| 1367 | 1367 | 'before' => '<a href="$1" class="bbc_link">', |
| 1368 | 1368 | 'after' => '</a>', |
| 1369 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1369 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1370 | 1370 | { |
| 1371 | 1371 | if (substr($data, 0, 1) == '#') |
| 1372 | 1372 | $data = '#post_' . substr($data, 1); |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | 'tag' => 'php', |
| 1447 | 1447 | 'type' => 'unparsed_content', |
| 1448 | 1448 | 'content' => '<span class="phpcode">$1</span>', |
| 1449 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1449 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1450 | 1450 | { |
| 1451 | 1451 | if (!isset($disabled['php'])) |
| 1452 | 1452 | { |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | 'test' => '[1-7]\]', |
| 1545 | 1545 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1546 | 1546 | 'after' => '</span>', |
| 1547 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1547 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1548 | 1548 | { |
| 1549 | 1549 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1550 | 1550 | $data = $sizes[$data] . 'em'; |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | 'tag' => 'time', |
| 1583 | 1583 | 'type' => 'unparsed_content', |
| 1584 | 1584 | 'content' => '$1', |
| 1585 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1585 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1586 | 1586 | { |
| 1587 | 1587 | if (is_numeric($data)) |
| 1588 | 1588 | $data = timeformat($data); |
@@ -1610,7 +1610,7 @@ discard block |
||
| 1610 | 1610 | 'tag' => 'url', |
| 1611 | 1611 | 'type' => 'unparsed_content', |
| 1612 | 1612 | 'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>', |
| 1613 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1613 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1614 | 1614 | { |
| 1615 | 1615 | $data = strtr($data, array('<br>' => '')); |
| 1616 | 1616 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1624,7 +1624,7 @@ discard block |
||
| 1624 | 1624 | 'quoted' => 'optional', |
| 1625 | 1625 | 'before' => '<a href="$1" class="bbc_link" target="_blank">', |
| 1626 | 1626 | 'after' => '</a>', |
| 1627 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1627 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1628 | 1628 | { |
| 1629 | 1629 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1630 | 1630 | if (empty($scheme)) |
@@ -1650,7 +1650,7 @@ discard block |
||
| 1650 | 1650 | { |
| 1651 | 1651 | if (isset($temp_bbc)) |
| 1652 | 1652 | $bbc_codes = $temp_bbc; |
| 1653 | - usort($codes, function ($a, $b) { |
|
| 1653 | + usort($codes, function($a, $b) { |
|
| 1654 | 1654 | return strcmp($a['tag'], $b['tag']); |
| 1655 | 1655 | }); |
| 1656 | 1656 | return $codes; |
@@ -1888,7 +1888,7 @@ discard block |
||
| 1888 | 1888 | # a run of Unicode domain name characters and a dot |
| 1889 | 1889 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 1890 | 1890 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 1891 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 1891 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 1892 | 1892 | ) |
| 1893 | 1893 | # followed by a non-domain character or end of line |
| 1894 | 1894 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -1956,7 +1956,7 @@ discard block |
||
| 1956 | 1956 | )? |
| 1957 | 1957 | '; |
| 1958 | 1958 | |
| 1959 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 1959 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 1960 | 1960 | $url = array_shift($matches); |
| 1961 | 1961 | |
| 1962 | 1962 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2685,7 +2685,7 @@ discard block |
||
| 2685 | 2685 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2686 | 2686 | { |
| 2687 | 2687 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2688 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2688 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2689 | 2689 | |
| 2690 | 2690 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2691 | 2691 | |
@@ -2702,7 +2702,7 @@ discard block |
||
| 2702 | 2702 | |
| 2703 | 2703 | // Replace away! |
| 2704 | 2704 | $message = preg_replace_callback($smileyPregSearch, |
| 2705 | - function ($matches) use ($smileyPregReplacements) |
|
| 2705 | + function($matches) use ($smileyPregReplacements) |
|
| 2706 | 2706 | { |
| 2707 | 2707 | return $smileyPregReplacements[$matches[1]]; |
| 2708 | 2708 | }, $message); |
@@ -2768,13 +2768,13 @@ discard block |
||
| 2768 | 2768 | { |
| 2769 | 2769 | if (defined('SID') && SID != '') |
| 2770 | 2770 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2771 | - function ($m) use ($scripturl) |
|
| 2771 | + function($m) use ($scripturl) |
|
| 2772 | 2772 | { |
| 2773 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2773 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2774 | 2774 | }, $setLocation); |
| 2775 | 2775 | else |
| 2776 | 2776 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2777 | - function ($m) use ($scripturl) |
|
| 2777 | + function($m) use ($scripturl) |
|
| 2778 | 2778 | { |
| 2779 | 2779 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2780 | 2780 | }, $setLocation); |
@@ -3097,7 +3097,7 @@ discard block |
||
| 3097 | 3097 | |
| 3098 | 3098 | // Add a generic "Are you sure?" confirmation message. |
| 3099 | 3099 | addInlineJavaScript(' |
| 3100 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3100 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3101 | 3101 | |
| 3102 | 3102 | // Now add the capping code for avatars. |
| 3103 | 3103 | if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize') |
@@ -3458,7 +3458,7 @@ discard block |
||
| 3458 | 3458 | |
| 3459 | 3459 | else |
| 3460 | 3460 | echo ' |
| 3461 | - <script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>'; |
|
| 3461 | + <script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>'; |
|
| 3462 | 3462 | } |
| 3463 | 3463 | |
| 3464 | 3464 | // Inline JavaScript - Actually useful some times! |
@@ -3536,14 +3536,14 @@ discard block |
||
| 3536 | 3536 | |
| 3537 | 3537 | else |
| 3538 | 3538 | echo ' |
| 3539 | - <link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">'; |
|
| 3539 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">'; |
|
| 3540 | 3540 | } |
| 3541 | 3541 | |
| 3542 | 3542 | // Print the rest after the minified files. |
| 3543 | 3543 | if (!empty($normal)) |
| 3544 | 3544 | foreach ($normal as $nf) |
| 3545 | 3545 | echo ' |
| 3546 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3546 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3547 | 3547 | |
| 3548 | 3548 | if ($db_show_debug === true) |
| 3549 | 3549 | { |
@@ -3559,7 +3559,7 @@ discard block |
||
| 3559 | 3559 | <style>'; |
| 3560 | 3560 | |
| 3561 | 3561 | foreach ($context['css_header'] as $css) |
| 3562 | - echo $css .' |
|
| 3562 | + echo $css . ' |
|
| 3563 | 3563 | '; |
| 3564 | 3564 | |
| 3565 | 3565 | echo' |
@@ -3588,27 +3588,27 @@ discard block |
||
| 3588 | 3588 | return false; |
| 3589 | 3589 | |
| 3590 | 3590 | // Did we already did this? |
| 3591 | - $toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400); |
|
| 3591 | + $toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400); |
|
| 3592 | 3592 | |
| 3593 | 3593 | // Already done? |
| 3594 | 3594 | if (!empty($toCache)) |
| 3595 | 3595 | return true; |
| 3596 | 3596 | |
| 3597 | 3597 | // No namespaces, sorry! |
| 3598 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3598 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3599 | 3599 | |
| 3600 | 3600 | // Temp path. |
| 3601 | - $cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/'; |
|
| 3601 | + $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
| 3602 | 3602 | |
| 3603 | 3603 | // What kind of file are we going to create? |
| 3604 | - $toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type; |
|
| 3604 | + $toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type; |
|
| 3605 | 3605 | |
| 3606 | 3606 | // File has to exists, if it isn't try to create it. |
| 3607 | 3607 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
| 3608 | 3608 | { |
| 3609 | 3609 | loadLanguage('Errors'); |
| 3610 | 3610 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3611 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3611 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3612 | 3612 | |
| 3613 | 3613 | // The process failed so roll back to print each individual file. |
| 3614 | 3614 | return $data; |
@@ -3643,14 +3643,14 @@ discard block |
||
| 3643 | 3643 | { |
| 3644 | 3644 | loadLanguage('Errors'); |
| 3645 | 3645 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3646 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3646 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3647 | 3647 | |
| 3648 | 3648 | // The process failed so roll back to print each individual file. |
| 3649 | 3649 | return $data; |
| 3650 | 3650 | } |
| 3651 | 3651 | |
| 3652 | 3652 | // And create a long lived cache entry. |
| 3653 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400); |
|
| 3653 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400); |
|
| 3654 | 3654 | |
| 3655 | 3655 | return true; |
| 3656 | 3656 | } |
@@ -3707,7 +3707,7 @@ discard block |
||
| 3707 | 3707 | else |
| 3708 | 3708 | $path = $modSettings['attachmentUploadDir']; |
| 3709 | 3709 | |
| 3710 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3710 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3711 | 3711 | } |
| 3712 | 3712 | |
| 3713 | 3713 | /** |
@@ -3751,10 +3751,10 @@ discard block |
||
| 3751 | 3751 | $valid_low = isValidIP($ip_parts[0]); |
| 3752 | 3752 | $valid_high = isValidIP($ip_parts[1]); |
| 3753 | 3753 | $count = 0; |
| 3754 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3754 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3755 | 3755 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3756 | 3756 | $min = 0; |
| 3757 | - if(!$valid_low) |
|
| 3757 | + if (!$valid_low) |
|
| 3758 | 3758 | { |
| 3759 | 3759 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3760 | 3760 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3768,7 +3768,7 @@ discard block |
||
| 3768 | 3768 | } |
| 3769 | 3769 | |
| 3770 | 3770 | $count = 0; |
| 3771 | - if(!$valid_high) |
|
| 3771 | + if (!$valid_high) |
|
| 3772 | 3772 | { |
| 3773 | 3773 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3774 | 3774 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3781,7 +3781,7 @@ discard block |
||
| 3781 | 3781 | } |
| 3782 | 3782 | } |
| 3783 | 3783 | |
| 3784 | - if($valid_high && $valid_low) |
|
| 3784 | + if ($valid_high && $valid_low) |
|
| 3785 | 3785 | { |
| 3786 | 3786 | $ip_array['low'] = $ip_parts[0]; |
| 3787 | 3787 | $ip_array['high'] = $ip_parts[1]; |
@@ -3963,7 +3963,7 @@ discard block |
||
| 3963 | 3963 | addInlineJavaScript(' |
| 3964 | 3964 | var user_menus = new smc_PopupMenu(); |
| 3965 | 3965 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 3966 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 3966 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 3967 | 3967 | if ($context['allow_pm']) |
| 3968 | 3968 | addInlineJavaScript(' |
| 3969 | 3969 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4588,7 +4588,7 @@ discard block |
||
| 4588 | 4588 | // No? try a fallback to $sourcedir |
| 4589 | 4589 | else |
| 4590 | 4590 | { |
| 4591 | - $absPath = $sourcedir .'/'. $file; |
|
| 4591 | + $absPath = $sourcedir . '/' . $file; |
|
| 4592 | 4592 | |
| 4593 | 4593 | if (file_exists($absPath)) |
| 4594 | 4594 | require_once($absPath); |
@@ -4669,15 +4669,15 @@ discard block |
||
| 4669 | 4669 | |
| 4670 | 4670 | // UTF-8 occurences of MS special characters |
| 4671 | 4671 | $findchars_utf8 = array( |
| 4672 | - "\xe2\80\x9a", // single low-9 quotation mark |
|
| 4673 | - "\xe2\80\x9e", // double low-9 quotation mark |
|
| 4674 | - "\xe2\80\xa6", // horizontal ellipsis |
|
| 4675 | - "\xe2\x80\x98", // left single curly quote |
|
| 4676 | - "\xe2\x80\x99", // right single curly quote |
|
| 4677 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4678 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4679 | - "\xe2\x80\x93", // en dash |
|
| 4680 | - "\xe2\x80\x94", // em dash |
|
| 4672 | + "\xe2\80\x9a", // single low-9 quotation mark |
|
| 4673 | + "\xe2\80\x9e", // double low-9 quotation mark |
|
| 4674 | + "\xe2\80\xa6", // horizontal ellipsis |
|
| 4675 | + "\xe2\x80\x98", // left single curly quote |
|
| 4676 | + "\xe2\x80\x99", // right single curly quote |
|
| 4677 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4678 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4679 | + "\xe2\x80\x93", // en dash |
|
| 4680 | + "\xe2\x80\x94", // em dash |
|
| 4681 | 4681 | ); |
| 4682 | 4682 | |
| 4683 | 4683 | // windows 1252 / iso equivalents |
@@ -4695,15 +4695,15 @@ discard block |
||
| 4695 | 4695 | |
| 4696 | 4696 | // safe replacements |
| 4697 | 4697 | $replacechars = array( |
| 4698 | - ',', // ‚ |
|
| 4699 | - ',,', // „ |
|
| 4700 | - '...', // … |
|
| 4701 | - "'", // ‘ |
|
| 4702 | - "'", // ’ |
|
| 4703 | - '"', // “ |
|
| 4704 | - '"', // ” |
|
| 4705 | - '-', // – |
|
| 4706 | - '--', // — |
|
| 4698 | + ',', // ‚ |
|
| 4699 | + ',,', // „ |
|
| 4700 | + '...', // … |
|
| 4701 | + "'", // ‘ |
|
| 4702 | + "'", // ’ |
|
| 4703 | + '"', // “ |
|
| 4704 | + '"', // ” |
|
| 4705 | + '-', // – |
|
| 4706 | + '--', // — |
|
| 4707 | 4707 | ); |
| 4708 | 4708 | |
| 4709 | 4709 | if ($context['utf8']) |
@@ -5066,7 +5066,7 @@ discard block |
||
| 5066 | 5066 | */ |
| 5067 | 5067 | function inet_dtop($bin) |
| 5068 | 5068 | { |
| 5069 | - if(empty($bin)) |
|
| 5069 | + if (empty($bin)) |
|
| 5070 | 5070 | return ''; |
| 5071 | 5071 | |
| 5072 | 5072 | global $db_type; |
@@ -5097,28 +5097,28 @@ discard block |
||
| 5097 | 5097 | */ |
| 5098 | 5098 | function _safe_serialize($value) |
| 5099 | 5099 | { |
| 5100 | - if(is_null($value)) |
|
| 5100 | + if (is_null($value)) |
|
| 5101 | 5101 | return 'N;'; |
| 5102 | 5102 | |
| 5103 | - if(is_bool($value)) |
|
| 5104 | - return 'b:'. (int) $value .';'; |
|
| 5103 | + if (is_bool($value)) |
|
| 5104 | + return 'b:' . (int) $value . ';'; |
|
| 5105 | 5105 | |
| 5106 | - if(is_int($value)) |
|
| 5107 | - return 'i:'. $value .';'; |
|
| 5106 | + if (is_int($value)) |
|
| 5107 | + return 'i:' . $value . ';'; |
|
| 5108 | 5108 | |
| 5109 | - if(is_float($value)) |
|
| 5110 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5109 | + if (is_float($value)) |
|
| 5110 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5111 | 5111 | |
| 5112 | - if(is_string($value)) |
|
| 5113 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5112 | + if (is_string($value)) |
|
| 5113 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5114 | 5114 | |
| 5115 | - if(is_array($value)) |
|
| 5115 | + if (is_array($value)) |
|
| 5116 | 5116 | { |
| 5117 | 5117 | $out = ''; |
| 5118 | - foreach($value as $k => $v) |
|
| 5118 | + foreach ($value as $k => $v) |
|
| 5119 | 5119 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5120 | 5120 | |
| 5121 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5121 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5122 | 5122 | } |
| 5123 | 5123 | |
| 5124 | 5124 | // safe_serialize cannot serialize resources or objects. |
@@ -5160,7 +5160,7 @@ discard block |
||
| 5160 | 5160 | function _safe_unserialize($str) |
| 5161 | 5161 | { |
| 5162 | 5162 | // Input is not a string. |
| 5163 | - if(empty($str) || !is_string($str)) |
|
| 5163 | + if (empty($str) || !is_string($str)) |
|
| 5164 | 5164 | return false; |
| 5165 | 5165 | |
| 5166 | 5166 | $stack = array(); |
@@ -5174,40 +5174,40 @@ discard block |
||
| 5174 | 5174 | * 3 - in array, expecting value or another array |
| 5175 | 5175 | */ |
| 5176 | 5176 | $state = 0; |
| 5177 | - while($state != 1) |
|
| 5177 | + while ($state != 1) |
|
| 5178 | 5178 | { |
| 5179 | 5179 | $type = isset($str[0]) ? $str[0] : ''; |
| 5180 | - if($type == '}') |
|
| 5180 | + if ($type == '}') |
|
| 5181 | 5181 | $str = substr($str, 1); |
| 5182 | 5182 | |
| 5183 | - else if($type == 'N' && $str[1] == ';') |
|
| 5183 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5184 | 5184 | { |
| 5185 | 5185 | $value = null; |
| 5186 | 5186 | $str = substr($str, 2); |
| 5187 | 5187 | } |
| 5188 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5188 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5189 | 5189 | { |
| 5190 | 5190 | $value = $matches[1] == '1' ? true : false; |
| 5191 | 5191 | $str = substr($str, 4); |
| 5192 | 5192 | } |
| 5193 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5193 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5194 | 5194 | { |
| 5195 | - $value = (int)$matches[1]; |
|
| 5195 | + $value = (int) $matches[1]; |
|
| 5196 | 5196 | $str = $matches[2]; |
| 5197 | 5197 | } |
| 5198 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5198 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5199 | 5199 | { |
| 5200 | - $value = (float)$matches[1]; |
|
| 5200 | + $value = (float) $matches[1]; |
|
| 5201 | 5201 | $str = $matches[3]; |
| 5202 | 5202 | } |
| 5203 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5203 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5204 | 5204 | { |
| 5205 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5206 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5205 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5206 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5207 | 5207 | } |
| 5208 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5208 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5209 | 5209 | { |
| 5210 | - $expectedLength = (int)$matches[1]; |
|
| 5210 | + $expectedLength = (int) $matches[1]; |
|
| 5211 | 5211 | $str = $matches[2]; |
| 5212 | 5212 | } |
| 5213 | 5213 | |
@@ -5215,10 +5215,10 @@ discard block |
||
| 5215 | 5215 | else |
| 5216 | 5216 | return false; |
| 5217 | 5217 | |
| 5218 | - switch($state) |
|
| 5218 | + switch ($state) |
|
| 5219 | 5219 | { |
| 5220 | 5220 | case 3: // In array, expecting value or another array. |
| 5221 | - if($type == 'a') |
|
| 5221 | + if ($type == 'a') |
|
| 5222 | 5222 | { |
| 5223 | 5223 | $stack[] = &$list; |
| 5224 | 5224 | $list[$key] = array(); |
@@ -5227,7 +5227,7 @@ discard block |
||
| 5227 | 5227 | $state = 2; |
| 5228 | 5228 | break; |
| 5229 | 5229 | } |
| 5230 | - if($type != '}') |
|
| 5230 | + if ($type != '}') |
|
| 5231 | 5231 | { |
| 5232 | 5232 | $list[$key] = $value; |
| 5233 | 5233 | $state = 2; |
@@ -5238,29 +5238,29 @@ discard block |
||
| 5238 | 5238 | return false; |
| 5239 | 5239 | |
| 5240 | 5240 | case 2: // in array, expecting end of array or a key |
| 5241 | - if($type == '}') |
|
| 5241 | + if ($type == '}') |
|
| 5242 | 5242 | { |
| 5243 | 5243 | // Array size is less than expected. |
| 5244 | - if(count($list) < end($expected)) |
|
| 5244 | + if (count($list) < end($expected)) |
|
| 5245 | 5245 | return false; |
| 5246 | 5246 | |
| 5247 | 5247 | unset($list); |
| 5248 | - $list = &$stack[count($stack)-1]; |
|
| 5248 | + $list = &$stack[count($stack) - 1]; |
|
| 5249 | 5249 | array_pop($stack); |
| 5250 | 5250 | |
| 5251 | 5251 | // Go to terminal state if we're at the end of the root array. |
| 5252 | 5252 | array_pop($expected); |
| 5253 | 5253 | |
| 5254 | - if(count($expected) == 0) |
|
| 5254 | + if (count($expected) == 0) |
|
| 5255 | 5255 | $state = 1; |
| 5256 | 5256 | |
| 5257 | 5257 | break; |
| 5258 | 5258 | } |
| 5259 | 5259 | |
| 5260 | - if($type == 'i' || $type == 's') |
|
| 5260 | + if ($type == 'i' || $type == 's') |
|
| 5261 | 5261 | { |
| 5262 | 5262 | // Array size exceeds expected length. |
| 5263 | - if(count($list) >= end($expected)) |
|
| 5263 | + if (count($list) >= end($expected)) |
|
| 5264 | 5264 | return false; |
| 5265 | 5265 | |
| 5266 | 5266 | $key = $value; |
@@ -5273,7 +5273,7 @@ discard block |
||
| 5273 | 5273 | |
| 5274 | 5274 | // Expecting array or value. |
| 5275 | 5275 | case 0: |
| 5276 | - if($type == 'a') |
|
| 5276 | + if ($type == 'a') |
|
| 5277 | 5277 | { |
| 5278 | 5278 | $data = array(); |
| 5279 | 5279 | $list = &$data; |
@@ -5282,7 +5282,7 @@ discard block |
||
| 5282 | 5282 | break; |
| 5283 | 5283 | } |
| 5284 | 5284 | |
| 5285 | - if($type != '}') |
|
| 5285 | + if ($type != '}') |
|
| 5286 | 5286 | { |
| 5287 | 5287 | $data = $value; |
| 5288 | 5288 | $state = 1; |
@@ -5295,7 +5295,7 @@ discard block |
||
| 5295 | 5295 | } |
| 5296 | 5296 | |
| 5297 | 5297 | // Trailing data in input. |
| 5298 | - if(!empty($str)) |
|
| 5298 | + if (!empty($str)) |
|
| 5299 | 5299 | return false; |
| 5300 | 5300 | |
| 5301 | 5301 | return $data; |
@@ -5349,7 +5349,7 @@ discard block |
||
| 5349 | 5349 | // Set different modes. |
| 5350 | 5350 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5351 | 5351 | |
| 5352 | - foreach($chmodValues as $val) |
|
| 5352 | + foreach ($chmodValues as $val) |
|
| 5353 | 5353 | { |
| 5354 | 5354 | // If it's writable, break out of the loop. |
| 5355 | 5355 | if (is_writable($file)) |
@@ -5384,13 +5384,13 @@ discard block |
||
| 5384 | 5384 | $returnArray = @json_decode($json, $returnAsArray); |
| 5385 | 5385 | |
| 5386 | 5386 | // PHP 5.3 so no json_last_error_msg() |
| 5387 | - switch(json_last_error()) |
|
| 5387 | + switch (json_last_error()) |
|
| 5388 | 5388 | { |
| 5389 | 5389 | case JSON_ERROR_NONE: |
| 5390 | 5390 | $jsonError = false; |
| 5391 | 5391 | break; |
| 5392 | 5392 | case JSON_ERROR_DEPTH: |
| 5393 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5393 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5394 | 5394 | break; |
| 5395 | 5395 | case JSON_ERROR_STATE_MISMATCH: |
| 5396 | 5396 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5418,10 +5418,10 @@ discard block |
||
| 5418 | 5418 | loadLanguage('Errors'); |
| 5419 | 5419 | |
| 5420 | 5420 | if (!empty($jsonDebug)) |
| 5421 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5421 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5422 | 5422 | |
| 5423 | 5423 | else |
| 5424 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5424 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5425 | 5425 | |
| 5426 | 5426 | // Everyone expects an array. |
| 5427 | 5427 | return array(); |
@@ -5525,7 +5525,7 @@ discard block |
||
| 5525 | 5525 | }); |
| 5526 | 5526 | |
| 5527 | 5527 | // Convert Punycode to Unicode |
| 5528 | - $tlds = array_map(function ($input) { |
|
| 5528 | + $tlds = array_map(function($input) { |
|
| 5529 | 5529 | $prefix = 'xn--'; |
| 5530 | 5530 | $safe_char = 0xFFFC; |
| 5531 | 5531 | $base = 36; |
@@ -5541,7 +5541,7 @@ discard block |
||
| 5541 | 5541 | |
| 5542 | 5542 | foreach ($enco_parts as $encoded) |
| 5543 | 5543 | { |
| 5544 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5544 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5545 | 5545 | { |
| 5546 | 5546 | $output_parts[] = $encoded; |
| 5547 | 5547 | continue; |
@@ -5552,7 +5552,7 @@ discard block |
||
| 5552 | 5552 | $idx = 0; |
| 5553 | 5553 | $char = 0x80; |
| 5554 | 5554 | $decoded = array(); |
| 5555 | - $output=''; |
|
| 5555 | + $output = ''; |
|
| 5556 | 5556 | $delim_pos = strrpos($encoded, '-'); |
| 5557 | 5557 | |
| 5558 | 5558 | if ($delim_pos > strlen($prefix)) |
@@ -5568,7 +5568,7 @@ discard block |
||
| 5568 | 5568 | |
| 5569 | 5569 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5570 | 5570 | { |
| 5571 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5571 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5572 | 5572 | { |
| 5573 | 5573 | $cp = ord($encoded{$enco_idx++}); |
| 5574 | 5574 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5609,15 +5609,15 @@ discard block |
||
| 5609 | 5609 | |
| 5610 | 5610 | // 2 bytes |
| 5611 | 5611 | elseif ($v < (1 << 11)) |
| 5612 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5612 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5613 | 5613 | |
| 5614 | 5614 | // 3 bytes |
| 5615 | 5615 | elseif ($v < (1 << 16)) |
| 5616 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5616 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5617 | 5617 | |
| 5618 | 5618 | // 4 bytes |
| 5619 | 5619 | elseif ($v < (1 << 21)) |
| 5620 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5620 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5621 | 5621 | |
| 5622 | 5622 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5623 | 5623 | else |
@@ -5724,7 +5724,7 @@ discard block |
||
| 5724 | 5724 | } |
| 5725 | 5725 | |
| 5726 | 5726 | // This recursive function creates the index array from the strings |
| 5727 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5727 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5728 | 5728 | { |
| 5729 | 5729 | static $depth = 0; |
| 5730 | 5730 | $depth++; |
@@ -5751,7 +5751,7 @@ discard block |
||
| 5751 | 5751 | }; |
| 5752 | 5752 | |
| 5753 | 5753 | // This recursive function turns the index array into a regular expression |
| 5754 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5754 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5755 | 5755 | { |
| 5756 | 5756 | static $depth = 0; |
| 5757 | 5757 | $depth++; |
@@ -5775,11 +5775,11 @@ discard block |
||
| 5775 | 5775 | |
| 5776 | 5776 | if (count(array_keys($value)) == 1) |
| 5777 | 5777 | { |
| 5778 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 5778 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 5779 | 5779 | $new_key .= $new_key_array[0]; |
| 5780 | 5780 | } |
| 5781 | 5781 | else |
| 5782 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 5782 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 5783 | 5783 | } |
| 5784 | 5784 | |
| 5785 | 5785 | if ($depth > 1) |
@@ -5819,7 +5819,7 @@ discard block |
||
| 5819 | 5819 | $index = $add_string_to_index($string, $index); |
| 5820 | 5820 | |
| 5821 | 5821 | while (!empty($index)) |
| 5822 | - $regexes[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 5822 | + $regexes[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 5823 | 5823 | |
| 5824 | 5824 | // Restore PHP's internal character encoding to whatever it was originally |
| 5825 | 5825 | if (!empty($current_encoding)) |