@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | 'value' => $txt['spider_name'], |
| 240 | 240 | ), |
| 241 | 241 | 'data' => array( |
| 242 | - 'function' => function ($rowData) use ($smcFunc, $scripturl) |
|
| 242 | + 'function' => function($rowData) use ($smcFunc, $scripturl) |
|
| 243 | 243 | { |
| 244 | 244 | return sprintf('<a href="%1$s?action=admin;area=sengines;sa=editspiders;sid=%2$d">%3$s</a>', $scripturl, $rowData['id_spider'], $smcFunc['htmlspecialchars']($rowData['spider_name'])); |
| 245 | 245 | }, |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | 'value' => $txt['spider_last_seen'], |
| 255 | 255 | ), |
| 256 | 256 | 'data' => array( |
| 257 | - 'function' => function ($rowData) use ($context, $txt) |
|
| 257 | + 'function' => function($rowData) use ($context, $txt) |
|
| 258 | 258 | { |
| 259 | 259 | return isset($context['spider_last_seen'][$rowData['id_spider']]) ? timeformat($context['spider_last_seen'][$rowData['id_spider']]) : $txt['spider_last_never']; |
| 260 | 260 | }, |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | |
| 691 | 691 | if (!empty($_POST['delete_entries']) && isset($_POST['older'])) |
| 692 | 692 | { |
| 693 | - $deleteTime = time() - (((int)$_POST['older']) * 24 * 60 * 60); |
|
| 693 | + $deleteTime = time() - (((int) $_POST['older']) * 24 * 60 * 60); |
|
| 694 | 694 | |
| 695 | 695 | // Delete the entires. |
| 696 | 696 | $smcFunc['db_query']('', ' |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | 'value' => $txt['spider_time'], |
| 743 | 743 | ), |
| 744 | 744 | 'data' => array( |
| 745 | - 'function' => function ($rowData) |
|
| 745 | + 'function' => function($rowData) |
|
| 746 | 746 | { |
| 747 | 747 | return timeformat($rowData['log_time']); |
| 748 | 748 | }, |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | require_once($sourcedir . '/Subs-Auth.php'); |
| 53 | 53 | |
| 54 | 54 | // Posting the password... check it. |
| 55 | - if (isset($_POST[$type. '_pass'])) |
|
| 55 | + if (isset($_POST[$type . '_pass'])) |
|
| 56 | 56 | { |
| 57 | 57 | // Check to ensure we're forcing SSL for authentication |
| 58 | 58 | if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | if ($ip_number == 'ip2' && $user_info['ip2'] == $user_info['ip']) |
| 181 | 181 | continue; |
| 182 | - $ban_query[] = ' {inet:'.$ip_number.'} BETWEEN bi.ip_low and bi.ip_high'; |
|
| 182 | + $ban_query[] = ' {inet:' . $ip_number . '} BETWEEN bi.ip_low and bi.ip_high'; |
|
| 183 | 183 | $ban_query_vars[$ip_number] = $user_info[$ip_number]; |
| 184 | 184 | // IP was valid, maybe there's also a hostname... |
| 185 | 185 | if (empty($modSettings['disableHostnameLookup']) && $user_info[$ip_number] != 'unknown') |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | $hostname = host_from_ip($user_info[$ip_number]); |
| 188 | 188 | if (strlen($hostname) > 0) |
| 189 | 189 | { |
| 190 | - $ban_query[] = '({string:hostname'.$ip_number.'} LIKE bi.hostname)'; |
|
| 191 | - $ban_query_vars['hostname'.$ip_number] = $hostname; |
|
| 190 | + $ban_query[] = '({string:hostname' . $ip_number . '} LIKE bi.hostname)'; |
|
| 191 | + $ban_query_vars['hostname' . $ip_number] = $hostname; |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | return true; |
| 913 | 913 | |
| 914 | 914 | // Let's ensure this is an array. |
| 915 | - $permission = (array)$permission; |
|
| 915 | + $permission = (array) $permission; |
|
| 916 | 916 | |
| 917 | 917 | // Are we checking the _current_ board, or some other boards? |
| 918 | 918 | if ($boards === null) |
@@ -398,7 +398,7 @@ |
||
| 398 | 398 | } |
| 399 | 399 | $smcFunc['db_free_result']($request); |
| 400 | 400 | |
| 401 | - if($updateBoardCount) |
|
| 401 | + if ($updateBoardCount) |
|
| 402 | 402 | { |
| 403 | 403 | // Decrease the posts/topics... |
| 404 | 404 | foreach ($adjustBoards as $stats) |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | if ($curAction == 'approve') |
| 178 | 178 | { |
| 179 | - approveMessages ($toAction, $details, $context['current_view']); |
|
| 179 | + approveMessages($toAction, $details, $context['current_view']); |
|
| 180 | 180 | } |
| 181 | 181 | else |
| 182 | 182 | { |
| 183 | - removeMessages ($toAction, $details, $context['current_view']); |
|
| 183 | + removeMessages($toAction, $details, $context['current_view']); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | 'value' => $txt['mc_unapproved_attach_poster'], |
| 438 | 438 | ), |
| 439 | 439 | 'data' => array( |
| 440 | - 'function' => function ($data) |
|
| 440 | + 'function' => function($data) |
|
| 441 | 441 | { |
| 442 | 442 | return $data['poster']['link']; |
| 443 | 443 | }, |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | 'value' => $txt['post'], |
| 468 | 468 | ), |
| 469 | 469 | 'data' => array( |
| 470 | - 'function' => function ($data) |
|
| 470 | + 'function' => function($data) |
|
| 471 | 471 | { |
| 472 | 472 | return '<a href="' . $data['message']['href'] . '">' . shorten_subject($data['message']['subject'], 20) . '</a>'; |
| 473 | 473 | }, |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | logAction(($approved ? 'un' : '') . 'approve', array('topic' => $topic, 'subject' => $subject, 'member' => $poster, 'board' => $board)); |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg']. '#msg' . $_REQUEST['msg']); |
|
| 696 | + redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']); |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | /** |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | $sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8); |
| 67 | 67 | switch ($word{$i} === 's' ? 0 : mt_rand(0, 2)) |
| 68 | 68 | { |
| 69 | - case 0: |
|
| 70 | - for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 69 | + case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 71 | 70 | for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) |
| 72 | 71 | $sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF))); |
| 73 | 72 | break; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $message = preg_replace('~&#(\d{4,5}|[2-9]\d{2,4}|1[2-9]\d);~', '&#$1;', $message); |
| 35 | 35 | |
| 36 | 36 | // Clean up after nobbc ;). |
| 37 | - $message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', function ($a) |
|
| 37 | + $message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', function($a) |
|
| 38 | 38 | { |
| 39 | 39 | return '[nobbc]' . strtr($a[1], array('[' => '[', ']' => ']', ':' => ':', '@' => '@')) . '[/nobbc]'; |
| 40 | 40 | }, $message); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if (!$previewing && strpos($message, '[html]') !== false) |
| 123 | 123 | { |
| 124 | 124 | if (allowedTo('admin_forum')) |
| 125 | - $message = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function ($m) { |
|
| 125 | + $message = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function($m) { |
|
| 126 | 126 | return '[html]' . strtr(un_htmlspecialchars($m), array("\n" => ' ', ' ' => '  ', '[' => '[', ']' => ']')) . '[/html]'; |
| 127 | 127 | }, $message); |
| 128 | 128 | |
@@ -135,17 +135,17 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Let's look at the time tags... |
| 138 | - $message = preg_replace_callback('~\[time(?:=(absolute))*\](.+?)\[/time\]~i', function ($m) use ($modSettings, $user_info) |
|
| 138 | + $message = preg_replace_callback('~\[time(?:=(absolute))*\](.+?)\[/time\]~i', function($m) use ($modSettings, $user_info) |
|
| 139 | 139 | { |
| 140 | 140 | return "[time]" . (is_numeric("$m[2]") || @strtotime("$m[2]") == 0 ? "$m[2]" : strtotime("$m[2]") - ("$m[1]" == "absolute" ? 0 : (($modSettings["time_offset"] + $user_info["time_offset"]) * 3600))) . "[/time]"; |
| 141 | 141 | }, $message); |
| 142 | 142 | |
| 143 | 143 | // Change the color specific tags to [color=the color]. |
| 144 | - $message = preg_replace('~\[(black|blue|green|red|white)\]~', '[color=$1]', $message); // First do the opening tags. |
|
| 145 | - $message = preg_replace('~\[/(black|blue|green|red|white)\]~', '[/color]', $message); // And now do the closing tags |
|
| 144 | + $message = preg_replace('~\[(black|blue|green|red|white)\]~', '[color=$1]', $message); // First do the opening tags. |
|
| 145 | + $message = preg_replace('~\[/(black|blue|green|red|white)\]~', '[/color]', $message); // And now do the closing tags |
|
| 146 | 146 | |
| 147 | 147 | // Make sure all tags are lowercase. |
| 148 | - $message = preg_replace_callback('~\[([/]?)(list|li|table|tr|td)((\s[^\]]+)*)\]~i', function ($m) |
|
| 148 | + $message = preg_replace_callback('~\[([/]?)(list|li|table|tr|td)((\s[^\]]+)*)\]~i', function($m) |
|
| 149 | 149 | { |
| 150 | 150 | return "[$m[1]" . strtolower("$m[2]") . "$m[3]]"; |
| 151 | 151 | }, $message); |
@@ -252,13 +252,13 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $message = implode('', $parts); |
| 254 | 254 | |
| 255 | - $message = preg_replace_callback('~\[html\](.+?)\[/html\]~i', function ($m) use ($smcFunc) |
|
| 255 | + $message = preg_replace_callback('~\[html\](.+?)\[/html\]~i', function($m) use ($smcFunc) |
|
| 256 | 256 | { |
| 257 | 257 | return "[html]" . strtr($smcFunc['htmlspecialchars']("$m[1]", ENT_QUOTES), array("\\"" => """, "&#13;" => "<br>", "&#32;" => " ", "&#91;" => "[", "&#93;" => "]")) . "[/html]"; |
| 258 | 258 | }, $message); |
| 259 | 259 | |
| 260 | 260 | // Attempt to un-parse the time to something less awful. |
| 261 | - $message = preg_replace_callback('~\[time\](\d{0,10})\[/time\]~i', function ($m) |
|
| 261 | + $message = preg_replace_callback('~\[time\](\d{0,10})\[/time\]~i', function($m) |
|
| 262 | 262 | { |
| 263 | 263 | return "[time]" . timeformat("$m[1]", false) . "[/time]"; |
| 264 | 264 | }, $message); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | fixTag($message, $param['tag'], $param['protocols'], $param['embeddedUrl'], $param['hasEqualSign'], !empty($param['hasExtra'])); |
| 350 | 350 | |
| 351 | 351 | // Now fix possible security problems with images loading links automatically... |
| 352 | - $message = preg_replace_callback('~(\[img.*?\])(.+?)\[/img\]~is', function ($m) |
|
| 352 | + $message = preg_replace_callback('~(\[img.*?\])(.+?)\[/img\]~is', function($m) |
|
| 353 | 353 | { |
| 354 | 354 | return "$m[1]" . preg_replace("~action(=|%3d)(?!dlattach)~i", "action-", "$m[2]") . "[/img]"; |
| 355 | 355 | }, $message); |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | $to_array = is_array($to) ? $to : array($to); |
| 536 | 536 | |
| 537 | 537 | // Make sure we actually have email addresses to send this to |
| 538 | - foreach($to_array as $k => $v) |
|
| 538 | + foreach ($to_array as $k => $v) |
|
| 539 | 539 | { |
| 540 | 540 | // This should never happen, but better safe than sorry |
| 541 | 541 | if (trim($v) == '') |
@@ -1211,7 +1211,7 @@ discard block |
||
| 1211 | 1211 | unset($matches); |
| 1212 | 1212 | |
| 1213 | 1213 | if ($simple) |
| 1214 | - $string = preg_replace_callback('~&#(\d{3,8});~', function ($m) |
|
| 1214 | + $string = preg_replace_callback('~&#(\d{3,8});~', function($m) |
|
| 1215 | 1215 | { |
| 1216 | 1216 | return chr("$m[1]"); |
| 1217 | 1217 | }, $string); |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | $string = $newstring; |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | - $entityConvert = function ($m) |
|
| 1245 | + $entityConvert = function($m) |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $c = $m[1]; |
| 1248 | 1248 | if (strlen($c) === 1 && ord($c[0]) <= 0x7F) |
@@ -1348,14 +1348,14 @@ discard block |
||
| 1348 | 1348 | $helo = gethostname(); |
| 1349 | 1349 | elseif (function_exists('php_uname')) |
| 1350 | 1350 | $helo = php_uname('n'); |
| 1351 | - elseif (array_key_exists('SERVER_NAME',$_SERVER) && !empty($_SERVER['SERVER_NAME'])) |
|
| 1351 | + elseif (array_key_exists('SERVER_NAME', $_SERVER) && !empty($_SERVER['SERVER_NAME'])) |
|
| 1352 | 1352 | $helo = $_SERVER['SERVER_NAME']; |
| 1353 | 1353 | |
| 1354 | 1354 | if (empty($helo)) |
| 1355 | 1355 | $helo = $modSettings['smtp_host']; |
| 1356 | 1356 | |
| 1357 | 1357 | // SMTP = 1, SMTP - STARTTLS = 2 |
| 1358 | - if (in_array($modSettings['mail_type'], array(1,2)) && $modSettings['smtp_username'] != '' && $modSettings['smtp_password'] != '') |
|
| 1358 | + if (in_array($modSettings['mail_type'], array(1, 2)) && $modSettings['smtp_username'] != '' && $modSettings['smtp_password'] != '') |
|
| 1359 | 1359 | { |
| 1360 | 1360 | // EHLO could be understood to mean encrypted hello... |
| 1361 | 1361 | if (server_parse('EHLO ' . $helo, $socket, null, $response) == '250') |
@@ -2119,7 +2119,7 @@ discard block |
||
| 2119 | 2119 | preg_match_all('/\[member\=([0-9]+)\]([^\[]*)\[\/member\]/U', $msgOptions['old_body'], $match); |
| 2120 | 2120 | |
| 2121 | 2121 | if (isset($match[1]) && isset($match[2]) && is_array($match[1]) && is_array($match[2])) |
| 2122 | - foreach($match[1] as $i => $oldID) |
|
| 2122 | + foreach ($match[1] as $i => $oldID) |
|
| 2123 | 2123 | $oldmentions[$oldID] = array('id' => $oldID, 'real_name' => $match[2][$i]); |
| 2124 | 2124 | |
| 2125 | 2125 | if (empty($modSettings['search_custom_index_config'])) |
@@ -2130,10 +2130,10 @@ discard block |
||
| 2130 | 2130 | $messages_columns['body'] = $msgOptions['body'] = Mentions::getBody($msgOptions['body'], $mentions); |
| 2131 | 2131 | |
| 2132 | 2132 | // Remove the poster. |
| 2133 | - if(isset($mentions[$user_info['id']])) |
|
| 2133 | + if (isset($mentions[$user_info['id']])) |
|
| 2134 | 2134 | unset($mentions[$user_info['id']]); |
| 2135 | 2135 | |
| 2136 | - if(isset($oldmentions[$user_info['id']])) |
|
| 2136 | + if (isset($oldmentions[$user_info['id']])) |
|
| 2137 | 2137 | unset($oldmentions[$user_info['id']]); |
| 2138 | 2138 | |
| 2139 | 2139 | if (is_array($mentions) && is_array($oldmentions) && count(array_diff_key($mentions, $oldmentions)) > 0 && count($mentions) > count($oldmentions)) |
@@ -2948,7 +2948,7 @@ discard block |
||
| 2948 | 2948 | $suggestions = enchant_dict_suggest($dict, $word); |
| 2949 | 2949 | |
| 2950 | 2950 | // Go through the suggestions and convert them back to the proper character set |
| 2951 | - foreach($suggestions as $index => $suggestion) |
|
| 2951 | + foreach ($suggestions as $index => $suggestion) |
|
| 2952 | 2952 | { |
| 2953 | 2953 | // //TRANSLIT makes it use similar-looking characters for incompatible ones... |
| 2954 | 2954 | $suggestions[$index] = iconv('UTF-8', $txt['lang_character_set'] . '//TRANSLIT', $suggestion); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | if ((!isset($match[3]) || trim($match[3]) != '/') && (!isset($match[2]) || trim($match[2]) != '/')) |
| 425 | 425 | { |
| 426 | 426 | // Because PHP 5.2.0+ seems to croak using regex, we'll have to do this the less fun way. |
| 427 | - $last_tag_end = strpos($data, '</' . $match[1]. '>'); |
|
| 427 | + $last_tag_end = strpos($data, '</' . $match[1] . '>'); |
|
| 428 | 428 | if ($last_tag_end === false) |
| 429 | 429 | continue; |
| 430 | 430 | |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | break; |
| 439 | 439 | |
| 440 | 440 | // If not then find the next ending tag. |
| 441 | - $next_tag_end = strpos($data, '</' . $match[1]. '>', $offset); |
|
| 441 | + $next_tag_end = strpos($data, '</' . $match[1] . '>', $offset); |
|
| 442 | 442 | |
| 443 | 443 | // Didn't find one? Then just use the last and sod it. |
| 444 | 444 | if ($next_tag_end === false) |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | // Parse the insides. |
| 453 | 453 | $inner_match = substr($data, 0, $last_tag_end); |
| 454 | 454 | // Data now starts from where this section ends. |
| 455 | - $data = substr($data, $last_tag_end + strlen('</' . $match[1]. '>')); |
|
| 455 | + $data = substr($data, $last_tag_end + strlen('</' . $match[1] . '>')); |
|
| 456 | 456 | |
| 457 | 457 | if (!empty($inner_match)) |
| 458 | 458 | { |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | $trans_tbl = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)); |
| 619 | 619 | |
| 620 | 620 | // Translate all the entities out. |
| 621 | - $data = strtr(preg_replace_callback('~&#(\d{1,4});~', function ($m) |
|
| 621 | + $data = strtr(preg_replace_callback('~&#(\d{1,4});~', function($m) |
|
| 622 | 622 | { |
| 623 | 623 | return chr("$m[1]"); |
| 624 | 624 | }, $data), $trans_tbl); |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | // Set different modes. |
| 874 | 874 | $chmod_values = $is_dir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 875 | 875 | |
| 876 | - foreach($chmod_values as $val) |
|
| 876 | + foreach ($chmod_values as $val) |
|
| 877 | 877 | { |
| 878 | 878 | // If it's writable, break out of the loop. |
| 879 | 879 | if (is_writable($ftp_file)) |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | call_user_func_array(array('parent', '__construct'), func_get_args()); |
| 108 | 108 | |
| 109 | - $dataDir = __DIR__.'/../data/js/'; |
|
| 109 | + $dataDir = __DIR__ . '/../data/js/'; |
|
| 110 | 110 | $options = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES; |
| 111 | - $this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options); |
|
| 112 | - $this->keywordsBefore = file($dataDir.'keywords_before.txt', $options); |
|
| 113 | - $this->keywordsAfter = file($dataDir.'keywords_after.txt', $options); |
|
| 114 | - $this->operatorsBefore = file($dataDir.'operators_before.txt', $options); |
|
| 115 | - $this->operatorsAfter = file($dataDir.'operators_after.txt', $options); |
|
| 111 | + $this->keywordsReserved = file($dataDir . 'keywords_reserved.txt', $options); |
|
| 112 | + $this->keywordsBefore = file($dataDir . 'keywords_before.txt', $options); |
|
| 113 | + $this->keywordsAfter = file($dataDir . 'keywords_after.txt', $options); |
|
| 114 | + $this->operatorsBefore = file($dataDir . 'operators_before.txt', $options); |
|
| 115 | + $this->operatorsAfter = file($dataDir . 'operators_after.txt', $options); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * singe-line comment on the last line (in which case it would also |
| 138 | 138 | * be seen as part of that comment) |
| 139 | 139 | */ |
| 140 | - $content .= $js."\n;"; |
|
| 140 | + $content .= $js . "\n;"; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /* |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | // PHP only supports $this inside anonymous functions since 5.4 |
| 204 | 204 | $minifier = $this; |
| 205 | - $callback = function ($match) use ($minifier) { |
|
| 205 | + $callback = function($match) use ($minifier) { |
|
| 206 | 206 | $count = count($minifier->extracted); |
| 207 | - $placeholder = '/'.$count.'/'; |
|
| 207 | + $placeholder = '/' . $count . '/'; |
|
| 208 | 208 | $minifier->extracted[$placeholder] = $match[1]; |
| 209 | 209 | |
| 210 | 210 | return $placeholder; |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | // it's going to be division |
| 220 | 220 | // checking for that is complex, so we'll do inverse: |
| 221 | 221 | // * at the beginning of the file, it's not division, but regex |
| 222 | - $this->registerPattern('/^\s*\K'.$pattern.'/', $callback); |
|
| 222 | + $this->registerPattern('/^\s*\K' . $pattern . '/', $callback); |
|
| 223 | 223 | // * following another operator, it's not division, but regex |
| 224 | 224 | $operators = $this->getOperatorsForRegex($this->operatorsBefore, '/'); |
| 225 | 225 | $operators += $this->getKeywordsForRegex($this->keywordsReserved, '/'); |
| 226 | - $this->registerPattern('/(?:'.implode('|', $operators).')\s*\K'.$pattern.'/', $callback); |
|
| 226 | + $this->registerPattern('/(?:' . implode('|', $operators) . ')\s*\K' . $pattern . '/', $callback); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | unset($before['+'], $before['-'], $after['+'], $after['-']); |
| 266 | 266 | $content = preg_replace( |
| 267 | 267 | array( |
| 268 | - '/('.implode('|', $before).')\s+/', |
|
| 269 | - '/\s+('.implode('|', $after).')/', |
|
| 268 | + '/(' . implode('|', $before) . ')\s+/', |
|
| 269 | + '/\s+(' . implode('|', $after) . ')/', |
|
| 270 | 270 | ), '\\1', $content |
| 271 | 271 | ); |
| 272 | 272 | |
@@ -284,13 +284,13 @@ discard block |
||
| 284 | 284 | * strip the newlines. However, we can safely strip any non-line feed |
| 285 | 285 | * whitespace that follows them. |
| 286 | 286 | */ |
| 287 | - $content = preg_replace('/([\}\)\]])[^\S\n]+(?!'.implode('|', $operators).')/', '\\1', $content); |
|
| 287 | + $content = preg_replace('/([\}\)\]])[^\S\n]+(?!' . implode('|', $operators) . ')/', '\\1', $content); |
|
| 288 | 288 | |
| 289 | 289 | // collapse whitespace around reserved words into single space |
| 290 | 290 | $before = $this->getKeywordsForRegex($this->keywordsBefore, '/'); |
| 291 | 291 | $after = $this->getKeywordsForRegex($this->keywordsAfter, '/'); |
| 292 | - $content = preg_replace('/(^|[;\}\s])\K('.implode('|', $before).')\s+/', '\\2 ', $content); |
|
| 293 | - $content = preg_replace('/\s+('.implode('|', $after).')(?=([;\{\s]|$))/', ' \\1', $content); |
|
| 292 | + $content = preg_replace('/(^|[;\}\s])\K(' . implode('|', $before) . ')\s+/', '\\2 ', $content); |
|
| 293 | + $content = preg_replace('/\s+(' . implode('|', $after) . ')(?=([;\{\s]|$))/', ' \\1', $content); |
|
| 294 | 294 | |
| 295 | 295 | /* |
| 296 | 296 | * Get rid of double semicolons, except where they can be used like: |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | // don't confuse = with other assignment shortcuts (e.g. +=) |
| 366 | 366 | $chars = preg_quote('+-*\=<>%&|'); |
| 367 | - $operators['='] = '(?<!['.$chars.'])\='; |
|
| 367 | + $operators['='] = '(?<![' . $chars . '])\='; |
|
| 368 | 368 | |
| 369 | 369 | return $operators; |
| 370 | 370 | } |
@@ -385,8 +385,8 @@ discard block |
||
| 385 | 385 | $escaped = array_map('preg_quote', $keywords, $delimiter); |
| 386 | 386 | |
| 387 | 387 | // add word boundaries |
| 388 | - array_walk($keywords, function ($value) { |
|
| 389 | - return '\b'.$value.'\b'; |
|
| 388 | + array_walk($keywords, function($value) { |
|
| 389 | + return '\b' . $value . '\b'; |
|
| 390 | 390 | }); |
| 391 | 391 | |
| 392 | 392 | $keywords = array_combine($keywords, $escaped); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | // PHP only supports $this inside anonymous functions since 5.4 |
| 407 | 407 | $minifier = $this; |
| 408 | 408 | $keywords = $this->keywordsReserved; |
| 409 | - $callback = function ($match) use ($minifier, $keywords) { |
|
| 409 | + $callback = function($match) use ($minifier, $keywords) { |
|
| 410 | 410 | $property = trim($minifier->extracted[$match[1]], '\'"'); |
| 411 | 411 | |
| 412 | 412 | /* |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | * array['key-here'] can't be replaced by array.key-here since '-' |
| 424 | 424 | * is not a valid character there. |
| 425 | 425 | */ |
| 426 | - if (!preg_match('/^'.$minifier::REGEX_VARIABLE.'$/u', $property)) { |
|
| 426 | + if (!preg_match('/^' . $minifier::REGEX_VARIABLE . '$/u', $property)) { |
|
| 427 | 427 | return $match[0]; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - return '.'.$property; |
|
| 430 | + return '.' . $property; |
|
| 431 | 431 | }; |
| 432 | 432 | |
| 433 | 433 | /* |
@@ -448,9 +448,9 @@ discard block |
||
| 448 | 448 | * separate look-behind assertions, one for each keyword. |
| 449 | 449 | */ |
| 450 | 450 | $keywords = $this->getKeywordsForRegex($keywords); |
| 451 | - $keywords = '(?<!'.implode(')(?<!', $keywords).')'; |
|
| 451 | + $keywords = '(?<!' . implode(')(?<!', $keywords) . ')'; |
|
| 452 | 452 | |
| 453 | - return preg_replace_callback('/(?<='.$previousChar.'|\])'.$keywords.'\[(([\'"])[0-9]+\\2)\]/u', $callback, $content); |
|
| 453 | + return preg_replace_callback('/(?<=' . $previousChar . '|\])' . $keywords . '\[(([\'"])[0-9]+\\2)\]/u', $callback, $content); |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | /** |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | // when both paths have nothing in common, one of them is probably |
| 40 | 40 | // absolute while the other is relative |
| 41 | 41 | $cwd = getcwd(); |
| 42 | - $from = strpos($from, $cwd) === 0 ? $from : $cwd.'/'.$from; |
|
| 43 | - $to = strpos($to, $cwd) === 0 ? $to : $cwd.'/'.$to; |
|
| 42 | + $from = strpos($from, $cwd) === 0 ? $from : $cwd . '/' . $from; |
|
| 43 | + $to = strpos($to, $cwd) === 0 ? $to : $cwd . '/' . $to; |
|
| 44 | 44 | |
| 45 | 45 | // or traveling the tree via `..` |
| 46 | 46 | // attempt to resolve path, or assume it's fine if it doesn't exist |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // normalize paths |
| 150 | - $path = $this->normalize($this->from.'/'.$path); |
|
| 150 | + $path = $this->normalize($this->from . '/' . $path); |
|
| 151 | 151 | |
| 152 | 152 | // strip shared ancestor paths |
| 153 | 153 | $shared = $this->shared($path, $this->to); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | // add .. for every directory that needs to be traversed to new path |
| 158 | 158 | $to = str_repeat('../', mb_substr_count($to, '/')); |
| 159 | 159 | |
| 160 | - return $to.ltrim($path, '/'); |
|
| 160 | + return $to . ltrim($path, '/'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |