[PLUGINS] ~maj globale
[lhc/web/www.git] / www / plugins / zen-garden-2 / inc / zengarden.php
1 <?php
2 /**
3 * Plugin Zen-Garden pour Spip 3.0
4 * Licence GPL (c) 2006-2013 Cedric Morin
5 *
6 */
7
8 if (!defined("_ECRIRE_INC_VERSION")) {
9 return;
10 }
11
12 if (!defined('_DIR_THEMES')) {
13 define('_DIR_THEMES', _DIR_RACINE . "themes/");
14 }
15
16 if (!defined('_DIR_THEMES_DIST')) {
17 define('_DIR_THEMES_DIST', _DIR_RACINE . "themes-dist/");
18 }
19
20 function zengarden_charge_themes($dir = _DIR_THEMES, $tous = false, $force = false){
21 $themes = array();
22
23 include_spip('inc/plugin');
24 $files = liste_plugin_files($dir);
25
26 if (count($files)) {
27 $get_infos = charger_fonction('get_infos', 'plugins');
28
29 $t = $get_infos($files,$force,$dir);
30 $themes = array();
31
32 foreach($files as $d){
33 if (isset($t[$d])){
34 if (isset($t[$d]['categorie']) and $t[$d]['categorie']=='theme'
35 AND ($tous OR $t[$d]['etat']=='stable')){
36 $t[$d]['tri'] = strtolower(basename($d));
37 $themes[substr($dir.$d,strlen(_DIR_RACINE))] = $t[$d];
38 }
39 }
40 unset($t[$d]);
41 }
42 }
43
44 return $themes;
45 }