Completed
Pull Request — release-2.1 (#3886)
by Fran
07:42
created
Themes/default/Profile.template.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3031,8 +3031,7 @@
 block discarded – undo
3031 3031
 							<div class="roundframe">
3032 3032
 								<div>
3033 3033
 		', !empty($context['tfa_backup']) ? '
3034
-									<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' :
3035
-			($modSettings['tfa_mode'] == 2 ? '
3034
+									<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? '
3036 3035
 									<div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), '
3037 3036
 									<div class="smalltext">', $txt['tfa_desc'], '</div>
3038 3037
 									<div id="basicinfo" style="width: 60%">
Please login to merge, or discard this patch.
Themes/default/Recent.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	<div id="recent" class="main_section">
22 22
 		<div class="cat_bar">
23 23
 			<h3 class="catbg">
24
-				<span class="xx"></span>',$txt['recent_posts'],'
24
+				<span class="xx"></span>',$txt['recent_posts'], '
25 25
 			</h3>
26 26
 		</div>
27 27
 		<div class="pagesection">', $context['page_index'], '</div>';
Please login to merge, or discard this patch.
Sources/Post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -259,8 +259,8 @@
 block discarded – undo
259 259
 			$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
260 260
 
261 261
 		$js_time_string = str_replace(
262
-			array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r',      '%R',  '%S', '%T',    '%X'),
263
-			array('H',  'G',  'h',  'g',  'i',  'A',  'a',  'h:i:s A', 'H:i', 's',  'H:i:s', 'H:i:s'),
262
+			array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'),
263
+			array('H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s'),
264 264
 			$time_string
265 265
 		);
266 266
 
Please login to merge, or discard this patch.
Sources/Subs-Db-mysql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 		$connection
758 758
 	);
759 759
 	
760
-	if(!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0)
760
+	if (!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0)
761 761
 	{
762 762
 		if ($returnmode == 1)
763 763
 			$return_var = smf_db_insert_id($table, $keys[0]) + count($insertRows) - 1;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			$return_var = array();
767 767
 			$count = count($insertRows);
768 768
 			$start = smf_db_insert_id($table, $keys[0]);
769
-			for ($i = 0; $i < $count; $i++ )
769
+			for ($i = 0; $i < $count; $i++)
770 770
 				$return_var[] = $start + $i;
771 771
 		}
772 772
 		return $return_var;
Please login to merge, or discard this patch.
Sources/Subs-Db-postgresql.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 	$returning = '';
764 764
 	$with_returning = false;
765 765
 	// lets build the returning string, mysql allow only in normal mode
766
-	if(!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0)
766
+	if (!empty($keys) && (count($keys) > 0) && $method == '' && $returnmode > 0)
767 767
 	{
768 768
 		// we only take the first key
769
-		$returning = ' RETURNING '.$keys[0];
769
+		$returning = ' RETURNING ' . $keys[0];
770 770
 		$with_returning = true;
771 771
 	}
772 772
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 			INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '")
798 798
 			VALUES
799 799
 				' . implode(',
800
-				', $insertRows).$replace.$returning,
800
+				', $insertRows) . $replace . $returning,
801 801
 			array(
802 802
 				'security_override' => true,
803 803
 				'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors',
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 			if ($returnmode === 2)
811 811
 				$return_var = array();
812 812
 
813
-			while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
813
+			while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
814 814
 			{
815 815
 				if (is_numeric($row[0])) // try to emulate mysql limitation
816 816
 				{
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
  *
105 105
  * @param string $class The fully-qualified class name.
106 106
  */
107
-spl_autoload_register(function ($class) use ($sourcedir)
107
+spl_autoload_register(function($class) use ($sourcedir)
108 108
 {
109 109
 	$classMap = array(
110 110
 		'ReCaptcha\\' => 'ReCaptcha/',
Please login to merge, or discard this patch.
Sources/minify/path-converter/src/Converter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Sources/minify/src/CSS.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             }
83 83
 
84 84
             // add to top
85
-            $content = implode('', $matches[0]).$content;
85
+            $content = implode('', $matches[0]) . $content;
86 86
         }
87 87
 
88 88
         return $content;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         // loop the matches
208 208
         foreach ($matches as $match) {
209 209
             // get the path for the file that will be imported
210
-            $importPath = dirname($source).'/'.$match['path'];
210
+            $importPath = dirname($source) . '/' . $match['path'];
211 211
 
212 212
             // only replace the import with the content if we can grab the
213 213
             // content of the file
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 // check if current file was not imported previously in the same
216 216
                 // import chain.
217 217
                 if (in_array($importPath, $parents)) {
218
-                    throw new FileImportException('Failed to import file "'.$importPath.'": circular reference detected.');
218
+                    throw new FileImportException('Failed to import file "' . $importPath . '": circular reference detected.');
219 219
                 }
220 220
 
221 221
                 // grab referenced file & minify it (which may include importing
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
                 // check if this is only valid for certain media
227 227
                 if (!empty($match['media'])) {
228
-                    $importContent = '@media '.$match['media'].'{'.$importContent.'}';
228
+                    $importContent = '@media ' . $match['media'] . '{' . $importContent . '}';
229 229
                 }
230 230
 
231 231
                 // add to replacement array
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     protected function importFiles($source, $content)
255 255
     {
256 256
         $extensions = array_keys($this->importExtensions);
257
-        $regex = '/url\((["\']?)((?!["\']?data:).*?\.('.implode('|', $extensions).'))\\1\)/i';
257
+        $regex = '/url\((["\']?)((?!["\']?data:).*?\.(' . implode('|', $extensions) . '))\\1\)/i';
258 258
         if ($extensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
259 259
             $search = array();
260 260
             $replace = array();
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             foreach ($matches as $match) {
264 264
                 // get the path for the file that will be imported
265 265
                 $path = $match[2];
266
-                $path = dirname($source).'/'.$path;
266
+                $path = dirname($source) . '/' . $path;
267 267
                 $extension = $match[3];
268 268
 
269 269
                 // only replace the import with the content if we're able to get
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
                     // build replacement
277 277
                     $search[] = $match[0];
278
-                    $replace[] = 'url('.$this->importExtensions[$extension].';base64,'.$importContent.')';
278
+                    $replace[] = 'url(' . $this->importExtensions[$extension] . ';base64,' . $importContent . ')';
279 279
                 }
280 280
             }
281 281
 
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
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
 
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
         );
520 520
 
521 521
         return preg_replace_callback(
522
-            '/(?<=[: ])('.implode(array_keys($colors), '|').')(?=[; }])/i',
523
-            function ($match) use ($colors) {
522
+            '/(?<=[: ])(' . implode(array_keys($colors), '|') . ')(?=[; }])/i',
523
+            function($match) use ($colors) {
524 524
                 return $colors[strtoupper($match[0])];
525 525
             },
526 526
             $content
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
             'bold' => 700,
542 542
         );
543 543
 
544
-        $callback = function ($match) use ($weights) {
545
-            return $match[1].$weights[$match[2]];
544
+        $callback = function($match) use ($weights) {
545
+            return $match[1] . $weights[$match[2]];
546 546
         };
547 547
 
548
-        return preg_replace_callback('/(font-weight\s*:\s*)('.implode('|', array_keys($weights)).')(?=[;}])/', $callback, $content);
548
+        return preg_replace_callback('/(font-weight\s*:\s*)(' . implode('|', array_keys($weights)) . ')(?=[;}])/', $callback, $content);
549 549
     }
550 550
 
551 551
     /**
@@ -571,19 +571,19 @@  discard block
 block discarded – undo
571 571
         // practice, Webkit (especially Safari) seems to stumble over at least
572 572
         // 0%, potentially other units as well. Only stripping 'px' for now.
573 573
         // @see https://github.com/matthiasmullie/minify/issues/60
574
-        $content = preg_replace('/'.$before.'(-?0*(\.0+)?)(?<=0)px'.$after.'/', '\\1', $content);
574
+        $content = preg_replace('/' . $before . '(-?0*(\.0+)?)(?<=0)px' . $after . '/', '\\1', $content);
575 575
 
576 576
         // strip 0-digits (.0 -> 0)
577
-        $content = preg_replace('/'.$before.'\.0+'.$units.'?'.$after.'/', '0\\1', $content);
577
+        $content = preg_replace('/' . $before . '\.0+' . $units . '?' . $after . '/', '0\\1', $content);
578 578
         // strip trailing 0: 50.10 -> 50.1, 50.10px -> 50.1px
579
-        $content = preg_replace('/'.$before.'(-?[0-9]+\.[0-9]+)0+'.$units.'?'.$after.'/', '\\1\\2', $content);
579
+        $content = preg_replace('/' . $before . '(-?[0-9]+\.[0-9]+)0+' . $units . '?' . $after . '/', '\\1\\2', $content);
580 580
         // strip trailing 0: 50.00 -> 50, 50.00px -> 50px
581
-        $content = preg_replace('/'.$before.'(-?[0-9]+)\.0+'.$units.'?'.$after.'/', '\\1\\2', $content);
581
+        $content = preg_replace('/' . $before . '(-?[0-9]+)\.0+' . $units . '?' . $after . '/', '\\1\\2', $content);
582 582
         // strip leading 0: 0.1 -> .1, 01.1 -> 1.1
583
-        $content = preg_replace('/'.$before.'(-?)0+([0-9]*\.[0-9]+)'.$units.'?'.$after.'/', '\\1\\2\\3', $content);
583
+        $content = preg_replace('/' . $before . '(-?)0+([0-9]*\.[0-9]+)' . $units . '?' . $after . '/', '\\1\\2\\3', $content);
584 584
 
585 585
         // strip negative zeroes (-0 -> 0) & truncate zeroes (00 -> 0)
586
-        $content = preg_replace('/'.$before.'-?0+'.$units.'?'.$after.'/', '0\\1', $content);
586
+        $content = preg_replace('/' . $before . '-?0+' . $units . '?' . $after . '/', '0\\1', $content);
587 587
 
588 588
         // remove zeroes where they make no sense in calc: e.g. calc(100px - 0)
589 589
         // the 0 doesn't have any effect, and this isn't even valid without unit
Please login to merge, or discard this patch.
Sources/minify/src/JS.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.