X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Fplugins%2Fextraire_boutons.php;fp=www%2Fecrire%2Fplugins%2Fextraire_boutons.php;h=016dfe402c3baa4391151a3827bfb1839f8004ea;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/ecrire/plugins/extraire_boutons.php b/www/ecrire/plugins/extraire_boutons.php new file mode 100644 index 0000000..016dfe4 --- /dev/null +++ b/www/ecrire/plugins/extraire_boutons.php @@ -0,0 +1,50 @@ + $arbre + * @return + */ +function plugins_extraire_boutons_dist($arbre){ + $ret = array('bouton'=>array(),'onglet'=>array()); + // recuperer les boutons et onglets si necessaire + spip_xml_match_nodes(",^(bouton|onglet)\s,",$arbre,$les_boutons); + if (is_array($les_boutons) && count($les_boutons)){ + $ret['bouton'] = array(); + $ret['onglet'] = array(); + foreach($les_boutons as $bouton => $val) { + $bouton = spip_xml_decompose_tag($bouton); + $type = reset($bouton); + $bouton = end($bouton); + if (isset($bouton['id'])){ + $id = $bouton['id']; + $val = reset($val); + if(is_array($val)){ + $ret[$type][$id]['parent'] = isset($bouton['parent'])?$bouton['parent']:''; + $ret[$type][$id]['position'] = isset($bouton['position'])?$bouton['position']:''; + $ret[$type][$id]['titre'] = isset($val['titre'])?trim(spip_xml_aplatit($val['titre'])):''; + $ret[$type][$id]['icone'] = isset($val['icone'])?trim(end($val['icone'])):''; + $ret[$type][$id]['url'] = isset($val['url'])?trim(end($val['url'])):''; + $ret[$type][$id]['args'] = isset($val['args'])?trim(end($val['args'])):''; + } + } + } + } + return $ret; +} + + +?>