Completed
Push — master ( 0911bb...f0522e )
by cam
04:37
created
ecrire/inc/presenter_enfants.php 2 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 include_spip('inc/autoriser');
@@ -31,80 +31,80 @@  discard block
 block discarded – undo
31 31
  *  Un tableau des sous rubriques
32 32
  */
33 33
 function enfant_rub($collection, $debut = 0, $limite = 500) {
34
-	$voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != 'non');
35
-	$logo = '';
36
-
37
-	if ($voir_logo) {
38
-		$chercher_logo = charger_fonction('chercher_logo', 'inc');
39
-		include_spip('inc/filtres_images_mini');
40
-	}
41
-
42
-	$res = array();
43
-
44
-	$result = sql_select(
45
-		'id_rubrique, id_parent, titre, descriptif, lang',
46
-		'spip_rubriques',
47
-		'id_parent='.intval($collection),
48
-		'',
49
-		'0+titre,titre',
50
-		"$debut,$limite"
51
-	);
52
-	while ($row = sql_fetch($result)) {
53
-		$id_rubrique = $row['id_rubrique'];
54
-		$id_parent = $row['id_parent'];
55
-		// pour etre sur de passer par tous les traitements
56
-		$titre = generer_info_entite($id_rubrique, 'rubrique', 'titre');
57
-		if ('' !== ($rang = recuperer_numero($row['titre']))) {
58
-			$rang = "$rang. ";
59
-		}
60
-
61
-		if (autoriser('voir', 'rubrique', $id_rubrique)) {
62
-			$les_sous_enfants = sous_enfant_rub($id_rubrique);
63
-
64
-			changer_typo($row['lang']);
65
-			$lang_dir = lang_dir($row['lang']);
66
-			$descriptif = propre($row['descriptif']);
67
-
68
-			if ($voir_logo) {
69
-				if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) {
70
-					list($fid, $dir, $nom, $format) = $logo;
71
-					$logo = image_recadre_avec_fallback("<img src='$fid' alt='' />", 70, 70);
72
-					if ($logo) {
73
-						$logo = wrap(inserer_attribut($logo, 'class', 'logo'),'<span class="logo-carre">');
74
-					}
75
-				}
76
-			}
77
-
78
-			$lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' :
79
-					http_img_pack(
80
-						'auteur-0minirezo-16.png',
81
-						'',
82
-						" width='16' height='16'",
83
-						_T('image_administrer_rubrique')
84
-					)) .
85
-				" <a class='titremlien' dir='$lang_dir'" .
86
-				($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') .
87
-				" href='" .
88
-				generer_url_entite($id_rubrique, 'rubrique') .
89
-				"'><span class='titre'>" .
90
-				$rang . $titre
91
-				. '</span>'
92
-				. (is_string($logo) ? $logo : '')
93
-				. '</a>';
94
-
95
-			$titre = bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants$id_rubrique")
96
-				. (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>")
97
-				;
98
-
99
-			$res[] =
100
-				debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) .
101
-				$les_sous_enfants .
102
-				fin_cadre_sous_rub(true);
103
-		}
104
-	}
105
-
106
-	changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite
107
-	return $res;
34
+    $voir_logo = (isset($GLOBALS['meta']['image_process']) and $GLOBALS['meta']['image_process'] != 'non');
35
+    $logo = '';
36
+
37
+    if ($voir_logo) {
38
+        $chercher_logo = charger_fonction('chercher_logo', 'inc');
39
+        include_spip('inc/filtres_images_mini');
40
+    }
41
+
42
+    $res = array();
43
+
44
+    $result = sql_select(
45
+        'id_rubrique, id_parent, titre, descriptif, lang',
46
+        'spip_rubriques',
47
+        'id_parent='.intval($collection),
48
+        '',
49
+        '0+titre,titre',
50
+        "$debut,$limite"
51
+    );
52
+    while ($row = sql_fetch($result)) {
53
+        $id_rubrique = $row['id_rubrique'];
54
+        $id_parent = $row['id_parent'];
55
+        // pour etre sur de passer par tous les traitements
56
+        $titre = generer_info_entite($id_rubrique, 'rubrique', 'titre');
57
+        if ('' !== ($rang = recuperer_numero($row['titre']))) {
58
+            $rang = "$rang. ";
59
+        }
60
+
61
+        if (autoriser('voir', 'rubrique', $id_rubrique)) {
62
+            $les_sous_enfants = sous_enfant_rub($id_rubrique);
63
+
64
+            changer_typo($row['lang']);
65
+            $lang_dir = lang_dir($row['lang']);
66
+            $descriptif = propre($row['descriptif']);
67
+
68
+            if ($voir_logo) {
69
+                if ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on')) {
70
+                    list($fid, $dir, $nom, $format) = $logo;
71
+                    $logo = image_recadre_avec_fallback("<img src='$fid' alt='' />", 70, 70);
72
+                    if ($logo) {
73
+                        $logo = wrap(inserer_attribut($logo, 'class', 'logo'),'<span class="logo-carre">');
74
+                    }
75
+                }
76
+            }
77
+
78
+            $lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' :
79
+                    http_img_pack(
80
+                        'auteur-0minirezo-16.png',
81
+                        '',
82
+                        " width='16' height='16'",
83
+                        _T('image_administrer_rubrique')
84
+                    )) .
85
+                " <a class='titremlien' dir='$lang_dir'" .
86
+                ($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') .
87
+                " href='" .
88
+                generer_url_entite($id_rubrique, 'rubrique') .
89
+                "'><span class='titre'>" .
90
+                $rang . $titre
91
+                . '</span>'
92
+                . (is_string($logo) ? $logo : '')
93
+                . '</a>';
94
+
95
+            $titre = bouton_block_depliable($lib_bouton, $les_sous_enfants ? false : -1, "enfants$id_rubrique")
96
+                . (!$descriptif ? '' : "\n<div class='descriptif'>$descriptif</div>")
97
+                ;
98
+
99
+            $res[] =
100
+                debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) .
101
+                $les_sous_enfants .
102
+                fin_cadre_sous_rub(true);
103
+        }
104
+    }
105
+
106
+    changer_typo($GLOBALS['spip_lang']); # remettre la typo de l'interface pour la suite
107
+    return $res;
108 108
 }
109 109
 
110 110
 /**
@@ -117,65 +117,65 @@  discard block
 block discarded – undo
117 117
  *  Le contenu du bloc dépliable
118 118
  */
119 119
 function sous_enfant_rub($collection2) {
120
-	$nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2));
121
-
122
-	$retour = '';
123
-	$pagination = '';
124
-	$debut = 0;
125
-	$limite = 500;
126
-
127
-	/**
128
-	 * On ne va afficher que 500 résultats max
129
-	 * Si > 500 on affiche une pagination
130
-	 */
131
-	if ($nb > $limite) {
132
-		$debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut;
133
-		$pagination = chercher_filtre('pagination');
134
-		$pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true,
135
-				'prive') . '</p>';
136
-		$limite = $debut + $limite;
137
-	}
138
-
139
-	$result = sql_select(
140
-		'id_rubrique, id_parent, titre, lang',
141
-		'spip_rubriques',
142
-		'id_parent='.intval($collection2),
143
-		'',
144
-		'0+titre,titre',
145
-		"$debut,$limite"
146
-	);
147
-
148
-	while ($row = sql_fetch($result)) {
149
-		$id_rubrique2 = $row['id_rubrique'];
150
-		$titre2 = generer_info_entite(
151
-			$id_rubrique2,
152
-			'rubrique',
153
-			'titre'
154
-		); // pour etre sur de passer par tous les traitements
155
-		if ('' !== ($rang2 = recuperer_numero($row['titre']))) {
156
-			$rang2 = "$rang2. ";
157
-		}
158
-
159
-		changer_typo($row['lang']);
160
-		$lang_dir = lang_dir($row['lang']);
161
-		if (autoriser('voir', 'rubrique', $id_rubrique2)) {
162
-			$retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite(
163
-				$id_rubrique2,
164
-				'rubrique'
165
-			) . "'>" . $rang2 . $titre2 . "</a></li>\n";
166
-		}
167
-	}
168
-
169
-	$retour = $pagination . $retour . $pagination;
170
-
171
-	if (!$retour) {
172
-		return '';
173
-	}
174
-
175
-	return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2")
176
-	. "\n<ul class='liste-items sous-sous-rub'>\n"
177
-	. $retour
178
-	. "</ul>\n" . fin_block() . "\n\n";
120
+    $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($collection2));
121
+
122
+    $retour = '';
123
+    $pagination = '';
124
+    $debut = 0;
125
+    $limite = 500;
126
+
127
+    /**
128
+     * On ne va afficher que 500 résultats max
129
+     * Si > 500 on affiche une pagination
130
+     */
131
+    if ($nb > $limite) {
132
+        $debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut;
133
+        $pagination = chercher_filtre('pagination');
134
+        $pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true,
135
+                'prive') . '</p>';
136
+        $limite = $debut + $limite;
137
+    }
138
+
139
+    $result = sql_select(
140
+        'id_rubrique, id_parent, titre, lang',
141
+        'spip_rubriques',
142
+        'id_parent='.intval($collection2),
143
+        '',
144
+        '0+titre,titre',
145
+        "$debut,$limite"
146
+    );
147
+
148
+    while ($row = sql_fetch($result)) {
149
+        $id_rubrique2 = $row['id_rubrique'];
150
+        $titre2 = generer_info_entite(
151
+            $id_rubrique2,
152
+            'rubrique',
153
+            'titre'
154
+        ); // pour etre sur de passer par tous les traitements
155
+        if ('' !== ($rang2 = recuperer_numero($row['titre']))) {
156
+            $rang2 = "$rang2. ";
157
+        }
158
+
159
+        changer_typo($row['lang']);
160
+        $lang_dir = lang_dir($row['lang']);
161
+        if (autoriser('voir', 'rubrique', $id_rubrique2)) {
162
+            $retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite(
163
+                $id_rubrique2,
164
+                'rubrique'
165
+            ) . "'>" . $rang2 . $titre2 . "</a></li>\n";
166
+        }
167
+    }
168
+
169
+    $retour = $pagination . $retour . $pagination;
170
+
171
+    if (!$retour) {
172
+        return '';
173
+    }
174
+
175
+    return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2")
176
+    . "\n<ul class='liste-items sous-sous-rub'>\n"
177
+    . $retour
178
+    . "</ul>\n" . fin_block() . "\n\n";
179 179
 }
180 180
 
181 181
 /**
@@ -190,44 +190,44 @@  discard block
 block discarded – undo
190 190
  *  Le contenu textuel affiché, la liste des sous rubriques
191 191
  */
192 192
 function afficher_enfant_rub($id_rubrique = 0) {
193
-	$pagination = '';
194
-	$debut = 0;
195
-	$limite = 500;
196
-
197
-	$nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique));
198
-
199
-	if ($nb > $limite) {
200
-		$debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut;
201
-		$pagination = chercher_filtre('pagination');
202
-		$pagination = '<br class="nettoyeur"><p class="pagination">' .
203
-			$pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') .
204
-		'</p>';
205
-	}
206
-
207
-	$les_enfants = enfant_rub($id_rubrique, $debut, $limite);
208
-
209
-	if (!$n = count($les_enfants)) {
210
-		return '';
211
-	}
212
-
213
-	if ($n == 1) {
214
-		$les_enfants = reset($les_enfants);
215
-		$les_enfants2 = '';
216
-	} else {
217
-		$n = ceil($n / 2);
218
-		$les_enfants2 = implode('', array_slice($les_enfants, $n));
219
-		$les_enfants = implode('', array_slice($les_enfants, 0, $n));
220
-	}
221
-
222
-	$res =
223
-		$pagination
224
-		. "<div class='gauche'>"
225
-		. $les_enfants
226
-		. '</div>'
227
-		. "<div class='droite'>"
228
-		. $les_enfants2
229
-		. '</div>'
230
-		. $pagination;
231
-
232
-	return $res;
193
+    $pagination = '';
194
+    $debut = 0;
195
+    $limite = 500;
196
+
197
+    $nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique));
198
+
199
+    if ($nb > $limite) {
200
+        $debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut;
201
+        $pagination = chercher_filtre('pagination');
202
+        $pagination = '<br class="nettoyeur"><p class="pagination">' .
203
+            $pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') .
204
+        '</p>';
205
+    }
206
+
207
+    $les_enfants = enfant_rub($id_rubrique, $debut, $limite);
208
+
209
+    if (!$n = count($les_enfants)) {
210
+        return '';
211
+    }
212
+
213
+    if ($n == 1) {
214
+        $les_enfants = reset($les_enfants);
215
+        $les_enfants2 = '';
216
+    } else {
217
+        $n = ceil($n / 2);
218
+        $les_enfants2 = implode('', array_slice($les_enfants, $n));
219
+        $les_enfants = implode('', array_slice($les_enfants, 0, $n));
220
+    }
221
+
222
+    $res =
223
+        $pagination
224
+        . "<div class='gauche'>"
225
+        . $les_enfants
226
+        . '</div>'
227
+        . "<div class='droite'>"
228
+        . $les_enfants2
229
+        . '</div>'
230
+        . $pagination;
231
+
232
+    return $res;
233 233
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -70,24 +70,23 @@  discard block
 block discarded – undo
70 70
 					list($fid, $dir, $nom, $format) = $logo;
71 71
 					$logo = image_recadre_avec_fallback("<img src='$fid' alt='' />", 70, 70);
72 72
 					if ($logo) {
73
-						$logo = wrap(inserer_attribut($logo, 'class', 'logo'),'<span class="logo-carre">');
73
+						$logo = wrap(inserer_attribut($logo, 'class', 'logo'), '<span class="logo-carre">');
74 74
 					}
75 75
 				}
76 76
 			}
77 77
 
78
-			$lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' :
79
-					http_img_pack(
78
+			$lib_bouton = (!acces_restreint_rubrique($id_rubrique) ? '' : http_img_pack(
80 79
 						'auteur-0minirezo-16.png',
81 80
 						'',
82 81
 						" width='16' height='16'",
83 82
 						_T('image_administrer_rubrique')
84
-					)) .
85
-				" <a class='titremlien' dir='$lang_dir'" .
86
-				($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='" . $row['lang'] . "'" : '') .
87
-				" href='" .
88
-				generer_url_entite($id_rubrique, 'rubrique') .
89
-				"'><span class='titre'>" .
90
-				$rang . $titre
83
+					)).
84
+				" <a class='titremlien' dir='$lang_dir'".
85
+				($row['lang'] !== $GLOBALS['spip_lang'] ? " hreflang='".$row['lang']."'" : '').
86
+				" href='".
87
+				generer_url_entite($id_rubrique, 'rubrique').
88
+				"'><span class='titre'>".
89
+				$rang.$titre
91 90
 				. '</span>'
92 91
 				. (is_string($logo) ? $logo : '')
93 92
 				. '</a>';
@@ -97,8 +96,8 @@  discard block
 block discarded – undo
97 96
 				;
98 97
 
99 98
 			$res[] =
100
-				debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre) .
101
-				$les_sous_enfants .
99
+				debut_cadre_sous_rub(($id_parent ? 'rubrique-24.png' : 'secteur-24.png'), true, '', $titre).
100
+				$les_sous_enfants.
102 101
 				fin_cadre_sous_rub(true);
103 102
 		}
104 103
 	}
@@ -129,10 +128,10 @@  discard block
 block discarded – undo
129 128
 	 * Si > 500 on affiche une pagination
130 129
 	 */
131 130
 	if ($nb > $limite) {
132
-		$debut = _request('debut_rubrique' . $collection2) ? _request('debut_rubrique' . $collection2) : $debut;
131
+		$debut = _request('debut_rubrique'.$collection2) ? _request('debut_rubrique'.$collection2) : $debut;
133 132
 		$pagination = chercher_filtre('pagination');
134
-		$pagination = '<p class="pagination">' . $pagination($nb, '_rubrique' . $collection2, $debut, $limite, true,
135
-				'prive') . '</p>';
133
+		$pagination = '<p class="pagination">'.$pagination($nb, '_rubrique'.$collection2, $debut, $limite, true,
134
+				'prive').'</p>';
136 135
 		$limite = $debut + $limite;
137 136
 	}
138 137
 
@@ -159,14 +158,14 @@  discard block
 block discarded – undo
159 158
 		changer_typo($row['lang']);
160 159
 		$lang_dir = lang_dir($row['lang']);
161 160
 		if (autoriser('voir', 'rubrique', $id_rubrique2)) {
162
-			$retour .= "\n<li class='item' dir='$lang_dir'><a href='" . generer_url_entite(
161
+			$retour .= "\n<li class='item' dir='$lang_dir'><a href='".generer_url_entite(
163 162
 				$id_rubrique2,
164 163
 				'rubrique'
165
-			) . "'>" . $rang2 . $titre2 . "</a></li>\n";
164
+			)."'>".$rang2.$titre2."</a></li>\n";
166 165
 		}
167 166
 	}
168 167
 
169
-	$retour = $pagination . $retour . $pagination;
168
+	$retour = $pagination.$retour.$pagination;
170 169
 
171 170
 	if (!$retour) {
172 171
 		return '';
@@ -175,7 +174,7 @@  discard block
 block discarded – undo
175 174
 	return debut_block_depliable($debut > 0 ? true : false, "enfants$collection2")
176 175
 	. "\n<ul class='liste-items sous-sous-rub'>\n"
177 176
 	. $retour
178
-	. "</ul>\n" . fin_block() . "\n\n";
177
+	. "</ul>\n".fin_block()."\n\n";
179 178
 }
180 179
 
181 180
 /**
@@ -197,10 +196,10 @@  discard block
 block discarded – undo
197 196
 	$nb = sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique));
198 197
 
199 198
 	if ($nb > $limite) {
200
-		$debut = _request('debut_rubrique' . $id_rubrique) ? _request('debut_rubrique' . $id_rubrique) : $debut;
199
+		$debut = _request('debut_rubrique'.$id_rubrique) ? _request('debut_rubrique'.$id_rubrique) : $debut;
201 200
 		$pagination = chercher_filtre('pagination');
202
-		$pagination = '<br class="nettoyeur"><p class="pagination">' .
203
-			$pagination($nb, '_rubrique' . $id_rubrique, $debut, $limite, true, 'prive') .
201
+		$pagination = '<br class="nettoyeur"><p class="pagination">'.
202
+			$pagination($nb, '_rubrique'.$id_rubrique, $debut, $limite, true, 'prive').
204 203
 		'</p>';
205 204
 	}
206 205
 
Please login to merge, or discard this patch.
ecrire/inc/pipelines_ecrire.php 2 patches
Indentation   +202 added lines, -202 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
 // https://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,81 +131,81 @@  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
-			// Préparation du marqueur affiche_milieu
160
-			// Si c'est la page d'un objet pas en édition, on l'encapsule dans un div
161
-			$est_page_objet = !empty($o[$exec]['type']);
162
-			$est_en_edition = (isset($o[$exec]['edition']) and $o[$exec]['edition'] === true);
163
-			$encapsuler_milieu = ($est_page_objet and !$est_en_edition);
164
-			$flux['data']['texte'] = afficher_blocs_ecrire_preparer_marqueur(
165
-				$flux['data']['texte'],
166
-				'<!--affiche_milieu-->',
167
-				'<div id=["\']wysiwyg',
168
-				$encapsuler_milieu ? '<div class="affiche_milieu">' : '',
169
-				$encapsuler_milieu ? '</div>' : ''
170
-			);
171
-			if ($o[$exec]
172
-				and $objet = $o[$exec]['type']
173
-				and $o[$exec]['edition'] == false
174
-				and isset($flux['args']['contexte'][$o[$exec]['id_table_objet']])
175
-				and $id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']])
176
-			) {
177
-				// inserer le formulaire de traduction
178
-				$flux['data']['texte'] = str_replace("<!--affiche_milieu-->", recuperer_fond('prive/objets/editer/traductions',
179
-						array('objet' => $objet, 'id_objet' => $id, 'espace_prive' => 1)) . "<!--affiche_milieu-->", $flux['data']['texte']);
180
-				$flux['data']['texte'] = pipeline('afficher_fiche_objet', array(
181
-					'args' => array(
182
-						'contexte' => $flux['args']['contexte'],
183
-						'type' => $objet,
184
-						'id' => $id
185
-					),
186
-					'data' => $flux['data']['texte']
187
-				));
188
-			}
189
-			$flux['data']['texte'] = pipeline('affiche_milieu',
190
-				array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
191
-		} elseif ($fond == "prive/squelettes/inclure/pied") {
192
-			$flux['data']['texte'] = pipeline('affiche_pied',
193
-				array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
194
-		} elseif (strncmp($fond, "prive/objets/contenu/", 21) == 0
195
-			and $objet = basename($fond)
196
-			and $objet == substr($fond, 21)
197
-			and isset($o[$objet])
198
-			and $o[$objet]
199
-		) {
200
-			$id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']]);
201
-			$flux['data']['texte'] = pipeline('afficher_contenu_objet', array(
202
-				'args' => array('type' => $objet, 'id_objet' => $id, 'contexte' => $flux['args']['contexte']),
203
-				'data' => $flux['data']['texte']
204
-			));
205
-		}
206
-	}
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
+            // Préparation du marqueur affiche_milieu
160
+            // Si c'est la page d'un objet pas en édition, on l'encapsule dans un div
161
+            $est_page_objet = !empty($o[$exec]['type']);
162
+            $est_en_edition = (isset($o[$exec]['edition']) and $o[$exec]['edition'] === true);
163
+            $encapsuler_milieu = ($est_page_objet and !$est_en_edition);
164
+            $flux['data']['texte'] = afficher_blocs_ecrire_preparer_marqueur(
165
+                $flux['data']['texte'],
166
+                '<!--affiche_milieu-->',
167
+                '<div id=["\']wysiwyg',
168
+                $encapsuler_milieu ? '<div class="affiche_milieu">' : '',
169
+                $encapsuler_milieu ? '</div>' : ''
170
+            );
171
+            if ($o[$exec]
172
+                and $objet = $o[$exec]['type']
173
+                and $o[$exec]['edition'] == false
174
+                and isset($flux['args']['contexte'][$o[$exec]['id_table_objet']])
175
+                and $id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']])
176
+            ) {
177
+                // inserer le formulaire de traduction
178
+                $flux['data']['texte'] = str_replace("<!--affiche_milieu-->", recuperer_fond('prive/objets/editer/traductions',
179
+                        array('objet' => $objet, 'id_objet' => $id, 'espace_prive' => 1)) . "<!--affiche_milieu-->", $flux['data']['texte']);
180
+                $flux['data']['texte'] = pipeline('afficher_fiche_objet', array(
181
+                    'args' => array(
182
+                        'contexte' => $flux['args']['contexte'],
183
+                        'type' => $objet,
184
+                        'id' => $id
185
+                    ),
186
+                    'data' => $flux['data']['texte']
187
+                ));
188
+            }
189
+            $flux['data']['texte'] = pipeline('affiche_milieu',
190
+                array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
191
+        } elseif ($fond == "prive/squelettes/inclure/pied") {
192
+            $flux['data']['texte'] = pipeline('affiche_pied',
193
+                array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte']));
194
+        } elseif (strncmp($fond, "prive/objets/contenu/", 21) == 0
195
+            and $objet = basename($fond)
196
+            and $objet == substr($fond, 21)
197
+            and isset($o[$objet])
198
+            and $o[$objet]
199
+        ) {
200
+            $id = intval($flux['args']['contexte'][$o[$exec]['id_table_objet']]);
201
+            $flux['data']['texte'] = pipeline('afficher_contenu_objet', array(
202
+                'args' => array('type' => $objet, 'id_objet' => $id, 'contexte' => $flux['args']['contexte']),
203
+                'data' => $flux['data']['texte']
204
+            ));
205
+        }
206
+    }
207 207
 
208
-	return $flux;
208
+    return $flux;
209 209
 }
210 210
 
211 211
 /**
@@ -233,34 +233,34 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function afficher_blocs_ecrire_preparer_marqueur(string $texte, string $marqueur, string $inserer_avant, string $ouvrir = '', string $fermer = '') : string {
235 235
 
236
-	$encapsuler = (($ouvrir and $fermer) ? true : false);
237
-	$marqueur_pos = strpos($texte, $marqueur);
238
-	$full_marqueur = "$ouvrir$marqueur$fermer";
236
+    $encapsuler = (($ouvrir and $fermer) ? true : false);
237
+    $marqueur_pos = strpos($texte, $marqueur);
238
+    $full_marqueur = "$ouvrir$marqueur$fermer";
239 239
 
240
-	// Le marqueur est absent : on l'ajoute avant l'élément indiqué
241
-	if ($marqueur_pos  === false) {
242
-		$texte = preg_replace(
243
-			",$inserer_avant,",
244
-			"$full_marqueur\\0",
245
-			$texte
246
-		);
247
-	// Le marqueur est présent mais pas encapsulé : on ajoute les balises ouvrantes et fermantes.
248
-	// Pour vérifier, on prend le texte précédent et on regarde si ça correspond à la balise ouvrante.
249
-	// Il ne faut donc aucun espace blanc en trop.
250
-	} elseif (
251
-		$marqueur_pos !== false
252
-		and $encapsuler
253
-		and substr($texte, $marqueur_pos-strlen($ouvrir), strlen($ouvrir)) !== $ouvrir
254
-	) {
255
-		$texte = substr_replace(
256
-			$texte,
257
-			$full_marqueur,
258
-			$marqueur_pos,
259
-			strlen($marqueur)
260
-		);
261
-	}
240
+    // Le marqueur est absent : on l'ajoute avant l'élément indiqué
241
+    if ($marqueur_pos  === false) {
242
+        $texte = preg_replace(
243
+            ",$inserer_avant,",
244
+            "$full_marqueur\\0",
245
+            $texte
246
+        );
247
+    // Le marqueur est présent mais pas encapsulé : on ajoute les balises ouvrantes et fermantes.
248
+    // Pour vérifier, on prend le texte précédent et on regarde si ça correspond à la balise ouvrante.
249
+    // Il ne faut donc aucun espace blanc en trop.
250
+    } elseif (
251
+        $marqueur_pos !== false
252
+        and $encapsuler
253
+        and substr($texte, $marqueur_pos-strlen($ouvrir), strlen($ouvrir)) !== $ouvrir
254
+    ) {
255
+        $texte = substr_replace(
256
+            $texte,
257
+            $full_marqueur,
258
+            $marqueur_pos,
259
+            strlen($marqueur)
260
+        );
261
+    }
262 262
 
263
-	return $texte;
263
+    return $texte;
264 264
 }
265 265
 
266 266
 /**
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
  * @return string
272 272
  */
273 273
 function f_queue_affiche_milieu($flux) {
274
-	$args = $flux['args'];
275
-	$res = "";
276
-	foreach ($args as $key => $arg) {
277
-		if (preg_match(",^id_,", $key) and is_numeric($arg) and $arg = intval($arg)) {
278
-			$objet = preg_replace(',^id_,', '', $key);
279
-			$res .= recuperer_fond('modeles/object_jobs_list', array('id_objet' => $arg, 'objet' => $objet, 'espace_prive' => 1),
280
-				array('ajax' => true));
281
-		}
282
-	}
283
-	if ($res) {
284
-		$flux['data'] = $res . $flux['data'];
285
-	}
274
+    $args = $flux['args'];
275
+    $res = "";
276
+    foreach ($args as $key => $arg) {
277
+        if (preg_match(",^id_,", $key) and is_numeric($arg) and $arg = intval($arg)) {
278
+            $objet = preg_replace(',^id_,', '', $key);
279
+            $res .= recuperer_fond('modeles/object_jobs_list', array('id_objet' => $arg, 'objet' => $objet, 'espace_prive' => 1),
280
+                array('ajax' => true));
281
+        }
282
+    }
283
+    if ($res) {
284
+        $flux['data'] = $res . $flux['data'];
285
+    }
286 286
 
287
-	return $flux;
287
+    return $flux;
288 288
 }
289 289
 
290 290
 /**
@@ -298,39 +298,39 @@  discard block
 block discarded – undo
298 298
  * @return array|bool
299 299
  */
300 300
 function trouver_objet_exec($exec) {
301
-	static $objet_exec = array();
302
-	if (!$exec) {
303
-		return false;
304
-	}
305
-	// cas particulier
306
-	if ($exec == "infos_perso") {
307
-		$exec = "auteur";
308
-		set_request('id_auteur', $GLOBALS['visiteur_session']['id_auteur']);
309
-	}
310
-	if (!isset($objet_exec[$exec])) {
311
-		$objet_exec[$exec] = false;
312
-		$infos = lister_tables_objets_sql();
313
-		foreach ($infos as $t => $info) {
314
-			if ($exec == $info['url_edit'] and $info['editable']) {
315
-				return $objet_exec[$exec] = array(
316
-					'edition' => $exec == $info['url_voir'] ? '' : true,
317
-					'table_objet_sql' => $t,
318
-					'table' => $info['table_objet'],
319
-					'type' => $info['type'],
320
-					'id_table_objet' => id_table_objet($info['type'])
321
-				);
322
-			}
323
-			if ($exec == $info['url_voir']) {
324
-				return $objet_exec[$exec] = array(
325
-					'edition' => false,
326
-					'table_objet_sql' => $t,
327
-					'table' => $info['table_objet'],
328
-					'type' => $info['type'],
329
-					'id_table_objet' => id_table_objet($info['type'])
330
-				);
331
-			}
332
-		}
333
-	}
301
+    static $objet_exec = array();
302
+    if (!$exec) {
303
+        return false;
304
+    }
305
+    // cas particulier
306
+    if ($exec == "infos_perso") {
307
+        $exec = "auteur";
308
+        set_request('id_auteur', $GLOBALS['visiteur_session']['id_auteur']);
309
+    }
310
+    if (!isset($objet_exec[$exec])) {
311
+        $objet_exec[$exec] = false;
312
+        $infos = lister_tables_objets_sql();
313
+        foreach ($infos as $t => $info) {
314
+            if ($exec == $info['url_edit'] and $info['editable']) {
315
+                return $objet_exec[$exec] = array(
316
+                    'edition' => $exec == $info['url_voir'] ? '' : true,
317
+                    'table_objet_sql' => $t,
318
+                    'table' => $info['table_objet'],
319
+                    'type' => $info['type'],
320
+                    'id_table_objet' => id_table_objet($info['type'])
321
+                );
322
+            }
323
+            if ($exec == $info['url_voir']) {
324
+                return $objet_exec[$exec] = array(
325
+                    'edition' => false,
326
+                    'table_objet_sql' => $t,
327
+                    'table' => $info['table_objet'],
328
+                    'type' => $info['type'],
329
+                    'id_table_objet' => id_table_objet($info['type'])
330
+                );
331
+            }
332
+        }
333
+    }
334 334
 
335
-	return $objet_exec[$exec];
335
+    return $objet_exec[$exec];
336 336
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$titre = "<title>["
92 92
 			. $nom_site_spip
93
-			. "] " . $match
93
+			. "] ".$match
94 94
 			. "</title>";
95 95
 
96 96
 		$texte = substr_replace($texte, $titre, $p + 6, 0);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		} elseif ($fond == "prive/squelettes/extra/$typepage") {
149 149
 			include_spip('inc/presentation_mini');
150 150
 			$flux['data']['texte'] = pipeline('affiche_droite',
151
-					array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte'])) . liste_objets_bloques($exec,
151
+					array('args' => $flux['args']['contexte'], 'data' => $flux['data']['texte'])).liste_objets_bloques($exec,
152 152
 					$flux['args']['contexte']);
153 153
 		} elseif ($fond == "prive/squelettes/hierarchie/$typepage" and $o[$exec]) {
154 154
 			// id non defini sur les formulaire de nouveaux objets
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 			) {
177 177
 				// inserer le formulaire de traduction
178 178
 				$flux['data']['texte'] = str_replace("<!--affiche_milieu-->", recuperer_fond('prive/objets/editer/traductions',
179
-						array('objet' => $objet, 'id_objet' => $id, 'espace_prive' => 1)) . "<!--affiche_milieu-->", $flux['data']['texte']);
179
+						array('objet' => $objet, 'id_objet' => $id, 'espace_prive' => 1))."<!--affiche_milieu-->", $flux['data']['texte']);
180 180
 				$flux['data']['texte'] = pipeline('afficher_fiche_objet', array(
181 181
 					'args' => array(
182 182
 						'contexte' => $flux['args']['contexte'],
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	$full_marqueur = "$ouvrir$marqueur$fermer";
239 239
 
240 240
 	// Le marqueur est absent : on l'ajoute avant l'élément indiqué
241
-	if ($marqueur_pos  === false) {
241
+	if ($marqueur_pos === false) {
242 242
 		$texte = preg_replace(
243 243
 			",$inserer_avant,",
244 244
 			"$full_marqueur\\0",
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	} elseif (
251 251
 		$marqueur_pos !== false
252 252
 		and $encapsuler
253
-		and substr($texte, $marqueur_pos-strlen($ouvrir), strlen($ouvrir)) !== $ouvrir
253
+		and substr($texte, $marqueur_pos - strlen($ouvrir), strlen($ouvrir)) !== $ouvrir
254 254
 	) {
255 255
 		$texte = substr_replace(
256 256
 			$texte,
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		}
282 282
 	}
283 283
 	if ($res) {
284
-		$flux['data'] = $res . $flux['data'];
284
+		$flux['data'] = $res.$flux['data'];
285 285
 	}
286 286
 
287 287
 	return $flux;
Please login to merge, or discard this patch.