| 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 | { |
|---|
| 52 | $areas[] = 'ap_content'; |
|---|
| 53 | $width = '100%'; |
|---|
| 54 | $template->set_prefilter('plugin_admin_content', 'add_remove_button'); |
|---|
| 55 | } |
|---|
| 56 | // PWG Stuffs |
|---|
| 57 | elseif ($section == 'PWG_Stuffs/admin/add_module.php' and $_GET['type'] == 'Personal') |
|---|
| 58 | { |
|---|
| 59 | $areas[] = 'personal_content'; |
|---|
| 60 | $width = '99%'; |
|---|
| 61 | $height = '250px'; |
|---|
| 62 | $template->set_prefilter('module_options', 'add_remove_button_stuffs'); |
|---|
| 63 | } |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | if (!empty($areas)) |
|---|
| 67 | { |
|---|
| 68 | set_fckeditor_instance($areas, $toolbar, $width, $height); |
|---|
| 69 | } |
|---|
| 70 | return $plugin_menu_links; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | function add_remove_button($content, &$smarty) |
|---|
| 74 | { |
|---|
| 75 | $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims'; |
|---|
| 76 | $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>'; |
|---|
| 77 | return preg_replace($pattern, $replacement, $content); |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | function add_remove_button_stuffs($content, &$smarty) |
|---|
| 81 | { |
|---|
| 82 | $pattern = '#<textarea.*?</textarea>#ims'; |
|---|
| 83 | $replacement = '<textarea name="personal_content" id="personal_content" rows="10" cols="50" style="width:100%; height: 300px;">{$PERSONAL_CONTENT}</textarea> |
|---|
| 84 | <br><a href="#" onClick="toogleEditor(\'personal_content\'); return false;" style="border-bottom: none; float: right;">FCK Editor On/Off</a>'; |
|---|
| 85 | return preg_replace($pattern, $replacement, $content); |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | function add_remove_button_banner($content, &$smarty) |
|---|
| 89 | { |
|---|
| 90 | $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims'; |
|---|
| 91 | $replacement = '$1<a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right; margin-right: 5%;">FCK Editor On/Off</a>'; |
|---|
| 92 | return preg_replace($pattern, $replacement, $content); |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | ?> |
|---|