You are here

function ckeditor_admin_global_profile_form_validate in CKEditor - WYSIWYG HTML editor 6

Same name and namespace in other branches
  1. 7 includes/ckeditor.admin.inc \ckeditor_admin_global_profile_form_validate()

File

includes/ckeditor.admin.inc, line 1848
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_admin_global_profile_form_validate($form, &$form_state) {
  $edit =& $form_state['values'];
  if (!preg_match('#^\\s*\\[(?:\\s*(?:\\{\\s*[\\w:\'" ,]*\\s*\\[(?:\\s*([\'\\"\\"])(?:\\w+|-)\\1\\s*[,]?\\s*)+\\]\\s*\\}|([\'\\"\\"])\\/\\2)\\s*[,]?\\s*)+\\]\\s*$#U', $edit['simple_toolbar']) && !preg_match('#^\\s*\\[(?:\\s*(?:\\[(?:\\s*([\'\\"\\"])(?:\\w+|-)\\1\\s*[,]?\\s*)+\\]|([\'\\"\\"])\\/\\2)\\s*[,]?\\s*)+\\]\\s*$#', $edit['simple_toolbar'])) {
    form_set_error('simple_toolbar', t('Enter a valid toolbar configuration.'));
  }

  //include mode and all other fields are empty, invalid
  if ($edit['excl_mode'] == 1 && empty($edit['excl'])) {
    form_set_error('excl_mode', t('Include mode selected, but no paths given. Enter at least one path where CKEditor should appear.'));
  }
  else {
    ckeditor_admin_profile_validate_fieldpaths('excl', $edit['excl']);
  }
  ckeditor_admin_profile_validate_fieldpaths('simple_incl', $edit['simple_incl']);
}