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