You are here

function videojs_get_version in Video.js (HTML5 Video Player) 7

Same name and namespace in other branches
  1. 8 videojs.module \videojs_get_version()
  2. 6.2 videojs.module \videojs_get_version()
  3. 6 videojs.module \videojs_get_version()
  4. 7.3 videojs.module \videojs_get_version()
  5. 7.2 videojs.module \videojs_get_version()

Return the version of Video.js installed.

Parameters

$directory: The directory to check for a Video.js installation.

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 149
Provides an HTML5-compatible with Flash-fallback video player.

Code

function videojs_get_version($directory = NULL) {
  $version = NULL;
  if (!isset($directory)) {
    $directory = variable_get('videojs_directory', 'sites/all/libraries/video-js');
  }
  if (!file_exists($directory . '/video.js')) {
    return NULL;
  }
  $contents = file_get_contents($directory . '/video.js');
  $matches = array();
  if (preg_match('/(?:v[ ]*|Version )([\\d.]+)/i', $contents, $matches)) {
    $version = $matches[1];
  }
  return $version;
}