本文整理汇总了PHP中kXml::setChildElement方法的典型用法代码示例。如果您正苦于以下问题:PHP kXml::setChildElement方法的具体用法?PHP kXml::setChildElement怎么用?PHP kXml::setChildElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kXml
的用法示例。
在下文中一共展示了kXml::setChildElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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();
}