4 * Copyright 2009 Roger Guignard and Marc-Etienne Vargenau, Alcatel-Lucent
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Standard Alcatel-Lucent disclaimer for contributing to open source
26 * "The VideoPlugin ("Contribution") has not been tested and/or
27 * validated for release as or in products, combinations with products or
28 * other commercial use. Any use of the Contribution is entirely made at
29 * the user's own responsibility and the user can not rely on any features,
30 * functionalities or performances Alcatel-Lucent has attributed to the
33 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
34 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
36 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
37 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
39 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
40 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
41 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
45 class WikiPlugin_Video
48 function getDescription()
50 return _("Display video in Flash or HTML5.");
53 function getDefaultArguments()
55 return array('width' => 460,
65 * @param string $argstr
66 * @param WikiRequest $request
67 * @param string $basepage
70 function run($dbi, $argstr, &$request, $basepage)
74 $args = $this->getArgs($argstr, $request);
77 if (!$url && !$file) {
78 return $this->error(_("Both 'url' or 'file' parameters missing."));
79 } elseif ($url && $file) {
80 return $this->error(_("Choose only one of 'url' or 'file' parameters."));
82 // $url = SERVER_URL . getUploadDataPath() . '/' . $file;
83 $url = getUploadDataPath() . '/' . $file;
86 if (string_ends_with($url, ".ogg")) {
87 return HTML::video(array('autoplay' => 'true', 'controls' => 'true', 'src' => $url),
88 _("Your browser does not understand the HTML 5 video tag."));
94 $object = HTML::object(array('id' => 'flowplayer',
95 'classid' => 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
97 'height' => $height));
99 $param = HTML::param(array('name' => 'movie',
100 'value' => SERVER_URL . $WikiTheme->_findData('flowplayer-3.2.4.swf')));
101 $object->pushContent($param);
103 $param = HTML::param(array('name' => "allowfullscreen",
105 $object->pushContent($param);
107 $param = HTML::param(array('name' => "allowscriptaccess",
108 'value' => "false"));
109 $object->pushContent($param);
111 $flashvars = "config={'clip':{'url':'" . $url . "','autoPlay':" . $autoplay . "}}";
113 $param = HTML::param(array('name' => 'flashvars',
114 'value' => $flashvars));
115 $object->pushContent($param);
117 $embed = HTML::embed(array('type' => 'application/x-shockwave-flash',
120 'src' => SERVER_URL . $WikiTheme->_findData('flowplayer-3.2.4.swf'),
121 'flashvars' => $flashvars));
122 $object->pushContent($embed);
124 $html->pushContent($object);
127 $object = HTML::object(array('data' => SERVER_URL . $WikiTheme->_findData('flowplayer-3.2.4.swf'),
128 'type' => "application/x-shockwave-flash",
130 'height' => $height));
132 $param = HTML::param(array('name' => "allowfullscreen",
134 $object->pushContent($param);
136 $param = HTML::param(array('name' => "allowscriptaccess",
137 'value' => "false"));
138 $object->pushContent($param);
140 $value = "config={'clip':{'url':'" . $url . "','autoPlay':" . $autoplay . "}}";
141 $param = HTML::param(array('name' => "flashvars",
143 $object->pushContent($param);
145 $html->pushContent($object);
155 // c-hanging-comment-ender-p: nil
156 // indent-tabs-mode: nil