You are here

function jplayer_get_version in jPlayer 6

Same name and namespace in other branches
  1. 7.2 jplayer.module \jplayer_get_version()

Return the version of jQuery UI installed.

Parameters

$directory: The directory to check for a jPlayer installation.

2 calls to jplayer_get_version()
jplayer_requirements in ./jplayer.install
Implementation of hook_requirements().
jplayer_settings_form_validate in includes/jplayer.admin.inc
Validation function to validate the jplayer_settings_form() form.

File

./jplayer.module, line 188
Provides an HTML5-compatible with Flash-fallback audio player.

Code

function jplayer_get_version($directory = NULL) {
  $version = 0;
  if (!isset($directory)) {
    $directory = variable_get('jplayer_directory', 'sites/all/libraries/jplayer');
  }
  if (file_exists($directory . '/jquery.jplayer.min.js')) {
    $contents = file_get_contents($directory . '/jquery.jplayer.min.js');
  }
  elseif (file_exists($directory . '/jquery.jplayer.js')) {
    $contents = file_get_contents($directory . '/jquery.jplayer.js');
  }
  $matches = array();
  preg_match('/Version:?[ ]*([\\d.]+)/i', $contents, $matches);
  if (isset($matches[1])) {
    $version = $matches[1];
  }
  return $version;
}