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 getDefaultArguments() {
58 return array('width' => 460,
62 'autoplay' => 'false',
67 function run($dbi, $argstr, &$request, $basepage) {
70 $args = $this->getArgs($argstr, $request);
73 if (! $url && ! $file) {
74 return $this->error(_("Both 'url' or 'file' parameters missing."));
75 } elseif ($url && $file) {
76 return $this->error(_("Choose only one of 'url' or 'file' parameters."));
78 $url = getUploadDataPath() . $file;
81 // TODO: Check HTML5 browser capabilities
82 if (string_ends_with($url, ".ogg")) {
83 return HTML::video(array('autoplay' => 'true', 'controls' => 'true', 'src' => $url),
84 _("Your browser does not understand the HTML 5 video tag."));
86 if (!$image) $image = $url;
87 if ($autoplay != 'true' and $autoplay != 'false')
88 return $this->error(fmt("Invalid argument %s", "autoplay"));
89 if (!is_numeric($width))
90 return $this->error(fmt("Invalid argument %s", "width"));
91 if (!is_numeric($height))
92 return $this->error(fmt("Invalid argument %s", "height"));
93 if (preg_match("/'/", $url))
94 return $this->error(fmt("Invalid argument %s", "url"));
96 $params = array("data" => SERVER_URL . $WikiTheme->_findData('flowplayer-3.1.4.swf'),
97 "type" => "application/x-shockwave-flash",
100 "allowfullscreen" => "true",
101 "allowscriptaccess" => "false",
103 "config={'clip':{'url':'" . $url . "','autoPlay':" . $autoplay . "}}'");
104 return ImgObject(HTML::img(array('src' => $image)), $params);
112 // c-hanging-comment-ender-p: nil
113 // indent-tabs-mode: nil