You are here

function modernizr_get_version in Modernizr 8

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

Guesses the modernizr library version.

This function is using a regex, which assumes that the format of the version string won't change. If it changes, feel free to submit a bug report.

Return value

mixed The version number if exists, or a boolean FALSE if it can't be determined.

1 call to modernizr_get_version()
modernizr_requirements in ./modernizr.install
Implements hook_requirements.

File

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

Code

function modernizr_get_version($reset = FALSE) {
  $version =& drupal_static(__FUNCTION__);

  // if ($version === NULL || $reset == TRUE) {
  //   if ($cached = cache_get('modernizr_version') && isset($cached->data) && $reset != TRUE) {
  //     $version = $cached->data;
  //   }
  //   else {
  //     $version = FALSE;
  //     $modernizr_path = modernizr_get_path();
  //     if (file_exists($modernizr_path)) {
  //       $modernizr = file_get_contents($modernizr_path);
  //       $matches = array();
  //       preg_match(MODERNIZR_VERSION_REGEX, $modernizr, $matches);
  //       if (isset($matches[1])) {
  //         $version = $matches[1];
  //         if ($version) {
  //           cache_set('modernizr_version', $version);
  //         }
  //       }
  //       unset($modernizr);
  //     }
  //   }
  // }
  return '2.6.2';
}