4b95e9072cc3c03e19f53df039391ddd04c06bac
[lhc/web/www.git] / www / plugins / yaml / experimental / yaml_fonctions.php
1 <?php
2
3 if (!defined('_ECRIRE_INC_VERSION')) {
4 return;
5 }
6
7 function yaml_article($id_article) {
8 include_spip('inc/yaml');
9 $a = array_filter(sql_fetsel('*', 'spip_articles', 'id_article='.$id_article));
10 $a['rubrique'] = array_filter(sql_fetsel('*', 'spip_rubriques', 'id_rubrique='.$a['id_rubrique']));
11
12 foreach (sql_allfetsel('*', 'spip_mots AS m LEFT JOIN spip_mots_articles AS c ON m.id_mot=c.id_mot', 'c.id_article='.$id_article) as $m) {
13 $a['mots'][] = array_filter($m);
14 }
15
16 return yaml_encode(array_filter($a));
17 }