You are here

function responsive_menu_get_library_version in Responsive and off-canvas menu 4.4.x

Same name and namespace in other branches
  1. 8.3 responsive_menu.install \responsive_menu_get_library_version()
  2. 8.2 responsive_menu.install \responsive_menu_get_library_version()
  3. 4.0.x responsive_menu.install \responsive_menu_get_library_version()
  4. 4.1.x responsive_menu.install \responsive_menu_get_library_version()
  5. 4.3.x responsive_menu.install \responsive_menu_get_library_version()

Returns a version string.

Parameters

string $version_path: The path to the file containing the version.

Return value

string A version string or '0' if not found.

1 call to responsive_menu_get_library_version()
responsive_menu_requirements in ./responsive_menu.install
Implements hook_requirements().

File

./responsive_menu.install, line 217
Contains install and update functions.

Code

function responsive_menu_get_library_version($version_path) {
  if (!file_exists(DRUPAL_ROOT . $version_path)) {
    return '0';
  }
  $json = file_get_contents(DRUPAL_ROOT . $version_path);
  if (!$json) {
    return '0';
  }
  $json_array = json_decode($json, TRUE);
  if (isset($json_array['version'])) {
    return $json_array['version'];
  }
  return '0';
}