Completed
Push — master ( 358935...bffbd4 )
by cam
05:38 queued 27s
created
ecrire/inc/filtres_dates.php 1 patch
Spacing   +36 added lines, -36 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,16 +517,16 @@  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
 	}
524 524
 
525 525
 	$mois = intval($mois);
526 526
 	if ($mois > 0 and $mois < 13) {
527
-		$nommois = _T('date_mois_' . $mois);
527
+		$nommois = _T('date_mois_'.$mois);
528 528
 		if ($jour) {
529
-			$jourmois = _T('date_de_mois_' . $mois, array('j' => $jour, 'nommois' => $nommois));
529
+			$jourmois = _T('date_de_mois_'.$mois, array('j' => $jour, 'nommois' => $nommois));
530 530
 		} else {
531 531
 			$jourmois = $nommois;
532 532
 		}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	}
537 537
 
538 538
 	if ($annee < 0) {
539
-		$annee = -$annee . " " . _T('date_avant_jc');
539
+		$annee = -$annee." "._T('date_avant_jc');
540 540
 		$avjc = true;
541 541
 	} else {
542 542
 		$avjc = false;
@@ -562,10 +562,10 @@  discard block
 block discarded – undo
562 562
 				}
563 563
 			}
564 564
 			if ($vue == 'saison') {
565
-				return $saison ? _T('date_saison_' . $saison) : '';
565
+				return $saison ? _T('date_saison_'.$saison) : '';
566 566
 			} else {
567 567
 				return $saison ? trim(_T('date_fmt_saison_annee',
568
-					array('saison' => _T('date_saison_' . $saison), 'annee' => $annee))) : '';
568
+					array('saison' => _T('date_saison_'.$saison), 'annee' => $annee))) : '';
569 569
 			}
570 570
 
571 571
 		case 'court':
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 			}
615 615
 
616 616
 		case 'nom_mois':
617
-			$param = ((isset($options['param']) and $options['param']) ? '_' . $options['param'] : '');
617
+			$param = ((isset($options['param']) and $options['param']) ? '_'.$options['param'] : '');
618 618
 			if ($param and $mois) {
619
-				return _T('date_mois_' . $mois . $param);
619
+				return _T('date_mois_'.$mois.$param);
620 620
 			}
621 621
 
622 622
 			return $nommois;
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 			}
637 637
 			$nom = mktime(1, 1, 1, $mois, $njour, $annee);
638 638
 			$nom = 1 + date('w', $nom);
639
-			$param = ((isset($options['param']) and $options['param']) ? '_' . $options['param'] : '');
639
+			$param = ((isset($options['param']) and $options['param']) ? '_'.$options['param'] : '');
640 640
 
641
-			return _T('date_jour_' . $nom . $param);
641
+			return _T('date_jour_'.$nom.$param);
642 642
 
643 643
 		case 'mois_annee':
644 644
 			if ($avjc) {
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 	$dtstart = $dtend = $dtabbr = "";
1035 1035
 	if (strpos($forme, 'hcal') !== false) {
1036
-		$dtstart = "<abbr class='dtstart' title='" . date_iso($date_debut) . "'>";
1037
-		$dtend = "<abbr class='dtend' title='" . date_iso($date_fin) . "'>";
1036
+		$dtstart = "<abbr class='dtstart' title='".date_iso($date_debut)."'>";
1037
+		$dtend = "<abbr class='dtend' title='".date_iso($date_fin)."'>";
1038 1038
 		$dtabbr = "</abbr>";
1039 1039
 	}
1040 1040
 
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			}
1079 1079
 		} else {
1080 1080
 			if ($dtabbr && $dtstart) {
1081
-				$s = $dtstart . spip_ucfirst($s) . $dtabbr;
1081
+				$s = $dtstart.spip_ucfirst($s).$dtabbr;
1082 1082
 			} else {
1083 1083
 				$s = spip_ucfirst($s);
1084 1084
 			}
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
 				$date_debut = _T('date_fmt_jour_heure', array('jour' => $date_debut, 'heure' => $hd));
1102 1102
 				$date_fin = _T('date_fmt_jour_heure', array('jour' => $date_fin, 'heure' => $hf));
1103 1103
 			}
1104
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1105
-			$date_fin = $dtend . $date_fin . $dtabbr;
1104
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1105
+			$date_fin = $dtend.$date_fin.$dtabbr;
1106 1106
 
1107 1107
 			$s = _T('date_fmt_periode', array('date_debut' => $date_debut, 'date_fin' => $date_fin));
1108 1108
 		} else {
@@ -1119,8 +1119,8 @@  discard block
 block discarded – undo
1119 1119
 				$date_fin = _T('date_fmt_jour_heure', array('jour' => $date_fin, 'heure' => $hf));
1120 1120
 			}
1121 1121
 
1122
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1123
-			$date_fin = $dtend . $date_fin . $dtabbr;
1122
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1123
+			$date_fin = $dtend.$date_fin.$dtabbr;
1124 1124
 			$s = _T('date_fmt_periode', array('date_debut' => $date_debut, 'date_fin' => $date_fin));
1125 1125
 
1126 1126
 		}
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 		$d = date("Y-m-d");
1226 1226
 	}
1227 1227
 
1228
-	return substr($d, 0, 4) . substr($d, 5, 2) . substr($d, 8, 2);
1228
+	return substr($d, 0, 4).substr($d, 5, 2).substr($d, 8, 2);
1229 1229
 }
1230 1230
 
1231 1231
 /**
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 		$d = date("Y-m-d");
1246 1246
 	}
1247 1247
 
1248
-	return substr($d, 0, 4) . substr($d, 5, 2);
1248
+	return substr($d, 0, 4).substr($d, 5, 2);
1249 1249
 }
1250 1250
 
1251 1251
 /**
Please login to merge, or discard this patch.