1 | <?php /* |
---|
2 | Plugin Name: RV Menu Tree |
---|
3 | Version: 2.6.a |
---|
4 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=238 |
---|
5 | Description: Replaces the categories in the menu bar with a nicer one (javascript). |
---|
6 | Author: rvelices |
---|
7 | Author URI: http://www.modusoptimus.com |
---|
8 | */ |
---|
9 | |
---|
10 | add_event_handler('get_categories_menu_sql_where', 'rv_mt_get_categories_menu_sql_where', EVENT_HANDLER_PRIORITY_NEUTRAL, 3 ); |
---|
11 | |
---|
12 | function rv_mt_get_categories_menu_sql_where($where, $expand, $filter) |
---|
13 | { |
---|
14 | if (mobile_theme()) |
---|
15 | return $where; |
---|
16 | add_event_handler('blockmanager_apply', 'rv_mt_menubar_categories'); |
---|
17 | |
---|
18 | if ($expand or $filter) |
---|
19 | return $where; |
---|
20 | |
---|
21 | global $page; |
---|
22 | if ( !isset($page['category']) ) |
---|
23 | $where = 'id_uppercat IS NULL OR uppercats REGEXP \'^[0-9]+,[0-9]+$\''; |
---|
24 | else |
---|
25 | { |
---|
26 | $where = 'id_uppercat is NULL |
---|
27 | OR uppercats LIKE "'.$page['category']['upper_names'][0]['id'].',%" |
---|
28 | OR uppercats REGEXP \'^[0-9]+,[0-9]+$\''; |
---|
29 | } |
---|
30 | return $where; |
---|
31 | } |
---|
32 | |
---|
33 | function rv_mt_menubar_categories($menu_ref_arr) |
---|
34 | { |
---|
35 | $menu = & $menu_ref_arr[0]; |
---|
36 | |
---|
37 | if (($block = $menu->get_block('mbCategories')) != null) |
---|
38 | { |
---|
39 | global $template, $page; |
---|
40 | |
---|
41 | $rvmt_base_name = basename(dirname(__FILE__)); |
---|
42 | $template->set_template_dir(PHPWG_ROOT_PATH.'plugins/'.$rvmt_base_name.'/template/'); |
---|
43 | $template->assign(array( |
---|
44 | 'RVMT_BASE_NAME' => $rvmt_base_name, |
---|
45 | 'RVMT_UPPER_IDS' => isset($page['category']['uppercats']) ? array_flip( explode(',', $page['category']['uppercats'])) : null, |
---|
46 | ) |
---|
47 | ); |
---|
48 | $block->template = 'rv_menutree_categories.tpl'; |
---|
49 | } |
---|
50 | } |
---|
51 | ?> |
---|