function _plupload_requirements_version in Plupload integration 8
Same name and namespace in other branches
- 7.2 plupload.install \_plupload_requirements_version()
- 7 plupload.install \_plupload_requirements_version()
- 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 87 - Install, update and uninstall functions for the Plupload module.
Code
function _plupload_requirements_version() {
$libraries = \Drupal::service('library.discovery')
->getLibrariesByExtension('plupload');
$library = $libraries['plupload'];
// Read contents of Plupload's javascript file.
$configcontents = @file_get_contents($library['js'][0]['data']);
if (!$configcontents) {
return NULL;
}
// Search for version string using a regular expression.
$matches = [];
if (preg_match("#Plupload.*v(\\d+[\\.\\d+]*)#s", $configcontents, $matches)) {
return $matches[1];
}
return NULL;
}