[SPIP] +spip v3.0.17
[lhc/web/clavette_www.git] / www / plugins-dist / porte_plume / prive / porte_plume_preview_fonctions.php
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')) return;
11
12
13 /**
14 * Retourner le charset SQL
15 *
16 * Retourne le charset SQL si on le connait, en priorité
17 * sinon, on utilise le charset de l'affichage HTML.
18 *
19 * Cependant, on peut forcer un charset donné avec une constante :
20 * define('PORTE_PLUME_PREVIEW_CHARSET','utf-8');
21 *
22 * @return string Nom du charset (ex: 'utf-8')
23 */
24 function filtre_pp_charset() {
25 if (defined('PORTE_PLUME_PREVIEW_CHARSET')) {
26 return PORTE_PLUME_PREVIEW_CHARSET;
27 }
28
29 $charset = $GLOBALS['meta']['charset'];
30 $charset_sql = isset($GLOBALS['charset_sql_base']) ? $GLOBALS['charset_sql_base'] : '';
31 if ($charset_sql == 'utf8') {
32 $charset_sql = 'utf-8';
33 }
34 return $charset_sql ? $charset_sql : $charset;
35 }
36
37 ?>