@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | case 'datetime': |
| 257 | 257 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
| 258 | - return 'str_to_date('. |
|
| 259 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
| 258 | + return 'str_to_date(' . |
|
| 259 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
| 260 | 260 | ',\'%Y-%m-%d %h:%i:%s\')'; |
| 261 | 261 | else |
| 262 | 262 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $old_pos = 0; |
| 461 | 461 | $pos = -1; |
| 462 | 462 | // Remove the string escape for better runtime |
| 463 | - $db_string_1 = str_replace('\\\'','',$db_string); |
|
| 463 | + $db_string_1 = str_replace('\\\'', '', $db_string); |
|
| 464 | 464 | while (true) |
| 465 | 465 | { |
| 466 | 466 | $pos = strpos($db_string_1, '\'', $pos + 1); |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | { |
| 843 | 843 | $count = count($insertRows); |
| 844 | 844 | $ai = 0; |
| 845 | - for($i = 0; $i < $count; $i++) |
|
| 845 | + for ($i = 0; $i < $count; $i++) |
|
| 846 | 846 | { |
| 847 | 847 | $old_id = $smcFunc['db_insert_id'](); |
| 848 | 848 | |
@@ -868,13 +868,13 @@ discard block |
||
| 868 | 868 | $count2 = count($indexed_columns); |
| 869 | 869 | for ($x = 0; $x < $count2; $x++) |
| 870 | 870 | { |
| 871 | - $where_string += key($indexed_columns[$x]) . ' = '. $insertRows[$i][$x]; |
|
| 871 | + $where_string += key($indexed_columns[$x]) . ' = ' . $insertRows[$i][$x]; |
|
| 872 | 872 | if (($x + 1) < $count2) |
| 873 | 873 | $where_string += ' AND '; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $request = $smcFunc['db_query']('',' |
|
| 877 | - SELECT `'. $keys[0] . '` FROM ' . $table .' |
|
| 876 | + $request = $smcFunc['db_query']('', ' |
|
| 877 | + SELECT `'. $keys[0] . '` FROM ' . $table . ' |
|
| 878 | 878 | WHERE ' . $where_string . ' LIMIT 1', |
| 879 | 879 | array() |
| 880 | 880 | ); |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | $return_var = array(); |
| 904 | 904 | $count = count($insertRows); |
| 905 | 905 | $start = smf_db_insert_id($table, $keys[0]); |
| 906 | - for ($i = 0; $i < $count; $i++ ) |
|
| 906 | + for ($i = 0; $i < $count; $i++) |
|
| 907 | 907 | $return_var[] = $start + $i; |
| 908 | 908 | } |
| 909 | 909 | return $return_var; |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | mysqli_stmt_bind_param($mysql_error_data_prep, 'iissssssi', |
| 1037 | 1037 | $error_array[0], $error_array[1], $error_array[2], $error_array[3], $error_array[4], $error_array[5], $error_array[6], |
| 1038 | 1038 | $error_array[7], $error_array[8]); |
| 1039 | - mysqli_stmt_execute ($mysql_error_data_prep); |
|
| 1039 | + mysqli_stmt_execute($mysql_error_data_prep); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | /** |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | */ |
| 1051 | 1051 | function smf_db_custom_order($field, $array_values, $desc = false) |
| 1052 | 1052 | { |
| 1053 | - $return = 'CASE '. $field . ' '; |
|
| 1053 | + $return = 'CASE ' . $field . ' '; |
|
| 1054 | 1054 | $count = count($array_values); |
| 1055 | 1055 | $then = ($desc ? ' THEN -' : ' THEN '); |
| 1056 | 1056 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $smcFunc['db_transaction']('begin'); |
| 128 | 128 | $db_trans = true; |
| 129 | - $smcFunc['db_drop_table']($table_name.'_old'); |
|
| 130 | - $smcFunc['db_query']('',' |
|
| 131 | - RENAME TABLE '. $table_name .' TO ' . $table_name . '_old', |
|
| 129 | + $smcFunc['db_drop_table']($table_name . '_old'); |
|
| 130 | + $smcFunc['db_query']('', ' |
|
| 131 | + RENAME TABLE '. $table_name . ' TO ' . $table_name . '_old', |
|
| 132 | 132 | array( |
| 133 | 133 | 'security_override' => true, |
| 134 | 134 | ) |
@@ -202,15 +202,15 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | $same_col = array(); |
| 204 | 204 | |
| 205 | - $request = $smcFunc['db_query']('',' |
|
| 205 | + $request = $smcFunc['db_query']('', ' |
|
| 206 | 206 | SELECT count(*), column_name |
| 207 | 207 | FROM information_schema.columns |
| 208 | 208 | WHERE table_name in ({string:table1},{string:table2}) AND table_schema = {string:schema} |
| 209 | 209 | GROUP BY column_name |
| 210 | 210 | HAVING count(*) > 1', |
| 211 | - array ( |
|
| 211 | + array( |
|
| 212 | 212 | 'table1' => $table_name, |
| 213 | - 'table2' => $table_name.'_old', |
|
| 213 | + 'table2' => $table_name . '_old', |
|
| 214 | 214 | 'schema' => $db_name, |
| 215 | 215 | ) |
| 216 | 216 | ); |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | $same_col[] = $row['column_name']; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - $smcFunc['db_query']('',' |
|
| 224 | - INSERT INTO ' . $table_name .'(' |
|
| 223 | + $smcFunc['db_query']('', ' |
|
| 224 | + INSERT INTO ' . $table_name . '(' |
|
| 225 | 225 | . implode($same_col, ',') . |
| 226 | 226 | ') |
| 227 | 227 | SELECT '. implode($same_col, ',') . ' |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | { |
| 387 | 387 | $val = 'CASE '; |
| 388 | 388 | foreach ($members as $k => $v) |
| 389 | - $val .= 'WHEN id_member = ' . $v . ' THEN '. count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
| 389 | + $val .= 'WHEN id_member = ' . $v . ' THEN ' . count(fetch_alerts($v, false, 0, array(), false)) . ' '; |
|
| 390 | 390 | $val = $val . ' END'; |
| 391 | 391 | $type = 'raw'; |
| 392 | 392 | } |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | $unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400); |
| 818 | 818 | if (empty($unsupportedFormats)) |
| 819 | 819 | { |
| 820 | - foreach($strftimeFormatSubstitutions as $format => $substitution) |
|
| 820 | + foreach ($strftimeFormatSubstitutions as $format => $substitution) |
|
| 821 | 821 | { |
| 822 | 822 | $value = @strftime('%' . $format); |
| 823 | 823 | |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1183 | 1183 | ), |
| 1184 | 1184 | 'content' => '$1', |
| 1185 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1185 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $returnContext = ''; |
| 1188 | 1188 | |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1220 | - $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']. '" class="atc_img"></a>'; |
|
| 1220 | + $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'] . '" class="atc_img"></a>'; |
|
| 1221 | 1221 | else |
| 1222 | 1222 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
| 1223 | 1223 | } |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | 'type' => 'unparsed_content', |
| 1247 | 1247 | '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>', |
| 1248 | 1248 | // @todo Maybe this can be simplified? |
| 1249 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1249 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1250 | 1250 | { |
| 1251 | 1251 | if (!isset($disabled['code'])) |
| 1252 | 1252 | { |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | 'type' => 'unparsed_equals_content', |
| 1284 | 1284 | '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>', |
| 1285 | 1285 | // @todo Maybe this can be simplified? |
| 1286 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1286 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1287 | 1287 | { |
| 1288 | 1288 | if (!isset($disabled['code'])) |
| 1289 | 1289 | { |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | 'type' => 'unparsed_content', |
| 1328 | 1328 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1329 | 1329 | // @todo Should this respect guest_hideContacts? |
| 1330 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1330 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | $data = strtr($data, array('<br>' => '')); |
| 1333 | 1333 | }, |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | 'type' => 'unparsed_commas_content', |
| 1347 | 1347 | 'test' => '\d+,\d+\]', |
| 1348 | 1348 | 'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">', |
| 1349 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1349 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1350 | 1350 | { |
| 1351 | 1351 | if (isset($disabled['url'])) |
| 1352 | 1352 | $tag['content'] = '$1'; |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
| 1363 | 1363 | 'before' => '<div $1>', |
| 1364 | 1364 | 'after' => '</div>', |
| 1365 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1365 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1366 | 1366 | { |
| 1367 | 1367 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
| 1368 | 1368 | |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1412 | 1412 | ), |
| 1413 | 1413 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1414 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1414 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1415 | 1415 | { |
| 1416 | 1416 | global $image_proxy_enabled, $image_proxy_secret, $boardurl, $user_info; |
| 1417 | 1417 | |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | 'tag' => 'img', |
| 1438 | 1438 | 'type' => 'unparsed_content', |
| 1439 | 1439 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1440 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1440 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1441 | 1441 | { |
| 1442 | 1442 | global $image_proxy_enabled, $image_proxy_secret, $boardurl, $user_info; |
| 1443 | 1443 | |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | 'tag' => 'iurl', |
| 1464 | 1464 | 'type' => 'unparsed_content', |
| 1465 | 1465 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1466 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1466 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1467 | 1467 | { |
| 1468 | 1468 | $data = strtr($data, array('<br>' => '')); |
| 1469 | 1469 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | 'quoted' => 'optional', |
| 1478 | 1478 | 'before' => '<a href="$1" class="bbc_link">', |
| 1479 | 1479 | 'after' => '</a>', |
| 1480 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1480 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1481 | 1481 | { |
| 1482 | 1482 | if (substr($data, 0, 1) == '#') |
| 1483 | 1483 | $data = '#post_' . substr($data, 1); |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | 'tag' => 'php', |
| 1558 | 1558 | 'type' => 'unparsed_content', |
| 1559 | 1559 | 'content' => '<span class="phpcode">$1</span>', |
| 1560 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1560 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1561 | 1561 | { |
| 1562 | 1562 | if (!isset($disabled['php'])) |
| 1563 | 1563 | { |
@@ -1655,7 +1655,7 @@ discard block |
||
| 1655 | 1655 | 'test' => '[1-7]\]', |
| 1656 | 1656 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1657 | 1657 | 'after' => '</span>', |
| 1658 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1658 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1659 | 1659 | { |
| 1660 | 1660 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1661 | 1661 | $data = $sizes[$data] . 'em'; |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | 'tag' => 'time', |
| 1694 | 1694 | 'type' => 'unparsed_content', |
| 1695 | 1695 | 'content' => '$1', |
| 1696 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1696 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1697 | 1697 | { |
| 1698 | 1698 | if (is_numeric($data)) |
| 1699 | 1699 | $data = timeformat($data); |
@@ -1721,7 +1721,7 @@ discard block |
||
| 1721 | 1721 | 'tag' => 'url', |
| 1722 | 1722 | 'type' => 'unparsed_content', |
| 1723 | 1723 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
| 1724 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1724 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1725 | 1725 | { |
| 1726 | 1726 | $data = strtr($data, array('<br>' => '')); |
| 1727 | 1727 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1735,7 +1735,7 @@ discard block |
||
| 1735 | 1735 | 'quoted' => 'optional', |
| 1736 | 1736 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
| 1737 | 1737 | 'after' => '</a>', |
| 1738 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1738 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1739 | 1739 | { |
| 1740 | 1740 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1741 | 1741 | if (empty($scheme)) |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | { |
| 1762 | 1762 | if (isset($temp_bbc)) |
| 1763 | 1763 | $bbc_codes = $temp_bbc; |
| 1764 | - usort($codes, function ($a, $b) { |
|
| 1764 | + usort($codes, function($a, $b) { |
|
| 1765 | 1765 | return strcmp($a['tag'], $b['tag']); |
| 1766 | 1766 | }); |
| 1767 | 1767 | return $codes; |
@@ -1998,7 +1998,7 @@ discard block |
||
| 1998 | 1998 | # a run of Unicode domain name characters and a dot |
| 1999 | 1999 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 2000 | 2000 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 2001 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 2001 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 2002 | 2002 | ) |
| 2003 | 2003 | # followed by a non-domain character or end of line |
| 2004 | 2004 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2066,7 +2066,7 @@ discard block |
||
| 2066 | 2066 | )? |
| 2067 | 2067 | '; |
| 2068 | 2068 | |
| 2069 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2069 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 2070 | 2070 | $url = array_shift($matches); |
| 2071 | 2071 | |
| 2072 | 2072 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2806,7 +2806,7 @@ discard block |
||
| 2806 | 2806 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2807 | 2807 | { |
| 2808 | 2808 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2809 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2809 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2810 | 2810 | |
| 2811 | 2811 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2812 | 2812 | |
@@ -2823,7 +2823,7 @@ discard block |
||
| 2823 | 2823 | |
| 2824 | 2824 | // Replace away! |
| 2825 | 2825 | $message = preg_replace_callback($smileyPregSearch, |
| 2826 | - function ($matches) use ($smileyPregReplacements) |
|
| 2826 | + function($matches) use ($smileyPregReplacements) |
|
| 2827 | 2827 | { |
| 2828 | 2828 | return $smileyPregReplacements[$matches[1]]; |
| 2829 | 2829 | }, $message); |
@@ -2889,13 +2889,13 @@ discard block |
||
| 2889 | 2889 | { |
| 2890 | 2890 | if (defined('SID') && SID != '') |
| 2891 | 2891 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2892 | - function ($m) use ($scripturl) |
|
| 2892 | + function($m) use ($scripturl) |
|
| 2893 | 2893 | { |
| 2894 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2894 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2895 | 2895 | }, $setLocation); |
| 2896 | 2896 | else |
| 2897 | 2897 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2898 | - function ($m) use ($scripturl) |
|
| 2898 | + function($m) use ($scripturl) |
|
| 2899 | 2899 | { |
| 2900 | 2900 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2901 | 2901 | }, $setLocation); |
@@ -3218,7 +3218,7 @@ discard block |
||
| 3218 | 3218 | |
| 3219 | 3219 | // Add a generic "Are you sure?" confirmation message. |
| 3220 | 3220 | addInlineJavaScript(' |
| 3221 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3221 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3222 | 3222 | |
| 3223 | 3223 | // Now add the capping code for avatars. |
| 3224 | 3224 | 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') |
@@ -3579,7 +3579,7 @@ discard block |
||
| 3579 | 3579 | |
| 3580 | 3580 | else |
| 3581 | 3581 | echo ' |
| 3582 | - <script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>'; |
|
| 3582 | + <script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>'; |
|
| 3583 | 3583 | } |
| 3584 | 3584 | |
| 3585 | 3585 | // Inline JavaScript - Actually useful some times! |
@@ -3657,14 +3657,14 @@ discard block |
||
| 3657 | 3657 | |
| 3658 | 3658 | else |
| 3659 | 3659 | echo ' |
| 3660 | - <link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">'; |
|
| 3660 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">'; |
|
| 3661 | 3661 | } |
| 3662 | 3662 | |
| 3663 | 3663 | // Print the rest after the minified files. |
| 3664 | 3664 | if (!empty($normal)) |
| 3665 | 3665 | foreach ($normal as $nf) |
| 3666 | 3666 | echo ' |
| 3667 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3667 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3668 | 3668 | |
| 3669 | 3669 | if ($db_show_debug === true) |
| 3670 | 3670 | { |
@@ -3680,7 +3680,7 @@ discard block |
||
| 3680 | 3680 | <style>'; |
| 3681 | 3681 | |
| 3682 | 3682 | foreach ($context['css_header'] as $css) |
| 3683 | - echo $css .' |
|
| 3683 | + echo $css . ' |
|
| 3684 | 3684 | '; |
| 3685 | 3685 | |
| 3686 | 3686 | echo' |
@@ -3709,27 +3709,27 @@ discard block |
||
| 3709 | 3709 | return false; |
| 3710 | 3710 | |
| 3711 | 3711 | // Did we already did this? |
| 3712 | - $toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400); |
|
| 3712 | + $toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400); |
|
| 3713 | 3713 | |
| 3714 | 3714 | // Already done? |
| 3715 | 3715 | if (!empty($toCache)) |
| 3716 | 3716 | return true; |
| 3717 | 3717 | |
| 3718 | 3718 | // No namespaces, sorry! |
| 3719 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3719 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3720 | 3720 | |
| 3721 | 3721 | // Temp path. |
| 3722 | - $cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/'; |
|
| 3722 | + $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
| 3723 | 3723 | |
| 3724 | 3724 | // What kind of file are we going to create? |
| 3725 | - $toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type; |
|
| 3725 | + $toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type; |
|
| 3726 | 3726 | |
| 3727 | 3727 | // File has to exists, if it isn't try to create it. |
| 3728 | 3728 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
| 3729 | 3729 | { |
| 3730 | 3730 | loadLanguage('Errors'); |
| 3731 | 3731 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3732 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3732 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3733 | 3733 | |
| 3734 | 3734 | // The process failed so roll back to print each individual file. |
| 3735 | 3735 | return $data; |
@@ -3764,14 +3764,14 @@ discard block |
||
| 3764 | 3764 | { |
| 3765 | 3765 | loadLanguage('Errors'); |
| 3766 | 3766 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3767 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3767 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3768 | 3768 | |
| 3769 | 3769 | // The process failed so roll back to print each individual file. |
| 3770 | 3770 | return $data; |
| 3771 | 3771 | } |
| 3772 | 3772 | |
| 3773 | 3773 | // And create a long lived cache entry. |
| 3774 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400); |
|
| 3774 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400); |
|
| 3775 | 3775 | |
| 3776 | 3776 | return true; |
| 3777 | 3777 | } |
@@ -3831,7 +3831,7 @@ discard block |
||
| 3831 | 3831 | else |
| 3832 | 3832 | $path = $modSettings['attachmentUploadDir']; |
| 3833 | 3833 | |
| 3834 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3834 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3835 | 3835 | } |
| 3836 | 3836 | |
| 3837 | 3837 | /** |
@@ -3875,10 +3875,10 @@ discard block |
||
| 3875 | 3875 | $valid_low = isValidIP($ip_parts[0]); |
| 3876 | 3876 | $valid_high = isValidIP($ip_parts[1]); |
| 3877 | 3877 | $count = 0; |
| 3878 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3878 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3879 | 3879 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3880 | 3880 | $min = 0; |
| 3881 | - if(!$valid_low) |
|
| 3881 | + if (!$valid_low) |
|
| 3882 | 3882 | { |
| 3883 | 3883 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3884 | 3884 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3892,7 +3892,7 @@ discard block |
||
| 3892 | 3892 | } |
| 3893 | 3893 | |
| 3894 | 3894 | $count = 0; |
| 3895 | - if(!$valid_high) |
|
| 3895 | + if (!$valid_high) |
|
| 3896 | 3896 | { |
| 3897 | 3897 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3898 | 3898 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3905,7 +3905,7 @@ discard block |
||
| 3905 | 3905 | } |
| 3906 | 3906 | } |
| 3907 | 3907 | |
| 3908 | - if($valid_high && $valid_low) |
|
| 3908 | + if ($valid_high && $valid_low) |
|
| 3909 | 3909 | { |
| 3910 | 3910 | $ip_array['low'] = $ip_parts[0]; |
| 3911 | 3911 | $ip_array['high'] = $ip_parts[1]; |
@@ -4087,7 +4087,7 @@ discard block |
||
| 4087 | 4087 | addInlineJavaScript(' |
| 4088 | 4088 | var user_menus = new smc_PopupMenu(); |
| 4089 | 4089 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4090 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4090 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4091 | 4091 | if ($context['allow_pm']) |
| 4092 | 4092 | addInlineJavaScript(' |
| 4093 | 4093 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4707,7 +4707,7 @@ discard block |
||
| 4707 | 4707 | // No? try a fallback to $sourcedir |
| 4708 | 4708 | else |
| 4709 | 4709 | { |
| 4710 | - $absPath = $sourcedir .'/'. $file; |
|
| 4710 | + $absPath = $sourcedir . '/' . $file; |
|
| 4711 | 4711 | |
| 4712 | 4712 | if (file_exists($absPath)) |
| 4713 | 4713 | require_once($absPath); |
@@ -4788,15 +4788,15 @@ discard block |
||
| 4788 | 4788 | |
| 4789 | 4789 | // UTF-8 occurences of MS special characters |
| 4790 | 4790 | $findchars_utf8 = array( |
| 4791 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4792 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4793 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4794 | - "\xe2\x80\x98", // left single curly quote |
|
| 4795 | - "\xe2\x80\x99", // right single curly quote |
|
| 4796 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4797 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4798 | - "\xe2\x80\x93", // en dash |
|
| 4799 | - "\xe2\x80\x94", // em dash |
|
| 4791 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4792 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4793 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4794 | + "\xe2\x80\x98", // left single curly quote |
|
| 4795 | + "\xe2\x80\x99", // right single curly quote |
|
| 4796 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4797 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4798 | + "\xe2\x80\x93", // en dash |
|
| 4799 | + "\xe2\x80\x94", // em dash |
|
| 4800 | 4800 | ); |
| 4801 | 4801 | |
| 4802 | 4802 | // windows 1252 / iso equivalents |
@@ -4814,15 +4814,15 @@ discard block |
||
| 4814 | 4814 | |
| 4815 | 4815 | // safe replacements |
| 4816 | 4816 | $replacechars = array( |
| 4817 | - ',', // ‚ |
|
| 4818 | - ',,', // „ |
|
| 4819 | - '...', // … |
|
| 4820 | - "'", // ‘ |
|
| 4821 | - "'", // ’ |
|
| 4822 | - '"', // “ |
|
| 4823 | - '"', // ” |
|
| 4824 | - '-', // – |
|
| 4825 | - '--', // — |
|
| 4817 | + ',', // ‚ |
|
| 4818 | + ',,', // „ |
|
| 4819 | + '...', // … |
|
| 4820 | + "'", // ‘ |
|
| 4821 | + "'", // ’ |
|
| 4822 | + '"', // “ |
|
| 4823 | + '"', // ” |
|
| 4824 | + '-', // – |
|
| 4825 | + '--', // — |
|
| 4826 | 4826 | ); |
| 4827 | 4827 | |
| 4828 | 4828 | if ($context['utf8']) |
@@ -5240,7 +5240,7 @@ discard block |
||
| 5240 | 5240 | */ |
| 5241 | 5241 | function inet_dtop($bin) |
| 5242 | 5242 | { |
| 5243 | - if(empty($bin)) |
|
| 5243 | + if (empty($bin)) |
|
| 5244 | 5244 | return ''; |
| 5245 | 5245 | |
| 5246 | 5246 | global $db_type; |
@@ -5271,28 +5271,28 @@ discard block |
||
| 5271 | 5271 | */ |
| 5272 | 5272 | function _safe_serialize($value) |
| 5273 | 5273 | { |
| 5274 | - if(is_null($value)) |
|
| 5274 | + if (is_null($value)) |
|
| 5275 | 5275 | return 'N;'; |
| 5276 | 5276 | |
| 5277 | - if(is_bool($value)) |
|
| 5278 | - return 'b:'. (int) $value .';'; |
|
| 5277 | + if (is_bool($value)) |
|
| 5278 | + return 'b:' . (int) $value . ';'; |
|
| 5279 | 5279 | |
| 5280 | - if(is_int($value)) |
|
| 5281 | - return 'i:'. $value .';'; |
|
| 5280 | + if (is_int($value)) |
|
| 5281 | + return 'i:' . $value . ';'; |
|
| 5282 | 5282 | |
| 5283 | - if(is_float($value)) |
|
| 5284 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5283 | + if (is_float($value)) |
|
| 5284 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5285 | 5285 | |
| 5286 | - if(is_string($value)) |
|
| 5287 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5286 | + if (is_string($value)) |
|
| 5287 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5288 | 5288 | |
| 5289 | - if(is_array($value)) |
|
| 5289 | + if (is_array($value)) |
|
| 5290 | 5290 | { |
| 5291 | 5291 | $out = ''; |
| 5292 | - foreach($value as $k => $v) |
|
| 5292 | + foreach ($value as $k => $v) |
|
| 5293 | 5293 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5294 | 5294 | |
| 5295 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5295 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5296 | 5296 | } |
| 5297 | 5297 | |
| 5298 | 5298 | // safe_serialize cannot serialize resources or objects. |
@@ -5334,7 +5334,7 @@ discard block |
||
| 5334 | 5334 | function _safe_unserialize($str) |
| 5335 | 5335 | { |
| 5336 | 5336 | // Input is not a string. |
| 5337 | - if(empty($str) || !is_string($str)) |
|
| 5337 | + if (empty($str) || !is_string($str)) |
|
| 5338 | 5338 | return false; |
| 5339 | 5339 | |
| 5340 | 5340 | $stack = array(); |
@@ -5348,40 +5348,40 @@ discard block |
||
| 5348 | 5348 | * 3 - in array, expecting value or another array |
| 5349 | 5349 | */ |
| 5350 | 5350 | $state = 0; |
| 5351 | - while($state != 1) |
|
| 5351 | + while ($state != 1) |
|
| 5352 | 5352 | { |
| 5353 | 5353 | $type = isset($str[0]) ? $str[0] : ''; |
| 5354 | - if($type == '}') |
|
| 5354 | + if ($type == '}') |
|
| 5355 | 5355 | $str = substr($str, 1); |
| 5356 | 5356 | |
| 5357 | - else if($type == 'N' && $str[1] == ';') |
|
| 5357 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5358 | 5358 | { |
| 5359 | 5359 | $value = null; |
| 5360 | 5360 | $str = substr($str, 2); |
| 5361 | 5361 | } |
| 5362 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5362 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5363 | 5363 | { |
| 5364 | 5364 | $value = $matches[1] == '1' ? true : false; |
| 5365 | 5365 | $str = substr($str, 4); |
| 5366 | 5366 | } |
| 5367 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5367 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5368 | 5368 | { |
| 5369 | - $value = (int)$matches[1]; |
|
| 5369 | + $value = (int) $matches[1]; |
|
| 5370 | 5370 | $str = $matches[2]; |
| 5371 | 5371 | } |
| 5372 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5372 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5373 | 5373 | { |
| 5374 | - $value = (float)$matches[1]; |
|
| 5374 | + $value = (float) $matches[1]; |
|
| 5375 | 5375 | $str = $matches[3]; |
| 5376 | 5376 | } |
| 5377 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5377 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5378 | 5378 | { |
| 5379 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5380 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5379 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5380 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5381 | 5381 | } |
| 5382 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5382 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5383 | 5383 | { |
| 5384 | - $expectedLength = (int)$matches[1]; |
|
| 5384 | + $expectedLength = (int) $matches[1]; |
|
| 5385 | 5385 | $str = $matches[2]; |
| 5386 | 5386 | } |
| 5387 | 5387 | |
@@ -5389,10 +5389,10 @@ discard block |
||
| 5389 | 5389 | else |
| 5390 | 5390 | return false; |
| 5391 | 5391 | |
| 5392 | - switch($state) |
|
| 5392 | + switch ($state) |
|
| 5393 | 5393 | { |
| 5394 | 5394 | case 3: // In array, expecting value or another array. |
| 5395 | - if($type == 'a') |
|
| 5395 | + if ($type == 'a') |
|
| 5396 | 5396 | { |
| 5397 | 5397 | $stack[] = &$list; |
| 5398 | 5398 | $list[$key] = array(); |
@@ -5401,7 +5401,7 @@ discard block |
||
| 5401 | 5401 | $state = 2; |
| 5402 | 5402 | break; |
| 5403 | 5403 | } |
| 5404 | - if($type != '}') |
|
| 5404 | + if ($type != '}') |
|
| 5405 | 5405 | { |
| 5406 | 5406 | $list[$key] = $value; |
| 5407 | 5407 | $state = 2; |
@@ -5412,29 +5412,29 @@ discard block |
||
| 5412 | 5412 | return false; |
| 5413 | 5413 | |
| 5414 | 5414 | case 2: // in array, expecting end of array or a key |
| 5415 | - if($type == '}') |
|
| 5415 | + if ($type == '}') |
|
| 5416 | 5416 | { |
| 5417 | 5417 | // Array size is less than expected. |
| 5418 | - if(count($list) < end($expected)) |
|
| 5418 | + if (count($list) < end($expected)) |
|
| 5419 | 5419 | return false; |
| 5420 | 5420 | |
| 5421 | 5421 | unset($list); |
| 5422 | - $list = &$stack[count($stack)-1]; |
|
| 5422 | + $list = &$stack[count($stack) - 1]; |
|
| 5423 | 5423 | array_pop($stack); |
| 5424 | 5424 | |
| 5425 | 5425 | // Go to terminal state if we're at the end of the root array. |
| 5426 | 5426 | array_pop($expected); |
| 5427 | 5427 | |
| 5428 | - if(count($expected) == 0) |
|
| 5428 | + if (count($expected) == 0) |
|
| 5429 | 5429 | $state = 1; |
| 5430 | 5430 | |
| 5431 | 5431 | break; |
| 5432 | 5432 | } |
| 5433 | 5433 | |
| 5434 | - if($type == 'i' || $type == 's') |
|
| 5434 | + if ($type == 'i' || $type == 's') |
|
| 5435 | 5435 | { |
| 5436 | 5436 | // Array size exceeds expected length. |
| 5437 | - if(count($list) >= end($expected)) |
|
| 5437 | + if (count($list) >= end($expected)) |
|
| 5438 | 5438 | return false; |
| 5439 | 5439 | |
| 5440 | 5440 | $key = $value; |
@@ -5447,7 +5447,7 @@ discard block |
||
| 5447 | 5447 | |
| 5448 | 5448 | // Expecting array or value. |
| 5449 | 5449 | case 0: |
| 5450 | - if($type == 'a') |
|
| 5450 | + if ($type == 'a') |
|
| 5451 | 5451 | { |
| 5452 | 5452 | $data = array(); |
| 5453 | 5453 | $list = &$data; |
@@ -5456,7 +5456,7 @@ discard block |
||
| 5456 | 5456 | break; |
| 5457 | 5457 | } |
| 5458 | 5458 | |
| 5459 | - if($type != '}') |
|
| 5459 | + if ($type != '}') |
|
| 5460 | 5460 | { |
| 5461 | 5461 | $data = $value; |
| 5462 | 5462 | $state = 1; |
@@ -5469,7 +5469,7 @@ discard block |
||
| 5469 | 5469 | } |
| 5470 | 5470 | |
| 5471 | 5471 | // Trailing data in input. |
| 5472 | - if(!empty($str)) |
|
| 5472 | + if (!empty($str)) |
|
| 5473 | 5473 | return false; |
| 5474 | 5474 | |
| 5475 | 5475 | return $data; |
@@ -5523,7 +5523,7 @@ discard block |
||
| 5523 | 5523 | // Set different modes. |
| 5524 | 5524 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5525 | 5525 | |
| 5526 | - foreach($chmodValues as $val) |
|
| 5526 | + foreach ($chmodValues as $val) |
|
| 5527 | 5527 | { |
| 5528 | 5528 | // If it's writable, break out of the loop. |
| 5529 | 5529 | if (is_writable($file)) |
@@ -5558,13 +5558,13 @@ discard block |
||
| 5558 | 5558 | $returnArray = @json_decode($json, $returnAsArray); |
| 5559 | 5559 | |
| 5560 | 5560 | // PHP 5.3 so no json_last_error_msg() |
| 5561 | - switch(json_last_error()) |
|
| 5561 | + switch (json_last_error()) |
|
| 5562 | 5562 | { |
| 5563 | 5563 | case JSON_ERROR_NONE: |
| 5564 | 5564 | $jsonError = false; |
| 5565 | 5565 | break; |
| 5566 | 5566 | case JSON_ERROR_DEPTH: |
| 5567 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5567 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5568 | 5568 | break; |
| 5569 | 5569 | case JSON_ERROR_STATE_MISMATCH: |
| 5570 | 5570 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5592,10 +5592,10 @@ discard block |
||
| 5592 | 5592 | loadLanguage('Errors'); |
| 5593 | 5593 | |
| 5594 | 5594 | if (!empty($jsonDebug)) |
| 5595 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5595 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5596 | 5596 | |
| 5597 | 5597 | else |
| 5598 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5598 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5599 | 5599 | |
| 5600 | 5600 | // Everyone expects an array. |
| 5601 | 5601 | return array(); |
@@ -5707,7 +5707,7 @@ discard block |
||
| 5707 | 5707 | }); |
| 5708 | 5708 | |
| 5709 | 5709 | // Convert Punycode to Unicode |
| 5710 | - $tlds = array_map(function ($input) { |
|
| 5710 | + $tlds = array_map(function($input) { |
|
| 5711 | 5711 | $prefix = 'xn--'; |
| 5712 | 5712 | $safe_char = 0xFFFC; |
| 5713 | 5713 | $base = 36; |
@@ -5723,7 +5723,7 @@ discard block |
||
| 5723 | 5723 | |
| 5724 | 5724 | foreach ($enco_parts as $encoded) |
| 5725 | 5725 | { |
| 5726 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5726 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5727 | 5727 | { |
| 5728 | 5728 | $output_parts[] = $encoded; |
| 5729 | 5729 | continue; |
@@ -5734,7 +5734,7 @@ discard block |
||
| 5734 | 5734 | $idx = 0; |
| 5735 | 5735 | $char = 0x80; |
| 5736 | 5736 | $decoded = array(); |
| 5737 | - $output=''; |
|
| 5737 | + $output = ''; |
|
| 5738 | 5738 | $delim_pos = strrpos($encoded, '-'); |
| 5739 | 5739 | |
| 5740 | 5740 | if ($delim_pos > strlen($prefix)) |
@@ -5750,7 +5750,7 @@ discard block |
||
| 5750 | 5750 | |
| 5751 | 5751 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5752 | 5752 | { |
| 5753 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5753 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5754 | 5754 | { |
| 5755 | 5755 | $cp = ord($encoded{$enco_idx++}); |
| 5756 | 5756 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5791,15 +5791,15 @@ discard block |
||
| 5791 | 5791 | |
| 5792 | 5792 | // 2 bytes |
| 5793 | 5793 | elseif ($v < (1 << 11)) |
| 5794 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5794 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5795 | 5795 | |
| 5796 | 5796 | // 3 bytes |
| 5797 | 5797 | elseif ($v < (1 << 16)) |
| 5798 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5798 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5799 | 5799 | |
| 5800 | 5800 | // 4 bytes |
| 5801 | 5801 | elseif ($v < (1 << 21)) |
| 5802 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5802 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5803 | 5803 | |
| 5804 | 5804 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5805 | 5805 | else |
@@ -5904,7 +5904,7 @@ discard block |
||
| 5904 | 5904 | } |
| 5905 | 5905 | |
| 5906 | 5906 | // This recursive function creates the index array from the strings |
| 5907 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5907 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5908 | 5908 | { |
| 5909 | 5909 | static $depth = 0; |
| 5910 | 5910 | $depth++; |
@@ -5931,7 +5931,7 @@ discard block |
||
| 5931 | 5931 | }; |
| 5932 | 5932 | |
| 5933 | 5933 | // This recursive function turns the index array into a regular expression |
| 5934 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5934 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5935 | 5935 | { |
| 5936 | 5936 | static $depth = 0; |
| 5937 | 5937 | $depth++; |
@@ -5955,11 +5955,11 @@ discard block |
||
| 5955 | 5955 | |
| 5956 | 5956 | if (count(array_keys($value)) == 1) |
| 5957 | 5957 | { |
| 5958 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 5958 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 5959 | 5959 | $new_key .= $new_key_array[0]; |
| 5960 | 5960 | } |
| 5961 | 5961 | else |
| 5962 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 5962 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 5963 | 5963 | } |
| 5964 | 5964 | |
| 5965 | 5965 | if ($depth > 1) |
@@ -6002,10 +6002,10 @@ discard block |
||
| 6002 | 6002 | { |
| 6003 | 6003 | $regex = array(); |
| 6004 | 6004 | while (!empty($index)) |
| 6005 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6005 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6006 | 6006 | } |
| 6007 | 6007 | else |
| 6008 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6008 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6009 | 6009 | |
| 6010 | 6010 | // Restore PHP's internal character encoding to whatever it was originally |
| 6011 | 6011 | if (!empty($current_encoding)) |