Completed
Push — master ( dc31ed...4191b0 )
by cam
01:33
created
ecrire/src/Afficher/Minipres.php 3 patches
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -19,137 +19,137 @@
 block discarded – undo
19 19
  **/
20 20
 class Minipres extends Minipublic {
21 21
 
22
-	protected function setOptions(array $options) {
23
-		$options['couleur_fond'] = '#aaa';
24
-		$options['css_files'] = [
25
-			find_in_theme('minipres.css')
26
-		];
27
-
28
-		if (!empty($options['titre']) and $options['titre'] === 'AUTO') {
29
-			$options['titre'] = _T('info_installation_systeme_publication');
30
-		}
31
-		$options['page_title'] = ($options['titre'] ?? '');
32
-
33
-		return $options;
34
-	}
35
-
36
-
37
-	/**
38
-	 * Retourne le début d'une page HTML minimale (de type installation ou erreur)
39
-	 *
40
-	 * @param array $options
41
-	 * @return string
42
-	 *    Code HTML
43
-	 */
44
-	public function installDebutPage($options = []) {
45
-
46
-		$options = $this->setOptions($options);
47
-		return parent::ouvreBody($options)
48
-			. parent::ouvreCorps($options);
49
-	}
50
-
51
-	/**
52
-	 * Retourne le fin d'une page HTML minimale (de type installation ou erreur)
53
-	 *
54
-	 * @param array $options
55
-	 * @return string
56
-	 *    Code HTML
57
-	 */
58
-	public function installFinPage($options = []) {
59
-
60
-		$options = $this->setOptions($options);
61
-		return parent::fermeCorps($options)
62
-			. parent::fermeBody();
63
-	}
64
-
65
-
66
-	/**
67
-	 * Retourne une page HTML contenant, dans une présentation minimale,
68
-	 * le contenu transmis dans `$corps`.
69
-	 *
70
-	 * Appelée pour afficher un message d’erreur (l’utilisateur n’a pas
71
-	 * accès à cette page par exemple).
72
-	 *
73
-	 * Lorsqu’aucun argument n’est transmis, un header 403 est renvoyé,
74
-	 * ainsi qu’un message indiquant une interdiction d’accès.
75
-	 *
76
-	 * @param string $corps
77
-	 *   Corps de la page
78
-	 * @param array $options
79
-	 * @return string
80
-	 *   HTML de la page
81
-	 * @see  ouvreBody()
82
-	 *   string $titre : Titre à l'affichage (différent de $page_title)
83
-	 *   int $status : status de la page
84
-	 *   string $footer : pied de la box en remplacement du bouton retour par défaut
85
-	 * @uses ouvreBody()
86
-	 * @uses fermeBody()
87
-	 *
88
-	 */
89
-	public function page($corps = '', $options = []) {
90
-
91
-		$footer = '';
92
-
93
-		if (empty($options['titre'])) {
94
-			if (empty($corps) and !isset($options['status'])) {
95
-				$options['status'] = 403;
96
-			}
97
-
98
-			if (
99
-				!$titre = _request('action')
100
-				and !$titre = _request('exec')
101
-				and !$titre = _request('page')
102
-			) {
103
-				$titre = '?';
104
-			}
105
-
106
-			$titre = spip_htmlspecialchars($titre);
107
-
108
-			$titre = ($titre == 'install')
109
-				? _T('avis_espace_interdit')
110
-				: $titre . ' : ' . _T('info_acces_interdit');
111
-
112
-			$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
113
-			$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
114
-
115
-			if ($statut != '0minirezo') {
116
-				$titre = _T('info_acces_interdit');
117
-			}
118
-
119
-			if ($statut and test_espace_prive()) {
120
-				$footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
121
-			}
122
-			elseif (!empty($_COOKIE['spip_admin'])) {
123
-				$footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
124
-			}
125
-			else {
126
-				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site']);
127
-			}
128
-
129
-			$corps = "";
130
-			spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres');
131
-		}
132
-
133
-		$options['footer'] = $footer;
134
-		$options['page_title'] = $titre;
135
-		$options['titre'] = $titre;
136
-
137
-		$options = $this->setOptions($options);
138
-
139
-		$html = parent::page($corps, $options);
140
-
141
-		if (!_AJAX) {
142
-			return $html;
143
-		} else {
144
-			include_spip('inc/headers');
145
-			include_spip('inc/actions');
146
-			$url = self('&', true);
147
-			foreach ($_POST as $v => $c) {
148
-				$url = parametre_url($url, $v, $c, '&');
149
-			}
150
-			ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
151
-			return '';
152
-		}
153
-	}
22
+    protected function setOptions(array $options) {
23
+        $options['couleur_fond'] = '#aaa';
24
+        $options['css_files'] = [
25
+            find_in_theme('minipres.css')
26
+        ];
27
+
28
+        if (!empty($options['titre']) and $options['titre'] === 'AUTO') {
29
+            $options['titre'] = _T('info_installation_systeme_publication');
30
+        }
31
+        $options['page_title'] = ($options['titre'] ?? '');
32
+
33
+        return $options;
34
+    }
35
+
36
+
37
+    /**
38
+     * Retourne le début d'une page HTML minimale (de type installation ou erreur)
39
+     *
40
+     * @param array $options
41
+     * @return string
42
+     *    Code HTML
43
+     */
44
+    public function installDebutPage($options = []) {
45
+
46
+        $options = $this->setOptions($options);
47
+        return parent::ouvreBody($options)
48
+            . parent::ouvreCorps($options);
49
+    }
50
+
51
+    /**
52
+     * Retourne le fin d'une page HTML minimale (de type installation ou erreur)
53
+     *
54
+     * @param array $options
55
+     * @return string
56
+     *    Code HTML
57
+     */
58
+    public function installFinPage($options = []) {
59
+
60
+        $options = $this->setOptions($options);
61
+        return parent::fermeCorps($options)
62
+            . parent::fermeBody();
63
+    }
64
+
65
+
66
+    /**
67
+     * Retourne une page HTML contenant, dans une présentation minimale,
68
+     * le contenu transmis dans `$corps`.
69
+     *
70
+     * Appelée pour afficher un message d’erreur (l’utilisateur n’a pas
71
+     * accès à cette page par exemple).
72
+     *
73
+     * Lorsqu’aucun argument n’est transmis, un header 403 est renvoyé,
74
+     * ainsi qu’un message indiquant une interdiction d’accès.
75
+     *
76
+     * @param string $corps
77
+     *   Corps de la page
78
+     * @param array $options
79
+     * @return string
80
+     *   HTML de la page
81
+     * @see  ouvreBody()
82
+     *   string $titre : Titre à l'affichage (différent de $page_title)
83
+     *   int $status : status de la page
84
+     *   string $footer : pied de la box en remplacement du bouton retour par défaut
85
+     * @uses ouvreBody()
86
+     * @uses fermeBody()
87
+     *
88
+     */
89
+    public function page($corps = '', $options = []) {
90
+
91
+        $footer = '';
92
+
93
+        if (empty($options['titre'])) {
94
+            if (empty($corps) and !isset($options['status'])) {
95
+                $options['status'] = 403;
96
+            }
97
+
98
+            if (
99
+                !$titre = _request('action')
100
+                and !$titre = _request('exec')
101
+                and !$titre = _request('page')
102
+            ) {
103
+                $titre = '?';
104
+            }
105
+
106
+            $titre = spip_htmlspecialchars($titre);
107
+
108
+            $titre = ($titre == 'install')
109
+                ? _T('avis_espace_interdit')
110
+                : $titre . '&nbsp;: ' . _T('info_acces_interdit');
111
+
112
+            $statut = $GLOBALS['visiteur_session']['statut'] ?? '';
113
+            $nom = $GLOBALS['visiteur_session']['nom'] ?? '';
114
+
115
+            if ($statut != '0minirezo') {
116
+                $titre = _T('info_acces_interdit');
117
+            }
118
+
119
+            if ($statut and test_espace_prive()) {
120
+                $footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
121
+            }
122
+            elseif (!empty($_COOKIE['spip_admin'])) {
123
+                $footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
124
+            }
125
+            else {
126
+                $footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site']);
127
+            }
128
+
129
+            $corps = "";
130
+            spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres');
131
+        }
132
+
133
+        $options['footer'] = $footer;
134
+        $options['page_title'] = $titre;
135
+        $options['titre'] = $titre;
136
+
137
+        $options = $this->setOptions($options);
138
+
139
+        $html = parent::page($corps, $options);
140
+
141
+        if (!_AJAX) {
142
+            return $html;
143
+        } else {
144
+            include_spip('inc/headers');
145
+            include_spip('inc/actions');
146
+            $url = self('&', true);
147
+            foreach ($_POST as $v => $c) {
148
+                $url = parametre_url($url, $v, $c, '&');
149
+            }
150
+            ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
151
+            return '';
152
+        }
153
+    }
154 154
 
155 155
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 			$titre = ($titre == 'install')
109 109
 				? _T('avis_espace_interdit')
110
-				: $titre . '&nbsp;: ' . _T('info_acces_interdit');
110
+				: $titre.'&nbsp;: '._T('info_acces_interdit');
111 111
 
112 112
 			$statut = $GLOBALS['visiteur_session']['statut'] ?? '';
113 113
 			$nom = $GLOBALS['visiteur_session']['nom'] ?? '';
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			}
128 128
 
129 129
 			$corps = "";
130
-			spip_log($nom . " $titre " . $_SERVER['REQUEST_URI'], 'minipres');
130
+			spip_log($nom." $titre ".$_SERVER['REQUEST_URI'], 'minipres');
131 131
 		}
132 132
 
133 133
 		$options['footer'] = $footer;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			foreach ($_POST as $v => $c) {
148 148
 				$url = parametre_url($url, $v, $c, '&');
149 149
 			}
150
-			ajax_retour('<div>' . $titre . redirige_formulaire($url) . '</div>', false);
150
+			ajax_retour('<div>'.$titre.redirige_formulaire($url).'</div>', false);
151 151
 			return '';
152 152
 		}
153 153
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,11 +118,9 @@
 block discarded – undo
118 118
 
119 119
 			if ($statut and test_espace_prive()) {
120 120
 				$footer = bouton_action(_T('public:accueil_site'), generer_url_ecrire('accueil'));
121
-			}
122
-			elseif (!empty($_COOKIE['spip_admin'])) {
121
+			} elseif (!empty($_COOKIE['spip_admin'])) {
123 122
 				$footer = bouton_action(_T('public:lien_connecter'), generer_url_public('login'));
124
-			}
125
-			else {
123
+			} else {
126 124
 				$footer = bouton_action(_T('public:accueil_site'), $GLOBALS['meta']['adresse_site']);
127 125
 			}
128 126
 
Please login to merge, or discard this patch.
ecrire/src/Afficher/Minipublic.php 2 patches
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -19,263 +19,263 @@
 block discarded – undo
19 19
  **/
20 20
 class Minipublic {
21 21
 
22
-	public function __construct() {
23
-		include_fichiers_fonctions();
24
-		include_spip('inc/headers');
25
-		include_spip('inc/texte'); //inclue inc/lang et inc/filtres
26
-		include_spip('inc/filtres_images_mini');
27
-	}
22
+    public function __construct() {
23
+        include_fichiers_fonctions();
24
+        include_spip('inc/headers');
25
+        include_spip('inc/texte'); //inclue inc/lang et inc/filtres
26
+        include_spip('inc/filtres_images_mini');
27
+    }
28 28
 
29
-	/**
30
-	 * Retourne le début d'une page HTML minimale
31
-	 *
32
-	 * Le contenu de CSS minimales (reset.css, clear.css, minipublic.css) est inséré
33
-	 * dans une balise script inline (compactée si possible)
34
-	 *
35
-	 * @param array $options
36
-	 *   string $lang : forcer la langue utilisateur
37
-	 *   string $page_title : titre éventuel de la page (nom du site par défaut)
38
-	 *   string $couleur_fond : pour la couleur dominante de la page (par défaut on reprend le réglage de la page de login)
39
-	 *   bool $all_inline : inliner les CSS pour envoyer toute la page en 1 hit
40
-	 *   string $doctype
41
-	 *   string $charset
42
-	 *   string $onload
43
-	 *   array $css_files : ajouter des fichiers css
44
-	 *   string $css : ajouter du CSS inline
45
-	 *   string $head : contenu à ajouter à la fin <head> (pour inclusion de JS ou JS inline...)
46
-	 * @return string
47
-	 *    Code HTML
48
-	 *
49
-	 * @uses html_lang_attributes()
50
-	 * @uses minifier() si le plugin compresseur est présent
51
-	 * @uses url_absolue_css()
52
-	 *
53
-	 * @uses utiliser_langue_visiteur()
54
-	 * @uses http_no_cache()
55
-	 */
56
-	protected function ouvreBody($options = []) {
57
-		if (empty($options['lang'])) {
58
-			// on se limite sur une langue de $GLOBALS['meta']['langues_multilingue'] car on est dans le public
59
-			utiliser_langue_visiteur($GLOBALS['meta']['langues_multilingue']);
60
-		} else {
61
-			changer_langue($options['lang']);
62
-		}
63
-		http_no_cache();
29
+    /**
30
+     * Retourne le début d'une page HTML minimale
31
+     *
32
+     * Le contenu de CSS minimales (reset.css, clear.css, minipublic.css) est inséré
33
+     * dans une balise script inline (compactée si possible)
34
+     *
35
+     * @param array $options
36
+     *   string $lang : forcer la langue utilisateur
37
+     *   string $page_title : titre éventuel de la page (nom du site par défaut)
38
+     *   string $couleur_fond : pour la couleur dominante de la page (par défaut on reprend le réglage de la page de login)
39
+     *   bool $all_inline : inliner les CSS pour envoyer toute la page en 1 hit
40
+     *   string $doctype
41
+     *   string $charset
42
+     *   string $onload
43
+     *   array $css_files : ajouter des fichiers css
44
+     *   string $css : ajouter du CSS inline
45
+     *   string $head : contenu à ajouter à la fin <head> (pour inclusion de JS ou JS inline...)
46
+     * @return string
47
+     *    Code HTML
48
+     *
49
+     * @uses html_lang_attributes()
50
+     * @uses minifier() si le plugin compresseur est présent
51
+     * @uses url_absolue_css()
52
+     *
53
+     * @uses utiliser_langue_visiteur()
54
+     * @uses http_no_cache()
55
+     */
56
+    protected function ouvreBody($options = []) {
57
+        if (empty($options['lang'])) {
58
+            // on se limite sur une langue de $GLOBALS['meta']['langues_multilingue'] car on est dans le public
59
+            utiliser_langue_visiteur($GLOBALS['meta']['langues_multilingue']);
60
+        } else {
61
+            changer_langue($options['lang']);
62
+        }
63
+        http_no_cache();
64 64
 
65
-		$page_title = (isset($options['page_title']) ? $options['page_title'] : $GLOBALS['meta']['nom_site']);
66
-		$doctype = (isset($options['doctype']) ? $options['doctype'] : "<!DOCTYPE html>");
67
-		$doctype = trim($doctype) . "\n";
68
-		$charset = (isset($options['charset']) ? $options['charset'] : "utf-8");
69
-		$all_inline = (isset($options['all_inline']) ? $options['all_inline'] : true);
70
-		$onLoad = (isset($options['onLoad']) ? $options['onLoad'] : '');
71
-		if ($onLoad) {
72
-			$onLoad = ' onload="' . attribut_html($onLoad) . '"';
73
-		}
65
+        $page_title = (isset($options['page_title']) ? $options['page_title'] : $GLOBALS['meta']['nom_site']);
66
+        $doctype = (isset($options['doctype']) ? $options['doctype'] : "<!DOCTYPE html>");
67
+        $doctype = trim($doctype) . "\n";
68
+        $charset = (isset($options['charset']) ? $options['charset'] : "utf-8");
69
+        $all_inline = (isset($options['all_inline']) ? $options['all_inline'] : true);
70
+        $onLoad = (isset($options['onLoad']) ? $options['onLoad'] : '');
71
+        if ($onLoad) {
72
+            $onLoad = ' onload="' . attribut_html($onLoad) . '"';
73
+        }
74 74
 
75
-		# envoyer le charset
76
-		if (!headers_sent()) {
77
-			header('Content-Type: text/html; charset=' . $charset);
78
-		}
75
+        # envoyer le charset
76
+        if (!headers_sent()) {
77
+            header('Content-Type: text/html; charset=' . $charset);
78
+        }
79 79
 
80
-		$css = '';
80
+        $css = '';
81 81
 
82
-		if (function_exists('couleur_hex_to_hsl')) {
83
-			if (!empty($options['couleur_fond'])) {
84
-				$couleur_fond = $options['couleur_fond'];
85
-			} else {
86
-				$couleur_fond = lire_config("couleur_login", "#db1762");
87
-			}
88
-			$h = couleur_hex_to_hsl($couleur_fond, "h");
89
-			$s = couleur_hex_to_hsl($couleur_fond, "s");
90
-			$l = couleur_hex_to_hsl($couleur_fond, "l");
91
-		}
82
+        if (function_exists('couleur_hex_to_hsl')) {
83
+            if (!empty($options['couleur_fond'])) {
84
+                $couleur_fond = $options['couleur_fond'];
85
+            } else {
86
+                $couleur_fond = lire_config("couleur_login", "#db1762");
87
+            }
88
+            $h = couleur_hex_to_hsl($couleur_fond, "h");
89
+            $s = couleur_hex_to_hsl($couleur_fond, "s");
90
+            $l = couleur_hex_to_hsl($couleur_fond, "l");
91
+        }
92 92
 
93
-		$inline = ":root {"
94
-			. "--minipublic-color-theme--h: $h;"
95
-			. "--minipublic-color-theme--s: $s;"
96
-			. "--minipublic-color-theme--l: $l;}";
97
-		$vars = file_get_contents(find_in_theme('minipublic.vars.css'));
98
-		$inline .= "\n" . trim($vars);
99
-		if (function_exists('minifier')) {
100
-			$inline = minifier($inline, 'css');
101
-		}
102
-		$files = [
103
-			find_in_theme('reset.css'),
104
-			find_in_theme('clear.css'),
105
-			find_in_theme('minipublic.css'),
106
-		];
107
-		if (!empty($options['css_files'])) {
108
-			foreach ($options['css_files'] as $css_file) {
109
-				$files[] = $css_file;
110
-			}
111
-		}
112
-		if ($all_inline) {
113
-			// inliner les CSS (optimisation de la page minipublic qui passe en un seul hit a la demande)
114
-			foreach ($files as $name) {
115
-				$file = direction_css($name);
116
-				if (function_exists('minifier')) {
117
-					$file = minifier($file);
118
-				} else {
119
-					$file = url_absolue_css($file); // precaution
120
-				}
121
-				$css .= file_get_contents($file);
122
-			}
123
-			$css = "$inline\n$css";
124
-			if (!empty($options['css'])) {
125
-				$css .= "\n" . $options['css'];
126
-			}
127
-			$css = "<style type='text/css'>$css</style>";
128
-		} else {
129
-			$css = "<style type='text/css'>$inline</style>";
130
-			foreach ($files as $name) {
131
-				$file = timestamp(direction_css($name));
132
-				$css .= "<link rel='stylesheet' href='" . attribut_html($file) . "' type='text/css' />\n";
133
-			}
134
-			if (!empty($options['css'])) {
135
-				$css .= "<style type='text/css'>" . $options['css'] . "</style>";
136
-			}
137
-		}
93
+        $inline = ":root {"
94
+            . "--minipublic-color-theme--h: $h;"
95
+            . "--minipublic-color-theme--s: $s;"
96
+            . "--minipublic-color-theme--l: $l;}";
97
+        $vars = file_get_contents(find_in_theme('minipublic.vars.css'));
98
+        $inline .= "\n" . trim($vars);
99
+        if (function_exists('minifier')) {
100
+            $inline = minifier($inline, 'css');
101
+        }
102
+        $files = [
103
+            find_in_theme('reset.css'),
104
+            find_in_theme('clear.css'),
105
+            find_in_theme('minipublic.css'),
106
+        ];
107
+        if (!empty($options['css_files'])) {
108
+            foreach ($options['css_files'] as $css_file) {
109
+                $files[] = $css_file;
110
+            }
111
+        }
112
+        if ($all_inline) {
113
+            // inliner les CSS (optimisation de la page minipublic qui passe en un seul hit a la demande)
114
+            foreach ($files as $name) {
115
+                $file = direction_css($name);
116
+                if (function_exists('minifier')) {
117
+                    $file = minifier($file);
118
+                } else {
119
+                    $file = url_absolue_css($file); // precaution
120
+                }
121
+                $css .= file_get_contents($file);
122
+            }
123
+            $css = "$inline\n$css";
124
+            if (!empty($options['css'])) {
125
+                $css .= "\n" . $options['css'];
126
+            }
127
+            $css = "<style type='text/css'>$css</style>";
128
+        } else {
129
+            $css = "<style type='text/css'>$inline</style>";
130
+            foreach ($files as $name) {
131
+                $file = timestamp(direction_css($name));
132
+                $css .= "<link rel='stylesheet' href='" . attribut_html($file) . "' type='text/css' />\n";
133
+            }
134
+            if (!empty($options['css'])) {
135
+                $css .= "<style type='text/css'>" . $options['css'] . "</style>";
136
+            }
137
+        }
138 138
 
139
-		return $doctype .
140
-			html_lang_attributes() .
141
-			"<head>\n" .
142
-			'<title>' .
143
-			textebrut($page_title) .
144
-			"</title>\n" .
145
-			"<meta name=\"viewport\" content=\"width=device-width\" />\n" .
146
-			$css .
147
-			(empty($options['head']) ? "" : $options['head']) .
148
-			"</head>\n" .
149
-			"<body{$onLoad} class=\"minipublic\">\n" .
150
-			"\t<div class=\"minipublic-bloc\">\n";
151
-	}
139
+        return $doctype .
140
+            html_lang_attributes() .
141
+            "<head>\n" .
142
+            '<title>' .
143
+            textebrut($page_title) .
144
+            "</title>\n" .
145
+            "<meta name=\"viewport\" content=\"width=device-width\" />\n" .
146
+            $css .
147
+            (empty($options['head']) ? "" : $options['head']) .
148
+            "</head>\n" .
149
+            "<body{$onLoad} class=\"minipublic\">\n" .
150
+            "\t<div class=\"minipublic-bloc\">\n";
151
+    }
152 152
 
153
-	/**
154
-	 * Ouvre le corps : affiche le header avec un éventuel titre + ouvre le div corps
155
-	 * @param $options
156
-	 * @return string
157
-	 */
158
-	protected function ouvreCorps($options = []) {
159
-		$url_site = url_de_base();
160
-		$header = "<header>\n" .
161
-			"<h1><a href=\"" . attribut_html($url_site) . "\">" . interdire_scripts($GLOBALS['meta']['nom_site']) . "</a></h1>\n";
153
+    /**
154
+     * Ouvre le corps : affiche le header avec un éventuel titre + ouvre le div corps
155
+     * @param $options
156
+     * @return string
157
+     */
158
+    protected function ouvreCorps($options = []) {
159
+        $url_site = url_de_base();
160
+        $header = "<header>\n" .
161
+            "<h1><a href=\"" . attribut_html($url_site) . "\">" . interdire_scripts($GLOBALS['meta']['nom_site']) . "</a></h1>\n";
162 162
 
163
-		$titre = (isset($options['titre']) ? $options['titre'] : '');
164
-		if ($titre) {
165
-			$header .= "<h2>" . interdire_scripts($titre) . "</h2>";
166
-		}
167
-		$header .= "</header>";
163
+        $titre = (isset($options['titre']) ? $options['titre'] : '');
164
+        if ($titre) {
165
+            $header .= "<h2>" . interdire_scripts($titre) . "</h2>";
166
+        }
167
+        $header .= "</header>";
168 168
 
169
-		return $header . "<div class='corps'>\n";
170
-	}
169
+        return $header . "<div class='corps'>\n";
170
+    }
171 171
 
172
-	/**
173
-	 * Ferme le corps : affiche le footer par défaut ou custom et ferme le div corps
174
-	 * @param $options
175
-	 * @return string
176
-	 */
177
-	protected function fermeCorps($options = []) {
178
-		$url_site = url_de_base();
172
+    /**
173
+     * Ferme le corps : affiche le footer par défaut ou custom et ferme le div corps
174
+     * @param $options
175
+     * @return string
176
+     */
177
+    protected function fermeCorps($options = []) {
178
+        $url_site = url_de_base();
179 179
 
180
-		if (isset($options['footer'])) {
181
-			$footer = $options['footer'];
182
-		} else {
183
-			$footer = "<a href=\"" . attribut_html($url_site) . "\">" . _T('retour') . "</a>\n";
184
-		}
185
-		if (!empty($footer)) {
186
-			$footer = "<footer>\n{$footer}</footer>";
187
-		}
180
+        if (isset($options['footer'])) {
181
+            $footer = $options['footer'];
182
+        } else {
183
+            $footer = "<a href=\"" . attribut_html($url_site) . "\">" . _T('retour') . "</a>\n";
184
+        }
185
+        if (!empty($footer)) {
186
+            $footer = "<footer>\n{$footer}</footer>";
187
+        }
188 188
 
189
-		return "</div>\n" . $footer;
190
-	}
189
+        return "</div>\n" . $footer;
190
+    }
191 191
 
192 192
 
193
-	/**
194
-	 * Retourne la fin d'une page HTML minimale
195
-	 *
196
-	 * @return string Code HTML
197
-	 */
198
-	protected function fermeBody() {
199
-		return "\n\t</div>\n</body>\n</html>";
200
-	}
193
+    /**
194
+     * Retourne la fin d'une page HTML minimale
195
+     *
196
+     * @return string Code HTML
197
+     */
198
+    protected function fermeBody() {
199
+        return "\n\t</div>\n</body>\n</html>";
200
+    }
201 201
 
202 202
 
203
-	/**
204
-	 * Retourne une page HTML contenant, dans une présentation minimale,
205
-	 * le contenu transmis dans `$corps`.
206
-	 *
207
-	 * Appelée pour afficher un message ou une demande de confirmation simple et rapide
208
-	 *
209
-	 * @param string $corps
210
-	 *   Corps de la page
211
-	 * @param array $options
212
-	 * @return string
213
-	 *   HTML de la page
214
-	 * @see  ouvreBody()
215
-	 * @see  ouvreCorps()
216
-	 *   string $titre : Titre à l'affichage (différent de $page_title)
217
-	 *   int $status : status de la page
218
-	 *   string $footer : pied de la box en remplacement du bouton retour par défaut
219
-	 * @uses ouvreBody()
220
-	 * @uses ouvreCorps()
221
-	 * @uses fermeCorps()
222
-	 * @uses fermeBody()
223
-	 *
224
-	 */
225
-	public function page($corps, $options = []) {
203
+    /**
204
+     * Retourne une page HTML contenant, dans une présentation minimale,
205
+     * le contenu transmis dans `$corps`.
206
+     *
207
+     * Appelée pour afficher un message ou une demande de confirmation simple et rapide
208
+     *
209
+     * @param string $corps
210
+     *   Corps de la page
211
+     * @param array $options
212
+     * @return string
213
+     *   HTML de la page
214
+     * @see  ouvreBody()
215
+     * @see  ouvreCorps()
216
+     *   string $titre : Titre à l'affichage (différent de $page_title)
217
+     *   int $status : status de la page
218
+     *   string $footer : pied de la box en remplacement du bouton retour par défaut
219
+     * @uses ouvreBody()
220
+     * @uses ouvreCorps()
221
+     * @uses fermeCorps()
222
+     * @uses fermeBody()
223
+     *
224
+     */
225
+    public function page($corps, $options = []) {
226 226
 
227
-		// par securite
228
-		if (!defined('_AJAX')) {
229
-			define('_AJAX', false);
230
-		}
227
+        // par securite
228
+        if (!defined('_AJAX')) {
229
+            define('_AJAX', false);
230
+        }
231 231
 
232
-		$status = (isset($options['status']) ? intval($options['status']) : 200);
233
-		$status = ($status ?: 200);
232
+        $status = (isset($options['status']) ? intval($options['status']) : 200);
233
+        $status = ($status ?: 200);
234 234
 
235
-		http_response_code($status);
235
+        http_response_code($status);
236 236
 
237
-		$html = $this->ouvreBody($options)
238
-			. $this->ouvreCorps($options)
239
-			. $corps
240
-			. $this->fermeCorps($options)
241
-			. $this->fermeBody();
237
+        $html = $this->ouvreBody($options)
238
+            . $this->ouvreCorps($options)
239
+            . $corps
240
+            . $this->fermeCorps($options)
241
+            . $this->fermeBody();
242 242
 
243
-		if (
244
-			$GLOBALS['profondeur_url'] >= (_DIR_RESTREINT ? 1 : 2)
245
-			and empty($options['all_inline'])
246
-		) {
247
-			define('_SET_HTML_BASE', true);
248
-			include_spip('public/assembler');
249
-			$GLOBALS['html'] = true;
250
-			page_base_href($html);
251
-		}
252
-		return $html;
253
-	}
243
+        if (
244
+            $GLOBALS['profondeur_url'] >= (_DIR_RESTREINT ? 1 : 2)
245
+            and empty($options['all_inline'])
246
+        ) {
247
+            define('_SET_HTML_BASE', true);
248
+            include_spip('public/assembler');
249
+            $GLOBALS['html'] = true;
250
+            page_base_href($html);
251
+        }
252
+        return $html;
253
+    }
254 254
 
255
-	/**
256
-	 * Fonction helper pour les erreurs
257
-	 * @param ?string $message_erreur
258
-	 * @param array $options
259
-	 * @see page()
260
-	 * @return string
261
-	 *
262
-	 */
263
-	public function pageErreur($message_erreur = null, $options = []) {
255
+    /**
256
+     * Fonction helper pour les erreurs
257
+     * @param ?string $message_erreur
258
+     * @param array $options
259
+     * @see page()
260
+     * @return string
261
+     *
262
+     */
263
+    public function pageErreur($message_erreur = null, $options = []) {
264 264
 
265
-		if (empty($message_erreur)) {
266
-			if (empty($options['lang'])) {
267
-				utiliser_langue_visiteur();
268
-			} else {
269
-				changer_langue($options['lang']);
270
-			}
271
-			$message_erreur = _T('info_acces_interdit');
272
-		}
273
-		$corps = "<div class='msg-alert error'>"
274
-			. $message_erreur
275
-			. "</div>";
276
-		if (empty($options['status'])) {
277
-			$options['status'] = 403;
278
-		}
279
-		return $this->page($corps, $options);
280
-	}
265
+        if (empty($message_erreur)) {
266
+            if (empty($options['lang'])) {
267
+                utiliser_langue_visiteur();
268
+            } else {
269
+                changer_langue($options['lang']);
270
+            }
271
+            $message_erreur = _T('info_acces_interdit');
272
+        }
273
+        $corps = "<div class='msg-alert error'>"
274
+            . $message_erreur
275
+            . "</div>";
276
+        if (empty($options['status'])) {
277
+            $options['status'] = 403;
278
+        }
279
+        return $this->page($corps, $options);
280
+    }
281 281
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 
65 65
 		$page_title = (isset($options['page_title']) ? $options['page_title'] : $GLOBALS['meta']['nom_site']);
66 66
 		$doctype = (isset($options['doctype']) ? $options['doctype'] : "<!DOCTYPE html>");
67
-		$doctype = trim($doctype) . "\n";
67
+		$doctype = trim($doctype)."\n";
68 68
 		$charset = (isset($options['charset']) ? $options['charset'] : "utf-8");
69 69
 		$all_inline = (isset($options['all_inline']) ? $options['all_inline'] : true);
70 70
 		$onLoad = (isset($options['onLoad']) ? $options['onLoad'] : '');
71 71
 		if ($onLoad) {
72
-			$onLoad = ' onload="' . attribut_html($onLoad) . '"';
72
+			$onLoad = ' onload="'.attribut_html($onLoad).'"';
73 73
 		}
74 74
 
75 75
 		# envoyer le charset
76 76
 		if (!headers_sent()) {
77
-			header('Content-Type: text/html; charset=' . $charset);
77
+			header('Content-Type: text/html; charset='.$charset);
78 78
 		}
79 79
 
80 80
 		$css = '';
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			. "--minipublic-color-theme--s: $s;"
96 96
 			. "--minipublic-color-theme--l: $l;}";
97 97
 		$vars = file_get_contents(find_in_theme('minipublic.vars.css'));
98
-		$inline .= "\n" . trim($vars);
98
+		$inline .= "\n".trim($vars);
99 99
 		if (function_exists('minifier')) {
100 100
 			$inline = minifier($inline, 'css');
101 101
 		}
@@ -122,31 +122,31 @@  discard block
 block discarded – undo
122 122
 			}
123 123
 			$css = "$inline\n$css";
124 124
 			if (!empty($options['css'])) {
125
-				$css .= "\n" . $options['css'];
125
+				$css .= "\n".$options['css'];
126 126
 			}
127 127
 			$css = "<style type='text/css'>$css</style>";
128 128
 		} else {
129 129
 			$css = "<style type='text/css'>$inline</style>";
130 130
 			foreach ($files as $name) {
131 131
 				$file = timestamp(direction_css($name));
132
-				$css .= "<link rel='stylesheet' href='" . attribut_html($file) . "' type='text/css' />\n";
132
+				$css .= "<link rel='stylesheet' href='".attribut_html($file)."' type='text/css' />\n";
133 133
 			}
134 134
 			if (!empty($options['css'])) {
135
-				$css .= "<style type='text/css'>" . $options['css'] . "</style>";
135
+				$css .= "<style type='text/css'>".$options['css']."</style>";
136 136
 			}
137 137
 		}
138 138
 
139
-		return $doctype .
140
-			html_lang_attributes() .
141
-			"<head>\n" .
142
-			'<title>' .
143
-			textebrut($page_title) .
144
-			"</title>\n" .
145
-			"<meta name=\"viewport\" content=\"width=device-width\" />\n" .
146
-			$css .
147
-			(empty($options['head']) ? "" : $options['head']) .
148
-			"</head>\n" .
149
-			"<body{$onLoad} class=\"minipublic\">\n" .
139
+		return $doctype.
140
+			html_lang_attributes().
141
+			"<head>\n".
142
+			'<title>'.
143
+			textebrut($page_title).
144
+			"</title>\n".
145
+			"<meta name=\"viewport\" content=\"width=device-width\" />\n".
146
+			$css.
147
+			(empty($options['head']) ? "" : $options['head']).
148
+			"</head>\n".
149
+			"<body{$onLoad} class=\"minipublic\">\n".
150 150
 			"\t<div class=\"minipublic-bloc\">\n";
151 151
 	}
152 152
 
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	protected function ouvreCorps($options = []) {
159 159
 		$url_site = url_de_base();
160
-		$header = "<header>\n" .
161
-			"<h1><a href=\"" . attribut_html($url_site) . "\">" . interdire_scripts($GLOBALS['meta']['nom_site']) . "</a></h1>\n";
160
+		$header = "<header>\n".
161
+			"<h1><a href=\"".attribut_html($url_site)."\">".interdire_scripts($GLOBALS['meta']['nom_site'])."</a></h1>\n";
162 162
 
163 163
 		$titre = (isset($options['titre']) ? $options['titre'] : '');
164 164
 		if ($titre) {
165
-			$header .= "<h2>" . interdire_scripts($titre) . "</h2>";
165
+			$header .= "<h2>".interdire_scripts($titre)."</h2>";
166 166
 		}
167 167
 		$header .= "</header>";
168 168
 
169
-		return $header . "<div class='corps'>\n";
169
+		return $header."<div class='corps'>\n";
170 170
 	}
171 171
 
172 172
 	/**
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 		if (isset($options['footer'])) {
181 181
 			$footer = $options['footer'];
182 182
 		} else {
183
-			$footer = "<a href=\"" . attribut_html($url_site) . "\">" . _T('retour') . "</a>\n";
183
+			$footer = "<a href=\"".attribut_html($url_site)."\">"._T('retour')."</a>\n";
184 184
 		}
185 185
 		if (!empty($footer)) {
186 186
 			$footer = "<footer>\n{$footer}</footer>";
187 187
 		}
188 188
 
189
-		return "</div>\n" . $footer;
189
+		return "</div>\n".$footer;
190 190
 	}
191 191
 
192 192
 
Please login to merge, or discard this patch.
ecrire/inc/minipres.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\Minipres
16 16
  **/
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 
21 21
 /**
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function install_debut_html($titre = 'AUTO', $onLoad = '', $all_inline = false) {
35 35
 
36
-	if ($onLoad) {
37
-		include_spip('inc/filtres');
38
-		$onLoad = extraire_attribut("<body $onLoad>", "onload");
39
-	}
36
+    if ($onLoad) {
37
+        include_spip('inc/filtres');
38
+        $onLoad = extraire_attribut("<body $onLoad>", "onload");
39
+    }
40 40
 
41
-	$options = [
42
-		'all_inline' => $all_inline,
43
-		'onload' => $onLoad,
44
-		'titre' => $titre,
45
-	];
41
+    $options = [
42
+        'all_inline' => $all_inline,
43
+        'onload' => $onLoad,
44
+        'titre' => $titre,
45
+    ];
46 46
 
47
-	$minipres = new Spip\Afficher\Minipres();
48
-	return $minipres->installDebutPage($options);
47
+    $minipres = new Spip\Afficher\Minipres();
48
+    return $minipres->installDebutPage($options);
49 49
 }
50 50
 
51 51
 /**
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
  * @return string Code HTML
56 56
  */
57 57
 function install_fin_html() {
58
-	$minipres = new Spip\Afficher\Minipres();
59
-	return $minipres->installFinPage();
58
+    $minipres = new Spip\Afficher\Minipres();
59
+    return $minipres->installFinPage();
60 60
 }
61 61
 
62 62
 
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function minipres($titre = '', $corps = '', $options = []) {
96 96
 
97
-	// compat signature old
98
-	// minipres($titre='', $corps="", $onload='', $all_inline = false)
99
-	$args = func_get_args();
100
-	if (isset($args[2]) and is_string($args[2])) {
101
-		$options = ['onload' => $args[2]];
102
-	}
103
-	if (isset($args[3])) {
104
-		$options['all_inline'] = $args[3];
105
-	}
97
+    // compat signature old
98
+    // minipres($titre='', $corps="", $onload='', $all_inline = false)
99
+    $args = func_get_args();
100
+    if (isset($args[2]) and is_string($args[2])) {
101
+        $options = ['onload' => $args[2]];
102
+    }
103
+    if (isset($args[3])) {
104
+        $options['all_inline'] = $args[3];
105
+    }
106 106
 
107
-	$options = array_merge([
108
-		'onload' => '',
109
-		'all_inline' => false,
110
-	], $options);
107
+    $options = array_merge([
108
+        'onload' => '',
109
+        'all_inline' => false,
110
+    ], $options);
111 111
 
112
-	$options['titre'] = $titre;
112
+    $options['titre'] = $titre;
113 113
 
114
-	$minipres = new Spip\Afficher\Minipres();
115
-	return $minipres->page($corps, $options);
114
+    $minipres = new Spip\Afficher\Minipres();
115
+    return $minipres->page($corps, $options);
116 116
 }
Please login to merge, or discard this patch.