Line | |
---|
1 | <?php |
---|
2 | /** |
---|
3 | * Fonctions pour la prévisualisation |
---|
4 | * |
---|
5 | * @plugin Porte Plume pour SPIP |
---|
6 | * @license GPL |
---|
7 | * @package SPIP\PortePlume\Fonctions |
---|
8 | **/ |
---|
9 | |
---|
10 | if (!defined('_ECRIRE_INC_VERSION')) { |
---|
11 | return; |
---|
12 | } |
---|
13 | |
---|
14 | |
---|
15 | /** |
---|
16 | * Retourner le charset SQL |
---|
17 | * |
---|
18 | * Retourne le charset SQL si on le connait, en priorité |
---|
19 | * sinon, on utilise le charset de l'affichage HTML. |
---|
20 | * |
---|
21 | * Cependant, on peut forcer un charset donné avec une constante : |
---|
22 | * define('PORTE_PLUME_PREVIEW_CHARSET','utf-8'); |
---|
23 | * |
---|
24 | * @return string Nom du charset (ex: 'utf-8') |
---|
25 | */ |
---|
26 | function filtre_pp_charset() { |
---|
27 | if (defined('PORTE_PLUME_PREVIEW_CHARSET')) { |
---|
28 | return PORTE_PLUME_PREVIEW_CHARSET; |
---|
29 | } |
---|
30 | |
---|
31 | $charset = $GLOBALS['meta']['charset']; |
---|
32 | $charset_sql = isset($GLOBALS['charset_sql_base']) ? $GLOBALS['charset_sql_base'] : ''; |
---|
33 | if ($charset_sql == 'utf8') { |
---|
34 | $charset_sql = 'utf-8'; |
---|
35 | } |
---|
36 | |
---|
37 | return $charset_sql ? $charset_sql : $charset; |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.