@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | include_spip('inc/charsets'); |
| 23 | 23 | include_spip('inc/texte'); |
@@ -25,181 +25,181 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | // http://code.spip.net/@ligne_plug |
| 27 | 27 | function plugins_afficher_plugin_dist( |
| 28 | - $url_page, |
|
| 29 | - $plug_file, |
|
| 30 | - $checked, |
|
| 31 | - $actif, |
|
| 32 | - $expose = false, |
|
| 33 | - $class_li = "item", |
|
| 34 | - $dir_plugins = _DIR_PLUGINS |
|
| 28 | + $url_page, |
|
| 29 | + $plug_file, |
|
| 30 | + $checked, |
|
| 31 | + $actif, |
|
| 32 | + $expose = false, |
|
| 33 | + $class_li = "item", |
|
| 34 | + $dir_plugins = _DIR_PLUGINS |
|
| 35 | 35 | ) { |
| 36 | 36 | |
| 37 | - static $id_input = 0; |
|
| 38 | - static $versions = array(); |
|
| 39 | - |
|
| 40 | - $force_reload = (_request('var_mode') == 'recalcul'); |
|
| 41 | - $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 42 | - $info = $get_infos($plug_file, $force_reload, $dir_plugins); |
|
| 43 | - $prefix = $info['prefix']; |
|
| 44 | - $cfg = ""; |
|
| 45 | - $checkable = ($dir_plugins !== _DIR_PLUGINS_DIST); |
|
| 46 | - $nom = plugin_nom($info, $dir_plugins, $plug_file); |
|
| 47 | - $erreur = ""; |
|
| 48 | - |
|
| 49 | - if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) { |
|
| 50 | - $info['slogan'] = _T('plugin_info_non_compatible_spip'); |
|
| 51 | - $erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'", |
|
| 52 | - _T('plugin_info_non_compatible_spip')); |
|
| 53 | - $class_li .= " disabled"; |
|
| 54 | - $checkable = false; |
|
| 55 | - } elseif (isset($info['erreur'])) { |
|
| 56 | - $class_li .= " error"; |
|
| 57 | - $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'", |
|
| 58 | - _T('plugin_info_erreur_xml')) |
|
| 59 | - . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 60 | - $checkable = false; |
|
| 61 | - } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) { |
|
| 62 | - $class_li .= " error"; |
|
| 63 | - $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)), |
|
| 64 | - " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom))) |
|
| 65 | - . "<div class='erreur'>" . implode("<br />", |
|
| 66 | - $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>"; |
|
| 67 | - } else { |
|
| 68 | - $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : ""; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // numerotons les occurrences d'un meme prefix |
|
| 72 | - $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : ''; |
|
| 73 | - |
|
| 74 | - $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : ""); |
|
| 75 | - |
|
| 76 | - return "<li id='$prefix$id' class='$class_li'>" |
|
| 77 | - . ((!$checkable and !$checked) |
|
| 78 | - ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked)) |
|
| 79 | - . plugin_resume($info, $dir_plugins, $plug_file, $url_page) |
|
| 80 | - . $cfg |
|
| 81 | - . $erreur |
|
| 82 | - . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file)) |
|
| 83 | - ? plugin_desintalle($plug_file, $nom, $dir_plugins) : '') |
|
| 84 | - . "<div class='details'>" // pour l'ajax de exec/info_plugin |
|
| 85 | - . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins)) |
|
| 86 | - . "</div>" |
|
| 87 | - . "</li>"; |
|
| 37 | + static $id_input = 0; |
|
| 38 | + static $versions = array(); |
|
| 39 | + |
|
| 40 | + $force_reload = (_request('var_mode') == 'recalcul'); |
|
| 41 | + $get_infos = charger_fonction('get_infos', 'plugins'); |
|
| 42 | + $info = $get_infos($plug_file, $force_reload, $dir_plugins); |
|
| 43 | + $prefix = $info['prefix']; |
|
| 44 | + $cfg = ""; |
|
| 45 | + $checkable = ($dir_plugins !== _DIR_PLUGINS_DIST); |
|
| 46 | + $nom = plugin_nom($info, $dir_plugins, $plug_file); |
|
| 47 | + $erreur = ""; |
|
| 48 | + |
|
| 49 | + if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) { |
|
| 50 | + $info['slogan'] = _T('plugin_info_non_compatible_spip'); |
|
| 51 | + $erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'", |
|
| 52 | + _T('plugin_info_non_compatible_spip')); |
|
| 53 | + $class_li .= " disabled"; |
|
| 54 | + $checkable = false; |
|
| 55 | + } elseif (isset($info['erreur'])) { |
|
| 56 | + $class_li .= " error"; |
|
| 57 | + $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'", |
|
| 58 | + _T('plugin_info_erreur_xml')) |
|
| 59 | + . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 60 | + $checkable = false; |
|
| 61 | + } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) { |
|
| 62 | + $class_li .= " error"; |
|
| 63 | + $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)), |
|
| 64 | + " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom))) |
|
| 65 | + . "<div class='erreur'>" . implode("<br />", |
|
| 66 | + $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>"; |
|
| 67 | + } else { |
|
| 68 | + $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : ""; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + // numerotons les occurrences d'un meme prefix |
|
| 72 | + $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : ''; |
|
| 73 | + |
|
| 74 | + $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : ""); |
|
| 75 | + |
|
| 76 | + return "<li id='$prefix$id' class='$class_li'>" |
|
| 77 | + . ((!$checkable and !$checked) |
|
| 78 | + ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked)) |
|
| 79 | + . plugin_resume($info, $dir_plugins, $plug_file, $url_page) |
|
| 80 | + . $cfg |
|
| 81 | + . $erreur |
|
| 82 | + . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file)) |
|
| 83 | + ? plugin_desintalle($plug_file, $nom, $dir_plugins) : '') |
|
| 84 | + . "<div class='details'>" // pour l'ajax de exec/info_plugin |
|
| 85 | + . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info, $dir_plugins)) |
|
| 86 | + . "</div>" |
|
| 87 | + . "</li>"; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | function plugin_bouton_config($nom, $infos, $dir) { |
| 91 | - // la verification se base sur le filesystem |
|
| 92 | - // il faut donc n'utiliser que des minuscules, par convention |
|
| 93 | - $prefix = strtolower($infos['prefix']); |
|
| 94 | - // si plugin.xml fournit un squelette, le prendre |
|
| 95 | - if (isset($infos['config']) and $infos['config']) { |
|
| 96 | - return recuperer_fond("$dir$nom/" . $infos['config'], |
|
| 97 | - array( |
|
| 98 | - 'script' => 'configurer_' . $prefix, |
|
| 99 | - 'nom' => $nom |
|
| 100 | - )); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - // si le plugin CFG est la, l'essayer |
|
| 104 | - if (defined('_DIR_PLUGIN_CFG')) { |
|
| 105 | - if (include_spip('inc/cfg')) // test CFG version >= 1.0.5 |
|
| 106 | - { |
|
| 107 | - if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) { |
|
| 108 | - return "<div class='cfg_link'>$cfg</div>"; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - // sinon prendre le squelette std sur le nom std |
|
| 114 | - return recuperer_fond("prive/squelettes/inclure/cfg", |
|
| 115 | - array( |
|
| 116 | - 'script' => 'configurer_' . $prefix, |
|
| 117 | - 'nom' => $nom |
|
| 118 | - )); |
|
| 91 | + // la verification se base sur le filesystem |
|
| 92 | + // il faut donc n'utiliser que des minuscules, par convention |
|
| 93 | + $prefix = strtolower($infos['prefix']); |
|
| 94 | + // si plugin.xml fournit un squelette, le prendre |
|
| 95 | + if (isset($infos['config']) and $infos['config']) { |
|
| 96 | + return recuperer_fond("$dir$nom/" . $infos['config'], |
|
| 97 | + array( |
|
| 98 | + 'script' => 'configurer_' . $prefix, |
|
| 99 | + 'nom' => $nom |
|
| 100 | + )); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + // si le plugin CFG est la, l'essayer |
|
| 104 | + if (defined('_DIR_PLUGIN_CFG')) { |
|
| 105 | + if (include_spip('inc/cfg')) // test CFG version >= 1.0.5 |
|
| 106 | + { |
|
| 107 | + if ($cfg = icone_lien_cfg("$dir$nom", "cfg")) { |
|
| 108 | + return "<div class='cfg_link'>$cfg</div>"; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + // sinon prendre le squelette std sur le nom std |
|
| 114 | + return recuperer_fond("prive/squelettes/inclure/cfg", |
|
| 115 | + array( |
|
| 116 | + 'script' => 'configurer_' . $prefix, |
|
| 117 | + 'nom' => $nom |
|
| 118 | + )); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // checkbox pour activer ou desactiver |
| 122 | 122 | // si ce n'est pas une extension |
| 123 | 123 | |
| 124 | 124 | function plugin_checkbox($id_input, $file, $actif) { |
| 125 | - $name = substr(md5($file), 0, 16); |
|
| 126 | - |
|
| 127 | - return "<div class='check'>\n" |
|
| 128 | - . "<input type='checkbox' name='s$name' id='label_$id_input'" |
|
| 129 | - . ($actif ? " checked='checked'" : "") |
|
| 130 | - . " class='checkbox' value='O' />" |
|
| 131 | - . "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>" |
|
| 132 | - . "</div>"; |
|
| 125 | + $name = substr(md5($file), 0, 16); |
|
| 126 | + |
|
| 127 | + return "<div class='check'>\n" |
|
| 128 | + . "<input type='checkbox' name='s$name' id='label_$id_input'" |
|
| 129 | + . ($actif ? " checked='checked'" : "") |
|
| 130 | + . " class='checkbox' value='O' />" |
|
| 131 | + . "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>" |
|
| 132 | + . "</div>"; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | function plugin_nom($info, $dir_plugins, $plug_file) { |
| 136 | - $prefix = $info['prefix']; |
|
| 137 | - $dir = "$dir_plugins$plug_file"; |
|
| 138 | - // Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom" |
|
| 139 | - if ($info['dtd'] == "paquet") { |
|
| 140 | - $nom = PtoBR(plugin_propre("{$prefix}_nom", "$dir/lang/paquet-$prefix")); |
|
| 141 | - if (!$nom) { |
|
| 142 | - $nom = PtoBR(propre($info['nom'])); |
|
| 143 | - } |
|
| 144 | - } else { |
|
| 145 | - $nom = typo(attribut_html($info['nom'])); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - return trim($nom); |
|
| 136 | + $prefix = $info['prefix']; |
|
| 137 | + $dir = "$dir_plugins$plug_file"; |
|
| 138 | + // Si dtd paquet, on traite le nom soit par son item de langue soit par sa valeur immediate a l'index "nom" |
|
| 139 | + if ($info['dtd'] == "paquet") { |
|
| 140 | + $nom = PtoBR(plugin_propre("{$prefix}_nom", "$dir/lang/paquet-$prefix")); |
|
| 141 | + if (!$nom) { |
|
| 142 | + $nom = PtoBR(propre($info['nom'])); |
|
| 143 | + } |
|
| 144 | + } else { |
|
| 145 | + $nom = typo(attribut_html($info['nom'])); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + return trim($nom); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Cartouche Resume |
| 152 | 152 | function plugin_resume($info, $dir_plugins, $plug_file, $url_page) { |
| 153 | - $prefix = $info['prefix']; |
|
| 154 | - $dir = "$dir_plugins$plug_file"; |
|
| 155 | - $slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix")); |
|
| 156 | - // une seule ligne dans le slogan : couper si besoin |
|
| 157 | - if (($p = strpos($slogan, "<br />")) !== false) { |
|
| 158 | - $slogan = substr($slogan, 0, $p); |
|
| 159 | - } |
|
| 160 | - // couper par securite |
|
| 161 | - $slogan = couper($slogan, 80); |
|
| 162 | - |
|
| 163 | - $nom = plugin_nom($info, $dir_plugins, $plug_file); |
|
| 164 | - |
|
| 165 | - $url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE))); |
|
| 166 | - |
|
| 167 | - if (isset($info['logo']) and $i = trim($info['logo'])) { |
|
| 168 | - include_spip("inc/filtres_images_mini"); |
|
| 169 | - $i = inserer_attribut(image_reduire("$dir/$i", 32), 'alt', ''); |
|
| 170 | - $i = "<div class='icon'><a href='$url' rel='info'>$i</a></div>"; |
|
| 171 | - } else { |
|
| 172 | - $i = ''; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - return "<div class='resume'>" |
|
| 176 | - . "<h3><a href='$url' rel='info'>" |
|
| 177 | - . $nom |
|
| 178 | - . "</a></h3>" |
|
| 179 | - . " <span class='version'>" . $info['version'] . "</span>" |
|
| 180 | - . " <span class='etat'> - " |
|
| 181 | - . plugin_etat_en_clair($info['etat']) |
|
| 182 | - . "</span>" |
|
| 183 | - . "<div class='short'>" . $slogan . "</div>" |
|
| 184 | - . $i |
|
| 185 | - . "</div>"; |
|
| 153 | + $prefix = $info['prefix']; |
|
| 154 | + $dir = "$dir_plugins$plug_file"; |
|
| 155 | + $slogan = PtoBR(plugin_propre($info['slogan'], "$dir/lang/paquet-$prefix")); |
|
| 156 | + // une seule ligne dans le slogan : couper si besoin |
|
| 157 | + if (($p = strpos($slogan, "<br />")) !== false) { |
|
| 158 | + $slogan = substr($slogan, 0, $p); |
|
| 159 | + } |
|
| 160 | + // couper par securite |
|
| 161 | + $slogan = couper($slogan, 80); |
|
| 162 | + |
|
| 163 | + $nom = plugin_nom($info, $dir_plugins, $plug_file); |
|
| 164 | + |
|
| 165 | + $url = parametre_url($url_page, "plugin", substr($dir, strlen(_DIR_RACINE))); |
|
| 166 | + |
|
| 167 | + if (isset($info['logo']) and $i = trim($info['logo'])) { |
|
| 168 | + include_spip("inc/filtres_images_mini"); |
|
| 169 | + $i = inserer_attribut(image_reduire("$dir/$i", 32), 'alt', ''); |
|
| 170 | + $i = "<div class='icon'><a href='$url' rel='info'>$i</a></div>"; |
|
| 171 | + } else { |
|
| 172 | + $i = ''; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + return "<div class='resume'>" |
|
| 176 | + . "<h3><a href='$url' rel='info'>" |
|
| 177 | + . $nom |
|
| 178 | + . "</a></h3>" |
|
| 179 | + . " <span class='version'>" . $info['version'] . "</span>" |
|
| 180 | + . " <span class='etat'> - " |
|
| 181 | + . plugin_etat_en_clair($info['etat']) |
|
| 182 | + . "</span>" |
|
| 183 | + . "<div class='short'>" . $slogan . "</div>" |
|
| 184 | + . $i |
|
| 185 | + . "</div>"; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | function plugin_desintalle($plug_file, $nom, $dir_plugins = null) { |
| 189 | - if (!$dir_plugins) { |
|
| 190 | - $dir_plugins = _DIR_PLUGINS; |
|
| 191 | - } |
|
| 189 | + if (!$dir_plugins) { |
|
| 190 | + $dir_plugins = _DIR_PLUGINS; |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - $action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin'); |
|
| 194 | - $text = _T('bouton_desinstaller'); |
|
| 195 | - $text2 = _T('info_desinstaller_plugin'); |
|
| 196 | - $file = basename($plug_file); |
|
| 193 | + $action = redirige_action_auteur('desinstaller_plugin', "$dir_plugins::$plug_file", 'admin_plugin'); |
|
| 194 | + $text = _T('bouton_desinstaller'); |
|
| 195 | + $text2 = _T('info_desinstaller_plugin'); |
|
| 196 | + $file = basename($plug_file); |
|
| 197 | 197 | |
| 198 | - return "<div class='actions'>[" . |
|
| 199 | - "<a href='$action' |
|
| 198 | + return "<div class='actions'>[" . |
|
| 199 | + "<a href='$action' |
|
| 200 | 200 | onclick='return confirm(\"$text $nom ?\\n$text2\")'>" |
| 201 | - . $text |
|
| 202 | - . "</a>]</div>"; |
|
| 201 | + . $text |
|
| 202 | + . "</a>]</div>"; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -213,132 +213,132 @@ discard block |
||
| 213 | 213 | * Traduction de l'état dans la langue en cours |
| 214 | 214 | **/ |
| 215 | 215 | function plugin_etat_en_clair($etat) { |
| 216 | - if (!in_array($etat, array('stable', 'test', 'experimental'))) { |
|
| 217 | - $etat = 'developpement'; |
|
| 218 | - } |
|
| 216 | + if (!in_array($etat, array('stable', 'test', 'experimental'))) { |
|
| 217 | + $etat = 'developpement'; |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - return _T('plugin_etat_' . $etat); |
|
| 220 | + return _T('plugin_etat_' . $etat); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // http://code.spip.net/@plugin_propre |
| 224 | 224 | function plugin_propre($texte, $module = '') { |
| 225 | - // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine |
|
| 226 | - if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) { |
|
| 227 | - $module = substr($module, strlen(_DIR_RACINE)); |
|
| 228 | - } |
|
| 229 | - if (preg_match("|^\w+_[\w_]+$|", $texte)) { |
|
| 230 | - $texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false)); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - return propre($texte); |
|
| 225 | + // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine |
|
| 226 | + if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) { |
|
| 227 | + $module = substr($module, strlen(_DIR_RACINE)); |
|
| 228 | + } |
|
| 229 | + if (preg_match("|^\w+_[\w_]+$|", $texte)) { |
|
| 230 | + $texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false)); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + return propre($texte); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | // http://code.spip.net/@affiche_bloc_plugin |
| 238 | 238 | function affiche_bloc_plugin($plug_file, $info, $dir_plugins = null) { |
| 239 | - if (!$dir_plugins) { |
|
| 240 | - $dir_plugins = _DIR_PLUGINS; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - $prefix = $info['prefix']; |
|
| 244 | - $dir = "$dir_plugins$plug_file/lang/paquet-$prefix"; |
|
| 245 | - |
|
| 246 | - $s = ""; |
|
| 247 | - // TODO: le traiter_multi ici n'est pas beau |
|
| 248 | - // cf. description du plugin/_stable_/ortho/plugin.xml |
|
| 249 | - $description = ""; |
|
| 250 | - if (isset($info['description'])) { |
|
| 251 | - $description = plugin_propre($info['description'], $dir); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - if (isset($info['documentation']) |
|
| 255 | - and $lien = $info['documentation'] |
|
| 256 | - ) { |
|
| 257 | - $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>'; |
|
| 258 | - } |
|
| 259 | - $s .= "<dd class='desc'>" . $description . "</dd>\n"; |
|
| 260 | - |
|
| 261 | - if (isset($info['auteur'])) { |
|
| 262 | - if (is_array($info['auteur'])) { |
|
| 263 | - $a = formater_credits($info['auteur'], ', '); |
|
| 264 | - } // pour compat mais ne doit plus arriver |
|
| 265 | - else { |
|
| 266 | - $a = trim($info['auteur']); |
|
| 267 | - } |
|
| 268 | - if ($a) { |
|
| 269 | - $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a, |
|
| 270 | - $dir)) . "</dd>\n"; |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - if (isset($info['credit'])) { |
|
| 275 | - if ($a = formater_credits($info['credit'], ', ')) { |
|
| 276 | - $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a, |
|
| 277 | - $dir)) . "</dd>\n"; |
|
| 278 | - } |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - if (isset($info['licence'])) { |
|
| 282 | - if (is_array($info['licence'])) { |
|
| 283 | - $a = formater_credits($info['licence'], ', '); |
|
| 284 | - } // pour compat mais ne doit plus arriver |
|
| 285 | - else { |
|
| 286 | - $a = trim($info['licence']); |
|
| 287 | - } |
|
| 288 | - if ($a) { |
|
| 289 | - $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a, |
|
| 290 | - $dir)) . "</dd>\n"; |
|
| 291 | - } |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - $s = "<dl class='description'>$s</dl>"; |
|
| 295 | - |
|
| 296 | - // |
|
| 297 | - // Ajouter les infos techniques |
|
| 298 | - // |
|
| 299 | - $infotech = array(); |
|
| 300 | - |
|
| 301 | - $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version']; |
|
| 302 | - // Version SVN |
|
| 303 | - if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) { |
|
| 304 | - $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']'; |
|
| 305 | - } |
|
| 306 | - $version .= "</dd>"; |
|
| 307 | - $infotech[] = $version; |
|
| 308 | - $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>"; |
|
| 309 | - // source zip le cas echeant |
|
| 310 | - $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log) |
|
| 311 | - and preg_match(',^source:(.*)$,m', $log, $r)) |
|
| 312 | - ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>" |
|
| 313 | - : ''; |
|
| 314 | - |
|
| 315 | - $infotech[] = !$info['necessite'] ? '' : |
|
| 316 | - ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ', |
|
| 317 | - array_map('array_shift', $info['necessite'])) . '</dd>'); |
|
| 318 | - |
|
| 319 | - $s .= "<dl class='tech'>" |
|
| 320 | - . join('', $infotech) |
|
| 321 | - . "</dl>"; |
|
| 322 | - |
|
| 323 | - |
|
| 324 | - return $s; |
|
| 239 | + if (!$dir_plugins) { |
|
| 240 | + $dir_plugins = _DIR_PLUGINS; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + $prefix = $info['prefix']; |
|
| 244 | + $dir = "$dir_plugins$plug_file/lang/paquet-$prefix"; |
|
| 245 | + |
|
| 246 | + $s = ""; |
|
| 247 | + // TODO: le traiter_multi ici n'est pas beau |
|
| 248 | + // cf. description du plugin/_stable_/ortho/plugin.xml |
|
| 249 | + $description = ""; |
|
| 250 | + if (isset($info['description'])) { |
|
| 251 | + $description = plugin_propre($info['description'], $dir); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + if (isset($info['documentation']) |
|
| 255 | + and $lien = $info['documentation'] |
|
| 256 | + ) { |
|
| 257 | + $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>'; |
|
| 258 | + } |
|
| 259 | + $s .= "<dd class='desc'>" . $description . "</dd>\n"; |
|
| 260 | + |
|
| 261 | + if (isset($info['auteur'])) { |
|
| 262 | + if (is_array($info['auteur'])) { |
|
| 263 | + $a = formater_credits($info['auteur'], ', '); |
|
| 264 | + } // pour compat mais ne doit plus arriver |
|
| 265 | + else { |
|
| 266 | + $a = trim($info['auteur']); |
|
| 267 | + } |
|
| 268 | + if ($a) { |
|
| 269 | + $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a, |
|
| 270 | + $dir)) . "</dd>\n"; |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + if (isset($info['credit'])) { |
|
| 275 | + if ($a = formater_credits($info['credit'], ', ')) { |
|
| 276 | + $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a, |
|
| 277 | + $dir)) . "</dd>\n"; |
|
| 278 | + } |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + if (isset($info['licence'])) { |
|
| 282 | + if (is_array($info['licence'])) { |
|
| 283 | + $a = formater_credits($info['licence'], ', '); |
|
| 284 | + } // pour compat mais ne doit plus arriver |
|
| 285 | + else { |
|
| 286 | + $a = trim($info['licence']); |
|
| 287 | + } |
|
| 288 | + if ($a) { |
|
| 289 | + $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a, |
|
| 290 | + $dir)) . "</dd>\n"; |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + $s = "<dl class='description'>$s</dl>"; |
|
| 295 | + |
|
| 296 | + // |
|
| 297 | + // Ajouter les infos techniques |
|
| 298 | + // |
|
| 299 | + $infotech = array(); |
|
| 300 | + |
|
| 301 | + $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version']; |
|
| 302 | + // Version SVN |
|
| 303 | + if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) { |
|
| 304 | + $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']'; |
|
| 305 | + } |
|
| 306 | + $version .= "</dd>"; |
|
| 307 | + $infotech[] = $version; |
|
| 308 | + $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>"; |
|
| 309 | + // source zip le cas echeant |
|
| 310 | + $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log) |
|
| 311 | + and preg_match(',^source:(.*)$,m', $log, $r)) |
|
| 312 | + ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>" |
|
| 313 | + : ''; |
|
| 314 | + |
|
| 315 | + $infotech[] = !$info['necessite'] ? '' : |
|
| 316 | + ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ', |
|
| 317 | + array_map('array_shift', $info['necessite'])) . '</dd>'); |
|
| 318 | + |
|
| 319 | + $s .= "<dl class='tech'>" |
|
| 320 | + . join('', $infotech) |
|
| 321 | + . "</dl>"; |
|
| 322 | + |
|
| 323 | + |
|
| 324 | + return $s; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | function formater_credits($infos, $sep = ', ') { |
| 328 | - $texte = ''; |
|
| 329 | - |
|
| 330 | - foreach ($infos as $_credit) { |
|
| 331 | - if ($texte) { |
|
| 332 | - $texte .= $sep; |
|
| 333 | - } |
|
| 334 | - // Si le credit en cours n'est pas un array c'est donc un copyright |
|
| 335 | - $texte .= |
|
| 336 | - (!is_array($_credit)) |
|
| 337 | - ? PtoBR(propre($_credit)) |
|
| 338 | - : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') . |
|
| 339 | - $_credit['nom'] . |
|
| 340 | - ($_credit['url'] ? '</a>' : ''); |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - return $texte; |
|
| 328 | + $texte = ''; |
|
| 329 | + |
|
| 330 | + foreach ($infos as $_credit) { |
|
| 331 | + if ($texte) { |
|
| 332 | + $texte .= $sep; |
|
| 333 | + } |
|
| 334 | + // Si le credit en cours n'est pas un array c'est donc un copyright |
|
| 335 | + $texte .= |
|
| 336 | + (!is_array($_credit)) |
|
| 337 | + ? PtoBR(propre($_credit)) |
|
| 338 | + : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') . |
|
| 339 | + $_credit['nom'] . |
|
| 340 | + ($_credit['url'] ? '</a>' : ''); |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + return $texte; |
|
| 344 | 344 | } |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | $class_li .= " error"; |
| 57 | 57 | $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'", |
| 58 | 58 | _T('plugin_info_erreur_xml')) |
| 59 | - . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 59 | + . "<div class='erreur'>".join('<br >', $info['erreur'])."</div>"; |
|
| 60 | 60 | $checkable = false; |
| 61 | - } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) { |
|
| 61 | + } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) { |
|
| 62 | 62 | $class_li .= " error"; |
| 63 | 63 | $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)), |
| 64 | 64 | " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom))) |
| 65 | - . "<div class='erreur'>" . implode("<br />", |
|
| 66 | - $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>"; |
|
| 65 | + . "<div class='erreur'>".implode("<br />", |
|
| 66 | + $GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])."</div>"; |
|
| 67 | 67 | } else { |
| 68 | 68 | $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : ""; |
| 69 | 69 | } |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | // numerotons les occurrences d'un meme prefix |
| 72 | 72 | $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : ''; |
| 73 | 73 | |
| 74 | - $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : ""); |
|
| 74 | + $class_li .= ($actif ? " actif" : "").($expose ? " on" : ""); |
|
| 75 | 75 | |
| 76 | 76 | return "<li id='$prefix$id' class='$class_li'>" |
| 77 | 77 | . ((!$checkable and !$checked) |
| 78 | - ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked)) |
|
| 78 | + ? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked)) |
|
| 79 | 79 | . plugin_resume($info, $dir_plugins, $plug_file, $url_page) |
| 80 | 80 | . $cfg |
| 81 | 81 | . $erreur |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | $prefix = strtolower($infos['prefix']); |
| 94 | 94 | // si plugin.xml fournit un squelette, le prendre |
| 95 | 95 | if (isset($infos['config']) and $infos['config']) { |
| 96 | - return recuperer_fond("$dir$nom/" . $infos['config'], |
|
| 96 | + return recuperer_fond("$dir$nom/".$infos['config'], |
|
| 97 | 97 | array( |
| 98 | - 'script' => 'configurer_' . $prefix, |
|
| 98 | + 'script' => 'configurer_'.$prefix, |
|
| 99 | 99 | 'nom' => $nom |
| 100 | 100 | )); |
| 101 | 101 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | // sinon prendre le squelette std sur le nom std |
| 114 | 114 | return recuperer_fond("prive/squelettes/inclure/cfg", |
| 115 | 115 | array( |
| 116 | - 'script' => 'configurer_' . $prefix, |
|
| 116 | + 'script' => 'configurer_'.$prefix, |
|
| 117 | 117 | 'nom' => $nom |
| 118 | 118 | )); |
| 119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | . "<input type='checkbox' name='s$name' id='label_$id_input'" |
| 129 | 129 | . ($actif ? " checked='checked'" : "") |
| 130 | 130 | . " class='checkbox' value='O' />" |
| 131 | - . "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>" |
|
| 131 | + . "\n<label for='label_$id_input'>"._T('activer_plugin')."</label>" |
|
| 132 | 132 | . "</div>"; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | . "<h3><a href='$url' rel='info'>" |
| 177 | 177 | . $nom |
| 178 | 178 | . "</a></h3>" |
| 179 | - . " <span class='version'>" . $info['version'] . "</span>" |
|
| 179 | + . " <span class='version'>".$info['version']."</span>" |
|
| 180 | 180 | . " <span class='etat'> - " |
| 181 | 181 | . plugin_etat_en_clair($info['etat']) |
| 182 | 182 | . "</span>" |
| 183 | - . "<div class='short'>" . $slogan . "</div>" |
|
| 183 | + . "<div class='short'>".$slogan."</div>" |
|
| 184 | 184 | . $i |
| 185 | 185 | . "</div>"; |
| 186 | 186 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $text2 = _T('info_desinstaller_plugin'); |
| 196 | 196 | $file = basename($plug_file); |
| 197 | 197 | |
| 198 | - return "<div class='actions'>[" . |
|
| 198 | + return "<div class='actions'>[". |
|
| 199 | 199 | "<a href='$action' |
| 200 | 200 | onclick='return confirm(\"$text $nom ?\\n$text2\")'>" |
| 201 | 201 | . $text |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $etat = 'developpement'; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - return _T('plugin_etat_' . $etat); |
|
| 220 | + return _T('plugin_etat_'.$etat); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // http://code.spip.net/@plugin_propre |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $module = substr($module, strlen(_DIR_RACINE)); |
| 228 | 228 | } |
| 229 | 229 | if (preg_match("|^\w+_[\w_]+$|", $texte)) { |
| 230 | - $texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false)); |
|
| 230 | + $texte = _T(($module ? "$module:" : '').$texte, array(), array('force' => false)); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | return propre($texte); |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | if (isset($info['documentation']) |
| 255 | 255 | and $lien = $info['documentation'] |
| 256 | 256 | ) { |
| 257 | - $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>'; |
|
| 257 | + $description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>'; |
|
| 258 | 258 | } |
| 259 | - $s .= "<dd class='desc'>" . $description . "</dd>\n"; |
|
| 259 | + $s .= "<dd class='desc'>".$description."</dd>\n"; |
|
| 260 | 260 | |
| 261 | 261 | if (isset($info['auteur'])) { |
| 262 | 262 | if (is_array($info['auteur'])) { |
@@ -266,15 +266,15 @@ discard block |
||
| 266 | 266 | $a = trim($info['auteur']); |
| 267 | 267 | } |
| 268 | 268 | if ($a) { |
| 269 | - $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a, |
|
| 270 | - $dir)) . "</dd>\n"; |
|
| 269 | + $s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre($a, |
|
| 270 | + $dir))."</dd>\n"; |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | if (isset($info['credit'])) { |
| 275 | 275 | if ($a = formater_credits($info['credit'], ', ')) { |
| 276 | - $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a, |
|
| 277 | - $dir)) . "</dd>\n"; |
|
| 276 | + $s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre($a, |
|
| 277 | + $dir))."</dd>\n"; |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | $a = trim($info['licence']); |
| 287 | 287 | } |
| 288 | 288 | if ($a) { |
| 289 | - $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a, |
|
| 290 | - $dir)) . "</dd>\n"; |
|
| 289 | + $s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre($a, |
|
| 290 | + $dir))."</dd>\n"; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
@@ -298,23 +298,22 @@ discard block |
||
| 298 | 298 | // |
| 299 | 299 | $infotech = array(); |
| 300 | 300 | |
| 301 | - $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version']; |
|
| 301 | + $version = "<dt>"._T('version')."</dt><dd>".$info['version']; |
|
| 302 | 302 | // Version SVN |
| 303 | - if ($svn_revision = version_svn_courante($dir_plugins . $plug_file)) { |
|
| 304 | - $version .= ($svn_revision < 0 ? ' SVN' : '') . ' [' . abs($svn_revision) . ']'; |
|
| 303 | + if ($svn_revision = version_svn_courante($dir_plugins.$plug_file)) { |
|
| 304 | + $version .= ($svn_revision < 0 ? ' SVN' : '').' ['.abs($svn_revision).']'; |
|
| 305 | 305 | } |
| 306 | 306 | $version .= "</dd>"; |
| 307 | 307 | $infotech[] = $version; |
| 308 | - $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>"; |
|
| 308 | + $infotech[] = "<dt>"._T('repertoire_plugins')."</dt><dd>".joli_repertoire("$dir_plugins$plug_file")."</dd>"; |
|
| 309 | 309 | // source zip le cas echeant |
| 310 | - $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log) |
|
| 310 | + $infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log) |
|
| 311 | 311 | and preg_match(',^source:(.*)$,m', $log, $r)) |
| 312 | - ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>" |
|
| 312 | + ? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1])."</dd>" |
|
| 313 | 313 | : ''; |
| 314 | 314 | |
| 315 | - $infotech[] = !$info['necessite'] ? '' : |
|
| 316 | - ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ', |
|
| 317 | - array_map('array_shift', $info['necessite'])) . '</dd>'); |
|
| 315 | + $infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(' ', |
|
| 316 | + array_map('array_shift', $info['necessite'])).'</dd>'); |
|
| 318 | 317 | |
| 319 | 318 | $s .= "<dl class='tech'>" |
| 320 | 319 | . join('', $infotech) |
@@ -335,8 +334,8 @@ discard block |
||
| 335 | 334 | $texte .= |
| 336 | 335 | (!is_array($_credit)) |
| 337 | 336 | ? PtoBR(propre($_credit)) |
| 338 | - : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') . |
|
| 339 | - $_credit['nom'] . |
|
| 337 | + : ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : ''). |
|
| 338 | + $_credit['nom']. |
|
| 340 | 339 | ($_credit['url'] ? '</a>' : ''); |
| 341 | 340 | } |
| 342 | 341 | |