function ueditor_global_settings_submit in UEditor - 百度编辑器 7.2
Same name and namespace in other branches
- 7.3 ueditor.module \ueditor_global_settings_submit()
Submit callback for ueditor global settings form.
File
- ./
ueditor.module, line 505 - Integration ueditor for wysiwyg.
Code
function ueditor_global_settings_submit($form, &$form_state) {
// Exclude unnecessary elements before saving.
form_state_values_clean($form_state);
$values = $form_state['values'];
if (!empty($values['ueditor_enable_paging'])) {
if ($values['ueditor_enable_paging'] == 1) {
if (!module_exists('paging')) {
drupal_set_message(t('Please install the <a href="@url">Paging</a> module at first.', array(
'@url' => url("https://www.drupal.org/project/paging"),
)), 'error');
}
}
}
if (file_exists('sites/all/libraries/ueditor/kityformula-plugin/kityformula/js/kityformula-editor.all.min.js') || file_exists('profiles/' . drupal_get_profile() . '/libraries/ueditor/kityformula-plugin/kityformula/js/kityformula-editor.all.min.js')) {
$kityformula_installed = TRUE;
}
else {
$kityformula_installed = FALSE;
}
if (!empty($values['ueditor_enable_formula_editor'])) {
if ($values['ueditor_enable_formula_editor'] == 1) {
if (!$kityformula_installed) {
drupal_set_message(t('Please install the <a href="@url">kityformula</a> library at first, and the place should be like this: <i>sites/all/libraries/ueditor/kityformula-plugin/kityformula/js/kityformula-editor.all.min.js</i>', array(
'@url' => url("http://ueditor.baidu.com/download/kityformula-plugin.zip"),
)), 'error');
}
}
}
if (!empty($values['ueditor_enable_colorbox'])) {
if ($values['ueditor_enable_colorbox'] == 1) {
if (!module_exists('colorbox')) {
drupal_set_message(t('Please install the <a href="@url">Colorbox</a> module at first.', array(
'@url' => url("https://www.drupal.org/project/colorbox"),
)), 'error');
}
}
}
if (!empty($values['watermark_upload'])) {
$file = $values['watermark_upload'];
unset($values['watermark_upload']);
$filename = file_unmanaged_copy($file->uri);
$values['watermark_path'] = $filename;
}
// If the user entered a path relative to the system files directory for
// a watermark image, store a public:// URI so the theme system can handle it.
if (!empty($values['watermark_path'])) {
$values['watermark_path'] = _ueditor_global_settings_validate_path($values['watermark_path']);
}
foreach ($values as $key => $value) {
variable_set('ueditor_' . $key, $value);
}
drupal_set_message(t('The configuration options have been saved.'));
}