You are here

function bueditor_path_tr in BUEditor 7

Same name and namespace in other branches
  1. 6.2 bueditor.inc \bueditor_path_tr()
  2. 6 bueditor.module \bueditor_path_tr()

Translate editor paths.

6 calls to bueditor_path_tr()
bueditor_editor_theme in admin/bueditor.admin.inc
Editor form theming.
bueditor_get_library in ./bueditor.inc
Get an array of js and css files defined in editor library.
bueditor_save_import in admin/bueditor.admin.inc
Save imported editor data. Save icons and library files into specified editor path.
bueditor_sprite_buttons in admin/bueditor.sprite.inc
Create an icon sprite for a set of buttons.
bueditor_varexport_editor in admin/bueditor.admin.inc
Generate an importable editor string including icon and library files.

... See full list

File

./bueditor.inc, line 248
Implements commonly used functions for bueditor.

Code

function bueditor_path_tr($path, $reverse = FALSE) {
  if (!$path) {
    return $path;
  }
  static $tokens;
  if (!isset($tokens)) {
    $tokens = array(
      '%BUEDITOR' => drupal_get_path('module', 'bueditor'),
      '%FILES' => bueditor_public_dir(),
      '%THEME' => isset($GLOBALS['theme']) ? drupal_get_path('theme', $GLOBALS['theme']) : path_to_theme(),
    );
  }
  if ($reverse) {
    return strtr($path, array_flip($tokens));
  }
  $trpath = strtr($path, $tokens);

  // For themes missing icon or library directory, switch to default theme.
  if (!file_exists($trpath) && substr($path, 0, 6) == '%THEME') {
    $trpath = str_replace('%THEME', drupal_get_path('theme', variable_get('theme_default', 'bartik')), $path);
  }
  return $trpath;
}