@@ -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, $image_proxy_url; |
| 1417 | 1417 | |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | 'tag' => 'img', |
| 1441 | 1441 | 'type' => 'unparsed_content', |
| 1442 | 1442 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1443 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1443 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1444 | 1444 | { |
| 1445 | 1445 | global $image_proxy_enabled, $image_proxy_secret, $boardurl, $image_proxy_url, $user_info; |
| 1446 | 1446 | |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | 'tag' => 'iurl', |
| 1470 | 1470 | 'type' => 'unparsed_content', |
| 1471 | 1471 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1472 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1472 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1473 | 1473 | { |
| 1474 | 1474 | $data = strtr($data, array('<br>' => '')); |
| 1475 | 1475 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | 'quoted' => 'optional', |
| 1484 | 1484 | 'before' => '<a href="$1" class="bbc_link">', |
| 1485 | 1485 | 'after' => '</a>', |
| 1486 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1486 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1487 | 1487 | { |
| 1488 | 1488 | if (substr($data, 0, 1) == '#') |
| 1489 | 1489 | $data = '#post_' . substr($data, 1); |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | 'tag' => 'php', |
| 1564 | 1564 | 'type' => 'unparsed_content', |
| 1565 | 1565 | 'content' => '<span class="phpcode">$1</span>', |
| 1566 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1566 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1567 | 1567 | { |
| 1568 | 1568 | if (!isset($disabled['php'])) |
| 1569 | 1569 | { |
@@ -1661,7 +1661,7 @@ discard block |
||
| 1661 | 1661 | 'test' => '[1-7]\]', |
| 1662 | 1662 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1663 | 1663 | 'after' => '</span>', |
| 1664 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1664 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1665 | 1665 | { |
| 1666 | 1666 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1667 | 1667 | $data = $sizes[$data] . 'em'; |
@@ -1699,7 +1699,7 @@ discard block |
||
| 1699 | 1699 | 'tag' => 'time', |
| 1700 | 1700 | 'type' => 'unparsed_content', |
| 1701 | 1701 | 'content' => '$1', |
| 1702 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1702 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1703 | 1703 | { |
| 1704 | 1704 | if (is_numeric($data)) |
| 1705 | 1705 | $data = timeformat($data); |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | 'tag' => 'url', |
| 1728 | 1728 | 'type' => 'unparsed_content', |
| 1729 | 1729 | 'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>', |
| 1730 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1730 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1731 | 1731 | { |
| 1732 | 1732 | $data = strtr($data, array('<br>' => '')); |
| 1733 | 1733 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1741,7 +1741,7 @@ discard block |
||
| 1741 | 1741 | 'quoted' => 'optional', |
| 1742 | 1742 | 'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">', |
| 1743 | 1743 | 'after' => '</a>', |
| 1744 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1744 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1745 | 1745 | { |
| 1746 | 1746 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1747 | 1747 | if (empty($scheme)) |
@@ -1767,7 +1767,7 @@ discard block |
||
| 1767 | 1767 | { |
| 1768 | 1768 | if (isset($temp_bbc)) |
| 1769 | 1769 | $bbc_codes = $temp_bbc; |
| 1770 | - usort($codes, function ($a, $b) { |
|
| 1770 | + usort($codes, function($a, $b) { |
|
| 1771 | 1771 | return strcmp($a['tag'], $b['tag']); |
| 1772 | 1772 | }); |
| 1773 | 1773 | return $codes; |
@@ -2004,7 +2004,7 @@ discard block |
||
| 2004 | 2004 | # a run of Unicode domain name characters and a dot |
| 2005 | 2005 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 2006 | 2006 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 2007 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 2007 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 2008 | 2008 | ) |
| 2009 | 2009 | # followed by a non-domain character or end of line |
| 2010 | 2010 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -2072,7 +2072,7 @@ discard block |
||
| 2072 | 2072 | )? |
| 2073 | 2073 | '; |
| 2074 | 2074 | |
| 2075 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 2075 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 2076 | 2076 | $url = array_shift($matches); |
| 2077 | 2077 | |
| 2078 | 2078 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2153,7 +2153,7 @@ discard block |
||
| 2153 | 2153 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2154 | 2154 | |
| 2155 | 2155 | // A closing tag that doesn't match any open tags? Skip it. |
| 2156 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2156 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
| 2157 | 2157 | continue; |
| 2158 | 2158 | |
| 2159 | 2159 | $to_close = array(); |
@@ -2820,7 +2820,7 @@ discard block |
||
| 2820 | 2820 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2821 | 2821 | { |
| 2822 | 2822 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2823 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2823 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2824 | 2824 | |
| 2825 | 2825 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2826 | 2826 | |
@@ -2837,7 +2837,7 @@ discard block |
||
| 2837 | 2837 | |
| 2838 | 2838 | // Replace away! |
| 2839 | 2839 | $message = preg_replace_callback($smileyPregSearch, |
| 2840 | - function ($matches) use ($smileyPregReplacements) |
|
| 2840 | + function($matches) use ($smileyPregReplacements) |
|
| 2841 | 2841 | { |
| 2842 | 2842 | return $smileyPregReplacements[$matches[1]]; |
| 2843 | 2843 | }, $message); |
@@ -2903,13 +2903,13 @@ discard block |
||
| 2903 | 2903 | { |
| 2904 | 2904 | if (defined('SID') && SID != '') |
| 2905 | 2905 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2906 | - function ($m) use ($scripturl) |
|
| 2906 | + function($m) use ($scripturl) |
|
| 2907 | 2907 | { |
| 2908 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2908 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2909 | 2909 | }, $setLocation); |
| 2910 | 2910 | else |
| 2911 | 2911 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2912 | - function ($m) use ($scripturl) |
|
| 2912 | + function($m) use ($scripturl) |
|
| 2913 | 2913 | { |
| 2914 | 2914 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2915 | 2915 | }, $setLocation); |
@@ -3232,7 +3232,7 @@ discard block |
||
| 3232 | 3232 | |
| 3233 | 3233 | // Add a generic "Are you sure?" confirmation message. |
| 3234 | 3234 | addInlineJavaScript(' |
| 3235 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3235 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3236 | 3236 | |
| 3237 | 3237 | // Now add the capping code for avatars. |
| 3238 | 3238 | 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') |
@@ -3676,7 +3676,7 @@ discard block |
||
| 3676 | 3676 | if (!empty($normal)) |
| 3677 | 3677 | foreach ($normal as $nf) |
| 3678 | 3678 | echo ' |
| 3679 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3679 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3680 | 3680 | |
| 3681 | 3681 | if ($db_show_debug === true) |
| 3682 | 3682 | { |
@@ -3692,7 +3692,7 @@ discard block |
||
| 3692 | 3692 | <style>'; |
| 3693 | 3693 | |
| 3694 | 3694 | foreach ($context['css_header'] as $css) |
| 3695 | - echo $css .' |
|
| 3695 | + echo $css . ' |
|
| 3696 | 3696 | '; |
| 3697 | 3697 | |
| 3698 | 3698 | echo' |
@@ -3731,7 +3731,7 @@ discard block |
||
| 3731 | 3731 | return true; |
| 3732 | 3732 | |
| 3733 | 3733 | // No namespaces, sorry! |
| 3734 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3734 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3735 | 3735 | |
| 3736 | 3736 | // Temp path. |
| 3737 | 3737 | $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
@@ -3857,7 +3857,7 @@ discard block |
||
| 3857 | 3857 | else |
| 3858 | 3858 | $path = $modSettings['attachmentUploadDir']; |
| 3859 | 3859 | |
| 3860 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3860 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3861 | 3861 | } |
| 3862 | 3862 | |
| 3863 | 3863 | /** |
@@ -3901,10 +3901,10 @@ discard block |
||
| 3901 | 3901 | $valid_low = isValidIP($ip_parts[0]); |
| 3902 | 3902 | $valid_high = isValidIP($ip_parts[1]); |
| 3903 | 3903 | $count = 0; |
| 3904 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3904 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3905 | 3905 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3906 | 3906 | $min = 0; |
| 3907 | - if(!$valid_low) |
|
| 3907 | + if (!$valid_low) |
|
| 3908 | 3908 | { |
| 3909 | 3909 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3910 | 3910 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3918,7 +3918,7 @@ discard block |
||
| 3918 | 3918 | } |
| 3919 | 3919 | |
| 3920 | 3920 | $count = 0; |
| 3921 | - if(!$valid_high) |
|
| 3921 | + if (!$valid_high) |
|
| 3922 | 3922 | { |
| 3923 | 3923 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3924 | 3924 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3931,7 +3931,7 @@ discard block |
||
| 3931 | 3931 | } |
| 3932 | 3932 | } |
| 3933 | 3933 | |
| 3934 | - if($valid_high && $valid_low) |
|
| 3934 | + if ($valid_high && $valid_low) |
|
| 3935 | 3935 | { |
| 3936 | 3936 | $ip_array['low'] = $ip_parts[0]; |
| 3937 | 3937 | $ip_array['high'] = $ip_parts[1]; |
@@ -4113,7 +4113,7 @@ discard block |
||
| 4113 | 4113 | addInlineJavaScript(' |
| 4114 | 4114 | var user_menus = new smc_PopupMenu(); |
| 4115 | 4115 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4116 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4116 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4117 | 4117 | if ($context['allow_pm']) |
| 4118 | 4118 | addInlineJavaScript(' |
| 4119 | 4119 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4749,7 +4749,7 @@ discard block |
||
| 4749 | 4749 | // No? try a fallback to $sourcedir |
| 4750 | 4750 | else |
| 4751 | 4751 | { |
| 4752 | - $absPath = $sourcedir .'/'. $file; |
|
| 4752 | + $absPath = $sourcedir . '/' . $file; |
|
| 4753 | 4753 | |
| 4754 | 4754 | if (file_exists($absPath)) |
| 4755 | 4755 | require_once($absPath); |
@@ -4830,15 +4830,15 @@ discard block |
||
| 4830 | 4830 | |
| 4831 | 4831 | // UTF-8 occurences of MS special characters |
| 4832 | 4832 | $findchars_utf8 = array( |
| 4833 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4834 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4835 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4836 | - "\xe2\x80\x98", // left single curly quote |
|
| 4837 | - "\xe2\x80\x99", // right single curly quote |
|
| 4838 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4839 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4840 | - "\xe2\x80\x93", // en dash |
|
| 4841 | - "\xe2\x80\x94", // em dash |
|
| 4833 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4834 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4835 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4836 | + "\xe2\x80\x98", // left single curly quote |
|
| 4837 | + "\xe2\x80\x99", // right single curly quote |
|
| 4838 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4839 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4840 | + "\xe2\x80\x93", // en dash |
|
| 4841 | + "\xe2\x80\x94", // em dash |
|
| 4842 | 4842 | ); |
| 4843 | 4843 | |
| 4844 | 4844 | // windows 1252 / iso equivalents |
@@ -4856,15 +4856,15 @@ discard block |
||
| 4856 | 4856 | |
| 4857 | 4857 | // safe replacements |
| 4858 | 4858 | $replacechars = array( |
| 4859 | - ',', // ‚ |
|
| 4860 | - ',,', // „ |
|
| 4861 | - '...', // … |
|
| 4862 | - "'", // ‘ |
|
| 4863 | - "'", // ’ |
|
| 4864 | - '"', // “ |
|
| 4865 | - '"', // ” |
|
| 4866 | - '-', // – |
|
| 4867 | - '--', // — |
|
| 4859 | + ',', // ‚ |
|
| 4860 | + ',,', // „ |
|
| 4861 | + '...', // … |
|
| 4862 | + "'", // ‘ |
|
| 4863 | + "'", // ’ |
|
| 4864 | + '"', // “ |
|
| 4865 | + '"', // ” |
|
| 4866 | + '-', // – |
|
| 4867 | + '--', // — |
|
| 4868 | 4868 | ); |
| 4869 | 4869 | |
| 4870 | 4870 | if ($context['utf8']) |
@@ -5282,7 +5282,7 @@ discard block |
||
| 5282 | 5282 | */ |
| 5283 | 5283 | function inet_dtop($bin) |
| 5284 | 5284 | { |
| 5285 | - if(empty($bin)) |
|
| 5285 | + if (empty($bin)) |
|
| 5286 | 5286 | return ''; |
| 5287 | 5287 | |
| 5288 | 5288 | global $db_type; |
@@ -5313,28 +5313,28 @@ discard block |
||
| 5313 | 5313 | */ |
| 5314 | 5314 | function _safe_serialize($value) |
| 5315 | 5315 | { |
| 5316 | - if(is_null($value)) |
|
| 5316 | + if (is_null($value)) |
|
| 5317 | 5317 | return 'N;'; |
| 5318 | 5318 | |
| 5319 | - if(is_bool($value)) |
|
| 5320 | - return 'b:'. (int) $value .';'; |
|
| 5319 | + if (is_bool($value)) |
|
| 5320 | + return 'b:' . (int) $value . ';'; |
|
| 5321 | 5321 | |
| 5322 | - if(is_int($value)) |
|
| 5323 | - return 'i:'. $value .';'; |
|
| 5322 | + if (is_int($value)) |
|
| 5323 | + return 'i:' . $value . ';'; |
|
| 5324 | 5324 | |
| 5325 | - if(is_float($value)) |
|
| 5326 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5325 | + if (is_float($value)) |
|
| 5326 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5327 | 5327 | |
| 5328 | - if(is_string($value)) |
|
| 5329 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5328 | + if (is_string($value)) |
|
| 5329 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5330 | 5330 | |
| 5331 | - if(is_array($value)) |
|
| 5331 | + if (is_array($value)) |
|
| 5332 | 5332 | { |
| 5333 | 5333 | $out = ''; |
| 5334 | - foreach($value as $k => $v) |
|
| 5334 | + foreach ($value as $k => $v) |
|
| 5335 | 5335 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5336 | 5336 | |
| 5337 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5337 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5338 | 5338 | } |
| 5339 | 5339 | |
| 5340 | 5340 | // safe_serialize cannot serialize resources or objects. |
@@ -5376,7 +5376,7 @@ discard block |
||
| 5376 | 5376 | function _safe_unserialize($str) |
| 5377 | 5377 | { |
| 5378 | 5378 | // Input is not a string. |
| 5379 | - if(empty($str) || !is_string($str)) |
|
| 5379 | + if (empty($str) || !is_string($str)) |
|
| 5380 | 5380 | return false; |
| 5381 | 5381 | |
| 5382 | 5382 | $stack = array(); |
@@ -5390,40 +5390,40 @@ discard block |
||
| 5390 | 5390 | * 3 - in array, expecting value or another array |
| 5391 | 5391 | */ |
| 5392 | 5392 | $state = 0; |
| 5393 | - while($state != 1) |
|
| 5393 | + while ($state != 1) |
|
| 5394 | 5394 | { |
| 5395 | 5395 | $type = isset($str[0]) ? $str[0] : ''; |
| 5396 | - if($type == '}') |
|
| 5396 | + if ($type == '}') |
|
| 5397 | 5397 | $str = substr($str, 1); |
| 5398 | 5398 | |
| 5399 | - else if($type == 'N' && $str[1] == ';') |
|
| 5399 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5400 | 5400 | { |
| 5401 | 5401 | $value = null; |
| 5402 | 5402 | $str = substr($str, 2); |
| 5403 | 5403 | } |
| 5404 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5404 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5405 | 5405 | { |
| 5406 | 5406 | $value = $matches[1] == '1' ? true : false; |
| 5407 | 5407 | $str = substr($str, 4); |
| 5408 | 5408 | } |
| 5409 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5409 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5410 | 5410 | { |
| 5411 | - $value = (int)$matches[1]; |
|
| 5411 | + $value = (int) $matches[1]; |
|
| 5412 | 5412 | $str = $matches[2]; |
| 5413 | 5413 | } |
| 5414 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5414 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5415 | 5415 | { |
| 5416 | - $value = (float)$matches[1]; |
|
| 5416 | + $value = (float) $matches[1]; |
|
| 5417 | 5417 | $str = $matches[3]; |
| 5418 | 5418 | } |
| 5419 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5419 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5420 | 5420 | { |
| 5421 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5422 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5421 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5422 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5423 | 5423 | } |
| 5424 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5424 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5425 | 5425 | { |
| 5426 | - $expectedLength = (int)$matches[1]; |
|
| 5426 | + $expectedLength = (int) $matches[1]; |
|
| 5427 | 5427 | $str = $matches[2]; |
| 5428 | 5428 | } |
| 5429 | 5429 | |
@@ -5431,10 +5431,10 @@ discard block |
||
| 5431 | 5431 | else |
| 5432 | 5432 | return false; |
| 5433 | 5433 | |
| 5434 | - switch($state) |
|
| 5434 | + switch ($state) |
|
| 5435 | 5435 | { |
| 5436 | 5436 | case 3: // In array, expecting value or another array. |
| 5437 | - if($type == 'a') |
|
| 5437 | + if ($type == 'a') |
|
| 5438 | 5438 | { |
| 5439 | 5439 | $stack[] = &$list; |
| 5440 | 5440 | $list[$key] = array(); |
@@ -5443,7 +5443,7 @@ discard block |
||
| 5443 | 5443 | $state = 2; |
| 5444 | 5444 | break; |
| 5445 | 5445 | } |
| 5446 | - if($type != '}') |
|
| 5446 | + if ($type != '}') |
|
| 5447 | 5447 | { |
| 5448 | 5448 | $list[$key] = $value; |
| 5449 | 5449 | $state = 2; |
@@ -5454,29 +5454,29 @@ discard block |
||
| 5454 | 5454 | return false; |
| 5455 | 5455 | |
| 5456 | 5456 | case 2: // in array, expecting end of array or a key |
| 5457 | - if($type == '}') |
|
| 5457 | + if ($type == '}') |
|
| 5458 | 5458 | { |
| 5459 | 5459 | // Array size is less than expected. |
| 5460 | - if(count($list) < end($expected)) |
|
| 5460 | + if (count($list) < end($expected)) |
|
| 5461 | 5461 | return false; |
| 5462 | 5462 | |
| 5463 | 5463 | unset($list); |
| 5464 | - $list = &$stack[count($stack)-1]; |
|
| 5464 | + $list = &$stack[count($stack) - 1]; |
|
| 5465 | 5465 | array_pop($stack); |
| 5466 | 5466 | |
| 5467 | 5467 | // Go to terminal state if we're at the end of the root array. |
| 5468 | 5468 | array_pop($expected); |
| 5469 | 5469 | |
| 5470 | - if(count($expected) == 0) |
|
| 5470 | + if (count($expected) == 0) |
|
| 5471 | 5471 | $state = 1; |
| 5472 | 5472 | |
| 5473 | 5473 | break; |
| 5474 | 5474 | } |
| 5475 | 5475 | |
| 5476 | - if($type == 'i' || $type == 's') |
|
| 5476 | + if ($type == 'i' || $type == 's') |
|
| 5477 | 5477 | { |
| 5478 | 5478 | // Array size exceeds expected length. |
| 5479 | - if(count($list) >= end($expected)) |
|
| 5479 | + if (count($list) >= end($expected)) |
|
| 5480 | 5480 | return false; |
| 5481 | 5481 | |
| 5482 | 5482 | $key = $value; |
@@ -5489,7 +5489,7 @@ discard block |
||
| 5489 | 5489 | |
| 5490 | 5490 | // Expecting array or value. |
| 5491 | 5491 | case 0: |
| 5492 | - if($type == 'a') |
|
| 5492 | + if ($type == 'a') |
|
| 5493 | 5493 | { |
| 5494 | 5494 | $data = array(); |
| 5495 | 5495 | $list = &$data; |
@@ -5498,7 +5498,7 @@ discard block |
||
| 5498 | 5498 | break; |
| 5499 | 5499 | } |
| 5500 | 5500 | |
| 5501 | - if($type != '}') |
|
| 5501 | + if ($type != '}') |
|
| 5502 | 5502 | { |
| 5503 | 5503 | $data = $value; |
| 5504 | 5504 | $state = 1; |
@@ -5511,7 +5511,7 @@ discard block |
||
| 5511 | 5511 | } |
| 5512 | 5512 | |
| 5513 | 5513 | // Trailing data in input. |
| 5514 | - if(!empty($str)) |
|
| 5514 | + if (!empty($str)) |
|
| 5515 | 5515 | return false; |
| 5516 | 5516 | |
| 5517 | 5517 | return $data; |
@@ -5565,7 +5565,7 @@ discard block |
||
| 5565 | 5565 | // Set different modes. |
| 5566 | 5566 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5567 | 5567 | |
| 5568 | - foreach($chmodValues as $val) |
|
| 5568 | + foreach ($chmodValues as $val) |
|
| 5569 | 5569 | { |
| 5570 | 5570 | // If it's writable, break out of the loop. |
| 5571 | 5571 | if (is_writable($file)) |
@@ -5600,13 +5600,13 @@ discard block |
||
| 5600 | 5600 | $returnArray = @json_decode($json, $returnAsArray); |
| 5601 | 5601 | |
| 5602 | 5602 | // PHP 5.3 so no json_last_error_msg() |
| 5603 | - switch(json_last_error()) |
|
| 5603 | + switch (json_last_error()) |
|
| 5604 | 5604 | { |
| 5605 | 5605 | case JSON_ERROR_NONE: |
| 5606 | 5606 | $jsonError = false; |
| 5607 | 5607 | break; |
| 5608 | 5608 | case JSON_ERROR_DEPTH: |
| 5609 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5609 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5610 | 5610 | break; |
| 5611 | 5611 | case JSON_ERROR_STATE_MISMATCH: |
| 5612 | 5612 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5634,10 +5634,10 @@ discard block |
||
| 5634 | 5634 | loadLanguage('Errors'); |
| 5635 | 5635 | |
| 5636 | 5636 | if (!empty($jsonDebug)) |
| 5637 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5637 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5638 | 5638 | |
| 5639 | 5639 | else |
| 5640 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5640 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5641 | 5641 | |
| 5642 | 5642 | // Everyone expects an array. |
| 5643 | 5643 | return array(); |
@@ -5749,7 +5749,7 @@ discard block |
||
| 5749 | 5749 | }); |
| 5750 | 5750 | |
| 5751 | 5751 | // Convert Punycode to Unicode |
| 5752 | - $tlds = array_map(function ($input) { |
|
| 5752 | + $tlds = array_map(function($input) { |
|
| 5753 | 5753 | $prefix = 'xn--'; |
| 5754 | 5754 | $safe_char = 0xFFFC; |
| 5755 | 5755 | $base = 36; |
@@ -5765,7 +5765,7 @@ discard block |
||
| 5765 | 5765 | |
| 5766 | 5766 | foreach ($enco_parts as $encoded) |
| 5767 | 5767 | { |
| 5768 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5768 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5769 | 5769 | { |
| 5770 | 5770 | $output_parts[] = $encoded; |
| 5771 | 5771 | continue; |
@@ -5776,7 +5776,7 @@ discard block |
||
| 5776 | 5776 | $idx = 0; |
| 5777 | 5777 | $char = 0x80; |
| 5778 | 5778 | $decoded = array(); |
| 5779 | - $output=''; |
|
| 5779 | + $output = ''; |
|
| 5780 | 5780 | $delim_pos = strrpos($encoded, '-'); |
| 5781 | 5781 | |
| 5782 | 5782 | if ($delim_pos > strlen($prefix)) |
@@ -5792,7 +5792,7 @@ discard block |
||
| 5792 | 5792 | |
| 5793 | 5793 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5794 | 5794 | { |
| 5795 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5795 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5796 | 5796 | { |
| 5797 | 5797 | $cp = ord($encoded{$enco_idx++}); |
| 5798 | 5798 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5833,15 +5833,15 @@ discard block |
||
| 5833 | 5833 | |
| 5834 | 5834 | // 2 bytes |
| 5835 | 5835 | elseif ($v < (1 << 11)) |
| 5836 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5836 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5837 | 5837 | |
| 5838 | 5838 | // 3 bytes |
| 5839 | 5839 | elseif ($v < (1 << 16)) |
| 5840 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5840 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5841 | 5841 | |
| 5842 | 5842 | // 4 bytes |
| 5843 | 5843 | elseif ($v < (1 << 21)) |
| 5844 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5844 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5845 | 5845 | |
| 5846 | 5846 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5847 | 5847 | else |
@@ -5946,7 +5946,7 @@ discard block |
||
| 5946 | 5946 | } |
| 5947 | 5947 | |
| 5948 | 5948 | // This recursive function creates the index array from the strings |
| 5949 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5949 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5950 | 5950 | { |
| 5951 | 5951 | static $depth = 0; |
| 5952 | 5952 | $depth++; |
@@ -5973,7 +5973,7 @@ discard block |
||
| 5973 | 5973 | }; |
| 5974 | 5974 | |
| 5975 | 5975 | // This recursive function turns the index array into a regular expression |
| 5976 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5976 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5977 | 5977 | { |
| 5978 | 5978 | static $depth = 0; |
| 5979 | 5979 | $depth++; |
@@ -5997,11 +5997,11 @@ discard block |
||
| 5997 | 5997 | |
| 5998 | 5998 | if (count(array_keys($value)) == 1) |
| 5999 | 5999 | { |
| 6000 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 6000 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 6001 | 6001 | $new_key .= $new_key_array[0]; |
| 6002 | 6002 | } |
| 6003 | 6003 | else |
| 6004 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 6004 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 6005 | 6005 | } |
| 6006 | 6006 | |
| 6007 | 6007 | if ($depth > 1) |
@@ -6044,10 +6044,10 @@ discard block |
||
| 6044 | 6044 | { |
| 6045 | 6045 | $regex = array(); |
| 6046 | 6046 | while (!empty($index)) |
| 6047 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6047 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6048 | 6048 | } |
| 6049 | 6049 | else |
| 6050 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6050 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6051 | 6051 | |
| 6052 | 6052 | // Restore PHP's internal character encoding to whatever it was originally |
| 6053 | 6053 | if (!empty($current_encoding)) |