3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
16 * Analyser un arbre xml et extraire les infos concernant les boutons et onglets
18 * @param <type> $arbre
21 function plugins_extraire_boutons_dist($arbre){
22 $ret = array('bouton'=>array(),'onglet'=>array());
23 // recuperer les boutons et onglets si necessaire
24 spip_xml_match_nodes(",^(bouton|onglet)\s,",$arbre,$les_boutons);
25 if (is_array($les_boutons) && count($les_boutons)){
26 $ret['bouton'] = array();
27 $ret['onglet'] = array();
28 foreach($les_boutons as $bouton => $val) {
29 $bouton = spip_xml_decompose_tag($bouton);
30 $type = reset($bouton);
31 $bouton = end($bouton);
32 if (isset($bouton['id'])){
36 $ret[$type][$id]['parent'] = isset($bouton['parent'])?
$bouton['parent']:'';
37 $ret[$type][$id]['position'] = isset($bouton['position'])?
$bouton['position']:'';
38 $ret[$type][$id]['titre'] = isset($val['titre'])?
trim(spip_xml_aplatit($val['titre'])):'';
39 $ret[$type][$id]['icone'] = isset($val['icone'])?
trim(end($val['icone'])):'';
40 $ret[$type][$id]['action'] = isset($val['url'])?
trim(end($val['url'])):'';
41 $ret[$type][$id]['parametres'] = isset($val['args'])?
trim(end($val['args'])):'';