This extension allows this by the following tag: */ // WrVideo // ------- class WrVideo { /// Renders the tag. /// @param $content string - the content of the tag /// @param $args array - the array of attribute name/value pairs for the tag /// @param $parser Parser - the MW Parser object for the current page /// /// @return string - the html for rendering the map public static function render($content, $args, $parser, $frame) { $parserOutput = $parser->getOutput(); $parserOutput->addModules(['ext.wrvideo']); try { // default properties $properties = array('width' => 500, 'height' => 281); // video properties if (isset($args['id'])) $properties['id'] = (int) $args['id']; // video ID if (isset($args['width'])) $properties['width'] = (int) $args['width']; // width as int value if (isset($args['height'])) $properties['height'] = (int) $args['height']; // height as int value // verify properties if (!isset($properties['id'])) throw new Exception(wfMessage('wrvideo-error-no-id')->text()); // build iframe $doc = new DOMDocument(); $child = $doc->appendChild($doc->createElement('iframe')); $child->setAttribute('src', '//player.vimeo.com/video/' . $properties['id'] . '?byline=0&portrait=0&color=014e9a'); $child->setAttribute('width', $properties['width']); $child->setAttribute('height', $properties['height']); $child->setAttribute('frameborder', 0); $child->setAttribute('webkitallowfullscreen', ''); $child->setAttribute('mozallowfullscreen', ''); $child->setAttribute('allowfullscreen', ''); } catch (Exception $e) { $doc = new DOMDocument(); $child = $doc->appendChild($doc->createElement('div')); $child->setAttribute('class', 'error'); $child->appendChild($doc->createTextNode(wfMessage('wrvideo-error-msg')->text() . $e->getMessage())); } return array($doc->saveHTML($doc->firstChild), 'markerType' => 'nowiki'); } public static function ParserFirstCallInitHook(Parser &$parser) { $parser->setHook('wrvideo', 'WrVideo::render'); return true; } } ?>