Completed
Push — master ( 76d7da...58ec5b )
by cam
04:09
created
ecrire/inc/filtres_dates.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 function extraire_date($texte) {
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
 }
44 44
 
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 		}
69 69
 		if (preg_match("#^([12][0-9]{3})([-/]00)?( [-0-9:]+)?$#", $date, $regs)) {
70 70
 			$regs = array_pad($regs, 4, null); // eviter notice php
71
-			$date = $regs[1] . "-00-00" . $regs[3];
71
+			$date = $regs[1]."-00-00".$regs[3];
72 72
 		} else {
73 73
 			if (preg_match("#^([12][0-9]{3}[-/][01]?[0-9])([-/]00)?( [-0-9:]+)?$#", $date, $regs)) {
74 74
 				$regs = array_pad($regs, 4, null); // eviter notice php
75
-				$date = preg_replace("@/@", "-", $regs[1]) . "-00" . $regs[3];
75
+				$date = preg_replace("@/@", "-", $regs[1])."-00".$regs[3];
76 76
 			} else {
77 77
 				$date = date("Y-m-d H:i:s", strtotime($date));
78 78
 			}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  **/
98 98
 function vider_date($letexte, $verif_format_date = false) {
99 99
 	if (!$verif_format_date
100
-	  or (in_array(strlen($letexte), [10,19]) and
100
+	  or (in_array(strlen($letexte), [10, 19]) and
101 101
 			  preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}(\s[0-9]{2}:[0-9]{2}:[0-9]{2})?$/", $letexte))) {
102 102
 
103 103
 		if (strncmp("0000-00-00", $letexte, 10) == 0) {
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
  *	- si 'abbr' ne précise pas l'unité des minutes : 12h10
209 209
  * @return string L'heure formatée dans la langue en cours.
210 210
  **/
211
-function heures_minutes($numdate, $forme='') {
212
-	if ($forme !='abbr') {
211
+function heures_minutes($numdate, $forme = '') {
212
+	if ($forme != 'abbr') {
213 213
 		return _T('date_fmt_heures_minutes', array('h' => heures($numdate), 'm' => minutes($numdate)));
214 214
 	}
215 215
 	else {
@@ -381,17 +381,17 @@  discard block
 block discarded – undo
381 381
 	if ($decal > 3600 * 24 * 30) {
382 382
 		$mois = floor($decal / (3600 * 24 * 30));
383 383
 		if ($mois < 2) {
384
-			$delai = "$mois " . _T("date_un_mois");
384
+			$delai = "$mois "._T("date_un_mois");
385 385
 		} else {
386
-			$delai = "$mois " . _T("date_mois");
386
+			$delai = "$mois "._T("date_mois");
387 387
 		}
388 388
 	} else {
389 389
 		if ($decal > 3600 * 24 * 7) {
390 390
 			$semaines = floor($decal / (3600 * 24 * 7));
391 391
 			if ($semaines < 2) {
392
-				$delai = "$semaines " . _T("date_une_semaine");
392
+				$delai = "$semaines "._T("date_une_semaine");
393 393
 			} else {
394
-				$delai = "$semaines " . _T("date_semaines");
394
+				$delai = "$semaines "._T("date_semaines");
395 395
 			}
396 396
 		} else {
397 397
 			if ($decal > 3600 * 24) {
@@ -399,30 +399,30 @@  discard block
 block discarded – undo
399 399
 				if ($jours < 2) {
400 400
 					return $il_y_a == "date_dans" ? _T("date_demain") : _T("date_hier");
401 401
 				} else {
402
-					$delai = "$jours " . _T("date_jours");
402
+					$delai = "$jours "._T("date_jours");
403 403
 				}
404 404
 			} else {
405 405
 				if ($decal >= 3600) {
406 406
 					$heures = floor($decal / 3600);
407 407
 					if ($heures < 2) {
408
-						$delai = "$heures " . _T("date_une_heure");
408
+						$delai = "$heures "._T("date_une_heure");
409 409
 					} else {
410
-						$delai = "$heures " . _T("date_heures");
410
+						$delai = "$heures "._T("date_heures");
411 411
 					}
412 412
 				} else {
413 413
 					if ($decal >= 60) {
414 414
 						$minutes = floor($decal / 60);
415 415
 						if ($minutes < 2) {
416
-							$delai = "$minutes " . _T("date_une_minute");
416
+							$delai = "$minutes "._T("date_une_minute");
417 417
 						} else {
418
-							$delai = "$minutes " . _T("date_minutes");
418
+							$delai = "$minutes "._T("date_minutes");
419 419
 						}
420 420
 					} else {
421 421
 						$secondes = ceil($decal);
422 422
 						if ($secondes < 2) {
423
-							$delai = "$secondes " . _T("date_une_seconde");
423
+							$delai = "$secondes "._T("date_une_seconde");
424 424
 						} else {
425
-							$delai = "$secondes " . _T("date_secondes");
425
+							$delai = "$secondes "._T("date_secondes");
426 426
 						}
427 427
 					}
428 428
 				}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		$njour = 0;
518 518
 	} else {
519 519
 		$njour = intval($jour);
520
-		if ($jourth = _T('date_jnum' . $jour)) {
520
+		if ($jourth = _T('date_jnum'.$jour)) {
521 521
 			$jour = $jourth;
522 522
 		}
523 523
 	}
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
 	$mois = intval($mois);
526 526
 	if ($mois > 0 and $mois < 13) {
527 527
 		/* Traiter le cas "abbr" pour les noms de mois */
528
-		$param = ((isset($options['param']) and $options['param'] === "abbr") ? '_' . $options['param'] : '');
529
-		$nommois = _T('date_mois_' . $mois . $param);
528
+		$param = ((isset($options['param']) and $options['param'] === "abbr") ? '_'.$options['param'] : '');
529
+		$nommois = _T('date_mois_'.$mois.$param);
530 530
 		if ($jour) {
531
-			$jourmois = _T('date_de_mois_' . $mois, array('j' => $jour, 'nommois' => $nommois));
531
+			$jourmois = _T('date_de_mois_'.$mois, array('j' => $jour, 'nommois' => $nommois));
532 532
 		} else {
533 533
 			$jourmois = $nommois;
534 534
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	}
539 539
 
540 540
 	if ($annee < 0) {
541
-		$annee = -$annee . " " . _T('date_avant_jc');
541
+		$annee = -$annee." "._T('date_avant_jc');
542 542
 		$avjc = true;
543 543
 	} else {
544 544
 		$avjc = false;
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 				}
565 565
 			}
566 566
 			if ($vue == 'saison') {
567
-				return $saison ? _T('date_saison_' . $saison) : '';
567
+				return $saison ? _T('date_saison_'.$saison) : '';
568 568
 			} else {
569 569
 				return $saison ? trim(_T('date_fmt_saison_annee',
570
-					array('saison' => _T('date_saison_' . $saison), 'annee' => $annee))) : '';
570
+					array('saison' => _T('date_saison_'.$saison), 'annee' => $annee))) : '';
571 571
 			}
572 572
 
573 573
 		case 'court':
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 			}
634 634
 			$nom = mktime(1, 1, 1, $mois, $njour, $annee);
635 635
 			$nom = 1 + date('w', $nom);
636
-			$param = ((isset($options['param']) and $options['param']) ? '_' . $options['param'] : '');
636
+			$param = ((isset($options['param']) and $options['param']) ? '_'.$options['param'] : '');
637 637
 
638
-			return _T('date_jour_' . $nom . $param);
638
+			return _T('date_jour_'.$nom.$param);
639 639
 
640 640
 		case 'mois_annee':
641 641
 			if ($avjc) {
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
 
1031 1031
 	$dtstart = $dtend = $dtabbr = "";
1032 1032
 	if (strpos($forme, 'hcal') !== false) {
1033
-		$dtstart = "<abbr class='dtstart' title='" . date_iso($date_debut) . "'>";
1034
-		$dtend = "<abbr class='dtend' title='" . date_iso($date_fin) . "'>";
1033
+		$dtstart = "<abbr class='dtstart' title='".date_iso($date_debut)."'>";
1034
+		$dtend = "<abbr class='dtend' title='".date_iso($date_fin)."'>";
1035 1035
 		$dtabbr = "</abbr>";
1036 1036
 	}
1037 1037
 
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 			}
1076 1076
 		} else {
1077 1077
 			if ($dtabbr && $dtstart) {
1078
-				$s = $dtstart . spip_ucfirst($s) . $dtabbr;
1078
+				$s = $dtstart.spip_ucfirst($s).$dtabbr;
1079 1079
 			} else {
1080 1080
 				$s = spip_ucfirst($s);
1081 1081
 			}
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 				$date_debut = _T('date_fmt_jour_heure', array('jour' => $date_debut, 'heure' => $hd));
1099 1099
 				$date_fin = _T('date_fmt_jour_heure', array('jour' => $date_fin, 'heure' => $hf));
1100 1100
 			}
1101
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1102
-			$date_fin = $dtend . $date_fin . $dtabbr;
1101
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1102
+			$date_fin = $dtend.$date_fin.$dtabbr;
1103 1103
 
1104 1104
 			$s = _T('date_fmt_periode', array('date_debut' => $date_debut, 'date_fin' => $date_fin));
1105 1105
 		} else {
@@ -1116,8 +1116,8 @@  discard block
 block discarded – undo
1116 1116
 				$date_fin = _T('date_fmt_jour_heure', array('jour' => $date_fin, 'heure' => $hf));
1117 1117
 			}
1118 1118
 
1119
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1120
-			$date_fin = $dtend . $date_fin . $dtabbr;
1119
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1120
+			$date_fin = $dtend.$date_fin.$dtabbr;
1121 1121
 			$s = _T('date_fmt_periode', array('date_debut' => $date_debut, 'date_fin' => $date_fin));
1122 1122
 
1123 1123
 		}
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 		$d = date("Y-m-d");
1223 1223
 	}
1224 1224
 
1225
-	return substr($d, 0, 4) . substr($d, 5, 2) . substr($d, 8, 2);
1225
+	return substr($d, 0, 4).substr($d, 5, 2).substr($d, 8, 2);
1226 1226
 }
1227 1227
 
1228 1228
 /**
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 		$d = date("Y-m-d");
1243 1243
 	}
1244 1244
 
1245
-	return substr($d, 0, 4) . substr($d, 5, 2);
1245
+	return substr($d, 0, 4).substr($d, 5, 2);
1246 1246
 }
1247 1247
 
1248 1248
 /**
Please login to merge, or discard this patch.