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