当前位置: 首页>>代码示例>>PHP>>正文


PHP kXml::transformXmlUsingXslt方法代码示例

本文整理汇总了PHP中kXml::transformXmlUsingXslt方法的典型用法代码示例。如果您正苦于以下问题:PHP kXml::transformXmlUsingXslt方法的具体用法?PHP kXml::transformXmlUsingXslt怎么用?PHP kXml::transformXmlUsingXslt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kXml的用法示例。


在下文中一共展示了kXml::transformXmlUsingXslt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleFooter

 public function handleFooter()
 {
     $mrss = $this->getKalturaMrssXml($this->syndicationFeed->name, $this->syndicationFeed->feedLandingPage, $this->syndicationFeed->feedDescription);
     if ($this->kalturaXslt) {
         $mrss = kXml::transformXmlUsingXslt($mrss, $this->kalturaXslt);
     }
     $divideHeaderFromFooter = strpos($mrss, self::ITEMS_PLACEHOLDER) + strlen(self::ITEMS_PLACEHOLDER);
     $mrss = substr($mrss, $divideHeaderFromFooter);
     return $mrss;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:10,代码来源:KalturaFeedRenderer.php

示例2: updateFromXSLImpl

 public function updateFromXSLImpl($id, $xslData)
 {
     $dbMetadataObject = MetadataPeer::retrieveByPK($id);
     if (!$dbMetadataObject) {
         throw new KalturaAPIException(MetadataErrors::METADATA_NOT_FOUND);
     }
     $dbMetadataObjectFileSyncKey = $dbMetadataObject->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
     $xsltErrors = array();
     $transformMetadataObjectData = kXml::transformXmlUsingXslt(kFileSyncUtils::file_get_contents($dbMetadataObjectFileSyncKey), $xslData, array(), $xsltErrors);
     if (count($xsltErrors)) {
         throw new KalturaAPIException(MetadataErrors::XSLT_VALIDATION_ERROR, implode(',', $xsltErrors));
     }
     return $this->updateImpl($id, $transformMetadataObjectData);
 }
开发者ID:DBezemer,项目名称:server,代码行数:14,代码来源:MetadataService.php

示例3: handleCustomData

 public function handleCustomData($objectId, SimpleXMLElement $customData)
 {
     $action = KBulkUploadEngine::$actionsMap[KalturaBulkUploadAction::REPLACE];
     if (isset($customData->action)) {
         $action = strtolower($customData->action);
     }
     $metadataProfileId = null;
     if (!empty($customData['metadataProfileId'])) {
         $metadataProfileId = (int) $customData['metadataProfileId'];
     }
     if (!$metadataProfileId && !empty($customData['metadataProfile'])) {
         $metadataProfileId = $this->getMetadataProfileId($customData['metadataProfile']);
     }
     if (!$metadataProfileId) {
         throw new KalturaBatchException("Missing custom data metadataProfile attribute", KalturaBatchJobAppErrors::BULK_MISSING_MANDATORY_PARAMETER);
     }
     $metadataPlugin = KalturaMetadataClientPlugin::get(KBatchBase::$kClient);
     $metadataFilter = new KalturaMetadataFilter();
     $metadataFilter->metadataObjectTypeEqual = $this->objectType;
     $metadataFilter->objectIdEqual = $objectId;
     $metadataFilter->metadataProfileIdEqual = $metadataProfileId;
     $pager = new KalturaFilterPager();
     $pager->pageSize = 1;
     $metadataListResponse = $metadataPlugin->metadata->listAction($metadataFilter, $pager);
     $metadataId = null;
     $metadata = null;
     if (is_array($metadataListResponse->objects) && count($metadataListResponse->objects) > 0) {
         $metadata = reset($metadataListResponse->objects);
         $metadataId = $metadata->id;
     }
     switch ($action) {
         case KBulkUploadEngine::$actionsMap[KalturaBulkUploadAction::TRANSFORM_XSLT]:
             if (!isset($customData->xslt)) {
                 throw new KalturaBatchException($this->containerName . '->' . $this->nodeName . "->xslt element is missing", KalturaBatchJobAppErrors::BULK_ELEMENT_NOT_FOUND);
             }
             if ($metadata) {
                 $metadataXml = $metadata->xml;
             } else {
                 $metadataXml = '<metadata></metadata>';
             }
             $decodedXslt = kXml::decodeXml($customData->xslt);
             $metadataXml = kXml::transformXmlUsingXslt($metadataXml, $decodedXslt);
             break;
         case KBulkUploadEngine::$actionsMap[KalturaBulkUploadAction::REPLACE]:
             if (!isset($customData->xmlData)) {
                 throw new KalturaBatchException($this->containerName . '->' . $this->nodeName . "->xmlData element is missing", KalturaBatchJobAppErrors::BULK_ELEMENT_NOT_FOUND);
             }
             $metadataXmlObject = $customData->xmlData->children();
             $metadataXml = $metadataXmlObject->asXML();
             break;
         default:
             throw new KalturaBatchException($this->containerName . '->' . $this->nodeName . "->action: {$action} is not supported", KalturaBatchJobAppErrors::BULK_ACTION_NOT_SUPPORTED);
     }
     if ($metadataId) {
         $metadataPlugin->metadata->update($metadataId, $metadataXml);
     } else {
         $metadataPlugin->metadata->add($metadataProfileId, $this->objectType, $objectId, $metadataXml);
     }
 }
开发者ID:kubrickfr,项目名称:server,代码行数:59,代码来源:MetadataBulkUploadXmlEngineHandler.php

示例4: createXml

 private function createXml()
 {
     // Init the document
     $this->_doc = new DOMDocument();
     $this->_doc->formatOutput = true;
     $this->_doc->encoding = "UTF-8";
     $feedAsXml = kMrssManager::getEntryMrssXml($this->entry);
     if ($this->distributionProfile->xsltFile && strlen($this->distributionProfile->xsltFile) !== 0) {
         // custom non empty xslt
         $xslt = $this->distributionProfile->xsltFile;
     } else {
         $xslt = file_get_contents(__DIR__ . "/../xml/tvinci_default.xslt");
     }
     $feedAsString = kXml::transformXmlUsingXslt($feedAsXml->saveXML(), $xslt, $this->createArgumentsForXSLT());
     $data = $this->_doc->createElement('data');
     $data->appendChild($this->_doc->createCDATASection($feedAsString));
     // Create the document's root node
     $envelopeRootNode = $this->_doc->createElement('s:Envelope');
     $this->setAttribute($envelopeRootNode, "xmlns:s", "http://www.w3.org/2003/05/soap-envelope");
     $this->setAttribute($envelopeRootNode, "xmlns:a", "http://www.w3.org/2005/08/addressing");
     $envelopeHeaderNode = $this->_doc->createElement('s:Header');
     $envelopeHeaderActionNode = $this->_doc->createElement('a:Action', 'urn:Iservice/IngestTvinciData');
     $this->setAttribute($envelopeHeaderActionNode, "s:mustUnderstand", "1");
     $envelopeHeaderNode->appendChild($envelopeHeaderActionNode);
     $envelopeBodyNode = $this->_doc->createElement('s:Body');
     $ingestTvinciDataNode = $this->_doc->createElement('IngestTvinciData');
     $tvinciDataRequestNode = $this->_doc->createElement('request');
     $this->setAttribute($tvinciDataRequestNode, "xmlns:i", "http://www.w3.org/2001/XMLSchema-instance");
     $tvinciDataRequestNode->appendChild($this->_doc->createElement('userName', $this->distributionProfile->username));
     $tvinciDataRequestNode->appendChild($this->_doc->createElement('passWord', $this->distributionProfile->password));
     // Attach the CDATA section
     $tvinciDataRequestNode->appendChild($data);
     $ingestTvinciDataNode->appendChild($tvinciDataRequestNode);
     $envelopeBodyNode->appendChild($ingestTvinciDataNode);
     $envelopeRootNode->appendChild($envelopeHeaderNode);
     $envelopeRootNode->appendChild($envelopeBodyNode);
     // Attach the root node to the document
     $this->_doc->appendChild($envelopeRootNode);
     return $this->getXml();
 }
开发者ID:DBezemer,项目名称:server,代码行数:40,代码来源:TvinciDistributionFeedHelper.php

示例5: transformMetadata

 private function transformMetadata($metadataProfileId, $xmlData)
 {
     $result = null;
     $metadataProfile = MetadataProfilePeer::retrieveByPK($metadataProfileId);
     if (!$metadataProfile) {
         KalturaLog::err('Cannot find metadata profile id [' . $metadataProfileId . ']');
         return null;
     }
     $metadataXsltKey = $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_XSLT);
     if (!kFileSyncUtils::file_exists($metadataXsltKey, true)) {
         return null;
     }
     $xsltString = kFileSyncUtils::file_get_contents($metadataXsltKey, true, false);
     if (!$xsltString) {
         return null;
     }
     $xsltParams = array(XsltParameterName::KALTURA_CURRENT_TIMESTAMP => time());
     $xsltErrors = array();
     $xmlDataTransformed = kXml::transformXmlUsingXslt($xmlData, $xsltString, $xsltParams, $xsltErrors);
     if (!empty($xsltErrors)) {
         throw new KalturaAPIException(MetadataErrors::XSLT_VALIDATION_ERROR, implode(',', $xsltErrors));
     }
     if ($xmlDataTransformed) {
         return $xmlDataTransformed;
     }
     KalturaLog::err('Failed XML [$xmlData] transformation for metadata with XSL [$xsltString]');
     return null;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:28,代码来源:MetadataService.php

示例6: getMrssEntry

 /**
  * @param $entry
  * @param $syndicationFeed
  * @return string
  */
 public static function getMrssEntry(entry $entry, syndicationFeed $syndicationFeed = null, $link = null, $xslParams = array())
 {
     $entryMrss = self::getMrssEntryXml($entry, $syndicationFeed, $link);
     if (!$entryMrss) {
         KalturaLog::err("No MRSS returned for entry [" . $entry->getId() . "]");
         return null;
     }
     if ($syndicationFeed->getType() == syndicationFeedType::KALTURA_XSLT && !is_null(self::getXslt($syndicationFeed))) {
         $itemXslt = self::getKalturaItemXslt(self::getXslt($syndicationFeed));
         $entryMrss = kXml::transformXmlUsingXslt($entryMrss, $itemXslt, $xslParams);
         $entryMrss = self::removeNamespaces($entryMrss);
     }
     $entryMrss = self::removeXmlHeader($entryMrss);
     return $entryMrss;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:20,代码来源:kSyndicationFeedManager.php


注:本文中的kXml::transformXmlUsingXslt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。