@@ -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']. '" class="atc_img"></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'] . '" class="atc_img"></a>'; |
|
| 1136 | 1136 | else |
| 1137 | 1137 | $returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>'; |
| 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'; |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | 'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]', |
| 1278 | 1278 | 'before' => '<div $1>', |
| 1279 | 1279 | 'after' => '</div>', |
| 1280 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1280 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1281 | 1281 | { |
| 1282 | 1282 | $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; |
| 1283 | 1283 | |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1327 | 1327 | ), |
| 1328 | 1328 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1329 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1329 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1330 | 1330 | { |
| 1331 | 1331 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
| 1332 | 1332 | |
@@ -1349,7 +1349,7 @@ discard block |
||
| 1349 | 1349 | 'tag' => 'img', |
| 1350 | 1350 | 'type' => 'unparsed_content', |
| 1351 | 1351 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1352 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1352 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1353 | 1353 | { |
| 1354 | 1354 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
| 1355 | 1355 | |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | 'tag' => 'iurl', |
| 1373 | 1373 | 'type' => 'unparsed_content', |
| 1374 | 1374 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1375 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1375 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1376 | 1376 | { |
| 1377 | 1377 | $data = strtr($data, array('<br>' => '')); |
| 1378 | 1378 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | 'quoted' => 'optional', |
| 1387 | 1387 | 'before' => '<a href="$1" class="bbc_link">', |
| 1388 | 1388 | 'after' => '</a>', |
| 1389 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1389 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1390 | 1390 | { |
| 1391 | 1391 | if (substr($data, 0, 1) == '#') |
| 1392 | 1392 | $data = '#post_' . substr($data, 1); |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | 'tag' => 'php', |
| 1467 | 1467 | 'type' => 'unparsed_content', |
| 1468 | 1468 | 'content' => '<span class="phpcode">$1</span>', |
| 1469 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1469 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1470 | 1470 | { |
| 1471 | 1471 | if (!isset($disabled['php'])) |
| 1472 | 1472 | { |
@@ -1564,7 +1564,7 @@ discard block |
||
| 1564 | 1564 | 'test' => '[1-7]\]', |
| 1565 | 1565 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1566 | 1566 | 'after' => '</span>', |
| 1567 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1567 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1568 | 1568 | { |
| 1569 | 1569 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1570 | 1570 | $data = $sizes[$data] . 'em'; |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | 'tag' => 'time', |
| 1603 | 1603 | 'type' => 'unparsed_content', |
| 1604 | 1604 | 'content' => '$1', |
| 1605 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1605 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1606 | 1606 | { |
| 1607 | 1607 | if (is_numeric($data)) |
| 1608 | 1608 | $data = timeformat($data); |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | 'tag' => 'url', |
| 1631 | 1631 | 'type' => 'unparsed_content', |
| 1632 | 1632 | 'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>', |
| 1633 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1633 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1634 | 1634 | { |
| 1635 | 1635 | $data = strtr($data, array('<br>' => '')); |
| 1636 | 1636 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1644,7 +1644,7 @@ discard block |
||
| 1644 | 1644 | 'quoted' => 'optional', |
| 1645 | 1645 | 'before' => '<a href="$1" class="bbc_link" target="_blank">', |
| 1646 | 1646 | 'after' => '</a>', |
| 1647 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1647 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1648 | 1648 | { |
| 1649 | 1649 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1650 | 1650 | if (empty($scheme)) |
@@ -1670,7 +1670,7 @@ discard block |
||
| 1670 | 1670 | { |
| 1671 | 1671 | if (isset($temp_bbc)) |
| 1672 | 1672 | $bbc_codes = $temp_bbc; |
| 1673 | - usort($codes, function ($a, $b) { |
|
| 1673 | + usort($codes, function($a, $b) { |
|
| 1674 | 1674 | return strcmp($a['tag'], $b['tag']); |
| 1675 | 1675 | }); |
| 1676 | 1676 | return $codes; |
@@ -1908,7 +1908,7 @@ discard block |
||
| 1908 | 1908 | # a run of Unicode domain name characters and a dot |
| 1909 | 1909 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 1910 | 1910 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 1911 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 1911 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 1912 | 1912 | ) |
| 1913 | 1913 | # followed by a non-domain character or end of line |
| 1914 | 1914 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -1976,7 +1976,7 @@ discard block |
||
| 1976 | 1976 | )? |
| 1977 | 1977 | '; |
| 1978 | 1978 | |
| 1979 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 1979 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 1980 | 1980 | $url = array_shift($matches); |
| 1981 | 1981 | |
| 1982 | 1982 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2713,7 +2713,7 @@ discard block |
||
| 2713 | 2713 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2714 | 2714 | { |
| 2715 | 2715 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2716 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2716 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2717 | 2717 | |
| 2718 | 2718 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2719 | 2719 | |
@@ -2730,7 +2730,7 @@ discard block |
||
| 2730 | 2730 | |
| 2731 | 2731 | // Replace away! |
| 2732 | 2732 | $message = preg_replace_callback($smileyPregSearch, |
| 2733 | - function ($matches) use ($smileyPregReplacements) |
|
| 2733 | + function($matches) use ($smileyPregReplacements) |
|
| 2734 | 2734 | { |
| 2735 | 2735 | return $smileyPregReplacements[$matches[1]]; |
| 2736 | 2736 | }, $message); |
@@ -2796,13 +2796,13 @@ discard block |
||
| 2796 | 2796 | { |
| 2797 | 2797 | if (defined('SID') && SID != '') |
| 2798 | 2798 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2799 | - function ($m) use ($scripturl) |
|
| 2799 | + function($m) use ($scripturl) |
|
| 2800 | 2800 | { |
| 2801 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2801 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2802 | 2802 | }, $setLocation); |
| 2803 | 2803 | else |
| 2804 | 2804 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2805 | - function ($m) use ($scripturl) |
|
| 2805 | + function($m) use ($scripturl) |
|
| 2806 | 2806 | { |
| 2807 | 2807 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2808 | 2808 | }, $setLocation); |
@@ -3125,7 +3125,7 @@ discard block |
||
| 3125 | 3125 | |
| 3126 | 3126 | // Add a generic "Are you sure?" confirmation message. |
| 3127 | 3127 | addInlineJavaScript(' |
| 3128 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3128 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3129 | 3129 | |
| 3130 | 3130 | // Now add the capping code for avatars. |
| 3131 | 3131 | 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') |
@@ -3486,7 +3486,7 @@ discard block |
||
| 3486 | 3486 | |
| 3487 | 3487 | else |
| 3488 | 3488 | echo ' |
| 3489 | - <script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>'; |
|
| 3489 | + <script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>'; |
|
| 3490 | 3490 | } |
| 3491 | 3491 | |
| 3492 | 3492 | // Inline JavaScript - Actually useful some times! |
@@ -3564,14 +3564,14 @@ discard block |
||
| 3564 | 3564 | |
| 3565 | 3565 | else |
| 3566 | 3566 | echo ' |
| 3567 | - <link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">'; |
|
| 3567 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">'; |
|
| 3568 | 3568 | } |
| 3569 | 3569 | |
| 3570 | 3570 | // Print the rest after the minified files. |
| 3571 | 3571 | if (!empty($normal)) |
| 3572 | 3572 | foreach ($normal as $nf) |
| 3573 | 3573 | echo ' |
| 3574 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3574 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3575 | 3575 | |
| 3576 | 3576 | if ($db_show_debug === true) |
| 3577 | 3577 | { |
@@ -3587,7 +3587,7 @@ discard block |
||
| 3587 | 3587 | <style>'; |
| 3588 | 3588 | |
| 3589 | 3589 | foreach ($context['css_header'] as $css) |
| 3590 | - echo $css .' |
|
| 3590 | + echo $css . ' |
|
| 3591 | 3591 | '; |
| 3592 | 3592 | |
| 3593 | 3593 | echo' |
@@ -3616,27 +3616,27 @@ discard block |
||
| 3616 | 3616 | return false; |
| 3617 | 3617 | |
| 3618 | 3618 | // Did we already did this? |
| 3619 | - $toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400); |
|
| 3619 | + $toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400); |
|
| 3620 | 3620 | |
| 3621 | 3621 | // Already done? |
| 3622 | 3622 | if (!empty($toCache)) |
| 3623 | 3623 | return true; |
| 3624 | 3624 | |
| 3625 | 3625 | // No namespaces, sorry! |
| 3626 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3626 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3627 | 3627 | |
| 3628 | 3628 | // Temp path. |
| 3629 | - $cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/'; |
|
| 3629 | + $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
| 3630 | 3630 | |
| 3631 | 3631 | // What kind of file are we going to create? |
| 3632 | - $toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type; |
|
| 3632 | + $toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type; |
|
| 3633 | 3633 | |
| 3634 | 3634 | // File has to exists, if it isn't try to create it. |
| 3635 | 3635 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
| 3636 | 3636 | { |
| 3637 | 3637 | loadLanguage('Errors'); |
| 3638 | 3638 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3639 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3639 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3640 | 3640 | |
| 3641 | 3641 | // The process failed so roll back to print each individual file. |
| 3642 | 3642 | return $data; |
@@ -3671,14 +3671,14 @@ discard block |
||
| 3671 | 3671 | { |
| 3672 | 3672 | loadLanguage('Errors'); |
| 3673 | 3673 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3674 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3674 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3675 | 3675 | |
| 3676 | 3676 | // The process failed so roll back to print each individual file. |
| 3677 | 3677 | return $data; |
| 3678 | 3678 | } |
| 3679 | 3679 | |
| 3680 | 3680 | // And create a long lived cache entry. |
| 3681 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400); |
|
| 3681 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400); |
|
| 3682 | 3682 | |
| 3683 | 3683 | return true; |
| 3684 | 3684 | } |
@@ -3738,7 +3738,7 @@ discard block |
||
| 3738 | 3738 | else |
| 3739 | 3739 | $path = $modSettings['attachmentUploadDir']; |
| 3740 | 3740 | |
| 3741 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3741 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3742 | 3742 | } |
| 3743 | 3743 | |
| 3744 | 3744 | /** |
@@ -3782,10 +3782,10 @@ discard block |
||
| 3782 | 3782 | $valid_low = isValidIP($ip_parts[0]); |
| 3783 | 3783 | $valid_high = isValidIP($ip_parts[1]); |
| 3784 | 3784 | $count = 0; |
| 3785 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3785 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3786 | 3786 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3787 | 3787 | $min = 0; |
| 3788 | - if(!$valid_low) |
|
| 3788 | + if (!$valid_low) |
|
| 3789 | 3789 | { |
| 3790 | 3790 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3791 | 3791 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3799,7 +3799,7 @@ discard block |
||
| 3799 | 3799 | } |
| 3800 | 3800 | |
| 3801 | 3801 | $count = 0; |
| 3802 | - if(!$valid_high) |
|
| 3802 | + if (!$valid_high) |
|
| 3803 | 3803 | { |
| 3804 | 3804 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3805 | 3805 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3812,7 +3812,7 @@ discard block |
||
| 3812 | 3812 | } |
| 3813 | 3813 | } |
| 3814 | 3814 | |
| 3815 | - if($valid_high && $valid_low) |
|
| 3815 | + if ($valid_high && $valid_low) |
|
| 3816 | 3816 | { |
| 3817 | 3817 | $ip_array['low'] = $ip_parts[0]; |
| 3818 | 3818 | $ip_array['high'] = $ip_parts[1]; |
@@ -3994,7 +3994,7 @@ discard block |
||
| 3994 | 3994 | addInlineJavaScript(' |
| 3995 | 3995 | var user_menus = new smc_PopupMenu(); |
| 3996 | 3996 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 3997 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 3997 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 3998 | 3998 | if ($context['allow_pm']) |
| 3999 | 3999 | addInlineJavaScript(' |
| 4000 | 4000 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4619,7 +4619,7 @@ discard block |
||
| 4619 | 4619 | // No? try a fallback to $sourcedir |
| 4620 | 4620 | else |
| 4621 | 4621 | { |
| 4622 | - $absPath = $sourcedir .'/'. $file; |
|
| 4622 | + $absPath = $sourcedir . '/' . $file; |
|
| 4623 | 4623 | |
| 4624 | 4624 | if (file_exists($absPath)) |
| 4625 | 4625 | require_once($absPath); |
@@ -4700,15 +4700,15 @@ discard block |
||
| 4700 | 4700 | |
| 4701 | 4701 | // UTF-8 occurences of MS special characters |
| 4702 | 4702 | $findchars_utf8 = array( |
| 4703 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4704 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4705 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4706 | - "\xe2\x80\x98", // left single curly quote |
|
| 4707 | - "\xe2\x80\x99", // right single curly quote |
|
| 4708 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4709 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4710 | - "\xe2\x80\x93", // en dash |
|
| 4711 | - "\xe2\x80\x94", // em dash |
|
| 4703 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4704 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4705 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4706 | + "\xe2\x80\x98", // left single curly quote |
|
| 4707 | + "\xe2\x80\x99", // right single curly quote |
|
| 4708 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4709 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4710 | + "\xe2\x80\x93", // en dash |
|
| 4711 | + "\xe2\x80\x94", // em dash |
|
| 4712 | 4712 | ); |
| 4713 | 4713 | |
| 4714 | 4714 | // windows 1252 / iso equivalents |
@@ -4726,15 +4726,15 @@ discard block |
||
| 4726 | 4726 | |
| 4727 | 4727 | // safe replacements |
| 4728 | 4728 | $replacechars = array( |
| 4729 | - ',', // ‚ |
|
| 4730 | - ',,', // „ |
|
| 4731 | - '...', // … |
|
| 4732 | - "'", // ‘ |
|
| 4733 | - "'", // ’ |
|
| 4734 | - '"', // “ |
|
| 4735 | - '"', // ” |
|
| 4736 | - '-', // – |
|
| 4737 | - '--', // — |
|
| 4729 | + ',', // ‚ |
|
| 4730 | + ',,', // „ |
|
| 4731 | + '...', // … |
|
| 4732 | + "'", // ‘ |
|
| 4733 | + "'", // ’ |
|
| 4734 | + '"', // “ |
|
| 4735 | + '"', // ” |
|
| 4736 | + '-', // – |
|
| 4737 | + '--', // — |
|
| 4738 | 4738 | ); |
| 4739 | 4739 | |
| 4740 | 4740 | if ($context['utf8']) |
@@ -5097,7 +5097,7 @@ discard block |
||
| 5097 | 5097 | */ |
| 5098 | 5098 | function inet_dtop($bin) |
| 5099 | 5099 | { |
| 5100 | - if(empty($bin)) |
|
| 5100 | + if (empty($bin)) |
|
| 5101 | 5101 | return ''; |
| 5102 | 5102 | |
| 5103 | 5103 | global $db_type; |
@@ -5128,28 +5128,28 @@ discard block |
||
| 5128 | 5128 | */ |
| 5129 | 5129 | function _safe_serialize($value) |
| 5130 | 5130 | { |
| 5131 | - if(is_null($value)) |
|
| 5131 | + if (is_null($value)) |
|
| 5132 | 5132 | return 'N;'; |
| 5133 | 5133 | |
| 5134 | - if(is_bool($value)) |
|
| 5135 | - return 'b:'. (int) $value .';'; |
|
| 5134 | + if (is_bool($value)) |
|
| 5135 | + return 'b:' . (int) $value . ';'; |
|
| 5136 | 5136 | |
| 5137 | - if(is_int($value)) |
|
| 5138 | - return 'i:'. $value .';'; |
|
| 5137 | + if (is_int($value)) |
|
| 5138 | + return 'i:' . $value . ';'; |
|
| 5139 | 5139 | |
| 5140 | - if(is_float($value)) |
|
| 5141 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5140 | + if (is_float($value)) |
|
| 5141 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5142 | 5142 | |
| 5143 | - if(is_string($value)) |
|
| 5144 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5143 | + if (is_string($value)) |
|
| 5144 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5145 | 5145 | |
| 5146 | - if(is_array($value)) |
|
| 5146 | + if (is_array($value)) |
|
| 5147 | 5147 | { |
| 5148 | 5148 | $out = ''; |
| 5149 | - foreach($value as $k => $v) |
|
| 5149 | + foreach ($value as $k => $v) |
|
| 5150 | 5150 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5151 | 5151 | |
| 5152 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5152 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5153 | 5153 | } |
| 5154 | 5154 | |
| 5155 | 5155 | // safe_serialize cannot serialize resources or objects. |
@@ -5191,7 +5191,7 @@ discard block |
||
| 5191 | 5191 | function _safe_unserialize($str) |
| 5192 | 5192 | { |
| 5193 | 5193 | // Input is not a string. |
| 5194 | - if(empty($str) || !is_string($str)) |
|
| 5194 | + if (empty($str) || !is_string($str)) |
|
| 5195 | 5195 | return false; |
| 5196 | 5196 | |
| 5197 | 5197 | $stack = array(); |
@@ -5205,40 +5205,40 @@ discard block |
||
| 5205 | 5205 | * 3 - in array, expecting value or another array |
| 5206 | 5206 | */ |
| 5207 | 5207 | $state = 0; |
| 5208 | - while($state != 1) |
|
| 5208 | + while ($state != 1) |
|
| 5209 | 5209 | { |
| 5210 | 5210 | $type = isset($str[0]) ? $str[0] : ''; |
| 5211 | - if($type == '}') |
|
| 5211 | + if ($type == '}') |
|
| 5212 | 5212 | $str = substr($str, 1); |
| 5213 | 5213 | |
| 5214 | - else if($type == 'N' && $str[1] == ';') |
|
| 5214 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5215 | 5215 | { |
| 5216 | 5216 | $value = null; |
| 5217 | 5217 | $str = substr($str, 2); |
| 5218 | 5218 | } |
| 5219 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5219 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5220 | 5220 | { |
| 5221 | 5221 | $value = $matches[1] == '1' ? true : false; |
| 5222 | 5222 | $str = substr($str, 4); |
| 5223 | 5223 | } |
| 5224 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5224 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5225 | 5225 | { |
| 5226 | - $value = (int)$matches[1]; |
|
| 5226 | + $value = (int) $matches[1]; |
|
| 5227 | 5227 | $str = $matches[2]; |
| 5228 | 5228 | } |
| 5229 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5229 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5230 | 5230 | { |
| 5231 | - $value = (float)$matches[1]; |
|
| 5231 | + $value = (float) $matches[1]; |
|
| 5232 | 5232 | $str = $matches[3]; |
| 5233 | 5233 | } |
| 5234 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5234 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5235 | 5235 | { |
| 5236 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5237 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5236 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5237 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5238 | 5238 | } |
| 5239 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5239 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5240 | 5240 | { |
| 5241 | - $expectedLength = (int)$matches[1]; |
|
| 5241 | + $expectedLength = (int) $matches[1]; |
|
| 5242 | 5242 | $str = $matches[2]; |
| 5243 | 5243 | } |
| 5244 | 5244 | |
@@ -5246,10 +5246,10 @@ discard block |
||
| 5246 | 5246 | else |
| 5247 | 5247 | return false; |
| 5248 | 5248 | |
| 5249 | - switch($state) |
|
| 5249 | + switch ($state) |
|
| 5250 | 5250 | { |
| 5251 | 5251 | case 3: // In array, expecting value or another array. |
| 5252 | - if($type == 'a') |
|
| 5252 | + if ($type == 'a') |
|
| 5253 | 5253 | { |
| 5254 | 5254 | $stack[] = &$list; |
| 5255 | 5255 | $list[$key] = array(); |
@@ -5258,7 +5258,7 @@ discard block |
||
| 5258 | 5258 | $state = 2; |
| 5259 | 5259 | break; |
| 5260 | 5260 | } |
| 5261 | - if($type != '}') |
|
| 5261 | + if ($type != '}') |
|
| 5262 | 5262 | { |
| 5263 | 5263 | $list[$key] = $value; |
| 5264 | 5264 | $state = 2; |
@@ -5269,29 +5269,29 @@ discard block |
||
| 5269 | 5269 | return false; |
| 5270 | 5270 | |
| 5271 | 5271 | case 2: // in array, expecting end of array or a key |
| 5272 | - if($type == '}') |
|
| 5272 | + if ($type == '}') |
|
| 5273 | 5273 | { |
| 5274 | 5274 | // Array size is less than expected. |
| 5275 | - if(count($list) < end($expected)) |
|
| 5275 | + if (count($list) < end($expected)) |
|
| 5276 | 5276 | return false; |
| 5277 | 5277 | |
| 5278 | 5278 | unset($list); |
| 5279 | - $list = &$stack[count($stack)-1]; |
|
| 5279 | + $list = &$stack[count($stack) - 1]; |
|
| 5280 | 5280 | array_pop($stack); |
| 5281 | 5281 | |
| 5282 | 5282 | // Go to terminal state if we're at the end of the root array. |
| 5283 | 5283 | array_pop($expected); |
| 5284 | 5284 | |
| 5285 | - if(count($expected) == 0) |
|
| 5285 | + if (count($expected) == 0) |
|
| 5286 | 5286 | $state = 1; |
| 5287 | 5287 | |
| 5288 | 5288 | break; |
| 5289 | 5289 | } |
| 5290 | 5290 | |
| 5291 | - if($type == 'i' || $type == 's') |
|
| 5291 | + if ($type == 'i' || $type == 's') |
|
| 5292 | 5292 | { |
| 5293 | 5293 | // Array size exceeds expected length. |
| 5294 | - if(count($list) >= end($expected)) |
|
| 5294 | + if (count($list) >= end($expected)) |
|
| 5295 | 5295 | return false; |
| 5296 | 5296 | |
| 5297 | 5297 | $key = $value; |
@@ -5304,7 +5304,7 @@ discard block |
||
| 5304 | 5304 | |
| 5305 | 5305 | // Expecting array or value. |
| 5306 | 5306 | case 0: |
| 5307 | - if($type == 'a') |
|
| 5307 | + if ($type == 'a') |
|
| 5308 | 5308 | { |
| 5309 | 5309 | $data = array(); |
| 5310 | 5310 | $list = &$data; |
@@ -5313,7 +5313,7 @@ discard block |
||
| 5313 | 5313 | break; |
| 5314 | 5314 | } |
| 5315 | 5315 | |
| 5316 | - if($type != '}') |
|
| 5316 | + if ($type != '}') |
|
| 5317 | 5317 | { |
| 5318 | 5318 | $data = $value; |
| 5319 | 5319 | $state = 1; |
@@ -5326,7 +5326,7 @@ discard block |
||
| 5326 | 5326 | } |
| 5327 | 5327 | |
| 5328 | 5328 | // Trailing data in input. |
| 5329 | - if(!empty($str)) |
|
| 5329 | + if (!empty($str)) |
|
| 5330 | 5330 | return false; |
| 5331 | 5331 | |
| 5332 | 5332 | return $data; |
@@ -5380,7 +5380,7 @@ discard block |
||
| 5380 | 5380 | // Set different modes. |
| 5381 | 5381 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5382 | 5382 | |
| 5383 | - foreach($chmodValues as $val) |
|
| 5383 | + foreach ($chmodValues as $val) |
|
| 5384 | 5384 | { |
| 5385 | 5385 | // If it's writable, break out of the loop. |
| 5386 | 5386 | if (is_writable($file)) |
@@ -5415,13 +5415,13 @@ discard block |
||
| 5415 | 5415 | $returnArray = @json_decode($json, $returnAsArray); |
| 5416 | 5416 | |
| 5417 | 5417 | // PHP 5.3 so no json_last_error_msg() |
| 5418 | - switch(json_last_error()) |
|
| 5418 | + switch (json_last_error()) |
|
| 5419 | 5419 | { |
| 5420 | 5420 | case JSON_ERROR_NONE: |
| 5421 | 5421 | $jsonError = false; |
| 5422 | 5422 | break; |
| 5423 | 5423 | case JSON_ERROR_DEPTH: |
| 5424 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5424 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5425 | 5425 | break; |
| 5426 | 5426 | case JSON_ERROR_STATE_MISMATCH: |
| 5427 | 5427 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5449,10 +5449,10 @@ discard block |
||
| 5449 | 5449 | loadLanguage('Errors'); |
| 5450 | 5450 | |
| 5451 | 5451 | if (!empty($jsonDebug)) |
| 5452 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5452 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5453 | 5453 | |
| 5454 | 5454 | else |
| 5455 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5455 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5456 | 5456 | |
| 5457 | 5457 | // Everyone expects an array. |
| 5458 | 5458 | return array(); |
@@ -5556,7 +5556,7 @@ discard block |
||
| 5556 | 5556 | }); |
| 5557 | 5557 | |
| 5558 | 5558 | // Convert Punycode to Unicode |
| 5559 | - $tlds = array_map(function ($input) { |
|
| 5559 | + $tlds = array_map(function($input) { |
|
| 5560 | 5560 | $prefix = 'xn--'; |
| 5561 | 5561 | $safe_char = 0xFFFC; |
| 5562 | 5562 | $base = 36; |
@@ -5572,7 +5572,7 @@ discard block |
||
| 5572 | 5572 | |
| 5573 | 5573 | foreach ($enco_parts as $encoded) |
| 5574 | 5574 | { |
| 5575 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5575 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5576 | 5576 | { |
| 5577 | 5577 | $output_parts[] = $encoded; |
| 5578 | 5578 | continue; |
@@ -5583,7 +5583,7 @@ discard block |
||
| 5583 | 5583 | $idx = 0; |
| 5584 | 5584 | $char = 0x80; |
| 5585 | 5585 | $decoded = array(); |
| 5586 | - $output=''; |
|
| 5586 | + $output = ''; |
|
| 5587 | 5587 | $delim_pos = strrpos($encoded, '-'); |
| 5588 | 5588 | |
| 5589 | 5589 | if ($delim_pos > strlen($prefix)) |
@@ -5599,7 +5599,7 @@ discard block |
||
| 5599 | 5599 | |
| 5600 | 5600 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5601 | 5601 | { |
| 5602 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5602 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5603 | 5603 | { |
| 5604 | 5604 | $cp = ord($encoded{$enco_idx++}); |
| 5605 | 5605 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5640,15 +5640,15 @@ discard block |
||
| 5640 | 5640 | |
| 5641 | 5641 | // 2 bytes |
| 5642 | 5642 | elseif ($v < (1 << 11)) |
| 5643 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5643 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5644 | 5644 | |
| 5645 | 5645 | // 3 bytes |
| 5646 | 5646 | elseif ($v < (1 << 16)) |
| 5647 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5647 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5648 | 5648 | |
| 5649 | 5649 | // 4 bytes |
| 5650 | 5650 | elseif ($v < (1 << 21)) |
| 5651 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5651 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5652 | 5652 | |
| 5653 | 5653 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5654 | 5654 | else |
@@ -5755,7 +5755,7 @@ discard block |
||
| 5755 | 5755 | } |
| 5756 | 5756 | |
| 5757 | 5757 | // This recursive function creates the index array from the strings |
| 5758 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5758 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5759 | 5759 | { |
| 5760 | 5760 | static $depth = 0; |
| 5761 | 5761 | $depth++; |
@@ -5782,7 +5782,7 @@ discard block |
||
| 5782 | 5782 | }; |
| 5783 | 5783 | |
| 5784 | 5784 | // This recursive function turns the index array into a regular expression |
| 5785 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5785 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5786 | 5786 | { |
| 5787 | 5787 | static $depth = 0; |
| 5788 | 5788 | $depth++; |
@@ -5806,11 +5806,11 @@ discard block |
||
| 5806 | 5806 | |
| 5807 | 5807 | if (count(array_keys($value)) == 1) |
| 5808 | 5808 | { |
| 5809 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 5809 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 5810 | 5810 | $new_key .= $new_key_array[0]; |
| 5811 | 5811 | } |
| 5812 | 5812 | else |
| 5813 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 5813 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 5814 | 5814 | } |
| 5815 | 5815 | |
| 5816 | 5816 | if ($depth > 1) |
@@ -5850,7 +5850,7 @@ discard block |
||
| 5850 | 5850 | $index = $add_string_to_index($string, $index); |
| 5851 | 5851 | |
| 5852 | 5852 | while (!empty($index)) |
| 5853 | - $regexes[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 5853 | + $regexes[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 5854 | 5854 | |
| 5855 | 5855 | // Restore PHP's internal character encoding to whatever it was originally |
| 5856 | 5856 | if (!empty($current_encoding)) |