function _ueditor_global_settings_validate_path in UEditor - 百度编辑器 7.3
Same name and namespace in other branches
- 7.2 ueditor.module \_ueditor_global_settings_validate_path()
Helper function for the system_theme_settings form.
Attempts to validate normal system paths, paths relative to the public files directory, or stream wrapper URIs. If the given path is any of the above, returns a valid path or URI that the theme system can display.
Parameters
$path: A path relative to the Drupal root or to the public files directory, or a stream wrapper URI.
Return value
mixed A valid path that can be displayed through the theme system, or FALSE if the path could not be validated.
2 calls to _ueditor_global_settings_validate_path()
- ueditor_global_settings_submit in ./
ueditor.module - Submit callback for ueditor global settings form.
- ueditor_global_settings_validate in ./
ueditor.module - Validator for the ueditor_global_settings() form.
File
- ./
ueditor.module, line 483 - Integration ueditor for wysiwyg.
Code
function _ueditor_global_settings_validate_path($path) {
// Absolute local file paths are invalid.
if (drupal_realpath($path) == $path) {
return FALSE;
}
// A path relative to the Drupal root or a fully qualified URI is valid.
if (is_file($path)) {
return $path;
}
// Prepend 'public://' for relative file paths within public filesystem.
if (file_uri_scheme($path) === FALSE) {
$path = 'public://' . $path;
}
if (is_file($path)) {
return $path;
}
return FALSE;
}