2016-03-28 20:32:42 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* kirbytag html5youtube
|
|
|
|
* responsive html5 youtube player embedding
|
|
|
|
*
|
|
|
|
* copyright: Jannik Beyerstedt | http://jannikbeyerstedt.de | code@jannikbeyerstedt.de
|
|
|
|
* license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
|
|
|
|
*
|
2016-12-12 23:00:38 +00:00
|
|
|
* version 2.0.2 (12.12.2016)
|
2016-03-28 20:32:42 +00:00
|
|
|
* changelog:
|
|
|
|
* - v2.0: kirby 2 support
|
|
|
|
* - v2.0.1: fix some html validation issues with & symbols
|
2016-12-12 23:00:38 +00:00
|
|
|
* - v2.0.2: html5 player is now default, so no url param needed any more
|
2016-03-28 20:32:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
kirbytext::$tags['html5youtube'] = array(
|
|
|
|
'attr' => array(
|
|
|
|
'options'
|
|
|
|
),
|
|
|
|
'html' => function($tag) {
|
|
|
|
$base = 'https://www.youtube-nocookie.com/embed/';
|
2016-12-12 23:00:38 +00:00
|
|
|
$end = '?rel=0';
|
2016-03-28 20:32:42 +00:00
|
|
|
|
|
|
|
$videoID = $tag->attr('html5youtube');
|
|
|
|
$options = $tag->attr('options');
|
|
|
|
|
|
|
|
return '<div class="video-container"><iframe src="' . $base . $videoID . $end . $options . '" allowfullscreen></iframe></div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|