Révision 6fd71452
Ajouté par Julien Enselme il y a environ 10 ans
drupal7/sites/all/modules/ckeditor/includes/ckeditor.admin.inc | ||
---|---|---|
44 | 44 |
$ckconfig_file = $editor_path . '/config.js'; |
45 | 45 |
|
46 | 46 |
//check if CKEditor plugin is installed |
47 |
if (!_ckeditor_requirements_isinstalled()) { |
|
47 |
if ($editor_path != '<URL>' && !_ckeditor_requirements_isinstalled()) {
|
|
48 | 48 |
drupal_set_message(t( |
49 | 49 |
'Checking for !filename or !file.', array( |
50 | 50 |
'!filename' => '<code>' . $ckconfig_file . '</code>', |
... | ... | |
253 | 253 |
'#collapsed' => FALSE, |
254 | 254 |
); |
255 | 255 |
|
256 |
$current_path = ckeditor_path('relative'); |
|
257 |
if ($current_path == '<URL>') { |
|
258 |
$current_path = ckeditor_path('url'); |
|
259 |
} |
|
256 | 260 |
$form['ckeditor_advanced_settings']['ckeditor_path'] = array( |
257 | 261 |
'#type' => 'textfield', |
258 | 262 |
'#title' => t('Path to CKEditor'), |
... | ... | |
260 | 264 |
'#size' => 40, |
261 | 265 |
'#maxlength' => 128, |
262 | 266 |
'#description' => t( |
263 |
'The path to CKEditor (the WYSIWYG rich text editor downloaded from !ckeditorcom) relative to the document root.', array( |
|
264 |
'!ckeditorcom' => l(t('ckeditor.com'), 'http://ckeditor.com/download') |
|
267 |
'The path to CKEditor (the WYSIWYG rich text editor downloaded from !ckeditorcom). Provide a path relative to the document root, unless CKEditor is located on an external URL. In such case enter the full URL to a folder with CKEditor.<br />The simplest way to have the editor running is to use CDN, to use it set: !cdn', array( |
|
268 |
'!ckeditorcom' => l(t('ckeditor.com'), 'http://ckeditor.com/download'), |
|
269 |
'!cdn' => '<strong>//cdn.ckeditor.com/4.4.0/full-all</strong>' |
|
265 | 270 |
) |
266 | 271 |
) . |
267 |
'<br /> ' . |
|
268 |
t('Available placeholders:!b – path of the Drupal installation (!base) !m – path where the CKEditor module is stored (!module).!l – path to the libraries directory (!library)', array( |
|
272 |
'<br /><br /> ' .
|
|
273 |
t('Available placeholders:!b – path of the Drupal installation (!base) !m – path where the CKEditor module is stored (!module).!l – path to the libraries directory (!library).', array(
|
|
269 | 274 |
'!b' => '<br /><code>%b</code>', |
270 | 275 |
'!m' => '<br /><code>%m</code>', |
271 | 276 |
'!l' => '<br /><code>%l</code>', |
... | ... | |
276 | 281 |
) . |
277 | 282 |
'<br /> ' . |
278 | 283 |
t('Current path: !path', array( |
279 |
'!path' => '<code>' . ckeditor_path('relative') . '</code>'
|
|
284 |
'!path' => '<code>' . $current_path . '</code>'
|
|
280 | 285 |
) |
281 | 286 |
), |
282 | 287 |
'#required' => TRUE |
283 | 288 |
); |
284 | 289 |
|
290 |
$local_path = ckeditor_path('local'); |
|
291 |
if ($local_path == '<URL>') { |
|
292 |
$local_path = t('CKEditor is loaded from URL. Local path is not available.'); |
|
293 |
} |
|
285 | 294 |
$form['ckeditor_advanced_settings']['ckeditor_local_path'] = array( |
286 | 295 |
'#type' => 'textfield', |
287 | 296 |
'#title' => t('Local path to CKEditor'), |
... | ... | |
295 | 304 |
) . |
296 | 305 |
'<br /> ' . |
297 | 306 |
t('Current path: !path', array( |
298 |
'!path' => '<code>' . ckeditor_path('local') . '</code>'
|
|
307 |
'!path' => '<code>' . $local_path . '</code>'
|
|
299 | 308 |
) |
300 | 309 |
) |
301 | 310 |
); |
... | ... | |
501 | 510 |
$edit['ckeditor_path'] = ''; |
502 | 511 |
} |
503 | 512 |
$edit['ckeditor_path'] = trim(rtrim($edit['ckeditor_path'], "/")); |
504 |
if ($edit['ckeditor_path'] && 0 !== strpos($edit['ckeditor_path'], "/") && 0 !== strpos($edit['ckeditor_path'], "%")) { |
|
513 |
if ($edit['ckeditor_path'] && 0 !== strpos($edit['ckeditor_path'], "/") && 0 !== strpos($edit['ckeditor_path'], "%") && !preg_match("|^http(s)?://|i", $edit['ckeditor_path'])) {
|
|
505 | 514 |
//ensure that slash is at the beginning |
506 | 515 |
$edit['ckeditor_path'] = "/" . $edit['ckeditor_path']; |
507 | 516 |
} |
... | ... | |
556 | 565 |
/** |
557 | 566 |
* Form builder for a profile |
558 | 567 |
*/ |
559 |
function ckeditor_admin_profile_form($form, $form_state, $profile = NULL) { |
|
568 |
function ckeditor_admin_profile_form($form, $form_state, $task, $profile = NULL) {
|
|
560 | 569 |
global $theme; |
561 | 570 |
|
562 | 571 |
if ($profile != NULL) { |
... | ... | |
581 | 590 |
|
582 | 591 |
$lang_options = ckeditor_load_lang_options(); |
583 | 592 |
|
593 |
// Attach the administration CSS. |
|
594 |
$form['#attached'] = array( |
|
595 |
'css' => array( |
|
596 |
drupal_get_path('module', 'ckeditor') . '/css/ckeditor.admin.css', |
|
597 |
), |
|
598 |
); |
|
599 |
|
|
584 | 600 |
$form['basic'] = array( |
585 | 601 |
'#type' => 'fieldset', |
586 | 602 |
'#title' => t('Basic setup'), |
... | ... | |
588 | 604 |
'#collapsed' => TRUE |
589 | 605 |
); |
590 | 606 |
|
591 |
switch (arg(4)) {
|
|
607 |
switch ($task) {
|
|
592 | 608 |
case 'clone': |
593 | 609 |
//load all profiles to check their names |
594 | 610 |
$profiles = ckeditor_profile_load(); |
... | ... | |
633 | 649 |
|
634 | 650 |
$orig_formats = filter_formats(); |
635 | 651 |
|
636 |
if (arg(4) == 'edit' && !empty($profile->name)) {
|
|
652 |
if ($task == 'edit' && !empty($profile->name)) {
|
|
637 | 653 |
$used_formats = db_select('ckeditor_input_format', 'f')->fields('f', array("format"))->distinct()->condition("f.name", array($profile->name), 'NOT IN')->execute()->fetchAllAssoc('format'); |
638 | 654 |
} |
639 | 655 |
else { |
... | ... | |
644 | 660 |
$formats = array(); |
645 | 661 |
$input_format_config_links = array(); |
646 | 662 |
foreach ($orig_formats AS $format) { |
647 |
if ((arg(4) == 'edit' && !empty($profile->input_formats) && array_key_exists($format->format, $profile->input_formats)) || !array_key_exists($format->format, $used_formats)) {
|
|
663 |
if (($task == 'edit' && !empty($profile->input_formats) && array_key_exists($format->format, $profile->input_formats)) || !array_key_exists($format->format, $used_formats)) {
|
|
648 | 664 |
$formats[$format->format] = $format->name; |
649 | 665 |
$input_format_config_links[$format->format] = array("name" => $format->name, "config_url" => url("admin/config/content/formats/" . $format->format)); |
650 | 666 |
} |
... | ... | |
719 | 735 |
'#collapsed' => TRUE, |
720 | 736 |
); |
721 | 737 |
|
722 |
$form['appearance']['default'] = array( |
|
723 |
'#type' => 'radios', |
|
724 |
'#title' => t('Default state'), |
|
725 |
'#default_value' => !empty($profile->settings['default']) ? $profile->settings['default'] : 't', |
|
726 |
'#options' => array( |
|
727 |
't' => t('Enabled'), |
|
728 |
'f' => t('Disabled') |
|
729 |
), |
|
730 |
'#description' => t('Default editor state. If disabled, the rich text editor may still be enabled by using toggle.'), |
|
731 |
); |
|
732 |
|
|
733 |
$form['appearance']['show_toggle'] = array( |
|
734 |
'#type' => 'radios', |
|
735 |
'#title' => t('Show the disable/enable rich text editor toggle'), |
|
736 |
'#default_value' => !empty($profile->settings['show_toggle']) ? $profile->settings['show_toggle'] : 't', |
|
737 |
'#options' => array( |
|
738 |
't' => t('Show'), |
|
739 |
'f' => t('Hide') |
|
740 |
), |
|
741 |
'#description' => t('Whether or not to show the disable/enable rich text editor toggle below the textarea.'), |
|
742 |
); |
|
743 |
|
|
744 | 738 |
$ui_colors = array( |
745 | 739 |
"default" => t('CKEditor default'), |
746 | 740 |
"custom" => t('Select manually') |
... | ... | |
769 | 763 |
drupal_add_js(array('ckeditor_uicolor' => $color_palette), 'setting'); |
770 | 764 |
} |
771 | 765 |
|
772 |
drupal_add_js('window.CKEDITOR_BASEPATH = "' . $editor_path . '/"', array('type' => 'inline', 'weight' => -100)); |
|
773 |
drupal_add_js($editor_url_path . '/ckeditor.js', array('type' => 'file', 'preprocess' => FALSE)); |
|
766 |
if ($editor_path == '<URL>') { |
|
767 |
drupal_add_js($editor_url_path . '/ckeditor.js', 'external'); |
|
768 |
} |
|
769 |
else { |
|
770 |
drupal_add_js('window.CKEDITOR_BASEPATH = "' . $editor_path . '/"', array('type' => 'inline', 'weight' => -100)); |
|
771 |
drupal_add_js($editor_url_path . '/ckeditor.js', array('type' => 'file', 'preprocess' => FALSE)); |
|
772 |
} |
|
774 | 773 |
drupal_add_js($module_drupal_url_path . '/ckeditor.config.js', 'file'); |
775 | 774 |
drupal_add_js($module_drupal_url_path . '/includes/ckeditor.admin.js', 'file'); |
776 | 775 |
|
777 | 776 |
if ($toolbar_wizard == 't') { |
778 |
if (module_exists('jquery_ui')) { |
|
779 |
jquery_ui_add(array('jquery.ui.widget.min.js', 'jquery.ui.sortable.min.js')); |
|
780 |
} |
|
781 |
else { |
|
782 |
drupal_add_js($module_drupal_url_path . '/includes/jqueryUI/jquery-ui.min.js', 'file'); |
|
783 |
drupal_add_js($module_drupal_url_path . '/includes/jqueryUI/jquery.ui.widget.min.js', 'file'); |
|
784 |
drupal_add_js($module_drupal_url_path . '/includes/jqueryUI/jquery.ui.sortable.min.js', 'file'); |
|
785 |
} |
|
777 |
drupal_add_library('system', 'ui.widget'); |
|
778 |
drupal_add_library('system', 'ui.sortable'); |
|
786 | 779 |
drupal_add_js($module_drupal_url_path . '/includes/jqueryUI/sort.js', 'file'); |
787 | 780 |
} |
788 | 781 |
|
782 |
$form['appearance']['toolbar'] = array( |
|
783 |
'#type' => 'textarea', |
|
784 |
'#title' => t('Toolbar'), |
|
785 |
'#default_value' => !empty($profile->settings['toolbar']) ? $profile->settings['toolbar'] : '', |
|
786 |
'#description' => t('Load sample toolbar: !toolbars', array("!toolbars" => '<a href="#" id="cke_toolbar_DrupalBasic" class="cke_load_toolbar">' . t('Basic') . '</a> | <a href="#" id="cke_toolbar_DrupalAdvanced" class="cke_load_toolbar">' . t('Advanced') . '</a> | <a href="#" id="cke_toolbar_DrupalFull" class="cke_load_toolbar">' . t('Full') . '</a>')), |
|
787 |
'#wysiwyg' => FALSE, |
|
788 |
'#rows' => 15 |
|
789 |
); |
|
790 |
|
|
791 |
if ($toolbar_wizard == 't') { |
|
792 |
$form['appearance']['toolbar_wizzard_used'] = array( |
|
793 |
'#markup' => '<div>' . t('Current toolbar') . '</div><div class="sortableList" id="groupLayout"></div><br/>', |
|
794 |
'#description' => t('Currently used buttons'), |
|
795 |
); |
|
796 |
|
|
797 |
drupal_add_js(array('cke_toolbar_buttons_all' => ckeditor_toolbar_buttons_all()), 'setting'); |
|
798 |
|
|
799 |
$form['appearance']['toolbar_wizzard_all'] = array( |
|
800 |
'#markup' => '<div>' . t('Available buttons') . '</div><div id="allButtons" class="sortableList"></div><br/>', |
|
801 |
'#description' => t('All available buttons'), |
|
802 |
); |
|
803 |
} |
|
804 |
|
|
805 |
$form['appearance']['expand'] = array( |
|
806 |
'#type' => 'radios', |
|
807 |
'#title' => t('Toolbar state on startup'), |
|
808 |
'#default_value' => !empty($profile->settings['expand']) ? $profile->settings['expand'] : 't', |
|
809 |
'#options' => array( |
|
810 |
't' => t('Expanded'), |
|
811 |
'f' => t('Collapsed') |
|
812 |
), |
|
813 |
'#description' => t('The toolbar will start in an expanded or collapsed state.'), |
|
814 |
); |
|
815 |
|
|
816 |
$form['appearance']['default'] = array( |
|
817 |
'#type' => 'radios', |
|
818 |
'#title' => t('Default editor state'), |
|
819 |
'#default_value' => !empty($profile->settings['default']) ? $profile->settings['default'] : 't', |
|
820 |
'#options' => array( |
|
821 |
't' => t('Enabled'), |
|
822 |
'f' => t('Disabled') |
|
823 |
), |
|
824 |
'#description' => t('Default editor state. If disabled, the rich text editor may still be enabled by using toggle.'), |
|
825 |
); |
|
826 |
|
|
827 |
$form['appearance']['show_toggle'] = array( |
|
828 |
'#type' => 'radios', |
|
829 |
'#title' => t('Show the disable/enable rich text editor toggle'), |
|
830 |
'#default_value' => !empty($profile->settings['show_toggle']) ? $profile->settings['show_toggle'] : 't', |
|
831 |
'#options' => array( |
|
832 |
't' => t('Show'), |
|
833 |
'f' => t('Hide') |
|
834 |
), |
|
835 |
'#description' => t('Whether or not to show the disable/enable rich text editor toggle below the textarea.'), |
|
836 |
); |
|
837 |
|
|
789 | 838 |
$form['appearance']['uicolor'] = array( |
790 | 839 |
'#type' => 'select', |
791 | 840 |
'#title' => t('User interface color'), |
... | ... | |
804 | 853 |
) |
805 | 854 |
)); |
806 | 855 |
$form['appearance']['skinframe'] = array( |
807 |
'#markup' => '<iframe frameborder="0" id="skinframe" marginheight="0" marginwidth="0" src="' . $skinframe_url . '" style="height:500px;width:700px;"></iframe><br/>',
|
|
856 |
'#markup' => '<iframe frameborder="0" id="skinframe" marginheight="0" marginwidth="0" src="' . $skinframe_url . '" style="height:430px;width:700px;"></iframe><br/>',
|
|
808 | 857 |
'#description' => '', |
809 | 858 |
); |
810 | 859 |
$form['appearance']['uicolor_user'] = array( |
... | ... | |
812 | 861 |
'#default_value' => !empty($profile->settings['uicolor_user']) ? $profile->settings['uicolor_user'] : 'default', |
813 | 862 |
); |
814 | 863 |
|
815 |
$form['appearance']['toolbar'] = array( |
|
816 |
'#type' => 'textarea', |
|
817 |
'#title' => t('Toolbar'), |
|
818 |
'#default_value' => !empty($profile->settings['toolbar']) ? $profile->settings['toolbar'] : '', |
|
819 |
'#description' => t('Load sample toolbar: !toolbars', array("!toolbars" => '<a href="#" id="cke_toolbar_DrupalBasic" class="cke_load_toolbar">' . t('Basic') . '</a> | <a href="#" id="cke_toolbar_DrupalAdvanced" class="cke_load_toolbar">' . t('Advanced') . '</a> | <a href="#" id="cke_toolbar_DrupalFull" class="cke_load_toolbar">' . t('Full') . '</a>')), |
|
820 |
'#wysiwyg' => FALSE, |
|
821 |
'#rows' => 15 |
|
822 |
); |
|
823 |
|
|
824 |
if ($toolbar_wizard == 't') { |
|
825 |
$form['appearance']['toolbar_wizzard_used'] = array( |
|
826 |
'#markup' => '<div>' . t('Used buttons') . '</div><div class="sortableList" id="groupLayout"></div><br/>', |
|
827 |
'#description' => t('Currently used buttons'), |
|
828 |
); |
|
829 |
|
|
830 |
drupal_add_js(array('cke_toolbar_buttons_all' => ckeditor_toolbar_buttons_all()), 'setting'); |
|
831 |
|
|
832 |
$form['appearance']['toolbar_wizzard_all'] = array( |
|
833 |
'#markup' => '<div>' . t('All buttons') . '</div><div id="allButtons" class="sortableList"></div><br/>', |
|
834 |
'#description' => t('All available buttons'), |
|
835 |
); |
|
836 |
} |
|
837 |
|
|
838 | 864 |
$plugin_list = ckeditor_load_plugins(); |
839 | 865 |
$plugins = array(); |
840 | 866 |
if (isset($profile->settings['loadPlugins'])) { |
... | ... | |
860 | 886 |
'#description' => t('Choose the plugins that you want to enable in CKEditor.') |
861 | 887 |
); |
862 | 888 |
|
863 |
$form['appearance']['expand'] = array( |
|
864 |
'#type' => 'radios', |
|
865 |
'#title' => t('Toolbar state on startup'), |
|
866 |
'#default_value' => !empty($profile->settings['expand']) ? $profile->settings['expand'] : 't', |
|
867 |
'#options' => array( |
|
868 |
't' => t('Expanded'), |
|
869 |
'f' => t('Collapsed') |
|
870 |
), |
|
871 |
'#description' => t('The toolbar will start in an expanded or collapsed state.'), |
|
872 |
); |
|
873 |
|
|
874 |
if (file_exists(ckeditor_path('local') . '/plugins/divarea/plugin.js')) { |
|
889 |
if ($editor_local_path != '<URL>' && file_exists($editor_local_path . '/plugins/divarea/plugin.js')) { |
|
875 | 890 |
$form['appearance']['use_divarea'] = array( |
876 | 891 |
'#type' => 'radios', |
877 | 892 |
'#title' => t('"Div-based" editor'), |
... | ... | |
929 | 944 |
) |
930 | 945 |
); |
931 | 946 |
|
947 |
$form['acf'] = array( |
|
948 |
'#type' => 'fieldset', |
|
949 |
'#title' => t('Advanced content filter'), |
|
950 |
'#description' => t('Configure input data filtering in CKEditor. See !link for more information about ACF.', array( |
|
951 |
'!link' => l(t('this blog post'), 'http://ckeditor.com/blog/Upgrading-to-CKEditor-4.1') |
|
952 |
)), |
|
953 |
'#collapsible' => TRUE, |
|
954 |
'#collapsed' => TRUE |
|
955 |
); |
|
956 |
|
|
957 |
$form['acf']['allowed_content'] = array( |
|
958 |
'#type' => 'radios', |
|
959 |
'#title' => t('Advanced content filter'), |
|
960 |
'#description' => t('<strong>Example:</strong> if only Bold and Link buttons are enabled, only !strong and !a tags will be allowed. Any !b tags will automatically be converted into !strong. The !img tag will not be allowed, unless the Image button is added to the toolbar.', array( |
|
961 |
'!strong' => '<code><strong></code>', |
|
962 |
'!a' => '<code><a></code>', |
|
963 |
'!img' => '<code><img></code>', |
|
964 |
'!b' => '<code><b></code>' |
|
965 |
)).'<br /><br />'. |
|
966 |
t('<strong>Warning:</strong> CKEditor will not use the set of tags associated with text format. Only the buttons enabled in the toolbar and optional plugins will determine which tags/attributes/styles are handled by CKEditor. Enabling ACF in CKEditor does not affect server-side filtering done by Drupal in any way.'), |
|
967 |
|
|
968 |
'#default_value' => !empty($profile->settings['allowed_content']) ? $profile->settings['allowed_content'] : 't', |
|
969 |
'#options' => array( |
|
970 |
't' => t('Enabled'), |
|
971 |
'f' => t('Disabled'), |
|
972 |
), |
|
973 |
); |
|
974 |
$form['acf']['allowed_content']['t']['#description'] = t('CKEditor will only allow tags/attributes/styles provided by CKEditor features. Disallowed content will be removed directly by CKEditor. When configured properly, it helps to ensure a true WYSIWYG experience.'); |
|
975 |
$form['acf']['allowed_content']['f']['#description'] = t('CKEditor will not filter any tags and as a result, the user will be able to insert any content into the editor. The content will only be filtered by server-side filters associated with input formats.'); |
|
976 |
|
|
977 |
$form['acf']['extraAllowedContent'] = array( |
|
978 |
'#type' => 'textarea', |
|
979 |
'#title' => t('Extra allowed content'), |
|
980 |
'#default_value' => !empty($profile->settings['extraAllowedContent']) ? $profile->settings['extraAllowedContent'] : "", |
|
981 |
'#cols' => 60, |
|
982 |
'#rows' => 5, |
|
983 |
'#description' => t( |
|
984 |
'Set additional allowed content rules for CKEditor. Separate rules with a semicolon. See !docs for more information.', array( |
|
985 |
'!docs' => l(t('CKEditor documentation'), 'http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent') |
|
986 |
)).'<p>'. |
|
987 |
t('<strong>Example:</strong> !rules', array( |
|
988 |
'!rules' => "<code>object[width,height];param[name,value];embed[*];</code>" |
|
989 |
)).'</p>', |
|
990 |
'#wysiwyg' => FALSE, |
|
991 |
); |
|
992 |
|
|
932 | 993 |
$form['output'] = array( |
933 | 994 |
'#type' => 'fieldset', |
934 | 995 |
'#title' => t('Cleanup and output'), |
... | ... | |
1017 | 1078 |
'#collapsed' => TRUE |
1018 | 1079 |
); |
1019 | 1080 |
|
1081 |
$current_theme = variable_get('theme_default', $theme); |
|
1082 |
$theme_path = drupal_get_path('theme', $current_theme); |
|
1083 |
|
|
1020 | 1084 |
$form['css']['css_mode'] = array( |
1021 | 1085 |
'#type' => 'select', |
1022 | 1086 |
'#title' => t('Editor CSS'), |
... | ... | |
1054 | 1118 |
'!h' => '<br /><code>%h</code>', |
1055 | 1119 |
'!t' => '<br /><code>%t</code>', |
1056 | 1120 |
'!host' => '<code>' . base_path() . '</code>', |
1057 |
'!theme' => '<code>' . base_path() . path_to_theme() . '/</code>'
|
|
1121 |
'!theme' => '<code>' . base_path() . $theme_path . '/</code>'
|
|
1058 | 1122 |
) |
1059 | 1123 |
) |
1060 | 1124 |
); |
... | ... | |
1072 | 1136 |
'Define the location of the !ckeditor_styles_js_file file. It is used by the <strong>Style</strong> drop-down list available in the default toolbar. Copy the !ckeditor_styles_js_path file into your theme directory (!theme) and adjust it to your needs.', array( |
1073 | 1137 |
'!ckeditor_styles_js_file' => '<code>ckeditor.styles.js</code>', |
1074 | 1138 |
'!ckeditor_styles_js_path' => '<code>' . drupal_get_path('module', 'ckeditor') . '/ckeditor.styles.js</code>', |
1075 |
'!theme' => '<code>' . path_to_theme() . '/ckeditor.styles.js' . '</code>'
|
|
1139 |
'!theme' => '<code>' . $theme_path . '/ckeditor.styles.js' . '</code>'
|
|
1076 | 1140 |
) |
1077 | 1141 |
) |
1078 | 1142 |
); |
... | ... | |
1096 | 1160 |
'!t' => '<br /><code>%t</code>', |
1097 | 1161 |
'!m' => '<br /><code>%m</code>', |
1098 | 1162 |
'!host' => '<code>' . base_path() . '</code>', |
1099 |
'!theme' => '<code>' . base_path() . path_to_theme() . '/</code>',
|
|
1163 |
'!theme' => '<code>' . base_path() . $theme_path . '/</code>',
|
|
1100 | 1164 |
'!module' => '<code>' . drupal_get_path('module', 'ckeditor') . '</code>' |
1101 | 1165 |
) |
1102 | 1166 |
) |
... | ... | |
1429 | 1493 |
$toolbar = $edit['toolbar']; |
1430 | 1494 |
$toolbar = str_replace("'", '"', $toolbar); |
1431 | 1495 |
$toolbar = preg_replace('/(\w*)\s*\:/', '"${1}":', $toolbar); |
1496 |
|
|
1497 |
if (strpos($toolbar, 'CodeSnippet') !== false && empty($edit['loadPlugins']['codesnippet'])) { |
|
1498 |
form_set_error('loadPlugins][codesnippet', t('The Code Snippet plugin must be enabled if the CodeSnippet button is enabled in the toolbar.')); |
|
1499 |
} |
|
1500 |
if (strpos($toolbar, 'Mathjax') !== false && empty($edit['loadPlugins']['mathjax'])) { |
|
1501 |
form_set_error('loadPlugins][mathjax', t('The Mathjax plugin must be enabled if the Mathjax button is enabled in the toolbar.')); |
|
1502 |
} |
|
1432 | 1503 |
if (!json_decode($toolbar)) { |
1433 | 1504 |
form_set_error('toolbar', t('Enter a valid toolbar configuration.')); |
1434 | 1505 |
} |
... | ... | |
1470 | 1541 |
/** |
1471 | 1542 |
* Form builder for a clone profile |
1472 | 1543 |
*/ |
1473 |
function ckeditor_admin_profile_clone_form($form, $form_state, $oldprofile) { |
|
1474 |
return ckeditor_admin_profile_form($form, $form_state, $oldprofile); |
|
1544 |
function ckeditor_admin_profile_clone_form($form, $form_state, $task, $oldprofile) {
|
|
1545 |
return ckeditor_admin_profile_form($form, $form_state, $task, $oldprofile);
|
|
1475 | 1546 |
} |
1476 | 1547 |
|
1477 | 1548 |
/** |
... | ... | |
1566 | 1637 |
} |
1567 | 1638 |
unset($values['name'], $values['input_formats'], $values['_profile'], $values['op'], $values['submit'], $values['form_build_id'], $values['form_token'], $values['form_id'], $values['loadPlugins']); |
1568 | 1639 |
|
1640 |
// Replace CRLF with LF in toolbar settings |
|
1641 |
if(isset($values['toolbar'])){ |
|
1642 |
$values['toolbar'] = str_replace("\r\n", "\n", $values['toolbar']); |
|
1643 |
} |
|
1644 |
|
|
1569 | 1645 |
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); |
1570 | 1646 |
$plugin_list = ckeditor_load_plugins(); |
1571 | 1647 |
$values['loadPlugins'] = array(); |
... | ... | |
1598 | 1674 |
|
1599 | 1675 |
function _ckeditor_load_methods() { |
1600 | 1676 |
$result = array('ckeditor.js' => 'ckeditor.js'); |
1601 |
if (file_exists(ckeditor_path('local') . '/ckeditor_basic.js')) { |
|
1677 |
$ckeditor_local_path = ckeditor_path('local'); |
|
1678 |
if ($ckeditor_local_path == '<URL>') { |
|
1679 |
return $result; |
|
1680 |
} |
|
1681 |
if (file_exists($ckeditor_local_path . '/ckeditor_basic.js')) { |
|
1602 | 1682 |
$result['ckeditor_basic.js'] = 'ckeditor_basic.js'; |
1603 | 1683 |
} |
1604 |
if (file_exists(ckeditor_path('local') . '/ckeditor_source.js')) {
|
|
1684 |
if (file_exists($ckeditor_local_path . '/ckeditor_source.js')) {
|
|
1605 | 1685 |
$result['ckeditor_source.js'] = 'ckeditor_source.js (' . t('for developers only') . ')'; |
1606 | 1686 |
} |
1607 | 1687 |
return $result; |
... | ... | |
1632 | 1712 |
$buttons = array( |
1633 | 1713 |
'Source' => array('name' => 'Source', 'icon' => $path . '/images/buttons/source.png', 'title' => 'Source', 'row' => 1), |
1634 | 1714 |
'Save' => array('name' => 'Save', 'icon' => $path . '/images/buttons/save.png', 'title' => 'Save', 'row' => 1), |
1635 |
'NewPage' => array('name' => 'NewPage', 'icon' => $path . '/images/buttons/newPage.png', 'title' => 'New Page', 'row' => 1),
|
|
1715 |
'NewPage' => array('name' => 'NewPage', 'icon' => $path . '/images/buttons/newpage.png', 'title' => 'New Page', 'row' => 1),
|
|
1636 | 1716 |
'Preview' => array('name' => 'Preview', 'icon' => $path . '/images/buttons/preview.png', 'title' => 'Preview', 'row' => 1), |
1637 | 1717 |
'Templates' => array('name' => 'Templates', 'icon' => $path . '/images/buttons/templates.png', 'title' => 'Templates', 'row' => 1), |
1638 | 1718 |
'Cut' => array('name' => 'Cut', 'icon' => $path . '/images/buttons/cut.png', 'title' => 'Cut', 'row' => 1), |
1639 | 1719 |
'Copy' => array('name' => 'Copy', 'icon' => $path . '/images/buttons/copy.png', 'title' => 'Copy', 'row' => 1), |
1640 | 1720 |
'Paste' => array('name' => 'Paste', 'icon' => $path . '/images/buttons/paste.png', 'title' => 'Paste', 'row' => 1), |
1641 |
'PasteText' => array('name' => 'PasteText', 'icon' => $path . '/images/buttons/pastePlainText.png', 'title' => 'Paste as plain text', 'row' => 1),
|
|
1642 |
'PasteFromWord' => array('name' => 'PasteFromWord', 'icon' => $path . '/images/buttons/pasteWord.png', 'title' => 'Paste from Word', 'row' => 1),
|
|
1721 |
'PasteText' => array('name' => 'PasteText', 'icon' => $path . '/images/buttons/pastetext.png', 'title' => 'Paste as plain text', 'row' => 1),
|
|
1722 |
'PasteFromWord' => array('name' => 'PasteFromWord', 'icon' => $path . '/images/buttons/pastefromword.png', 'title' => 'Paste from Word', 'row' => 1),
|
|
1643 | 1723 |
'Print' => array('name' => 'Print', 'icon' => $path . '/images/buttons/print.png', 'title' => 'Print', 'row' => 1), |
1644 |
'SpellChecker' => array('name' => 'SpellChecker', 'icon' => $path . '/images/buttons/checkSpelling.png', 'title' => 'Check Spelling', 'row' => 1),
|
|
1645 |
'Scayt' => array('name' => 'Scayt', 'icon' => $path . '/images/buttons/checkSpelling.png', 'title' => 'Spell Check As you Type', 'row' => 1), //TODO sprawdzic ta opcje
|
|
1724 |
'SpellChecker' => array('name' => 'SpellChecker', 'icon' => $path . '/images/buttons/spellchecker.png', 'title' => 'Check Spelling', 'row' => 1),
|
|
1725 |
'Scayt' => array('name' => 'Scayt', 'icon' => $path . '/images/buttons/scayt.png', 'title' => 'Spell Check As you Type', 'row' => 1), //TODO sprawdzic ta opcje
|
|
1646 | 1726 |
'Undo' => array('name' => 'Undo', 'icon' => $path . '/images/buttons/undo.png', 'title' => 'Undo', 'row' => 1), |
1647 | 1727 |
'Redo' => array('name' => 'Redo', 'icon' => $path . '/images/buttons/redo.png', 'title' => 'Redo', 'row' => 1), |
1648 | 1728 |
'Find' => array('name' => 'Find', 'icon' => $path . '/images/buttons/find.png', 'title' => 'Find', 'row' => 1), |
1649 | 1729 |
'Replace' => array('name' => 'Replace', 'icon' => $path . '/images/buttons/replace.png', 'title' => 'Replace', 'row' => 1), |
1650 |
'SelectAll' => array('name' => 'SelectAll', 'icon' => $path . '/images/buttons/selectAll.png', 'title' => 'Select All', 'row' => 1),
|
|
1651 |
'RemoveFormat' => array('name' => 'RemoveFormat', 'icon' => $path . '/images/buttons/removeFormat.png', 'title' => 'Remove Format', 'row' => 1),
|
|
1730 |
'SelectAll' => array('name' => 'SelectAll', 'icon' => $path . '/images/buttons/selectall.png', 'title' => 'Select All', 'row' => 1),
|
|
1731 |
'RemoveFormat' => array('name' => 'RemoveFormat', 'icon' => $path . '/images/buttons/removeformat.png', 'title' => 'Remove Format', 'row' => 1),
|
|
1652 | 1732 |
'Form' => array('name' => 'Form', 'icon' => $path . '/images/buttons/form.png', 'title' => 'Form', 'row' => 1), |
1653 | 1733 |
'Checkbox' => array('name' => 'Checkbox', 'icon' => $path . '/images/buttons/checkbox.png', 'title' => 'Checkbox', 'row' => 1), |
1654 |
'Radio' => array('name' => 'Radio', 'icon' => $path . '/images/buttons/radioButton.png', 'title' => 'Radio Button', 'row' => 1),
|
|
1655 |
'TextField' => array('name' => 'TextField', 'icon' => $path . '/images/buttons/textField.png', 'title' => 'Text Field', 'row' => 1),
|
|
1734 |
'Radio' => array('name' => 'Radio', 'icon' => $path . '/images/buttons/radio.png', 'title' => 'Radio Button', 'row' => 1), |
|
1735 |
'TextField' => array('name' => 'TextField', 'icon' => $path . '/images/buttons/textfield.png', 'title' => 'Text Field', 'row' => 1),
|
|
1656 | 1736 |
'Textarea' => array('name' => 'Textarea', 'icon' => $path . '/images/buttons/textarea.png', 'title' => 'Textarea', 'row' => 1), |
1657 |
'Select' => array('name' => 'Select', 'icon' => $path . '/images/buttons/selectionField.png', 'title' => 'Selection Field', 'row' => 1),
|
|
1737 |
'Select' => array('name' => 'Select', 'icon' => $path . '/images/buttons/select.png', 'title' => 'Selection Field', 'row' => 1), |
|
1658 | 1738 |
'Button' => array('name' => 'Button', 'icon' => $path . '/images/buttons/button.png', 'title' => 'Button', 'row' => 1), |
1659 |
'ImageButton' => array('name' => 'ImageButton', 'icon' => $path . '/images/buttons/imageButton.png', 'title' => 'Image Button', 'row' => 1),
|
|
1660 |
'HiddenField' => array('name' => 'HiddenField', 'icon' => $path . '/images/buttons/hiddenField.png', 'title' => 'Hidden Field', 'row' => 1),
|
|
1739 |
'ImageButton' => array('name' => 'ImageButton', 'icon' => $path . '/images/buttons/imagebutton.png', 'title' => 'Image Button', 'row' => 1),
|
|
1740 |
'HiddenField' => array('name' => 'HiddenField', 'icon' => $path . '/images/buttons/hiddenfield.png', 'title' => 'Hidden Field', 'row' => 1),
|
|
1661 | 1741 |
'Bold' => array('name' => 'Bold', 'icon' => $path . '/images/buttons/bold.png', 'title' => 'Bold', 'row' => 2), |
1662 | 1742 |
'Italic' => array('name' => 'Italic', 'icon' => $path . '/images/buttons/italic.png', 'type' => 'command', 'title' => 'Italic', 'row' => 2), |
1663 | 1743 |
'Underline' => array('name' => 'Underline', 'icon' => $path . '/images/buttons/underline.png', 'title' => 'Underline', 'row' => 2), |
1664 | 1744 |
'Strike' => array('name' => 'Strike', 'icon' => $path . '/images/buttons/strike.png', 'title' => 'Strike Through', 'row' => 2), |
1665 | 1745 |
'Subscript' => array('name' => 'Subscript', 'icon' => $path . '/images/buttons/subscript.png', 'title' => 'Subscript', 'row' => 2), |
1666 | 1746 |
'Superscript' => array('name' => 'Superscript', 'icon' => $path . '/images/buttons/superscript.png', 'title' => 'Superscript', 'row' => 2), |
1667 |
'NumberedList' => array('name' => 'NumberedList', 'icon' => $path . '/images/buttons/numberedList.png', 'title' => 'Insert/Remove Numbered List', 'row' => 2), |
|
1668 |
'BulletedList' => array('name' => 'BulletedList', 'icon' => $path . '/images/buttons/bulletedList.png', 'title' => 'Insert/Remove Bulleted List', 'row' => 2), |
|
1669 |
'Outdent' => array('name' => 'Outdent', 'icon' => $path . '/images/buttons/decreaseIndent.png', 'title' => 'Decrease Indent', 'row' => 2), |
|
1670 |
'Indent' => array('name' => 'Indent', 'icon' => $path . '/images/buttons/increaseIndent.png', 'title' => 'Increase Indent', 'row' => 2), |
|
1671 |
'Blockquote' => array('name' => 'Blockquote', 'icon' => $path . '/images/buttons/blockQuote.png', 'title' => 'Block Quote', 'row' => 2), |
|
1672 |
'CreateDiv' => array('name' => 'CreateDiv', 'icon' => $path . '/images/buttons/createDivContainer.png', 'title' => 'Create Div Container', 'row' => 2), |
|
1673 |
'JustifyLeft' => array('name' => 'JustifyLeft', 'icon' => $path . '/images/buttons/leftJustify.png', 'title' => 'Left Justify', 'row' => 2), |
|
1674 |
'JustifyCenter' => array('name' => 'JustifyCenter', 'icon' => $path . '/images/buttons/centerJustify.png', 'title' => 'Center Justify', 'row' => 2), |
|
1675 |
'JustifyRight' => array('name' => 'JustifyRight', 'icon' => $path . '/images/buttons/rightJustify.png', 'title' => 'Right Justify', 'row' => 2), |
|
1676 |
'JustifyBlock' => array('name' => 'JustifyBlock', 'icon' => $path . '/images/buttons/blockJustify.png', 'title' => 'Block Justify', 'row' => 2), |
|
1677 |
'BidiLtr' => array('name' => 'BidiLtr', 'icon' => $path . '/images/buttons/bidiLeft.png', 'title' => 'Text direction from left to right', 'row' => 2), |
|
1678 |
'BidiRtl' => array('name' => 'BidiRtl', 'icon' => $path . '/images/buttons/bidiRight.png', 'title' => 'Text direction from right to left', 'row' => 2), |
|
1747 |
'NumberedList' => array('name' => 'NumberedList', 'icon' => $path . '/images/buttons/numberedlist.png', 'title' => 'Insert/Remove Numbered List', 'row' => 2), |
|
1748 |
'BulletedList' => array('name' => 'BulletedList', 'icon' => $path . '/images/buttons/bulletedlist.png', 'title' => 'Insert/Remove Bulleted List', 'row' => 2), |
|
1749 |
'Outdent' => array('name' => 'Outdent', 'icon' => $path . '/images/buttons/outdent.png', 'title' => 'Decrease Indent', 'row' => 2), |
|
1750 |
'Indent' => array('name' => 'Indent', 'icon' => $path . '/images/buttons/indent.png', 'title' => 'Increase Indent', 'row' => 2), |
|
1751 |
'Blockquote' => array('name' => 'Blockquote', 'icon' => $path . '/images/buttons/blockquote.png', 'title' => 'Block Quote', 'row' => 2), |
|
1752 |
'CreateDiv' => array('name' => 'CreateDiv', 'icon' => $path . '/images/buttons/creatediv.png', 'title' => 'Create Div Container', 'row' => 2), |
|
1753 |
'JustifyLeft' => array('name' => 'JustifyLeft', 'icon' => $path . '/images/buttons/justifyleft.png', 'title' => 'Left Justify', 'row' => 2), |
|
1754 |
'JustifyCenter' => array('name' => 'JustifyCenter', 'icon' => $path . '/images/buttons/justifycenter.png', 'title' => 'Center Justify', 'row' => 2), |
|
1755 |
'JustifyRight' => array('name' => 'JustifyRight', 'icon' => $path . '/images/buttons/justifyright.png', 'title' => 'Right Justify', 'row' => 2), |
|
1756 |
'JustifyBlock' => array('name' => 'JustifyBlock', 'icon' => $path . '/images/buttons/justifyblock.png', 'title' => 'Block Justify', 'row' => 2), |
|
1757 |
'BidiLtr' => array('name' => 'BidiLtr', 'icon' => $path . '/images/buttons/bidiltr.png', 'title' => 'Text direction from left to right', 'row' => 2), |
|
1758 |
'BidiRtl' => array('name' => 'BidiRtl', 'icon' => $path . '/images/buttons/bidirtl.png', 'title' => 'Text direction from right to left', 'row' => 2), |
|
1759 |
'Language' => array('name' => 'Language', 'icon' => $path . '/images/buttons/language.png', 'title' => 'Set Language', 'row' => 2), |
|
1679 | 1760 |
'Link' => array('name' => 'Link', 'icon' => $path . '/images/buttons/link.png', 'title' => 'Link', 'row' => 2), |
1680 | 1761 |
'Unlink' => array('name' => 'Unlink', 'icon' => $path . '/images/buttons/unlink.png', 'title' => 'Unlink', 'row' => 2), |
1681 | 1762 |
'Anchor' => array('name' => 'Anchor', 'icon' => $path . '/images/buttons/anchor.png', 'title' => 'Anchor', 'row' => 2), |
1682 | 1763 |
'Image' => array('name' => 'Image', 'icon' => $path . '/images/buttons/image.png', 'title' => 'Image', 'row' => 2), |
1683 | 1764 |
'Flash' => array('name' => 'Flash', 'icon' => $path . '/images/buttons/flash.png', 'title' => 'Flash', 'row' => 2), |
1684 | 1765 |
'Table' => array('name' => 'Table', 'icon' => $path . '/images/buttons/table.png', 'title' => 'Table', 'row' => 2), |
1685 |
'HorizontalRule' => array('name' => 'HorizontalRule', 'icon' => $path . '/images/buttons/horizontalLine.png', 'title' => 'Insert Horizontal Line', 'row' => 2),
|
|
1766 |
'HorizontalRule' => array('name' => 'HorizontalRule', 'icon' => $path . '/images/buttons/horizontalrule.png', 'title' => 'Insert Horizontal Line', 'row' => 2),
|
|
1686 | 1767 |
'Smiley' => array('name' => 'Smiley', 'icon' => $path . '/images/buttons/smiley.png', 'title' => 'Smiley', 'row' => 2), |
1687 |
'SpecialChar' => array('name' => 'SpecialChar', 'icon' => $path . '/images/buttons/specialCharacter.png', 'title' => 'Inseert Special Character', 'row' => 2),
|
|
1688 |
'PageBreak' => array('name' => 'PageBreak', 'icon' => $path . '/images/buttons/pageBreakPrinting.png', 'title' => 'Insert Page Break for Printing', 'row' => 2),
|
|
1768 |
'SpecialChar' => array('name' => 'SpecialChar', 'icon' => $path . '/images/buttons/specialchar.png', 'title' => 'Insert Special Character', 'row' => 2),
|
|
1769 |
'PageBreak' => array('name' => 'PageBreak', 'icon' => $path . '/images/buttons/pagebreak.png', 'title' => 'Insert Page Break for Printing', 'row' => 2),
|
|
1689 | 1770 |
'Styles' => array('name' => 'Styles', 'icon' => $path . '/images/buttons/styles.png', 'title' => 'Formatting Styles', 'row' => 3), |
1690 | 1771 |
'Format' => array('name' => 'Format', 'icon' => $path . '/images/buttons/format.png', 'title' => 'Paragraph Format', 'row' => 3), |
1691 | 1772 |
'Font' => array('name' => 'Font', 'icon' => $path . '/images/buttons/font.png', 'title' => 'Font Name', 'row' => 3), |
1692 |
'FontSize' => array('name' => 'FontSize', 'icon' => $path . '/images/buttons/fontSize.png', 'title' => 'Font Size', 'row' => 3),
|
|
1693 |
'TextColor' => array('name' => 'TextColor', 'icon' => $path . '/images/buttons/textColor.png', 'title' => 'Text Color', 'row' => 3),
|
|
1694 |
'BGColor' => array('name' => 'BGColor', 'icon' => $path . '/images/buttons/backgroundColor.png', 'title' => 'Background Color', 'row' => 3),
|
|
1773 |
'FontSize' => array('name' => 'FontSize', 'icon' => $path . '/images/buttons/size.png', 'title' => 'Font Size', 'row' => 3),
|
|
1774 |
'TextColor' => array('name' => 'TextColor', 'icon' => $path . '/images/buttons/textcolor.png', 'title' => 'Text Color', 'row' => 3),
|
|
1775 |
'BGColor' => array('name' => 'BGColor', 'icon' => $path . '/images/buttons/bgcolor.png', 'title' => 'Background Color', 'row' => 3),
|
|
1695 | 1776 |
'Maximize' => array('name' => 'Maximize', 'icon' => $path . '/images/buttons/maximize.png', 'title' => 'Maximize', 'row' => 3), |
1696 |
'ShowBlocks' => array('name' => 'ShowBlocks', 'icon' => $path . '/images/buttons/showBlocks.png', 'title' => 'Show Blocks', 'row' => 3),
|
|
1777 |
'ShowBlocks' => array('name' => 'ShowBlocks', 'icon' => $path . '/images/buttons/showblocks.png', 'title' => 'Show Blocks', 'row' => 3),
|
|
1697 | 1778 |
'Iframe' => array('name' => 'Iframe', 'icon' => $path . '/images/buttons/iframe.png', 'title' => 'IFrame', 'row' => 3), |
1698 | 1779 |
'About' => array('name' => 'About', 'icon' => $path . '/images/buttons/about.png', 'title' => 'About', 'row' => 3), |
1699 | 1780 |
'__spacer' => array('name' => FALSE, 'icon' => $path . '/images/buttons/spacer.png', 'title' => 'Spacer', 'row' => 4), |
... | ... | |
1765 | 1846 |
} |
1766 | 1847 |
|
1767 | 1848 |
$editor_path = ckeditor_path('relative'); |
1849 |
if ($editor_path == '<URL>') |
|
1850 |
$editor_path = ckeditor_path('url'); |
|
1768 | 1851 |
$module_drupal_path = ckeditor_module_path('relative'); |
1769 | 1852 |
|
1770 | 1853 |
$html = "<!DOCTYPE html>"; |
... | ... | |
1803 | 1886 |
}); |
1804 | 1887 |
CKEDITOR.replace('editor', { |
1805 | 1888 |
extraPlugins : 'uicolor', |
1806 |
height: 400,
|
|
1889 |
height: 330,
|
|
1807 | 1890 |
uiColor: '#' + uicolor, |
1808 | 1891 |
toolbar : [[ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList'],[ 'UIColor' ]], |
1809 | 1892 |
skin: skin, |
Formats disponibles : Unified diff
Update CKEditor