Completed
Push — master ( 923621...1c404c )
by cam
08:12
created
ecrire/inc/plugin.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 /** l'adresse du repertoire de telechargement et de decompactage des plugins */
24 24
 if (!defined('_DIR_PLUGINS_AUTO')) {
25
-	define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS . 'auto/');
25
+	define('_DIR_PLUGINS_AUTO', _DIR_PLUGINS.'auto/');
26 26
 }
27 27
 
28 28
 #include_spip('inc/texte'); // ????? Appelle public/parametrer trop tot avant la reconstruction du chemin des plugins.
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 				if ($dir) {
371 371
 					$dir .= "/";
372 372
 				}
373
-				$dir .= "procure:" . $procure['nom'];
373
+				$dir .= "procure:".$procure['nom'];
374 374
 
375 375
 				$procure['etat'] = '?';
376 376
 				$procure['dir_type'] = $resume['dir_type'];
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 		$plug = $resume['dir'];
552 552
 		$k = $infos[$dir_type][$plug];
553 553
 
554
-		$plug = constant($dir_type) . $plug;
554
+		$plug = constant($dir_type).$plug;
555 555
 		if (!isset($msg[$p])) {
556 556
 			if (isset($resume['erreur']) and $resume['erreur']) {
557 557
 				$msg[$p] = array($resume['erreur']);
@@ -594,10 +594,10 @@  discard block
 block discarded – undo
594 594
 		$list = $raw ? array() : $GLOBALS['meta']['plugin_erreur_activation'];
595 595
 	} elseif (!$raw) {
596 596
 		foreach ($list as $plug => $msg) {
597
-			$list[$plug] = "<li>" . _T('plugin_impossible_activer', array('plugin' => $plug))
598
-				. "<ul><li>" . implode("</li><li>", $msg) . "</li></ul></li>";
597
+			$list[$plug] = "<li>"._T('plugin_impossible_activer', array('plugin' => $plug))
598
+				. "<ul><li>".implode("</li><li>", $msg)."</li></ul></li>";
599 599
 		}
600
-		$list = "<ul>" . join("\n", $list) . "</ul>";
600
+		$list = "<ul>".join("\n", $list)."</ul>";
601 601
 	}
602 602
 	if ($raz) {
603 603
 		effacer_meta('plugin_erreur_activation');
@@ -708,13 +708,13 @@  discard block
 block discarded – undo
708 708
 			if ($minimum_inclus and spip_version_compare($version, $minimum, '<')) {
709 709
 				return _T("plugin_${balise}_${type}", array(
710 710
 					'plugin' => $nom,
711
-					'version' => ' &ge; ' . $minimum
711
+					'version' => ' &ge; '.$minimum
712 712
 				));
713 713
 			}
714 714
 			if (!$minimum_inclus and spip_version_compare($version, $minimum, '<=')) {
715 715
 				return _T("plugin_${balise}_${type}", array(
716 716
 					'plugin' => $nom,
717
-					'version' => ' &gt; ' . $minimum
717
+					'version' => ' &gt; '.$minimum
718 718
 				));
719 719
 			}
720 720
 		}
@@ -723,13 +723,13 @@  discard block
 block discarded – undo
723 723
 			if ($maximum_inclus and spip_version_compare($version, $maximum, '>')) {
724 724
 				return _T("plugin_${balise}_${type}", array(
725 725
 					'plugin' => $nom,
726
-					'version' => ' &le; ' . $maximum
726
+					'version' => ' &le; '.$maximum
727 727
 				));
728 728
 			}
729 729
 			if (!$maximum_inclus and spip_version_compare($version, $maximum, '>=')) {
730 730
 				return _T("plugin_${balise}_plugin", array(
731 731
 					'plugin' => $nom,
732
-					'version' => ' &lt; ' . $maximum
732
+					'version' => ' &lt; '.$maximum
733 733
 				));
734 734
 			}
735 735
 		}
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 		include_spip('inc/charger_plugin');
749 749
 		$url = '<br />'	. bouton_telechargement_plugin($url, 'lib');
750 750
 	}*/
751
-	return _T('plugin_necessite_lib', array('lib' => $lib)) . " <a href='$url'>$url</a>";
751
+	return _T('plugin_necessite_lib', array('lib' => $lib))." <a href='$url'>$url</a>";
752 752
 }
753 753
 
754 754
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 	foreach ($plugin_valides as $p => $resume) {
848 848
 		// Les headers ne doivent pas indiquer les versions des extensions PHP, ni la version PHP
849 849
 		if (0 !== strpos($p, 'PHP:') and $p !== 'PHP') {
850
-			$header[] = $p . ($resume['version'] ? "(" . $resume['version'] . ")" : "");
850
+			$header[] = $p.($resume['version'] ? "(".$resume['version'].")" : "");
851 851
 		}
852 852
 		if ($resume['dir']) {
853 853
 			foreach ($infos[$resume['dir_type']][$resume['dir']]['lib'] as $l) {
@@ -871,10 +871,10 @@  discard block
 block discarded – undo
871 871
 	ecrire_meta('plugin_attente', serialize($liste));
872 872
 	$header = strtolower(implode(",", $header));
873 873
 	if (!isset($GLOBALS['spip_header_silencieux']) or !$GLOBALS['spip_header_silencieux']) {
874
-		ecrire_fichier(_DIR_VAR . "config.txt",
875
-			(defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : "Composed-By: SPIP") . ' ' . $GLOBALS['spip_version_affichee'] . " @ www.spip.net + " . $header);
874
+		ecrire_fichier(_DIR_VAR."config.txt",
875
+			(defined('_HEADER_COMPOSED_BY') ? _HEADER_COMPOSED_BY : "Composed-By: SPIP").' '.$GLOBALS['spip_version_affichee']." @ www.spip.net + ".$header);
876 876
 	} else {
877
-		@unlink(_DIR_VAR . "config.txt");
877
+		@unlink(_DIR_VAR."config.txt");
878 878
 	}
879 879
 	// generer charger_plugins_chemin.php
880 880
 	plugins_precompile_chemin($plugin_valides, $ordre);
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 			// definir le plugin, donc le path avant l'include du fichier options
926 926
 			// permet de faire des include_spip pour attraper un inc_ du plugin
927 927
 
928
-			$dir = $dir_type . ".'" . $plug . "/'";
928
+			$dir = $dir_type.".'".$plug."/'";
929 929
 
930 930
 			$prefix = strtoupper(preg_replace(',\W,', '_', $info['prefix']));
931 931
 			if (
@@ -945,13 +945,13 @@  discard block
 block discarded – undo
945 945
 							$dir = '';
946 946
 						}
947 947
 						if (strlen($dir)) {
948
-							$dir = rtrim($dir, '/') . '/';
948
+							$dir = rtrim($dir, '/').'/';
949 949
 						}
950 950
 						if (!isset($chemin['type']) or $chemin['type'] == 'public') {
951
-							$chemins['public'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : "");
951
+							$chemins['public'][] = "_DIR_PLUGIN_$prefix".(strlen($dir) ? ".'$dir'" : "");
952 952
 						}
953 953
 						if (!isset($chemin['type']) or $chemin['type'] == 'prive') {
954
-							$chemins['prive'][] = "_DIR_PLUGIN_$prefix" . (strlen($dir) ? ".'$dir'" : "");
954
+							$chemins['prive'][] = "_DIR_PLUGIN_$prefix".(strlen($dir) ? ".'$dir'" : "");
955 955
 						}
956 956
 					}
957 957
 				}
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
 		}
960 960
 	}
961 961
 	if (count($chemins)) {
962
-		$contenu .= "if (_DIR_RESTREINT) _chemin(implode(':',array(" . implode(',',
963
-				array_reverse($chemins['public'])) . ")));\n"
964
-			. "else _chemin(implode(':',array(" . implode(',', array_reverse($chemins['prive'])) . ")));\n";
962
+		$contenu .= "if (_DIR_RESTREINT) _chemin(implode(':',array(".implode(',',
963
+				array_reverse($chemins['public'])).")));\n"
964
+			. "else _chemin(implode(':',array(".implode(',', array_reverse($chemins['prive'])).")));\n";
965 965
 	}
966 966
 
967 967
 	ecrire_fichier_php(_CACHE_PLUGINS_PATH, $contenu);
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 					and strpos($dir, ":") === false // exclure le cas des procure:
1010 1010
 					and file_exists("$dir$plug/paquet.xml") // uniquement pour les paquet.xml
1011 1011
 				) {
1012
-					if (is_readable("$dir$plug/" . ($file = $info['prefix'] . "_" . $charge . ".php"))) {
1012
+					if (is_readable("$dir$plug/".($file = $info['prefix']."_".$charge.".php"))) {
1013 1013
 						$info[$charge] = array($file);
1014 1014
 					}
1015 1015
 				}
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 						) {
1026 1026
 							unset($info[$charge][$k]);
1027 1027
 						} else {
1028
-							$_file = $root_dir_type . ".'$plug/$file'";
1028
+							$_file = $root_dir_type.".'$plug/$file'";
1029 1029
 							$contenu[$charge] .= "include_once_check($_file);\n";
1030 1030
 						}
1031 1031
 					}
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 		}
1036 1036
 	}
1037 1037
 
1038
-	$contenu['options'] = "define('_PLUGINS_HASH','" . md5($sign) . "');\n" . $contenu['options'];
1038
+	$contenu['options'] = "define('_PLUGINS_HASH','".md5($sign)."');\n".$contenu['options'];
1039 1039
 	$contenu['fonctions'] .= plugin_ongletbouton("boutons_plugins", $boutons)
1040 1040
 		. plugin_ongletbouton("onglets_plugins", $onglets);
1041 1041
 
@@ -1070,12 +1070,12 @@  discard block
 block discarded – undo
1070 1070
 		define("_UPDATED_$nom", $val);
1071 1071
 		define("_UPDATED_md5_$nom", $md5);
1072 1072
 	}
1073
-	$val = "unserialize('" . str_replace("'", "\'", $val) . "')";
1073
+	$val = "unserialize('".str_replace("'", "\'", $val)."')";
1074 1074
 
1075 1075
 	return
1076 1076
 		"if (!function_exists('$nom')) {\n"
1077 1077
 		. "function $nom(){return defined('_UPDATED_$nom')?unserialize(_UPDATED_$nom):$val;}\n"
1078
-		. "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'" . $md5 . "';}\n"
1078
+		. "function md5_$nom(){return defined('_UPDATED_md5_$nom')?_UPDATED_md5_$nom:'".$md5."';}\n"
1079 1079
 		. "}\n";
1080 1080
 }
1081 1081
 
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 	if (@is_readable(_CACHE_PLUGINS_OPT)) {
1099 1099
 		include_once(_CACHE_PLUGINS_OPT);
1100 1100
 	} else {
1101
-		spip_log("pipelines desactives: impossible de produire " . _CACHE_PLUGINS_OPT);
1101
+		spip_log("pipelines desactives: impossible de produire "._CACHE_PLUGINS_OPT);
1102 1102
 	}
1103 1103
 }
1104 1104
 
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 			$dir_type = $plugin_valides[$p]['dir_type'];
1136 1136
 			$root_dir_type = str_replace('_DIR_', '_ROOT_', $dir_type);
1137 1137
 			$plug = $plugin_valides[$p]['dir'];
1138
-			$prefix = (($info['prefix'] == "spip") ? "" : $info['prefix'] . "_");
1138
+			$prefix = (($info['prefix'] == "spip") ? "" : $info['prefix']."_");
1139 1139
 			if (isset($info['pipeline']) and is_array($info['pipeline'])) {
1140 1140
 				foreach ($info['pipeline'] as $pipe) {
1141 1141
 					$nom = $pipe['nom'];
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 						}
1166 1166
 						if (isset($pipe['inclure'])) {
1167 1167
 							$GLOBALS['spip_matrice']["$prefix$action"] =
1168
-								"$root_dir_type:$plug/" . $pipe['inclure'];
1168
+								"$root_dir_type:$plug/".$pipe['inclure'];
1169 1169
 						}
1170 1170
 					}
1171 1171
 				}
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 					$prepend_code['taches_generales_cron'] = "";
1176 1176
 				}
1177 1177
 				foreach ($info['genie'] as $genie) {
1178
-					$nom = $prefix . $genie['nom'];
1178
+					$nom = $prefix.$genie['nom'];
1179 1179
 					$periode = max(60, intval($genie['periode']));
1180 1180
 					if (charger_fonction($nom, "genie", true)) {
1181 1181
 						$prepend_code['taches_generales_cron'] .= "\$val['$nom'] = $periode;\n";
@@ -1193,13 +1193,13 @@  discard block
 block discarded – undo
1193 1193
 				}
1194 1194
 				foreach ($info['style'] as $style) {
1195 1195
 					if (isset($style['path']) and $style['path']) {
1196
-						$code = "if (\$f=timestamp(direction_css(find_in_path('" . addslashes($style['path']) . "')))) ";
1196
+						$code = "if (\$f=timestamp(direction_css(find_in_path('".addslashes($style['path'])."')))) ";
1197 1197
 					} else {
1198
-						$code = "if (\$f='" . addslashes($style['url']) . "') ";
1198
+						$code = "if (\$f='".addslashes($style['url'])."') ";
1199 1199
 					}
1200 1200
 					$code .= "\$val .= '<link rel=\"stylesheet\" href=\"'.\$f.'\" type=\"text/css\"";
1201 1201
 					if (isset($style['media']) and strlen($style['media'])) {
1202
-						$code .= " media=\"" . addslashes($style['media']) . "\"";
1202
+						$code .= " media=\"".addslashes($style['media'])."\"";
1203 1203
 					}
1204 1204
 					$code .= "/>';\n";
1205 1205
 					if ($style['type'] != 'prive') {
@@ -1219,9 +1219,9 @@  discard block
 block discarded – undo
1219 1219
 			if (isset($info['script']) and count($info['script'])) {
1220 1220
 				foreach ($info['script'] as $script) {
1221 1221
 					if (isset($script['path']) and $script['path']) {
1222
-						$code = "if (\$f=timestamp(find_in_path('" . addslashes($script['path']) . "'))) ";
1222
+						$code = "if (\$f=timestamp(find_in_path('".addslashes($script['path'])."'))) ";
1223 1223
 					} else {
1224
-						$code = "if (\$f='" . addslashes($script['url']) . "') ";
1224
+						$code = "if (\$f='".addslashes($script['url'])."') ";
1225 1225
 					}
1226 1226
 					$code .= "\$val .= '<script src=\"'.\$f.'\" type=\"text/javascript\"></script>';\n";
1227 1227
 					if ($script['type'] != 'prive') {
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		// Eclater le pipeline en filtres et appliquer chaque filtre
1287 1287
 		foreach ($pipe as $fonc) {
1288 1288
 			$fonc = trim($fonc);
1289
-			$s_call .= '$val = minipipe(\'' . $fonc . '\', $val);' . "\n";
1289
+			$s_call .= '$val = minipipe(\''.$fonc.'\', $val);'."\n";
1290 1290
 			if (isset($GLOBALS['spip_matrice'][$fonc])) {
1291 1291
 				$file = $GLOBALS['spip_matrice'][$fonc];
1292 1292
 				$file = "'$file'";
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 					if (defined($root_dir)) {
1298 1298
 						$dir = $root_dir;
1299 1299
 					}
1300
-					$file = str_replace($regs[0], "'." . $dir . ".'", $file);
1300
+					$file = str_replace($regs[0], "'.".$dir.".'", $file);
1301 1301
 					$file = str_replace("''.", "", $file);
1302 1302
 					$file = str_replace(constant($dir), '', $file);
1303 1303
 				}
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		$content .= "// Pipeline $action \n"
1311 1311
 			. "function execute_pipeline_$action(&\$val){\n"
1312 1312
 			. $s_inc
1313
-			. ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action]) . "\n" : '')
1313
+			. ((isset($prepend_code[$action]) and strlen($prepend_code[$action])) ? trim($prepend_code[$action])."\n" : '')
1314 1314
 			. $s_call
1315 1315
 			. "return \$val;\n}\n";
1316 1316
 	}
@@ -1394,18 +1394,18 @@  discard block
 block discarded – undo
1394 1394
 		$GLOBALS['fichier_php_compile_recent'] = 0;
1395 1395
 	}
1396 1396
 
1397
-	$contenu = '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>';
1397
+	$contenu = '<'.'?php'."\n".$comment."\nif (defined('_ECRIRE_INC_VERSION')) {\n".$contenu."}\n?".'>';
1398 1398
 	// si un fichier existe deja on verifie que son contenu change avant de l'ecraser
1399 1399
 	// si pas de modif on ne touche pas au fichier initial
1400 1400
 	if (file_exists($nom)) {
1401 1401
 		if (substr($nom, -4) == '.php') {
1402
-			$fichier_tmp = substr($nom, 0, -4) . '.tmp.php';
1402
+			$fichier_tmp = substr($nom, 0, -4).'.tmp.php';
1403 1403
 		}
1404 1404
 		else {
1405
-			$fichier_tmp = $nom . '.tmp';
1405
+			$fichier_tmp = $nom.'.tmp';
1406 1406
 		}
1407 1407
 		file_put_contents($fichier_tmp, $contenu);
1408
-		if(md5_file($nom) == md5_file($fichier_tmp)) {
1408
+		if (md5_file($nom) == md5_file($fichier_tmp)) {
1409 1409
 			$GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
1410 1410
 			@unlink($fichier_tmp);
1411 1411
 			return;
Please login to merge, or discard this patch.