本文整理汇总了PHP中entryPeer::addPartnerToCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::addPartnerToCriteria方法的具体用法?PHP entryPeer::addPartnerToCriteria怎么用?PHP entryPeer::addPartnerToCriteria使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryPeer
的用法示例。
在下文中一共展示了entryPeer::addPartnerToCriteria方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldValuesXml
protected function getFieldValuesXml(EntryDistribution $entryDistribution, $fieldName = null)
{
$entry = entryPeer::retrieveByPKNoFilter($entryDistribution->getEntryId());
if (!$entry) {
KalturaLog::err('Entry not found with ID [' . $entry->getId() . ']');
return null;
}
// set the default criteria to use the current entry distribution partner id (it is restored later)
// this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
$oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
entryPeer::setDefaultCriteriaFilter();
entryPeer::addPartnerToCriteria($entryDistribution->getPartnerId(), true);
try {
$mrss = null;
$mrssParams = new kMrssParameters();
if ($this->getItemXpathsToExtend()) {
$mrssParams->setItemXpathsToExtend($this->getItemXpathsToExtend());
}
$mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
$mrssStr = $mrss->asXML();
} catch (Exception $e) {
// restore the original criteria so it will not get stuck due to the exception
entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
throw $e;
}
// restore the original criteria
entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
if (!$mrssStr) {
KalturaLog::err('No MRSS returned for entry [' . $entry->getId() . ']');
return null;
}
$mrssObj = new DOMDocument();
if (!$mrssObj->loadXML($mrssStr)) {
KalturaLog::err('Error loading MRSS XML object for entry [' . $entry->getId() . ']');
return null;
}
$xslObj = new DOMDocument();
$xslStr = $this->getFieldValuesXslt($entryDistribution, $fieldName);
$xslStr = trim($xslStr);
if (!$xslObj->loadXML($xslStr)) {
KalturaLog::err('Error loading distribution profile XSLT for profile ID [' . $this->getId() . ']');
return null;
}
$proc = new XSLTProcessor();
$proc->registerPHPFunctions(kConf::get('xslt_enabled_php_functions'));
$proc->importStyleSheet($xslObj);
$resultXmlObj = $proc->transformToDoc($mrssObj);
if (!$resultXmlObj) {
KalturaLog::err('Error transforming XML for distribution profile [' . $this->getId() . '] and entry id [' . $entry->getId() . ']');
return null;
}
/* DEBUG logs
KalturaLog::log('entry mrss = '.$mrssStr);
KalturaLog::log('profile xslt = '.$xslStr);
*/
KalturaLog::debug('Result XML: ' . $resultXmlObj->saveXML());
return $resultXmlObj;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:58,代码来源:ConfigurableDistributionProfile.php
示例2: getEntryMrssDoc
public function getEntryMrssDoc(EntryDistribution $entryDistribution)
{
$entry = entryPeer::retrieveByPK($entryDistribution->getEntryId());
// set the default criteria to use the current entry distribution partner id (it is restored later)
// this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
$oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
entryPeer::setDefaultCriteriaFilter();
entryPeer::addPartnerToCriteria($this->getPartnerId(), true);
try {
$mrss = null;
$mrssParams = new kMrssParameters();
if ($this->getItemXpathsToExtend()) {
$mrssParams->setItemXpathsToExtend($this->getItemXpathsToExtend());
}
$mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
$mrssStr = $mrss->asXML();
} catch (Exception $e) {
// restore the original criteria so it will not get stuck due to the exception
entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
throw $e;
}
// restore the original criteria
entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
$mrssObj = new DOMDocument();
if (!$mrssObj->loadXML($mrssStr)) {
throw new Exception('Entry mrss xml is not valid');
}
return $mrssObj;
}
示例3: getPathValue
/**
* @return string path value
* @param entry $entry
* @param string $xslStr
*/
protected function getPathValue(entry $entry, $xslStr)
{
// set the default criteria to use the current entry distribution partner id (it is restored later)
// this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
$oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
entryPeer::setDefaultCriteriaFilter();
entryPeer::addPartnerToCriteria($entry->getPartnerId(), true);
$mrss = null;
$mrss = kMrssManager::getEntryMrssXml($entry, $mrss);
$mrssStr = $mrss->asXML();
// restore the original criteria
entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
if (!$mrssStr) {
KalturaLog::err('No MRSS returned for entry [' . $entry->getId() . ']');
return null;
}
$mrssObj = new DOMDocument();
if (!$mrssObj->loadXML($mrssStr)) {
KalturaLog::err('Error loading MRSS XML object for entry [' . $entry->getId() . ']');
return null;
}
$xslObj = new DOMDocument();
$xslStr = trim($xslStr);
if (!$xslObj->loadXML($xslStr)) {
KalturaLog::err('Error loading XSL');
return null;
}
$proc = new XSLTProcessor();
$proc->registerPHPFunctions(kConf::get('xslt_enabled_php_functions'));
$proc->importStyleSheet($xslObj);
$resultXmlObj = $proc->transformToDoc($mrssObj);
if (!$resultXmlObj) {
KalturaLog::err('Error transforming XML for entry id [' . $entry->getId() . ']');
return null;
}
/* DEBUG logs
KalturaLog::log('entry mrss = '.$mrssStr);
KalturaLog::log('profile xslt = '.$xslStr);
*/
KalturaLog::debug('Result XML: ' . $resultXmlObj->saveXML());
$xpath = new DOMXPath($resultXmlObj);
$fieldElement = $xpath->query("//path_value")->item(0);
if (!$fieldElement) {
KalturaLog::err('Cannot find element <path_value> in XML');
return null;
}
$fieldValue = $fieldElement->nodeValue;
return $fieldValue;
}