function ckeditor_admin_global_profile_form_validate in CKEditor - WYSIWYG HTML editor 7
Same name and namespace in other branches
- 6 includes/ckeditor.admin.inc \ckeditor_admin_global_profile_form_validate()
Form validation for a global profile
File
- includes/
ckeditor.admin.inc, line 528 - 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 (!empty($edit['skin'])) {
if (preg_match('/^\\/\\/cdn\\.ckeditor\\.com\\/(.*)\\/(.*)$/', $edit['ckeditor_path'], $matches)) {
// Assume a default skin is being used, then check if this is true.
$default_skin = TRUE;
$default_skin_string = '';
// CKEditor v4.6 and above use "moono-lisa" as the default skin.
if (version_compare($matches[1], '4.6', '>=')) {
// Presets standard-all and full-all contains all default skins
$defaults = !empty($matches[2]) && substr($matches[2], -4) == '-all' ? [
'moono-lisa',
'moono',
'kama',
] : [
'moono-lisa',
];
if (!in_array($edit['skin'], $defaults)) {
$default_skin = FALSE;
$default_skin_string = 'Moono-lisa';
}
}
elseif (!in_array($edit['skin'], [
'moono',
'kama',
])) {
$default_skin = FALSE;
$default_skin_string = 'Moono or Kama';
}
$skin_js_local = ckeditor_skins_path('local') . '/' . $edit['skin'] . '/skin.js';
if (!$default_skin && !file_exists($skin_js_local)) {
$skin_js_relative = ckeditor_skins_path('relative') . '/' . $edit['skin'] . '/skin.js';
$err_msg = t('When using the CKEditor CDN and a skin other than @skin_string, the <strong>skin.js</strong> file must be accessible locally. To fix this issue, download the skin from <a href="@url">CKEditor Addons</a>, extract skin.js, and place the file in the sub-directory named for the selected skin (for example: <em>@skin_js</em>).', array(
'@skin_string' => $default_skin_string,
'@url' => 'http://ckeditor.com/addons/skins/all',
'@skin_js' => $skin_js_relative,
));
form_set_error('ckeditor_skins_path', $err_msg);
}
}
}
}