Completed
Pull Request — master (#36)
by
unknown
06:08
created
ecrire/public/composer.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$GLOBALS['debug_objets']['courant'] = $nom;
54 54
 	}
55 55
 
56
-	$phpfile = sous_repertoire(_DIR_SKELS, '', false, true) . $nom . '.php';
56
+	$phpfile = sous_repertoire(_DIR_SKELS, '', false, true).$nom.'.php';
57 57
 
58 58
 	// si squelette est deja compile et perenne, le charger
59 59
 	if (!squelette_obsolete($phpfile, $source)) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		#}
67 67
 	}
68 68
 
69
-	if (file_exists($lib = $squelette . '_fonctions' . '.php')) {
69
+	if (file_exists($lib = $squelette.'_fonctions'.'.php')) {
70 70
 		include_once $lib;
71 71
 	}
72 72
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		$skel_code = $compiler($skel, $nom, $gram, $source, $connect);
83 83
 	}
84 84
 	else
85
-		$skel_code='';
85
+		$skel_code = '';
86 86
 
87 87
 	// Ne plus rien faire si le compilateur n'a pas pu operer.
88 88
 	if (!$skel_code) {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	if (defined('_VAR_MODE') and _VAR_MODE == 'debug') {
122 122
 
123 123
 		// Tracer ce qui vient d'etre compile
124
-		$GLOBALS['debug_objets']['code'][$nom . 'tout'] = $code;
124
+		$GLOBALS['debug_objets']['code'][$nom.'tout'] = $code;
125 125
 
126 126
 		// si c'est ce que demande le debusqueur, lui passer la main
127 127
 		if ($GLOBALS['debug_objets']['sourcefile']
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 		$code = "
144 144
 /*
145 145
  * Squelette : $sourcefile
146
- * Date :      " . gmdate("D, d M Y H:i:s", @filemtime($sourcefile)) . " GMT
147
- * Compile :   " . gmdate("D, d M Y H:i:s", time()) . " GMT
148
- * " . (!$boucles ? "Pas de boucle" : ("Boucles :   " . $noms)) . "
146
+ * Date :      ".gmdate("D, d M Y H:i:s", @filemtime($sourcefile))." GMT
147
+ * Compile :   " . gmdate("D, d M Y H:i:s", time())." GMT
148
+ * " . (!$boucles ? "Pas de boucle" : ("Boucles :   ".$noms))."
149 149
  */ ";
150 150
 	}
151 151
 
152
-	$code = '<' . "?php\n" . $code . join('', $boucles) . "\n?" . '>';
152
+	$code = '<'."?php\n".$code.join('', $boucles)."\n?".'>';
153 153
 	if (!defined('_VAR_NOCACHE') or !_VAR_NOCACHE) {
154 154
 		ecrire_fichier($phpfile, $code);
155 155
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			$j = join('-', array_map('ucwords', explode('-', strtolower($r[2]))));
210 210
 
211 211
 			if ($j == 'X-Spip-Filtre' and isset($headers[$j])) {
212
-				$headers[$j] .= "|" . $r[3];
212
+				$headers[$j] .= "|".$r[3];
213 213
 			} else {
214 214
 				$headers[$j] = $r[3];
215 215
 			}
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 	// S'agit-il d'un resultat constant ou contenant du code php
219 219
 	$process_ins = (
220
-		strpos($corps, '<' . '?') === false
220
+		strpos($corps, '<'.'?') === false
221 221
 		or
222
-		(strpos($corps, '<' . '?xml') !== false and
223
-			strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false)
222
+		(strpos($corps, '<'.'?xml') !== false and
223
+			strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false)
224 224
 	)
225 225
 		? 'html'
226 226
 		: 'php';
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 
247 247
 		if ($process_ins == 'html') {
248 248
 			$skel['process_ins'] = (
249
-				strpos($corps, '<' . '?') === false
249
+				strpos($corps, '<'.'?') === false
250 250
 				or
251
-				(strpos($corps, '<' . '?xml') !== false and
252
-					strpos(str_replace('<' . '?xml', '', $corps), '<' . '?') === false)
251
+				(strpos($corps, '<'.'?xml') !== false and
252
+					strpos(str_replace('<'.'?xml', '', $corps), '<'.'?') === false)
253 253
 			)
254 254
 				? 'html'
255 255
 				: 'php';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	if (strlen($intro)) {
328 328
 		$texte = $intro;
329 329
 	} else {
330
-		if (strpos("\n" . $texte, "\n|") === false
330
+		if (strpos("\n".$texte, "\n|") === false
331 331
 			and strlen($texte) > 2.5 * $longueur
332 332
 		) {
333 333
 			if (strpos($texte, "<multi") !== false) {
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 //
373 373
 
374 374
 /** Code PHP pour inclure une balise dynamique à l'exécution d'une page */
375
-define('CODE_INCLURE_BALISE', '<' . '?php 
375
+define('CODE_INCLURE_BALISE', '<'.'?php 
376 376
 include_once("%s");
377 377
 if ($lang_select = "%s") $lang_select = lang_select($lang_select);
378 378
 inserer_balise_dynamique(balise_%s_dyn(%s), array(%s));
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  **/
400 400
 function synthetiser_balise_dynamique($nom, $args, $file, $context_compil) {
401 401
 	if (strncmp($file, "/", 1) !== 0) {
402
-		$file = './" . _DIR_RACINE . "' . $file;
402
+		$file = './" . _DIR_RACINE . "'.$file;
403 403
 	}
404 404
 	$r = sprintf(CODE_INCLURE_BALISE,
405 405
 		$file,
@@ -427,14 +427,14 @@  discard block
 block discarded – undo
427 427
 function argumenter_squelette($v) {
428 428
 
429 429
 	if (!is_array($v)) {
430
-		return "'" . texte_script($v) . "'";
430
+		return "'".texte_script($v)."'";
431 431
 	} else {
432 432
 		$out = array();
433 433
 		foreach ($v as $k => $val) {
434
-			$out [] = argumenter_squelette($k) . '=>' . argumenter_squelette($val);
434
+			$out [] = argumenter_squelette($k).'=>'.argumenter_squelette($val);
435 435
 		}
436 436
 
437
-		return 'array(' . join(", ", $out) . ')';
437
+		return 'array('.join(", ", $out).')';
438 438
 	}
439 439
 }
440 440
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	}
500 500
 
501 501
 	// Y a-t-il une fonction de traitement des arguments ?
502
-	$f = 'balise_' . $nomfonction . '_stat';
502
+	$f = 'balise_'.$nomfonction.'_stat';
503 503
 
504 504
 	$r = !function_exists($f) ? $args : $f($args, $context_compil);
505 505
 
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
 
510 510
 	// verifier que la fonction dyn est la, 
511 511
 	// sinon se replier sur la generique si elle existe
512
-	if (!function_exists('balise_' . $nomfonction . '_dyn')) {
512
+	if (!function_exists('balise_'.$nomfonction.'_dyn')) {
513 513
 		if ($nomfonction_generique
514
-			and $file = include_spip("balise/" . strtolower($nomfonction_generique))
515
-			and function_exists('balise_' . $nomfonction_generique . '_dyn')
514
+			and $file = include_spip("balise/".strtolower($nomfonction_generique))
515
+			and function_exists('balise_'.$nomfonction_generique.'_dyn')
516 516
 		) {
517 517
 			// et lui injecter en premier arg le nom de la balise 
518 518
 			array_unshift($r, $nom);
519 519
 			$nomfonction = $nomfonction_generique;
520 520
 			if (!_DIR_RESTREINT) {
521
-				$file = _DIR_RESTREINT_ABS . $file;
521
+				$file = _DIR_RESTREINT_ABS.$file;
522 522
 			}
523 523
 		} else {
524 524
 			$msg = array('zbug_balise_inexistante', array('from' => 'CVT', 'balise' => $nom));
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 		$n = '';
640 640
 		foreach (explode(',', $liste) as $val) {
641 641
 			if ($a = intval($val) and $val === strval($a)) {
642
-				$n .= ',' . $val;
642
+				$n .= ','.$val;
643 643
 			}
644 644
 		}
645 645
 		if (strlen($n)) {
@@ -818,14 +818,14 @@  discard block
 block discarded – undo
818 818
 			// on construit le where une fois, puis on ajoute les where complentaires si besoin, et on reconstruit le where en fonction
819 819
 			$i = 0;
820 820
 			do {
821
-				$where[$k] = remplace_sous_requete($w, "(" . calculer_select(
822
-						array($sous[1] . " AS id"),
821
+				$where[$k] = remplace_sous_requete($w, "(".calculer_select(
822
+						array($sous[1]." AS id"),
823 823
 						$from,
824 824
 						$from_type,
825 825
 						$wheresub,
826 826
 						$jsub,
827 827
 						array(), array(), '',
828
-						$having, $table, $id, $serveur, false) . ")");
828
+						$having, $table, $id, $serveur, false).")");
829 829
 				if (!$i) {
830 830
 					$i = 1;
831 831
 					$wherestring = calculer_where_to_string($where[$k]);
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 		if ($sous[0] == 'SUBSELECT') {
845 845
 			// c'est une sous requete explicite sous la forme identique a sql_select : (SUBSELECT,$select,$from,$where,$groupby,$orderby,$limit,$having)
846 846
 			array_push($where_simples, $sous[3]); // est-ce utile dans ce cas ?
847
-			$where[$k] = remplace_sous_requete($w, "(" . calculer_select(
847
+			$where[$k] = remplace_sous_requete($w, "(".calculer_select(
848 848
 					$sous[1], # select
849 849
 					$sous[2], #from
850 850
 					array(), #from_type
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 					$sous[6], #limit
857 857
 					$sous[7] ? $sous[7] : array(), #having
858 858
 					$table, $id, $serveur, false
859
-				) . ")");
859
+				).")");
860 860
 		}
861 861
 		array_pop($where_simples);
862 862
 	}
@@ -917,15 +917,15 @@  discard block
 block discarded – undo
917 917
 			// sans recours a preg_match
918 918
 			// un implode(' ',..) est fait dans reinjecte_joint un peu plus bas
919 919
 			$afrom[$t][$cle] = array(
920
-				"\n" .
921
-				(isset($from_type[$cle]) ? $from_type[$cle] : "INNER") . " JOIN",
920
+				"\n".
921
+				(isset($from_type[$cle]) ? $from_type[$cle] : "INNER")." JOIN",
922 922
 				$from[$cle],
923 923
 				"AS $cle",
924 924
 				"ON (",
925 925
 				"$cle.$c",
926 926
 				"=",
927 927
 				"$t.$carr",
928
-				($and ? "AND " . $and : "") .
928
+				($and ? "AND ".$and : "").
929 929
 				")"
930 930
 			);
931 931
 			if (isset($afrom[$cle])) {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 		$t = key($from);
960 960
 		$c = current($from);
961 961
 		reset($from);
962
-		$e = '/\b(' . "$t\\." . join("|" . $t . '\.', $equiv) . ')\b/';
962
+		$e = '/\b('."$t\\.".join("|".$t.'\.', $equiv).')\b/';
963 963
 		if (!(strpos($t, ' ') or // jointure des le depart cf boucle_doc
964 964
 				calculer_jointnul($t, $select, $e) or
965 965
 				calculer_jointnul($t, $join, $e) or
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 			unset($afrom[$t][$nt]);
977 977
 			$afrom[$nt] = $afrom[$t];
978 978
 			unset($afrom[$t]);
979
-			$e = '/\b' . preg_quote($nfrom[6]) . '\b/';
979
+			$e = '/\b'.preg_quote($nfrom[6]).'\b/';
980 980
 			$t = $nfrom[4];
981 981
 			$alias = "";
982 982
 			// verifier que les deux cles sont homonymes, sinon installer un alias dans le select
@@ -987,14 +987,14 @@  discard block
 block discarded – undo
987 987
 			if ($newcle != $oldcle) {
988 988
 				// si l'ancienne cle etait deja dans le select avec un AS
989 989
 				// reprendre simplement ce AS
990
-				$as = '/\b' . preg_quote($nfrom[6]) . '\s+(AS\s+\w+)\b/';
990
+				$as = '/\b'.preg_quote($nfrom[6]).'\s+(AS\s+\w+)\b/';
991 991
 				if (preg_match($as, implode(',', $select), $m)) {
992 992
 					$alias = "";
993 993
 				} else {
994
-					$alias = ", " . $nfrom[4] . " AS $oldcle";
994
+					$alias = ", ".$nfrom[4]." AS $oldcle";
995 995
 				}
996 996
 			}
997
-			$select = remplacer_jointnul($t . $alias, $select, $e);
997
+			$select = remplacer_jointnul($t.$alias, $select, $e);
998 998
 			$join = remplacer_jointnul($t, $join, $e);
999 999
 			$where = remplacer_jointnul($t, $where, $e);
1000 1000
 			$having = remplacer_jointnul($t, $having, $e);
@@ -1028,9 +1028,9 @@  discard block
 block discarded – undo
1028 1028
 	} else {
1029 1029
 		$exp = "";
1030 1030
 		if (strtoupper($join) === 'AND') {
1031
-			return $exp . join(" $join ", array_map('calculer_where_to_string', $v));
1031
+			return $exp.join(" $join ", array_map('calculer_where_to_string', $v));
1032 1032
 		} else {
1033
-			return $exp . join($join, $v);
1033
+			return $exp.join($join, $v);
1034 1034
 		}
1035 1035
 	}
1036 1036
 }
@@ -1096,6 +1096,6 @@  discard block
 block discarded – undo
1096 1096
 	}
1097 1097
 
1098 1098
 	return $mime_type
1099
-	. (!$connect ? '' : preg_replace('/\W/', "_", $connect)) . '_'
1100
-	. md5($GLOBALS['spip_version_code'] . ' * ' . $skel . (isset($GLOBALS['marqueur_skel']) ? '*' . $GLOBALS['marqueur_skel'] : ''));
1099
+	. (!$connect ? '' : preg_replace('/\W/', "_", $connect)).'_'
1100
+	. md5($GLOBALS['spip_version_code'].' * '.$skel.(isset($GLOBALS['marqueur_skel']) ? '*'.$GLOBALS['marqueur_skel'] : ''));
1101 1101
 }
Please login to merge, or discard this patch.