From a1ac4b293d94ed249abdaa7628283e023b07a987 Mon Sep 17 00:00:00 2001 From: michal Date: Fri, 26 Aug 2011 14:06:39 +0200 Subject: [PATCH] Add regex to work with 'new' CKEditor's toolbars (with groups for WAI-ARIA) --- includes/ckeditor.admin.inc | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/includes/ckeditor.admin.inc b/includes/ckeditor.admin.inc index c32bfe1..2878a9f 100644 --- a/includes/ckeditor.admin.inc +++ b/includes/ckeditor.admin.inc @@ -38,7 +38,7 @@ function ckeditor_admin_main() { module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); $editor_path = ckeditor_path(TRUE); $ckconfig_file = $editor_path . '/config.js'; - + //check if CKEditor plugin is installed if (!_ckeditor_requirements_isinstalled()) { drupal_set_message(t('Checking for %filename or %file.', array('%filename' => $ckconfig_file, '%file' => 'sites/all/libraries/ckeditor/ckeditor.js'))); @@ -333,7 +333,7 @@ function ckeditor_admin_profile_form($form, $form_state, $profile = NULL) { $profile->input_formats = array(); $used_formats = db_select('ckeditor_input_format', 'f')->fields('f', array("format"))->distinct()->execute()->fetchAllAssoc('format'); } - + $formats = array(); foreach ($orig_formats AS $format) { if ( (arg(4) == 'edit' && !empty($profile->input_formats) && array_key_exists($format->format, $profile->input_formats)) || !array_key_exists($format->format, $used_formats) ) { @@ -516,7 +516,7 @@ function ckeditor_admin_profile_form($form, $form_state, $profile = NULL) { '#wysiwyg' => FALSE, '#rows' => 15 ); - + $pluginList = ckeditor_load_plugins(); $plugins = array(); if (isset($profile->settings['loadPlugins'])){ @@ -771,8 +771,8 @@ function ckeditor_admin_profile_form($form, $form_state, $profile = NULL) { } if (module_exists('elfinder')) { - $filebrowsers['elfinder'] = t('elFinder'); - $filebrowsers_dialogs['elfinder'] = t('elFinder'); + $filebrowsers['elfinder'] = t('elFinder'); + $filebrowsers_dialogs['elfinder'] = t('elFinder'); } /* MODULES NOT PORTED TO D7 @@ -1028,8 +1028,7 @@ function ckeditor_admin_profile_form_validate($form, &$form_state) { if (!preg_match('#\d+#', $edit['ckeditor_load_time_out'])) { form_set_error('ckeditor_load_time_out', t('Enter valid load timeout in seconds.')); } - - if (!preg_match('#^\s*\[(?:\s*(?:\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#', $edit['toolbar'])) { + if (!preg_match('#^\s*\[(?:\s*(?:\{\s*[\w:\'" ,]*\s*\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]\s*\}|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#U', $edit['toolbar']) && !preg_match('#^\s*\[(?:\s*(?:\[(?:\s*([\'\"\"])(?:\w+|-)\1\s*[,]?\s*)+\]|([\'\"\"])\/\2)\s*[,]?\s*)+\]\s*$#', $edit['toolbar'])) { form_set_error('toolbar', t('Enter valid toolbar configuration.')); } } @@ -1102,7 +1101,7 @@ function ckeditor_admin_profile_clone_form_submit($form, &$form_state) { } } } - + $form_state['redirect'] = 'admin/config/content/ckeditor'; } @@ -1161,7 +1160,7 @@ function ckeditor_admin_values_to_settings($values) { $plugins = $values['loadPlugins']; } unset($values['name'], $values['input_formats'], $values['_profile'], $values['op'], $values['submit'], $values['form_build_id'], $values['form_token'], $values['form_id'], $values['loadPlugins']); - + module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); $pluginList = ckeditor_load_plugins(); $values['loadPlugins'] = array(); -- 1.7.4.msysgit.0