Completed
Push — master ( 48c029...69f484 )
by cam
06:06 queued 11s
created
ecrire/inc/pipelines_ecrire.php 1 patch
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Pipelines
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -36,35 +36,35 @@  discard block
 block discarded – undo
36 36
  * @return string          Contenu complété des scripts javascripts, dont jQuery
37 37
  **/
38 38
 function f_jQuery_prive($texte) {
39
-	$x = '';
40
-	$jquery_plugins = pipeline('jquery_plugins',
41
-		array(
42
-			'prive/javascript/jquery.js',
43
-			'prive/javascript/jquery-migrate-3.2.0.js',
44
-			'prive/javascript/jquery.form.js',
45
-			'prive/javascript/jquery.autosave.js',
46
-			'prive/javascript/jquery.placeholder-label.js',
47
-			'prive/javascript/ajaxCallback.js',
48
-			'prive/javascript/js.cookie.js',
49
-			'prive/javascript/jquery.cookie.js',
50
-			'prive/javascript/spip_barre.js',
51
-		));
52
-	foreach (array_unique($jquery_plugins) as $script) {
53
-		if ($script = find_in_path(supprimer_timestamp($script))) {
54
-			$script = timestamp($script);
55
-			$x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n";
56
-		}
57
-	}
58
-	// inserer avant le premier script externe ou a la fin
59
-	if (preg_match(",<script[^><]*src=,", $texte, $match)
60
-		and $p = strpos($texte, $match[0])
61
-	) {
62
-		$texte = substr_replace($texte, $x, $p, 0);
63
-	} else {
64
-		$texte .= $x;
65
-	}
39
+    $x = '';
40
+    $jquery_plugins = pipeline('jquery_plugins',
41
+        array(
42
+            'prive/javascript/jquery.js',
43
+            'prive/javascript/jquery-migrate-3.2.0.js',
44
+            'prive/javascript/jquery.form.js',
45
+            'prive/javascript/jquery.autosave.js',
46
+            'prive/javascript/jquery.placeholder-label.js',
47
+            'prive/javascript/ajaxCallback.js',
48
+            'prive/javascript/js.cookie.js',
49
+            'prive/javascript/jquery.cookie.js',
50
+            'prive/javascript/spip_barre.js',
51
+        ));
52
+    foreach (array_unique($jquery_plugins) as $script) {
53
+        if ($script = find_in_path(supprimer_timestamp($script))) {
54
+            $script = timestamp($script);
55
+            $x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n";
56
+        }
57
+    }
58
+    // inserer avant le premier script externe ou a la fin
59
+    if (preg_match(",<script[^><]*src=,", $texte, $match)
60
+        and $p = strpos($texte, $match[0])
61
+    ) {
62
+        $texte = substr_replace($texte, $x, $p, 0);
63
+    } else {
64
+        $texte .= $x;
65
+    }
66 66
 
67
-	return $texte;
67
+    return $texte;
68 68
 }
69 69
 
70 70
 
@@ -77,42 +77,42 @@  discard block
 block discarded – undo
77 77
  * @return string
78 78
  */
79 79
 function affichage_final_prive_title_auto($texte) {
80
-	if (strpos($texte, '<title>') === false
81
-		and
82
-		(preg_match(",<h1[^>]*>(.+)</h1>,Uims", $texte, $match)
83
-			or preg_match(",<h[23][^>]*>(.+)</h[23]>,Uims", $texte, $match))
84
-		and $match = textebrut(trim($match[1]))
85
-		and ($p = strpos($texte, '<head>')) !== false
86
-	) {
87
-		if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) {
88
-			$nom_site_spip = _T('info_mon_site_spip');
89
-		}
80
+    if (strpos($texte, '<title>') === false
81
+        and
82
+        (preg_match(",<h1[^>]*>(.+)</h1>,Uims", $texte, $match)
83
+            or preg_match(",<h[23][^>]*>(.+)</h[23]>,Uims", $texte, $match))
84
+        and $match = textebrut(trim($match[1]))
85
+        and ($p = strpos($texte, '<head>')) !== false
86
+    ) {
87
+        if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']["nom_site"]))) {
88
+            $nom_site_spip = _T('info_mon_site_spip');
89
+        }
90 90
 
91
-		$titre = "<title>["
92
-			. $nom_site_spip
93
-			. "] " . $match
94
-			. "</title>";
91
+        $titre = "<title>["
92
+            . $nom_site_spip
93
+            . "] " . $match
94
+            . "</title>";
95 95
 
96
-		$texte = substr_replace($texte, $titre, $p + 6, 0);
97
-	}
96
+        $texte = substr_replace($texte, $titre, $p + 6, 0);
97
+    }
98 98
 
99
-	return $texte;
99
+    return $texte;
100 100
 }
101 101
 
102 102
 
103 103
 // Fonction standard pour le pipeline 'boite_infos'
104 104
 // http://code.spip.net/@f_boite_infos
105 105
 function f_boite_infos($flux) {
106
-	$args = $flux['args'];
107
-	$type = $args['type'];
108
-	unset($args['row']);
109
-	if (!trouver_fond($type, "prive/objets/infos/")) {
110
-		$type = 'objet';
111
-	}
112
-	$args['espace_prive'] = 1;
113
-	$flux['data'] .= recuperer_fond("prive/objets/infos/$type", $args);
106
+    $args = $flux['args'];
107
+    $type = $args['type'];
108
+    unset($args['row']);
109
+    if (!trouver_fond($type, "prive/objets/infos/")) {
110
+        $type = 'objet';
111
+    }
112
+    $args['espace_prive'] = 1;
113
+    $flux['data'] .= recuperer_fond("prive/objets/infos/$type", $args);
114 114
 
115
-	return $flux;
115
+    return $flux;
116 116
 }
117 117
 
118 118
 
@@ -131,73 +131,73 @@  discard block
 block discarded – undo
131 131
  * @return array Données du pipeline
132 132
  */
133 133
 function f_afficher_blocs_ecrire($flux) {
134
-	static $o = array();
135
-	if (is_string($fond = $flux['args']['fond'])) {
136
-		$exec = isset($flux['args']['contexte']['exec']) ? $flux['args']['contexte']['exec'] : _request('exec');
137
-		if (!isset($o[$exec])) {
138
-			$o[$exec] = trouver_objet_exec($exec);
139
-		}
140
-		// cas particulier
141
-		if ($exec == "infos_perso") {
142
-			$flux['args']['contexte']['id_auteur'] = $GLOBALS['visiteur_session']['id_auteur'];
143
-		}
144
-		$typepage = (isset($flux['args']['contexte']['type-page']) ? $flux['args']['contexte']['type-page'] : $exec);
145
-		if ($fond == "prive/squelettes/navigation/$typepage") {
146
-			$flux['data']['texte'] = pipeline('affiche_gauche',
147
-				array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
148
-		} elseif ($fond == "prive/squelettes/extra/$typepage") {
149
-			include_spip('inc/presentation_mini');
150
-			$flux['data']['texte'] = pipeline('affiche_droite',
151
-					array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte'])) . liste_objets_bloques($exec,
152
-					$flux['args']['contexte']);
153
-		} elseif ($fond == "prive/squelettes/hierarchie/$typepage" and $o[$exec]) {
154
-			// id non defini sur les formulaire de nouveaux objets
155
-			$id = isset($flux['args']['contexte'][$o[$exec]['id_table_objet']]) ? intval($flux['args']['contexte'][$o[$exec]['id_table_objet']]) : 0;
156
-			$flux['data']['texte'] = pipeline('affiche_hierarchie',
157
-				array('args' => array('objet' => $o[$exec]['type'], 'id_objet' => $id), 'data' => $flux['data']['texte']));
158
-		} elseif ($fond == "prive/squelettes/contenu/$typepage") {
159
-			if (!strpos($flux['data']['texte'], "<!--affiche_milieu-->")) {
160
-				$flux['data']['texte'] = preg_replace(',<div id=["\']wysiwyg,', "<!--affiche_milieu-->\\0",
161
-					$flux['data']['texte']);
162
-			}
163
-			if ($o[$exec]
164
-				and $objet = $o[$exec]['type']
165
-				and $o[$exec]['edition'] == false
166
-				and isset($flux['args']['contexte'][$o[$exec]['id_table_objet']])
167
-				and $id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']])
168
-			) {
169
-				// inserer le formulaire de traduction
170
-				$flux['data']['texte'] = str_replace("<!--affiche_milieu-->", recuperer_fond('prive/objets/editer/traductions',
171
-						array('objet' => $objet, 'id_objet' => $id, 'espace_prive' => 1)) . "<!--affiche_milieu-->", $flux['data']['texte']);
172
-				$flux['data']['texte'] = pipeline('afficher_fiche_objet', array(
173
-					'args' => array(
174
-						'contexte' => $flux['args']['contexte'],
175
-						'type' => $objet,
176
-						'id' => $id
177
-					),
178
-					'data' => $flux['data']['texte']
179
-				));
180
-			}
181
-			$flux['data']['texte'] = pipeline('affiche_milieu',
182
-				array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
183
-		} elseif ($fond == "prive/squelettes/inclure/pied") {
184
-			$flux['data']['texte'] = pipeline('affiche_pied',
185
-				array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
186
-		} elseif (strncmp($fond, "prive/objets/contenu/", 21) == 0
187
-			and $objet = basename($fond)
188
-			and $objet == substr($fond, 21)
189
-			and isset($o[$objet])
190
-			and $o[$objet]
191
-		) {
192
-			$id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']]);
193
-			$flux['data']['texte'] = pipeline('afficher_contenu_objet', array(
194
-				'args' => array('type' => $objet, 'id_objet' => $id, 'contexte' => $flux['args']['contexte']),
195
-				'data' => $flux['data']['texte']
196
-			));
197
-		}
198
-	}
134
+    static $o = array();
135
+    if (is_string($fond = $flux['args']['fond'])) {
136
+        $exec = isset($flux['args']['contexte']['exec']) ? $flux['args']['contexte']['exec'] : _request('exec');
137
+        if (!isset($o[$exec])) {
138
+            $o[$exec] = trouver_objet_exec($exec);
139
+        }
140
+        // cas particulier
141
+        if ($exec == "infos_perso") {
142
+            $flux['args']['contexte']['id_auteur'] = $GLOBALS['visiteur_session']['id_auteur'];
143
+        }
144
+        $typepage = (isset($flux['args']['contexte']['type-page']) ? $flux['args']['contexte']['type-page'] : $exec);
145
+        if ($fond == "prive/squelettes/navigation/$typepage") {
146
+            $flux['data']['texte'] = pipeline('affiche_gauche',
147
+                array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
148
+        } elseif ($fond == "prive/squelettes/extra/$typepage") {
149
+            include_spip('inc/presentation_mini');
150
+            $flux['data']['texte'] = pipeline('affiche_droite',
151
+                    array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte'])) . liste_objets_bloques($exec,
152
+                    $flux['args']['contexte']);
153
+        } elseif ($fond == "prive/squelettes/hierarchie/$typepage" and $o[$exec]) {
154
+            // id non defini sur les formulaire de nouveaux objets
155
+            $id = isset($flux['args']['contexte'][$o[$exec]['id_table_objet']]) ? intval($flux['args']['contexte'][$o[$exec]['id_table_objet']]) : 0;
156
+            $flux['data']['texte'] = pipeline('affiche_hierarchie',
157
+                array('args' => array('objet' => $o[$exec]['type'], 'id_objet' => $id), 'data' => $flux['data']['texte']));
158
+        } elseif ($fond == "prive/squelettes/contenu/$typepage") {
159
+            if (!strpos($flux['data']['texte'], "<!--affiche_milieu-->")) {
160
+                $flux['data']['texte'] = preg_replace(',<div id=["\']wysiwyg,', "<!--affiche_milieu-->\\0",
161
+                    $flux['data']['texte']);
162
+            }
163
+            if ($o[$exec]
164
+                and $objet = $o[$exec]['type']
165
+                and $o[$exec]['edition'] == false
166
+                and isset($flux['args']['contexte'][$o[$exec]['id_table_objet']])
167
+                and $id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']])
168
+            ) {
169
+                // inserer le formulaire de traduction
170
+                $flux['data']['texte'] = str_replace("<!--affiche_milieu-->", recuperer_fond('prive/objets/editer/traductions',
171
+                        array('objet' => $objet, 'id_objet' => $id, 'espace_prive' => 1)) . "<!--affiche_milieu-->", $flux['data']['texte']);
172
+                $flux['data']['texte'] = pipeline('afficher_fiche_objet', array(
173
+                    'args' => array(
174
+                        'contexte' => $flux['args']['contexte'],
175
+                        'type' => $objet,
176
+                        'id' => $id
177
+                    ),
178
+                    'data' => $flux['data']['texte']
179
+                ));
180
+            }
181
+            $flux['data']['texte'] = pipeline('affiche_milieu',
182
+                array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
183
+        } elseif ($fond == "prive/squelettes/inclure/pied") {
184
+            $flux['data']['texte'] = pipeline('affiche_pied',
185
+                array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
186
+        } elseif (strncmp($fond, "prive/objets/contenu/", 21) == 0
187
+            and $objet = basename($fond)
188
+            and $objet == substr($fond, 21)
189
+            and isset($o[$objet])
190
+            and $o[$objet]
191
+        ) {
192
+            $id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']]);
193
+            $flux['data']['texte'] = pipeline('afficher_contenu_objet', array(
194
+                'args' => array('type' => $objet, 'id_objet' => $id, 'contexte' => $flux['args']['contexte']),
195
+                'data' => $flux['data']['texte']
196
+            ));
197
+        }
198
+    }
199 199
 
200
-	return $flux;
200
+    return $flux;
201 201
 }
202 202
 
203 203
 /**
@@ -208,20 +208,20 @@  discard block
 block discarded – undo
208 208
  * @return string
209 209
  */
210 210
 function f_queue_affiche_milieu($flux) {
211
-	$args = $flux['args'];
212
-	$res = "";
213
-	foreach ($args as $key => $arg) {
214
-		if (preg_match(",^id_,", $key) and is_numeric($arg) and $arg = intval($arg)) {
215
-			$objet = preg_replace(',^id_,', '', $key);
216
-			$res .= recuperer_fond('modeles/object_jobs_list', array('id_objet' => $arg, 'objet' => $objet, 'espace_prive' => 1),
217
-				array('ajax' => true));
218
-		}
219
-	}
220
-	if ($res) {
221
-		$flux['data'] = $res . $flux['data'];
222
-	}
211
+    $args = $flux['args'];
212
+    $res = "";
213
+    foreach ($args as $key => $arg) {
214
+        if (preg_match(",^id_,", $key) and is_numeric($arg) and $arg = intval($arg)) {
215
+            $objet = preg_replace(',^id_,', '', $key);
216
+            $res .= recuperer_fond('modeles/object_jobs_list', array('id_objet' => $arg, 'objet' => $objet, 'espace_prive' => 1),
217
+                array('ajax' => true));
218
+        }
219
+    }
220
+    if ($res) {
221
+        $flux['data'] = $res . $flux['data'];
222
+    }
223 223
 
224
-	return $flux;
224
+    return $flux;
225 225
 }
226 226
 
227 227
 /**
@@ -235,39 +235,39 @@  discard block
 block discarded – undo
235 235
  * @return array|bool
236 236
  */
237 237
 function trouver_objet_exec($exec) {
238
-	static $objet_exec = array();
239
-	if (!$exec) {
240
-		return false;
241
-	}
242
-	// cas particulier
243
-	if ($exec == "infos_perso") {
244
-		$exec = "auteur";
245
-		set_request('id_auteur', $GLOBALS['visiteur_session']['id_auteur']);
246
-	}
247
-	if (!isset($objet_exec[$exec])) {
248
-		$objet_exec[$exec] = false;
249
-		$infos = lister_tables_objets_sql();
250
-		foreach ($infos as $t => $info) {
251
-			if ($exec == $info['url_edit'] and $info['editable']) {
252
-				return $objet_exec[$exec] = array(
253
-					'edition' => $exec == $info['url_voir'] ? '' : true,
254
-					'table_objet_sql' => $t,
255
-					'table' => $info['table_objet'],
256
-					'type' => $info['type'],
257
-					'id_table_objet' => id_table_objet($info['type'])
258
-				);
259
-			}
260
-			if ($exec == $info['url_voir']) {
261
-				return $objet_exec[$exec] = array(
262
-					'edition' => false,
263
-					'table_objet_sql' => $t,
264
-					'table' => $info['table_objet'],
265
-					'type' => $info['type'],
266
-					'id_table_objet' => id_table_objet($info['type'])
267
-				);
268
-			}
269
-		}
270
-	}
238
+    static $objet_exec = array();
239
+    if (!$exec) {
240
+        return false;
241
+    }
242
+    // cas particulier
243
+    if ($exec == "infos_perso") {
244
+        $exec = "auteur";
245
+        set_request('id_auteur', $GLOBALS['visiteur_session']['id_auteur']);
246
+    }
247
+    if (!isset($objet_exec[$exec])) {
248
+        $objet_exec[$exec] = false;
249
+        $infos = lister_tables_objets_sql();
250
+        foreach ($infos as $t => $info) {
251
+            if ($exec == $info['url_edit'] and $info['editable']) {
252
+                return $objet_exec[$exec] = array(
253
+                    'edition' => $exec == $info['url_voir'] ? '' : true,
254
+                    'table_objet_sql' => $t,
255
+                    'table' => $info['table_objet'],
256
+                    'type' => $info['type'],
257
+                    'id_table_objet' => id_table_objet($info['type'])
258
+                );
259
+            }
260
+            if ($exec == $info['url_voir']) {
261
+                return $objet_exec[$exec] = array(
262
+                    'edition' => false,
263
+                    'table_objet_sql' => $t,
264
+                    'table' => $info['table_objet'],
265
+                    'type' => $info['type'],
266
+                    'id_table_objet' => id_table_objet($info['type'])
267
+                );
268
+            }
269
+        }
270
+    }
271 271
 
272
-	return $objet_exec[$exec];
272
+    return $objet_exec[$exec];
273 273
 }
Please login to merge, or discard this patch.
ecrire/inc/pipelines.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Pipelines
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 if (test_espace_prive()) {
22
-	include_spip('inc/pipelines_ecrire');
22
+    include_spip('inc/pipelines_ecrire');
23 23
 }
24 24
 
25 25
 
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
  * @return string          Contenu qui sera inséré dans le head HTML
46 46
  **/
47 47
 function f_jQuery($texte) {
48
-	$x = '';
49
-	$jquery_plugins = pipeline('jquery_plugins',
50
-		array(
51
-			'javascript/jquery.js',
52
-			'javascript/jquery-migrate-3.2.0.js',
53
-			'javascript/jquery.form.js',
54
-			'javascript/jquery.autosave.js',
55
-			'javascript/jquery.placeholder-label.js',
56
-			'javascript/ajaxCallback.js',
57
-			'javascript/js.cookie.js',
58
-			'javascript/jquery.cookie.js'
59
-		));
60
-	foreach (array_unique($jquery_plugins) as $script) {
61
-		if ($script = find_in_path(supprimer_timestamp($script))) {
62
-			$script = timestamp($script);
63
-			$x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n";
64
-		}
65
-	}
48
+    $x = '';
49
+    $jquery_plugins = pipeline('jquery_plugins',
50
+        array(
51
+            'javascript/jquery.js',
52
+            'javascript/jquery-migrate-3.2.0.js',
53
+            'javascript/jquery.form.js',
54
+            'javascript/jquery.autosave.js',
55
+            'javascript/jquery.placeholder-label.js',
56
+            'javascript/ajaxCallback.js',
57
+            'javascript/js.cookie.js',
58
+            'javascript/jquery.cookie.js'
59
+        ));
60
+    foreach (array_unique($jquery_plugins) as $script) {
61
+        if ($script = find_in_path(supprimer_timestamp($script))) {
62
+            $script = timestamp($script);
63
+            $x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n";
64
+        }
65
+    }
66 66
 
67
-	$texte = $x . $texte;
67
+    $texte = $x . $texte;
68 68
 
69
-	return $texte;
69
+    return $texte;
70 70
 }
71 71
 
72 72
 
@@ -85,27 +85,27 @@  discard block
 block discarded – undo
85 85
  * @return string         Contenu de la page envoyée au navigateur
86 86
  **/
87 87
 function f_surligne($texte) {
88
-	if (!$GLOBALS['html']) {
89
-		return $texte;
90
-	}
91
-	$rech = _request('var_recherche');
92
-	if (!$rech
93
-		and (!defined('_SURLIGNE_RECHERCHE_REFERERS')
94
-			or !_SURLIGNE_RECHERCHE_REFERERS
95
-			or !isset($_SERVER['HTTP_REFERER']))
96
-	) {
97
-		return $texte;
98
-	}
99
-	include_spip('inc/surligne');
88
+    if (!$GLOBALS['html']) {
89
+        return $texte;
90
+    }
91
+    $rech = _request('var_recherche');
92
+    if (!$rech
93
+        and (!defined('_SURLIGNE_RECHERCHE_REFERERS')
94
+            or !_SURLIGNE_RECHERCHE_REFERERS
95
+            or !isset($_SERVER['HTTP_REFERER']))
96
+    ) {
97
+        return $texte;
98
+    }
99
+    include_spip('inc/surligne');
100 100
 
101
-	if (isset($_SERVER['HTTP_REFERER'])) {
102
-		$_SERVER['HTTP_REFERER'] = preg_replace(',[^\w\,/#&;-]+,', ' ', $_SERVER['HTTP_REFERER']);
103
-	}
104
-	if ($rech){
105
-		$rech = preg_replace(',[^\w\,/#&;-]+,', ' ', $rech);
106
-	}
101
+    if (isset($_SERVER['HTTP_REFERER'])) {
102
+        $_SERVER['HTTP_REFERER'] = preg_replace(',[^\w\,/#&;-]+,', ' ', $_SERVER['HTTP_REFERER']);
103
+    }
104
+    if ($rech){
105
+        $rech = preg_replace(',[^\w\,/#&;-]+,', ' ', $rech);
106
+    }
107 107
 
108
-	return surligner_mots($texte, $rech);
108
+    return surligner_mots($texte, $rech);
109 109
 }
110 110
 
111 111
 /**
@@ -122,32 +122,32 @@  discard block
 block discarded – undo
122 122
  * @return string         Contenu de la page envoyée au navigateur
123 123
  **/
124 124
 function f_tidy($texte) {
125
-	/**
126
-	 * Indentation à faire ?
127
-	 *
128
-	 * - true : actif.
129
-	 * - false par défaut.
130
-	 */
125
+    /**
126
+     * Indentation à faire ?
127
+     *
128
+     * - true : actif.
129
+     * - false par défaut.
130
+     */
131 131
 
132
-	if ($GLOBALS['xhtml'] # tidy demande
133
-		and $GLOBALS['html'] # verifie que la page avait l'entete text/html
134
-		and strlen($texte)
135
-		and !headers_sent()
136
-	) {
137
-		# Compatibilite ascendante
138
-		if (!is_string($GLOBALS['xhtml'])) {
139
-			$GLOBALS['xhtml'] = 'tidy';
140
-		}
132
+    if ($GLOBALS['xhtml'] # tidy demande
133
+        and $GLOBALS['html'] # verifie que la page avait l'entete text/html
134
+        and strlen($texte)
135
+        and !headers_sent()
136
+    ) {
137
+        # Compatibilite ascendante
138
+        if (!is_string($GLOBALS['xhtml'])) {
139
+            $GLOBALS['xhtml'] = 'tidy';
140
+        }
141 141
 
142
-		if (!$f = charger_fonction($GLOBALS['xhtml'], 'inc', true)) {
143
-			spip_log("tidy absent, l'indenteur SPIP le remplace");
144
-			$f = charger_fonction('sax', 'xml');
145
-		}
142
+        if (!$f = charger_fonction($GLOBALS['xhtml'], 'inc', true)) {
143
+            spip_log("tidy absent, l'indenteur SPIP le remplace");
144
+            $f = charger_fonction('sax', 'xml');
145
+        }
146 146
 
147
-		return $f($texte);
148
-	}
147
+        return $f($texte);
148
+    }
149 149
 
150
-	return $texte;
150
+    return $texte;
151 151
 }
152 152
 
153 153
 
@@ -166,21 +166,21 @@  discard block
 block discarded – undo
166 166
  * @return string         Contenu de la page envoyée au navigateur
167 167
  **/
168 168
 function f_insert_head($texte) {
169
-	if (!$GLOBALS['html']) {
170
-		return $texte;
171
-	}
172
-	include_spip('public/admin'); // pour strripos
169
+    if (!$GLOBALS['html']) {
170
+        return $texte;
171
+    }
172
+    include_spip('public/admin'); // pour strripos
173 173
 
174
-	($pos = stripos($texte, '</head>'))
175
-	|| ($pos = stripos($texte, '<body>'))
176
-	|| ($pos = 0);
174
+    ($pos = stripos($texte, '</head>'))
175
+    || ($pos = stripos($texte, '<body>'))
176
+    || ($pos = 0);
177 177
 
178
-	if (false === strpos(substr($texte, 0, $pos), '<!-- insert_head -->')) {
179
-		$insert = "\n" . pipeline('insert_head', '<!-- f_insert_head -->') . "\n";
180
-		$texte = substr_replace($texte, $insert, $pos, 0);
181
-	}
178
+    if (false === strpos(substr($texte, 0, $pos), '<!-- insert_head -->')) {
179
+        $insert = "\n" . pipeline('insert_head', '<!-- f_insert_head -->') . "\n";
180
+        $texte = substr_replace($texte, $insert, $pos, 0);
181
+    }
182 182
 
183
-	return $texte;
183
+    return $texte;
184 184
 }
185 185
 
186 186
 
@@ -196,28 +196,28 @@  discard block
 block discarded – undo
196 196
  * @return string         Contenu de la page envoyée au navigateur
197 197
  **/
198 198
 function f_admin($texte) {
199
-	if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and $GLOBALS['html']) {
200
-		include_spip('inc/filtres'); // pour http_img_pack
201
-		$x = "<div class='spip-previsu' "
202
-			. http_style_background('preview-32.png', '', 32)
203
-			. ">"
204
-			. _T('previsualisation')
205
-			. "</div>";
206
-		if (!$pos = stripos($texte, '</body>')) {
207
-			$pos = strlen($texte);
208
-		}
209
-		$texte = substr_replace($texte, $x, $pos, 0);
210
-	}
199
+    if (defined('_VAR_PREVIEW') and _VAR_PREVIEW and $GLOBALS['html']) {
200
+        include_spip('inc/filtres'); // pour http_img_pack
201
+        $x = "<div class='spip-previsu' "
202
+            . http_style_background('preview-32.png', '', 32)
203
+            . ">"
204
+            . _T('previsualisation')
205
+            . "</div>";
206
+        if (!$pos = stripos($texte, '</body>')) {
207
+            $pos = strlen($texte);
208
+        }
209
+        $texte = substr_replace($texte, $x, $pos, 0);
210
+    }
211 211
 
212
-	if (isset($GLOBALS['affiche_boutons_admin']) and $GLOBALS['affiche_boutons_admin']) {
213
-		include_spip('public/admin');
214
-		$texte = affiche_boutons_admin($texte);
215
-	}
216
-	if (_request('var_mode') == 'noajax') {
217
-		$texte = preg_replace(',(class=[\'"][^\'"]*)ajax([^\'"]*[\'"]),Uims', "\\1\\2", $texte);
218
-	}
212
+    if (isset($GLOBALS['affiche_boutons_admin']) and $GLOBALS['affiche_boutons_admin']) {
213
+        include_spip('public/admin');
214
+        $texte = affiche_boutons_admin($texte);
215
+    }
216
+    if (_request('var_mode') == 'noajax') {
217
+        $texte = preg_replace(',(class=[\'"][^\'"]*)ajax([^\'"]*[\'"]),Uims', "\\1\\2", $texte);
218
+    }
219 219
 
220
-	return $texte;
220
+    return $texte;
221 221
 }
222 222
 
223 223
 /**
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
  * @return array $flux  Description et contenu de l'inclusion
236 236
  **/
237 237
 function f_recuperer_fond($flux) {
238
-	if (!test_espace_prive()) {
239
-		return $flux;
240
-	}
238
+    if (!test_espace_prive()) {
239
+        return $flux;
240
+    }
241 241
 
242
-	return f_afficher_blocs_ecrire($flux);
242
+    return f_afficher_blocs_ecrire($flux);
243 243
 }
244 244
 
245 245
 /**
@@ -253,29 +253,29 @@  discard block
 block discarded – undo
253 253
  * @return string         Contenu de la page envoyée au navigateur
254 254
  */
255 255
 function f_queue($texte) {
256
-	// eviter une inclusion si rien a faire
257
-	if (_request('action') == 'cron'
258
-		or queue_sleep_time_to_next_job() > 0
259
-		or defined('_DEBUG_BLOCK_QUEUE')
260
-	) {
261
-		return $texte;
262
-	}
256
+    // eviter une inclusion si rien a faire
257
+    if (_request('action') == 'cron'
258
+        or queue_sleep_time_to_next_job() > 0
259
+        or defined('_DEBUG_BLOCK_QUEUE')
260
+    ) {
261
+        return $texte;
262
+    }
263 263
 
264
-	include_spip('inc/queue');
265
-	$code = queue_affichage_cron();
264
+    include_spip('inc/queue');
265
+    $code = queue_affichage_cron();
266 266
 
267
-	// si rien a afficher
268
-	// ou si on est pas dans une page html, on ne sait rien faire de mieux
269
-	if (!$code or !isset($GLOBALS['html']) or !$GLOBALS['html']) {
270
-		return $texte;
271
-	}
267
+    // si rien a afficher
268
+    // ou si on est pas dans une page html, on ne sait rien faire de mieux
269
+    if (!$code or !isset($GLOBALS['html']) or !$GLOBALS['html']) {
270
+        return $texte;
271
+    }
272 272
 
273
-	// inserer avant le </body> fermant si on peut, a la fin de la page sinon
274
-	if (($p = strpos($texte, '</body>')) !== false) {
275
-		$texte = substr($texte, 0, $p) . $code . substr($texte, $p);
276
-	} else {
277
-		$texte .= $code;
278
-	}
273
+    // inserer avant le </body> fermant si on peut, a la fin de la page sinon
274
+    if (($p = strpos($texte, '</body>')) !== false) {
275
+        $texte = substr($texte, 0, $p) . $code . substr($texte, $p);
276
+    } else {
277
+        $texte .= $code;
278
+    }
279 279
 
280
-	return $texte;
280
+    return $texte;
281 281
 }
Please login to merge, or discard this patch.