示例#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>";
}
示例#3
0
文件: info_plugin.php 项目: JLuc/SPIP
/**
 * Affichage de la description d'un plugin (en ajax)
 * @uses plugins_get_infos_dist()
 * @uses plugins_afficher_plugin_dist()
 * @uses affiche_bloc_plugin()
 * @uses ajax_retour()
 */
function exec_info_plugin_dist()
{
    if (!autoriser('configurer', '_plugins')) {
        include_spip('inc/minipres');
        echo minipres();
    } else {
        $plug = _DIR_RACINE . _request('plugin');
        $get_infos = charger_fonction('get_infos', 'plugins');
        $dir = "";
        if (strncmp($plug, _DIR_PLUGINS, strlen(_DIR_PLUGINS)) == 0) {
            $dir = _DIR_PLUGINS;
        } elseif (strncmp($plug, _DIR_PLUGINS_DIST, strlen(_DIR_PLUGINS_DIST)) == 0) {
            $dir = _DIR_PLUGINS_DIST;
        }
        if ($dir) {
            $plug = substr($plug, strlen($dir));
        }
        $info = $get_infos($plug, false, $dir);
        $afficher_plugin = charger_fonction("afficher_plugin", "plugins");
        ajax_retour(affiche_bloc_plugin($plug, $info, $dir));
    }
}
示例#4
0
function exec_info_plugin_dist() {
	if (!autoriser('configurer', 'plugins')) {
		include_spip('inc/minipres');
		echo minipres();
	} else {
		$plug = _request('plugin');
		$dir_plugins = _DIR_PLUGINS;
		if (strncmp($plug, _DIR_EXTENSIONS,strlen(_DIR_EXTENSIONS)) === 0) {
			$dir_plugins = _DIR_EXTENSIONS;
			$plug = substr($plug,strlen(_DIR_EXTENSIONS));
		}
		else if (strncmp($plug, _DIR_PLUGINS,strlen(_DIR_PLUGINS)) === 0) {
			$dir_plugins = _DIR_PLUGINS;
			$plug = substr($plug,strlen(_DIR_PLUGINS));
		}
		// sinon c'est louche, mais on essaye quand meme

		$get_infos = charger_fonction('get_infos','plugins');
		$info = $get_infos($plug, false, $dir_plugins);
		$afficher_plugin = charger_fonction("afficher_plugin","plugins");
		ajax_retour(affiche_bloc_plugin($plug, $info));
	}
}
示例#5
0
function player_petite_boite_info () {
	include_spip('inc/plugin');
	if ($GLOBALS['spip_version_code']>=15133)
		include_spip('plugins/afficher_plugin');
	$get_infos = ($GLOBALS['spip_version_code']>=15133)?charger_fonction('get_infos','plugins'):'plugin_get_infos'; // Compatibilite SPIP 2.1
	$info = $get_infos(_DIR_PLUGIN_PLAYER);
	$titre = _T(_PLAYER_LANG.'player_nom');
	$result = ""
		. debut_cadre_relief('plugin-24.gif', true, '', $titre)
		. affiche_bloc_plugin(_DIR_PLUGIN_PLAYER, $info)
		. fin_cadre_relief(true)
		;
	return($result);
}