public function handleBody($entry, $e = null, $flavorAssetUrl = null) { $entryDescription = $this->stringToSafeXml($e->description); if (!$entryDescription) { $entryDescription = $this->stringToSafeXml($e->name); } $entryTags = $this->stringToSafeXml($e->tags); if (!$entryTags) { $entryTags = $this->stringToSafeXml(str_replace(' ', ', ', $e->name)); } $res = ''; $res .= $this->writeOpenXmlNode('item', 2); $res .= $this->writeFullXmlNode('pubDate', date('Y-m-d', $e->createdAt) . 'T' . date('H:i:sO', $e->createdAt), 3); $res .= $this->writeFullXmlNode('media:title', $this->stringToSafeXml($e->name), 3); $res .= $this->writeFullXmlNode('media:description', $entryDescription, 3); $res .= $this->writeFullXmlNode('media:keywords', $entryTags, 3); $categories = explode(',', $this->syndicationFeed->categories); foreach ($categories as $category) { $categoryId = KalturaTubeMogulSyndicationFeed::getCategoryId($category); $res .= $this->writeFullXmlNode('media:category', $categoryId, 3, array('scheme' => "http://www.tubemogul.com")); break; } $res .= $this->writeFullXmlNode('media:content', '', 3, array('url' => $flavorAssetUrl)); $res .= $this->writeClosingXmlNode('item', 1); return $res; }
private function renderTubeMogulFeed($state, $entry = null, $e = null, $moreItems = false) { switch ($state) { case self::STATE_HEADER: header("content-type: text/xml; charset=utf-8"); $this->writeOpenXmlNode('rss', 0, array('version' => "2.0", 'xmlns:media' => "http://search.yahoo.com/mrss/", 'xmlns:tm' => "http://www.tubemogul.com/mrss")); $this->writeOpenXmlNode('channel', 1); break; case self::STATE_BODY: $entryDescription = $this->stringToSafeXml($e->description); if (!$entryDescription) { $entryDescription = $this->stringToSafeXml($e->name); } $entryTags = $this->stringToSafeXml($e->tags); if (!$entryTags) { $entryTags = $this->stringToSafeXml(str_replace(' ', ', ', $e->name)); } $this->writeOpenXmlNode('item', 2); $this->writeFullXmlNode('pubDate', date('Y-m-d', $e->createdAt) . 'T' . date('H:i:sO', $e->createdAt), 3); $this->writeFullXmlNode('media:title', $this->stringToSafeXml($e->name), 3); $this->writeFullXmlNode('media:description', $entryDescription, 3); $this->writeFullXmlNode('media:keywords', $entryTags, 3); $categories = explode(',', $this->syndicationFeed->categories); foreach ($categories as $category) { $categoryId = KalturaTubeMogulSyndicationFeed::getCategoryId($category); $this->writeFullXmlNode('media:category', $categoryId, 3, array('scheme' => "http://www.tubemogul.com")); break; } $this->writeFullXmlNode('media:content', '', 3, array('url' => $this->getFlavorAssetUrl($e))); $this->writeClosingXmlNode('item', 1); break; case self::STATE_FOOTER: $this->writeClosingXmlNode('channel', 1); $this->writeClosingXmlNode('rss'); break; } }
private function renderTubeMogulFeed() { header("content-type: text/xml; charset=utf-8"); $this->writeOpenXmlNode('rss', 0, array('version' => "2.0", 'xmlns:media' => "http://search.yahoo.com/mrss/", 'xmlns:tm' => "http://www.tubemogul.com/mrss")); $this->writeOpenXmlNode('channel', 1); while ($entry = $this->getNextEntry()) { $e = new KalturaMediaEntry(); $e->fromObject($entry); // in case no video player is requested by user and the entry is mix, skip it if ($entry->getType() === entryType::MIX && !$this->syndicationFeed->allowEmbed || $entry->getType() !== entryType::MIX && $this->getFlavorAssetUrl($e) == null) { continue; } $entryDescription = $this->stringToSafeXml($e->description); if (!$entryDescription) { $entryDescription = $this->stringToSafeXml($e->name); } $entryTags = $this->stringToSafeXml($e->tags); if (!$entryTags) { $entryTags = $this->stringToSafeXml(str_replace(' ', ', ', $e->name)); } $this->writeOpenXmlNode('item', 2); $this->writeFullXmlNode('pubDate', date('Y-m-d', $e->createdAt) . 'T' . date('H:i:sO', $e->createdAt), 3); $this->writeFullXmlNode('media:title', $this->stringToSafeXml($e->name), 3); $this->writeFullXmlNode('media:description', $entryDescription, 3); $this->writeFullXmlNode('media:keywords', $entryTags, 3); $categories = explode(',', $this->syndicationFeed->categories); foreach ($categories as $category) { $categoryId = KalturaTubeMogulSyndicationFeed::getCategoryId($category); $this->writeFullXmlNode('media:category', $categoryId, 3, array('scheme' => "http://www.tubemogul.com")); break; } $this->writeFullXmlNode('media:content', '', 3, array('url' => $this->getFlavorAssetUrl($e))); $this->writeClosingXmlNode('item', 1); } $this->writeClosingXmlNode('channel', 1); $this->writeClosingXmlNode('rss'); }