1 | <?php |
---|
2 | defined('SKELETON_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | /** |
---|
5 | * detect current section |
---|
6 | */ |
---|
7 | function skeleton_loc_end_section_init() |
---|
8 | { |
---|
9 | global $tokens, $page, $conf; |
---|
10 | |
---|
11 | if ($tokens[0] == 'skeleton') |
---|
12 | { |
---|
13 | $page['section'] = 'skeleton'; |
---|
14 | $page['title'] = '<a href="'.get_absolute_root_url().'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.SKELETON_PUBLIC.'">'.l10n('Skeleton').'</a>'; |
---|
15 | |
---|
16 | // print_r($tokens); |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | /** |
---|
21 | * include public page |
---|
22 | */ |
---|
23 | function skeleton_loc_end_page() |
---|
24 | { |
---|
25 | global $page; |
---|
26 | |
---|
27 | if ( isset($page['section']) and $page['section'] == 'skeleton' ) |
---|
28 | { |
---|
29 | include(SKELETON_PATH . 'include/skeleton_page.inc.php'); |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | /** |
---|
34 | * add link in existing menu |
---|
35 | */ |
---|
36 | function skeleton_blockmanager_apply1($menu_ref_arr) |
---|
37 | { |
---|
38 | $menu = &$menu_ref_arr[0]; |
---|
39 | |
---|
40 | if ( ($block = $menu->get_block('mbMenu')) != null ) |
---|
41 | { |
---|
42 | array_push($block->data, array( |
---|
43 | 'URL' => SKELETON_PUBLIC, |
---|
44 | 'TITLE' => l10n('Skeleton'), |
---|
45 | 'NAME' => l10n('Skeleton'), |
---|
46 | )); |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | * add a nbew menu block |
---|
52 | */ |
---|
53 | function skeleton_blockmanager_register_blocks($menu_ref_arr) |
---|
54 | { |
---|
55 | $menu = &$menu_ref_arr[0]; |
---|
56 | |
---|
57 | if ($menu->get_id() == 'menubar') |
---|
58 | { |
---|
59 | $menu->register_block(new RegisteredBlock('mbSkeleton', l10n('Skeleton'), 'skeleton')); |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | /** |
---|
64 | * fill the added menu block |
---|
65 | */ |
---|
66 | function skeleton_blockmanager_apply2($menu_ref_arr) |
---|
67 | { |
---|
68 | $menu = &$menu_ref_arr[0]; |
---|
69 | |
---|
70 | if ( ($block = $menu->get_block('mbSkeleton')) != null ) |
---|
71 | { |
---|
72 | global $template; |
---|
73 | |
---|
74 | $block->set_title(l10n('Skeleton')); |
---|
75 | |
---|
76 | $block->data['link1'] = |
---|
77 | array( |
---|
78 | 'URL' => get_absolute_root_url(), |
---|
79 | 'TITLE' => l10n('First link'), |
---|
80 | 'NAME' => l10n('Link 1'), |
---|
81 | 'REL'=> 'rel="nofollow"', |
---|
82 | ); |
---|
83 | |
---|
84 | $block->data['link2'] = |
---|
85 | array( |
---|
86 | 'URL' => SKELETON_PUBLIC, |
---|
87 | 'TITLE' => l10n('Second link'), |
---|
88 | 'NAME' => l10n('Link 2'), |
---|
89 | ); |
---|
90 | |
---|
91 | $template->set_template_dir(SKELETON_PATH . 'template/'); |
---|
92 | $block->template = 'menubar_skeleton.tpl'; |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | /** |
---|
97 | * add a prefilter on photo page |
---|
98 | */ |
---|
99 | function skeleton_loc_end_picture() |
---|
100 | { |
---|
101 | global $template; |
---|
102 | |
---|
103 | $template->set_prefilter('picture', 'skeleton_picture_prefilter'); |
---|
104 | } |
---|
105 | |
---|
106 | function skeleton_picture_prefilter($content) |
---|
107 | { |
---|
108 | $search = '{if $display_info.author and isset($INFO_AUTHOR)}'; |
---|
109 | $replace = '<div id="Skeleton" class="imageInfo"> |
---|
110 | <dt>{\'Skeleton\'|@translate}</dt> |
---|
111 | <dd style="color:orange;">{\'Piwigo rocks\'|@translate}</dd> |
---|
112 | </div> |
---|
113 | '.$search; |
---|
114 | |
---|
115 | return str_replace($search, $replace, $content); |
---|
116 | } |
---|
117 | |
---|
118 | |
---|
119 | ?> |
---|