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


PHP kXml::decodeXml方法代码示例

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


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

示例1: 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


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