]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | /** | |
3 | * Plugin PlayVideos | |
4 | * | |
5 | * Add a button in the toolbar allowing to watch all videos. | |
6 | * Note: this plugin adds jQuery. | |
7 | */ | |
8 | ||
9 | use Shaarli\Plugin\PluginManager; | |
10 | use Shaarli\Router; | |
11 | ||
12 | /** | |
13 | * When linklist is displayed, add play videos to header's toolbar. | |
14 | * | |
15 | * @param array $data - header data. | |
16 | * | |
17 | * @return mixed - header data with playvideos toolbar item. | |
18 | */ | |
19 | function hook_playvideos_render_header($data) | |
20 | { | |
21 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | |
22 | $playvideo = array( | |
23 | 'attr' => array( | |
24 | 'href' => '#', | |
25 | 'title' => t('Video player'), | |
26 | 'id' => 'playvideos', | |
27 | ), | |
28 | 'html' => '► '. t('Play Videos') | |
29 | ); | |
30 | $data['buttons_toolbar'][] = $playvideo; | |
31 | } | |
32 | ||
33 | return $data; | |
34 | } | |
35 | ||
36 | /** | |
37 | * When linklist is displayed, include playvideos JS files. | |
38 | * | |
39 | * @param array $data - footer data. | |
40 | * | |
41 | * @return mixed - footer data with playvideos JS files added. | |
42 | */ | |
43 | function hook_playvideos_render_footer($data) | |
44 | { | |
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; | |
51 | } | |
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 | } |