You are here

function _share42_library_version in Share42 - social sharing buttons 6

Same name and namespace in other branches
  1. 7.2 share42.module \_share42_library_version()
  2. 7 share42.module \_share42_library_version()

Returns version of the Share42 library.

1 call to _share42_library_version()
share42_requirements in ./share42.install
Implements hook_requirements().

File

./share42.module, line 115
Main file for the Share42 module.

Code

function _share42_library_version() {
  static $version;
  if (is_null($version) && ($library_path = _share42_library_path())) {
    $pattern = '/share42.com \\| ([0-9\\.]+)/';
    $share42_js = file_get_contents($library_path . '/share42.js', NULL, NULL, 0, 32);
    if (preg_match($pattern, $share42_js, $matches)) {
      $version = $matches[1];
    }
    else {
      $version = 'Unknown';
    }
  }
  return $version;
}