You are here

function _modernizr_sanitize_resource in Modernizr 8

Same name and namespace in other branches
  1. 7.3 modernizr.module \_modernizr_sanitize_resource()

Helper function to sanitize Modernizr.load() assets

1 call to _modernizr_sanitize_resource()
modernizr_load_data in ./modernizr.module
A function to generate the load data from the current themes.

File

./modernizr.module, line 434
Main module file for Modernizr

Code

function _modernizr_sanitize_resource($resource, $theme_path) {
  global $base_url;
  $output = '';

  // If a path starts with 'sites' we assume they know exactly where they're
  // going. Otherwise, they seem like relative URLs so append theme path.
  $output = strpos($resource, 'sites/') !== FALSE ? $resource : $base_url . '/' . $theme_path . $resource;
  return $output;
}