-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideo.php
38 lines (34 loc) · 1.06 KB
/
video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
// Video plugin, https://github.com/nibreh/yellow-plugin-video
// Copyright (c) 2013-2015 Datenstrom, https://datenstrom.se
// This file may be used and distributed under the terms of the public license.
class YellowVideo
{
const VERSION = "0.6.7";
var $yellow; //access to API
// Handle initialisation
function onLoad($yellow)
{
$this->yellow = $yellow;
}
// Handle page content parsing of custom block
function onParseContentBlock($page, $name, $text, $shortcut)
{
$output = NULL;
if($name=="video" && $shortcut)
{
list($videourl, $poster) = $this->yellow->toolbox->getTextArgs($text);
if(empty($poster)) {
$output = "<video controls style=\"width:100%; height:auto;\" src=\"".htmlspecialchars($videourl)."\">";
$output .="</video>\r\n";
}
else {
$output = "<video controls style=\"width:100%; height:auto;\" poster=\"".htmlspecialchars($poster)."\" src=\"".htmlspecialchars($videourl)."\">";
$output .="</video>\r\n";
}
}
return $output;
}
}
$yellow->plugins->register("video", "YellowVideo", YellowVideo::VERSION);
?>