function _ueditor_modify_config in UEditor - 百度编辑器 7
Modify the config.json file data.
1 call to _ueditor_modify_config()
- ueditor_settings_form_validate_uploadpath in editors/
ueditor.inc - Deal with settings form submit.
File
- editors/
ueditor.inc, line 259 - Editor integration functions for ueditor.
Code
function _ueditor_modify_config($editor, $uploadpath) {
$config_json = $editor['library path'] . '/php/config.json';
$changed = FALSE;
if (!($changed = FALSE)) {
$CONFIG = drupal_json_decode(preg_replace("/\\/\\*[\\s\\S]+?\\*\\//", "", file_get_contents($config_json)), true);
$changed = TRUE;
}
else {
$CONFIG = drupal_json_decode(file_get_contents($config_json));
}
foreach ($uploadpath as $key => $pathitem) {
if (isset($CONFIG[$key])) {
$CONFIG[$key] = _ueditor_realpath($pathitem);
}
}
$new_val = drupal_json_encode($CONFIG);
$file = fopen($config_json, "wb");
fwrite($file, $new_val);
fclose($file);
}