2015-07-15 12:01:06 +02:00
|
|
|
<?php
|
2015-11-07 16:30:56 +01:00
|
|
|
/**
|
|
|
|
* Plugin PlayVideos
|
|
|
|
*
|
|
|
|
* Add a button in the toolbar allowing to watch all videos.
|
|
|
|
* Note: this plugin adds jQuery.
|
|
|
|
*/
|
2015-07-15 12:01:06 +02:00
|
|
|
|
2018-12-04 00:26:50 +01:00
|
|
|
use Shaarli\Plugin\PluginManager;
|
2020-07-06 08:04:35 +02:00
|
|
|
use Shaarli\Render\TemplatePage;
|
2018-12-04 00:02:17 +01:00
|
|
|
|
2015-07-15 12:01:06 +02:00
|
|
|
/**
|
|
|
|
* When linklist is displayed, add play videos to header's toolbar.
|
|
|
|
*
|
|
|
|
* @param array $data - header data.
|
2015-11-07 16:30:56 +01:00
|
|
|
*
|
2015-07-15 12:01:06 +02:00
|
|
|
* @return mixed - header data with playvideos toolbar item.
|
|
|
|
*/
|
2015-11-07 16:30:56 +01:00
|
|
|
function hook_playvideos_render_header($data)
|
|
|
|
{
|
2020-07-06 08:04:35 +02:00
|
|
|
if ($data['_PAGE_'] == TemplatePage::LINKLIST) {
|
2016-12-01 11:38:21 +01:00
|
|
|
$playvideo = array(
|
|
|
|
'attr' => array(
|
|
|
|
'href' => '#',
|
2017-05-09 18:12:15 +02:00
|
|
|
'title' => t('Video player'),
|
2016-12-01 11:38:21 +01:00
|
|
|
'id' => 'playvideos',
|
|
|
|
),
|
2017-05-09 18:12:15 +02:00
|
|
|
'html' => '► '. t('Play Videos')
|
2016-12-01 11:38:21 +01:00
|
|
|
);
|
|
|
|
$data['buttons_toolbar'][] = $playvideo;
|
2015-07-15 12:01:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When linklist is displayed, include playvideos JS files.
|
|
|
|
*
|
|
|
|
* @param array $data - footer data.
|
2015-11-07 16:30:56 +01:00
|
|
|
*
|
2015-07-15 12:01:06 +02:00
|
|
|
* @return mixed - footer data with playvideos JS files added.
|
|
|
|
*/
|
2015-11-07 16:30:56 +01:00
|
|
|
function hook_playvideos_render_footer($data)
|
|
|
|
{
|
2020-07-06 08:04:35 +02:00
|
|
|
if ($data['_PAGE_'] == TemplatePage::LINKLIST) {
|
2015-07-15 12:01:06 +02:00
|
|
|
$data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/jquery-1.11.2.min.js';
|
|
|
|
$data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/youtube_playlist.js';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
2016-08-13 14:22:22 +02:00
|
|
|
}
|
2017-05-09 18:12:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is never called, but contains translation calls for GNU gettext extraction.
|
|
|
|
*/
|
|
|
|
function playvideos_dummy_translation()
|
|
|
|
{
|
|
|
|
// meta
|
|
|
|
t('Add a button in the toolbar allowing to watch all videos.');
|
|
|
|
}
|