1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: NBC ThemeChanger |
---|
4 | Version: 2.0.1.b |
---|
5 | Description: Permet d imposer un theme à une categorie (merci a P@t). |
---|
6 | ThemeChanger vous permet de spécifier pour chaque catégorie un thème différent. |
---|
7 | Pour les catégories non spécifiées, le thème par défaut s'applique. |
---|
8 | ThemeChanger allow you to specify for each category a different theme. |
---|
9 | For the unspecified categories, the theme by default is applied. |
---|
10 | ThemeChanger permette di precisare per ogni categoria un tema diverso. |
---|
11 | Per le categorie non precisato, il tema da difetto è applicato. |
---|
12 | Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=214 |
---|
13 | Author: Nicco |
---|
14 | Author URI: http://gallery-nicco.no-ip.org |
---|
15 | Author Portage piwigo 2.0.X : Datajulien |
---|
16 | Author Portage piwigo 2.0.X URI : http://morgane.quoirez.com |
---|
17 | */ |
---|
18 | |
---|
19 | define('NBC_ThemeChanger_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
20 | |
---|
21 | |
---|
22 | //if (!defined(NBC_ThemeChanger_PATH)) die('Hacking attempt - ThemeChanger main.inc.php - NBC_ThemeChanger_PATH!'); |
---|
23 | |
---|
24 | /* Set the administration panel of the plugin */ |
---|
25 | |
---|
26 | |
---|
27 | class ThemeChanger |
---|
28 | // Sets the administration panel of the plugin |
---|
29 | { |
---|
30 | function nbc_ThemeChanger_admin_menu($menu) |
---|
31 | { |
---|
32 | array_push($menu, |
---|
33 | array( |
---|
34 | 'NAME' => 'ThemeChanger', |
---|
35 | 'URL' => get_admin_plugin_menu_link(NBC_ThemeChanger_PATH.'admin/nbc_ThemeChanger_admin.php') |
---|
36 | ) |
---|
37 | ); |
---|
38 | return $menu; |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | $obj = new ThemeChanger(); |
---|
43 | |
---|
44 | function change_category_theme() |
---|
45 | { |
---|
46 | global $template, $page, $user, $conf; |
---|
47 | |
---|
48 | $conf_nbc_ThemeChanger = isset($conf['nbc_ThemeChanger']) ? explode(";" , $conf['nbc_ThemeChanger']) : array(); |
---|
49 | |
---|
50 | $category_theme = array(); |
---|
51 | |
---|
52 | foreach ($conf_nbc_ThemeChanger as $Theme_Cat) |
---|
53 | { |
---|
54 | $element_ThemeChanger = explode("," , $Theme_Cat); |
---|
55 | |
---|
56 | if ($element_ThemeChanger[0] <> '' and $element_ThemeChanger[1] <> '' and $element_ThemeChanger[2] <> '') |
---|
57 | $category_theme[$element_ThemeChanger[0]] = array( $element_ThemeChanger[1] , $element_ThemeChanger[2] ); |
---|
58 | } |
---|
59 | |
---|
60 | if (isset($page['category']['id']) and isset($category_theme[$page['category']['id']])) |
---|
61 | { |
---|
62 | $user['template'] = $category_theme[$page['category']['id']][0]; |
---|
63 | $user['theme'] = $category_theme[$page['category']['id']][1]; |
---|
64 | |
---|
65 | $template->Template(PHPWG_ROOT_PATH.'template/'.$user['template'], $user['theme']); |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'nbc_ThemeChanger_admin_menu') ); |
---|
70 | add_event_handler('loc_end_section_init', 'change_category_theme'); |
---|
71 | set_plugin_data($plugin['id'], $obj) |
---|
72 | |
---|
73 | ?> |
---|