/**
  * Embeds video of the chosen service
  * @param Parser $parser Instance of running Parser.
  * @param String $service Which online service has the video.
  * @param String $id Identifier of the chosen service
  * @param String $width Width of video (optional)
  * @param String $desc description to show (optional, unused)
  * @param String $align alignment of the video (optional, unused)
  * @return String Encoded representation of input params (to be processed later)
  */
 public static function parserFunction_ev($parser, $service = null, $id = null, $width = null, $align = null, $desc = null)
 {
     global $wgScriptPath;
     # Initialize things once
     if (!EmbedVideo::$initialized) {
         EmbedVideo::VerifyWidthMinAndMax();
         # Add system messages
         wfLoadExtensionMessages('embedvideo');
         $parser->disableCache();
         EmbedVideo::$initialized = true;
     }
     # Get the name of the host
     if ($service === null || $id === null) {
         return EmbedVideo::errMissingParams($service, $id);
     }
     $service = trim($service);
     $id = trim($id);
     $desc = $parser->recursiveTagParse($desc);
     $entry = EmbedVideo::getServiceEntry($service);
     if (!$entry) {
         return EmbedVideo::errBadService($service);
     }
     if (!EmbedVideo::sanitizeWidth($entry, $width)) {
         return EmbedVideo::errBadWidth($width);
     }
     $height = EmbedVideo::getHeight($entry, $width);
     $hasalign = $align !== null;
     if ($hasalign) {
         $desc = EmbedVideo::getDescriptionMarkup($desc);
     }
     # If the service has an ID pattern specified, verify the id number
     if (!EmbedVideo::verifyID($entry, $id)) {
         return EmbedVideo::errBadID($service, $id);
     }
     # if the service has it's own custom extern declaration, use that instead
     if (array_key_exists('extern', $entry) && ($clause = $entry['extern']) != null) {
         $clause = wfMsgReplaceArgs($clause, array($wgScriptPath, $id, $width, $height));
         if ($hasalign) {
             $clause = EmbedVideo::generateAlignExternClause($clause, $align, $desc, $width, $height);
         }
         return array($clause, 'noparse' => true, 'isHTML' => true);
     }
     # Build URL and output embedded flash object
     $url = wfMsgReplaceArgs($entry['url'], array($id, $width, $height));
     $clause = "";
     if ($hasalign) {
         $clause = EmbedVideo::generateAlignClause($url, $width, $height, $align, $desc);
     } else {
         $clause = EmbedVideo::generateNormalClause($url, $width, $height);
     }
     return array($clause, 'noparse' => true, 'isHTML' => true);
 }