source: extensions/FCKEditor/fckeditor.php @ 32853

Last change on this file since 32853 was 32717, checked in by ddtddt, 3 years ago

[fckeditor] update for plugin admin message

File size: 4.4 KB
RevLine 
[4629]1<?php
2
[32425]3add_event_handler('loc_begin_admin_page', 'load_fckeditor_script');
[4629]4 
[32424]5function load_fckeditor_script()
[4629]6{
7  global $page, $template, $conf;
8
[32424]9  if (!isset($page['page'])) return true;
[4629]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  }
[32717]51  elseif ($page['page'] == 'intro')
52  {
53    $areas[] = 'admin_message';
54    $toolbar = $conf['fckeditor_toolbar_always_full'] ? 'Full' : 'Basic';
55    $template->set_prefilter('intro', 'add_remove_button');
56  }
[4629]57  elseif ($page['page'] == 'plugin')
58  {
59    $section = $_GET['section'];
60    // Additional pages
[9268]61    if ($section == 'AdditionalPages/admin/add_page.php'
[9739]62      or (preg_match('#AdditionalPages/(?:admin/|)admin.php#', $section) and (@in_array($_GET['tab'], array('add_page', 'edit_page'))))
[9607]63    )
[4629]64    {
65      $areas[] = 'ap_content';
66      $width = '100%';
[9293]67      $height = '400px';
[4631]68      $template->set_prefilter('plugin_admin_content', 'add_remove_button');
[4629]69    }
70    // PWG Stuffs
[9607]71    elseif (($section == 'PWG_Stuffs/admin/add_module.php' and @$_GET['type'] == 'Personal')
[9739]72      or (preg_match('#PWG_Stuffs/(?:admin/|)admin.php#', $section) and @in_array($_GET['tab'], array('edit_module', 'add_module')))
[9607]73    )
[4629]74    {
75      $areas[] = 'personal_content';
[4630]76      $width = '99%';
[9607]77      $height = '400px';
[4629]78      $template->set_prefilter('module_options', 'add_remove_button_stuffs');
79    }
[8133]80    // Personal About
[31984]81    elseif ($section == 'PersoAbout/admin.php')
[8133]82    {
83      $areas[] = 'perso_about';
84      $width = '100%';
85      $height = '300px';
86      $template->set_prefilter('plugin_admin_content', 'add_remove_button');
87    }
[32424]88        elseif ($section == 'PersoFooter/admin.php')
89    {
90      $areas[] = 'perso_footer';
91      $width = '100%';
92      $height = '300px';
93      $template->set_prefilter('plugin_admin_content', 'add_remove_button');
94    }
[32717]95        elseif ($section == 'Admin_Messages/admin.php')
96    {
97      $areas[] = 'admin_message';
98      $width = '100%';
99      $height = '300px';
100      $template->set_prefilter('plugin_admin_content', 'add_remove_button');
101    }
[4629]102  }
103
104  if (!empty($areas))
105  {
[4630]106    set_fckeditor_instance($areas, $toolbar, $width, $height);
[4629]107  }
[32424]108
[4629]109}
110
[32684]111function add_remove_button($content)
[4629]112{
113  $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims';
[32426]114  $replacement = '$1</td></tr><tr><td></td><td><a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right;">'.l10n('Display FCK Editor On/Off').'</a>';
[4629]115  return preg_replace($pattern, $replacement, $content);
116}
117
[32684]118function add_remove_button_stuffs($content)
[4629]119{
120  $pattern = '#<textarea.*?</textarea>#ims';
121  $replacement = '<textarea name="personal_content" id="personal_content" rows="10" cols="50" style="width:100%; height: 300px;">{$PERSONAL_CONTENT}</textarea>
[32426]122<br><a href="#" onClick="toogleEditor(\'personal_content\'); return false;" style="border-bottom: none; float: right;">'.l10n('Display FCK Editor On/Off').'</a>';
[4629]123  return preg_replace($pattern, $replacement, $content);
124}
125
[32684]126function add_remove_button_banner($content)
[4630]127{
128  $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims';
[32426]129  $replacement = '$1<a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right; margin-right: 5%;">'.l10n('Display FCK Editor On/Off').'</a>';
[4630]130  return preg_replace($pattern, $replacement, $content);
131}
132
[4629]133?>
Note: See TracBrowser for help on using the repository browser.