private function videoEntry(Title $title) { $entries = array(); $articleVideos = $this->mMediaService->getMediaFromArticle($title, MediaQueryService::MEDIA_TYPE_VIDEO); foreach ($articleVideos as $videoTitleData) { $metaData = $videoTitleData['meta']; if ($metaData['canEmbed'] === 0) { continue; } $description = !empty($videoTitleData['desc']) ? $videoTitleData['desc'] : (!empty($metaData['description']) ? $metaData['description'] : $videoTitleData['title']); $entry = "\t\t<video:video>\n" . "\t\t\t<video:title><![CDATA[{$videoTitleData['title']}]]></video:title>\n" . "\t\t\t<video:description><![CDATA[{$description}]]></video:description>\n" . (!empty($videoTitleData['thumbUrl']) ? "\t\t\t<video:thumbnail_loc>{$videoTitleData['thumbUrl']}</video:thumbnail_loc>\n" : "") . ($metaData['srcType'] == 'player' ? "\t\t\t<video:player_loc allow_embed=\"yes\" " . (!empty($metaData['autoplayParam']) ? "autoplay=\"{$metaData['autoplayParam']}\"" : "") . ">" . htmlentities($metaData['srcParam']) . "</video:player_loc>\n" : "\t\t\t<video:content_loc>" . htmlentities($metaData['srcParam']) . "</video:content_loc>\n") . (!empty($metaData['duration']) ? "\t\t\t<video:duration>{$metaData['duration']}</video:duration>\n" : "") . "\t\t\t<video:family_friendly>yes</video:family_friendly>\n" . "\t\t</video:video>\n"; $entries[] = $entry; } return implode("\t\n", $entries); }
/** * Get thumbs of images from given page */ public static function getImagesFromPageThumbs($title, $limit = 50) { wfProfileIn(__METHOD__); $ret = array(); // get list of images linked with given article /** * @var $mediaQuery MediaQueryService */ $mediaQuery = new MediaQueryService(); $images = $mediaQuery->getMediaFromArticle($title, MediaQueryService::MEDIA_TYPE_IMAGE, $limit); foreach ($images as $entry) { $image = Title::newFromText($entry['title'], NS_FILE); $thumb = self::getResultsThumbnailUrl($image); if ($thumb) { $ret[] = array('name' => $image->getText(), 'thumb' => $thumb); } } wfProfileOut(__METHOD__); return $ret; }