]>
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 | |
a932f486 V |
9 | use Shaarli\Router; |
10 | ||
b17c19ff A |
11 | /** |
12 | * When linklist is displayed, add play videos to header's toolbar. | |
13 | * | |
14 | * @param array $data - header data. | |
840caea6 | 15 | * |
b17c19ff A |
16 | * @return mixed - header data with playvideos toolbar item. |
17 | */ | |
840caea6 A |
18 | function hook_playvideos_render_header($data) |
19 | { | |
b17c19ff | 20 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { |
ba0fd807 A |
21 | $playvideo = array( |
22 | 'attr' => array( | |
23 | 'href' => '#', | |
12266213 | 24 | 'title' => t('Video player'), |
ba0fd807 A |
25 | 'id' => 'playvideos', |
26 | ), | |
12266213 | 27 | 'html' => '► '. t('Play Videos') |
ba0fd807 A |
28 | ); |
29 | $data['buttons_toolbar'][] = $playvideo; | |
b17c19ff A |
30 | } |
31 | ||
32 | return $data; | |
33 | } | |
34 | ||
35 | /** | |
36 | * When linklist is displayed, include playvideos JS files. | |
37 | * | |
38 | * @param array $data - footer data. | |
840caea6 | 39 | * |
b17c19ff A |
40 | * @return mixed - footer data with playvideos JS files added. |
41 | */ | |
840caea6 A |
42 | function hook_playvideos_render_footer($data) |
43 | { | |
b17c19ff A |
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; | |
db6dec0d | 50 | } |
12266213 A |
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 | } |