source: extensions/FCKEditor/fckeditor.php @ 9484

Last change on this file since 9484 was 9293, checked in by patdenice, 13 years ago

Update to CK Editor 3.5.2

File size: 3.3 KB
Line 
1<?php
2
3add_event_handler('get_admin_plugin_menu_links', 'load_fckeditor_script');
4 
5function 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 ($section == 'AdditionalPages/admin/admin.php' and (@in_array($_GET['tab'], array('add_page', 'edit_page')))))
52    {
53      $areas[] = 'ap_content';
54      $width = '100%';
55      $height = '400px';
56      $template->set_prefilter('plugin_admin_content', 'add_remove_button');
57    }
58    // PWG Stuffs
59    elseif ($section == 'PWG_Stuffs/admin/add_module.php' and $_GET['type'] == 'Personal')
60    {
61      $areas[] = 'personal_content';
62      $width = '99%';
63      $height = '250px';
64      $template->set_prefilter('module_options', 'add_remove_button_stuffs');
65    }
66    // Personal About
67    elseif ($section == 'PersoAbout/admin/admin.php')
68    {
69      $areas[] = 'perso_about';
70      $width = '100%';
71      $height = '300px';
72      $template->set_prefilter('plugin_admin_content', 'add_remove_button');
73    }
74  }
75
76  if (!empty($areas))
77  {
78    set_fckeditor_instance($areas, $toolbar, $width, $height);
79  }
80  return $plugin_menu_links;
81}
82
83function add_remove_button($content, &$smarty)
84{
85  $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims';
86  $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>';
87  return preg_replace($pattern, $replacement, $content);
88}
89
90function add_remove_button_stuffs($content, &$smarty)
91{
92  $pattern = '#<textarea.*?</textarea>#ims';
93  $replacement = '<textarea name="personal_content" id="personal_content" rows="10" cols="50" style="width:100%; height: 300px;">{$PERSONAL_CONTENT}</textarea>
94<br><a href="#" onClick="toogleEditor(\'personal_content\'); return false;" style="border-bottom: none; float: right;">FCK Editor On/Off</a>';
95  return preg_replace($pattern, $replacement, $content);
96}
97
98function add_remove_button_banner($content, &$smarty)
99{
100  $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims';
101  $replacement = '$1<a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right; margin-right: 5%;">FCK Editor On/Off</a>';
102  return preg_replace($pattern, $replacement, $content);
103}
104
105?>
Note: See TracBrowser for help on using the repository browser.