source: extensions/FCKEditor/fckeditor.php @ 31984

Last change on this file since 31984 was 31984, checked in by ddtddt, 5 years ago

[fckeditor] update for plugin Perso About

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