@@ -430,8 +430,8 @@ |
||
| 430 | 430 | $real_name = $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name'; |
| 431 | 431 | |
| 432 | 432 | // Searches. |
| 433 | - $member_name_search = $member_name . ' ' . $comparison . ' ' . implode( ' OR ' . $member_name . ' ' . $comparison . ' ', $names_list); |
|
| 434 | - $real_name_search = $real_name . ' ' . $comparison . ' ' . implode( ' OR ' . $real_name . ' ' . $comparison . ' ', $names_list); |
|
| 433 | + $member_name_search = $member_name . ' ' . $comparison . ' ' . implode(' OR ' . $member_name . ' ' . $comparison . ' ', $names_list); |
|
| 434 | + $real_name_search = $real_name . ' ' . $comparison . ' ' . implode(' OR ' . $real_name . ' ' . $comparison . ' ', $names_list); |
|
| 435 | 435 | |
| 436 | 436 | // Search by username, display name, and email address. |
| 437 | 437 | $request = $smcFunc['db_query']('', ' |
@@ -899,13 +899,13 @@ |
||
| 899 | 899 | if ($start_char === 'C') |
| 900 | 900 | $limit_seek = $limit; |
| 901 | 901 | else |
| 902 | - $limit_seek = $limit + 1; |
|
| 902 | + $limit_seek = $limit + 1; |
|
| 903 | 903 | |
| 904 | 904 | $request = $smcFunc['db_query']('', ' |
| 905 | 905 | SELECT id_msg, id_member, approved |
| 906 | 906 | FROM {db_prefix}messages |
| 907 | 907 | WHERE id_topic = {int:current_topic} |
| 908 | - AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
| 908 | + AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
| 909 | 909 | AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . ' |
| 910 | 910 | ORDER BY id_msg ' . ($ascending_seek ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : ' |
| 911 | 911 | LIMIT {int:limit}'), |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array The truncated array |
| 25 | 25 | */ |
| 26 | -function truncateArray($arr, $max_length=1900) |
|
| 26 | +function truncateArray($arr, $max_length = 1900) |
|
| 27 | 27 | { |
| 28 | 28 | $curr_length = 0; |
| 29 | 29 | foreach ($arr as $key => $value) |
| 30 | 30 | if (is_array($value)) |
| 31 | 31 | foreach ($value as $key2 => $value2) |
| 32 | - $curr_length += strlen ($value2); |
|
| 32 | + $curr_length += strlen($value2); |
|
| 33 | 33 | else |
| 34 | - $curr_length += strlen ($value); |
|
| 34 | + $curr_length += strlen($value); |
|
| 35 | 35 | if ($curr_length <= $max_length) |
| 36 | 36 | return $arr; |
| 37 | 37 | else |
| 38 | 38 | { |
| 39 | 39 | // Truncate each element's value to a reasonable length |
| 40 | - $param_max = floor($max_length/count($arr)); |
|
| 40 | + $param_max = floor($max_length / count($arr)); |
|
| 41 | 41 | foreach ($arr as $key => &$value) |
| 42 | 42 | if (is_array($value)) |
| 43 | 43 | foreach ($value as $key2 => &$value2) |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if (filemtime($cachedir . '/db_last_error.php') === $last_db_error_change) |
| 208 | 208 | { |
| 209 | 209 | // Write the change |
| 210 | - $write_db_change = '<' . '?' . "php\n" . '$db_last_error = ' . time() . ';' . "\n" . '?' . '>'; |
|
| 210 | + $write_db_change = '<' . '?' . "php\n" . '$db_last_error = ' . time() . ';' . "\n" . '?' . '>'; |
|
| 211 | 211 | $written_bytes = file_put_contents($cachedir . '/db_last_error.php', $write_db_change, LOCK_EX); |
| 212 | 212 | |
| 213 | 213 | // survey says ... |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | ', $txt['debug_language_files'], count($context['debug']['language_files']), ': <em>', implode('</em>, <em>', $context['debug']['language_files']), '</em>.<br> |
| 281 | 281 | ', $txt['debug_stylesheets'], count($context['debug']['sheets']), ': <em>', implode('</em>, <em>', $context['debug']['sheets']), '</em>.<br> |
| 282 | 282 | ', $txt['debug_hooks'], empty($context['debug']['hooks']) ? 0 : count($context['debug']['hooks']) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_hooks\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_hooks" style="display: none;"><em>' . implode('</em>, <em>', $context['debug']['hooks']), '</em></span>)', '<br> |
| 283 | - ',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">'. $txt['debug_show'] .'</a><span id="debug_instances" style="display: none;"><em>'. implode('</em>, <em>', array_keys($context['debug']['instances'])) .'</em></span>)'. '<br>') : ''),' |
|
| 283 | + ',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">' . $txt['debug_show'] . '</a><span id="debug_instances" style="display: none;"><em>' . implode('</em>, <em>', array_keys($context['debug']['instances'])) . '</em></span>)' . '<br>') : ''), ' |
|
| 284 | 284 | ', $txt['debug_files_included'], count($files), ' - ', round($total_size / 1024), $txt['debug_kb'], ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_include_info" style="display: none;"><em>', implode('</em>, <em>', $files), '</em></span>)<br>'; |
| 285 | 285 | |
| 286 | 286 | if (function_exists('memory_get_peak_usage')) |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | // INET. |
| 361 | 361 | elseif ($param_info['type'] == 'inet') |
| 362 | 362 | { |
| 363 | - if(count($search_params[$param_name]) === 1) |
|
| 363 | + if (count($search_params[$param_name]) === 1) |
|
| 364 | 364 | { |
| 365 | 365 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' = {inet:' . $param_name . '})'; |
| 366 | 366 | $where_params[$param_name] = $search_params[$param_name][0]; |
@@ -368,8 +368,8 @@ discard block |
||
| 368 | 368 | elseif (count($search_params[$param_name]) === 2) |
| 369 | 369 | { |
| 370 | 370 | $query_parts[] = '(' . $param_info['db_fields'][0] . ' <= {inet:' . $param_name . '_high} and ' . $param_info['db_fields'][0] . ' >= {inet:' . $param_name . '_low})'; |
| 371 | - $where_params[$param_name.'_low'] = $search_params[$param_name]['low']; |
|
| 372 | - $where_params[$param_name.'_high'] = $search_params[$param_name]['high']; |
|
| 371 | + $where_params[$param_name . '_low'] = $search_params[$param_name]['low']; |
|
| 372 | + $where_params[$param_name . '_high'] = $search_params[$param_name]['high']; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | } |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | 'Jessica "Suki" González', |
| 593 | 593 | 'Karl "RegularExpression" Benson', |
| 594 | 594 | 'Matthew "Labradoodle-360" Kerle', |
| 595 | - $user_info['is_admin'] ? 'Matt "Grudge" Wolf': 'Grudge', |
|
| 595 | + $user_info['is_admin'] ? 'Matt "Grudge" Wolf' : 'Grudge', |
|
| 596 | 596 | 'Michael "Thantos" Miller', |
| 597 | 597 | 'Norv', |
| 598 | 598 | 'Peter "Arantor" Spicer', |
@@ -824,13 +824,13 @@ discard block |
||
| 824 | 824 | $credit_info = $smcFunc['json_decode']($row['credits'], true); |
| 825 | 825 | |
| 826 | 826 | $copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' © ' . $smcFunc['htmlspecialchars']($credit_info['copyright']); |
| 827 | - $license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license'])); |
|
| 827 | + $license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license'])); |
|
| 828 | 828 | $version = $txt['credits_version'] . ' ' . $row['version']; |
| 829 | 829 | $title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version; |
| 830 | 830 | |
| 831 | 831 | // build this one out and stash it away |
| 832 | 832 | $mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>'; |
| 833 | - $mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : ''); |
|
| 833 | + $mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : ''); |
|
| 834 | 834 | } |
| 835 | 835 | cache_put_data('mods_credits', $mods, 86400); |
| 836 | 836 | } |
@@ -236,7 +236,7 @@ |
||
| 236 | 236 | $header = 'POST /cgi-bin/webscr HTTP/1.1' . "\r\n"; |
| 237 | 237 | $header .= 'content-type: application/x-www-form-urlencoded' . "\r\n"; |
| 238 | 238 | $header .= 'Host: www.' . (!empty($modSettings['paidsubs_test']) ? 'sandbox.' : '') . 'paypal.com' . "\r\n"; |
| 239 | - $header .= 'content-length: ' . strlen ($requestString) . "\r\n"; |
|
| 239 | + $header .= 'content-length: ' . strlen($requestString) . "\r\n"; |
|
| 240 | 240 | $header .= 'connection: close' . "\r\n\r\n"; |
| 241 | 241 | |
| 242 | 242 | // Open the connection. |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // Just send a generic message. |
| 77 | 77 | else |
| 78 | 78 | $this->setResponse(array( |
| 79 | - 'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error', |
|
| 79 | + 'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error', |
|
| 80 | 80 | 'type' => 'error', |
| 81 | 81 | 'data' => false, |
| 82 | 82 | )); |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | // Gotta urlencode the filename. |
| 411 | 411 | if ($this->_attachResults) |
| 412 | 412 | foreach ($this->_attachResults as $k => $v) |
| 413 | - $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
|
| 413 | + $this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']); |
|
| 414 | 414 | |
| 415 | 415 | $this->_response = array( |
| 416 | 416 | 'files' => $this->_attachResults ? $this->_attachResults : false, |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | ob_start(); |
| 438 | 438 | |
| 439 | 439 | // Set the header. |
| 440 | - header('content-type: application/json; charset='. $context['character_set'] .''); |
|
| 440 | + header('content-type: application/json; charset=' . $context['character_set'] . ''); |
|
| 441 | 441 | |
| 442 | 442 | echo $smcFunc['json_encode']($this->_response ? $this->_response : array()); |
| 443 | 443 | |
@@ -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); |
@@ -2147,7 +2147,7 @@ discard block |
||
| 2147 | 2147 | $look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2)); |
| 2148 | 2148 | |
| 2149 | 2149 | // A closing tag that doesn't match any open tags? Skip it. |
| 2150 | - if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags))) |
|
| 2150 | + if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags))) |
|
| 2151 | 2151 | continue; |
| 2152 | 2152 | |
| 2153 | 2153 | $to_close = array(); |
@@ -2814,7 +2814,7 @@ discard block |
||
| 2814 | 2814 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2815 | 2815 | { |
| 2816 | 2816 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2817 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2817 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2818 | 2818 | |
| 2819 | 2819 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2820 | 2820 | |
@@ -2831,7 +2831,7 @@ discard block |
||
| 2831 | 2831 | |
| 2832 | 2832 | // Replace away! |
| 2833 | 2833 | $message = preg_replace_callback($smileyPregSearch, |
| 2834 | - function ($matches) use ($smileyPregReplacements) |
|
| 2834 | + function($matches) use ($smileyPregReplacements) |
|
| 2835 | 2835 | { |
| 2836 | 2836 | return $smileyPregReplacements[$matches[1]]; |
| 2837 | 2837 | }, $message); |
@@ -2897,13 +2897,13 @@ discard block |
||
| 2897 | 2897 | { |
| 2898 | 2898 | if (defined('SID') && SID != '') |
| 2899 | 2899 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2900 | - function ($m) use ($scripturl) |
|
| 2900 | + function($m) use ($scripturl) |
|
| 2901 | 2901 | { |
| 2902 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2902 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2903 | 2903 | }, $setLocation); |
| 2904 | 2904 | else |
| 2905 | 2905 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2906 | - function ($m) use ($scripturl) |
|
| 2906 | + function($m) use ($scripturl) |
|
| 2907 | 2907 | { |
| 2908 | 2908 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2909 | 2909 | }, $setLocation); |
@@ -3226,7 +3226,7 @@ discard block |
||
| 3226 | 3226 | |
| 3227 | 3227 | // Add a generic "Are you sure?" confirmation message. |
| 3228 | 3228 | addInlineJavaScript(' |
| 3229 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3229 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3230 | 3230 | |
| 3231 | 3231 | // Now add the capping code for avatars. |
| 3232 | 3232 | 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') |
@@ -3675,7 +3675,7 @@ discard block |
||
| 3675 | 3675 | if (!empty($normal)) |
| 3676 | 3676 | foreach ($normal as $nf) |
| 3677 | 3677 | echo ' |
| 3678 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3678 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3679 | 3679 | |
| 3680 | 3680 | if ($db_show_debug === true) |
| 3681 | 3681 | { |
@@ -3691,7 +3691,7 @@ discard block |
||
| 3691 | 3691 | <style>'; |
| 3692 | 3692 | |
| 3693 | 3693 | foreach ($context['css_header'] as $css) |
| 3694 | - echo $css .' |
|
| 3694 | + echo $css . ' |
|
| 3695 | 3695 | '; |
| 3696 | 3696 | |
| 3697 | 3697 | echo' |
@@ -3730,7 +3730,7 @@ discard block |
||
| 3730 | 3730 | return true; |
| 3731 | 3731 | |
| 3732 | 3732 | // No namespaces, sorry! |
| 3733 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3733 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3734 | 3734 | |
| 3735 | 3735 | // Temp path. |
| 3736 | 3736 | $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
@@ -3856,7 +3856,7 @@ discard block |
||
| 3856 | 3856 | else |
| 3857 | 3857 | $path = $modSettings['attachmentUploadDir']; |
| 3858 | 3858 | |
| 3859 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3859 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3860 | 3860 | } |
| 3861 | 3861 | |
| 3862 | 3862 | /** |
@@ -3900,10 +3900,10 @@ discard block |
||
| 3900 | 3900 | $valid_low = isValidIP($ip_parts[0]); |
| 3901 | 3901 | $valid_high = isValidIP($ip_parts[1]); |
| 3902 | 3902 | $count = 0; |
| 3903 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3903 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3904 | 3904 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3905 | 3905 | $min = 0; |
| 3906 | - if(!$valid_low) |
|
| 3906 | + if (!$valid_low) |
|
| 3907 | 3907 | { |
| 3908 | 3908 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3909 | 3909 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3917,7 +3917,7 @@ discard block |
||
| 3917 | 3917 | } |
| 3918 | 3918 | |
| 3919 | 3919 | $count = 0; |
| 3920 | - if(!$valid_high) |
|
| 3920 | + if (!$valid_high) |
|
| 3921 | 3921 | { |
| 3922 | 3922 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3923 | 3923 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3930,7 +3930,7 @@ discard block |
||
| 3930 | 3930 | } |
| 3931 | 3931 | } |
| 3932 | 3932 | |
| 3933 | - if($valid_high && $valid_low) |
|
| 3933 | + if ($valid_high && $valid_low) |
|
| 3934 | 3934 | { |
| 3935 | 3935 | $ip_array['low'] = $ip_parts[0]; |
| 3936 | 3936 | $ip_array['high'] = $ip_parts[1]; |
@@ -4112,7 +4112,7 @@ discard block |
||
| 4112 | 4112 | addInlineJavaScript(' |
| 4113 | 4113 | var user_menus = new smc_PopupMenu(); |
| 4114 | 4114 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4115 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4115 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4116 | 4116 | if ($context['allow_pm']) |
| 4117 | 4117 | addInlineJavaScript(' |
| 4118 | 4118 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4748,7 +4748,7 @@ discard block |
||
| 4748 | 4748 | // No? try a fallback to $sourcedir |
| 4749 | 4749 | else |
| 4750 | 4750 | { |
| 4751 | - $absPath = $sourcedir .'/'. $file; |
|
| 4751 | + $absPath = $sourcedir . '/' . $file; |
|
| 4752 | 4752 | |
| 4753 | 4753 | if (file_exists($absPath)) |
| 4754 | 4754 | require_once($absPath); |
@@ -4829,15 +4829,15 @@ discard block |
||
| 4829 | 4829 | |
| 4830 | 4830 | // UTF-8 occurences of MS special characters |
| 4831 | 4831 | $findchars_utf8 = array( |
| 4832 | - "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4833 | - "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4834 | - "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4835 | - "\xe2\x80\x98", // left single curly quote |
|
| 4836 | - "\xe2\x80\x99", // right single curly quote |
|
| 4837 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4838 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4839 | - "\xe2\x80\x93", // en dash |
|
| 4840 | - "\xe2\x80\x94", // em dash |
|
| 4832 | + "\xe2\x80\x9a", // single low-9 quotation mark |
|
| 4833 | + "\xe2\x80\x9e", // double low-9 quotation mark |
|
| 4834 | + "\xe2\x80\xa6", // horizontal ellipsis |
|
| 4835 | + "\xe2\x80\x98", // left single curly quote |
|
| 4836 | + "\xe2\x80\x99", // right single curly quote |
|
| 4837 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4838 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4839 | + "\xe2\x80\x93", // en dash |
|
| 4840 | + "\xe2\x80\x94", // em dash |
|
| 4841 | 4841 | ); |
| 4842 | 4842 | |
| 4843 | 4843 | // windows 1252 / iso equivalents |
@@ -4855,15 +4855,15 @@ discard block |
||
| 4855 | 4855 | |
| 4856 | 4856 | // safe replacements |
| 4857 | 4857 | $replacechars = array( |
| 4858 | - ',', // ‚ |
|
| 4859 | - ',,', // „ |
|
| 4860 | - '...', // … |
|
| 4861 | - "'", // ‘ |
|
| 4862 | - "'", // ’ |
|
| 4863 | - '"', // “ |
|
| 4864 | - '"', // ” |
|
| 4865 | - '-', // – |
|
| 4866 | - '--', // — |
|
| 4858 | + ',', // ‚ |
|
| 4859 | + ',,', // „ |
|
| 4860 | + '...', // … |
|
| 4861 | + "'", // ‘ |
|
| 4862 | + "'", // ’ |
|
| 4863 | + '"', // “ |
|
| 4864 | + '"', // ” |
|
| 4865 | + '-', // – |
|
| 4866 | + '--', // — |
|
| 4867 | 4867 | ); |
| 4868 | 4868 | |
| 4869 | 4869 | if ($context['utf8']) |
@@ -5281,7 +5281,7 @@ discard block |
||
| 5281 | 5281 | */ |
| 5282 | 5282 | function inet_dtop($bin) |
| 5283 | 5283 | { |
| 5284 | - if(empty($bin)) |
|
| 5284 | + if (empty($bin)) |
|
| 5285 | 5285 | return ''; |
| 5286 | 5286 | |
| 5287 | 5287 | global $db_type; |
@@ -5312,28 +5312,28 @@ discard block |
||
| 5312 | 5312 | */ |
| 5313 | 5313 | function _safe_serialize($value) |
| 5314 | 5314 | { |
| 5315 | - if(is_null($value)) |
|
| 5315 | + if (is_null($value)) |
|
| 5316 | 5316 | return 'N;'; |
| 5317 | 5317 | |
| 5318 | - if(is_bool($value)) |
|
| 5319 | - return 'b:'. (int) $value .';'; |
|
| 5318 | + if (is_bool($value)) |
|
| 5319 | + return 'b:' . (int) $value . ';'; |
|
| 5320 | 5320 | |
| 5321 | - if(is_int($value)) |
|
| 5322 | - return 'i:'. $value .';'; |
|
| 5321 | + if (is_int($value)) |
|
| 5322 | + return 'i:' . $value . ';'; |
|
| 5323 | 5323 | |
| 5324 | - if(is_float($value)) |
|
| 5325 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5324 | + if (is_float($value)) |
|
| 5325 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5326 | 5326 | |
| 5327 | - if(is_string($value)) |
|
| 5328 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5327 | + if (is_string($value)) |
|
| 5328 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5329 | 5329 | |
| 5330 | - if(is_array($value)) |
|
| 5330 | + if (is_array($value)) |
|
| 5331 | 5331 | { |
| 5332 | 5332 | $out = ''; |
| 5333 | - foreach($value as $k => $v) |
|
| 5333 | + foreach ($value as $k => $v) |
|
| 5334 | 5334 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5335 | 5335 | |
| 5336 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5336 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5337 | 5337 | } |
| 5338 | 5338 | |
| 5339 | 5339 | // safe_serialize cannot serialize resources or objects. |
@@ -5375,7 +5375,7 @@ discard block |
||
| 5375 | 5375 | function _safe_unserialize($str) |
| 5376 | 5376 | { |
| 5377 | 5377 | // Input is not a string. |
| 5378 | - if(empty($str) || !is_string($str)) |
|
| 5378 | + if (empty($str) || !is_string($str)) |
|
| 5379 | 5379 | return false; |
| 5380 | 5380 | |
| 5381 | 5381 | $stack = array(); |
@@ -5389,40 +5389,40 @@ discard block |
||
| 5389 | 5389 | * 3 - in array, expecting value or another array |
| 5390 | 5390 | */ |
| 5391 | 5391 | $state = 0; |
| 5392 | - while($state != 1) |
|
| 5392 | + while ($state != 1) |
|
| 5393 | 5393 | { |
| 5394 | 5394 | $type = isset($str[0]) ? $str[0] : ''; |
| 5395 | - if($type == '}') |
|
| 5395 | + if ($type == '}') |
|
| 5396 | 5396 | $str = substr($str, 1); |
| 5397 | 5397 | |
| 5398 | - else if($type == 'N' && $str[1] == ';') |
|
| 5398 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5399 | 5399 | { |
| 5400 | 5400 | $value = null; |
| 5401 | 5401 | $str = substr($str, 2); |
| 5402 | 5402 | } |
| 5403 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5403 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5404 | 5404 | { |
| 5405 | 5405 | $value = $matches[1] == '1' ? true : false; |
| 5406 | 5406 | $str = substr($str, 4); |
| 5407 | 5407 | } |
| 5408 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5408 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5409 | 5409 | { |
| 5410 | - $value = (int)$matches[1]; |
|
| 5410 | + $value = (int) $matches[1]; |
|
| 5411 | 5411 | $str = $matches[2]; |
| 5412 | 5412 | } |
| 5413 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5413 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5414 | 5414 | { |
| 5415 | - $value = (float)$matches[1]; |
|
| 5415 | + $value = (float) $matches[1]; |
|
| 5416 | 5416 | $str = $matches[3]; |
| 5417 | 5417 | } |
| 5418 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5418 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5419 | 5419 | { |
| 5420 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5421 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5420 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5421 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5422 | 5422 | } |
| 5423 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5423 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5424 | 5424 | { |
| 5425 | - $expectedLength = (int)$matches[1]; |
|
| 5425 | + $expectedLength = (int) $matches[1]; |
|
| 5426 | 5426 | $str = $matches[2]; |
| 5427 | 5427 | } |
| 5428 | 5428 | |
@@ -5430,10 +5430,10 @@ discard block |
||
| 5430 | 5430 | else |
| 5431 | 5431 | return false; |
| 5432 | 5432 | |
| 5433 | - switch($state) |
|
| 5433 | + switch ($state) |
|
| 5434 | 5434 | { |
| 5435 | 5435 | case 3: // In array, expecting value or another array. |
| 5436 | - if($type == 'a') |
|
| 5436 | + if ($type == 'a') |
|
| 5437 | 5437 | { |
| 5438 | 5438 | $stack[] = &$list; |
| 5439 | 5439 | $list[$key] = array(); |
@@ -5442,7 +5442,7 @@ discard block |
||
| 5442 | 5442 | $state = 2; |
| 5443 | 5443 | break; |
| 5444 | 5444 | } |
| 5445 | - if($type != '}') |
|
| 5445 | + if ($type != '}') |
|
| 5446 | 5446 | { |
| 5447 | 5447 | $list[$key] = $value; |
| 5448 | 5448 | $state = 2; |
@@ -5453,29 +5453,29 @@ discard block |
||
| 5453 | 5453 | return false; |
| 5454 | 5454 | |
| 5455 | 5455 | case 2: // in array, expecting end of array or a key |
| 5456 | - if($type == '}') |
|
| 5456 | + if ($type == '}') |
|
| 5457 | 5457 | { |
| 5458 | 5458 | // Array size is less than expected. |
| 5459 | - if(count($list) < end($expected)) |
|
| 5459 | + if (count($list) < end($expected)) |
|
| 5460 | 5460 | return false; |
| 5461 | 5461 | |
| 5462 | 5462 | unset($list); |
| 5463 | - $list = &$stack[count($stack)-1]; |
|
| 5463 | + $list = &$stack[count($stack) - 1]; |
|
| 5464 | 5464 | array_pop($stack); |
| 5465 | 5465 | |
| 5466 | 5466 | // Go to terminal state if we're at the end of the root array. |
| 5467 | 5467 | array_pop($expected); |
| 5468 | 5468 | |
| 5469 | - if(count($expected) == 0) |
|
| 5469 | + if (count($expected) == 0) |
|
| 5470 | 5470 | $state = 1; |
| 5471 | 5471 | |
| 5472 | 5472 | break; |
| 5473 | 5473 | } |
| 5474 | 5474 | |
| 5475 | - if($type == 'i' || $type == 's') |
|
| 5475 | + if ($type == 'i' || $type == 's') |
|
| 5476 | 5476 | { |
| 5477 | 5477 | // Array size exceeds expected length. |
| 5478 | - if(count($list) >= end($expected)) |
|
| 5478 | + if (count($list) >= end($expected)) |
|
| 5479 | 5479 | return false; |
| 5480 | 5480 | |
| 5481 | 5481 | $key = $value; |
@@ -5488,7 +5488,7 @@ discard block |
||
| 5488 | 5488 | |
| 5489 | 5489 | // Expecting array or value. |
| 5490 | 5490 | case 0: |
| 5491 | - if($type == 'a') |
|
| 5491 | + if ($type == 'a') |
|
| 5492 | 5492 | { |
| 5493 | 5493 | $data = array(); |
| 5494 | 5494 | $list = &$data; |
@@ -5497,7 +5497,7 @@ discard block |
||
| 5497 | 5497 | break; |
| 5498 | 5498 | } |
| 5499 | 5499 | |
| 5500 | - if($type != '}') |
|
| 5500 | + if ($type != '}') |
|
| 5501 | 5501 | { |
| 5502 | 5502 | $data = $value; |
| 5503 | 5503 | $state = 1; |
@@ -5510,7 +5510,7 @@ discard block |
||
| 5510 | 5510 | } |
| 5511 | 5511 | |
| 5512 | 5512 | // Trailing data in input. |
| 5513 | - if(!empty($str)) |
|
| 5513 | + if (!empty($str)) |
|
| 5514 | 5514 | return false; |
| 5515 | 5515 | |
| 5516 | 5516 | return $data; |
@@ -5564,7 +5564,7 @@ discard block |
||
| 5564 | 5564 | // Set different modes. |
| 5565 | 5565 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5566 | 5566 | |
| 5567 | - foreach($chmodValues as $val) |
|
| 5567 | + foreach ($chmodValues as $val) |
|
| 5568 | 5568 | { |
| 5569 | 5569 | // If it's writable, break out of the loop. |
| 5570 | 5570 | if (is_writable($file)) |
@@ -5599,13 +5599,13 @@ discard block |
||
| 5599 | 5599 | $returnArray = @json_decode($json, $returnAsArray); |
| 5600 | 5600 | |
| 5601 | 5601 | // PHP 5.3 so no json_last_error_msg() |
| 5602 | - switch(json_last_error()) |
|
| 5602 | + switch (json_last_error()) |
|
| 5603 | 5603 | { |
| 5604 | 5604 | case JSON_ERROR_NONE: |
| 5605 | 5605 | $jsonError = false; |
| 5606 | 5606 | break; |
| 5607 | 5607 | case JSON_ERROR_DEPTH: |
| 5608 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5608 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5609 | 5609 | break; |
| 5610 | 5610 | case JSON_ERROR_STATE_MISMATCH: |
| 5611 | 5611 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5633,10 +5633,10 @@ discard block |
||
| 5633 | 5633 | loadLanguage('Errors'); |
| 5634 | 5634 | |
| 5635 | 5635 | if (!empty($jsonDebug)) |
| 5636 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5636 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5637 | 5637 | |
| 5638 | 5638 | else |
| 5639 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5639 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5640 | 5640 | |
| 5641 | 5641 | // Everyone expects an array. |
| 5642 | 5642 | return array(); |
@@ -5748,7 +5748,7 @@ discard block |
||
| 5748 | 5748 | }); |
| 5749 | 5749 | |
| 5750 | 5750 | // Convert Punycode to Unicode |
| 5751 | - $tlds = array_map(function ($input) { |
|
| 5751 | + $tlds = array_map(function($input) { |
|
| 5752 | 5752 | $prefix = 'xn--'; |
| 5753 | 5753 | $safe_char = 0xFFFC; |
| 5754 | 5754 | $base = 36; |
@@ -5764,7 +5764,7 @@ discard block |
||
| 5764 | 5764 | |
| 5765 | 5765 | foreach ($enco_parts as $encoded) |
| 5766 | 5766 | { |
| 5767 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5767 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5768 | 5768 | { |
| 5769 | 5769 | $output_parts[] = $encoded; |
| 5770 | 5770 | continue; |
@@ -5775,7 +5775,7 @@ discard block |
||
| 5775 | 5775 | $idx = 0; |
| 5776 | 5776 | $char = 0x80; |
| 5777 | 5777 | $decoded = array(); |
| 5778 | - $output=''; |
|
| 5778 | + $output = ''; |
|
| 5779 | 5779 | $delim_pos = strrpos($encoded, '-'); |
| 5780 | 5780 | |
| 5781 | 5781 | if ($delim_pos > strlen($prefix)) |
@@ -5791,7 +5791,7 @@ discard block |
||
| 5791 | 5791 | |
| 5792 | 5792 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5793 | 5793 | { |
| 5794 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5794 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5795 | 5795 | { |
| 5796 | 5796 | $cp = ord($encoded{$enco_idx++}); |
| 5797 | 5797 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5832,15 +5832,15 @@ discard block |
||
| 5832 | 5832 | |
| 5833 | 5833 | // 2 bytes |
| 5834 | 5834 | elseif ($v < (1 << 11)) |
| 5835 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5835 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5836 | 5836 | |
| 5837 | 5837 | // 3 bytes |
| 5838 | 5838 | elseif ($v < (1 << 16)) |
| 5839 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5839 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5840 | 5840 | |
| 5841 | 5841 | // 4 bytes |
| 5842 | 5842 | elseif ($v < (1 << 21)) |
| 5843 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5843 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5844 | 5844 | |
| 5845 | 5845 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5846 | 5846 | else |
@@ -5945,7 +5945,7 @@ discard block |
||
| 5945 | 5945 | } |
| 5946 | 5946 | |
| 5947 | 5947 | // This recursive function creates the index array from the strings |
| 5948 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5948 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5949 | 5949 | { |
| 5950 | 5950 | static $depth = 0; |
| 5951 | 5951 | $depth++; |
@@ -5972,7 +5972,7 @@ discard block |
||
| 5972 | 5972 | }; |
| 5973 | 5973 | |
| 5974 | 5974 | // This recursive function turns the index array into a regular expression |
| 5975 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5975 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5976 | 5976 | { |
| 5977 | 5977 | static $depth = 0; |
| 5978 | 5978 | $depth++; |
@@ -5996,11 +5996,11 @@ discard block |
||
| 5996 | 5996 | |
| 5997 | 5997 | if (count(array_keys($value)) == 1) |
| 5998 | 5998 | { |
| 5999 | - $new_key_array = explode('(?'.'>', $sub_regex); |
|
| 5999 | + $new_key_array = explode('(?' . '>', $sub_regex); |
|
| 6000 | 6000 | $new_key .= $new_key_array[0]; |
| 6001 | 6001 | } |
| 6002 | 6002 | else |
| 6003 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 6003 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 6004 | 6004 | } |
| 6005 | 6005 | |
| 6006 | 6006 | if ($depth > 1) |
@@ -6043,10 +6043,10 @@ discard block |
||
| 6043 | 6043 | { |
| 6044 | 6044 | $regex = array(); |
| 6045 | 6045 | while (!empty($index)) |
| 6046 | - $regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6046 | + $regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6047 | 6047 | } |
| 6048 | 6048 | else |
| 6049 | - $regex = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 6049 | + $regex = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 6050 | 6050 | |
| 6051 | 6051 | // Restore PHP's internal character encoding to whatever it was originally |
| 6052 | 6052 | if (!empty($current_encoding)) |
@@ -704,7 +704,7 @@ |
||
| 704 | 704 | $mail_result = false; |
| 705 | 705 | } |
| 706 | 706 | } |
| 707 | - catch(ErrorException $e) |
|
| 707 | + catch (ErrorException $e) |
|
| 708 | 708 | { |
| 709 | 709 | log_error($e->getMessage(), 'general', $e->getFile(), $e->getLine()); |
| 710 | 710 | log_error(sprintf($txt['mail_send_unable'], $to)); |