From: <var...@us...> - 2015-03-25 11:32:03
|
Revision: 9629 http://sourceforge.net/p/phpwiki/code/9629 Author: vargenau Date: 2015-03-25 11:32:00 +0000 (Wed, 25 Mar 2015) Log Message: ----------- Improve Video plugin Modified Paths: -------------- trunk/lib/BlockParser.php trunk/lib/InlineParser.php trunk/lib/plugin/Video.php trunk/lib/stdlib.php trunk/pgsrc/Help%2FVideoPlugin Modified: trunk/lib/BlockParser.php =================================================================== --- trunk/lib/BlockParser.php 2015-03-18 14:19:38 UTC (rev 9628) +++ trunk/lib/BlockParser.php 2015-03-25 11:32:00 UTC (rev 9629) @@ -1193,7 +1193,12 @@ // It's a video if (is_video($imagename)) { - $pi = '<' . '?plugin Video file="' . $pi . '" ?>'; + if ((strpos($imagename, 'http://') === 0) + || (strpos($imagename, 'https://') === 0)) { + $pi = '<' . '?plugin Video url="' . $pi . '" ?>'; + } else { + $pi = '<' . '?plugin Video file="' . $pi . '" ?>'; + } $this->_element = new Cached_PluginInvocation($pi); return true; } Modified: trunk/lib/InlineParser.php =================================================================== --- trunk/lib/InlineParser.php 2015-03-18 14:19:38 UTC (rev 9628) +++ trunk/lib/InlineParser.php 2015-03-25 11:32:00 UTC (rev 9629) @@ -1106,7 +1106,12 @@ // It's a video if (is_video($imagename)) { - $s = '<' . '?plugin Video file="' . $imagename . '" ?' . '>'; + if ((strpos($imagename, 'http://') === 0) + || (strpos($imagename, 'https://') === 0)) { + $s = '<' . '?plugin Video url="' . $imagename . '" ?' . '>'; + } else { + $s = '<' . '?plugin Video file="' . $imagename . '" ?' . '>'; + } return new Cached_PluginInvocation($s); } Modified: trunk/lib/plugin/Video.php =================================================================== --- trunk/lib/plugin/Video.php 2015-03-18 14:19:38 UTC (rev 9628) +++ trunk/lib/plugin/Video.php 2015-03-25 11:32:00 UTC (rev 9629) @@ -72,7 +72,11 @@ global $WikiTheme; $args = $this->getArgs($argstr, $request); - extract($args); + $url = $args['url']; + $file = $args['file']; + $width = $args['width']; + $height = $args['height']; + $autoplay = $args['autoplay']; if (!$url && !$file) { return $this->error(_("Both 'url' or 'file' parameters missing.")); @@ -83,9 +87,18 @@ $url = getUploadDataPath() . '/' . $file; } - if (string_ends_with($url, ".ogg")) { - return HTML::video(array('autoplay' => 'true', 'controls' => 'true', 'src' => $url), + if (string_ends_with($url, ".ogg") + || string_ends_with($url, ".mp4") + || string_ends_with($url, ".webm")) { + $video = HTML::video(array('controls' => 'controls', + 'width' => $width, + 'height' => $height, + 'src' => $url), _("Your browser does not understand the HTML 5 video tag.")); + if ($autoplay == 'true') { + $video->setAttr('autoplay', 'autoplay'); + } + return $video; } $html = HTML(); Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2015-03-18 14:19:38 UTC (rev 9628) +++ trunk/lib/stdlib.php 2015-03-25 11:32:00 UTC (rev 9629) @@ -2089,13 +2089,15 @@ /** * Returns true if the filename ends with an video suffix. - * Currently only FLV and OGG + * Currently FLV, OGG, MP4 and WebM. */ function is_video($filename) { return string_ends_with(strtolower($filename), ".flv") - or string_ends_with(strtolower($filename), ".ogg"); + or string_ends_with(strtolower($filename), ".ogg") + or string_ends_with(strtolower($filename), ".mp4") + or string_ends_with(strtolower($filename), ".webm"); } /** Modified: trunk/pgsrc/Help%2FVideoPlugin =================================================================== --- trunk/pgsrc/Help%2FVideoPlugin 2015-03-18 14:19:38 UTC (rev 9628) +++ trunk/pgsrc/Help%2FVideoPlugin 2015-03-25 11:32:00 UTC (rev 9629) @@ -1,4 +1,4 @@ -Date: Wed, 18 Mar 2015 15:14:44 +0000 +Date: Wed, 25 Mar 2015 12:24:09 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.5.3) Content-Type: application/x-phpwiki; pagename=Help%2FVideoPlugin; @@ -8,9 +8,9 @@ The **~Video** [[Help:WikiPlugin|plugin]] allows to include video in a wiki page. Video file must be encoded in FLV format ([[WikiPedia:Flash Video|Flash Video]]) or in an HTML 5 format: -* [[WikiPedia:Ogg|Ogg]], -* [[WikiPedia:MP4|MP4]], -* [[WikiPedia:WebM|WebM]]. +* [[WikiPedia:Ogg|Ogg]] (##.ogg## suffix), +* [[WikiPedia:MP4|MP4]] (##.mp4## suffix), +* [[WikiPedia:WebM|WebM]] (##.webm## suffix). The Video plugin can also be called with the ~{~{video.flv~}~} syntax. @@ -41,11 +41,11 @@ | 320 |- | **autoplay** -| Auto play the video when page is displayed. +| Auto play the video when page is displayed (boolean). | false |} -== Example == +== Examples == A video: {{{ @@ -62,6 +62,13 @@ {{another_video.flv}} }}} +=== Big Buck Bunny === + +{{{ +{{http://video.webmfiles.org/big-buck-bunny_trailer.webm}} +}}} +{{http://video.webmfiles.org/big-buck-bunny_trailer.webm}} + == Authors == * Roger Guignard, Alcatel-Lucent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |