Completed
Push — master ( d9f4e3...31f563 )
by cam
04:21
created
ecrire/inc/filtres_alertes.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
  *     Pile complétée par le code à générer
43 43
  */
44 44
 function balise_ALERTE_dist($p) {
45
-	$_texte = interprete_argument_balise(1, $p);
46
-	$_titre = interprete_argument_balise(2, $p);
47
-	$_class = interprete_argument_balise(3, $p);
48
-	$_role  = interprete_argument_balise(4, $p);
49
-	$_id    = interprete_argument_balise(5, $p);
50
-	$_texte = ($_texte ? $_texte     : "''");
51
-	$_titre = ($_titre ? ", $_titre" : ", ''");
52
-	$_class = (($_class and $_class !== "''") ? ", $_class" : ", 'notice'"); // cf. @note
53
-	$_role  = ($_role  ? ", $_role"  : ", 'alert'");
54
-	$_id    = ($_id    ? ", $_id"    : '');
55
-
56
-	$f = chercher_filtre('message_alerte');
57
-	$p->code = "$f($_texte$_titre$_class$_role$_id)";
58
-	$p->interdire_scripts = false;
59
-
60
-	return $p;
45
+    $_texte = interprete_argument_balise(1, $p);
46
+    $_titre = interprete_argument_balise(2, $p);
47
+    $_class = interprete_argument_balise(3, $p);
48
+    $_role  = interprete_argument_balise(4, $p);
49
+    $_id    = interprete_argument_balise(5, $p);
50
+    $_texte = ($_texte ? $_texte     : "''");
51
+    $_titre = ($_titre ? ", $_titre" : ", ''");
52
+    $_class = (($_class and $_class !== "''") ? ", $_class" : ", 'notice'"); // cf. @note
53
+    $_role  = ($_role  ? ", $_role"  : ", 'alert'");
54
+    $_id    = ($_id    ? ", $_id"    : '');
55
+
56
+    $f = chercher_filtre('message_alerte');
57
+    $p->code = "$f($_texte$_titre$_class$_role$_id)";
58
+    $p->interdire_scripts = false;
59
+
60
+    return $p;
61 61
 }
62 62
 
63 63
 /**
@@ -84,20 +84,20 @@  discard block
 block discarded – undo
84 84
  *     Pile complétée par le code à générer
85 85
  */
86 86
 function balise_ALERTE_OUVRIR_dist($p) {
87
-	$_titre = interprete_argument_balise(1, $p);
88
-	$_class = interprete_argument_balise(2, $p);
89
-	$_role  = interprete_argument_balise(3, $p);
90
-	$_id    = interprete_argument_balise(4, $p);
91
-	$_titre = ($_titre ? "$_titre"   : "''");
92
-	$_class = (($_class and $_class !== "''") ? ", $_class" : ", 'notice'"); // cf. @note
93
-	$_role  = ($_role  ? ", $_role"  : ", 'alert'");
94
-	$_id    = ($_id    ? ", $_id"    : '');
95
-
96
-	$f = chercher_filtre('message_alerte_ouvrir');
97
-	$p->code = "$f($_titre$_class$_role$_id)";
98
-	$p->interdire_scripts = false;
99
-
100
-	return $p;
87
+    $_titre = interprete_argument_balise(1, $p);
88
+    $_class = interprete_argument_balise(2, $p);
89
+    $_role  = interprete_argument_balise(3, $p);
90
+    $_id    = interprete_argument_balise(4, $p);
91
+    $_titre = ($_titre ? "$_titre"   : "''");
92
+    $_class = (($_class and $_class !== "''") ? ", $_class" : ", 'notice'"); // cf. @note
93
+    $_role  = ($_role  ? ", $_role"  : ", 'alert'");
94
+    $_id    = ($_id    ? ", $_id"    : '');
95
+
96
+    $f = chercher_filtre('message_alerte_ouvrir');
97
+    $p->code = "$f($_titre$_class$_role$_id)";
98
+    $p->interdire_scripts = false;
99
+
100
+    return $p;
101 101
 }
102 102
 
103 103
 /**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
  *     Pile complétée par le code à générer
120 120
  */
121 121
 function balise_ALERTE_FERMER_dist($p) {
122
-	$f = chercher_filtre('message_alerte_fermer');
123
-	$p->code = "$f()";
124
-	$p->interdire_scripts = false;
122
+    $f = chercher_filtre('message_alerte_fermer');
123
+    $p->code = "$f()";
124
+    $p->interdire_scripts = false;
125 125
 
126
-	return $p;
126
+    return $p;
127 127
 }
128 128
 
129 129
 /**
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function message_alerte(string $texte, string $titre = '', string $class = '', string $role = '', string $id = '') : string {
153 153
 
154
-	$message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
155
-	$message_alerte_fermer = chercher_filtre('message_alerte_fermer');
156
-	$message =
157
-		$message_alerte_ouvrir($titre, $class, $role, $id) .
158
-		$texte .
159
-		$message_alerte_fermer();
154
+    $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
155
+    $message_alerte_fermer = chercher_filtre('message_alerte_fermer');
156
+    $message =
157
+        $message_alerte_ouvrir($titre, $class, $role, $id) .
158
+        $texte .
159
+        $message_alerte_fermer();
160 160
 
161
-	return $message;
161
+    return $message;
162 162
 }
163 163
 
164 164
 /**
@@ -184,51 +184,51 @@  discard block
 block discarded – undo
184 184
  */
185 185
 function message_alerte_ouvrir(string $titre = '', string $class = '', string $role = '', string $id = '') : string {
186 186
 
187
-	$prive = test_espace_prive();
188
-
189
-	// Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
190
-	$types = [
191
-		'notice',
192
-		'error',
193
-		'success',
194
-		'info',
195
-	];
196
-	$type  = array_intersect(explode(' ', $class), $types);
197
-	$type  = reset($type) ?: '';
198
-	$class = trim(str_replace($types, '', $class) . " $type");
199
-
200
-	// Classes
201
-	$class_racine = 'msg-alert';
202
-	$clearfix     = ($prive ? 'clearfix' : '');
203
-	$class_alerte = "$class_racine $class";
204
-	$class_texte  = "${class_racine}__text $clearfix";
205
-	$class_titre  = "${class_racine}__heading";
206
-
207
-	// Titre : markup
208
-	$titre = trim($titre);
209
-	if (strlen($titre)) {
210
-		include_spip('inc/filtres');
211
-		// Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
212
-		$cherche_tag = ($prive ? '<h' : '<');
213
-		$wrap_tag    = ($prive ? '<h3>' : '<div>');
214
-		if (strpos($titre, $cherche_tag) !== 0) {
215
-			$titre = wrap($titre, $wrap_tag);
216
-		}
217
-		// puis on ajoute la classe
218
-		$titre = ajouter_class($titre, $class_titre);
219
-	}
220
-
221
-	// Attributs
222
-	$attr_role = ($role ? "role=\"$role\"" : '');
223
-	$attr_id   = ($id ? "id=\"$id\"" : '');
224
-	$attr_data = ($type ? "data-alert=\"$type\"" : '');
225
-
226
-	$message =
227
-		"<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
228
-			. $titre
229
-			. "<div class=\"$class_texte\">";
230
-
231
-	return $message;
187
+    $prive = test_espace_prive();
188
+
189
+    // Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
190
+    $types = [
191
+        'notice',
192
+        'error',
193
+        'success',
194
+        'info',
195
+    ];
196
+    $type  = array_intersect(explode(' ', $class), $types);
197
+    $type  = reset($type) ?: '';
198
+    $class = trim(str_replace($types, '', $class) . " $type");
199
+
200
+    // Classes
201
+    $class_racine = 'msg-alert';
202
+    $clearfix     = ($prive ? 'clearfix' : '');
203
+    $class_alerte = "$class_racine $class";
204
+    $class_texte  = "${class_racine}__text $clearfix";
205
+    $class_titre  = "${class_racine}__heading";
206
+
207
+    // Titre : markup
208
+    $titre = trim($titre);
209
+    if (strlen($titre)) {
210
+        include_spip('inc/filtres');
211
+        // Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
212
+        $cherche_tag = ($prive ? '<h' : '<');
213
+        $wrap_tag    = ($prive ? '<h3>' : '<div>');
214
+        if (strpos($titre, $cherche_tag) !== 0) {
215
+            $titre = wrap($titre, $wrap_tag);
216
+        }
217
+        // puis on ajoute la classe
218
+        $titre = ajouter_class($titre, $class_titre);
219
+    }
220
+
221
+    // Attributs
222
+    $attr_role = ($role ? "role=\"$role\"" : '');
223
+    $attr_id   = ($id ? "id=\"$id\"" : '');
224
+    $attr_data = ($type ? "data-alert=\"$type\"" : '');
225
+
226
+    $message =
227
+        "<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
228
+            . $titre
229
+            . "<div class=\"$class_texte\">";
230
+
231
+    return $message;
232 232
 }
233 233
 
234 234
 /**
@@ -242,5 +242,5 @@  discard block
 block discarded – undo
242 242
  *     HTML de fin de l'alerte
243 243
  */
244 244
 function message_alerte_fermer() : string {
245
-	return '</div></div>';
245
+    return '</div></div>';
246 246
 }
Please login to merge, or discard this patch.
ecrire/inc/pipelines_ecrire.php 1 patch
Indentation   +204 added lines, -204 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,36 +233,36 @@  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
-	if ($texte) {
237
-		$encapsuler = (($ouvrir and $fermer) ? true : false);
238
-		$marqueur_pos = strpos($texte, $marqueur);
239
-		$full_marqueur = "$ouvrir$marqueur$fermer";
236
+    if ($texte) {
237
+        $encapsuler = (($ouvrir and $fermer) ? true : false);
238
+        $marqueur_pos = strpos($texte, $marqueur);
239
+        $full_marqueur = "$ouvrir$marqueur$fermer";
240 240
 
241
-		// Le marqueur est absent : on l'ajoute avant l'élément indiqué
242
-		if ($marqueur_pos  === false) {
243
-			$texte = preg_replace(
244
-				",$inserer_avant,",
245
-				"$full_marqueur\\0",
246
-				$texte
247
-			);
248
-		// Le marqueur est présent mais pas encapsulé : on ajoute les balises ouvrantes et fermantes.
249
-		// Pour vérifier, on prend le texte précédent et on regarde si ça correspond à la balise ouvrante.
250
-		// Il ne faut donc aucun espace blanc en trop.
251
-		} elseif (
252
-			$marqueur_pos !== false
253
-			and $encapsuler
254
-			and substr($texte, $marqueur_pos-strlen($ouvrir), strlen($ouvrir)) !== $ouvrir
255
-		) {
256
-			$texte = substr_replace(
257
-				$texte,
258
-				$full_marqueur,
259
-				$marqueur_pos,
260
-				strlen($marqueur)
261
-			);
262
-		}
263
-	}
241
+        // Le marqueur est absent : on l'ajoute avant l'élément indiqué
242
+        if ($marqueur_pos  === false) {
243
+            $texte = preg_replace(
244
+                ",$inserer_avant,",
245
+                "$full_marqueur\\0",
246
+                $texte
247
+            );
248
+        // Le marqueur est présent mais pas encapsulé : on ajoute les balises ouvrantes et fermantes.
249
+        // Pour vérifier, on prend le texte précédent et on regarde si ça correspond à la balise ouvrante.
250
+        // Il ne faut donc aucun espace blanc en trop.
251
+        } elseif (
252
+            $marqueur_pos !== false
253
+            and $encapsuler
254
+            and substr($texte, $marqueur_pos-strlen($ouvrir), strlen($ouvrir)) !== $ouvrir
255
+        ) {
256
+            $texte = substr_replace(
257
+                $texte,
258
+                $full_marqueur,
259
+                $marqueur_pos,
260
+                strlen($marqueur)
261
+            );
262
+        }
263
+    }
264 264
 
265
-	return $texte;
265
+    return $texte;
266 266
 }
267 267
 
268 268
 /**
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
  * @return string
274 274
  */
275 275
 function f_queue_affiche_milieu($flux) {
276
-	$args = $flux['args'];
277
-	$res = "";
278
-	foreach ($args as $key => $arg) {
279
-		if (preg_match(",^id_,", $key) and is_numeric($arg) and $arg = intval($arg)) {
280
-			$objet = preg_replace(',^id_,', '', $key);
281
-			$res .= recuperer_fond('modeles/object_jobs_list', array('id_objet' => $arg, 'objet' => $objet, 'espace_prive' => 1),
282
-				array('ajax' => true));
283
-		}
284
-	}
285
-	if ($res) {
286
-		$flux['data'] = $res . $flux['data'];
287
-	}
276
+    $args = $flux['args'];
277
+    $res = "";
278
+    foreach ($args as $key => $arg) {
279
+        if (preg_match(",^id_,", $key) and is_numeric($arg) and $arg = intval($arg)) {
280
+            $objet = preg_replace(',^id_,', '', $key);
281
+            $res .= recuperer_fond('modeles/object_jobs_list', array('id_objet' => $arg, 'objet' => $objet, 'espace_prive' => 1),
282
+                array('ajax' => true));
283
+        }
284
+    }
285
+    if ($res) {
286
+        $flux['data'] = $res . $flux['data'];
287
+    }
288 288
 
289
-	return $flux;
289
+    return $flux;
290 290
 }
291 291
 
292 292
 /**
@@ -300,39 +300,39 @@  discard block
 block discarded – undo
300 300
  * @return array|bool
301 301
  */
302 302
 function trouver_objet_exec($exec) {
303
-	static $objet_exec = array();
304
-	if (!$exec) {
305
-		return false;
306
-	}
307
-	// cas particulier
308
-	if ($exec == "infos_perso") {
309
-		$exec = "auteur";
310
-		set_request('id_auteur', $GLOBALS['visiteur_session']['id_auteur']);
311
-	}
312
-	if (!isset($objet_exec[$exec])) {
313
-		$objet_exec[$exec] = false;
314
-		$infos = lister_tables_objets_sql();
315
-		foreach ($infos as $t => $info) {
316
-			if ($exec == $info['url_edit'] and $info['editable']) {
317
-				return $objet_exec[$exec] = array(
318
-					'edition' => $exec == $info['url_voir'] ? '' : true,
319
-					'table_objet_sql' => $t,
320
-					'table' => $info['table_objet'],
321
-					'type' => $info['type'],
322
-					'id_table_objet' => id_table_objet($info['type'])
323
-				);
324
-			}
325
-			if ($exec == $info['url_voir']) {
326
-				return $objet_exec[$exec] = array(
327
-					'edition' => false,
328
-					'table_objet_sql' => $t,
329
-					'table' => $info['table_objet'],
330
-					'type' => $info['type'],
331
-					'id_table_objet' => id_table_objet($info['type'])
332
-				);
333
-			}
334
-		}
335
-	}
303
+    static $objet_exec = array();
304
+    if (!$exec) {
305
+        return false;
306
+    }
307
+    // cas particulier
308
+    if ($exec == "infos_perso") {
309
+        $exec = "auteur";
310
+        set_request('id_auteur', $GLOBALS['visiteur_session']['id_auteur']);
311
+    }
312
+    if (!isset($objet_exec[$exec])) {
313
+        $objet_exec[$exec] = false;
314
+        $infos = lister_tables_objets_sql();
315
+        foreach ($infos as $t => $info) {
316
+            if ($exec == $info['url_edit'] and $info['editable']) {
317
+                return $objet_exec[$exec] = array(
318
+                    'edition' => $exec == $info['url_voir'] ? '' : true,
319
+                    'table_objet_sql' => $t,
320
+                    'table' => $info['table_objet'],
321
+                    'type' => $info['type'],
322
+                    'id_table_objet' => id_table_objet($info['type'])
323
+                );
324
+            }
325
+            if ($exec == $info['url_voir']) {
326
+                return $objet_exec[$exec] = array(
327
+                    'edition' => false,
328
+                    'table_objet_sql' => $t,
329
+                    'table' => $info['table_objet'],
330
+                    'type' => $info['type'],
331
+                    'id_table_objet' => id_table_objet($info['type'])
332
+                );
333
+            }
334
+        }
335
+    }
336 336
 
337
-	return $objet_exec[$exec];
337
+    return $objet_exec[$exec];
338 338
 }
Please login to merge, or discard this patch.