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


PHP kXml::getFirstElement方法代码示例

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


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

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

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

示例3: addVersionInfo

 public static function addVersionInfo($xml_metadata, $version_info)
 {
     $xml_doc = new DOMDocument();
     $xml_doc->loadXML($xml_metadata);
     $metadata = kXml::getFirstElement($xml_doc, "MetaData");
     kXml::setChildElement($xml_doc, $metadata, "KuserId", @$version_info["KuserId"], false);
     kXml::setChildElement($xml_doc, $metadata, "PuserId", @$version_info["PuserId"], false);
     kXml::setChildElement($xml_doc, $metadata, "ScreenName", @$version_info["ScreenName"], false);
     kXml::setChildElement($xml_doc, $metadata, "UpdatedAt", time(), false);
     return $xml_doc->saveXML();
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:11,代码来源:myMetadataUtils.class.php

示例4: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshowId = $this->getP("kshow_id");
     $numberOfVersions = $this->getP("number_of_versions", 5);
     // must be int and not more than 50
     $numberOfVersions = (int) $numberOfVersions;
     $numberOfVersions = min($numberOfVersions, 50);
     $kshow = kshowPeer::retrieveByPK($kshowId);
     if (!$kshow) {
         $this->addError(APIErrors::KSHOW_DOES_NOT_EXISTS);
         return;
     }
     $showEntry = $kshow->getShowEntry();
     if (!$showEntry) {
         $this->addError(APIErrors::ROUGHCUT_NOT_FOUND);
         return;
     }
     $sync_key = $showEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     $showEntryDataPath = kFileSyncUtils::getLocalFilePathForKey($sync_key);
     $versionsInfoFilePath = $showEntryDataPath . '.info';
     $lastVersionDoc = new KDOMDocument();
     $lastVersionDoc->loadXML(kFileSyncUtils::file_get_contents($sync_key, true, false));
     $lastVersion = myContentStorage::getVersion($showEntryDataPath);
     // check if we need to refresh the data in the info file
     $refreshInfoFile = true;
     if (file_exists($versionsInfoFilePath)) {
         $versionsInfoDoc = new KDOMDocument();
         $versionsInfoDoc->load($versionsInfoFilePath);
         $lastVersionInInfoFile = kXml::getLastElementAsText($versionsInfoDoc, "ShowVersion");
         if ($lastVersionInInfoFile && $lastVersion == $lastVersionInInfoFile) {
             $refreshInfoFile = false;
         } else {
             $refreshInfoFile = true;
         }
     } else {
         $refreshInfoFile = true;
     }
     // refresh or create the data in the info file
     if ($refreshInfoFile) {
         $versionsInfoDoc = new KDOMDocument();
         $xmlElement = $versionsInfoDoc->createElement("xml");
         // start from the first edited version (100001) and don't use 100000
         for ($i = myContentStorage::MIN_OBFUSCATOR_VALUE + 1; $i <= $lastVersion; $i++) {
             $version_sync_key = $showEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $i);
             if (kFileSyncUtils::file_exists($version_sync_key, false)) {
                 $xmlContent = kFileSyncUtils::file_get_contents($version_sync_key);
                 //echo "[" . htmlspecialchars( $xmlContent ) . "]<br>";
                 $xmlDoc = new KDOMDocument();
                 $xmlDoc->loadXML($xmlContent);
                 $elementToCopy = kXml::getFirstElement($xmlDoc, "MetaData");
                 //echo "[$i]";
                 $elementCloned = $elementToCopy->cloneNode(true);
                 $elementImported = $versionsInfoDoc->importNode($elementCloned, true);
                 $xmlElement->appendChild($elementImported);
             }
         }
         $versionsInfoDoc->appendChild($xmlElement);
         kFile::setFileContent($versionsInfoFilePath, $versionsInfoDoc->saveXML());
         // FileSync OK - created a temp file on DC's disk
     }
     $metadataNodes = $versionsInfoDoc->getElementsByTagName("MetaData");
     $count = 0;
     $versionsInfo = array();
     for ($i = $metadataNodes->length - 1; $i >= 0; $i--) {
         $metadataNode = $metadataNodes->item($i);
         $node = kXml::getFirstElement($metadataNode, "ShowVersion");
         $showVersion = $node ? $node->nodeValue : "";
         $node = kXml::getFirstElement($metadataNode, "PuserId");
         $puserId = $node ? $node->nodeValue : "";
         $node = kXml::getFirstElement($metadataNode, "ScreenName");
         $screenName = $node ? $node->nodeValue : "";
         $node = kXml::getFirstElement($metadataNode, "UpdatedAt");
         $updatedAt = $node ? $node->nodeValue : "";
         $versionsInfo[] = array("version" => $showVersion, "puserId" => $puserId, "screenName" => $screenName, "updatedAt" => $updatedAt);
         $count++;
         if ($count >= $numberOfVersions) {
             break;
         }
     }
     $this->addMsg("show_versions", $versionsInfo);
 }
开发者ID:DBezemer,项目名称:server,代码行数:81,代码来源:getlastversionsinfoAction.class.php


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