]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - plugins/playvideos/playvideos.php
91a9c1e554c58437c5862adfd605019865096be7
[github/shaarli/Shaarli.git] / plugins / playvideos / playvideos.php
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\Render\TemplatePage;
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_'] == TemplatePage::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_'] == TemplatePage::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 }