Changeset 117914 in spip-zone
- Timestamp:
- Sep 20, 2019, 10:48:47 AM (16 months ago)
- Location:
- _plugins_/spip-bonux-3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/spip-bonux-3/paquet.xml
r105257 r117914 2 2 prefix="spip_bonux" 3 3 categorie="outil" 4 version="3. 4.6"4 version="3.5.0" 5 5 etat="stable" 6 6 compatibilite="[3.0.0;3.2.*]" -
_plugins_/spip-bonux-3/spip_bonux_options.php
r117838 r117914 66 66 67 67 68 include_spip('plugins/installer'); 68 69 if (!function_exists('_T_ou_typo')) { 69 70 /** … … 81 82 */ 82 83 function _T_ou_typo($valeur, $mode_typo = 'toujours') { 84 if (!in_array($mode_typo, array('toujours', 'multi', 'jamais'))) { 85 $mode_typo = 'toujours'; 86 } 87 83 88 // Si la valeur est bien une chaine (et pas non plus un entier déguisé) 84 89 if (is_string($valeur) and !intval($valeur)) { 85 // Si la chaine est du type <:truc:> on passe à _T() 86 if (preg_match('/^\<:(.*?):\>$/', $valeur, $match)) { 87 $valeur = _T($match[1]); 88 } else { 89 // Sinon on la passe a typo() 90 if (!in_array($mode_typo, array('toujours', 'multi', 'jamais'))) { 91 $mode_typo = 'toujours'; 92 } 93 if ($mode_typo == 'toujours' or ($mode_typo == 'multi' and strpos($valeur, '<multi>') !== false)) { 90 // Si on a dépassé 3.2, on peut uniquement utilser typo() car ça extrait les <:chaine:> 91 if (spip_version_compare(spip_version(), '3.2', '>=')) { 92 if ( 93 $mode_typo == 'toujours' 94 or ( 95 $mode_typo == 'multi' 96 and include_spip('inc/filtres') 97 and (preg_match(_EXTRAIRE_IDIOME, $valeur) or strpos($valeur, '<multi>') !== false) 98 ) 99 ) { 94 100 include_spip('inc/texte'); 95 101 $valeur = typo($valeur); 96 102 } 97 103 } 98 } elseif (is_array($valeur)) { 99 // Si c'est un tableau, on reapplique la fonction récursivement 104 // Si on est avant 3.2, on fait comme avant 105 else { 106 // Si la chaine est du type <:truc:> on passe à _T() 107 if (preg_match('/^\<:(.*?):\>$/', $valeur, $match)) { 108 $valeur = _T($match[1]); 109 } else { 110 // Sinon on la passe a typo() 111 if ($mode_typo == 'toujours' or ($mode_typo == 'multi' and strpos($valeur, '<multi>') !== false)) { 112 include_spip('inc/texte'); 113 $valeur = typo($valeur); 114 } 115 } 116 } 117 } 118 // Si c'est un tableau, on réapplique la fonction récursivement 119 elseif (is_array($valeur)) { 100 120 foreach ($valeur as $cle => $valeur2) { 101 121 $valeur[$cle] = _T_ou_typo($valeur2, $mode_typo); 102 122 } 103 123 } 124 104 125 return $valeur; 105 126 } 106 127 } 107 108 128 /** 109 129 * Insère toutes les valeurs du tableau $arr2 après (ou avant) $cle dans le tableau $arr1.
Note: See TracChangeset
for help on using the changeset viewer.