@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | call_user_func_array(array('parent', '__construct'), func_get_args()); |
| 119 | 119 | |
| 120 | - $dataDir = __DIR__.'/../data/js/'; |
|
| 120 | + $dataDir = __DIR__ . '/../data/js/'; |
|
| 121 | 121 | $options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES; |
| 122 | - $this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options); |
|
| 123 | - $this->keywordsBefore = file($dataDir.'keywords_before.txt', $options); |
|
| 124 | - $this->keywordsAfter = file($dataDir.'keywords_after.txt', $options); |
|
| 125 | - $this->operators = file($dataDir.'operators.txt', $options); |
|
| 126 | - $this->operatorsBefore = file($dataDir.'operators_before.txt', $options); |
|
| 127 | - $this->operatorsAfter = file($dataDir.'operators_after.txt', $options); |
|
| 122 | + $this->keywordsReserved = file($dataDir . 'keywords_reserved.txt', $options); |
|
| 123 | + $this->keywordsBefore = file($dataDir . 'keywords_before.txt', $options); |
|
| 124 | + $this->keywordsAfter = file($dataDir . 'keywords_after.txt', $options); |
|
| 125 | + $this->operators = file($dataDir . 'operators.txt', $options); |
|
| 126 | + $this->operatorsBefore = file($dataDir . 'operators_before.txt', $options); |
|
| 127 | + $this->operatorsAfter = file($dataDir . 'operators_after.txt', $options); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * singe-line comment on the last line (in which case it would also |
| 150 | 150 | * be seen as part of that comment) |
| 151 | 151 | */ |
| 152 | - $content .= $js."\n;"; |
|
| 152 | + $content .= $js . "\n;"; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /* |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | // PHP only supports $this inside anonymous functions since 5.4 |
| 216 | 216 | $minifier = $this; |
| 217 | - $callback = function ($match) use ($minifier) { |
|
| 217 | + $callback = function($match) use ($minifier) { |
|
| 218 | 218 | $count = count($minifier->extracted); |
| 219 | - $placeholder = '/'.$count.'/'; |
|
| 219 | + $placeholder = '/' . $count . '/'; |
|
| 220 | 220 | $minifier->extracted[$placeholder] = $match[0]; |
| 221 | 221 | |
| 222 | 222 | return $placeholder; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | // likely part of a division, not a regex) |
| 230 | 230 | $after = '[\.,;\)\}]'; |
| 231 | 231 | $methods = '\.(exec|test|match|search|replace|split)\('; |
| 232 | - $this->registerPattern('/'.$pattern.'(?=\s*('.$after.'|'.$methods.'))/', $callback); |
|
| 232 | + $this->registerPattern('/' . $pattern . '(?=\s*(' . $after . '|' . $methods . '))/', $callback); |
|
| 233 | 233 | |
| 234 | 234 | // 1 more edge case: a regex can be followed by a lot more operators or |
| 235 | 235 | // keywords if there's a newline (ASI) in between, where the operator |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // (https://github.com/matthiasmullie/minify/issues/56) |
| 238 | 238 | $operators = $this->getOperatorsForRegex($this->operatorsBefore, '/'); |
| 239 | 239 | $operators += $this->getOperatorsForRegex($this->keywordsReserved, '/'); |
| 240 | - $this->registerPattern('/'.$pattern.'\s*\n(?=\s*('.implode('|', $operators).'))/', $callback); |
|
| 240 | + $this->registerPattern('/' . $pattern . '\s*\n(?=\s*(' . implode('|', $operators) . '))/', $callback); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | unset($operatorsBefore['+'], $operatorsBefore['-'], $operatorsAfter['+'], $operatorsAfter['-']); |
| 282 | 282 | $content = preg_replace( |
| 283 | 283 | array( |
| 284 | - '/('.implode('|', $operatorsBefore).')\s+/', |
|
| 285 | - '/\s+('.implode('|', $operatorsAfter).')/', |
|
| 284 | + '/(' . implode('|', $operatorsBefore) . ')\s+/', |
|
| 285 | + '/\s+(' . implode('|', $operatorsAfter) . ')/', |
|
| 286 | 286 | ), '\\1', $content |
| 287 | 287 | ); |
| 288 | 288 | |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | 297 | // collapse whitespace around reserved words into single space |
| 298 | - $content = preg_replace('/(^|[;\}\s])\K('.implode('|', $keywordsBefore).')\s+/', '\\2 ', $content); |
|
| 299 | - $content = preg_replace('/\s+('.implode('|', $keywordsAfter).')(?=([;\{\s]|$))/', ' \\1', $content); |
|
| 298 | + $content = preg_replace('/(^|[;\}\s])\K(' . implode('|', $keywordsBefore) . ')\s+/', '\\2 ', $content); |
|
| 299 | + $content = preg_replace('/\s+(' . implode('|', $keywordsAfter) . ')(?=([;\{\s]|$))/', ' \\1', $content); |
|
| 300 | 300 | |
| 301 | 301 | /* |
| 302 | 302 | * We didn't strip whitespace after a couple of operators because they |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | $operatorsDiffBefore = array_diff($operators, $operatorsBefore); |
| 308 | 308 | $operatorsDiffAfter = array_diff($operators, $operatorsAfter); |
| 309 | - $content = preg_replace('/('.implode('|', $operatorsDiffBefore).')[^\S\n]+/', '\\1', $content); |
|
| 310 | - $content = preg_replace('/[^\S\n]+('.implode('|', $operatorsDiffAfter).')/', '\\1', $content); |
|
| 309 | + $content = preg_replace('/(' . implode('|', $operatorsDiffBefore) . ')[^\S\n]+/', '\\1', $content); |
|
| 310 | + $content = preg_replace('/[^\S\n]+(' . implode('|', $operatorsDiffAfter) . ')/', '\\1', $content); |
|
| 311 | 311 | |
| 312 | 312 | /* |
| 313 | 313 | * Get rid of double semicolons, except where they can be used like: |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | // don't confuse = with other assignment shortcuts (e.g. +=) |
| 383 | 383 | $chars = preg_quote('+-*\=<>%&|'); |
| 384 | - $operators['='] = '(?<!['.$chars.'])\='; |
|
| 384 | + $operators['='] = '(?<![' . $chars . '])\='; |
|
| 385 | 385 | |
| 386 | 386 | return $operators; |
| 387 | 387 | } |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | $escaped = array_map('preg_quote', $keywords, $delimiter); |
| 403 | 403 | |
| 404 | 404 | // add word boundaries |
| 405 | - array_walk($keywords, function ($value) { |
|
| 406 | - return '\b'.$value.'\b'; |
|
| 405 | + array_walk($keywords, function($value) { |
|
| 406 | + return '\b' . $value . '\b'; |
|
| 407 | 407 | }); |
| 408 | 408 | |
| 409 | 409 | $keywords = array_combine($keywords, $escaped); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | // PHP only supports $this inside anonymous functions since 5.4 |
| 424 | 424 | $minifier = $this; |
| 425 | 425 | $keywords = $this->keywordsReserved; |
| 426 | - $callback = function ($match) use ($minifier, $keywords) { |
|
| 426 | + $callback = function($match) use ($minifier, $keywords) { |
|
| 427 | 427 | $property = trim($minifier->extracted[$match[1]], '\'"'); |
| 428 | 428 | |
| 429 | 429 | /* |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | * array['key-here'] can't be replaced by array.key-here since '-' |
| 441 | 441 | * is not a valid character there. |
| 442 | 442 | */ |
| 443 | - if (!preg_match('/^'.$minifier::REGEX_VARIABLE.'$/u', $property)) { |
|
| 443 | + if (!preg_match('/^' . $minifier::REGEX_VARIABLE . '$/u', $property)) { |
|
| 444 | 444 | return $match[0]; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - return '.'.$property; |
|
| 447 | + return '.' . $property; |
|
| 448 | 448 | }; |
| 449 | 449 | |
| 450 | 450 | /* |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | * separate look-behind assertions, one for each keyword. |
| 466 | 466 | */ |
| 467 | 467 | $keywords = $this->getKeywordsForRegex($keywords); |
| 468 | - $keywords = '(?<!'.implode(')(?<!', $keywords).')'; |
|
| 468 | + $keywords = '(?<!' . implode(')(?<!', $keywords) . ')'; |
|
| 469 | 469 | |
| 470 | - return preg_replace_callback('/(?<='.$previousChar.'|\])'.$keywords.'\[\s*(([\'"])[0-9]+\\2)\s*\]/u', $callback, $content); |
|
| 470 | + return preg_replace_callback('/(?<=' . $previousChar . '|\])' . $keywords . '\[\s*(([\'"])[0-9]+\\2)\s*\]/u', $callback, $content); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
@@ -229,7 +229,7 @@ |
||
| 229 | 229 | //In maintenance mode, only login is allowed and don't show OverlayDiv |
| 230 | 230 | echo ' |
| 231 | 231 | <ul class="floatleft welcome"> |
| 232 | - <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li> |
|
| 232 | + <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl . '?action=login', 'return true;'), '</li> |
|
| 233 | 233 | </ul>'; |
| 234 | 234 | |
| 235 | 235 | if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | 'no_msg' => 0, |
| 1543 | 1543 | 'substep' => $_GET['substep'], |
| 1544 | 1544 | 'ignore_ids' => $ignore_ids, |
| 1545 | - 'attach_thumb' => array(0,3), |
|
| 1545 | + 'attach_thumb' => array(0, 3), |
|
| 1546 | 1546 | ) |
| 1547 | 1547 | ); |
| 1548 | 1548 | |
@@ -1572,7 +1572,7 @@ discard block |
||
| 1572 | 1572 | array( |
| 1573 | 1573 | 'to_remove' => $to_remove, |
| 1574 | 1574 | 'no_member' => 0, |
| 1575 | - 'attach_thumb' => array(0,3), |
|
| 1575 | + 'attach_thumb' => array(0, 3), |
|
| 1576 | 1576 | ) |
| 1577 | 1577 | ); |
| 1578 | 1578 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic) |
| 233 | 233 | WHERE t.id_topic IS NULL |
| 234 | 234 | GROUP BY m.id_topic, m.id_board', |
| 235 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
| 235 | + 'fix_processing' => function($row) use ($smcFunc) |
|
| 236 | 236 | { |
| 237 | 237 | global $salvageBoardID; |
| 238 | 238 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | // Remove all topics that have zero messages in the messages table. |
| 319 | 319 | 'fix_collect' => array( |
| 320 | 320 | 'index' => 'id_topic', |
| 321 | - 'process' => function ($topics) use ($smcFunc) |
|
| 321 | + 'process' => function($topics) use ($smcFunc) |
|
| 322 | 322 | { |
| 323 | 323 | $smcFunc['db_query']('', ' |
| 324 | 324 | DELETE FROM {db_prefix}topics |
@@ -356,21 +356,21 @@ discard block |
||
| 356 | 356 | AND p.id_poll IS NULL |
| 357 | 357 | GROUP BY o.id_poll |
| 358 | 358 | ', |
| 359 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
| 359 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
| 360 | 360 | { |
| 361 | 361 | global $salvageBoardID; |
| 362 | 362 | |
| 363 | 363 | $row['poster_name'] = !empty($row['poster_name']) ? $row['poster_name'] : $txt['guest']; |
| 364 | 364 | $row['id_poster'] = !empty($row['id_poster']) ? $row['id_poster'] : 0; |
| 365 | 365 | |
| 366 | - if(empty($row['id_board'])) |
|
| 366 | + if (empty($row['id_board'])) |
|
| 367 | 367 | { |
| 368 | 368 | // Only if we don't have a reasonable idea of where to put it. |
| 369 | 369 | createSalvageArea(); |
| 370 | - $row['id_board'] = (int)$salvageBoardID; |
|
| 370 | + $row['id_board'] = (int) $salvageBoardID; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if(empty($row['id_topic'])) { |
|
| 373 | + if (empty($row['id_topic'])) { |
|
| 374 | 374 | $newMessageID = $smcFunc['db_insert']('', |
| 375 | 375 | '{db_prefix}messages', |
| 376 | 376 | array( |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | LEFT JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll) |
| 493 | 493 | WHERE p.id_poll BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 494 | 494 | AND t.id_poll IS NULL', |
| 495 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
| 495 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
| 496 | 496 | { |
| 497 | 497 | global $salvageBoardID; |
| 498 | 498 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 606 | 606 | GROUP BY t.id_topic, t.id_first_msg, t.id_last_msg, t.approved, mf.approved |
| 607 | 607 | ORDER BY t.id_topic', |
| 608 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
| 608 | + 'fix_processing' => function($row) use ($smcFunc) |
|
| 609 | 609 | { |
| 610 | 610 | $row['firstmsg_approved'] = (int) $row['firstmsg_approved']; |
| 611 | 611 | $row['myid_first_msg'] = (int) $row['myid_first_msg']; |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | ) |
| 635 | 635 | ); |
| 636 | 636 | }, |
| 637 | - 'message_function' => function ($row) use ($txt, &$context) |
|
| 637 | + 'message_function' => function($row) use ($txt, &$context) |
|
| 638 | 638 | { |
| 639 | 639 | // A pretend error? |
| 640 | 640 | if ($row['myid_first_msg'] == $row['myid_first_msg'] && $row['myid_first_msg'] == $row['myid_first_msg'] && $row['approved'] == $row['firstmsg_approved']) |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 669 | 669 | GROUP BY t.id_topic, t.num_replies, mf.approved |
| 670 | 670 | ORDER BY t.id_topic', |
| 671 | - 'fix_processing' => function ($row) |
|
| 671 | + 'fix_processing' => function($row) |
|
| 672 | 672 | { |
| 673 | 673 | |
| 674 | 674 | global $smcFunc; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | ); |
| 690 | 690 | |
| 691 | 691 | }, |
| 692 | - 'message_function' => function ($row) |
|
| 692 | + 'message_function' => function($row) |
|
| 693 | 693 | { |
| 694 | 694 | |
| 695 | 695 | global $txt, $context; |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | GROUP BY t.id_topic, t.unapproved_posts |
| 723 | 723 | HAVING unapproved_posts != COUNT(mu.id_msg) |
| 724 | 724 | ORDER BY t.id_topic', |
| 725 | - 'fix_processing' => function ($row) |
|
| 725 | + 'fix_processing' => function($row) |
|
| 726 | 726 | { |
| 727 | 727 | |
| 728 | 728 | global $smcFunc; |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | WHERE b.id_board IS NULL |
| 765 | 765 | AND t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 766 | 766 | GROUP BY t.id_board', |
| 767 | - 'fix_processing' => function ($row) |
|
| 767 | + 'fix_processing' => function($row) |
|
| 768 | 768 | { |
| 769 | 769 | |
| 770 | 770 | global $smcFunc, $salvageCatID, $txt; |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | ORDER BY b.id_cat, b.id_board', |
| 814 | 814 | 'fix_collect' => array( |
| 815 | 815 | 'index' => 'id_cat', |
| 816 | - 'process' => function ($cats) |
|
| 816 | + 'process' => function($cats) |
|
| 817 | 817 | { |
| 818 | 818 | global $smcFunc, $salvageCatID; |
| 819 | 819 | createSalvageArea(); |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | // Last step-make sure all non-guest posters still exist. |
| 850 | 850 | 'fix_collect' => array( |
| 851 | 851 | 'index' => 'id_msg', |
| 852 | - 'process' => function ($msgs) |
|
| 852 | + 'process' => function($msgs) |
|
| 853 | 853 | { |
| 854 | 854 | |
| 855 | 855 | global $smcFunc; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | ORDER BY b.id_parent, b.id_board', |
| 879 | 879 | 'fix_collect' => array( |
| 880 | 880 | 'index' => 'id_parent', |
| 881 | - 'process' => function ($parents) |
|
| 881 | + 'process' => function($parents) |
|
| 882 | 882 | { |
| 883 | 883 | global $smcFunc, $salvageBoardID, $salvageCatID; |
| 884 | 884 | createSalvageArea(); |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | AND p.id_poll IS NULL', |
| 913 | 913 | 'fix_collect' => array( |
| 914 | 914 | 'index' => 'id_poll', |
| 915 | - 'process' => function ($polls) |
|
| 915 | + 'process' => function($polls) |
|
| 916 | 916 | { |
| 917 | 917 | |
| 918 | 918 | global $smcFunc; |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | ORDER BY cal.id_topic', |
| 947 | 947 | 'fix_collect' => array( |
| 948 | 948 | 'index' => 'id_topic', |
| 949 | - 'process' => function ($events) |
|
| 949 | + 'process' => function($events) |
|
| 950 | 950 | { |
| 951 | 951 | |
| 952 | 952 | global $smcFunc; |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | AND lt.id_member BETWEEN {STEP_LOW} AND {STEP_HIGH}', |
| 979 | 979 | 'fix_collect' => array( |
| 980 | 980 | 'index' => 'id_topic', |
| 981 | - 'process' => function ($topics) |
|
| 981 | + 'process' => function($topics) |
|
| 982 | 982 | { |
| 983 | 983 | |
| 984 | 984 | global $smcFunc; |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | GROUP BY lt.id_member', |
| 1011 | 1011 | 'fix_collect' => array( |
| 1012 | 1012 | 'index' => 'id_member', |
| 1013 | - 'process' => function ($members) |
|
| 1013 | + 'process' => function($members) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | |
| 1016 | 1016 | global $smcFunc; |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | GROUP BY lb.id_board', |
| 1043 | 1043 | 'fix_collect' => array( |
| 1044 | 1044 | 'index' => 'id_board', |
| 1045 | - 'process' => function ($boards) |
|
| 1045 | + 'process' => function($boards) |
|
| 1046 | 1046 | { |
| 1047 | 1047 | |
| 1048 | 1048 | global $smcFunc; |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | GROUP BY lb.id_member', |
| 1075 | 1075 | 'fix_collect' => array( |
| 1076 | 1076 | 'index' => 'id_member', |
| 1077 | - 'process' => function ($members) use ($smcFunc) |
|
| 1077 | + 'process' => function($members) use ($smcFunc) |
|
| 1078 | 1078 | { |
| 1079 | 1079 | $smcFunc['db_query']('', ' |
| 1080 | 1080 | DELETE FROM {db_prefix}log_boards |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | GROUP BY lmr.id_board', |
| 1104 | 1104 | 'fix_collect' => array( |
| 1105 | 1105 | 'index' => 'id_board', |
| 1106 | - 'process' => function ($boards) use ($smcFunc) |
|
| 1106 | + 'process' => function($boards) use ($smcFunc) |
|
| 1107 | 1107 | { |
| 1108 | 1108 | $smcFunc['db_query']('', ' |
| 1109 | 1109 | DELETE FROM {db_prefix}log_mark_read |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | GROUP BY lmr.id_member', |
| 1133 | 1133 | 'fix_collect' => array( |
| 1134 | 1134 | 'index' => 'id_member', |
| 1135 | - 'process' => function ($members) use ($smcFunc) |
|
| 1135 | + 'process' => function($members) use ($smcFunc) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | $smcFunc['db_query']('', ' |
| 1138 | 1138 | DELETE FROM {db_prefix}log_mark_read |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | GROUP BY pmr.id_pm', |
| 1162 | 1162 | 'fix_collect' => array( |
| 1163 | 1163 | 'index' => 'id_pm', |
| 1164 | - 'process' => function ($pms) use ($smcFunc) |
|
| 1164 | + 'process' => function($pms) use ($smcFunc) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $smcFunc['db_query']('', ' |
| 1167 | 1167 | DELETE FROM {db_prefix}pm_recipients |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | GROUP BY pmr.id_member', |
| 1192 | 1192 | 'fix_collect' => array( |
| 1193 | 1193 | 'index' => 'id_member', |
| 1194 | - 'process' => function ($members) |
|
| 1194 | + 'process' => function($members) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | |
| 1197 | 1197 | global $smcFunc; |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | AND mem.id_member IS NULL', |
| 1224 | 1224 | 'fix_collect' => array( |
| 1225 | 1225 | 'index' => 'id_pm', |
| 1226 | - 'process' => function ($guestMessages) |
|
| 1226 | + 'process' => function($guestMessages) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | |
| 1229 | 1229 | global $smcFunc; |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | GROUP BY ln.id_member', |
| 1256 | 1256 | 'fix_collect' => array( |
| 1257 | 1257 | 'index' => 'id_member', |
| 1258 | - 'process' => function ($members) use ($smcFunc) |
|
| 1258 | + 'process' => function($members) use ($smcFunc) |
|
| 1259 | 1259 | { |
| 1260 | 1260 | $smcFunc['db_query']('', ' |
| 1261 | 1261 | DELETE FROM {db_prefix}log_notify |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | LEFT JOIN {db_prefix}log_search_subjects AS lss ON (lss.id_topic = t.id_topic) |
| 1283 | 1283 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 1284 | 1284 | AND lss.id_topic IS NULL', |
| 1285 | - 'fix_full_processing' => function ($result) |
|
| 1285 | + 'fix_full_processing' => function($result) |
|
| 1286 | 1286 | { |
| 1287 | 1287 | |
| 1288 | 1288 | global $smcFunc; |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | ); |
| 1315 | 1315 | |
| 1316 | 1316 | }, |
| 1317 | - 'message_function' => function ($row) |
|
| 1317 | + 'message_function' => function($row) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | |
| 1320 | 1320 | global $txt, $context; |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | AND t.id_topic IS NULL', |
| 1345 | 1345 | 'fix_collect' => array( |
| 1346 | 1346 | 'index' => 'id_topic', |
| 1347 | - 'process' => function ($deleteTopics) |
|
| 1347 | + 'process' => function($deleteTopics) |
|
| 1348 | 1348 | { |
| 1349 | 1349 | |
| 1350 | 1350 | global $smcFunc; |
@@ -1376,7 +1376,7 @@ discard block |
||
| 1376 | 1376 | AND mem.id_member IS NULL', |
| 1377 | 1377 | 'fix_collect' => array( |
| 1378 | 1378 | 'index' => 'id_member', |
| 1379 | - 'process' => function ($members) |
|
| 1379 | + 'process' => function($members) |
|
| 1380 | 1380 | { |
| 1381 | 1381 | |
| 1382 | 1382 | global $smcFunc; |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | AND p.id_poll IS NULL', |
| 1408 | 1408 | 'fix_collect' => array( |
| 1409 | 1409 | 'index' => 'id_poll', |
| 1410 | - 'process' => function ($polls) |
|
| 1410 | + 'process' => function($polls) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | |
| 1413 | 1413 | global $smcFunc; |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | AND lrc.id_report IS NULL', |
| 1439 | 1439 | 'fix_collect' => array( |
| 1440 | 1440 | 'index' => 'id_report', |
| 1441 | - 'process' => function ($reports) |
|
| 1441 | + 'process' => function($reports) |
|
| 1442 | 1442 | { |
| 1443 | 1443 | |
| 1444 | 1444 | global $smcFunc; |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | AND lr.id_report IS NULL', |
| 1470 | 1470 | 'fix_collect' => array( |
| 1471 | 1471 | 'index' => 'id_report', |
| 1472 | - 'process' => function ($reports) |
|
| 1472 | + 'process' => function($reports) |
|
| 1473 | 1473 | { |
| 1474 | 1474 | global $smcFunc; |
| 1475 | 1475 | $smcFunc['db_query']('', ' |
@@ -1499,7 +1499,7 @@ discard block |
||
| 1499 | 1499 | GROUP BY lgr.id_member', |
| 1500 | 1500 | 'fix_collect' => array( |
| 1501 | 1501 | 'index' => 'id_member', |
| 1502 | - 'process' => function ($members) |
|
| 1502 | + 'process' => function($members) |
|
| 1503 | 1503 | { |
| 1504 | 1504 | global $smcFunc; |
| 1505 | 1505 | $smcFunc['db_query']('', ' |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | GROUP BY lgr.id_group', |
| 1530 | 1530 | 'fix_collect' => array( |
| 1531 | 1531 | 'index' => 'id_group', |
| 1532 | - 'process' => function ($groups) |
|
| 1532 | + 'process' => function($groups) |
|
| 1533 | 1533 | { |
| 1534 | 1534 | global $smcFunc; |
| 1535 | 1535 | $smcFunc['db_query']('', ' |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | { |
| 326 | 326 | // PHP only supports $this inside anonymous functions since 5.4 |
| 327 | 327 | $minifier = $this; |
| 328 | - $callback = function ($match) use ($minifier) { |
|
| 328 | + $callback = function($match) use ($minifier) { |
|
| 329 | 329 | // check the second index here, because the first always contains a quote |
| 330 | 330 | if ($match[2] === '') { |
| 331 | 331 | /* |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $count = count($minifier->extracted); |
| 341 | - $placeholder = $match[1].$count.$match[1]; |
|
| 342 | - $minifier->extracted[$placeholder] = $match[1].$match[2].$match[1]; |
|
| 341 | + $placeholder = $match[1] . $count . $match[1]; |
|
| 342 | + $minifier->extracted[$placeholder] = $match[1] . $match[2] . $match[1]; |
|
| 343 | 343 | |
| 344 | 344 | return $placeholder; |
| 345 | 345 | }; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * considered as escape-char (times 2) and to get it in the regex, |
| 357 | 357 | * escaped (times 2) |
| 358 | 358 | */ |
| 359 | - $this->registerPattern('/(['.$chars.'])(.*?(?<!\\\\)(\\\\\\\\)*+)\\1/s', $callback); |
|
| 359 | + $this->registerPattern('/([' . $chars . '])(.*?(?<!\\\\)(\\\\\\\\)*+)\\1/s', $callback); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | protected function openFileForWriting($path) |
| 407 | 407 | { |
| 408 | 408 | if (($handler = @fopen($path, 'w')) === false) { |
| 409 | - throw new IOException('The file "'.$path.'" could not be opened for writing. Check if PHP has enough permissions.'); |
|
| 409 | + throw new IOException('The file "' . $path . '" could not be opened for writing. Check if PHP has enough permissions.'); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | return $handler; |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | protected function writeToFile($handler, $content, $path = '') |
| 425 | 425 | { |
| 426 | 426 | if (($result = @fwrite($handler, $content)) === false || ($result < strlen($content))) { |
| 427 | - throw new IOException('The file "'.$path.'" could not be written to. Check your disk space and file permissions.'); |
|
| 427 | + throw new IOException('The file "' . $path . '" could not be written to. Check your disk space and file permissions.'); |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | } |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | case 'datetime': |
| 257 | 257 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
| 258 | - return 'str_to_date('. |
|
| 259 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
| 258 | + return 'str_to_date(' . |
|
| 259 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
| 260 | 260 | ',\'%Y-%m-%d %h:%i:%s\')'; |
| 261 | 261 | else |
| 262 | 262 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $connection |
| 824 | 824 | ); |
| 825 | 825 | |
| 826 | - if(!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 826 | + if (!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 827 | 827 | { |
| 828 | 828 | if ($returnmode == 1) |
| 829 | 829 | $return_var = smf_db_insert_id($table, $keys[0]) + count($insertRows) - 1; |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | $return_var = array(); |
| 833 | 833 | $count = count($insertRows); |
| 834 | 834 | $start = smf_db_insert_id($table, $keys[0]); |
| 835 | - for ($i = 0; $i < $count; $i++ ) |
|
| 835 | + for ($i = 0; $i < $count; $i++) |
|
| 836 | 836 | $return_var[] = $start + $i; |
| 837 | 837 | } |
| 838 | 838 | return $return_var; |
@@ -197,22 +197,22 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | case 'date': |
| 199 | 199 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
| 200 | - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date'; |
|
| 200 | + return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; |
|
| 201 | 201 | else |
| 202 | 202 | smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
| 203 | 203 | break; |
| 204 | 204 | |
| 205 | 205 | case 'time': |
| 206 | 206 | if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) |
| 207 | - return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time'; |
|
| 207 | + return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; |
|
| 208 | 208 | else |
| 209 | 209 | smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
| 210 | 210 | break; |
| 211 | 211 | |
| 212 | 212 | case 'datetime': |
| 213 | 213 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) |
| 214 | - return 'to_timestamp('. |
|
| 215 | - sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]). |
|
| 214 | + return 'to_timestamp(' . |
|
| 215 | + sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . |
|
| 216 | 216 | ',\'YYYY-MM-DD HH24:MI:SS\')'; |
| 217 | 217 | else |
| 218 | 218 | smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
@@ -764,10 +764,10 @@ discard block |
||
| 764 | 764 | $returning = ''; |
| 765 | 765 | $with_returning = false; |
| 766 | 766 | // lets build the returning string, mysql allow only in normal mode |
| 767 | - if(!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 767 | + if (!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0) |
|
| 768 | 768 | { |
| 769 | 769 | // we only take the first key |
| 770 | - $returning = ' RETURNING '.$keys[0]; |
|
| 770 | + $returning = ' RETURNING ' . $keys[0]; |
|
| 771 | 771 | $with_returning = true; |
| 772 | 772 | } |
| 773 | 773 | |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '") |
| 799 | 799 | VALUES |
| 800 | 800 | ' . implode(', |
| 801 | - ', $insertRows).$replace.$returning, |
|
| 801 | + ', $insertRows) . $replace . $returning, |
|
| 802 | 802 | array( |
| 803 | 803 | 'security_override' => true, |
| 804 | 804 | 'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors', |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | if ($returnmode === 2) |
| 812 | 812 | $return_var = array(); |
| 813 | 813 | |
| 814 | - while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
| 814 | + while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning) |
|
| 815 | 815 | { |
| 816 | 816 | if (is_numeric($row[0])) // try to emulate mysql limitation |
| 817 | 817 | { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | if (!empty($modSettings['search_simple_fulltext'])) |
| 208 | 208 | { |
| 209 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
| 209 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
| 210 | 210 | { |
| 211 | 211 | $language_ftx = $smcFunc['db_search_language'](); |
| 212 | 212 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // remove any indexed words that are used in the complex body search terms |
| 225 | 225 | $words['indexed_words'] = array_diff($words['indexed_words'], $words['complex_words']); |
| 226 | 226 | |
| 227 | - if($smcFunc['db_title'] == "PostgreSQL"){ |
|
| 227 | + if ($smcFunc['db_title'] == "PostgreSQL") { |
|
| 228 | 228 | $row = 0; |
| 229 | 229 | foreach ($words['indexed_words'] as $fulltextWord) { |
| 230 | 230 | $query_params['boolean_match'] .= ($row <> 0 ? '&' : ''); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | // if we have bool terms to search, add them in |
| 242 | 242 | if ($query_params['boolean_match']) { |
| 243 | - if($smcFunc['db_title'] == "PostgreSQL") |
|
| 243 | + if ($smcFunc['db_title'] == "PostgreSQL") |
|
| 244 | 244 | { |
| 245 | 245 | $language_ftx = $smcFunc['db_search_language'](); |
| 246 | 246 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 256 | + $ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? (' |
|
| 257 | 257 | INSERT IGNORE INTO {db_prefix}' . $search_data['insert_into'] . ' |
| 258 | 258 | (' . implode(', ', array_keys($query_select)) . ')') : '') . ' |
| 259 | 259 | SELECT ' . implode(', ', $query_select) . ' |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | $version = $smcFunc['db_get_version'](); |
| 39 | 39 | // if we got a Beta Version |
| 40 | 40 | if (stripos($version, 'beta') !== false) |
| 41 | - $version = substr($version, 0, stripos($version, 'beta')).'.0'; |
|
| 41 | + $version = substr($version, 0, stripos($version, 'beta')) . '.0'; |
|
| 42 | 42 | // or RC |
| 43 | 43 | if (stripos($version, 'rc') !== false) |
| 44 | - $version = substr($version, 0, stripos($version, 'rc')).'.0'; |
|
| 44 | + $version = substr($version, 0, stripos($version, 'rc')) . '.0'; |
|
| 45 | 45 | |
| 46 | - if (version_compare($version,'9.5.0','>=')) |
|
| 46 | + if (version_compare($version, '9.5.0', '>=')) |
|
| 47 | 47 | $smcFunc['db_support_ignore'] = true; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | function smf_db_search_support($search_type) |
| 57 | 57 | { |
| 58 | - $supported_types = array('custom','fulltext'); |
|
| 58 | + $supported_types = array('custom', 'fulltext'); |
|
| 59 | 59 | |
| 60 | 60 | return in_array($search_type, $supported_types); |
| 61 | 61 | } |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0) |
| 110 | 110 | { |
| 111 | 111 | $db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string); |
| 112 | - if ($smcFunc['db_support_ignore']){ |
|
| 112 | + if ($smcFunc['db_support_ignore']) { |
|
| 113 | 113 | //pg style "INSERT INTO.... ON CONFLICT DO NOTHING" |
| 114 | - $db_string = $db_string.' ON CONFLICT DO NOTHING'; |
|
| 114 | + $db_string = $db_string . ' ON CONFLICT DO NOTHING'; |
|
| 115 | 115 | } |
| 116 | 116 | else |
| 117 | 117 | { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $language_ftx = $modSettings['search_language']; |
| 169 | 169 | else |
| 170 | 170 | { |
| 171 | - $request = $smcFunc['db_query']('',' |
|
| 171 | + $request = $smcFunc['db_query']('', ' |
|
| 172 | 172 | SHOW default_text_search_config', |
| 173 | 173 | array() |
| 174 | 174 | ); |