Пример #1
0
function plugins_afficher_plugin_dist($url_page, $plug_file, $checked, $actif, $expose = false, $class_li = "item", $dir_plugins = _DIR_PLUGINS)
{
    static $id_input = 0;
    static $versions = array();
    $force_reload = _request('var_mode') == 'recalcul';
    $get_infos = charger_fonction('get_infos', 'plugins');
    $info = $get_infos($plug_file, $force_reload, $dir_plugins);
    $prefix = $info['prefix'];
    $cfg = "";
    $checkable = $dir_plugins !== _DIR_PLUGINS_DIST;
    $nom = plugin_nom($info, $dir_plugins, $plug_file);
    if (!plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
        $info['slogan'] = _T('plugin_info_non_compatible_spip');
        $erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err'", _T('plugin_info_non_compatible_spip'));
        $class_li .= " disabled";
        $checkable = false;
    } elseif (isset($info['erreur'])) {
        $class_li .= " error";
        $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'", _T('plugin_info_erreur_xml')) . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
        $checkable = false;
    } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
        $class_li .= " error";
        $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)), " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom))) . "<div class='erreur'>" . implode("<br />", $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
    } else {
        $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
    }
    // numerotons les occurrences d'un meme prefix
    $versions[$prefix] = $id = isset($versions[$prefix]) ? $versions[$prefix] + 1 : '';
    $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
    return "<li id='{$prefix}{$id}' class='{$class_li}'>" . ((!$checkable and !$checked) ? '' : plugin_checkbox(++$id_input, $plug_file, $checked)) . plugin_resume($info, $dir_plugins, $plug_file, $url_page) . $cfg . $erreur . (($dir_plugins !== _DIR_PLUGINS_DIST and plugin_est_installe($plug_file)) ? plugin_desintalle($plug_file, $nom) : '') . "<div class='details'>" . (!$expose ? '' : affiche_bloc_plugin($plug_file, $info)) . "</div>" . "</li>";
}
Пример #2
0
function plugins_afficher_plugin_dist($url_page, $plug_file, $actif, $expose=false, $class_li="item", $dir_plugins=_DIR_PLUGINS) {

	static $id_input = 0;
	static $versions = array();

	$force_reload = (_request('var_mode')=='recalcul');
	$get_infos = charger_fonction('get_infos','plugins');
	$info = $get_infos($plug_file, $force_reload, $dir_plugins);
	$prefix = $info['prefix'];
	$erreur = (!isset($info['erreur']) ? ''
	: ("<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"));

	$cfg = !$actif ? '' : plugin_bouton_config($plug_file,$info,$dir_plugins);

	// numerotons les occurrences d'un meme prefix
	$versions[$prefix] = $id = isset($versions[$prefix]) ? $versions[$prefix] + 1 : '';

	$class_li .= ($actif?" actif":"") . ($expose?" on":"") . (isset($info['erreur']) ? " erreur" : '');

	return "<li id='$prefix$id' class='$class_li'>"
	. (($erreur OR $dir_plugins===_DIR_EXTENSIONS)
	   ? '': plugin_checkbox(++$id_input, $plug_file, $actif))
	.  plugin_resume($info, $dir_plugins, $plug_file, $url_page)
	. $cfg
	. $erreur
	. (($dir_plugins!==_DIR_EXTENSIONS AND plugin_est_installe($plug_file))
	    ? plugin_desintalle($plug_file) : '')
	. "<div class='details'>" // pour l'ajax de exec/info_plugin
	. (!$expose ? '' : affiche_bloc_plugin($plug_file, $info))
	. "</div>"
	."</li>";
}