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


PHP kXml类代码示例

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


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

示例1: watchFolder

 public function watchFolder(KalturaDropFolder $folder)
 {
     $this->dropFolder = $folder;
     $this->fileTransferMgr = self::getFileTransferManager($this->dropFolder);
     KalturaLog::info('Watching folder [' . $this->dropFolder->id . ']');
     $physicalFiles = $this->getDropFolderFilesFromPhysicalFolder();
     if (count($physicalFiles) > 0) {
         $dropFolderFilesMap = $this->loadDropFolderFiles();
     } else {
         $dropFolderFilesMap = array();
     }
     $maxModificationTime = 0;
     foreach ($physicalFiles as &$physicalFile) {
         /* @var $physicalFile FileObject */
         $physicalFileName = $physicalFile->filename;
         $utfFileName = kString::stripUtf8InvalidChars($physicalFileName);
         if ($physicalFileName != $utfFileName) {
             KalturaLog::info("File name [{$physicalFileName}] is not utf-8 compatible, Skipping file...");
             continue;
         }
         if (!kXml::isXMLValidContent($utfFileName)) {
             KalturaLog::info("File name [{$physicalFileName}] contains invalid XML characters, Skipping file...");
             continue;
         }
         if ($this->dropFolder->incremental && $physicalFile->modificationTime < $this->dropFolder->lastFileTimestamp) {
             KalturaLog::info("File modification time [" . $physicalFile->modificationTime . "] predates drop folder last timestamp [" . $this->dropFolder->lastFileTimestamp . "]. Skipping.");
             if (isset($dropFolderFilesMap[$physicalFileName])) {
                 unset($dropFolderFilesMap[$physicalFileName]);
             }
             continue;
         }
         if ($this->validatePhysicalFile($physicalFileName)) {
             $maxModificationTime = $physicalFile->modificationTime > $maxModificationTime ? $physicalFile->modificationTime : $maxModificationTime;
             KalturaLog::info('Watch file [' . $physicalFileName . ']');
             if (!array_key_exists($physicalFileName, $dropFolderFilesMap)) {
                 try {
                     $lastModificationTime = $physicalFile->modificationTime;
                     $fileSize = $physicalFile->fileSize;
                     $this->handleFileAdded($physicalFileName, $fileSize, $lastModificationTime);
                 } catch (Exception $e) {
                     KalturaLog::err("Error handling drop folder file [{$physicalFileName}] " . $e->getMessage());
                 }
             } else {
                 $dropFolderFile = $dropFolderFilesMap[$physicalFileName];
                 //if file exist in the folder remove it from the map
                 //all the files that are left in a map will be marked as PURGED
                 unset($dropFolderFilesMap[$physicalFileName]);
                 $this->handleExistingDropFolderFile($dropFolderFile);
             }
         }
     }
     foreach ($dropFolderFilesMap as $dropFolderFile) {
         $this->handleFilePurged($dropFolderFile->id);
     }
     if ($this->dropFolder->incremental && $maxModificationTime > $this->dropFolder->lastFileTimestamp) {
         $updateDropFolder = new KalturaDropFolder();
         $updateDropFolder->lastFileTimestamp = $maxModificationTime;
         $this->dropFolderPlugin->dropFolder->update($this->dropFolder->id, $updateDropFolder);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:60,代码来源:KDropFolderFileTransferEngine.php

示例2: fromXml

 /**	
  * 
  * Generates a new KalturaTestsFailures object from a given failure file path 
  * @param string $failureFilePath
  */
 public function fromXml($failureFilePath)
 {
     $simpleXML = kXml::openXmlFile($failureFilePath);
     foreach ($simpleXML->Failures->UnitTestFailures as $unitTestFailureXml) {
         $this->testCaseFailures[] = KalturaTestCaseFailure::generateFromXml($unitTestFailureXml);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:KalturaTestFailures.php

示例3: fromSourceXML

 /**
  * sets the KalturaDataGeneratorConfigFile object from simpleXMLElement (the source xml of the data)
  * @param SimpleXMLElement $simpleXMLElement
  * 
  * @return None, sets the given object
  */
 public function fromSourceXML(SimpleXMLElement $simpleXMLElement)
 {
     //For each test file
     foreach ($simpleXMLElement->TestDataFile as $xmlTestDataFile) {
         //Create new test file obejct
         $testDataFile = new KalturaUnitTestDataFile();
         //For each UnitTest data (in this file)
         foreach ($xmlTestDataFile->UnitTestsData->UnitTestData as $xmlUnitTestData) {
             //Create new unit test data
             $unitTestData = new KalturaUnitTestData();
             //For each input create the needed Kaltura object identifier
             foreach ($xmlUnitTestData->Inputs->Input as $input) {
                 $additionalData = kXml::getAttributesAsArray($input);
                 $unitTestDataObjectIdentifier = new KalturaUnitTestDataObject((string) $input["type"], $additionalData);
                 $unitTestData->input[] = $unitTestDataObjectIdentifier;
             }
             //And for each output reference create the needed kaltura object identifier
             foreach ($xmlUnitTestData->OutputReferences->OutputReference as $outputReference) {
                 $additionalData = kXml::getAttributesAsArray($outputReference);
                 $unitTestDataObjectIdentifier = new KalturaUnitTestDataObject((string) $outputReference["type"], $additionalData);
                 $unitTestData->outputReference[] = $unitTestDataObjectIdentifier;
             }
             //Add the new unit test into the tests array.
             $testDataFile->unitTestsData[] = $unitTestData;
         }
         $testDataFile->fileName = trim((string) $xmlTestDataFile->FileName);
         $this->testFiles[] = $testDataFile;
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:35,代码来源:KalturaDataGeneratorConfigFile.php

示例4: parseStrTTTime

 private function parseStrTTTime($timeStr)
 {
     $matches = null;
     if (preg_match('/(\\d+)s/', $timeStr)) {
         return intval($matches[1]) * 1000;
     }
     return kXml::timeToInteger($timeStr);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:8,代码来源:dfxpCaptionsContentManager.php

示例5: execute

 public function execute()
 {
     $this->forceSystemAuthentication();
     $kshow_id = @$_REQUEST["kshow_id"];
     $this->kshow_id = $kshow_id;
     $this->kshow = NULL;
     $entry_id = @$_REQUEST["entry_id"];
     $this->entry_id = $entry_id;
     $this->entry = NULL;
     $this->message = "";
     if (!empty($kshow_id)) {
         $this->kshow = kshowPeer::retrieveByPK($kshow_id);
         if (!$this->kshow) {
             $this->message = "Cannot find kshow [{$kshow_id}]";
         } else {
             $this->entry = $this->kshow->getShowEntry();
         }
     } elseif (!empty($kshow_id)) {
         $this->entry = entryPeer::retrieveByPK($entry_id);
         if (!$this->entry) {
             $this->message = "Cannot find entry [{$entry_id}]";
         } else {
             $this->kshow = $this->{$this}->entry->getKshow();
         }
     }
     if ($this->kshow) {
         $this->metadata = $this->kshow->getMetadata();
     } else {
         $this->metadata = "";
     }
     $pending_str = $this->getP("pending");
     $remove_pending = $this->getP("remove_pending");
     if ($this->metadata && ($remove_pending || $pending_str)) {
         if ($remove_pending) {
             $pending_str = "";
         }
         $xml_doc = new DOMDocument();
         $xml_doc->loadXML($this->metadata);
         $metadata = kXml::getFirstElement($xml_doc, "MetaData");
         $should_save = kXml::setChildElement($xml_doc, $metadata, "Pending", $pending_str, true);
         if ($remove_pending) {
             $should_save = kXml::setChildElement($xml_doc, $metadata, "LastPendingTimeStamp", "", true);
         }
         if ($should_save) {
             $fixed_content = $xml_doc->saveXML();
             $content_dir = myContentStorage::getFSContentRootPath();
             $file_name = realpath($content_dir . $this->entry->getDataPath());
             $res = file_put_contents($file_name, $fixed_content);
             // sync - NOTOK
             $this->metadata = $fixed_content;
         }
     }
     $this->pending = $pending_str;
     $this->kshow_id = $kshow_id;
     $this->entry_id = $entry_id;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:56,代码来源:editPendingAction.class.php

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

示例7: fromXml

 /**
  * 
  * Generates a new testCaseFailure object from a given simpleXmlElement (failure file xml)
  * @param SimpleXMlElement $unitTestFailureXml
  */
 public function fromXml(SimpleXMlElement $unitTestFailureXml)
 {
     //Sets the inputs as key => value byt the xml attributes
     foreach ($unitTestFailureXml->Inputs->Input as $inputXml) {
         $this->testCaseInput[] = kXml::getAttributesAsArray($inputXml);
     }
     foreach ($unitTestFailureXml->Failures->Failure as $failureXml) {
         $this->testCaseFailures[] = KalturaFailure::generateFromXml($failureXml);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:15,代码来源:KalturaTestCaseFailure.php

示例8: validateXsdData

 public static function validateXsdData($xsdData, &$errorMessage)
 {
     // validates the xsd
     libxml_use_internal_errors(true);
     libxml_clear_errors();
     $xml = new KDOMDocument();
     if (!$xml->loadXML($xsdData)) {
         $errorMessage = kXml::getLibXmlErrorDescription($xsdData);
         return false;
     }
     libxml_clear_errors();
     libxml_use_internal_errors(false);
     return true;
 }
开发者ID:DBezemer,项目名称:server,代码行数:14,代码来源:kMetadataProfileManager.php

示例9: parseOutput

 protected function parseOutput($output)
 {
     $output = kXml::stripXMLInvalidChars($output);
     $tokenizer = new KStringTokenizer($output, "\t\n");
     $mediaInfo = new KalturaMediaInfo();
     $mediaInfo->rawData = $output;
     $fieldCnt = 0;
     $section = self::SrteamGeneral;
     $sectionID = 0;
     $mediaInfo->streamArray = array();
     $streamMediaInfo = null;
     while ($tokenizer->hasMoreTokens()) {
         $tok = strtolower(trim($tokenizer->nextToken()));
         if (strrpos($tok, ":") == false) {
             if (isset($streamMediaInfo)) {
                 $mediaInfo->streamArray[$section][] = $streamMediaInfo;
             }
             $streamMediaInfo = new KalturaMediaInfo();
             $sectionID = strchr($tok, "#");
             if ($sectionID) {
                 $sectionID = trim($sectionID, "#");
             } else {
                 $sectionID = 0;
             }
             if (strstr($tok, self::SrteamGeneral) == true) {
                 $section = self::SrteamGeneral;
             } else {
                 if (strstr($tok, self::SrteamVideo) == true) {
                     $section = self::SrteamVideo;
                 } else {
                     if (strstr($tok, self::SrteamAudio) == true) {
                         $section = self::SrteamAudio;
                     } else {
                         $section = $tok;
                     }
                 }
             }
         } else {
             if ($sectionID <= 1) {
                 self::loadStreamMedia($mediaInfo, $section, $tok);
                 $fieldCnt++;
             }
         }
         self::loadStreamMedia($streamMediaInfo, $section, $tok);
     }
     if (isset($streamMediaInfo)) {
         $mediaInfo->streamArray[$section][] = $streamMediaInfo;
     }
     return $mediaInfo;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:50,代码来源:KMediaInfoMediaParser.php

示例10: doTest

 public function doTest($xmlPath, $type)
 {
     echo "\tTesting File [{$xmlPath}]\n";
     $serviceUrl = $this->client->getConfig()->serviceUrl;
     $xsdPath = "{$serviceUrl}/api_v3/index.php/service/schema/action/serve/type/{$type}";
     //		libxml_use_internal_errors(true);
     //		libxml_clear_errors();
     $doc = new DOMDocument();
     $doc->Load($xmlPath);
     //Validate the XML file against the schema
     if (!$doc->schemaValidate($xsdPath)) {
         $description = kXml::getLibXmlErrorDescription(file_get_contents($xmlPath));
         $this->fail("Type [{$type}] File [{$xmlPath}]: {$description}");
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:SchemaServiceTestValidate.php

示例11: getAllAssetsData

 public static function getAllAssetsData($filePath)
 {
     list($xml_doc, $xpath) = self::getDomAndXpath($filePath);
     $asset_ids = self::getElementsList($xpath, "*");
     //$asset_ids = $xpath->query( "//VideoAssets/vidAsset" );
     $arr = array();
     foreach ($asset_ids as $asset_id) {
         $node = array();
         $node["id"] = $asset_id->getAttribute("k_id");
         $stream_info_elem = kXml::getFirstElement($asset_id, "StreamInfo");
         $node["start_time"] = $stream_info_elem->getAttribute("start_time");
         $node["len_time"] = $stream_info_elem->getAttribute("len_time");
         //start_time="0" len_time=
         $arr[] = $node;
     }
     return $arr;
 }
开发者ID:GElkayam,项目名称:server,代码行数:17,代码来源:myFlvStreamer.class.php

示例12: parseCuePoint

 protected function parseCuePoint(SimpleXMLElement $scene)
 {
     if ($scene->getName() != 'scene-code-cue-point') {
         return null;
     }
     $cuePoint = parent::parseCuePoint($scene);
     if (!$cuePoint instanceof KalturaCodeCuePoint) {
         return null;
     }
     if (isset($scene->sceneEndTime)) {
         $cuePoint->endTime = kXml::timeToInteger($scene->sceneEndTime);
     }
     if (isset($scene->code)) {
         $cuePoint->code = "{$scene->code}";
     }
     if (isset($scene->description)) {
         $cuePoint->description = "{$scene->description}";
     }
     return $cuePoint;
 }
开发者ID:DBezemer,项目名称:server,代码行数:20,代码来源:CodeCuePointBulkUploadXmlHandler.php

示例13: parseAction

 /**
  * Parse content of caption asset and index it
  *
  * @action parse
  * @param string $captionAssetId
  * @throws KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND
  */
 function parseAction($captionAssetId)
 {
     $captionAsset = assetPeer::retrieveById($captionAssetId);
     if (!$captionAsset) {
         throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_ID_NOT_FOUND, $captionAssetId);
     }
     $captionAssetItems = CaptionAssetItemPeer::retrieveByAssetId($captionAssetId);
     foreach ($captionAssetItems as $captionAssetItem) {
         /* @var $captionAssetItem CaptionAssetItem */
         $captionAssetItem->delete();
     }
     // make sure that all old items are deleted from the sphinx before creating the new ones
     kEventsManager::flushEvents();
     $syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $content = kFileSyncUtils::file_get_contents($syncKey, true, false);
     if (!$content) {
         return;
     }
     $captionsContentManager = kCaptionsContentManager::getCoreContentManager($captionAsset->getContainerFormat());
     if (!$captionsContentManager) {
         return;
     }
     $itemsData = $captionsContentManager->parse($content);
     foreach ($itemsData as $itemData) {
         $item = new CaptionAssetItem();
         $item->setCaptionAssetId($captionAsset->getId());
         $item->setEntryId($captionAsset->getEntryId());
         $item->setPartnerId($captionAsset->getPartnerId());
         $item->setStartTime($itemData['startTime']);
         $item->setEndTime($itemData['endTime']);
         $content = '';
         foreach ($itemData['content'] as $curChunk) {
             $content .= $curChunk['text'];
         }
         //Make sure there are no invalid chars in the caption asset items to avoid braking the search request by providing invalid XML
         $content = kString::stripUtf8InvalidChars($content);
         $content = kXml::stripXMLInvalidChars($content);
         $item->setContent($content);
         $item->save();
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:48,代码来源:CaptionAssetItemService.php

示例14: parseCuePoint

 protected function parseCuePoint(SimpleXMLElement $scene)
 {
     if ($scene->getName() != 'scene-annotation') {
         return null;
     }
     $cuePoint = parent::parseCuePoint($scene);
     if (!$cuePoint instanceof KalturaAnnotation) {
         return null;
     }
     if (isset($scene->sceneEndTime)) {
         $cuePoint->endTime = kXml::timeToInteger($scene->sceneEndTime);
     }
     if (isset($scene->sceneText)) {
         $cuePoint->text = "{$scene->sceneText}";
     }
     if (isset($scene->parentId)) {
         $cuePoint->parentId = "{$scene->parentId}";
     } elseif (isset($scene->parent)) {
         $cuePoint->parentId = $this->getCuePointId("{$scene->parent}");
     }
     return $cuePoint;
 }
开发者ID:DBezemer,项目名称:server,代码行数:22,代码来源:AnnotationBulkUploadXmlHandler.php

示例15: parseCuePoint

 protected function parseCuePoint(SimpleXMLElement $scene)
 {
     if ($scene->getName() != 'scene-ad-cue-point') {
         return null;
     }
     $cuePoint = parent::parseCuePoint($scene);
     if (!$cuePoint instanceof KalturaAdCuePoint) {
         return null;
     }
     if (isset($scene->sceneEndTime)) {
         $cuePoint->endTime = kXml::timeToInteger($scene->sceneEndTime);
     }
     if (isset($scene->sceneTitle)) {
         $cuePoint->title = "{$scene->sceneTitle}";
     }
     if (isset($scene->sourceUrl)) {
         $cuePoint->sourceUrl = "{$scene->sourceUrl}";
     }
     $cuePoint->adType = "{$scene->adType}";
     $cuePoint->protocolType = "{$scene->protocolType}";
     return $cuePoint;
 }
开发者ID:DBezemer,项目名称:server,代码行数:22,代码来源:AdCuePointBulkUploadXmlHandler.php


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