You are here

function modernizr_get_path in Modernizr 7.2

Same name and namespace in other branches
  1. 8 modernizr.module \modernizr_get_path()
  2. 7.3 modernizr.module \modernizr_get_path()

Returns the full path of modernizr, along with the filename.

Return value

string

2 calls to modernizr_get_path()
modernizr_get_version in ./modernizr.module
Guesses the modernizr library version.
modernizr_init in ./modernizr.module
Implements hook_init().

File

./modernizr.module, line 111

Code

function modernizr_get_path() {
  $path =& drupal_static(__FUNCTION__);
  if ($path === NULL) {
    $paths = array();
    if (module_exists('libraries')) {
      $library_path = libraries_get_path('modernizr');
      if (file_exists($library_path)) {
        $paths[] = $library_path;
      }
    }
    $paths[] = drupal_get_path('module', 'modernizr');
    foreach ($paths as $p) {
      if ($files = file_scan_directory($p, '/^modernizr[a-z\\.-]*\\.js$/')) {
        $path = reset($files)->uri;
        break;
      }
    }
  }
  return $path;
}