function elfinder_parse_path_tokens in elFinder file manager 8.2
Same name and namespace in other branches
- 6.2 elfinder.module \elfinder_parse_path_tokens()
- 6 elfinder.module \elfinder_parse_path_tokens()
- 7.3 elfinder.module \elfinder_parse_path_tokens()
- 7 elfinder.module \elfinder_parse_path_tokens()
- 7.2 elfinder.module \elfinder_parse_path_tokens()
replace path tokens to its values (%uid, %user, etc)
5 calls to elfinder_parse_path_tokens()
- elFinderConnectorController::getConnector in src/
Controller/ elFinderConnectorController.php - File browser to filesystem php connector service
- elfinder_editor_upload_ckeditor in editors/
ckeditor/ ckeditor.upload.inc - @file
- elfinder_editor_upload_fckeditor in editors/
fckeditor/ fckeditor.upload.inc - @file
- elfinder_file_directory_path in ./
elfinder.module - path to files directory
- elfinder_file_directory_url in ./
elfinder.module - files directory url
File
- ./
elfinder.module, line 250
Code
function elfinder_parse_path_tokens($unparsed_path) {
global $language;
$path = $unparsed_path;
$user = \Drupal::currentUser();
$uname = isset($user->name) ? preg_replace('/[[:^alnum:]]+/', '', $user->name) : '';
$langCode = isset($language->language) ? $language->language : 'en';
$path_tokens = array(
'%uid' => $user
->id(),
'%name' => $uname,
'%user' => $uname,
'%files' => elfinder_default_directory_path(),
'%lang' => $langCode,
);
$path = strtr($path, $path_tokens);
if (function_exists('token_replace')) {
$node = node_load($user
->id());
$path = token_replace($path, array(
'node' => $node,
'user' => $user,
));
}
return $path;
}