You are here

function getlocations_leaflet_library_version in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_leaflet/getlocations_leaflet.module \getlocations_leaflet_library_version()

Fetch leaflet version.

Return value

Returns version number

2 calls to getlocations_leaflet_library_version()
getlocations_leaflet_requirements in modules/getlocations_leaflet/getlocations_leaflet.install
Implements hook_requirements().
getlocations_leaflet_settings_form in modules/getlocations_leaflet/getlocations_leaflet.module
Function

File

modules/getlocations_leaflet/getlocations_leaflet.module, line 5204
getlocations_leaflet.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_leaflet_library_version() {
  $version = '';
  $file = libraries_get_path('leaflet') . '/leaflet.js';
  if (file_exists($file)) {
    $contents = file_get_contents($file);
    $regex = '/version="([0-9.]+)"/';
    if (preg_match($regex, $contents, $m)) {
      $version = $m[1];
    }
  }
  return $version;
}