Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / videojs / videojs.module
1 <?php
2
3 /**
4  * @file
5  * Exposes global functionality for video.js fields.
6  */
7
8 use Drupal\Core\Entity\EntityInterface;
9 use Drupal\Core\Routing\RouteMatchInterface;
10 use Drupal\file\Entity\File;
11 use Drupal\field\FieldStorageConfigInterface;
12 use Drupal\field\FieldConfigInterface;
13
14 /**
15  * Implements hook_theme().
16  */
17 function videojs_theme() {
18   return array(
19     'videojs' => array(
20       'variables' => array('items' => NULL, 'player_attributes' => NULL)
21     ),
22   );
23 }
24
25 /**
26  * Return the version of Video.js installed.
27  *
28  * @param $path
29  *   The path to check for a Video.js installation. This can be a local path
30  *   like sites/all/libraries/video-js or a remote path like
31  *   http://mycdn.com/videojs. Do not add a trailing slash.
32  *   Defaults to videojs_directory when using the local file path location
33  *   or whatever location the Libraries API determines.
34  *
35  * @return
36  *   The version found or NULL if no version found.
37  */
38 function videojs_get_version($path = NULL) {
39   $version = NULL;
40   $config = \Drupal::config('videojs.settings');
41   
42   if (!isset($path)) {
43     $path = $config->get('videojs_directory');
44   };
45
46   // When admins specify a protocol-relative URL, add http because file_get_contents doesn't understand it.
47   if (strncmp('//', $path, 2) === 0) {
48     $path = 'http:' . $path;
49   }
50
51   // Don't use file_exists() because it doesn't work with URLs.
52   // Now admins can also refer to directories like http://mycdn.com/videojs.
53   $contents = @file_get_contents($path . '/video.js', FALSE, NULL, 0, 400);
54   if (!empty($contents)) {
55     $matches = array();
56     if (preg_match('/([\d.]{3,})/i', $contents, $matches)) {
57       $version = $matches[1];
58     }
59   }
60   return $version;
61 }