1 | <?php |
---|
2 | |
---|
3 | add_event_handler('get_admin_plugin_menu_links', 'load_fckeditor_script'); |
---|
4 | |
---|
5 | function load_fckeditor_script($plugin_menu_links) |
---|
6 | { |
---|
7 | global $page, $template, $conf; |
---|
8 | |
---|
9 | if (!isset($page['page'])) return $plugin_menu_links; |
---|
10 | |
---|
11 | $toolbar = 'Full'; |
---|
12 | $width = '750px'; |
---|
13 | $height = '200px'; |
---|
14 | $areas = array(); |
---|
15 | |
---|
16 | // Category edit |
---|
17 | if ($page['page'] == 'cat_modify') |
---|
18 | { |
---|
19 | $areas[] = 'comment'; |
---|
20 | $areas[] = 'mail_content'; |
---|
21 | $toolbar = 'Basic'; |
---|
22 | $template->set_prefilter('categories', 'add_remove_button'); |
---|
23 | } |
---|
24 | // Picture modify |
---|
25 | elseif ($page['page'] == 'picture_modify') |
---|
26 | { |
---|
27 | $areas[] = 'description'; |
---|
28 | $toolbar = 'Basic'; |
---|
29 | $template->set_prefilter('picture_modify', 'add_remove_button'); |
---|
30 | } |
---|
31 | // Notification by mail |
---|
32 | elseif ($page['page'] == 'notification_by_mail') |
---|
33 | { |
---|
34 | $areas[] = 'send_customize_mail_content'; |
---|
35 | $toolbar = 'Basic'; |
---|
36 | $template->set_prefilter('notification_by_mail', 'add_remove_button'); |
---|
37 | } |
---|
38 | // Page banner |
---|
39 | elseif ($page['page'] == 'configuration') |
---|
40 | { |
---|
41 | $areas[] = 'page_banner'; |
---|
42 | $width = '70%'; |
---|
43 | $toolbar = 'Basic'; |
---|
44 | $template->set_prefilter('config', 'add_remove_button_banner'); |
---|
45 | } |
---|
46 | elseif ($page['page'] == 'plugin') |
---|
47 | { |
---|
48 | $section = $_GET['section']; |
---|
49 | // Additional pages |
---|
50 | if ($section == 'AdditionalPages/admin/add_page.php' |
---|
51 | or (preg_match('#AdditionalPages/(?:admin/|)admin.php#', $section) and (@in_array($_GET['tab'], array('add_page', 'edit_page')))) |
---|
52 | ) |
---|
53 | { |
---|
54 | $areas[] = 'ap_content'; |
---|
55 | $width = '100%'; |
---|
56 | $height = '400px'; |
---|
57 | $template->set_prefilter('plugin_admin_content', 'add_remove_button'); |
---|
58 | } |
---|
59 | // PWG Stuffs |
---|
60 | elseif (($section == 'PWG_Stuffs/admin/add_module.php' and @$_GET['type'] == 'Personal') |
---|
61 | or (preg_match('#PWG_Stuffs/(?:admin/|)admin.php#', $section) and @in_array($_GET['tab'], array('edit_module', 'add_module'))) |
---|
62 | ) |
---|
63 | { |
---|
64 | $areas[] = 'personal_content'; |
---|
65 | $width = '99%'; |
---|
66 | $height = '400px'; |
---|
67 | $template->set_prefilter('module_options', 'add_remove_button_stuffs'); |
---|
68 | } |
---|
69 | // Personal About |
---|
70 | elseif ($section == 'PersoAbout/admin/admin.php') |
---|
71 | { |
---|
72 | $areas[] = 'perso_about'; |
---|
73 | $width = '100%'; |
---|
74 | $height = '300px'; |
---|
75 | $template->set_prefilter('plugin_admin_content', 'add_remove_button'); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | if (!empty($areas)) |
---|
80 | { |
---|
81 | set_fckeditor_instance($areas, $toolbar, $width, $height); |
---|
82 | } |
---|
83 | return $plugin_menu_links; |
---|
84 | } |
---|
85 | |
---|
86 | function add_remove_button($content, &$smarty) |
---|
87 | { |
---|
88 | $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims'; |
---|
89 | $replacement = '$1</td></tr><tr><td></td><td><a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right;">FCK Editor On/Off</a>'; |
---|
90 | return preg_replace($pattern, $replacement, $content); |
---|
91 | } |
---|
92 | |
---|
93 | function add_remove_button_stuffs($content, &$smarty) |
---|
94 | { |
---|
95 | $pattern = '#<textarea.*?</textarea>#ims'; |
---|
96 | $replacement = '<textarea name="personal_content" id="personal_content" rows="10" cols="50" style="width:100%; height: 300px;">{$PERSONAL_CONTENT}</textarea> |
---|
97 | <br><a href="#" onClick="toogleEditor(\'personal_content\'); return false;" style="border-bottom: none; float: right;">FCK Editor On/Off</a>'; |
---|
98 | return preg_replace($pattern, $replacement, $content); |
---|
99 | } |
---|
100 | |
---|
101 | function add_remove_button_banner($content, &$smarty) |
---|
102 | { |
---|
103 | $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims'; |
---|
104 | $replacement = '$1<a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right; margin-right: 5%;">FCK Editor On/Off</a>'; |
---|
105 | return preg_replace($pattern, $replacement, $content); |
---|
106 | } |
---|
107 | |
---|
108 | ?> |
---|