Completed
Push — master ( d7bb20...c3d345 )
by cam
01:07
created
ecrire/public/composer.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$GLOBALS['debug_objets']['courant'] = $nom;
56 56
 	}
57 57
 
58
-	$phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php';
58
+	$phpfile = sous_repertoire(_DIR_SKELS, '', false, true).$nom.'.php';
59 59
 
60 60
 	// si squelette est deja compile et perenne, le charger
61 61
 	if (!squelette_obsolete($phpfile, $source)) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		#}
69 69
 	}
70 70
 
71
-	if (file_exists($lib = $squelette . '_fonctions' . '.php')) {
71
+	if (file_exists($lib = $squelette.'_fonctions'.'.php')) {
72 72
 		include_once $lib;
73 73
 	}
74 74
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			eval("return true; $f ;");
97 97
 		} catch (\ParseError $e) {
98 98
 			// Code syntaxiquement faux (critere etc mal programme')
99
-			$msg = _T('zbug_erreur_compilation') . ' | Line ' . $e->getLine() . ' : ' . $e->getMessage();
99
+			$msg = _T('zbug_erreur_compilation').' | Line '.$e->getLine().' : '.$e->getMessage();
100 100
 			erreur_squelette($msg, $boucle);
101 101
 			// continuer pour trouver d'autres fautes eventuelles
102 102
 			// mais prevenir que c'est mort
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 	if (defined('_VAR_MODE') and _VAR_MODE == 'debug') {
126 126
 		// Tracer ce qui vient d'etre compile
127
-		$GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code;
127
+		$GLOBALS['debug_objets']['code'][$nom.'tout'] = $code;
128 128
 
129 129
 		// si c'est ce que demande le debusqueur, lui passer la main
130 130
 		if (
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 		$code = "
149 149
 /*
150 150
  * Squelette : $sourcefile
151
- * Date :      " . gmdate('D, d M Y H:i:s', @filemtime($sourcefile)) . ' GMT
152
- * Compile :   ' . gmdate('D, d M Y H:i:s', time()) . ' GMT
153
- * ' . (!$boucles ? 'Pas de boucle' : ('Boucles :   ' . $noms)) . '
151
+ * Date :      ".gmdate('D, d M Y H:i:s', @filemtime($sourcefile)).' GMT
152
+ * Compile :   ' . gmdate('D, d M Y H:i:s', time()).' GMT
153
+ * ' . (!$boucles ? 'Pas de boucle' : ('Boucles :   '.$noms)).'
154 154
  */ ';
155 155
 	}
156 156
 
157
-	$code = '<' . "?php\n" . $code . join('', $boucles) . "\n";
157
+	$code = '<'."?php\n".$code.join('', $boucles)."\n";
158 158
 	if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) {
159 159
 		ecrire_fichier($phpfile, $code);
160 160
 	}
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 			$j = join('-', array_map('ucwords', explode('-', strtolower($r[2]))));
217 217
 
218 218
 			if ($j == 'X-Spip-Filtre' and isset($headers[$j])) {
219
-				$headers[$j] .= '|' . $r[3];
219
+				$headers[$j] .= '|'.$r[3];
220 220
 			} else {
221
-				$headers[$j] = str_replace(['\\\\',"\\'",'\\"'], ['\\',"'",'"'],$r[3]);
221
+				$headers[$j] = str_replace(['\\\\', "\\'", '\\"'], ['\\', "'", '"'], $r[3]);
222 222
 			}
223 223
 		}
224 224
 	}
225 225
 	// S'agit-il d'un resultat constant ou contenant du code php
226 226
 	$process_ins = (
227
-		strpos($corps, '<' . '?') === false
227
+		strpos($corps, '<'.'?') === false
228 228
 		or
229
-		(strpos($corps, '<' . '?xml') !== false and
230
-			strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false)
229
+		(strpos($corps, '<'.'?xml') !== false and
230
+			strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false)
231 231
 	)
232 232
 		? 'html'
233 233
 		: 'php';
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
 
257 257
 		if ($process_ins == 'html') {
258 258
 			$skel['process_ins'] = (
259
-				strpos($corps, '<' . '?') === false
259
+				strpos($corps, '<'.'?') === false
260 260
 				or
261
-				(strpos($corps, '<' . '?xml') !== false and
262
-					strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false)
261
+				(strpos($corps, '<'.'?xml') !== false and
262
+					strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false)
263 263
 			)
264 264
 				? 'html'
265 265
 				: 'php';
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 //
278 278
 
279 279
 /** Code PHP pour inclure une balise dynamique à l'exécution d'une page */
280
-define('CODE_INCLURE_BALISE', '<' . '?php
280
+define('CODE_INCLURE_BALISE', '<'.'?php
281 281
 include_once("%s");
282 282
 if ($lang_select = "%s") $lang_select = lang_select($lang_select);
283 283
 inserer_balise_dynamique(balise_%s_dyn(%s), array(%s));
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		// pas de lien symbolique sous Windows
309 309
 		and !(stristr(PHP_OS, 'WIN') and strpos($file, ':') !== false)
310 310
 	) {
311
-		$file = './" . _DIR_RACINE . "' . $file;
311
+		$file = './" . _DIR_RACINE . "'.$file;
312 312
 	}
313 313
 
314 314
 	$lang = $context_compil[4];
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
 	$args = array_map('argumenter_squelette', $args);
320 320
 	if (!empty($context_compil['appel_php_depuis_modele'])) {
321
-		$args[0] = 'arguments_balise_dyn_depuis_modele(' . $args[0] . ')';
321
+		$args[0] = 'arguments_balise_dyn_depuis_modele('.$args[0].')';
322 322
 	}
323 323
 	$args = join(', ', $args);
324 324
 
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 	if (is_object($v)) {
353 353
 		return var_export($v, true);
354 354
 	} elseif (!is_array($v)) {
355
-		return "'" . texte_script((string) $v) . "'";
355
+		return "'".texte_script((string) $v)."'";
356 356
 	} else {
357 357
 		$out = [];
358 358
 		foreach ($v as $k => $val) {
359
-			$out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val);
359
+			$out [] = argumenter_squelette($k).'=>'.argumenter_squelette($val);
360 360
 		}
361 361
 
362
-		return 'array(' . join(', ', $out) . ')';
362
+		return 'array('.join(', ', $out).')';
363 363
 	}
364 364
 }
365 365
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	}
438 438
 
439 439
 	// Y a-t-il une fonction de traitement des arguments ?
440
-	$f = 'balise_' . $nom_balise . '_stat';
440
+	$f = 'balise_'.$nom_balise.'_stat';
441 441
 
442 442
 	$r = !function_exists($f) ? $args : $f($args, $context_compil);
443 443
 
@@ -447,18 +447,18 @@  discard block
 block discarded – undo
447 447
 
448 448
 	// verifier que la fonction dyn est la,
449 449
 	// sinon se replier sur la generique si elle existe
450
-	if (!function_exists('balise_' . $nom_balise . '_dyn')) {
450
+	if (!function_exists('balise_'.$nom_balise.'_dyn')) {
451 451
 		if (
452 452
 			$balise_generique = chercher_balise_generique($nom)
453 453
 			and $nom_balise_generique = $balise_generique['nom_generique']
454
-			and $file = include_spip('balise/' . strtolower($nom_balise_generique))
455
-			and function_exists('balise_' . $nom_balise_generique . '_dyn')
454
+			and $file = include_spip('balise/'.strtolower($nom_balise_generique))
455
+			and function_exists('balise_'.$nom_balise_generique.'_dyn')
456 456
 		) {
457 457
 			// et lui injecter en premier arg le nom de la balise
458 458
 			array_unshift($r, $nom);
459 459
 			$nom_balise = $nom_balise_generique;
460 460
 			if (!_DIR_RESTREINT) {
461
-				$file = _DIR_RESTREINT_ABS . $file;
461
+				$file = _DIR_RESTREINT_ABS.$file;
462 462
 			}
463 463
 		} else {
464 464
 			$msg = ['zbug_balise_inexistante', ['from' => 'CVT', 'balise' => $nom]];
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		$n = '';
560 560
 		foreach (explode(',', $liste) as $val) {
561 561
 			if ($a = intval($val) and $val === strval($a)) {
562
-				$n .= ',' . $val;
562
+				$n .= ','.$val;
563 563
 			}
564 564
 		}
565 565
 		if (strlen($n)) {
@@ -738,8 +738,8 @@  discard block
 block discarded – undo
738 738
 			// on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction
739 739
 			$i = 0;
740 740
 			do {
741
-				$where[$k] = remplace_sous_requete($w, '(' . calculer_select(
742
-					[$sous[1] . ' AS id'],
741
+				$where[$k] = remplace_sous_requete($w, '('.calculer_select(
742
+					[$sous[1].' AS id'],
743 743
 					$from,
744 744
 					$from_type,
745 745
 					$wheresub,
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 					$id,
753 753
 					$serveur,
754 754
 					false
755
-				) . ')');
755
+				).')');
756 756
 				if (!$i) {
757 757
 					$i = 1;
758 758
 					$wherestring = calculer_where_to_string($where[$k]);
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 		if ($sous[0] == 'SUBSELECT') {
773 773
 			// c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having)
774 774
 			array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ?
775
-			$where[$k] = remplace_sous_requete($w, '(' . calculer_select(
775
+			$where[$k] = remplace_sous_requete($w, '('.calculer_select(
776 776
 				$sous[1], # select
777 777
 				$sous[2], #from
778 778
 				[], #from_type
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 				$id,
788 788
 				$serveur,
789 789
 				false
790
-			) . ')');
790
+			).')');
791 791
 		}
792 792
 		array_pop($where_simples);
793 793
 	}
@@ -850,15 +850,15 @@  discard block
 block discarded – undo
850 850
 			// sans recours a preg_match
851 851
 			// un implode(' ',..) est fait dans reinjecte_joint un peu plus bas
852 852
 			$afrom[$t][$cle] = [
853
-				"\n" .
854
-				($from_type[$cle] ?? 'INNER') . ' JOIN',
853
+				"\n".
854
+				($from_type[$cle] ?? 'INNER').' JOIN',
855 855
 				$from[$cle],
856 856
 				"AS $cle",
857 857
 				'ON (',
858 858
 				"$cle.$c",
859 859
 				'=',
860 860
 				"$t.$carr",
861
-				($and ? 'AND ' . $and : '') .
861
+				($and ? 'AND '.$and : '').
862 862
 				')'
863 863
 			];
864 864
 			if (isset($afrom[$cle])) {
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 		$t = key($from);
897 897
 		$c = current($from);
898 898
 		reset($from);
899
-		$e = '/\b(' . "$t\\." . join('|' . $t . '\.', $equiv) . ')\b/';
899
+		$e = '/\b('."$t\\.".join('|'.$t.'\.', $equiv).')\b/';
900 900
 		if (
901 901
 			!(strpos($t, ' ') or // jointure des le depart cf boucle_doc
902 902
 				calculer_jointnul($t, $select, $e) or
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 			unset($afrom[$t][$nt]);
915 915
 			$afrom[$nt] = $afrom[$t];
916 916
 			unset($afrom[$t]);
917
-			$e = '/\b' . preg_quote($nfrom[6]) . '\b/';
917
+			$e = '/\b'.preg_quote($nfrom[6]).'\b/';
918 918
 			$t = $nfrom[4];
919 919
 			$alias = '';
920 920
 			// verifier que les deux cles sont homonymes, sinon installer un alias dans le select
@@ -925,14 +925,14 @@  discard block
 block discarded – undo
925 925
 			if ($newcle != $oldcle) {
926 926
 				// si l'ancienne cle etait deja dans le select avec un AS
927 927
 				// reprendre simplement ce AS
928
-				$as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/';
928
+				$as = '/\b'.preg_quote($nfrom[6]).'\s+(AS\s+\w+)\b/';
929 929
 				if (preg_match($as, implode(',', $select), $m)) {
930 930
 					$alias = '';
931 931
 				} else {
932
-					$alias = ', ' . $nfrom[4] . " AS $oldcle";
932
+					$alias = ', '.$nfrom[4]." AS $oldcle";
933 933
 				}
934 934
 			}
935
-			$select = remplacer_jointnul($t . $alias, $select, $e);
935
+			$select = remplacer_jointnul($t.$alias, $select, $e);
936 936
 			$join = remplacer_jointnul($t, $join, $e);
937 937
 			$where = remplacer_jointnul($t, $where, $e);
938 938
 			$having = remplacer_jointnul($t, $having, $e);
@@ -982,9 +982,9 @@  discard block
 block discarded – undo
982 982
 	} else {
983 983
 		$exp = '';
984 984
 		if (strtoupper($join) === 'AND') {
985
-			return $exp . join(" $join ", array_map('calculer_where_to_string', $v));
985
+			return $exp.join(" $join ", array_map('calculer_where_to_string', $v));
986 986
 		} else {
987
-			return $exp . join($join, $v);
987
+			return $exp.join($join, $v);
988 988
 		}
989 989
 	}
990 990
 }
@@ -1046,6 +1046,6 @@  discard block
 block discarded – undo
1046 1046
 	}
1047 1047
 
1048 1048
 	return $mime_type
1049
-	. (!$connect ? '' : preg_replace('/\W/', '_', $connect)) . '_'
1050
-	. md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : ''));
1049
+	. (!$connect ? '' : preg_replace('/\W/', '_', $connect)).'_'
1050
+	. md5($GLOBALS['spip_version_code'].' * '.$skel.(isset($GLOBALS['marqueur_skel']) ? '*'.$GLOBALS['marqueur_skel'] : ''));
1051 1051
 }
Please login to merge, or discard this patch.