public static function syndicate(CuePoint $cuePoint, SimpleXMLElement $scenes, SimpleXMLElement $scene = null) { if (!$cuePoint instanceof Annotation) { return $scene; } if (!$scene) { $scene = kCuePointManager::syndicateCuePointXml($cuePoint, $scenes->addChild('scene-annotation')); } $scene->addChild('sceneEndTime', kXml::integerToTime($cuePoint->getEndTime())); if ($cuePoint->getText()) { $scene->addChild('sceneText', kMrssManager::stringToSafeXml($cuePoint->getText())); } if ($cuePoint->getParentId()) { $parentCuePoint = CuePointPeer::retrieveByPK($cuePoint->getParentId()); if ($parentCuePoint) { if ($parentCuePoint->getSystemName()) { $scene->addChild('parent', kMrssManager::stringToSafeXml($parentCuePoint->getSystemName())); } $scene->addChild('parentId', $parentCuePoint->getId()); } } return $scene; }
public static function syndicate(CuePoint $cuePoint, SimpleXMLElement $scenes, SimpleXMLElement $scene = null) { if (!$cuePoint instanceof AdCuePoint) { return $scene; } if (!$scene) { $scene = kCuePointManager::syndicateCuePointXml($cuePoint, $scenes->addChild('scene-ad-cue-point')); } if ($cuePoint->getEndTime()) { $scene->addChild('sceneEndTime', kXml::integerToTime($cuePoint->getEndTime())); } if ($cuePoint->getName()) { $scene->addChild('sceneTitle', kMrssManager::stringToSafeXml($cuePoint->getName())); } if ($cuePoint->getSourceUrl()) { $scene->addChild('sourceUrl', htmlspecialchars($cuePoint->getSourceUrl())); } $scene->addChild('adType', $cuePoint->getAdType()); $scene->addChild('protocolType', $cuePoint->getSubType()); return $scene; }
/** * @param CuePoint $cuePoint * @param SimpleXMLElement $scene * @return SimpleXMLElement the created scene */ public static function syndicateCuePointXml(CuePoint $cuePoint, SimpleXMLElement $scene) { $scene->addAttribute('sceneId', $cuePoint->getId()); if ($cuePoint->getSystemName()) { $scene->addAttribute('systemName', kMrssManager::stringToSafeXml($cuePoint->getSystemName())); } $scene->addChild('sceneStartTime', kXml::integerToTime($cuePoint->getStartTime())); $scene->addChild('createdAt', $cuePoint->getCreatedAt(kMrssManager::FORMAT_DATETIME)); $scene->addChild('updatedAt', $cuePoint->getCreatedAt(kMrssManager::FORMAT_DATETIME)); if ($cuePoint->getPuserId()) { $scene->addChild('userId', kMrssManager::stringToSafeXml($cuePoint->getPuserId())); } if (trim($cuePoint->getTags(), " \r\n\t")) { $tags = $scene->addChild('tags'); foreach (explode(',', $cuePoint->getTags()) as $tag) { $tags->addChild('tag', kMrssManager::stringToSafeXml($tag)); } } return $scene; }
public static function syndicate(CuePoint $cuePoint, SimpleXMLElement $scenes, SimpleXMLElement $scene = null) { if (!$cuePoint instanceof CodeCuePoint) { return $scene; } if (!$scene) { $scene = kCuePointManager::syndicateCuePointXml($cuePoint, $scenes->addChild('scene-code-cue-point')); } if ($cuePoint->getEndTime()) { $scene->addChild('sceneEndTime', kXml::integerToTime($cuePoint->getEndTime())); } $scene->addChild('code', kMrssManager::stringToSafeXml($cuePoint->getName())); if ($cuePoint->getText()) { $scene->addChild('description', kMrssManager::stringToSafeXml($cuePoint->getText())); } return $scene; }
/** * @param AttachmentAsset $attachmentAsset * @param SimpleXMLElement $mrss * @return SimpleXMLElement */ public function contributeAttachmentAssets(AttachmentAsset $attachmentAsset, SimpleXMLElement $mrss) { $attachment = $mrss->addChild('attachment'); $attachment->addAttribute('url', $attachmentAsset->getDownloadUrl(true)); $attachment->addAttribute('attachmentAssetId', $attachmentAsset->getId()); $attachment->addAttribute('format', $attachmentAsset->getContainerFormat()); $tags = $attachment->addChild('tags'); foreach (explode(',', $attachmentAsset->getTags()) as $tag) { $tags->addChild('tag', kMrssManager::stringToSafeXml($tag)); } $attachment->addChild('filename', $attachmentAsset->getFilename()); $attachment->addChild('title', $attachmentAsset->getTitle()); $attachment->addChild('description', $attachmentAsset->getPartnerDescription()); }
/** * @param CaptionAsset $captionAsset * @param SimpleXMLElement $mrss * @return SimpleXMLElement */ public function contributeCaptionAssets(CaptionAsset $captionAsset, SimpleXMLElement $mrss) { $subTitle = $mrss->addChild('subTitle'); $subTitle->addAttribute('href', $captionAsset->getDownloadUrl(true)); $subTitle->addAttribute('captionAssetId', $captionAsset->getId()); $subTitle->addAttribute('isDefault', $captionAsset->getDefault() ? 'true' : 'false'); $subTitle->addAttribute('format', $captionAsset->getContainerFormat()); $subTitle->addAttribute('lang', $captionAsset->getLanguage()); if ($captionAsset->getFlavorParamsId()) { $subTitle->addAttribute('captionParamsId', $captionAsset->getFlavorParamsId()); } $tags = $subTitle->addChild('tags'); foreach (explode(',', $captionAsset->getTags()) as $tag) { $tags->addChild('tag', kMrssManager::stringToSafeXml($tag)); } }
/** * @param EntryDistribution $entryDistribution * @param SimpleXMLElement $mrss * @return SimpleXMLElement */ public function contributeDistribution(EntryDistribution $entryDistribution, SimpleXMLElement $mrss) { $distributionsProvider = null; $distributionsProfile = DistributionProfilePeer::retrieveByPK($entryDistribution->getDistributionProfileId()); if ($distributionsProfile) { $distributionsProvider = $distributionsProfile->getProvider(); } $distribution = $mrss->addChild('distribution'); $distribution->addAttribute('entryDistributionId', $entryDistribution->getId()); $distribution->addAttribute('distributionProfileId', $entryDistribution->getDistributionProfileId()); if ($distributionsProfile) { $distribution->addAttribute('distributionProfileName', $distributionsProfile->getName()); } if ($distributionsProvider) { $distribution->addAttribute('provider', $distributionsProvider->getName()); if ($distributionsProvider->getType() == DistributionProviderType::GENERIC) { $distribution->addAttribute('distributionProviderId', $distributionsProvider->getId()); } elseif ($distributionsProvider->getType() == DistributionProviderType::SYNDICATION) { if ($distributionsProfile instanceof SyndicationDistributionProfile) { $distribution->addAttribute('feedId', $distributionsProfile->getFeedId()); } } else { $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaContentDistributionProvider'); foreach ($pluginInstances as $pluginInstance) { if ($pluginInstance->getProvider() === $distributionsProvider) { $pluginInstance->contributeMRSS($entryDistribution, $distribution); } } } } if ($entryDistribution->getRemoteId()) { $distribution->addChild('remoteId', $entryDistribution->getRemoteId()); } if ($entryDistribution->getSunrise(null)) { $distribution->addChild('sunrise', $entryDistribution->getSunrise(null)); } if ($entryDistribution->getSunset(null)) { $distribution->addChild('sunset', $entryDistribution->getSunset(null)); } $flavorAssetIds = explode(',', $entryDistribution->getFlavorAssetIds()); $flavorAssetIdsNode = $distribution->addChild('flavorAssetIds'); foreach ($flavorAssetIds as $flavorAssetId) { $flavorAssetIdsNode->addChild('flavorAssetId', $flavorAssetId); } $thumbAssetIds = explode(',', $entryDistribution->getThumbAssetIds()); $thumbAssetIdsNode = $distribution->addChild('thumbAssetIds'); foreach ($thumbAssetIds as $thumbAssetId) { $thumbAssetIdsNode->addChild('thumbAssetId', $thumbAssetId); } $assetIds = explode(',', $entryDistribution->getAssetIds()); $assetIdsNode = $distribution->addChild('assetIds'); foreach ($assetIds as $assetId) { $assetIdsNode->addChild('assetId', $assetId); } if ($entryDistribution->getErrorDescription()) { $distribution->addChild('errorDescription', kMrssManager::stringToSafeXml($entryDistribution->getErrorDescription())); } $distribution->addChild('createdAt', $entryDistribution->getCreatedAt(kMrssManager::FORMAT_DATETIME)); $distribution->addChild('updatedAt', $entryDistribution->getUpdatedAt(kMrssManager::FORMAT_DATETIME)); if ($entryDistribution->getSubmittedAt(null)) { $distribution->addChild('submittedAt', $entryDistribution->getSubmittedAt(kMrssManager::FORMAT_DATETIME)); } if ($entryDistribution->getLastReport(null)) { $distribution->addChild('lastReport', $entryDistribution->getLastReport(kMrssManager::FORMAT_DATETIME)); } if ($entryDistribution->getDirtyStatus()) { $distribution->addChild('dirtyStatus', $entryDistribution->getDirtyStatus()); } $distribution->addChild('status', $entryDistribution->getStatus()); $distribution->addChild('sunStatus', $entryDistribution->getSunStatus()); if ($entryDistribution->getPlays()) { $distribution->addChild('plays', $entryDistribution->getPlays()); } if ($entryDistribution->getViews()) { $distribution->addChild('views', $entryDistribution->getViews()); } if ($entryDistribution->getErrorNumber()) { $distribution->addChild('errorNumber', $entryDistribution->getErrorNumber()); } if ($entryDistribution->getErrorType()) { $distribution->addChild('errorType', $entryDistribution->getErrorType()); } }