You are here

function _plupload_requirements_version in Plupload integration 7.2

Same name and namespace in other branches
  1. 8 plupload.install \_plupload_requirements_version()
  2. 7 plupload.install \_plupload_requirements_version()
  3. 2.0.x plupload.install \_plupload_requirements_version()

Returns the version of the installed plupload library.

Return value

string The version of installed Plupload or NULL if unable to detect version.

1 call to _plupload_requirements_version()
plupload_requirements in ./plupload.install
Implements hook_requirements().

File

./plupload.install, line 89
Install, update and uninstall functions for the Plupload module.

Code

function _plupload_requirements_version() {
  $library_path = _plupload_library_path();
  $jspath = $library_path . '/js/plupload.full.min.js';

  // Read contents of Plupload's javascript file.
  $configcontents = @file_get_contents($jspath);
  if (!$configcontents) {
    return NULL;
  }

  // Search for version string using a regular expression.
  $matches = array();
  if (preg_match("#Plupload.*v(\\d+[\\.\\d+]*)#s", $configcontents, $matches)) {
    return $matches[1];
  }
  return NULL;
}