You are here

function _addtocopy_library_version in Add link to copied text 7

Returns version of the Add to Copy library.

2 calls to _addtocopy_library_version()
addtocopy_library in ./addtocopy.module
Implements hook_library().
addtocopy_requirements in ./addtocopy.install
Implements hook_requirements().

File

./addtocopy.module, line 106

Code

function _addtocopy_library_version() {
  $version =& drupal_static(__FUNCTION__, NULL);
  if (is_null($version) && ($library_path = _addtocopy_library_path())) {
    $pattern = '/@version ([0-9\\.a-z]+)/';
    $addtocopy_js = file_get_contents(_addtocopy_library_path_js(), NULL, NULL, 0, 150);
    if (preg_match($pattern, $addtocopy_js, $matches)) {
      $version = $matches[1];
    }
    else {
      $version = 'Unknown';
    }
  }
  return $version;
}