4 * Copyright 2009 Roger Guignard and Marc-Etienne Vargenau, Alcatel-Lucent
5 * Copyright 2009 Reini Urban
7 * This file is part of PhpWiki.
9 * PhpWiki is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * PhpWiki is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with PhpWiki; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Standard Alcatel-Lucent disclaimer for contributing to open source
27 * "The VideoPlugin ("Contribution") has not been tested and/or
28 * validated for release as or in products, combinations with products or
29 * other commercial use. Any use of the Contribution is entirely made at
30 * the user's own responsibility and the user can not rely on any features,
31 * functionalities or performances Alcatel-Lucent has attributed to the
34 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
35 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
36 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
37 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
38 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
40 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
41 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
42 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
46 class WikiPlugin_Video
53 function getDescription() {
54 return _("Display video in Flash");
57 function getVersion() {
58 return preg_replace("/[Revision: $]/", '',
62 function getDefaultArguments() {
63 return array('width' => 460,
72 function run($dbi, $argstr, &$request, $basepage) {
75 $args = $this->getArgs($argstr, $request);
78 if (! $url && ! $file) {
79 return $this->error(_("Both 'url' or 'file' parameters missing."));
80 } elseif ($url && $file) {
81 return $this->error(_("Choose only one of 'url' or 'file' parameters."));
83 $url = getUploadDataPath() . $file;
86 // TODO: Check HTML5 browser capabilities
87 if (string_ends_with($url, ".ogg")) {
88 return HTML::video(array('autoplay' => 'true', 'controls' => 'true', 'src' => $url),
89 _("Your browser does not understand the HTML 5 video tag."));
91 if (!$image) $image = $url;
92 if ($autoplay != 'true' and $autoplay != 'false')
93 return $this->error(fmt("Invalid argument %s", "autoplay"));
94 if (!is_numeric($width))
95 return $this->error(fmt("Invalid argument %s", "width"));
96 if (!is_numeric($height))
97 return $this->error(fmt("Invalid argument %s", "height"));
98 if (preg_match("/'/", $url))
99 return $this->error(fmt("Invalid argument %s", "url"));
101 $params = array("data" => SERVER_URL . $WikiTheme->_findData('flowplayer-3.1.3.swf'),
102 "type" => "application/x-shockwave-flash",
105 "allowfullscreen" => "true",
106 "allowscriptaccess" => "false",
108 "config={'clip':{'url':'" . $url . "','autoPlay':" . $autoplay . "}}'");
109 return ImgObject(HTML::img(array('src' => $image)), $params);
117 // c-hanging-comment-ender-p: nil
118 // indent-tabs-mode: nil