@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'value' => $txt['name'], |
| 97 | 97 | ), |
| 98 | 98 | 'data' => array( |
| 99 | - 'function' => function ($rowData) use ($scripturl) |
|
| 99 | + 'function' => function($rowData) use ($scripturl) |
|
| 100 | 100 | { |
| 101 | 101 | // Since the moderator group has no explicit members, no link is needed. |
| 102 | 102 | if ($rowData['id_group'] == 3) |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'value' => $txt['moderators'], |
| 147 | 147 | ), |
| 148 | 148 | 'data' => array( |
| 149 | - 'function' => function ($group) use ($txt) |
|
| 149 | + 'function' => function($group) use ($txt) |
|
| 150 | 150 | { |
| 151 | 151 | return empty($group['moderators']) ? '<em>' . $txt['membergroups_new_copy_none'] . '</em>' : implode(', ', $group['moderators']); |
| 152 | 152 | }, |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | 'value' => $txt['membergroups_members_top'], |
| 158 | 158 | ), |
| 159 | 159 | 'data' => array( |
| 160 | - 'function' => function ($rowData) use ($txt) |
|
| 160 | + 'function' => function($rowData) use ($txt) |
|
| 161 | 161 | { |
| 162 | 162 | // No explicit members for the moderator group. |
| 163 | 163 | return $rowData['id_group'] == 3 ? $txt['membergroups_guests_na'] : comma_format($rowData['num_members']); |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 746 | 746 | { |
| 747 | 747 | if (empty($row['reason'])) |
| 748 | - $reason = '<em>(' . $txt['mc_groupr_no_reason'] . ')</em>'; |
|
| 748 | + $reason = '<em>(' . $txt['mc_groupr_no_reason'] . ')</em>'; |
|
| 749 | 749 | else |
| 750 | 750 | $reason = censorText($row['reason']); |
| 751 | 751 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // add to top |
| 86 | - $content = implode('', $matches[0]).$content; |
|
| 86 | + $content = implode('', $matches[0]) . $content; |
|
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | 89 | return $content; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | // loop the matches |
| 209 | 209 | foreach ($matches as $match) { |
| 210 | 210 | // get the path for the file that will be imported |
| 211 | - $importPath = dirname($source).'/'.$match['path']; |
|
| 211 | + $importPath = dirname($source) . '/' . $match['path']; |
|
| 212 | 212 | |
| 213 | 213 | // only replace the import with the content if we can grab the |
| 214 | 214 | // content of the file |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | // check if current file was not imported previously in the same |
| 217 | 217 | // import chain. |
| 218 | 218 | if (in_array($importPath, $parents)) { |
| 219 | - throw new FileImportException('Failed to import file "'.$importPath.'": circular reference detected.'); |
|
| 219 | + throw new FileImportException('Failed to import file "' . $importPath . '": circular reference detected.'); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // grab referenced file & minify it (which may include importing |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | // check if this is only valid for certain media |
| 228 | 228 | if (!empty($match['media'])) { |
| 229 | - $importContent = '@media '.$match['media'].'{'.$importContent.'}'; |
|
| 229 | + $importContent = '@media ' . $match['media'] . '{' . $importContent . '}'; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // add to replacement array |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | protected function importFiles($source, $content) |
| 256 | 256 | { |
| 257 | 257 | $extensions = array_keys($this->importExtensions); |
| 258 | - $regex = '/url\((["\']?)((?!["\']?data:).*?\.('.implode('|', $extensions).'))\\1\)/i'; |
|
| 258 | + $regex = '/url\((["\']?)((?!["\']?data:).*?\.(' . implode('|', $extensions) . '))\\1\)/i'; |
|
| 259 | 259 | if ($extensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { |
| 260 | 260 | $search = array(); |
| 261 | 261 | $replace = array(); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | foreach ($matches as $match) { |
| 265 | 265 | // get the path for the file that will be imported |
| 266 | 266 | $path = $match[2]; |
| 267 | - $path = dirname($source).'/'.$path; |
|
| 267 | + $path = dirname($source) . '/' . $path; |
|
| 268 | 268 | $extension = $match[3]; |
| 269 | 269 | |
| 270 | 270 | // only replace the import with the content if we're able to get |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | // build replacement |
| 278 | 278 | $search[] = $match[0]; |
| 279 | - $replace[] = 'url('.$this->importExtensions[$extension].';base64,'.$importContent.')'; |
|
| 279 | + $replace[] = 'url(' . $this->importExtensions[$extension] . ';base64,' . $importContent . ')'; |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | |
@@ -463,9 +463,9 @@ discard block |
||
| 463 | 463 | // build replacement |
| 464 | 464 | $search[] = $match[0]; |
| 465 | 465 | if ($type == 'url') { |
| 466 | - $replace[] = 'url('.$url.')'; |
|
| 466 | + $replace[] = 'url(' . $url . ')'; |
|
| 467 | 467 | } elseif ($type == 'import') { |
| 468 | - $replace[] = '@import "'.$url.'"'; |
|
| 468 | + $replace[] = '@import "' . $url . '"'; |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |
@@ -513,19 +513,19 @@ discard block |
||
| 513 | 513 | // practice, Webkit (especially Safari) seems to stumble over at least |
| 514 | 514 | // 0%, potentially other units as well. Only stripping 'px' for now. |
| 515 | 515 | // @see https://github.com/matthiasmullie/minify/issues/60 |
| 516 | - $content = preg_replace('/'.$before.'(-?0*(\.0+)?)(?<=0)px'.$after.'/', '\\1', $content); |
|
| 516 | + $content = preg_replace('/' . $before . '(-?0*(\.0+)?)(?<=0)px' . $after . '/', '\\1', $content); |
|
| 517 | 517 | |
| 518 | 518 | // strip 0-digits (.0 -> 0) |
| 519 | - $content = preg_replace('/'.$before.'\.0+'.$units.'?'.$after.'/', '0\\1', $content); |
|
| 519 | + $content = preg_replace('/' . $before . '\.0+' . $units . '?' . $after . '/', '0\\1', $content); |
|
| 520 | 520 | // strip trailing 0: 50.10 -> 50.1, 50.10px -> 50.1px |
| 521 | - $content = preg_replace('/'.$before.'(-?[0-9]+\.[0-9]+)0+'.$units.'?'.$after.'/', '\\1\\2', $content); |
|
| 521 | + $content = preg_replace('/' . $before . '(-?[0-9]+\.[0-9]+)0+' . $units . '?' . $after . '/', '\\1\\2', $content); |
|
| 522 | 522 | // strip trailing 0: 50.00 -> 50, 50.00px -> 50px |
| 523 | - $content = preg_replace('/'.$before.'(-?[0-9]+)\.0+'.$units.'?'.$after.'/', '\\1\\2', $content); |
|
| 523 | + $content = preg_replace('/' . $before . '(-?[0-9]+)\.0+' . $units . '?' . $after . '/', '\\1\\2', $content); |
|
| 524 | 524 | // strip leading 0: 0.1 -> .1, 01.1 -> 1.1 |
| 525 | - $content = preg_replace('/'.$before.'(-?)0+([0-9]*\.[0-9]+)'.$units.'?'.$after.'/', '\\1\\2\\3', $content); |
|
| 525 | + $content = preg_replace('/' . $before . '(-?)0+([0-9]*\.[0-9]+)' . $units . '?' . $after . '/', '\\1\\2\\3', $content); |
|
| 526 | 526 | |
| 527 | 527 | // strip negative zeroes (-0 -> 0) & truncate zeroes (00 -> 0) |
| 528 | - $content = preg_replace('/'.$before.'-?0+'.$units.'?'.$after.'/', '0\\1', $content); |
|
| 528 | + $content = preg_replace('/' . $before . '-?0+' . $units . '?' . $after . '/', '0\\1', $content); |
|
| 529 | 529 | |
| 530 | 530 | return $content; |
| 531 | 531 | } |
@@ -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 | /** |
@@ -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 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | // PHP only supports $this inside anonymous functions since 5.4 |
| 318 | 318 | $minifier = $this; |
| 319 | - $callback = function ($match) use ($minifier) { |
|
| 319 | + $callback = function($match) use ($minifier) { |
|
| 320 | 320 | // check the second index here, because the first always contains a quote |
| 321 | 321 | if (!$match[2]) { |
| 322 | 322 | /* |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $count = count($minifier->extracted); |
| 332 | - $placeholder = $match[1].$count.$match[1]; |
|
| 333 | - $minifier->extracted[$placeholder] = $match[1].$match[2].$match[1]; |
|
| 332 | + $placeholder = $match[1] . $count . $match[1]; |
|
| 333 | + $minifier->extracted[$placeholder] = $match[1] . $match[2] . $match[1]; |
|
| 334 | 334 | |
| 335 | 335 | return $placeholder; |
| 336 | 336 | }; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * considered as escape-char (times 2) and to get it in the regex, |
| 348 | 348 | * escaped (times 2) |
| 349 | 349 | */ |
| 350 | - $this->registerPattern('/(['.$chars.'])(.*?(?<!\\\\)(\\\\\\\\)*+)\\1/s', $callback); |
|
| 350 | + $this->registerPattern('/([' . $chars . '])(.*?(?<!\\\\)(\\\\\\\\)*+)\\1/s', $callback); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | protected function openFileForWriting($path) |
| 398 | 398 | { |
| 399 | 399 | if (($handler = @fopen($path, 'w')) === false) { |
| 400 | - throw new IOException('The file "'.$path.'" could not be opened for writing. Check if PHP has enough permissions.'); |
|
| 400 | + throw new IOException('The file "' . $path . '" could not be opened for writing. Check if PHP has enough permissions.'); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | return $handler; |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | protected function writeToFile($handler, $content, $path = '') |
| 416 | 416 | { |
| 417 | 417 | if (($result = @fwrite($handler, $content)) === false || ($result < strlen($content))) { |
| 418 | - throw new IOException('The file "'.$path.'" could not be written to. Check your disk space and file permissions.'); |
|
| 418 | + throw new IOException('The file "' . $path . '" could not be written to. Check your disk space and file permissions.'); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | } |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | { |
| 799 | 799 | // It goes 0 = outside, 1 = begin tag, 2 = inside, 3 = close tag, repeat. |
| 800 | 800 | if ($i % 4 == 0) |
| 801 | - $parts[$i] = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function ($m) |
|
| 801 | + $parts[$i] = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function($m) |
|
| 802 | 802 | { |
| 803 | 803 | return '[html]' . preg_replace('~<br\s?/?' . '>~i', '<br /><br>', "$m[1]") . '[/html]'; |
| 804 | 804 | }, $parts[$i]); |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | { |
| 896 | 896 | // Since, they don't belong here. Let's inform the user that they exist.. |
| 897 | 897 | if (!empty($topic)) |
| 898 | - $delete_url = $scripturl . '?action=post' .(!empty($_REQUEST['msg']) ? (';msg=' . $_REQUEST['msg']) : '') . (!empty($_REQUEST['last_msg']) ? (';last_msg=' . $_REQUEST['last_msg']) : '') . ';topic=' . $topic . ';delete_temp'; |
|
| 898 | + $delete_url = $scripturl . '?action=post' . (!empty($_REQUEST['msg']) ? (';msg=' . $_REQUEST['msg']) : '') . (!empty($_REQUEST['last_msg']) ? (';last_msg=' . $_REQUEST['last_msg']) : '') . ';topic=' . $topic . ';delete_temp'; |
|
| 899 | 899 | else |
| 900 | 900 | $delete_url = $scripturl . '?action=post;board=' . $board . ';delete_temp'; |
| 901 | 901 | |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | $file_list = array(); |
| 904 | 904 | foreach ($_SESSION['temp_attachments'] as $attachID => $attachment) |
| 905 | 905 | if (strpos($attachID, 'post_tmp_' . $user_info['id']) !== false) |
| 906 | - $file_list[] = $attachment['name']; |
|
| 906 | + $file_list[] = $attachment['name']; |
|
| 907 | 907 | |
| 908 | 908 | $_SESSION['temp_attachments']['post']['files'] = $file_list; |
| 909 | 909 | $file_list = '<div class="attachments">' . implode('<br>', $file_list) . '</div>'; |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | if (!empty($_SESSION['temp_attachments']['post']['msg'])) |
| 912 | 912 | { |
| 913 | 913 | // We have a message id, so we can link back to the old topic they were trying to edit.. |
| 914 | - $goback_url = $scripturl . '?action=post' .(!empty($_SESSION['temp_attachments']['post']['msg']) ? (';msg=' . $_SESSION['temp_attachments']['post']['msg']) : '') . (!empty($_SESSION['temp_attachments']['post']['last_msg']) ? (';last_msg=' . $_SESSION['temp_attachments']['post']['last_msg']) : '') . ';topic=' . $_SESSION['temp_attachments']['post']['topic'] . ';additionalOptions'; |
|
| 914 | + $goback_url = $scripturl . '?action=post' . (!empty($_SESSION['temp_attachments']['post']['msg']) ? (';msg=' . $_SESSION['temp_attachments']['post']['msg']) : '') . (!empty($_SESSION['temp_attachments']['post']['last_msg']) ? (';last_msg=' . $_SESSION['temp_attachments']['post']['last_msg']) : '') . ';topic=' . $_SESSION['temp_attachments']['post']['topic'] . ';additionalOptions'; |
|
| 915 | 915 | |
| 916 | 916 | $post_errors[] = array('temp_attachments_found', array($delete_url, $goback_url, $file_list)); |
| 917 | 917 | $context['ignore_temp_attachments'] = true; |
@@ -1198,55 +1198,55 @@ discard block |
||
| 1198 | 1198 | foreach ($context['current_attachments'] as $key => $mock) |
| 1199 | 1199 | addInlineJavaScript(' |
| 1200 | 1200 | current_attachments.push({ |
| 1201 | - name: '. JavaScriptEscape($mock['name']) .', |
|
| 1202 | - size: '. $mock['size'] .', |
|
| 1203 | - attachID: '. $mock['attachID'] .', |
|
| 1204 | - approved: '. $mock['approved'] .', |
|
| 1205 | - type: '. JavaScriptEscape(!empty($mock['mime_type']) ? $mock['mime_type'] : '') .', |
|
| 1206 | - thumbID: '. (!empty($mock['thumb']) ? $mock['thumb'] : 0) .' |
|
| 1201 | + name: '. JavaScriptEscape($mock['name']) . ', |
|
| 1202 | + size: '. $mock['size'] . ', |
|
| 1203 | + attachID: '. $mock['attachID'] . ', |
|
| 1204 | + approved: '. $mock['approved'] . ', |
|
| 1205 | + type: '. JavaScriptEscape(!empty($mock['mime_type']) ? $mock['mime_type'] : '') . ', |
|
| 1206 | + thumbID: '. (!empty($mock['thumb']) ? $mock['thumb'] : 0) . ' |
|
| 1207 | 1207 | });', true); |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | // File Upload. |
| 1211 | 1211 | if ($context['can_post_attachment']) |
| 1212 | 1212 | { |
| 1213 | - $acceptedFiles = implode(',', array_map(function($val) use($smcFunc) { return '.'. $smcFunc['htmltrim']($val);} , explode(',', $context['allowed_extensions']))); |
|
| 1213 | + $acceptedFiles = implode(',', array_map(function($val) use($smcFunc) { return '.' . $smcFunc['htmltrim']($val); } , explode(',', $context['allowed_extensions']))); |
|
| 1214 | 1214 | |
| 1215 | 1215 | loadJavaScriptFile('dropzone.min.js', array('defer' => true), 'smf_dropzone'); |
| 1216 | 1216 | loadJavaScriptFile('smf_fileUpload.js', array('defer' => true), 'smf_fileUpload'); |
| 1217 | 1217 | addInlineJavaScript(' |
| 1218 | 1218 | $(function() { |
| 1219 | 1219 | smf_fileUpload({ |
| 1220 | - dictDefaultMessage : '. JavaScriptEscape($txt['attach_drop_zone']) .', |
|
| 1221 | - dictFallbackMessage : '. JavaScriptEscape($txt['attach_drop_zone_no']) .', |
|
| 1222 | - dictCancelUpload : '. JavaScriptEscape($txt['modify_cancel']) .', |
|
| 1223 | - genericError: '. JavaScriptEscape($txt['attach_php_error']) .', |
|
| 1224 | - text_attachLeft: '. JavaScriptEscape($txt['attached_attachedLeft']) .', |
|
| 1225 | - text_deleteAttach: '. JavaScriptEscape($txt['attached_file_delete']) .', |
|
| 1226 | - text_attachDeleted: '. JavaScriptEscape($txt['attached_file_deleted']) .', |
|
| 1227 | - text_insertBBC: '. JavaScriptEscape($txt['attached_insertBBC']) .', |
|
| 1228 | - text_attachUploaded: '. JavaScriptEscape($txt['attached_file_uploaded']) .', |
|
| 1229 | - text_attach_unlimited: '. JavaScriptEscape($txt['attach_drop_unlimited']) .', |
|
| 1230 | - dictMaxFilesExceeded: '. JavaScriptEscape($txt['more_attachments_error']) .', |
|
| 1231 | - dictInvalidFileType: '. JavaScriptEscape(sprintf($txt['cant_upload_type'], $context['allowed_extensions'])) .', |
|
| 1232 | - dictFileTooBig: '. JavaScriptEscape(sprintf($txt['file_too_big'], comma_format($modSettings['attachmentSizeLimit'], 0))) .', |
|
| 1233 | - maxTotalSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) .', |
|
| 1234 | - acceptedFiles: '. JavaScriptEscape($acceptedFiles) .', |
|
| 1235 | - maxFilesize: '. (!empty($modSettings['attachmentSizeLimit']) ? $modSettings['attachmentSizeLimit'] : 'null') .', |
|
| 1236 | - thumbnailWidth: '.(!empty($modSettings['attachmentThumbWidth']) ? $modSettings['attachmentThumbWidth'] : 'null') .', |
|
| 1237 | - thumbnailHeight: '.(!empty($modSettings['attachmentThumbHeight']) ? $modSettings['attachmentThumbHeight'] : 'null') .', |
|
| 1238 | - maxFiles: '. (!empty($context['num_allowed_attachments']) ? $context['num_allowed_attachments'] : 'null') .', |
|
| 1239 | - text_totalMaxSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) .', |
|
| 1240 | - text_max_size_progress: '. JavaScriptEscape($txt['attach_max_size_progress']) .', |
|
| 1241 | - limitMultiFileUploadSize:'. round(max($modSettings['attachmentPostLimit'] - ($context['attachments']['total_size'] / 1024), 0)) * 1024 .', |
|
| 1242 | - maxLimitReferenceUploadSize: '. $modSettings['attachmentPostLimit'] * 1024 .', |
|
| 1220 | + dictDefaultMessage : '. JavaScriptEscape($txt['attach_drop_zone']) . ', |
|
| 1221 | + dictFallbackMessage : '. JavaScriptEscape($txt['attach_drop_zone_no']) . ', |
|
| 1222 | + dictCancelUpload : '. JavaScriptEscape($txt['modify_cancel']) . ', |
|
| 1223 | + genericError: '. JavaScriptEscape($txt['attach_php_error']) . ', |
|
| 1224 | + text_attachLeft: '. JavaScriptEscape($txt['attached_attachedLeft']) . ', |
|
| 1225 | + text_deleteAttach: '. JavaScriptEscape($txt['attached_file_delete']) . ', |
|
| 1226 | + text_attachDeleted: '. JavaScriptEscape($txt['attached_file_deleted']) . ', |
|
| 1227 | + text_insertBBC: '. JavaScriptEscape($txt['attached_insertBBC']) . ', |
|
| 1228 | + text_attachUploaded: '. JavaScriptEscape($txt['attached_file_uploaded']) . ', |
|
| 1229 | + text_attach_unlimited: '. JavaScriptEscape($txt['attach_drop_unlimited']) . ', |
|
| 1230 | + dictMaxFilesExceeded: '. JavaScriptEscape($txt['more_attachments_error']) . ', |
|
| 1231 | + dictInvalidFileType: '. JavaScriptEscape(sprintf($txt['cant_upload_type'], $context['allowed_extensions'])) . ', |
|
| 1232 | + dictFileTooBig: '. JavaScriptEscape(sprintf($txt['file_too_big'], comma_format($modSettings['attachmentSizeLimit'], 0))) . ', |
|
| 1233 | + maxTotalSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) . ', |
|
| 1234 | + acceptedFiles: '. JavaScriptEscape($acceptedFiles) . ', |
|
| 1235 | + maxFilesize: '. (!empty($modSettings['attachmentSizeLimit']) ? $modSettings['attachmentSizeLimit'] : 'null') . ', |
|
| 1236 | + thumbnailWidth: '.(!empty($modSettings['attachmentThumbWidth']) ? $modSettings['attachmentThumbWidth'] : 'null') . ', |
|
| 1237 | + thumbnailHeight: '.(!empty($modSettings['attachmentThumbHeight']) ? $modSettings['attachmentThumbHeight'] : 'null') . ', |
|
| 1238 | + maxFiles: '. (!empty($context['num_allowed_attachments']) ? $context['num_allowed_attachments'] : 'null') . ', |
|
| 1239 | + text_totalMaxSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) . ', |
|
| 1240 | + text_max_size_progress: '. JavaScriptEscape($txt['attach_max_size_progress']) . ', |
|
| 1241 | + limitMultiFileUploadSize:'. round(max($modSettings['attachmentPostLimit'] - ($context['attachments']['total_size'] / 1024), 0)) * 1024 . ', |
|
| 1242 | + maxLimitReferenceUploadSize: '. $modSettings['attachmentPostLimit'] * 1024 . ', |
|
| 1243 | 1243 | }); |
| 1244 | 1244 | });', true); |
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | // Knowing the current board ID might be handy. |
| 1248 | 1248 | addInlineJavaScript(' |
| 1249 | - var current_board = '. (empty($context['current_board']) ? 'null' : $context['current_board']) .';', false); |
|
| 1249 | + var current_board = '. (empty($context['current_board']) ? 'null' : $context['current_board']) . ';', false); |
|
| 1250 | 1250 | |
| 1251 | 1251 | // Finally, load the template. |
| 1252 | 1252 | if (!isset($_REQUEST['xml'])) |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | 1666 | // Coming from the quickReply? |
| 1667 | - if(isset($_POST['quickReply'])) |
|
| 1667 | + if (isset($_POST['quickReply'])) |
|
| 1668 | 1668 | $_POST['message'] = $_POST['quickReply']; |
| 1669 | 1669 | |
| 1670 | 1670 | // Check the subject and message. |
@@ -2456,7 +2456,7 @@ discard block |
||
| 2456 | 2456 | FROM {db_prefix}messages AS m |
| 2457 | 2457 | LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) |
| 2458 | 2458 | WHERE m.id_topic = {int:current_topic}' . (isset($_REQUEST['msg']) ? ' |
| 2459 | - AND m.id_msg < {int:id_msg}' : '') .(!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : ' |
|
| 2459 | + AND m.id_msg < {int:id_msg}' : '') . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : ' |
|
| 2460 | 2460 | AND m.approved = {int:approved}') . ' |
| 2461 | 2461 | ORDER BY m.id_msg DESC' . $limit, |
| 2462 | 2462 | array( |
@@ -303,7 +303,7 @@ |
||
| 303 | 303 | ), |
| 304 | 304 | array( |
| 305 | 305 | $_POST['msg'], $message['id_topic'], $message['id_board'], $message['id_poster'], $message['real_name'], |
| 306 | - $message['subject'], $message['body'] , time(), time(), 1, 0, |
|
| 306 | + $message['subject'], $message['body'], time(), time(), 1, 0, |
|
| 307 | 307 | ), |
| 308 | 308 | array('id_report') |
| 309 | 309 | ); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | // Remove the phrase parts and extract the words. |
| 661 | 661 | $wordArray = preg_replace('~(?:^|\s)(?:[-]?)"(?:[^"]+)"(?:$|\s)~' . ($context['utf8'] ? 'u' : ''), ' ', $search_params['search']); |
| 662 | - $wordArray = explode(' ', $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES)); |
|
| 662 | + $wordArray = explode(' ', $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES)); |
|
| 663 | 663 | |
| 664 | 664 | // A minus sign in front of a word excludes the word.... so... |
| 665 | 665 | $excludedWords = array(); |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | SELECT |
| 1105 | 1105 | {int:id_search}, |
| 1106 | 1106 | t.id_topic, |
| 1107 | - ' . $relevance. ', |
|
| 1107 | + ' . $relevance . ', |
|
| 1108 | 1108 | ' . (empty($userQuery) ? 't.id_first_msg' : 'm.id_msg') . ', |
| 1109 | 1109 | 1 |
| 1110 | 1110 | FROM ' . $subject_query['from'] . (empty($subject_query['inner_join']) ? '' : ' |
@@ -1339,7 +1339,7 @@ discard block |
||
| 1339 | 1339 | if (empty($subject_query['where'])) |
| 1340 | 1340 | continue; |
| 1341 | 1341 | |
| 1342 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 1342 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? (' |
|
| 1343 | 1343 | INSERT IGNORE INTO {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics |
| 1344 | 1344 | (' . ($createTemporary ? '' : 'id_search, ') . 'id_topic)') : '') . ' |
| 1345 | 1345 | SELECT ' . ($createTemporary ? '' : $_SESSION['search_cache']['id_search'] . ', ') . 't.id_topic |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | } |
| 1569 | 1569 | $main_query['select']['relevance'] = substr($relevance, 0, -3) . ') / ' . $new_weight_total . ' AS relevance'; |
| 1570 | 1570 | |
| 1571 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 1571 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? (' |
|
| 1572 | 1572 | INSERT IGNORE INTO ' . '{db_prefix}log_search_results |
| 1573 | 1573 | (' . implode(', ', array_keys($main_query['select'])) . ')') : '') . ' |
| 1574 | 1574 | SELECT |
@@ -1636,7 +1636,7 @@ discard block |
||
| 1636 | 1636 | $relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance'; |
| 1637 | 1637 | |
| 1638 | 1638 | $usedIDs = array_flip(empty($inserts) ? array() : array_keys($inserts)); |
| 1639 | - $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ( ' |
|
| 1639 | + $ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? (' |
|
| 1640 | 1640 | INSERT IGNORE INTO {db_prefix}log_search_results |
| 1641 | 1641 | (id_search, id_topic, relevance, id_msg, num_matches)') : '') . ' |
| 1642 | 1642 | SELECT |
@@ -2102,7 +2102,7 @@ discard block |
||
| 2102 | 2102 | $query = trim($query, "\*+"); |
| 2103 | 2103 | $query = strtr($smcFunc['htmlspecialchars']($query), array('\\\'' => '\'')); |
| 2104 | 2104 | |
| 2105 | - $body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => ''')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function ($m) |
|
| 2105 | + $body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => ''')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function($m) |
|
| 2106 | 2106 | { |
| 2107 | 2107 | return isset($m[2]) && "$m[2]" == "$m[1]" ? stripslashes("$m[1]") : "<strong class=\"highlight\">$m[1]</strong>"; |
| 2108 | 2108 | }, $body_highlighted); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | 'value' => $txt['admin_edit_news'], |
| 153 | 153 | ), |
| 154 | 154 | 'data' => array( |
| 155 | - 'function' => function ($news) |
|
| 155 | + 'function' => function($news) |
|
| 156 | 156 | { |
| 157 | 157 | if (is_numeric($news['id'])) |
| 158 | 158 | return '<textarea id="data_' . $news['id'] . '" rows="3" cols="50" name="news[]" class="padding block">' . $news['unparsed'] . '</textarea> |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | 'value' => $txt['preview'], |
| 169 | 169 | ), |
| 170 | 170 | 'data' => array( |
| 171 | - 'function' => function ($news) |
|
| 171 | + 'function' => function($news) |
|
| 172 | 172 | { |
| 173 | 173 | return '<div id="box_preview_' . $news['id'] . '" style="overflow: auto; width: 100%; height: 10ex;">' . $news['parsed'] . '</div>'; |
| 174 | 174 | }, |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | 'class' => 'centercol', |
| 182 | 182 | ), |
| 183 | 183 | 'data' => array( |
| 184 | - 'function' => function ($news) |
|
| 184 | + 'function' => function($news) |
|
| 185 | 185 | { |
| 186 | 186 | if (is_numeric($news['id'])) |
| 187 | 187 | return '<input type="checkbox" name="remove[]" value="' . $news['id'] . '" class="input_check">'; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | * Prepare subject and message of an email for the preview box |
| 432 | 432 | * Used in ComposeMailing and RetrievePreview (Xml.php) |
| 433 | 433 | */ |
| 434 | -function prepareMailingForPreview () |
|
| 434 | +function prepareMailingForPreview() |
|
| 435 | 435 | { |
| 436 | 436 | global $context, $modSettings, $scripturl, $user_info, $txt; |
| 437 | 437 | loadLanguage('Errors'); |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $request = $smcFunc['db_query']('', ' |
| 636 | 636 | SELECT id_member |
| 637 | 637 | FROM {db_prefix}members |
| 638 | - WHERE email_address IN(' . implode(', ', $condition_array) .')', |
|
| 638 | + WHERE email_address IN(' . implode(', ', $condition_array) . ')', |
|
| 639 | 639 | $condition_array_params |
| 640 | 640 | ); |
| 641 | 641 | while ($row = $smcFunc['db_fetch_assoc']($request)) |