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