Completed
Push — master ( 62aed1...8add54 )
by cam
01:34
created
ecrire/bootstrap/inc/urls.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	foreach ($regexp as $r => $e) {
86 86
 		$regexp[$r] = str_replace('[]', '\[\]', preg_replace(',[^\w\[\]-],', '', $e));
87 87
 	}
88
-	$regexp = ',^(' . implode('|', $regexp) . '[[]?[]]?)(=.*)?$,';
88
+	$regexp = ',^('.implode('|', $regexp).'[[]?[]]?)(=.*)?$,';
89 89
 	$ajouts = array_flip(explode('|', $c));
90 90
 	$u = is_array($v) ? $v : rawurlencode((string) $v);
91 91
 	$testv = (is_array($v) ? count($v) : strlen((string) $v));
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			// Ajout. Pour une variable, remplacer au meme endroit,
113 113
 			// pour un tableau ce sera fait dans la prochaine boucle
114 114
 			elseif (!str_ends_with($r[1], '[]')) {
115
-				$url[$n] = $r[1] . '=' . $u;
115
+				$url[$n] = $r[1].'='.$u;
116 116
 				unset($ajouts[$r[1]]);
117 117
 			}
118 118
 			// Pour les tableaux on laisse tomber les valeurs de
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	} elseif ($testv) {
134 134
 		foreach ($ajouts as $k => $n) {
135 135
 			if (!is_array($v)) {
136
-				$url[] = $k . '=' . $u;
136
+				$url[] = $k.'='.$u;
137 137
 			} else {
138
-				$id = (str_ends_with($k, '[]')) ? $k : ($k . '[]');
138
+				$id = (str_ends_with($k, '[]')) ? $k : ($k.'[]');
139 139
 				foreach ($v as $w) {
140
-					$url[] = $id . '=' . (is_array($w) ? 'Array' : rawurlencode($w));
140
+					$url[] = $id.'='.(is_array($w) ? 'Array' : rawurlencode($w));
141 141
 				}
142 142
 			}
143 143
 		}
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 
149 149
 	// recomposer l'adresse
150 150
 	if ($url) {
151
-		$a .= '?' . join($sep, $url);
151
+		$a .= '?'.join($sep, $url);
152 152
 	}
153 153
 
154
-	return $a . $ancre;
154
+	return $a.$ancre;
155 155
 }
156 156
 
157 157
 /**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			translitteration($ancre)
182 182
 		);
183 183
 	}
184
-	return $url . (strlen($ancre) ? '#' . $ancre : '');
184
+	return $url.(strlen($ancre) ? '#'.$ancre : '');
185 185
 }
186 186
 
187 187
 /**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			if (str_starts_with($var, '^')) {
227 227
 				$var = substr($var, 1);
228 228
 			} else {
229
-				$var = '[^=&]*' . $var;
229
+				$var = '[^=&]*'.$var;
230 230
 			}
231 231
 			if (str_ends_with($var, '$')) {
232 232
 				$var = substr($var, 0, -1);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				$var .= '[^=&]*';
235 235
 			}
236 236
 		}
237
-		$preg_nettoyer = ',([?&])(' . implode('|', $preg_nettoyer_vars) . ')=[^&]*(&|$),i';
237
+		$preg_nettoyer = ',([?&])('.implode('|', $preg_nettoyer_vars).')=[^&]*(&|$),i';
238 238
 	}
239 239
 	if (empty($request_uri)) {
240 240
 		return $request_uri;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	}
365 365
 
366 366
 	// On a ete gentil mais la ....
367
-	spip_logger()->error("generer_objet_url: entite $entite " . ($public ? "($f)" : '') . " inconnue $type $public $connect");
367
+	spip_logger()->error("generer_objet_url: entite $entite ".($public ? "($f)" : '')." inconnue $type $public $connect");
368 368
 
369 369
 	return '';
370 370
 }
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 	include_spip('base/connect_sql');
416 416
 	$id_type = id_table_objet($entite, $public);
417 417
 
418
-	return _DIR_RACINE . get_spip_script('./')
419
-	. '?' . _SPIP_PAGE . "=$entite&$id_type=$i&connect=$public"
418
+	return _DIR_RACINE.get_spip_script('./')
419
+	. '?'._SPIP_PAGE."=$entite&$id_type=$i&connect=$public"
420 420
 	. (!$args ? '' : "&$args")
421 421
 	. (!$ancre ? '' : "#$ancre");
422 422
 }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 				!empty($_SERVER['QUERY_STRING'])
567 567
 				&& !str_contains($_SERVER['REQUEST_URI'], '?')
568 568
 			) {
569
-				$GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
569
+				$GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
570 570
 			}
571 571
 		}
572 572
 	}
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 		array_shift($myself);
605 605
 		$myself = implode('/', $myself);
606 606
 	}
607
-	$url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)) . '/';
607
+	$url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)).'/';
608 608
 
609
-	$url = $http . '://' . rtrim($host, '/') . '/' . ltrim($url, '/');
609
+	$url = $http.'://'.rtrim($host, '/').'/'.ltrim($url, '/');
610 610
 
611 611
 	return $url;
612 612
 }
@@ -645,16 +645,16 @@  discard block
 block discarded – undo
645 645
 function generer_url_ecrire(?string $script = '', $args = '', $no_entities = false, $rel = false) {
646 646
 	$script ??= '';
647 647
 	if (!$rel) {
648
-		$rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT;
648
+		$rel = url_de_base()._DIR_RESTREINT_ABS._SPIP_ECRIRE_SCRIPT;
649 649
 	} else {
650 650
 		if (!is_string($rel)) {
651
-			$rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT;
651
+			$rel = _DIR_RESTREINT ?: './'._SPIP_ECRIRE_SCRIPT;
652 652
 		}
653 653
 	}
654 654
 
655 655
 	[$script, $ancre] = array_pad(explode('#', $script), 2, null);
656 656
 	if ($script && ($script <> 'accueil' || $rel)) {
657
-		$args = "?exec=$script" . (!$args ? '' : "&$args");
657
+		$args = "?exec=$script".(!$args ? '' : "&$args");
658 658
 	} elseif ($args) {
659 659
 		$args = "?$args";
660 660
 	}
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 		$args .= "#$ancre";
663 663
 	}
664 664
 
665
-	return $rel . ($no_entities ? $args : str_replace('&', '&amp;', $args));
665
+	return $rel.($no_entities ? $args : str_replace('&', '&amp;', $args));
666 666
 }
667 667
 
668 668
 //
@@ -744,10 +744,10 @@  discard block
 block discarded – undo
744 744
 			$action = parametre_url($action, _SPIP_PAGE, $script, '&');
745 745
 		}
746 746
 		if ($args) {
747
-			$action .= (str_contains($action, '?') ? '&' : '?') . $args;
747
+			$action .= (str_contains($action, '?') ? '&' : '?').$args;
748 748
 		}
749 749
 		// ne pas generer une url avec /./?page= en cas d'url absolue et de _SPIP_SCRIPT vide
750
-		$url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/') . preg_replace(',^/[.]/,', '/', "/$action"));
750
+		$url = ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/').preg_replace(',^/[.]/,', '/', "/$action"));
751 751
 	}
752 752
 
753 753
 	if (!$no_entities) {
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 
760 760
 function generer_url_prive($script, $args = '', $no_entities = false) {
761 761
 
762
-	return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS . 'prive.php');
762
+	return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS.'prive.php');
763 763
 }
764 764
 
765 765
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		: generer_url_public('', '', false, false);
788 788
 	$url = parametre_url($url, 'action', $script);
789 789
 	if ($args) {
790
-		$url .= quote_amp('&' . $args);
790
+		$url .= quote_amp('&'.$args);
791 791
 	}
792 792
 
793 793
 	if ($no_entities) {
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 	}
822 822
 	$url =
823 823
 		(($public ? _DIR_RACINE : _DIR_RESTREINT) ?: './')
824
-	. $script . '/'
824
+	. $script.'/'
825 825
 	. ($path ? trim($path, '/') : '')
826
-	. ($args ? '?' . quote_amp($args) : '');
826
+	. ($args ? '?'.quote_amp($args) : '');
827 827
 
828 828
 	if ($no_entities) {
829 829
 		$url = str_replace('&amp;', '&', $url);
Please login to merge, or discard this patch.
ecrire/public/format_html.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,36 +26,36 @@  discard block
 block discarded – undo
26 26
 
27 27
 function format_inclure_html($file, $args, $prof) {
28 28
 	if (!str_contains((string) $file, '#')) {
29
-		$t = $file ? ('(' . $file . ')') : '';
29
+		$t = $file ? ('('.$file.')') : '';
30 30
 	} else {
31
-		$t = '{fond=' . $file . '}';
31
+		$t = '{fond='.$file.'}';
32 32
 	}
33
-	$args = $args ? '{' . implode(', ', $args) . '}' : ('');
33
+	$args = $args ? '{'.implode(', ', $args).'}' : ('');
34 34
 
35
-	return ('<INCLURE' . $t . $args . '>');
35
+	return ('<INCLURE'.$t.$args.'>');
36 36
 }
37 37
 
38 38
 function format_polyglotte_html($args, $prof) {
39 39
 	$contenu = [];
40 40
 	foreach ($args as $l => $t) {
41
-		$contenu[] = ($l ? "[$l]" : '') . $t;
41
+		$contenu[] = ($l ? "[$l]" : '').$t;
42 42
 	}
43 43
 
44
-	return ('<multi>' . implode(' ', $contenu) . '</multi>');
44
+	return ('<multi>'.implode(' ', $contenu).'</multi>');
45 45
 }
46 46
 
47 47
 function format_idiome_html($nom, $module, $args, $filtres, $prof) {
48 48
 	foreach ($args as $k => $v) {
49 49
 		$args[$k] = "$k=$v";
50 50
 	}
51
-	$args = ($args ? '{' . implode(',', $args) . '}' : (''));
51
+	$args = ($args ? '{'.implode(',', $args).'}' : (''));
52 52
 
53
-	return ('<:' . ($module ? "$module:" : '') . $nom . $args . $filtres . ':>');
53
+	return ('<:'.($module ? "$module:" : '').$nom.$args.$filtres.':>');
54 54
 }
55 55
 
56 56
 function format_champ_html($nom, $boucle, $etoile, $avant, $apres, $args, $filtres, $prof) {
57 57
 	$nom = '#'
58
-		. ($boucle ? ($boucle . ':') : '')
58
+		. ($boucle ? ($boucle.':') : '')
59 59
 		. $nom
60 60
 		. $etoile
61 61
 		. $args
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 		$critere[$k] = $crit_s;
85 85
 	}
86 86
 
87
-	return ($critere ? '{' . implode(',', $critere) . '}' : (''));
87
+	return ($critere ? '{'.implode(',', $critere).'}' : (''));
88 88
 }
89 89
 
90 90
 function format_liste_html($fonc, $args, $prof) {
91 91
 	return ((($fonc !== '') ? "|$fonc" : $fonc)
92
-		. ($args ? '{' . implode(',', $args) . '}' : ('')));
92
+		. ($args ? '{'.implode(',', $args).'}' : ('')));
93 93
 }
94 94
 
95 95
 // Concatenation sans separateur: verifier qu'on ne cree pas de faux lexemes
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			// si un texte se termine par ( et est suivi d'un champ
107 107
 			// ou assimiles, forcer la notation pleine
108 108
 			if ($c1 == '(' && str_starts_with((string) $texte2, '#')) {
109
-				$args[$i + 1][0] = '[(' . $texte2 . ')]';
109
+				$args[$i + 1][0] = '[('.$texte2.')]';
110 110
 			}
111 111
 		} else {
112 112
 			if ($type == 'texte') {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				$c1 == '}' && str_starts_with(ltrim((string) $texte2), '|')
120 120
 				|| preg_match('/[\w*]/', $c1) && preg_match('/^[\w*{|]/', (string) $texte2)
121 121
 			) {
122
-				$args[$i][0] = '[(' . $texte . ')]';
122
+				$args[$i][0] = '[('.$texte.')]';
123 123
 			}
124 124
 		}
125 125
 	}
Please login to merge, or discard this patch.