static function doSeqReplace(&$input, &$argv, &$parser) { global $wgTitle, $wgUser, $wgRequest, $markerList; $sk = $wgUser->getSkin(); $options = array(); $oldid = $wgRequest->getVal('oldid'); if ($oldid != '') { $options['oldid'] = $oldid; } $seqPlayer = new MV_SequencePlayer($wgTitle); $vidtag = '<div id="file" class="fullImageLink">'; $vidtag .= $seqPlayer->getEmbedSeqHtml($options); $vidtag .= '</div><hr>'; $marker = "xx-marker" . count($markerList) . "-xx"; $markerList[] = $vidtag; return $marker; }
/** * enables the rewriting of links to the Stream and Sequence namespace to support inline embeding. * see page: sample in-wiki-embed syntax * @@todo should probably be integrated to respective Stream and Sequence class. * and maybe integrated with File / image handle */ function mvLinkEnd($skin, $title, $options, &$text, &$attribs, &$ret) { global $mvDefaultAspectRatio, $mvDefaultVideoPlaybackRes, $mvEmbedKey; //only do link rewrites for $mvEmbedKey if (substr($title->getText(), 0, strlen($mvEmbedKey)) != $mvEmbedKey) { return true; } //parse text for extra parameters //@@todo integrate with image params / maybe file handle ) $params = explode('|', $text); //setup defaults: $size = $mvDefaultVideoPlaybackRes; $start_ntp = $end_ntp = null; foreach ($params as $param) { if (substr($param, -2) == 'px') { //size param if (strpos($param, 'x') === false) { $k = intval(str_replace($param, 'px', '')); //@@todo should use the actual clips aspect ratio $size = intval($v) . 'x' . (int) ($mvDefaultAspectRatio * $v); } else { list($width, $height) = explode('x', str_replace('px', '', $param)); $size = intval($width) . 'x' . intval($height); } } else { //only applicable to Stream: if ($title->getNamespace() == MV_NS_STREAM) { if (substr($param, 0, 6) == 'start=') { $start_str = substr($param, 6); $timeSec = npt2seconds($start_str); if ((int) $timeSec > 0) { $start_ntp = seconds2npt($timeSec); } } elseif (substr($param, 0, 4) == 'end=') { $end_str = substr($param, 6); $timeSec = npt2seconds($start_str); if ((int) $timeSec > 0) { $end_ntp = seconds2npt($timeSec); } } else { //caption text / desc } } } } if (substr($title->getText(), 0, strlen($mvEmbedKey)) == $mvEmbedKey) { $resourceTitle = Title::newFromText(substr($title->getText(), strlen($mvEmbedKey) + 1)); if ($resourceTitle->getNamespace() == MV_NS_STREAM) { $mvTitle = new MV_Title($resourceTitle); $ret = $mvTitle->getEmbedVideoHtml(array('size' => $size, 'showmeta' => true)); } if ($resourceTitle->getNamespace() == MV_NS_SEQUENCE) { $seqPlayer = new MV_SequencePlayer($resourceTitle); $ret = $seqPlayer->getEmbedSeqHtml(array('size' => $size)); } return false; } return true; }