function videojs_get_version in Video.js (HTML5 Video Player) 7.3
Same name and namespace in other branches
- 8 videojs.module \videojs_get_version()
- 6.2 videojs.module \videojs_get_version()
- 6 videojs.module \videojs_get_version()
- 7 videojs.module \videojs_get_version()
- 7.2 videojs.module \videojs_get_version()
Return the version of Video.js installed.
Parameters
$path: The path to check for a Video.js installation. This can be a local path like sites/all/libraries/video-js or a remote path like http://mycdn.com/videojs. Do not add a trailing slash. Defaults to videojs_directory when using the local file path location or whatever location the Libraries API determines.
Return value
The version found or NULL if no version found.
2 calls to videojs_get_version()
- videojs_requirements in ./
videojs.install - Implements hook_requirements().
- videojs_settings_form_validate in includes/
videojs.admin.inc - Validation function to validate the videojs_settings_form() form.
File
- ./
videojs.module, line 422 - Provides an HTML5-compatible with Flash-fallback video player.
Code
function videojs_get_version($path = NULL) {
$version = NULL;
if (!isset($path)) {
// Don't hit the network for each call when using CDN.
if (variable_get('videojs_location', 'cdn') === 'cdn') {
return videojs_utility::getCdnVersion();
}
$path = videojs_get_path();
}
// When admins specify a protocol-relative URL, add http because file_get_contents doesn't understand it.
if (strncmp('//', $path, 2) === 0) {
$path = 'http:' . $path;
}
// Don't use file_exists() because it doesn't work with URLs.
// Now admins can also refer to directories like http://mycdn.com/videojs.
$contents = @file_get_contents($path . '/video.js', FALSE, NULL, 0, 400);
if (!empty($contents)) {
$matches = array();
if (preg_match(videojs_utility::VERSION_REGEX, $contents, $matches)) {
$version = $matches[1];
}
}
return $version;
}