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


PHP FileManager::Get方法代码示例

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


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

示例1: FormatDisplayedItem

function FormatDisplayedItem($ItemID, $FileName, $FileSize, $HandlerMethod, &$Params, $Config)
{
    $FolderPath = substr($Config->CurrentBrowsingDirectory, strlen($Config->CurrentWorkingDirectory) + 1, strlen($Config->CurrentBrowsingDirectory) - strlen($Config->CurrentWorkingDirectory) + 1);
    $FolderPath = $FolderPath != "" ? $FolderPath . "/" . $FileName : $FileName;
    $EncodedPath = EncodeLinkUrl(FilePath(CurrentWebPath(), $FolderPath));
    $Params->Add("gid", $ItemID);
    $Return = "<input type=\"hidden\" name=\"Item{$ItemID}\" value=\"" . $EncodedPath . "\" />\r\n      <div class=\"DisplayItem\">\r\n         <h2><a href=\"" . CurrentWebPath() . $FolderPath . "\">{$FileName}</a></h2>\r\n         <ul class=\"Options\">\r\n            <li class=\"Save\"><a href=\"" . CurrentUrl() . $Params->GetQueryString() . "\">Save</a></li>\r\n            <li class=\"Copy\"><a href=\"Javascript:copy(document.frmLinkContainer.Item{$ItemID});\">Copy url</a></li>\r\n";
    $Handled = false;
    $Params->Remove("gid");
    switch ($HandlerMethod) {
        case "Image":
            $Handled = true;
            $Return .= "<input type=\"hidden\" name=\"ImgTag{$ItemID}\" value='<img src=\"" . $EncodedPath . "\" />' />\r\n               <li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.ImgTag{$ItemID});\">Copy img tag</a></li>\r\n            </ul>\r\n            <div class=\"DisplayItemImage\">";
            if ($Config->FitImagesToPage) {
                $ImageSize = @getimagesize($FolderPath);
                if ($ImageSize) {
                    $Return .= "<script>writeImage('{$EncodedPath}', " . $ImageSize[0] . ", " . $ImageSize[1] . ", '" . $ItemID . "');</script>";
                } else {
                    $Return .= "<img src=\"{$EncodedPath}\" alt=\"\" />";
                }
            } else {
                $Return .= "<img src=\"{$EncodedPath}\" alt=\"\" />";
            }
            $Return .= "</div>\r\n";
            break;
        case "IFrame":
            $Handled = true;
            $Return .= "<li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.AnchorTag{$ItemID});\">Copy anchor tag</a></li>\r\n            <input type=\"hidden\" name=\"AnchorTag{$ItemID}\" value=\"<a href='" . $EncodedPath . "'>" . CurrentWebPath() . $FolderPath . "</a>\" />\r\n            <li class=\"View\"><a href=\"" . CurrentWebPath() . $FolderPath . "\" target=\"_blank\">View</a></li>\r\n            </ul>\r\n         <div class=\"DisplayItemIFrame\"><iframe src=\"{$FolderPath}\"></iframe></div>\r\n";
            break;
        case "TextArea":
            $Handled = true;
            // Retrieve the file contents
            $File = new File();
            $File->Name = $FolderPath;
            $File->Path = "./";
            $FileManager = new FileManager();
            $FileManager->ErrorManager =& $Config->ErrorManager;
            $File = $FileManager->Get($File);
            if (!$File) {
                $FauxContext = "0";
                $Config->ErrorManager->AddError($FauxContext, "Filebrowser", "FormatDisplayedItem", "An error occurred while retrieving the file contents.", "", 0);
                $FileContents = $Config->ErrorManager->GetSimple();
            } else {
                // Make sure that a "</textarea>" tag doesn't kill my textarea
                $FileContents = str_replace("<", "&#60;", $File->Body);
            }
            $Return .= "<li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.AnchorTag{$ItemID});\">Copy anchor tag</a></li>\r\n            <input type=\"hidden\" name=\"AnchorTag{$ItemID}\" value='<a href=\"" . $EncodedPath . "\">" . CurrentWebPath() . $FolderPath . "</a>' />\r\n            <li class=\"View\"><a href=\"" . CurrentWebPath() . $FolderPath . "\" target=\"_blank\">View</a></li>\r\n            </ul>\r\n         <div class=\"DisplayItemTextArea\"><textarea>{$FileContents}</textarea></div>\r\n";
            break;
        case "EmbedFlash":
            $Handled = true;
            $EmbedString = "<object type=\"application/x-shockwave-flash\" data=\"" . $EncodedPath . "\"";
            if ($Config->PluginHeight > 0 && $Config->PluginWidth > 0) {
                $EmbedString .= " height=\"" . $Config->PluginHeight . "\" width=\"" . $Config->PluginWidth . "\"";
            }
            $EmbedString .= "><param name=\"movie\" value=\"" . $EncodedPath . "\" />You do not appear to have the latest flash plugin installed</object>";
            $Return .= "<li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.EmbedTag{$ItemID});\">Copy embed tag</a></li>\r\n            <input type=\"hidden\" name=\"EmbedTag{$ItemID}\" value='" . $EmbedString . "' />\r\n            </ul>\r\n            <div class=\"DisplayItemFlash\">" . $EmbedString . "</div>\r\n";
            break;
        case "Embed":
            $Handled = true;
            $EmbedString = "<embed src='" . CurrentWebPath() . $FolderPath . "'></embed>";
            $Return .= "<li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.EmbedTag{$ItemID});\">Copy embed tag</a></li>\r\n            <input type=\"hidden\" name=\"EmbedTag{$ItemID}\" value=\"" . $EmbedString . "\" />\r\n            </ul>\r\n         <div class=\"DisplayItemEmbed\">" . $EmbedString . "</div>\r\n";
            break;
        case "EmbedQuicktime":
            $Handled = true;
            $EmbedString = "<embed src='" . $EncodedPath . "'";
            if ($Config->PluginHeight > 0 && $Config->PluginWidth > 0) {
                $EmbedString .= " height='" . $Config->PluginHeight . "' width='" . $Config->PluginWidth . "'";
            }
            $EmbedString .= "></embed>";
            $Return .= "<li class=\"CopyImg\"><a href=\"Javascript:copy(document.frmLinkContainer.EmbedTag{$ItemID});\">Copy embed tag</a></li>\r\n            <input type=\"hidden\" name=\"EmbedTag{$ItemID}\" value=\"" . $EmbedString . "\" />\r\n            </ul>\r\n         <div class=\"DisplayItemEmbed\">" . $EmbedString . "</div>\r\n";
            break;
        default:
            // HyperLink handler method
            $Return .= "</ul>\r\n         <div class=\"DisplayItemBlank\"></div>\r\n";
            $Handled = true;
            break;
    }
    if (!$Handled) {
        $Return = "";
    } else {
        $Return .= "</div>\r\n";
    }
    return $Return;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:84,代码来源:Filebrowser.Utility.php

示例2: 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();
 }
开发者ID:jdegges,项目名称:pipweb,代码行数:54,代码来源:index.php

示例3: File

        }
    }
}
// If the folder exists, and there is a _config.xml file in the folder, reconfigure the filebrowser
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
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:31,代码来源:index.php


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