]>
Commit | Line | Data |
---|---|---|
b17c19ff | 1 | <?php |
840caea6 A |
2 | /** |
3 | * Plugin PlayVideos | |
4 | * | |
5 | * Add a button in the toolbar allowing to watch all videos. | |
6 | * Note: this plugin adds jQuery. | |
7 | */ | |
b17c19ff | 8 | |
e1850388 | 9 | use Shaarli\Plugin\PluginManager; |
a932f486 V |
10 | use Shaarli\Router; |
11 | ||
b17c19ff A |
12 | /** |
13 | * When linklist is displayed, add play videos to header's toolbar. | |
14 | * | |
15 | * @param array $data - header data. | |
840caea6 | 16 | * |
b17c19ff A |
17 | * @return mixed - header data with playvideos toolbar item. |
18 | */ | |
840caea6 A |
19 | function hook_playvideos_render_header($data) |
20 | { | |
b17c19ff | 21 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { |
ba0fd807 A |
22 | $playvideo = array( |
23 | 'attr' => array( | |
24 | 'href' => '#', | |
12266213 | 25 | 'title' => t('Video player'), |
ba0fd807 A |
26 | 'id' => 'playvideos', |
27 | ), | |
12266213 | 28 | 'html' => '► '. t('Play Videos') |
ba0fd807 A |
29 | ); |
30 | $data['buttons_toolbar'][] = $playvideo; | |
b17c19ff A |
31 | } |
32 | ||
33 | return $data; | |
34 | } | |
35 | ||
36 | /** | |
37 | * When linklist is displayed, include playvideos JS files. | |
38 | * | |
39 | * @param array $data - footer data. | |
840caea6 | 40 | * |
b17c19ff A |
41 | * @return mixed - footer data with playvideos JS files added. |
42 | */ | |
840caea6 A |
43 | function hook_playvideos_render_footer($data) |
44 | { | |
b17c19ff A |
45 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { |
46 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/jquery-1.11.2.min.js'; | |
47 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/youtube_playlist.js'; | |
48 | } | |
49 | ||
50 | return $data; | |
db6dec0d | 51 | } |
12266213 A |
52 | |
53 | /** | |
54 | * This function is never called, but contains translation calls for GNU gettext extraction. | |
55 | */ | |
56 | function playvideos_dummy_translation() | |
57 | { | |
58 | // meta | |
59 | t('Add a button in the toolbar allowing to watch all videos.'); | |
60 | } |