You are here

function _js_injector_rule_path in JS injector 7.2

Same name and namespace in other branches
  1. 8 js_injector.module \_js_injector_rule_path()
  2. 6.2 js_injector.module \_js_injector_rule_path()
  3. 7 js_injector.module \_js_injector_rule_path()

Helper function to get file path for a rule. This will get the path relative to DRUPAL_ROOT, as in 'sites/default/files/js_injector/js_injector_99.js'.

Parameters

$crid: The JS injector rule unique ID

1 call to _js_injector_rule_path()
js_injector_init in ./js_injector.module
Implements hook_init().

File

./js_injector.module, line 252
js_injector.module

Code

function _js_injector_rule_path($crid) {
  if (!empty($crid)) {
    $local_path = file_create_url(_js_injector_rule_uri($crid));

    // Now remove the part before the drupal root.
    $local_path = preg_replace('/^' . preg_quote($GLOBALS['base_url'], '/') . '\\//', '', $local_path);
    return $local_path;
  }
  return NULL;
}