You are here

function phpexcel_get_library_version in PHPExcel 7.3

Libraries API version callback.

1 string reference to 'phpexcel_get_library_version'
phpexcel_libraries_info in ./phpexcel.module
Implements hook_libraries_info().

File

./phpexcel.module, line 62
The module file.

Code

function phpexcel_get_library_version($library) {
  $changelog_file = $library['library path'] . DIRECTORY_SEPARATOR . 'changelog.txt';
  if (file_exists($changelog_file)) {
    $changelog = file_get_contents($changelog_file);
    if (preg_match('/\\d{4}-\\d{2}-\\d{2}\\s+\\(v([0-9\\.]+)/', $changelog, $match)) {
      return $match[1];
    }
    elseif (preg_match('/@version\\s+([0-9\\.]+)/', $changelog, $match)) {
      return $match[1];
    }
  }
  return 'n/a';
}