Completed
Push — master ( 11381c...fc67b6 )
by cam
01:49
created
ecrire/inc/icone_renommer.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -10,71 +10,71 @@
 block discarded – undo
10 10
 \***************************************************************************/
11 11
 
12 12
 if (!defined('_ECRIRE_INC_VERSION')) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 include_spip('inc/boutons');
17 17
 include_spip('base/objets');
18 18
 
19 19
 function inc_icone_renommer_dist($fond, $fonction) {
20
-	$size = 24;
21
-	if (
22
-		preg_match('/(?:-(\d{1,3}))?([.](gif|png|svg))?$/i', (string) $fond, $match)
23
-		&& (isset($match[0]) && $match[0] || isset($match[1]) && $match[1])
24
-	) {
25
-		if (isset($match[1]) && $match[1]) {
26
-			$size = $match[1];
27
-		}
28
-		$type = substr((string) $fond, 0, -strlen($match[0]));
29
-		if (!isset($match[2]) || !$match[2]) {
30
-			$fond .= '.png';
31
-		}
32
-	} else {
33
-		$type = $fond;
34
-		$fond .= '.png';
35
-	}
20
+    $size = 24;
21
+    if (
22
+        preg_match('/(?:-(\d{1,3}))?([.](gif|png|svg))?$/i', (string) $fond, $match)
23
+        && (isset($match[0]) && $match[0] || isset($match[1]) && $match[1])
24
+    ) {
25
+        if (isset($match[1]) && $match[1]) {
26
+            $size = $match[1];
27
+        }
28
+        $type = substr((string) $fond, 0, -strlen($match[0]));
29
+        if (!isset($match[2]) || !$match[2]) {
30
+            $fond .= '.png';
31
+        }
32
+    } else {
33
+        $type = $fond;
34
+        $fond .= '.png';
35
+    }
36 36
 
37
-	$rtl = false;
38
-	if (preg_match(',[-_]rtl$,i', (string) $type, $match)) {
39
-		$rtl = true;
40
-		$type = substr((string) $type, 0, -strlen($match[0]));
41
-	}
37
+    $rtl = false;
38
+    if (preg_match(',[-_]rtl$,i', (string) $type, $match)) {
39
+        $rtl = true;
40
+        $type = substr((string) $type, 0, -strlen($match[0]));
41
+    }
42 42
 
43
-	// objet_type garde invariant tout ce qui ne commence par par id_, spip_
44
-	// et ne finit pas par un s, sauf si c'est une exception declaree
45
-	$type = objet_type($type, false);
43
+    // objet_type garde invariant tout ce qui ne commence par par id_, spip_
44
+    // et ne finit pas par un s, sauf si c'est une exception declaree
45
+    $type = objet_type($type, false);
46 46
 
47
-	$dir = 'images/';
48
-	$f = "$type-$size.png";
49
-	if ($icone = find_in_theme($dir . $f)) {
50
-		$dir = dirname((string) $icone);
51
-		$fond = $icone;
47
+    $dir = 'images/';
48
+    $f = "$type-$size.png";
49
+    if ($icone = find_in_theme($dir . $f)) {
50
+        $dir = dirname((string) $icone);
51
+        $fond = $icone;
52 52
 
53
-		if (
54
-			$rtl
55
-			&& ($fr = $dir . '/' . str_replace("$type-", "$type-rtl-", basename((string) $icone)))
56
-			&& file_exists($fr)
57
-		) {
58
-			$fond = $fr;
59
-		}
53
+        if (
54
+            $rtl
55
+            && ($fr = $dir . '/' . str_replace("$type-", "$type-rtl-", basename((string) $icone)))
56
+            && file_exists($fr)
57
+        ) {
58
+            $fond = $fr;
59
+        }
60 60
 
61
-		$action = $fonction;
62
-		if ($action == 'supprimer.gif') {
63
-			$action = 'del';
64
-		} elseif ($action == 'creer.gif') {
65
-			$action = 'new';
66
-		} elseif ($action == 'edit.gif') {
67
-			$action = 'edit';
68
-		}
61
+        $action = $fonction;
62
+        if ($action == 'supprimer.gif') {
63
+            $action = 'del';
64
+        } elseif ($action == 'creer.gif') {
65
+            $action = 'new';
66
+        } elseif ($action == 'edit.gif') {
67
+            $action = 'edit';
68
+        }
69 69
 
70
-		$fonction = '';
71
-		if (in_array($action, ['add','del', 'new', 'edit', 'config'])) {
72
-			$fonction = $action;
73
-		}
70
+        $fonction = '';
71
+        if (in_array($action, ['add','del', 'new', 'edit', 'config'])) {
72
+            $fonction = $action;
73
+        }
74 74
 
75
-		// c'est bon !
76
-		return [$fond, $fonction];
77
-	}
75
+        // c'est bon !
76
+        return [$fond, $fonction];
77
+    }
78 78
 
79
-	return [$fond, $fonction];
79
+    return [$fond, $fonction];
80 80
 }
Please login to merge, or discard this patch.
ecrire/inc/lien_court.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 \***************************************************************************/
11 11
 
12 12
 if (!defined('_ECRIRE_INC_VERSION')) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 /*
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * http://zoumzamzouilam/truc/chose/machin..."
22 22
  */
23 23
 function inc_lien_court($url) {
24
-	$long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40;
25
-	$coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35;
24
+    $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40;
25
+    $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35;
26 26
 
27
-	if (strlen((string) $url) > $long_url) {
28
-		$url = substr((string) $url, 0, $coupe_url) . '...';
29
-	}
27
+    if (strlen((string) $url) > $long_url) {
28
+        $url = substr((string) $url, 0, $coupe_url) . '...';
29
+    }
30 30
 
31
-	return $url;
31
+    return $url;
32 32
 }
Please login to merge, or discard this patch.
ecrire/inc/selectionner.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/filtres');
@@ -45,56 +45,56 @@  discard block
 block discarded – undo
45 45
  **/
46 46
 function inc_selectionner_dist($sel, $idom = '', $exclus = 0, $aff_racine = false, $recur = true, $do = 'aff') {
47 47
 
48
-	if ($recur) {
49
-		$recur = mini_hier($sel);
50
-	} else {
51
-		$sel = 0;
52
-	}
53
-
54
-	if ($aff_racine) {
55
-		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
56
-		$idom3 = $idom . '_selection';
57
-
58
-		$onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
59
-
60
-		$ondbClick = strtr(
61
-			str_replace(
62
-				"'",
63
-				'’',
64
-				str_replace(
65
-					'"',
66
-					'"',
67
-					(string) textebrut(_T('info_racine_site'))
68
-				)
69
-			),
70
-			"\n\r",
71
-			'  '
72
-		);
73
-
74
-		$js_func = $do . '_selection_titre';
75
-		$ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
76
-
77
-		$aff_racine = "<div class='petit-item petite-racine item'>"
78
-			. "<a href='#'"
79
-			. 'onclick="'
80
-			. $onClick
81
-			. "\"\nondbclick=\""
82
-			. $ondbClick
83
-			. $onClick
84
-			. '">'
85
-			. _T('info_racine_site')
86
-			. '</a></div>';
87
-	}
88
-
89
-	$url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
90
-
91
-	$plonger = charger_fonction('plonger', 'inc');
92
-	$plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
93
-
94
-	// url completee par la fonction JS onkeypress_rechercher
95
-	$url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
96
-
97
-	return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
48
+    if ($recur) {
49
+        $recur = mini_hier($sel);
50
+    } else {
51
+        $sel = 0;
52
+    }
53
+
54
+    if ($aff_racine) {
55
+        $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
56
+        $idom3 = $idom . '_selection';
57
+
58
+        $onClick = "jQuery(this).parent().addClass('on');jQuery('#choix_parent_principal .on').removeClass('on'); aff_selection(0, '$idom3', '$info', event);return false;";
59
+
60
+        $ondbClick = strtr(
61
+            str_replace(
62
+                "'",
63
+                '&#8217;',
64
+                str_replace(
65
+                    '"',
66
+                    '&#34;',
67
+                    (string) textebrut(_T('info_racine_site'))
68
+                )
69
+            ),
70
+            "\n\r",
71
+            '  '
72
+        );
73
+
74
+        $js_func = $do . '_selection_titre';
75
+        $ondbClick = "$js_func('$ondbClick',0,'selection_rubrique','id_parent');";
76
+
77
+        $aff_racine = "<div class='petit-item petite-racine item'>"
78
+            . "<a href='#'"
79
+            . 'onclick="'
80
+            . $onClick
81
+            . "\"\nondbclick=\""
82
+            . $ondbClick
83
+            . $onClick
84
+            . '">'
85
+            . _T('info_racine_site')
86
+            . '</a></div>';
87
+    }
88
+
89
+    $url_init = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclus&id=0&col=1&do=$do");
90
+
91
+    $plonger = charger_fonction('plonger', 'inc');
92
+    $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus, $do);
93
+
94
+    // url completee par la fonction JS onkeypress_rechercher
95
+    $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&do=$do&type=");
96
+
97
+    return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init);
98 98
 }
99 99
 
100 100
 /**
@@ -112,58 +112,58 @@  discard block
 block discarded – undo
112 112
  **/
113 113
 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init = '') {
114 114
 
115
-	$idom1 = $idom . '_champ_recherche';
116
-	$idom2 = $idom . '_principal';
117
-	$idom3 = $idom . '_selection';
118
-	$idom4 = $idom . '_col_1';
119
-	$idom5 = 'img_' . $idom4;
120
-	$idom6 = $idom . '_fonc';
121
-
122
-	return "<div id='$idom'>"
123
-	. "<a id='$idom6' style='visibility: hidden;'"
124
-	. ($url_init ? "\nhref='$url_init'" : '')
125
-	. '></a>'
126
-	. "<div class='recherche_rapide_parent formulaire_recherche'>"
127
-	. http_img_pack(
128
-		'loader.svg',
129
-		'',
130
-		"class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
131
-	)
132
-	. ''
133
-	. "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
134
-	// eliminer Return car il provoque la soumission (balise unique)
135
-	// et eliminer Tab pour la navigation au clavier
136
-	// ce serait encore mieux de ne le faire que s'il y a encore plusieurs
137
-	// resultats retournes par la recherche
138
-	. "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
139
-	// lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
140
-	. "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
141
-	// la destination de la recherche
142
-	. "'$idom4'"
115
+    $idom1 = $idom . '_champ_recherche';
116
+    $idom2 = $idom . '_principal';
117
+    $idom3 = $idom . '_selection';
118
+    $idom4 = $idom . '_col_1';
119
+    $idom5 = 'img_' . $idom4;
120
+    $idom6 = $idom . '_fonc';
121
+
122
+    return "<div id='$idom'>"
123
+    . "<a id='$idom6' style='visibility: hidden;'"
124
+    . ($url_init ? "\nhref='$url_init'" : '')
125
+    . '></a>'
126
+    . "<div class='recherche_rapide_parent formulaire_recherche'>"
127
+    . http_img_pack(
128
+        'loader.svg',
129
+        '',
130
+        "class='loader' style='visibility: hidden;float:" . $GLOBALS['spip_lang_right'] . "' id='$idom5'"
131
+    )
132
+    . ''
133
+    . "<input style='width: 10em;float:" . $GLOBALS['spip_lang_right'] . ";' type='text' class='text search' id='$idom1' placeholder='" . _T('info_rechercher') . "'"
134
+    // eliminer Return car il provoque la soumission (balise unique)
135
+    // et eliminer Tab pour la navigation au clavier
136
+    // ce serait encore mieux de ne le faire que s'il y a encore plusieurs
137
+    // resultats retournes par la recherche
138
+    . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3 || k==9){return false;}\""
139
+    // lancer la recherche apres le filtrage ci-dessus sauf sur le tab (navigation au clavier)
140
+    . "\nonkeyup=\"if(event.keyCode==9){return false;};return onkey_rechercher(this.value,"
141
+    // la destination de la recherche
142
+    . "'$idom4'"
143 143
 #	. "this.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.id"
144
-	. ",'"
145
-	// l'url effectuant la recherche
146
-	. $url
147
-	. "',"
148
-	// le noeud contenant un gif anime
149
-	// . "'idom5'"
150
-	. 'this.parentNode.previousSibling.firstChild'
151
-	. ",'"
152
-	// la valeur de l'attribut Name a remplir
153
-	. $name
154
-	. "','"
155
-	// noeud invisible memorisant l'URL initiale (pour re-initialisation)
156
-	. $idom6
157
-	. "')\""
158
-	. ' />'
159
-	. "\n</div>"
160
-	. ($racine ? "<div>$racine</div>" : '')
161
-	. "<div id='"
162
-	. $idom2
163
-	. "'><div id='$idom4'"
164
-	. " class=''>"
165
-	. $liste
166
-	. "</div></div>\n<div id='$idom3'></div></div>\n";
144
+    . ",'"
145
+    // l'url effectuant la recherche
146
+    . $url
147
+    . "',"
148
+    // le noeud contenant un gif anime
149
+    // . "'idom5'"
150
+    . 'this.parentNode.previousSibling.firstChild'
151
+    . ",'"
152
+    // la valeur de l'attribut Name a remplir
153
+    . $name
154
+    . "','"
155
+    // noeud invisible memorisant l'URL initiale (pour re-initialisation)
156
+    . $idom6
157
+    . "')\""
158
+    . ' />'
159
+    . "\n</div>"
160
+    . ($racine ? "<div>$racine</div>" : '')
161
+    . "<div id='"
162
+    . $idom2
163
+    . "'><div id='$idom4'"
164
+    . " class=''>"
165
+    . $liste
166
+    . "</div></div>\n<div id='$idom3'></div></div>\n";
167 167
 }
168 168
 
169 169
 /**
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
  **/
176 176
 function mini_hier($id_rubrique) {
177 177
 
178
-	$liste = $id_rubrique;
179
-	$id_rubrique = (int) $id_rubrique;
180
-	while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
181
-		$liste = $id_rubrique . ",$liste";
182
-	}
178
+    $liste = $id_rubrique;
179
+    $id_rubrique = (int) $id_rubrique;
180
+    while ($id_rubrique = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique = ' . $id_rubrique)) {
181
+        $liste = $id_rubrique . ",$liste";
182
+    }
183 183
 
184
-	return explode(',', "0,$liste");
184
+    return explode(',', "0,$liste");
185 185
 }
Please login to merge, or discard this patch.
ecrire/inc/lien.php 1 patch
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 \***************************************************************************/
11 11
 
12 12
 if (!defined('_ECRIRE_INC_VERSION')) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 include_spip('base/abstract_sql');
@@ -36,42 +36,42 @@  discard block
 block discarded – undo
36 36
  * @return string
37 37
  */
38 38
 function inc_lien_dist(
39
-	$lien,
40
-	$texte = '',
41
-	$class = '',
42
-	$title = '',
43
-	$hlang = '',
44
-	$rel = '',
45
-	string $connect = '',
46
-	$env = []
39
+    $lien,
40
+    $texte = '',
41
+    $class = '',
42
+    $title = '',
43
+    $hlang = '',
44
+    $rel = '',
45
+    string $connect = '',
46
+    $env = []
47 47
 ) {
48
-	return $lien;
48
+    return $lien;
49 49
 }
50 50
 
51 51
 function expanser_liens($t, string $connect = '', $env = []) {
52 52
 
53
-	$t = pipeline('pre_liens', $t);
53
+    $t = pipeline('pre_liens', $t);
54 54
 
55
-	// on passe a traiter_modeles la liste des liens reperes pour lui permettre
56
-	// de remettre le texte d'origine dans les parametres du modele
57
-	$t = traiter_modeles($t, false, false, $connect);
55
+    // on passe a traiter_modeles la liste des liens reperes pour lui permettre
56
+    // de remettre le texte d'origine dans les parametres du modele
57
+    $t = traiter_modeles($t, false, false, $connect);
58 58
 
59
-	return $t;
59
+    return $t;
60 60
 }
61 61
 
62 62
 // Meme analyse mais pour eliminer les liens
63 63
 // et ne laisser que leur titre, a expliciter si ce n'est fait
64 64
 function nettoyer_raccourcis_typo($texte, string $connect = '') {
65
-	return $texte;
65
+    return $texte;
66 66
 }
67 67
 
68 68
 // Repere dans la partie texte d'un raccourci [texte->...]
69 69
 // la langue et la bulle eventuelles
70 70
 function traiter_raccourci_lien_atts($texte) {
71
-	$bulle = '';
72
-	$hlang = '';
71
+    $bulle = '';
72
+    $hlang = '';
73 73
 
74
-	return [trim((string) $texte), $bulle, $hlang];
74
+    return [trim((string) $texte), $bulle, $hlang];
75 75
 }
76 76
 
77 77
 define('_RACCOURCI_CHAPO', '/^(\W*)(\W*)(\w*\d+([?#].*)?)$/');
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  * @return string
88 88
  */
89 89
 function virtuel_redirige($virtuel, $url = false) {
90
-	return $virtuel;
90
+    return $virtuel;
91 91
 }
92 92
 
93 93
 // Cherche un lien du type [->raccourci 123]
@@ -100,56 +100,56 @@  discard block
 block discarded – undo
100 100
 // 'url':   seulement U  (i.e. generer_url_RACCOURCI)
101 101
 
102 102
 function calculer_url($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) {
103
-	$r = traiter_lien_implicite($ref, $texte, $pour, $connect);
103
+    $r = traiter_lien_implicite($ref, $texte, $pour, $connect);
104 104
 
105
-	return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo);
105
+    return $r ?: traiter_lien_explicite($ref, $texte, $pour, $connect, $echappe_typo);
106 106
 }
107 107
 
108 108
 define('_EXTRAIRE_LIEN', ',^\s*(?:' . _PROTOCOLES_STD . '):?/?/?\s*$,iS');
109 109
 
110 110
 function traiter_lien_explicite($ref, $texte = '', $pour = 'url', string $connect = '', $echappe_typo = true) {
111
-	if (preg_match(_EXTRAIRE_LIEN, (string) $ref)) {
112
-		return ($pour != 'tout') ? '' : ['', '', '', ''];
113
-	}
114
-
115
-	$lien = entites_html(trim((string) $ref));
116
-
117
-	// Liens explicites
118
-	if (!$texte) {
119
-		$texte = str_replace('"', '', (string) $lien);
120
-		// evite l'affichage de trops longues urls.
121
-		$lien_court = charger_fonction('lien_court', 'inc');
122
-		$texte = $lien_court($texte);
123
-		if ($echappe_typo) {
124
-			$texte = '<html>' . quote_amp($texte) . '</html>';
125
-		}
126
-	}
127
-
128
-	// petites corrections d'URL
129
-	if (preg_match('/^www\.[^@]+$/S', (string) $lien)) {
130
-		$lien = 'http://' . $lien;
131
-	} else {
132
-		if (strpos((string) $lien, '@') && email_valide($lien)) {
133
-			if (!$texte) {
134
-				$texte = $lien;
135
-			}
136
-			$lien = 'mailto:' . $lien;
137
-		}
138
-	}
139
-
140
-	if ($pour == 'url') {
141
-		return $lien;
142
-	}
143
-
144
-	if ($pour == 'titre') {
145
-		return $texte;
146
-	}
147
-
148
-	return ['url' => $lien, 'titre' => $texte];
111
+    if (preg_match(_EXTRAIRE_LIEN, (string) $ref)) {
112
+        return ($pour != 'tout') ? '' : ['', '', '', ''];
113
+    }
114
+
115
+    $lien = entites_html(trim((string) $ref));
116
+
117
+    // Liens explicites
118
+    if (!$texte) {
119
+        $texte = str_replace('"', '', (string) $lien);
120
+        // evite l'affichage de trops longues urls.
121
+        $lien_court = charger_fonction('lien_court', 'inc');
122
+        $texte = $lien_court($texte);
123
+        if ($echappe_typo) {
124
+            $texte = '<html>' . quote_amp($texte) . '</html>';
125
+        }
126
+    }
127
+
128
+    // petites corrections d'URL
129
+    if (preg_match('/^www\.[^@]+$/S', (string) $lien)) {
130
+        $lien = 'http://' . $lien;
131
+    } else {
132
+        if (strpos((string) $lien, '@') && email_valide($lien)) {
133
+            if (!$texte) {
134
+                $texte = $lien;
135
+            }
136
+            $lien = 'mailto:' . $lien;
137
+        }
138
+    }
139
+
140
+    if ($pour == 'url') {
141
+        return $lien;
142
+    }
143
+
144
+    if ($pour == 'titre') {
145
+        return $texte;
146
+    }
147
+
148
+    return ['url' => $lien, 'titre' => $texte];
149 149
 }
150 150
 
151 151
 function liens_implicite_glose_dist($texte, $id, $type, $args, $ancre, string $connect = '') {
152
-	return function_exists($f = 'glossaire_' . $ancre) ? $f($texte, $id) : glossaire_std($texte);
152
+    return function_exists($f = 'glossaire_' . $ancre) ? $f($texte, $id) : glossaire_std($texte);
153 153
 }
154 154
 
155 155
 /**
@@ -171,73 +171,73 @@  discard block
 block discarded – undo
171 171
  * @return array|bool|string
172 172
  */
173 173
 function traiter_lien_implicite($ref, $texte = '', $pour = 'url', $connect = '') {
174
-	$cible = $GLOBALS['lien_implicite_cible_public'] ?? null;
175
-	if (!($match = typer_raccourci($ref))) {
176
-		return false;
177
-	}
178
-
179
-	[$type, , $id, , $args, , $ancre] = array_pad($match, 7, null);
180
-
181
-	# attention dans le cas des sites le lien doit pointer non pas sur
182
-	# la page locale du site, mais directement sur le site lui-meme
183
-	$url = '';
184
-	if ($f = charger_fonction("implicite_$type", 'liens', true)) {
185
-		$url = $f($texte, $id, $type, $args, $ancre, $connect);
186
-	}
187
-
188
-	if (!$url) {
189
-		$url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? '');
190
-	}
191
-
192
-	if (!$url) {
193
-		return false;
194
-	}
195
-
196
-	if (is_array($url)) {
197
-		[$type, $id] = array_pad($url, 2, null);
198
-		$url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? '');
199
-	}
200
-
201
-	if ($pour === 'url') {
202
-		return $url;
203
-	}
204
-
205
-	$r = traiter_raccourci_titre($id, $type, $connect);
206
-	if ($r) {
207
-		$r['class'] = ($type == 'site') ? 'spip_out' : 'spip_in';
208
-	}
209
-
210
-	if ($texte = trim($texte)) {
211
-		$r['titre'] = $texte;
212
-	}
213
-
214
-	if (!@$r['titre']) {
215
-		$r['titre'] = _T($type) . " $id";
216
-	}
217
-
218
-	if ($pour == 'titre') {
219
-		return $r['titre'];
220
-	}
221
-
222
-	$r['url'] = $url;
223
-
224
-	// dans le cas d'un lien vers un doc, ajouter le type='mime/type'
225
-	if (
226
-		$type == 'document' && ($mime = sql_getfetsel(
227
-			'mime_type',
228
-			'spip_types_documents',
229
-			'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')',
230
-			'',
231
-			'',
232
-			'',
233
-			'',
234
-			$connect
235
-		))
236
-	) {
237
-		$r['mime'] = $mime;
238
-	}
239
-
240
-	return $r;
174
+    $cible = $GLOBALS['lien_implicite_cible_public'] ?? null;
175
+    if (!($match = typer_raccourci($ref))) {
176
+        return false;
177
+    }
178
+
179
+    [$type, , $id, , $args, , $ancre] = array_pad($match, 7, null);
180
+
181
+    # attention dans le cas des sites le lien doit pointer non pas sur
182
+    # la page locale du site, mais directement sur le site lui-meme
183
+    $url = '';
184
+    if ($f = charger_fonction("implicite_$type", 'liens', true)) {
185
+        $url = $f($texte, $id, $type, $args, $ancre, $connect);
186
+    }
187
+
188
+    if (!$url) {
189
+        $url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? '');
190
+    }
191
+
192
+    if (!$url) {
193
+        return false;
194
+    }
195
+
196
+    if (is_array($url)) {
197
+        [$type, $id] = array_pad($url, 2, null);
198
+        $url = generer_objet_url($id, $type, $args ?? '', $ancre ?? '', $cible, '', $connect ?? '');
199
+    }
200
+
201
+    if ($pour === 'url') {
202
+        return $url;
203
+    }
204
+
205
+    $r = traiter_raccourci_titre($id, $type, $connect);
206
+    if ($r) {
207
+        $r['class'] = ($type == 'site') ? 'spip_out' : 'spip_in';
208
+    }
209
+
210
+    if ($texte = trim($texte)) {
211
+        $r['titre'] = $texte;
212
+    }
213
+
214
+    if (!@$r['titre']) {
215
+        $r['titre'] = _T($type) . " $id";
216
+    }
217
+
218
+    if ($pour == 'titre') {
219
+        return $r['titre'];
220
+    }
221
+
222
+    $r['url'] = $url;
223
+
224
+    // dans le cas d'un lien vers un doc, ajouter le type='mime/type'
225
+    if (
226
+        $type == 'document' && ($mime = sql_getfetsel(
227
+            'mime_type',
228
+            'spip_types_documents',
229
+            'extension IN (' . sql_get_select('extension', 'spip_documents', 'id_document=' . sql_quote($id)) . ')',
230
+            '',
231
+            '',
232
+            '',
233
+            '',
234
+            $connect
235
+        ))
236
+    ) {
237
+        $r['mime'] = $mime;
238
+    }
239
+
240
+    return $r;
241 241
 }
242 242
 
243 243
 // analyse des raccourcis issus de [TITRE->RACCOURCInnn] et connexes
@@ -245,43 +245,43 @@  discard block
 block discarded – undo
245 245
 define('_RACCOURCI_URL', '/^\s*(\w*?)\s*(\d+)(\?(.*?))?(#([^\s]*))?\s*$/S');
246 246
 
247 247
 function typer_raccourci($lien) {
248
-	if (!preg_match(_RACCOURCI_URL, (string) $lien, $match)) {
249
-		return [];
250
-	}
251
-
252
-	$f = $match[1];
253
-	// valeur par defaut et alias historiques
254
-	if (!$f) {
255
-		$f = 'article';
256
-	} else {
257
-		if ($f == 'art') {
258
-			$f = 'article';
259
-		} else {
260
-			if ($f == 'br') {
261
-				$f = 'breve';
262
-			} else {
263
-				if ($f == 'rub') {
264
-					$f = 'rubrique';
265
-				} else {
266
-					if ($f == 'aut') {
267
-						$f = 'auteur';
268
-					} else {
269
-						if ($f == 'doc' || $f == 'im' || $f == 'img' || $f == 'image' || $f == 'emb') {
270
-							$f = 'document';
271
-						} else {
272
-							if (preg_match('/^br..?ve$/S', $f)) {
273
-								$f = 'breve'; # accents :(
274
-							}
275
-						}
276
-					}
277
-				}
278
-			}
279
-		}
280
-	}
281
-
282
-	$match[0] = $f;
283
-
284
-	return $match;
248
+    if (!preg_match(_RACCOURCI_URL, (string) $lien, $match)) {
249
+        return [];
250
+    }
251
+
252
+    $f = $match[1];
253
+    // valeur par defaut et alias historiques
254
+    if (!$f) {
255
+        $f = 'article';
256
+    } else {
257
+        if ($f == 'art') {
258
+            $f = 'article';
259
+        } else {
260
+            if ($f == 'br') {
261
+                $f = 'breve';
262
+            } else {
263
+                if ($f == 'rub') {
264
+                    $f = 'rubrique';
265
+                } else {
266
+                    if ($f == 'aut') {
267
+                        $f = 'auteur';
268
+                    } else {
269
+                        if ($f == 'doc' || $f == 'im' || $f == 'img' || $f == 'image' || $f == 'emb') {
270
+                            $f = 'document';
271
+                        } else {
272
+                            if (preg_match('/^br..?ve$/S', $f)) {
273
+                                $f = 'breve'; # accents :(
274
+                            }
275
+                        }
276
+                    }
277
+                }
278
+            }
279
+        }
280
+    }
281
+
282
+    $match[0] = $f;
283
+
284
+    return $match;
285 285
 }
286 286
 
287 287
 /**
@@ -296,44 +296,44 @@  discard block
 block discarded – undo
296 296
  * }
297 297
  **/
298 298
 function traiter_raccourci_titre($id, $type, $connect = null) {
299
-	$trouver_table = charger_fonction('trouver_table', 'base');
300
-	$desc = $trouver_table(table_objet($type));
299
+    $trouver_table = charger_fonction('trouver_table', 'base');
300
+    $desc = $trouver_table(table_objet($type));
301 301
 
302
-	if (!($desc && ($s = $desc['titre']))) {
303
-		return [];
304
-	}
302
+    if (!($desc && ($s = $desc['titre']))) {
303
+        return [];
304
+    }
305 305
 
306
-	$_id = $desc['key']['PRIMARY KEY'];
307
-	$r = sql_fetsel($s, $desc['table'], "$_id=$id", '', '', '', '', $connect);
306
+    $_id = $desc['key']['PRIMARY KEY'];
307
+    $r = sql_fetsel($s, $desc['table'], "$_id=$id", '', '', '', '', $connect);
308 308
 
309
-	if (!$r) {
310
-		return [];
311
-	}
309
+    if (!$r) {
310
+        return [];
311
+    }
312 312
 
313
-	$r['titre'] = supprimer_numero($r['titre']);
313
+    $r['titre'] = supprimer_numero($r['titre']);
314 314
 
315
-	if (!$r['titre'] && !empty($r['surnom'])) {
316
-		$r['titre'] = $r['surnom'];
317
-	}
315
+    if (!$r['titre'] && !empty($r['surnom'])) {
316
+        $r['titre'] = $r['surnom'];
317
+    }
318 318
 
319
-	if (!isset($r['lang'])) {
320
-		$r['lang'] = '';
321
-	}
319
+    if (!isset($r['lang'])) {
320
+        $r['lang'] = '';
321
+    }
322 322
 
323
-	return $r;
323
+    return $r;
324 324
 }
325 325
 
326 326
 //
327 327
 // Raccourcis ancre [#ancre<-]
328 328
 //
329 329
 function traiter_raccourci_ancre($letexte) {
330
-	return $letexte;
330
+    return $letexte;
331 331
 }
332 332
 
333 333
 function traiter_raccourci_glossaire($texte) {
334
-	return $texte;
334
+    return $texte;
335 335
 }
336 336
 
337 337
 function glossaire_std($terme) {
338
-	return $terme;
338
+    return $terme;
339 339
 }
Please login to merge, or discard this patch.
ecrire/inc/boutons.php 1 patch
Indentation   +33 added lines, -33 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
 /**
@@ -34,35 +34,35 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function definir_barre_onglets($script) {
36 36
 
37
-	$onglets = [];
38
-	$liste_onglets = [];
37
+    $onglets = [];
38
+    $liste_onglets = [];
39 39
 
40
-	// ajouter les onglets issus des plugin via paquet.xml
41
-	if (function_exists('onglets_plugins')) {
42
-		$liste_onglets = onglets_plugins();
43
-	}
40
+    // ajouter les onglets issus des plugin via paquet.xml
41
+    if (function_exists('onglets_plugins')) {
42
+        $liste_onglets = onglets_plugins();
43
+    }
44 44
 
45 45
 
46
-	foreach ($liste_onglets as $id => $infos) {
47
-		if (
48
-			($parent = $infos['parent'])
49
-			&& $parent == $script
50
-			&& autoriser('onglet', "_$id")
51
-		) {
52
-			$onglets[$id] = new Bouton(
53
-				isset($infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
54
-				$infos['titre'],  // titre
55
-				(isset($infos['action']) && $infos['action'])
56
-					? generer_url_ecrire(
57
-						$infos['action'],
58
-						(isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : ''
59
-					)
60
-					: null
61
-			);
62
-		}
63
-	}
46
+    foreach ($liste_onglets as $id => $infos) {
47
+        if (
48
+            ($parent = $infos['parent'])
49
+            && $parent == $script
50
+            && autoriser('onglet', "_$id")
51
+        ) {
52
+            $onglets[$id] = new Bouton(
53
+                isset($infos['icone']) ? find_in_theme($infos['icone']) : '',  // icone
54
+                $infos['titre'],  // titre
55
+                (isset($infos['action']) && $infos['action'])
56
+                    ? generer_url_ecrire(
57
+                        $infos['action'],
58
+                        (isset($infos['parametres']) && $infos['parametres']) ? $infos['parametres'] : ''
59
+                    )
60
+                    : null
61
+            );
62
+        }
63
+    }
64 64
 
65
-	return pipeline('ajouter_onglets', ['data' => $onglets, 'args' => $script]);
65
+    return pipeline('ajouter_onglets', ['data' => $onglets, 'args' => $script]);
66 66
 }
67 67
 
68 68
 /**
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
  * @return string
81 81
  */
82 82
 function barre_onglets($rubrique, $ongletCourant, $class = 'barre_onglet') {
83
-	include_spip('inc/presentation');
83
+    include_spip('inc/presentation');
84 84
 
85
-	$res = '';
85
+    $res = '';
86 86
 
87
-	foreach (definir_barre_onglets($rubrique) as $exec => $onglet) {
88
-		$url = $onglet->url ?: generer_url_ecrire($exec);
89
-		$res .= onglet(_T($onglet->libelle), $url, $exec, $ongletCourant, $onglet->icone);
90
-	}
87
+    foreach (definir_barre_onglets($rubrique) as $exec => $onglet) {
88
+        $url = $onglet->url ?: generer_url_ecrire($exec);
89
+        $res .= onglet(_T($onglet->libelle), $url, $exec, $ongletCourant, $onglet->icone);
90
+    }
91 91
 
92
-	return $res ? debut_onglet($class) . $res . fin_onglet() : ('');
92
+    return $res ? debut_onglet($class) . $res . fin_onglet() : ('');
93 93
 }
Please login to merge, or discard this patch.
ecrire/inc/filtres_boites.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
  *     Pile complétée par le code à générer
44 44
  */
45 45
 function balise_BOITE_OUVRIR_dist($p) {
46
-	$_titre = interprete_argument_balise(1, $p);
47
-	$_class = interprete_argument_balise(2, $p);
48
-	$_head_class = interprete_argument_balise(3, $p);
49
-	$_titre = ($_titre ?: "''");
50
-	$_class = ($_class ? ", $_class" : ", 'simple'");
51
-	$_head_class = ($_head_class ? ", $_head_class" : '');
52
-
53
-	$f = chercher_filtre('boite_ouvrir');
54
-	$p->code = "$f($_titre$_class$_head_class)";
55
-	$p->interdire_scripts = false;
56
-
57
-	return $p;
46
+    $_titre = interprete_argument_balise(1, $p);
47
+    $_class = interprete_argument_balise(2, $p);
48
+    $_head_class = interprete_argument_balise(3, $p);
49
+    $_titre = ($_titre ?: "''");
50
+    $_class = ($_class ? ", $_class" : ", 'simple'");
51
+    $_head_class = ($_head_class ? ", $_head_class" : '');
52
+
53
+    $f = chercher_filtre('boite_ouvrir');
54
+    $p->code = "$f($_titre$_class$_head_class)";
55
+    $p->interdire_scripts = false;
56
+
57
+    return $p;
58 58
 }
59 59
 
60 60
 /**
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
  *     Pile complétée par le code à générer
75 75
  */
76 76
 function balise_BOITE_PIED_dist($p) {
77
-	$_class = interprete_argument_balise(1, $p);
78
-	$_class = ($_class ? "$_class" : '');
77
+    $_class = interprete_argument_balise(1, $p);
78
+    $_class = ($_class ? "$_class" : '');
79 79
 
80
-	$f = chercher_filtre('boite_pied');
81
-	$p->code = "$f($_class)";
82
-	$p->interdire_scripts = false;
80
+    $f = chercher_filtre('boite_pied');
81
+    $p->code = "$f($_class)";
82
+    $p->interdire_scripts = false;
83 83
 
84
-	return $p;
84
+    return $p;
85 85
 }
86 86
 
87 87
 
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
  *     Pile complétée par le code à générer
102 102
  */
103 103
 function balise_BOITE_FERMER_dist($p) {
104
-	$f = chercher_filtre('boite_fermer');
105
-	$p->code = "$f()";
106
-	$p->interdire_scripts = false;
104
+    $f = chercher_filtre('boite_fermer');
105
+    $p->code = "$f()";
106
+    $p->interdire_scripts = false;
107 107
 
108
-	return $p;
108
+    return $p;
109 109
 }
110 110
 
111 111
 /**
@@ -127,16 +127,16 @@  discard block
 block discarded – undo
127 127
  *     HTML du début de la boîte
128 128
  */
129 129
 function boite_ouvrir($titre, $class = '', $head_class = '', $id = '') {
130
-	$class = "box $class";
131
-	$head_class = "box__header $head_class clearfix";
132
-	// dans l'espace prive, titrer en h3 si pas de balise <hn>
133
-	if (test_espace_prive() && strlen($titre) && !str_contains($titre, '<h')) {
134
-		$titre = "<h3>$titre</h3>";
135
-	}
136
-
137
-	return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">'
138
-	. ($titre ? "<div class=\"$head_class\">$titre<!--/hd--></div>" : '')
139
-	. '<div class="box__body clearfix">';
130
+    $class = "box $class";
131
+    $head_class = "box__header $head_class clearfix";
132
+    // dans l'espace prive, titrer en h3 si pas de balise <hn>
133
+    if (test_espace_prive() && strlen($titre) && !str_contains($titre, '<h')) {
134
+        $titre = "<h3>$titre</h3>";
135
+    }
136
+
137
+    return '<div class="' . $class . ($id ? "\" id=\"$id" : '') . '">'
138
+    . ($titre ? "<div class=\"$head_class\">$titre<!--/hd--></div>" : '')
139
+    . '<div class="box__body clearfix">';
140 140
 }
141 141
 
142 142
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
  *     HTML de transition vers le pied de la boîte
154 154
  */
155 155
 function boite_pied($class = 'act') {
156
-	$class = "box__footer $class";
156
+    $class = "box__footer $class";
157 157
 
158
-	return '</div>'
159
-	. "<div class=\"$class clearfix\">";
158
+    return '</div>'
159
+    . "<div class=\"$class clearfix\">";
160 160
 }
161 161
 
162 162
 
@@ -171,5 +171,5 @@  discard block
 block discarded – undo
171 171
  *     HTML de fin de la boîte
172 172
  */
173 173
 function boite_fermer() {
174
-	return '</div></div>';
174
+    return '</div></div>';
175 175
 }
Please login to merge, or discard this patch.
ecrire/inc/filtres_alertes.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -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_MESSAGE_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 ?: "''");
51
-	$_titre = ($_titre ? ", $_titre" : ', null');
52
-	$_class = ($_class ? ", $_class" : ', null');
53
-	$_role  = ($_role  ? ", $_role"  : ', null');
54
-	$_id    = ($_id    ? ", $_id"    : ', null');
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 ?: "''");
51
+    $_titre = ($_titre ? ", $_titre" : ', null');
52
+    $_class = ($_class ? ", $_class" : ', null');
53
+    $_role  = ($_role  ? ", $_role"  : ', null');
54
+    $_id    = ($_id    ? ", $_id"    : ', null');
55 55
 
56
-	$f = chercher_filtre('message_alerte');
57
-	$p->code = "$f($_texte$_titre$_class$_role$_id)";
58
-	$p->interdire_scripts = false;
56
+    $f = chercher_filtre('message_alerte');
57
+    $p->code = "$f($_texte$_titre$_class$_role$_id)";
58
+    $p->interdire_scripts = false;
59 59
 
60
-	return $p;
60
+    return $p;
61 61
 }
62 62
 
63 63
 /**
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
  *     Pile complétée par le code à générer
86 86
  */
87 87
 function balise_ALERTE_OUVRIR_dist($p) {
88
-	$_titre = interprete_argument_balise(1, $p);
89
-	$_class = interprete_argument_balise(2, $p);
90
-	$_role  = interprete_argument_balise(3, $p);
91
-	$_id    = interprete_argument_balise(4, $p);
92
-	$_titre = ($_titre ? "$_titre"   : 'null');
93
-	$_class = ($_class ? ", $_class" : ', null');
94
-	$_role  = ($_role  ? ", $_role"  : ', null');
95
-	$_id    = ($_id    ? ", $_id"    : ', null');
88
+    $_titre = interprete_argument_balise(1, $p);
89
+    $_class = interprete_argument_balise(2, $p);
90
+    $_role  = interprete_argument_balise(3, $p);
91
+    $_id    = interprete_argument_balise(4, $p);
92
+    $_titre = ($_titre ? "$_titre"   : 'null');
93
+    $_class = ($_class ? ", $_class" : ', null');
94
+    $_role  = ($_role  ? ", $_role"  : ', null');
95
+    $_id    = ($_id    ? ", $_id"    : ', null');
96 96
 
97
-	$f = chercher_filtre('message_alerte_ouvrir');
98
-	$p->code = "$f($_titre$_class$_role$_id)";
99
-	$p->interdire_scripts = false;
97
+    $f = chercher_filtre('message_alerte_ouvrir');
98
+    $p->code = "$f($_titre$_class$_role$_id)";
99
+    $p->interdire_scripts = false;
100 100
 
101
-	return $p;
101
+    return $p;
102 102
 }
103 103
 
104 104
 /**
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
  *     Pile complétée par le code à générer
121 121
  */
122 122
 function balise_ALERTE_FERMER_dist($p) {
123
-	$f = chercher_filtre('message_alerte_fermer');
124
-	$p->code = "$f()";
125
-	$p->interdire_scripts = false;
123
+    $f = chercher_filtre('message_alerte_fermer');
124
+    $p->code = "$f()";
125
+    $p->interdire_scripts = false;
126 126
 
127
-	return $p;
127
+    return $p;
128 128
 }
129 129
 
130 130
 /**
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function message_alerte(string $texte, ?string $titre = null, ?string $class = null, ?string $role = null, ?string $id = null): string {
161 161
 
162
-	$message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
163
-	$message_alerte_fermer = chercher_filtre('message_alerte_fermer');
162
+    $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
163
+    $message_alerte_fermer = chercher_filtre('message_alerte_fermer');
164 164
 
165
-	return $message_alerte_ouvrir($titre, $class, $role, $id) .
166
-		$texte .
167
-		$message_alerte_fermer();
165
+    return $message_alerte_ouvrir($titre, $class, $role, $id) .
166
+        $texte .
167
+        $message_alerte_fermer();
168 168
 }
169 169
 
170 170
 /**
@@ -195,53 +195,53 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function message_alerte_ouvrir(?string $titre = null, ?string $class = null, ?string $role = null, ?string $id = null): string {
197 197
 
198
-	$prive = test_espace_prive();
198
+    $prive = test_espace_prive();
199 199
 
200
-	// Valeurs par défaut
201
-	$titre = trim($titre ?? '');
202
-	$role ??= 'alert'; // fallback uniquement si null
203
-	$class ??= 'notice'; // fallback uniquement si null
200
+    // Valeurs par défaut
201
+    $titre = trim($titre ?? '');
202
+    $role ??= 'alert'; // fallback uniquement si null
203
+    $class ??= 'notice'; // fallback uniquement si null
204 204
 
205
-	// Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
206
-	$types = [
207
-		'notice',
208
-		'error',
209
-		'success',
210
-		'info',
211
-	];
212
-	$type  = array_intersect(explode(' ', $class), $types);
213
-	$type  = reset($type);
214
-	$class = trim(str_replace($types, '', $class) . " $type");
205
+    // Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
206
+    $types = [
207
+        'notice',
208
+        'error',
209
+        'success',
210
+        'info',
211
+    ];
212
+    $type  = array_intersect(explode(' ', $class), $types);
213
+    $type  = reset($type);
214
+    $class = trim(str_replace($types, '', $class) . " $type");
215 215
 
216
-	// Classes
217
-	$class_racine = 'msg-alert';
218
-	$clearfix     = ($prive ? 'clearfix' : '');
219
-	$class_alerte = "$class_racine $class";
220
-	$class_texte  = "{$class_racine}__text $clearfix";
221
-	$class_titre  = "{$class_racine}__heading";
216
+    // Classes
217
+    $class_racine = 'msg-alert';
218
+    $clearfix     = ($prive ? 'clearfix' : '');
219
+    $class_alerte = "$class_racine $class";
220
+    $class_texte  = "{$class_racine}__text $clearfix";
221
+    $class_titre  = "{$class_racine}__heading";
222 222
 
223
-	// Titre : markup
224
-	$titre = trim($titre);
225
-	if (strlen($titre)) {
226
-		include_spip('inc/filtres');
227
-		// Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
228
-		$cherche_tag = ($prive ? '<h' : '<');
229
-		$wrap_tag    = ($prive ? '<h3>' : '<div>');
230
-		if (!str_starts_with($titre, $cherche_tag)) {
231
-			$titre = wrap($titre, $wrap_tag);
232
-		}
233
-		// puis on ajoute la classe
234
-		$titre = ajouter_class($titre, $class_titre);
235
-	}
223
+    // Titre : markup
224
+    $titre = trim($titre);
225
+    if (strlen($titre)) {
226
+        include_spip('inc/filtres');
227
+        // Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
228
+        $cherche_tag = ($prive ? '<h' : '<');
229
+        $wrap_tag    = ($prive ? '<h3>' : '<div>');
230
+        if (!str_starts_with($titre, $cherche_tag)) {
231
+            $titre = wrap($titre, $wrap_tag);
232
+        }
233
+        // puis on ajoute la classe
234
+        $titre = ajouter_class($titre, $class_titre);
235
+    }
236 236
 
237
-	// Attributs
238
-	$attr_role = ($role ? "role=\"$role\"" : '');
239
-	$attr_id   = ($id   ? "id=\"$id\"" : '');
240
-	$attr_data = ($type ? "data-alert=\"$type\"" : '');
237
+    // Attributs
238
+    $attr_role = ($role ? "role=\"$role\"" : '');
239
+    $attr_id   = ($id   ? "id=\"$id\"" : '');
240
+    $attr_data = ($type ? "data-alert=\"$type\"" : '');
241 241
 
242
-	return "<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
243
-			. $titre
244
-			. "<div class=\"$class_texte\">";
242
+    return "<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
243
+            . $titre
244
+            . "<div class=\"$class_texte\">";
245 245
 }
246 246
 
247 247
 /**
@@ -255,5 +255,5 @@  discard block
 block discarded – undo
255 255
  *     HTML de fin de l'alerte
256 256
  */
257 257
 function message_alerte_fermer(): string {
258
-	return '</div></div>';
258
+    return '</div></div>';
259 259
 }
Please login to merge, or discard this patch.
ecrire/inc/cvt_configurer.php 1 patch
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 include_spip('inc/config');
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
  * @return array|false
32 32
  */
33 33
 function cvtconf_formulaire_charger($flux) {
34
-	if (
35
-		($form = $flux['args']['form'])
36
-		&& str_starts_with((string) $form, 'configurer_') // un #FORMULAIRE_CONFIGURER_XXX
37
-	) {
38
-		// Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé
39
-		include_spip('inc/autoriser');
40
-		if (!autoriser('configurer', '_' . substr((string) $form, 11))) {
41
-			return false;
42
-		}
34
+    if (
35
+        ($form = $flux['args']['form'])
36
+        && str_starts_with((string) $form, 'configurer_') // un #FORMULAIRE_CONFIGURER_XXX
37
+    ) {
38
+        // Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé
39
+        include_spip('inc/autoriser');
40
+        if (!autoriser('configurer', '_' . substr((string) $form, 11))) {
41
+            return false;
42
+        }
43 43
 
44
-		// S'il n'y a pas de fonction charger(), on génère un contexte automatiquement
45
-		if (!charger_fonction('charger', "formulaires/$form/", true)) {
46
-			$flux['data'] = cvtconf_formulaires_configurer_recense($form);
47
-			$flux['data']['editable'] = true;
48
-			if (_request('var_mode') == 'configurer' && autoriser('webmestre')) {
49
-				if (!_AJAX) {
50
-					var_dump($flux['data']);
51
-				}
52
-				// reinjecter pour la trace au traitement
53
-				$flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />";
54
-			}
55
-		}
56
-	}
44
+        // S'il n'y a pas de fonction charger(), on génère un contexte automatiquement
45
+        if (!charger_fonction('charger', "formulaires/$form/", true)) {
46
+            $flux['data'] = cvtconf_formulaires_configurer_recense($form);
47
+            $flux['data']['editable'] = true;
48
+            if (_request('var_mode') == 'configurer' && autoriser('webmestre')) {
49
+                if (!_AJAX) {
50
+                    var_dump($flux['data']);
51
+                }
52
+                // reinjecter pour la trace au traitement
53
+                $flux['data']['_hidden'] = "<input type='hidden' name='var_mode' value='configurer' />";
54
+            }
55
+        }
56
+    }
57 57
 
58
-	return $flux;
58
+    return $flux;
59 59
 }
60 60
 
61 61
 /**
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
  * @return array
66 66
  */
67 67
 function cvtconf_formulaire_traiter($flux) {
68
-	if (
69
-		($form = $flux['args']['form'])
70
-		&& str_starts_with((string) $form, 'configurer_') // un #FORMULAIRE_CONFIGURER_XXX
71
-		&& !charger_fonction('traiter', "formulaires/$form/", true) // sans fonction traiter()
72
-	) {
73
-		$trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']);
74
-		$flux['data'] = ['message_ok' => _T('config_info_enregistree') . $trace, 'editable' => true];
75
-	}
68
+    if (
69
+        ($form = $flux['args']['form'])
70
+        && str_starts_with((string) $form, 'configurer_') // un #FORMULAIRE_CONFIGURER_XXX
71
+        && !charger_fonction('traiter', "formulaires/$form/", true) // sans fonction traiter()
72
+    ) {
73
+        $trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']);
74
+        $flux['data'] = ['message_ok' => _T('config_info_enregistree') . $trace, 'editable' => true];
75
+    }
76 76
 
77
-	return $flux;
77
+    return $flux;
78 78
 }
79 79
 
80 80
 /**
@@ -90,32 +90,32 @@  discard block
 block discarded – undo
90 90
  * @return string
91 91
  */
92 92
 function cvtconf_formulaires_configurer_enregistre($form, $args) {
93
-	$valeurs = [];
94
-	// charger les valeurs
95
-	// ce qui permet de prendre en charge une fonction charger() existante
96
-	// qui prend alors la main sur l'auto detection
97
-	if ($charger_valeurs = charger_fonction('charger', "formulaires/$form/", true)) {
98
-		$valeurs = $charger_valeurs(...$args);
99
-	}
100
-	$valeurs = pipeline(
101
-		'formulaire_charger',
102
-		[
103
-			'args' => ['form' => $form, 'args' => $args, 'je_suis_poste' => false],
104
-			'data' => $valeurs
105
-		]
106
-	);
107
-	// ne pas stocker editable !
108
-	unset($valeurs['editable']);
93
+    $valeurs = [];
94
+    // charger les valeurs
95
+    // ce qui permet de prendre en charge une fonction charger() existante
96
+    // qui prend alors la main sur l'auto detection
97
+    if ($charger_valeurs = charger_fonction('charger', "formulaires/$form/", true)) {
98
+        $valeurs = $charger_valeurs(...$args);
99
+    }
100
+    $valeurs = pipeline(
101
+        'formulaire_charger',
102
+        [
103
+            'args' => ['form' => $form, 'args' => $args, 'je_suis_poste' => false],
104
+            'data' => $valeurs
105
+        ]
106
+    );
107
+    // ne pas stocker editable !
108
+    unset($valeurs['editable']);
109 109
 
110
-	// recuperer les valeurs postees
111
-	$store = [];
112
-	foreach ($valeurs as $k => $v) {
113
-		if (!str_starts_with((string) $k, '_')) {
114
-			$store[$k] = _request($k);
115
-		}
116
-	}
110
+    // recuperer les valeurs postees
111
+    $store = [];
112
+    foreach ($valeurs as $k => $v) {
113
+        if (!str_starts_with((string) $k, '_')) {
114
+            $store[$k] = _request($k);
115
+        }
116
+    }
117 117
 
118
-	return cvtconf_configurer_stocker($form, $valeurs, $store);
118
+    return cvtconf_configurer_stocker($form, $valeurs, $store);
119 119
 }
120 120
 
121 121
 /**
@@ -131,31 +131,31 @@  discard block
 block discarded – undo
131 131
  * @return array
132 132
  */
133 133
 function cvtconf_definir_configurer_conteneur($form, $valeurs) {
134
-	// stocker en base
135
-	// par defaut, dans un casier serialize dans spip_meta (idem CFG)
136
-	$casier = substr($form, 11);
137
-	$table = 'meta';
138
-	$prefixe = '';
139
-	$stockage = '';
134
+    // stocker en base
135
+    // par defaut, dans un casier serialize dans spip_meta (idem CFG)
136
+    $casier = substr($form, 11);
137
+    $table = 'meta';
138
+    $prefixe = '';
139
+    $stockage = '';
140 140
 
141
-	if (isset($valeurs['_meta_casier'])) {
142
-		$casier = $valeurs['_meta_casier'];
143
-	}
144
-	if (isset($valeurs['_meta_prefixe'])) {
145
-		$prefixe = $valeurs['_meta_prefixe'];
146
-	}
147
-	if (isset($valeurs['_meta_stockage'])) {
148
-		$stockage = $valeurs['_meta_stockage'] . '::';
149
-	}
141
+    if (isset($valeurs['_meta_casier'])) {
142
+        $casier = $valeurs['_meta_casier'];
143
+    }
144
+    if (isset($valeurs['_meta_prefixe'])) {
145
+        $prefixe = $valeurs['_meta_prefixe'];
146
+    }
147
+    if (isset($valeurs['_meta_stockage'])) {
148
+        $stockage = $valeurs['_meta_stockage'] . '::';
149
+    }
150 150
 
151
-	// si on indique juste une table, il faut vider les autres proprietes
152
-	// car par defaut on utilise ni casier ni prefixe dans ce cas
153
-	if (isset($valeurs['_meta_table'])) {
154
-		$table = $valeurs['_meta_table'];
155
-		$casier = ($valeurs['_meta_casier'] ?? '');
156
-	}
151
+    // si on indique juste une table, il faut vider les autres proprietes
152
+    // car par defaut on utilise ni casier ni prefixe dans ce cas
153
+    if (isset($valeurs['_meta_table'])) {
154
+        $table = $valeurs['_meta_table'];
155
+        $casier = ($valeurs['_meta_casier'] ?? '');
156
+    }
157 157
 
158
-	return [$table, $casier, $prefixe, $stockage];
158
+    return [$table, $casier, $prefixe, $stockage];
159 159
 }
160 160
 
161 161
 /**
@@ -166,49 +166,49 @@  discard block
 block discarded – undo
166 166
  * @return array
167 167
  */
168 168
 function cvtconf_formulaires_configurer_recense($form) {
169
-	$contenu = null;
170
-	$valeurs = ['editable' => ' '];
169
+    $contenu = null;
170
+    $valeurs = ['editable' => ' '];
171 171
 
172
-	// sinon cas analyse du squelette
173
-	if (
174
-		($f = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/'))
175
-		&& lire_fichier($f, $contenu)
176
-	) {
177
-		for ($i = 0; $i < 2; $i++) {
178
-			// a la seconde iteration, evaluer le fond avec les valeurs deja trouvees
179
-			// permet de trouver aussi les name="#GET{truc}"
180
-			if ($i == 1) {
181
-				$contenu = recuperer_fond("formulaires/$form", $valeurs);
182
-			}
172
+    // sinon cas analyse du squelette
173
+    if (
174
+        ($f = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/'))
175
+        && lire_fichier($f, $contenu)
176
+    ) {
177
+        for ($i = 0; $i < 2; $i++) {
178
+            // a la seconde iteration, evaluer le fond avec les valeurs deja trouvees
179
+            // permet de trouver aussi les name="#GET{truc}"
180
+            if ($i == 1) {
181
+                $contenu = recuperer_fond("formulaires/$form", $valeurs);
182
+            }
183 183
 
184
-			$balises = array_merge(
185
-				extraire_balises($contenu, 'input'),
186
-				extraire_balises($contenu, 'textarea'),
187
-				extraire_balises($contenu, 'select')
188
-			);
184
+            $balises = array_merge(
185
+                extraire_balises($contenu, 'input'),
186
+                extraire_balises($contenu, 'textarea'),
187
+                extraire_balises($contenu, 'select')
188
+            );
189 189
 
190
-			foreach ($balises as $b) {
191
-				if (
192
-					($n = extraire_attribut($b, 'name'))
193
-					&& preg_match(',^([\w\-]+)(\[\w*\])?$,', (string) $n, $r)
194
-					&& !in_array($n, ['formulaire_action', 'formulaire_action_args', 'formulaire_action_sign'])
195
-					&& extraire_attribut($b, 'type') !== 'submit'
196
-				) {
197
-					$valeurs[$r[1]] = '';
198
-					// recuperer les valeurs _meta_xx qui peuvent etre fournies
199
-					// en input hidden dans le squelette
200
-					if (str_starts_with($r[1], '_meta_')) {
201
-						$valeurs[$r[1]] = extraire_attribut($b, 'value');
202
-					}
203
-				}
204
-			}
205
-		}
206
-	}
190
+            foreach ($balises as $b) {
191
+                if (
192
+                    ($n = extraire_attribut($b, 'name'))
193
+                    && preg_match(',^([\w\-]+)(\[\w*\])?$,', (string) $n, $r)
194
+                    && !in_array($n, ['formulaire_action', 'formulaire_action_args', 'formulaire_action_sign'])
195
+                    && extraire_attribut($b, 'type') !== 'submit'
196
+                ) {
197
+                    $valeurs[$r[1]] = '';
198
+                    // recuperer les valeurs _meta_xx qui peuvent etre fournies
199
+                    // en input hidden dans le squelette
200
+                    if (str_starts_with($r[1], '_meta_')) {
201
+                        $valeurs[$r[1]] = extraire_attribut($b, 'value');
202
+                    }
203
+                }
204
+            }
205
+        }
206
+    }
207 207
 
208 208
 
209
-	cvtconf_configurer_lire_meta($form, $valeurs);
209
+    cvtconf_configurer_lire_meta($form, $valeurs);
210 210
 
211
-	return $valeurs;
211
+    return $valeurs;
212 212
 }
213 213
 
214 214
 /**
@@ -220,26 +220,26 @@  discard block
 block discarded – undo
220 220
  * @return string
221 221
  */
222 222
 function cvtconf_configurer_stocker($form, $valeurs, $store) {
223
-	$trace = '';
224
-	[$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
225
-	// stocker en base
226
-	// par defaut, dans un casier serialize dans spip_meta (idem CFG)
227
-	if (!isset($GLOBALS[$table])) {
228
-		lire_metas($table);
229
-	}
223
+    $trace = '';
224
+    [$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
225
+    // stocker en base
226
+    // par defaut, dans un casier serialize dans spip_meta (idem CFG)
227
+    if (!isset($GLOBALS[$table])) {
228
+        lire_metas($table);
229
+    }
230 230
 
231
-	$prefixe = ($prefixe ? $prefixe . '_' : '');
232
-	$table = ($table) ? "/$table/" : '';
233
-	$casier = ($casier) ? rtrim((string) $casier, '/') . '/' : ''; // slash final, sinon rien
231
+    $prefixe = ($prefixe ? $prefixe . '_' : '');
232
+    $table = ($table) ? "/$table/" : '';
233
+    $casier = ($casier) ? rtrim((string) $casier, '/') . '/' : ''; // slash final, sinon rien
234 234
 
235
-	foreach ($store as $k => $v) {
236
-		ecrire_config("$stockage$table$prefixe$casier$k", $v);
237
-		if (_request('var_mode') == 'configurer' && autoriser('webmestre')) {
238
-			$trace .= "<br />table $table : " . $prefixe . $k . " = $v;";
239
-		}
240
-	}
235
+    foreach ($store as $k => $v) {
236
+        ecrire_config("$stockage$table$prefixe$casier$k", $v);
237
+        if (_request('var_mode') == 'configurer' && autoriser('webmestre')) {
238
+            $trace .= "<br />table $table : " . $prefixe . $k . " = $v;";
239
+        }
240
+    }
241 241
 
242
-	return $trace;
242
+    return $trace;
243 243
 }
244 244
 
245 245
 /**
@@ -249,21 +249,21 @@  discard block
 block discarded – undo
249 249
  * @param array $valeurs
250 250
  */
251 251
 function cvtconf_configurer_lire_meta($form, &$valeurs) {
252
-	[$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
252
+    [$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
253 253
 
254
-	$table = ($table) ? "/$table/" : '';
255
-	$prefixe = ($prefixe ? $prefixe . '_' : '');
256
-	if ($casier) {
257
-		$meta = lire_config("$stockage$table$prefixe$casier");
258
-		$prefixe = '';
259
-	} else {
260
-		$table = rtrim($table, '/');
261
-		$meta = lire_config("$stockage$table");
262
-	}
254
+    $table = ($table) ? "/$table/" : '';
255
+    $prefixe = ($prefixe ? $prefixe . '_' : '');
256
+    if ($casier) {
257
+        $meta = lire_config("$stockage$table$prefixe$casier");
258
+        $prefixe = '';
259
+    } else {
260
+        $table = rtrim($table, '/');
261
+        $meta = lire_config("$stockage$table");
262
+    }
263 263
 
264
-	foreach (array_keys($valeurs) as $k) {
265
-		if (!str_starts_with($k, '_')) {
266
-			$valeurs[$k] = ($meta[$prefixe . $k] ?? null);
267
-		}
268
-	}
264
+    foreach (array_keys($valeurs) as $k) {
265
+        if (!str_starts_with($k, '_')) {
266
+            $valeurs[$k] = ($meta[$prefixe . $k] ?? null);
267
+        }
268
+    }
269 269
 }
Please login to merge, or discard this patch.
ecrire/inc/presentation_mini.php 1 patch
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\Affichage
16 16
  **/
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 
21 21
 /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  * @return string Code HTML
25 25
  */
26 26
 function debut_grand_cadre() {
27
- return "\n<div class = 'table_page'>\n";
27
+    return "\n<div class = 'table_page'>\n";
28 28
 }
29 29
 
30 30
 /**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @return string Code HTML
34 34
  */
35 35
 function fin_grand_cadre() {
36
- return "\n</div>";
36
+    return "\n</div>";
37 37
 }
38 38
 
39 39
 // Debut de la colonne de gauche
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @return string Code HTML
49 49
  */
50 50
 function debut_gauche() {
51
-	return "<div id = 'conteneur' class = ''>\n<div id = 'navigation' class = 'lat' role = 'contentinfo'>\n";
51
+    return "<div id = 'conteneur' class = ''>\n<div id = 'navigation' class = 'lat' role = 'contentinfo'>\n";
52 52
 }
53 53
 
54 54
 /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  * @return string Code HTML
58 58
  */
59 59
 function fin_gauche() {
60
- return "</div></div><br class = 'nettoyeur' />";
60
+    return "</div></div><br class = 'nettoyeur' />";
61 61
 }
62 62
 
63 63
 /**
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
  * @return string Code HTML
67 67
  */
68 68
 function creer_colonne_droite() {
69
-	static $deja_colonne_droite;
70
-	if ($deja_colonne_droite) {
71
-		return '';
72
-	}
73
-	$deja_colonne_droite = true;
69
+    static $deja_colonne_droite;
70
+    if ($deja_colonne_droite) {
71
+        return '';
72
+    }
73
+    $deja_colonne_droite = true;
74 74
 
75
-	return "\n</div><div id='extra' class='lat' role='complementary'>";
75
+    return "\n</div><div id='extra' class='lat' role='complementary'>";
76 76
 }
77 77
 
78 78
 /**
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
  * @return string Code HTML
82 82
  */
83 83
 function debut_droite() {
84
-	return liste_objets_bloques(_request('exec'))
85
-	. creer_colonne_droite()
86
-	. '</div>'
87
-	. "\n<div id='contenu'>";
84
+    return liste_objets_bloques(_request('exec'))
85
+    . creer_colonne_droite()
86
+    . '</div>'
87
+    . "\n<div id='contenu'>";
88 88
 }
89 89
 
90 90
 /**
@@ -106,32 +106,32 @@  discard block
 block discarded – undo
106 106
  *     Code HTML
107 107
  **/
108 108
 function liste_objets_bloques($exec, $contexte = [], $auteur = null): string {
109
-	$res = '';
110
-	include_spip('inc/config');
111
-	if (lire_config('articles_modif', 'non') !== 'non') {
112
-		include_spip('inc/drapeau_edition');
113
-		if (is_null($auteur)) {
114
-			$auteur = $GLOBALS['visiteur_session'];
115
-		}
116
-		if (
117
-			($en_cours = trouver_objet_exec($exec))
118
-			&& $en_cours['edition']
119
-			&& ($type = $en_cours['type'])
120
-			&& (isset($contexte[$en_cours['id_table_objet']])
121
-			&& ($id = $contexte[$en_cours['id_table_objet']]) || ($id = _request($en_cours['id_table_objet'])))
122
-		) {
123
-			// marquer le fait que l'objet est ouvert en edition par toto
124
-			// a telle date ; une alerte sera donnee aux autres redacteurs
125
-			signale_edition($id, $auteur, $type);
126
-		}
127
-
128
-		$objets_ouverts = liste_drapeau_edition($auteur['id_auteur']);
129
-		if ($objets_ouverts !== []) {
130
-			$res .= recuperer_fond('prive/objets/liste/objets-en-edition', [], ['ajax' => true]);
131
-		}
132
-	}
133
-
134
-	return $res;
109
+    $res = '';
110
+    include_spip('inc/config');
111
+    if (lire_config('articles_modif', 'non') !== 'non') {
112
+        include_spip('inc/drapeau_edition');
113
+        if (is_null($auteur)) {
114
+            $auteur = $GLOBALS['visiteur_session'];
115
+        }
116
+        if (
117
+            ($en_cours = trouver_objet_exec($exec))
118
+            && $en_cours['edition']
119
+            && ($type = $en_cours['type'])
120
+            && (isset($contexte[$en_cours['id_table_objet']])
121
+            && ($id = $contexte[$en_cours['id_table_objet']]) || ($id = _request($en_cours['id_table_objet'])))
122
+        ) {
123
+            // marquer le fait que l'objet est ouvert en edition par toto
124
+            // a telle date ; une alerte sera donnee aux autres redacteurs
125
+            signale_edition($id, $auteur, $type);
126
+        }
127
+
128
+        $objets_ouverts = liste_drapeau_edition($auteur['id_auteur']);
129
+        if ($objets_ouverts !== []) {
130
+            $res .= recuperer_fond('prive/objets/liste/objets-en-edition', [], ['ajax' => true]);
131
+        }
132
+    }
133
+
134
+    return $res;
135 135
 }
136 136
 
137 137
 
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
  * @return string Code HTML
146 146
  **/
147 147
 function fin_page() {
148
-	include_spip('inc/pipelines');
149
-	// avec &var_profile=1 on a le tableau de mesures SQL
150
-	$debug = (_request('exec') !== 'valider_xml'
151
-		&& (
152
-			_request('var_mode') == 'debug'
153
-			|| isset($GLOBALS['tableau_des_temps']) && $GLOBALS['tableau_des_temps']
154
-			&& isset($_COOKIE['spip_admin'])
155
-		)
156
-	);
157
-	$t = '</div><div id="pied"><div class="largeur">'
158
-		. recuperer_fond('prive/squelettes/inclure/pied')
159
-		. '</div>'
160
-		. '</div></div>' // cf. div#page et div.largeur ouvertes dans conmmencer_page()
161
-		. ($debug ? erreur_squelette() : '')
162
-		. "</body></html>\n";
163
-
164
-	return f_queue($t);
148
+    include_spip('inc/pipelines');
149
+    // avec &var_profile=1 on a le tableau de mesures SQL
150
+    $debug = (_request('exec') !== 'valider_xml'
151
+        && (
152
+            _request('var_mode') == 'debug'
153
+            || isset($GLOBALS['tableau_des_temps']) && $GLOBALS['tableau_des_temps']
154
+            && isset($_COOKIE['spip_admin'])
155
+        )
156
+    );
157
+    $t = '</div><div id="pied"><div class="largeur">'
158
+        . recuperer_fond('prive/squelettes/inclure/pied')
159
+        . '</div>'
160
+        . '</div></div>' // cf. div#page et div.largeur ouvertes dans conmmencer_page()
161
+        . ($debug ? erreur_squelette() : '')
162
+        . "</body></html>\n";
163
+
164
+    return f_queue($t);
165 165
 }
166 166
 
167 167
 /**
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
  * @return string Code HTML
177 177
  **/
178 178
 function html_tests_js() {
179
-	if (_SPIP_AJAX && !defined('_TESTER_NOSCRIPT')) {
180
-		// pour le pied de page (deja defini si on est validation XML)
181
-		define(
182
-			'_TESTER_NOSCRIPT',
183
-			"<noscript>\n<div style='display:none;'><img src='"
184
-			. generer_url_ecrire('test_ajax', 'js=-1')
185
-			. "' width='1' height='1' alt='' /></div></noscript>\n"
186
-		);
187
-	}
188
-
189
-	$rejouer = '';
190
-	if (defined('_SESSION_REJOUER')) {
191
-		$rejouer = (_SESSION_REJOUER === true) ? rejouer_session() : _SESSION_REJOUER;
192
-	}
193
-
194
-	return $rejouer . (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '');
179
+    if (_SPIP_AJAX && !defined('_TESTER_NOSCRIPT')) {
180
+        // pour le pied de page (deja defini si on est validation XML)
181
+        define(
182
+            '_TESTER_NOSCRIPT',
183
+            "<noscript>\n<div style='display:none;'><img src='"
184
+            . generer_url_ecrire('test_ajax', 'js=-1')
185
+            . "' width='1' height='1' alt='' /></div></noscript>\n"
186
+        );
187
+    }
188
+
189
+    $rejouer = '';
190
+    if (defined('_SESSION_REJOUER')) {
191
+        $rejouer = (_SESSION_REJOUER === true) ? rejouer_session() : _SESSION_REJOUER;
192
+    }
193
+
194
+    return $rejouer . (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '');
195 195
 }
196 196
 
197 197
 /**
@@ -201,25 +201,25 @@  discard block
 block discarded – undo
201 201
  **/
202 202
 function info_maj_spip() {
203 203
 
204
-	$maj = $GLOBALS['meta']['info_maj_spip'] ?? null;
205
-	if (!$maj) {
206
-		return '';
207
-	}
204
+    $maj = $GLOBALS['meta']['info_maj_spip'] ?? null;
205
+    if (!$maj) {
206
+        return '';
207
+    }
208 208
 
209
-	$maj = explode('|', (string) $maj);
210
-	// c'est une ancienne notif, on a fait la maj depuis !
211
-	if ($GLOBALS['spip_version_branche'] !== reset($maj)) {
212
-		return '';
213
-	}
209
+    $maj = explode('|', (string) $maj);
210
+    // c'est une ancienne notif, on a fait la maj depuis !
211
+    if ($GLOBALS['spip_version_branche'] !== reset($maj)) {
212
+        return '';
213
+    }
214 214
 
215
-	if (!autoriser('webmestre')) {
216
-		return '';
217
-	}
215
+    if (!autoriser('webmestre')) {
216
+        return '';
217
+    }
218 218
 
219
-	array_shift($maj);
220
-	$maj = implode('|', $maj);
219
+    array_shift($maj);
220
+    $maj = implode('|', $maj);
221 221
 
222
-	return "$maj<br />";
222
+    return "$maj<br />";
223 223
 }
224 224
 
225 225
 /**
@@ -230,43 +230,43 @@  discard block
 block discarded – undo
230 230
  **/
231 231
 function info_copyright() {
232 232
 
233
-	$version = $GLOBALS['spip_version_affichee'];
234
-
235
-	//
236
-	// Mention, le cas echeant, de la revision SVN courante
237
-	//
238
-	if ($vcs = version_vcs_courante(_DIR_RACINE, true)) {
239
-		if ($vcs['vcs'] === 'GIT') {
240
-			$url = 'https://git.spip.net/spip/spip/commit/' . $vcs['commit'];
241
-		} elseif ($vcs['vcs'] === 'SVN') {
242
-			$url = 'https://core.spip.net/projects/spip/repository/revisions/' . $vcs['commit'];
243
-		} else {
244
-			$url = '';
245
-		}
246
-		// affichage "GIT [master: abcdef]"
247
-		$commit = $vcs['commit_short'] ?? $vcs['commit'];
248
-		if ($url) {
249
-			$commit = "<a href=\"$url\" target=\"_blank\" rel=\"noopener noreferrer\">$commit</a>";
250
-		}
251
-		if ($vcs['branch']) {
252
-			$commit = $vcs['branch'] . ': ' . $commit;
253
-		}
254
-		$version .= " {$vcs['vcs']} [$commit]";
255
-	}
256
-
257
-	// et la version de l'ecran de securite
258
-	$secu = defined('_ECRAN_SECURITE')
259
-		? '<br />' . _T('ecran_securite', ['version' => _ECRAN_SECURITE])
260
-		: '';
261
-
262
-	return _T(
263
-		'info_copyright',
264
-		[
265
-			'spip' => "<b>SPIP $version</b> ",
266
-			'lien_gpl' => '<a href="https://www.gnu.org/licenses/gpl-3.0.html">' . _T('info_copyright_gpl') . '</a>'
267
-		]
268
-	)
269
-	. $secu;
233
+    $version = $GLOBALS['spip_version_affichee'];
234
+
235
+    //
236
+    // Mention, le cas echeant, de la revision SVN courante
237
+    //
238
+    if ($vcs = version_vcs_courante(_DIR_RACINE, true)) {
239
+        if ($vcs['vcs'] === 'GIT') {
240
+            $url = 'https://git.spip.net/spip/spip/commit/' . $vcs['commit'];
241
+        } elseif ($vcs['vcs'] === 'SVN') {
242
+            $url = 'https://core.spip.net/projects/spip/repository/revisions/' . $vcs['commit'];
243
+        } else {
244
+            $url = '';
245
+        }
246
+        // affichage "GIT [master: abcdef]"
247
+        $commit = $vcs['commit_short'] ?? $vcs['commit'];
248
+        if ($url) {
249
+            $commit = "<a href=\"$url\" target=\"_blank\" rel=\"noopener noreferrer\">$commit</a>";
250
+        }
251
+        if ($vcs['branch']) {
252
+            $commit = $vcs['branch'] . ': ' . $commit;
253
+        }
254
+        $version .= " {$vcs['vcs']} [$commit]";
255
+    }
256
+
257
+    // et la version de l'ecran de securite
258
+    $secu = defined('_ECRAN_SECURITE')
259
+        ? '<br />' . _T('ecran_securite', ['version' => _ECRAN_SECURITE])
260
+        : '';
261
+
262
+    return _T(
263
+        'info_copyright',
264
+        [
265
+            'spip' => "<b>SPIP $version</b> ",
266
+            'lien_gpl' => '<a href="https://www.gnu.org/licenses/gpl-3.0.html">' . _T('info_copyright_gpl') . '</a>'
267
+        ]
268
+    )
269
+    . $secu;
270 270
 }
271 271
 
272 272
 /**
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
  * @return string             Code HTML
282 282
  **/
283 283
 function formulaire_recherche($page, $complement = '') {
284
-	$recherche = _request('recherche');
285
-	$recherche_aff = entites_html($recherche);
286
-	if (!strlen((string) $recherche)) {
287
-		$recherche_aff = _T('info_rechercher');
288
-		$onfocus = " onfocus=\"this.value='';\"";
289
-	} else {
290
-		$onfocus = '';
291
-	}
292
-
293
-	$form = '<input type="text" size="10" value="' . $recherche_aff . '" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />';
294
-	$form .= "<input type='image' src='" . chemin_image('rechercher-20.png') . "' name='submit' class='submit' alt='" . _T('info_rechercher') . "' />";
295
-
296
-	return "<div class='spip_recherche'>" . generer_form_ecrire($page, $form . $complement, " method='get'") . '</div>';
284
+    $recherche = _request('recherche');
285
+    $recherche_aff = entites_html($recherche);
286
+    if (!strlen((string) $recherche)) {
287
+        $recherche_aff = _T('info_rechercher');
288
+        $onfocus = " onfocus=\"this.value='';\"";
289
+    } else {
290
+        $onfocus = '';
291
+    }
292
+
293
+    $form = '<input type="text" size="10" value="' . $recherche_aff . '" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />';
294
+    $form .= "<input type='image' src='" . chemin_image('rechercher-20.png') . "' name='submit' class='submit' alt='" . _T('info_rechercher') . "' />";
295
+
296
+    return "<div class='spip_recherche'>" . generer_form_ecrire($page, $form . $complement, " method='get'") . '</div>';
297 297
 }
Please login to merge, or discard this patch.