You are here

function htmlpurifier_libraries_get_version in HTML Purifier 7.2

Gets the version information from the HTML Purifier library.

See also

libraries_get_path()

1 string reference to 'htmlpurifier_libraries_get_version'
htmlpurifier_libraries_info in ./htmlpurifier.module
Implements hook_libraries_info().

File

./htmlpurifier.module, line 135
Implements HTML Purifier as a Drupal filter.

Code

function htmlpurifier_libraries_get_version($library, $options) {

  // Try to detect if a "Standard" HTML Purifier distribution is installed.
  $normal_version = libraries_get_version($library, $options);
  if (!empty($normal_version)) {
    return $normal_version;
  }

  // Try to detect if a "Lite" HTML Purifier distribution is installed.
  // The "Lite Distribution" does not have a "VERSION" file.
  $options = array(
    'file' => 'library/HTMLPurifier/Config.php',
    'pattern' => '@\\s+\\$version\\s*=\\s*\'([0-9\\.]+)\'@',
    'lines' => 40,
    'cols' => 40,
  );
  $lite_version = libraries_get_version($library, $options);
  if (!empty($lite_version)) {
    return $lite_version;
  }
}