/**
  * Get data-params attribute (for video on mobile)
  * @param File $file
  * @param string $imgSrc
  * @param array $options
  * @return string
  */
 public static function getDataParams($file, $imgSrc, $options)
 {
     if (is_callable([$file, 'getProviderName'])) {
         $provider = $file->getProviderName();
     } else {
         $provider = '';
     }
     $dataParams = ['type' => 'video', 'name' => htmlspecialchars($file->getTitle()->getDBKey()), 'full' => $imgSrc, 'provider' => $provider];
     if (!empty($options['caption'])) {
         $dataParams['capt'] = 1;
     }
     return htmlentities(json_encode([$dataParams]), ENT_QUOTES);
 }
 public static function onThumbnailVideoHTML($options, $linkAttribs, $imageAttribs, File $file, &$html)
 {
     global $wgRTEParserEnabled;
     if (!empty($wgRTEParserEnabled)) {
         return true;
     }
     if (is_null(self::$isWikiaMobile)) {
         self::init();
     }
     if (self::$isWikiaMobile) {
         wfProfileIn(__METHOD__);
         /**
          * WikiaMobile: lazy loading images in a SEO-friendly manner
          * @author Federico "Lox" Lucignano <federico@wikia-inc.com
          * @author Artur Klajnerok <*****@*****.**>
          */
         $origImg = Xml::element('img', $imageAttribs, '', true);
         if (empty($imageAttribs['alt'])) {
             unset($imageAttribs['alt']);
         }
         //Not all 'files' have getProviderName defined
         if (is_callable([$file, 'getProviderName'])) {
             $provider = $file->getProviderName();
         } else {
             $provider = '';
         }
         $imageParams = array('type' => 'video', 'provider' => $provider, 'full' => $imageAttribs['src']);
         if (!empty($imageAttribs['data-video-key'])) {
             $imageParams['name'] = htmlspecialchars($imageAttribs['data-video-key']);
         }
         if (!empty($options['caption'])) {
             $imageParams['capt'] = 1;
         }
         // TODO: this resizes every video thumbnail with a width over 64px regardless of where it appears.
         // We may want to add the ability to allow custom image widths (like on the file page history table for example)
         $size = WikiaMobileMediaService::calculateMediaSize($file->getWidth(), $file->getHeight());
         $thumb = $file->transform($size);
         $imageAttribs['src'] = wfReplaceImageServer($thumb->getUrl(), $file->getTimestamp());
         $imageAttribs['width'] = $size['width'];
         $imageAttribs['height'] = $size['height'];
         $data = ['attributes' => $imageAttribs, 'parameters' => [$imageParams], 'anchorAttributes' => $linkAttribs, 'noscript' => $origImg, 'isSmall' => WikiaMobileMediaService::isSmallImage($imageAttribs['width'], $imageAttribs['height'])];
         $title = $file->getTitle()->getDBKey();
         $titleText = $file->getTitle()->getText();
         $views = MediaQueryService::getTotalVideoViewsByTitle($title);
         $data['content'] = Xml::element('span', ['class' => 'videoInfo'], "{$titleText} (" . $file->getHandler()->getFormattedDuration() . ", " . wfMessage('wikiamobile-video-views-counter', $views)->inContentLanguage()->text() . ')');
         $html = F::app()->sendRequest('WikiaMobileMediaService', 'renderImageTag', $data, true)->toString();
         wfProfileOut(__METHOD__);
     }
     return true;
 }