1 | <?php |
---|
2 | defined('EXTENDED_DESC_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | /** |
---|
5 | * Main help page on plugins list |
---|
6 | */ |
---|
7 | function extdesc_admin_menu($menu) |
---|
8 | { |
---|
9 | $menu[] = array( |
---|
10 | 'NAME' => 'Extended Description', |
---|
11 | 'URL' => get_root_url() . 'admin.php?page=plugin-ExtendedDescription', |
---|
12 | ); |
---|
13 | return $menu; |
---|
14 | } |
---|
15 | |
---|
16 | /** |
---|
17 | * Add link to help popup |
---|
18 | */ |
---|
19 | function add_ed_help() |
---|
20 | { |
---|
21 | global $page, $template; |
---|
22 | |
---|
23 | load_language('plugin.lang', EXTENDED_DESC_PATH); |
---|
24 | $template->set_filename('extdesc_button', realpath(EXTENDED_DESC_PATH . 'template/help_button.tpl')); |
---|
25 | $template->assign_var_from_handle('EXTDESC_BUTTON', 'extdesc_button'); |
---|
26 | |
---|
27 | switch ($page['page']) |
---|
28 | { |
---|
29 | case 'album': |
---|
30 | $target = 'album_properties'; |
---|
31 | break; |
---|
32 | case 'photo': |
---|
33 | $target = 'picture_modify'; |
---|
34 | break; |
---|
35 | case 'configuration': |
---|
36 | $target = 'config'; |
---|
37 | break; |
---|
38 | case 'notification_by_mail': |
---|
39 | $target = 'notification_by_mail'; |
---|
40 | break; |
---|
41 | } |
---|
42 | |
---|
43 | if (isset($target)) |
---|
44 | { |
---|
45 | $template->set_prefilter($target, 'add_ed_help_prefilter'); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | function add_ed_help_prefilter($content) |
---|
50 | { |
---|
51 | return str_replace('</textarea>', '</textarea> {$EXTDESC_BUTTON}', $content); |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | /** |
---|
56 | * Display popup content |
---|
57 | */ |
---|
58 | function extended_desc_popup($help_content, $get) |
---|
59 | { |
---|
60 | if ($get == 'extended_desc') |
---|
61 | { |
---|
62 | global $template; |
---|
63 | |
---|
64 | load_language('plugin.lang', EXTENDED_DESC_PATH); |
---|
65 | |
---|
66 | $template->assign(array( |
---|
67 | 'EXTENDED_DESC_PATH' => EXTENDED_DESC_PATH, |
---|
68 | 'EXTDESC_HELP' => array( |
---|
69 | 'lang' => load_language('help.lang.html', EXTENDED_DESC_PATH, array('return'=>true)), |
---|
70 | 'extdesc' => load_language('help.extdesc.html', EXTENDED_DESC_PATH, array('return'=>true)), |
---|
71 | 'cat_photo' => load_language('help.cat_photo.html', EXTENDED_DESC_PATH, array('return'=>true)), |
---|
72 | 'slider' => load_language('help.slider.html', EXTENDED_DESC_PATH, array('return'=>true)), |
---|
73 | 'hide' => load_language('help.hide.html', EXTENDED_DESC_PATH, array('return'=>true)), |
---|
74 | 'redirect' => load_language('help.redirect.html', EXTENDED_DESC_PATH, array('return'=>true)), |
---|
75 | ), |
---|
76 | )); |
---|
77 | |
---|
78 | $template->set_filename('extdesc', realpath(EXTENDED_DESC_PATH . 'template/admin.tpl')); |
---|
79 | |
---|
80 | $help_content = '<h2>Extended Description</h2>' . $template->parse('extdesc', true); |
---|
81 | } |
---|
82 | return $help_content; |
---|
83 | } |
---|