Completed
Push — master ( fd5cc0...dec8bc )
by cam
01:14
created
ecrire/inc/filtres_dates.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 function extraire_date($texte): string {
39 39
 	// format = 2001-08
40 40
 	if (preg_match(',([1-2][0-9]{3})[^0-9]*(1[0-2]|0?[1-9]),', $texte, $regs)) {
41
-		return $regs[1] . '-' . sprintf('%02d', $regs[2]) . '-01';
41
+		return $regs[1].'-'.sprintf('%02d', $regs[2]).'-01';
42 42
 	}
43 43
 	return '';
44 44
 }
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 		if (preg_match('#^([12][0-9]{3})([-/]00)?( [-0-9:]+)?$#', $date, $regs)) {
71 71
 			$regs = array_pad($regs, 4, null); // eviter notice php
72
-			$date = $regs[1] . '-00-00' . $regs[3];
72
+			$date = $regs[1].'-00-00'.$regs[3];
73 73
 		} else {
74 74
 			if (preg_match('#^([12][0-9]{3}[-/][01]?[0-9])([-/]00)?( [-0-9:]+)?$#', $date, $regs)) {
75 75
 				$regs = array_pad($regs, 4, null); // eviter notice php
76
-				$date = preg_replace('@/@', '-', $regs[1]) . '-00' . $regs[3];
76
+				$date = preg_replace('@/@', '-', $regs[1]).'-00'.$regs[3];
77 77
 			} else {
78 78
 				$date = date('Y-m-d H:i:s', strtotime($date));
79 79
 			}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	$letexte ??= '';
101 101
 	if (
102 102
 		!$verif_format_date
103
-		or (in_array(strlen($letexte), [10,19]) and
103
+		or (in_array(strlen($letexte), [10, 19]) and
104 104
 			  preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}(\s[0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $letexte))
105 105
 	) {
106 106
 		if (strncmp('0000-00-00', $letexte, 10) == 0) {
@@ -390,17 +390,17 @@  discard block
 block discarded – undo
390 390
 	if ($decal > 3600 * 24 * 30) {
391 391
 		$mois = floor($decal / (3600 * 24 * 30));
392 392
 		if ($mois < 2) {
393
-			$delai = "$mois " . _T('date_un_mois');
393
+			$delai = "$mois "._T('date_un_mois');
394 394
 		} else {
395
-			$delai = "$mois " . _T('date_mois');
395
+			$delai = "$mois "._T('date_mois');
396 396
 		}
397 397
 	} else {
398 398
 		if ($decal > 3600 * 24 * 7) {
399 399
 			$semaines = floor($decal / (3600 * 24 * 7));
400 400
 			if ($semaines < 2) {
401
-				$delai = "$semaines " . _T('date_une_semaine');
401
+				$delai = "$semaines "._T('date_une_semaine');
402 402
 			} else {
403
-				$delai = "$semaines " . _T('date_semaines');
403
+				$delai = "$semaines "._T('date_semaines');
404 404
 			}
405 405
 		} else {
406 406
 			if ($decal > 3600 * 24) {
@@ -408,30 +408,30 @@  discard block
 block discarded – undo
408 408
 				if ($jours < 2) {
409 409
 					return $il_y_a == 'date_dans' ? _T('date_demain') : _T('date_hier');
410 410
 				} else {
411
-					$delai = "$jours " . _T('date_jours');
411
+					$delai = "$jours "._T('date_jours');
412 412
 				}
413 413
 			} else {
414 414
 				if ($decal >= 3600) {
415 415
 					$heures = floor($decal / 3600);
416 416
 					if ($heures < 2) {
417
-						$delai = "$heures " . _T('date_une_heure');
417
+						$delai = "$heures "._T('date_une_heure');
418 418
 					} else {
419
-						$delai = "$heures " . _T('date_heures');
419
+						$delai = "$heures "._T('date_heures');
420 420
 					}
421 421
 				} else {
422 422
 					if ($decal >= 60) {
423 423
 						$minutes = floor($decal / 60);
424 424
 						if ($minutes < 2) {
425
-							$delai = "$minutes " . _T('date_une_minute');
425
+							$delai = "$minutes "._T('date_une_minute');
426 426
 						} else {
427
-							$delai = "$minutes " . _T('date_minutes');
427
+							$delai = "$minutes "._T('date_minutes');
428 428
 						}
429 429
 					} else {
430 430
 						$secondes = ceil($decal);
431 431
 						if ($secondes < 2) {
432
-							$delai = "$secondes " . _T('date_une_seconde');
432
+							$delai = "$secondes "._T('date_une_seconde');
433 433
 						} else {
434
-							$delai = "$secondes " . _T('date_secondes');
434
+							$delai = "$secondes "._T('date_secondes');
435 435
 						}
436 436
 					}
437 437
 				}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		$njour = 0;
525 525
 	} else {
526 526
 		$njour = intval($jour);
527
-		if ($jourth = _T('date_jnum' . $jour)) {
527
+		if ($jourth = _T('date_jnum'.$jour)) {
528 528
 			$jour = $jourth;
529 529
 		}
530 530
 	}
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	$mois = intval($mois);
533 533
 	if ($mois > 0 and $mois < 13) {
534 534
 		/* Traiter le cas "abbr" pour les noms de mois */
535
-		$param = ((isset($options['param']) and $options['param'] === 'abbr') ? '_' . $options['param'] : '');
536
-		$nommois = _T('date_mois_' . $mois . $param);
535
+		$param = ((isset($options['param']) and $options['param'] === 'abbr') ? '_'.$options['param'] : '');
536
+		$nommois = _T('date_mois_'.$mois.$param);
537 537
 		if ($jour) {
538
-			$jourmois = _T('date_de_mois_' . $mois, ['j' => $jour, 'nommois' => $nommois]);
538
+			$jourmois = _T('date_de_mois_'.$mois, ['j' => $jour, 'nommois' => $nommois]);
539 539
 		} else {
540 540
 			$jourmois = $nommois;
541 541
 		}
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	}
546 546
 
547 547
 	if ($annee < 0) {
548
-		$annee = -$annee . ' ' . _T('date_avant_jc');
548
+		$annee = -$annee.' '._T('date_avant_jc');
549 549
 		$avjc = true;
550 550
 	} else {
551 551
 		$avjc = false;
@@ -571,11 +571,11 @@  discard block
 block discarded – undo
571 571
 				}
572 572
 			}
573 573
 			if ($vue == 'saison') {
574
-				return $saison ? _T('date_saison_' . $saison) : '';
574
+				return $saison ? _T('date_saison_'.$saison) : '';
575 575
 			} else {
576 576
 				return $saison ? trim(_T(
577 577
 					'date_fmt_saison_annee',
578
-					['saison' => _T('date_saison_' . $saison), 'annee' => $annee]
578
+					['saison' => _T('date_saison_'.$saison), 'annee' => $annee]
579 579
 				)) : '';
580 580
 			}
581 581
 
@@ -652,9 +652,9 @@  discard block
 block discarded – undo
652 652
 			}
653 653
 			$nom = mktime(1, 1, 1, $mois, $njour, $annee);
654 654
 			$nom = 1 + (int) date('w', $nom);
655
-			$param = ((isset($options['param']) and $options['param']) ? '_' . $options['param'] : '');
655
+			$param = ((isset($options['param']) and $options['param']) ? '_'.$options['param'] : '');
656 656
 
657
-			return _T('date_jour_' . $nom . $param);
657
+			return _T('date_jour_'.$nom.$param);
658 658
 
659 659
 		case 'mois_annee':
660 660
 			if ($avjc) {
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		default:
672 672
 			[$annee, $mois, $jour, $heures, $minutes, $secondes] = $date_array;
673 673
 			// il faut envoyer jour = 1 si jour pas défini, c'est le comportement qu'on avait historiquement en envoyant ''
674
-			if (!$time = mktime($heures, $minutes, $secondes, $mois, is_numeric($jour) ? $jour : 1 , $annee)) {
674
+			if (!$time = mktime($heures, $minutes, $secondes, $mois, is_numeric($jour) ? $jour : 1, $annee)) {
675 675
 				$time = strtotime($numdate);
676 676
 			}
677 677
 			return date($vue, $time);
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	$dtstart = $dtend = $dtabbr = '';
1052 1052
 	if (strpos($forme, 'hcal') !== false) {
1053
-		$dtstart = "<abbr class='dtstart' title='" . date_iso($date_debut) . "'>";
1054
-		$dtend = "<abbr class='dtend' title='" . date_iso($date_fin) . "'>";
1053
+		$dtstart = "<abbr class='dtstart' title='".date_iso($date_debut)."'>";
1054
+		$dtend = "<abbr class='dtend' title='".date_iso($date_fin)."'>";
1055 1055
 		$dtabbr = '</abbr>';
1056 1056
 	}
1057 1057
 
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 			}
1100 1100
 		} else {
1101 1101
 			if ($dtabbr && $dtstart) {
1102
-				$s = $dtstart . spip_ucfirst($s) . $dtabbr;
1102
+				$s = $dtstart.spip_ucfirst($s).$dtabbr;
1103 1103
 			} else {
1104 1104
 				$s = spip_ucfirst($s);
1105 1105
 			}
@@ -1122,8 +1122,8 @@  discard block
 block discarded – undo
1122 1122
 				$date_debut = _T('date_fmt_jour_heure', ['jour' => $date_debut, 'heure' => $hd]);
1123 1123
 				$date_fin = _T('date_fmt_jour_heure', ['jour' => $date_fin, 'heure' => $hf]);
1124 1124
 			}
1125
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1126
-			$date_fin = $dtend . $date_fin . $dtabbr;
1125
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1126
+			$date_fin = $dtend.$date_fin.$dtabbr;
1127 1127
 
1128 1128
 			$s = _T('date_fmt_periode', ['date_debut' => $date_debut, 'date_fin' => $date_fin]);
1129 1129
 		} else {
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 				$date_fin = _T('date_fmt_jour_heure', ['jour' => $date_fin, 'heure' => $hf]);
1141 1141
 			}
1142 1142
 
1143
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1144
-			$date_fin = $dtend . $date_fin . $dtabbr;
1143
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1144
+			$date_fin = $dtend.$date_fin.$dtabbr;
1145 1145
 			$s = _T('date_fmt_periode', ['date_debut' => $date_debut, 'date_fin' => $date_fin]);
1146 1146
 		}
1147 1147
 	}
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 		$d = date('Y-m-d');
1249 1249
 	}
1250 1250
 
1251
-	return substr($d, 0, 4) . substr($d, 5, 2) . substr($d, 8, 2);
1251
+	return substr($d, 0, 4).substr($d, 5, 2).substr($d, 8, 2);
1252 1252
 }
1253 1253
 
1254 1254
 /**
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 		$d = date('Y-m-d');
1269 1269
 	}
1270 1270
 
1271
-	return substr($d, 0, 4) . substr($d, 5, 2);
1271
+	return substr($d, 0, 4).substr($d, 5, 2);
1272 1272
 }
1273 1273
 
1274 1274
 /**
Please login to merge, or discard this patch.