function joyride_version in Joyride JQuery for Drupal Site Tours 7
Library version callback. Make sure the library version is correct.
1 string reference to 'joyride_version'
- joyride_libraries_info in ./
joyride.module - Implements hook_libraries_info(). Return information about external libraries.
File
- ./
joyride.module, line 40
Code
function joyride_version($library, $options) {
// Provide defaults.
$options += array(
'file' => '',
'pattern' => '',
'lines' => 20,
'cols' => 200,
);
$file = DRUPAL_ROOT . '/' . $library['library path'] . '/' . $options['file'];
if (empty($options['file']) || !file_exists($file)) {
return;
}
$file = fopen($file, 'r');
while ($options['lines'] && ($line = fgets($file, $options['cols']))) {
if (preg_match($options['pattern'], $line, $version)) {
if ($version[1] == JOYRIDE_LIBRARY_VERSION) {
fclose($file);
return $version[1];
}
}
$options['lines']--;
}
fclose($file);
}