You are here

function elfinder_parse_path_tokens in elFinder file manager 6.2

Same name and namespace in other branches
  1. 8.2 elfinder.module \elfinder_parse_path_tokens()
  2. 6 elfinder.module \elfinder_parse_path_tokens()
  3. 7.3 elfinder.module \elfinder_parse_path_tokens()
  4. 7 elfinder.module \elfinder_parse_path_tokens()
  5. 7.2 elfinder.module \elfinder_parse_path_tokens()

replace path tokens to its values (%uid, %user, etc)

7 calls to elfinder_parse_path_tokens()
elfinder_admin_form_validate in inc/elfinder.admin.inc
Validate form data
elfinder_admin_form_validate in inc/elfinder.admin.profiles.inc
Validate form data
elfinder_connector in ./elfinder.module
File browser to filesystem php connector callback
elfinder_editor_upload_ckeditor in editors/ckeditor/ckeditor.upload.inc
elfinder_editor_upload_fckeditor in editors/fckeditor/fckeditor.upload.inc

... See full list

File

./elfinder.module, line 1075

Code

function elfinder_parse_path_tokens($unparsed_path) {
  global $user, $language;
  $path = $unparsed_path;
  $uname = isset($user->name) ? preg_replace('/[[:^alnum:]]+/', '', $user->name) : '';
  $langCode = isset($language->language) ? $language->language : 'en';
  $path_tokens = array(
    '%uid' => $user->uid,
    '%name' => $uname,
    '%user' => $uname,
    '%files' => elfinder_default_directory_path(),
    '%lang' => $langCode,
  );
  $path = strtr($path, $path_tokens);
  if (function_exists('token_replace')) {
    $path = token_replace($path, 'global', NULL, '%', '');
  }
  return $path;
}