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