本文整理汇总了PHP中XmlManager::ParseNode方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlManager::ParseNode方法的具体用法?PHP XmlManager::ParseNode怎么用?PHP XmlManager::ParseNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlManager
的用法示例。
在下文中一共展示了XmlManager::ParseNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RetrieveConfigurationPropertiesFromXml
function RetrieveConfigurationPropertiesFromXml($Path)
{
$FauxContext = "0";
if ($this->ConfigFile == "") {
$this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "You must supply a path to the configuration file");
}
// Retrieve config file contents
$File = new File();
$File->Name = $this->ConfigFile;
$File->Path = $Path;
$FileManager = new FileManager();
$FileManager->ErrorManager =& $this->ErrorManager;
$File = $FileManager->Get($File);
// If there were errors retrieving the config file and we're in the CWD, report an error
if ($this->ErrorManager->ErrorCount > 0 && $Path == $this->CurrentWorkingDirectory) {
$this->ErrorManager->Clear();
$this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "The root configuration file could not be found/read (_config.xml).");
// If failed to retrieve the file from a non-root directory,
// just accept the root file
} elseif ($this->ErrorManager->ErrorCount > 0) {
$this->ErrorManager->Clear();
// If no errors occurred, continue to retrieve new configuration settings
} else {
// Create an XML Parser to retrieve configuration settings
$XMan = new XmlManager();
$XMan->ErrorManager =& $this->ErrorManager;
$MyConfig = $XMan->ParseNode($File->Body);
if ($MyConfig && $this->ErrorManager->ErrorCount == 0) {
$this->StyleUrl = $XMan->GetNodeValueByName($MyConfig, "StyleUrl");
$this->PageTitle = $XMan->GetNodeValueByName($MyConfig, "PageTitle");
$this->PageIntroduction = $XMan->GetNodeValueByName($MyConfig, "PageIntroduction");
$this->PageIntroduction = str_replace("[", "<", $this->PageIntroduction);
$this->PageIntroduction = str_replace("]", ">", $this->PageIntroduction);
$this->PageIntroduction = str_replace("\n", "<br />", $this->PageIntroduction);
$this->DisplayHiddenFiles = $XMan->GetNodeValueByName($MyConfig, "DisplayHiddenFiles");
$this->BrowseSubFolders = $XMan->GetNodeValueByName($MyConfig, "BrowseSubFolders");
$this->SortBy = $XMan->GetNodeValueByName($MyConfig, "SortBy");
$this->SortDirection = $XMan->GetNodeValueByName($MyConfig, "SortDirection");
$this->DateFormat = $XMan->GetNodeValueByName($MyConfig, "DateFormat");
$this->UsePageIntroductionInSubFolders = ForceBool($XMan->GetNodeValueByName($MyConfig, "UsePageIntroductionInSubFolders"), false);
$this->PluginHeight = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginHeight"), $this->PluginHeight);
$this->PluginWidth = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginWidth"), $this->PluginWidth);
$this->FilesPerPage = ForceIncomingInt("fpp", ForceInt($XMan->GetNodeValueByName($MyConfig, "FilesPerPage"), $this->FilesPerPage));
$this->MaxFilesPerPage = ForceInt($XMan->GetNodeValueByName($MyConfig, "MaxFilesPerPage"), $this->MaxFilesPerPage);
$this->FitImagesToPage = ForceBool($XMan->GetNodeValueByName($MyConfig, "FitImagesToPage"), $this->FitImagesToPage);
$this->UseThumbnails = ForceBool($XMan->GetNodeValueByName($MyConfig, "UseThumbnails"), $this->UseThumbnails);
$this->HideFiles = explode(",", $XMan->GetNodeValueByName($MyConfig, "HideFiles"));
for ($i = 0; $i < count($this->HideFiles); $i++) {
$this->FullyQualifiedHideFiles[] = $this->CurrentBrowsingDirectory . "/" . $this->HideFiles[$i];
}
}
}
return $this->ErrorManager->Iif();
}
示例2: File
if ($Config->CurrentWorkingDirectory != $Config->CurrentBrowsingDirectory) {
$Config->RetrieveConfigurationPropertiesFromXml($Config->CurrentBrowsingDirectory);
}
// -----------------------------------
// 2. RETRIEVE FILE EXTENSION SETTINGS
// -----------------------------------
$File = new File();
$File->Name = $Config->FileTypesFile;
$File->Path = $Config->CurrentWorkingDirectory;
$FileManager = new FileManager();
$FileManager->ErrorManager =& $Config->ErrorManager;
$File = $FileManager->Get($File);
// Create an XML Parser to retrieve configuration settings
$XmlManager = new XmlManager();
$XmlManager->ErrorManager =& $ErrorManager;
$FileTypes = $XmlManager->ParseNode($File->Body);
// Create an array of all defined file types
$FileCollections = array();
$FolderCollection = array();
$ExtensionLibrary = array();
for ($i = 0; $i < count($FileTypes->Child); $i++) {
if ($FileTypes->Child[$i]->Name == "FileGroup") {
$FileCollections[$i] = new FileCollection($FileTypes->Child[$i]->Attributes["Name"]);
for ($j = 0; $j < count($FileTypes->Child[$i]->Child); $j++) {
$Node = $FileTypes->Child[$i]->Child[$j];
if ($Node->Name == "Extensions") {
// Ignore all items with a handler method of none
if (@$Node->Attributes["HandlerMethod"] != "None") {
$CurrentExtensionArray = explode(",", $Node->Value);
for ($k = 0; $k < count($CurrentExtensionArray); $k++) {
$ExtensionLibrary[strtolower($CurrentExtensionArray[$k])] = array($i, $Node->Attributes["HandlerMethod"]);