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


PHP MOXMAN_Util_PathUtils::getSitePaths方法代码示例

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


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

示例1: __construct

 /**
  * Constructs a new LocalFileSystem.
  *
  * @param string $scheme File scheme.
  * @param MOXMAN_Util_Config $config Config instance for file system.
  * @param string $root Root path for file system.
  */
 public function __construct($scheme, MOXMAN_Util_Config $config, $root)
 {
     parent::__construct($scheme, $config, $root);
     // Force the root path to an absolute path
     $this->rootPath = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $this->rootPath);
     // Get wwwroot from config or resolve it, remove trailing slash.
     $wwwroot = preg_replace('/\\/$/', '', $config->get("filesystem.local.wwwroot"));
     if (!$wwwroot) {
         $sitePaths = MOXMAN_Util_PathUtils::getSitePaths();
         $wwwroot = $sitePaths["wwwroot"];
     }
     // If rootpath isn't within the resolved wwwroot then resolve the rootpath
     if (!MOXMAN_Util_PathUtils::isChildOf($this->rootPath, $wwwroot)) {
         $this->rootPath = realpath($this->rootPath);
         if (!$this->rootPath) {
             throw new MOXMAN_Exception("Configured filesystem.rootpath doesn't exist or couldn't be resolved.");
         } else {
             if (!MOXMAN_Util_PathUtils::isChildOf($this->rootPath, $wwwroot)) {
                 throw new MOXMAN_Exception("The filesystem.rootpath isn't within the auto detected wwwroot." . "You need to configure filesystem.local.wwwroot.");
             }
         }
     }
     $this->setFileConfigProvider(new MOXMAN_Vfs_Local_FileConfigProvider($this, $config));
     $this->setFileUrlProvider(new MOXMAN_Vfs_Local_FileUrlProvider());
     $this->setFileUrlResolver(new MOXMAN_Vfs_Local_FileUrlResolver($this));
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:33,代码来源:FileSystem.php

示例2: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $config = MOXMAN::getConfig();
     $response = $httpContext->getResponse();
     $response->disableCache();
     $response->setHeader('Content-type', 'text/html');
     if (!$config->get("general.debug")) {
         $response->sendContent("Debugging not configured, you need to set general.debug to true in config.php file.");
         return;
     }
     $request = $httpContext->getRequest();
     if ($request->get("info")) {
         phpinfo();
         return;
     }
     $sitepaths = MOXMAN_Util_PathUtils::getSitePaths();
     $scriptFilename = $_SERVER["SCRIPT_FILENAME"];
     if (realpath($scriptFilename) != $scriptFilename) {
         $scriptFilename = $scriptFilename . "<br />(" . realpath($scriptFilename) . ")";
     }
     if (function_exists("imagecreatefromjpeg")) {
         $gdInfo = gd_info();
         $outInfo = "Ver:" . $gdInfo["GD Version"];
         $outInfo .= " GIF:" . ($gdInfo["GIF Create Support"] ? "Y" : "N");
         $outInfo .= " PNG:" . ($gdInfo["PNG Support"] ? "Y" : "N");
         $outInfo .= " JPEG:" . ($gdInfo["JPEG Support"] ? "Y" : "N");
     } else {
         $outInfo = "N/A";
         $gdInfo = array();
     }
     $user = MOXMAN::getAuthManager()->getUser();
     $result = array("MOXMAN_ROOT" => MOXMAN_ROOT, "realpath('.')" => realpath("."), "Config.php rootpath" => $config->get("filesystem.rootpath"), "Config.php wwwroot" => $config->get("filesystem.local.wwwroot"), "wwwroot resolve" => $sitepaths["wwwroot"], "wwwroot realpath" => realpath($sitepaths["wwwroot"]), "prefix resolve" => $sitepaths["prefix"], "storage path" => MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $config->get("storage.path")), "storage writable" => is_writable(MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $config->get("storage.path"))), "script filename" => $scriptFilename, "script name" => $_SERVER["SCRIPT_NAME"], "GD" => $outInfo, "memory_limit" => @ini_get("memory_limit"), "upload_max_filesize" => @ini_get("upload_max_filesize"), "post_max_size" => @ini_get("post_max_size"), "file_uploads" => @ini_get("file_uploads") ? "Yes" : "No", "PHP Version" => phpversion(), "Time" => date('Y-m-d H:i:s', time()), "Time UTC" => date('Y-m-d H:i:s', time() - date("Z")), "Authenticated" => MOXMAN::getAuthManager()->isAuthenticated(), "User" => $user ? $user->getName() : "N/A");
     $out = "<html><body><table border='1'>";
     foreach ($result as $name => $value) {
         if ($value === true) {
             $value = "True";
         } else {
             if ($value === false) {
                 $value = "False";
             }
         }
         $out .= "<tr>";
         $out .= "<td>" . $name . "&nbsp;</td><td>" . $value . "&nbsp;</td>";
         $out .= "</tr>";
     }
     $out .= "</table><a href='?action=debug&info=true'>Show phpinfo</a>";
     $out .= "</body></html>";
     $response->sendContent($out);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:54,代码来源:DebugHandler.php

示例3: getFile

 /**
  * Returns a file object out of the specified URL.
  *
  * @param string Absolute URL for the specified file.
  * @return MOXMAN_Vfs_IFile File that got resolved or null if it wasn't found.
  */
 public function getFile($url)
 {
     $config = $this->fileSystem->getConfig();
     $file = null;
     // Get config items
     $wwwroot = $config->get("filesystem.local.wwwroot");
     $prefix = $config->get("filesystem.local.urlprefix");
     $paths = MOXMAN_Util_PathUtils::getSitePaths();
     // No wwwroot specified try to figure out a wwwroot
     if (!$wwwroot) {
         $wwwroot = $paths["wwwroot"];
     } else {
         // Force the www root to an absolute file system path
         $wwwroot = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $wwwroot);
     }
     // Add prefix to URL
     if ($prefix == "") {
         $prefix = MOXMAN_Util_PathUtils::combine("{proto}://{host}", $paths["prefix"]);
     }
     // Replace protocol
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
         $prefix = str_replace("{proto}", "https", $prefix);
     } else {
         $prefix = str_replace("{proto}", "http", $prefix);
     }
     // Replace host/port
     $prefix = str_replace("{host}", $_SERVER['HTTP_HOST'], $prefix);
     $prefix = str_replace("{port}", $_SERVER['SERVER_PORT'], $prefix);
     // Remove prefix from url
     if ($prefix && strpos($url, $prefix) === 0) {
         $url = substr($url, strlen($prefix));
     }
     // Parse url and check if path part of the URL is within the root of the file system
     $url = parse_url($url);
     if (isset($url["path"])) {
         $path = MOXMAN_Util_PathUtils::combine($wwwroot, $url["path"]);
         if (MOXMAN_Util_PathUtils::isChildOf($path, $this->fileSystem->getRootPath())) {
             // Crop away root path part and glue it back on again since the case might be different
             // For example: c:/inetpub/wwwroot and C:/InetPub/WWWRoot this will force it into the
             // valid fileSystem root path prefix
             $path = substr($path, strlen($this->fileSystem->getRootPath()));
             $path = MOXMAN_Util_PathUtils::combine($this->fileSystem->getRootPath(), $path);
             $file = $this->fileSystem->getFile($path);
         }
     }
     return $file;
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:53,代码来源:FileUrlResolver.php

示例4: getUrl

 /**
  * Returns an URL for the specified file object.
  *
  * @param MOXMAN_Vfs_IFile $file File to get the absolute URL for.
  * @return String Absolute URL for the specified file.
  */
 public function getUrl(MOXMAN_Vfs_IFile $file)
 {
     $config = $file->getConfig();
     // Get config items
     $wwwroot = $config->get("filesystem.local.wwwroot");
     $prefix = $config->get("filesystem.local.urlprefix");
     $suffix = $config->get("filesystem.local.urlsuffix");
     $paths = MOXMAN_Util_PathUtils::getSitePaths();
     // No wwwroot specified try to figure out a wwwroot
     if (!$wwwroot) {
         $wwwroot = $paths["wwwroot"];
     } else {
         // Force the www root to an absolute file system path
         $wwwroot = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $wwwroot);
     }
     // Add prefix to URL
     if ($prefix == "") {
         $prefix = MOXMAN_Util_PathUtils::combine("{proto}://{host}", $paths["prefix"]);
     }
     // Replace protocol
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
         $prefix = str_replace("{proto}", "https", $prefix);
     } else {
         $prefix = str_replace("{proto}", "http", $prefix);
     }
     // Replace host/port
     $prefix = str_replace("{host}", $_SERVER['HTTP_HOST'], $prefix);
     $prefix = str_replace("{port}", $_SERVER['SERVER_PORT'], $prefix);
     // Insert path into URL
     $url = substr($file->getPath(), strlen($wwwroot));
     $url = MOXMAN_Util_PathUtils::combine($prefix, $url);
     // Add suffix to URL
     if ($suffix) {
         $url .= $suffix;
     }
     return $url;
 }
开发者ID:tremor-od,项目名称:pizza.loc,代码行数:43,代码来源:FileUrlProvider.php

示例5: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $config = MOXMAN::getConfig();
     if (!$config->get("general.debug")) {
         return;
     }
     $request = $httpContext->getRequest();
     if ($request->get("info")) {
         phpinfo();
         die;
     }
     $response = $httpContext->getResponse();
     $response->disableCache();
     $response->setHeader('Content-type', 'text/html');
     $sitepaths = MOXMAN_Util_PathUtils::getSitePaths();
     $scriptFilename = $_SERVER["SCRIPT_FILENAME"];
     if (realpath($scriptFilename) != $scriptFilename) {
         $scriptFilename = $scriptFilename . "<br />(" . realpath($scriptFilename) . ")";
     }
     $result = array("MOXMAN_ROOT" => MOXMAN_ROOT, "realpath('.')" => realpath("."), "Config.php rootpath" => $config->get("filesystem.rootpath"), "Config.php wwwroot" => $config->get("filesystem.local.wwwroot"), "wwwroot resolve" => $sitepaths["wwwroot"], "wwwroot realpath" => realpath($sitepaths["wwwroot"]), "prefix resolve" => $sitepaths["prefix"], "storage path" => MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $config->get("storage.path")), "storage writable" => is_writable(MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $config->get("storage.path"))), "script filename" => $scriptFilename, "script name" => $_SERVER["SCRIPT_NAME"]);
     $out = "<html><body><table border='1'>";
     foreach ($result as $name => $value) {
         if ($value === true) {
             $value = "True";
         } else {
             if ($value === false) {
                 $value = "False";
             }
         }
         $out .= "<tr>";
         $out .= "<td>" . $name . "&nbsp;</td><td>" . $value . "&nbsp;</td>";
         $out .= "</tr>";
     }
     $out .= "</table><a href='?action=debug&info=true'>Show phpinfo</a>";
     $out .= "</body></html>";
     $response->sendContent($out);
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:42,代码来源:DebugHandler.php

示例6: getUrl

 /**
  * Returns an URL for the specified file object.
  *
  * @param MOXMAN_Vfs_IFile $file File to get the absolute URL for.
  * @return String Absolute URL for the specified file.
  */
 public function getUrl(MOXMAN_Vfs_IFile $file)
 {
     $config = $file->getConfig();
     // Get config items
     $wwwroot = $config->get("filesystem.local.wwwroot");
     $prefix = $config->get("filesystem.local.urlprefix");
     $suffix = $config->get("filesystem.local.urlsuffix");
     // Map to wwwroot array
     if (is_array($wwwroot)) {
         foreach ($wwwroot as $rootPath => $rootConfig) {
             $rootPath = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $rootPath);
             if (strpos($file->getPath(), $rootPath) === 0) {
                 $wwwroot = $rootPath;
                 if (isset($rootConfig["wwwroot"])) {
                     $wwwroot = $rootConfig["wwwroot"];
                 }
                 if (isset($rootConfig["urlprefix"])) {
                     $prefix = $rootConfig["urlprefix"];
                 }
                 if (isset($rootConfig["urlsuffix"])) {
                     $suffix = $rootConfig["urlsuffix"];
                 }
                 break;
             }
         }
         if (is_array($wwwroot)) {
             $wwwroot = "";
         }
     }
     $paths = MOXMAN_Util_PathUtils::getSitePaths();
     // No wwwroot specified try to figure out a wwwroot
     if (!$wwwroot) {
         $wwwroot = $paths["wwwroot"];
     } else {
         // Force the www root to an absolute file system path
         $wwwroot = MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $wwwroot);
     }
     // Add prefix to URL
     if ($prefix == "") {
         $prefix = MOXMAN_Util_PathUtils::combine("{proto}://{host}", $paths["prefix"]);
     }
     // Replace protocol
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
         $prefix = str_replace("{proto}", "https", $prefix);
     } else {
         $prefix = str_replace("{proto}", "http", $prefix);
     }
     // Replace host/port
     $prefix = str_replace("{host}", $_SERVER['HTTP_HOST'], $prefix);
     $prefix = str_replace("{port}", $_SERVER['SERVER_PORT'], $prefix);
     // Insert path into URL
     if (stripos($file->getPath(), $wwwroot) === 0) {
         $url = substr($file->getPath(), strlen($wwwroot));
         $url = MOXMAN_Util_PathUtils::combine($prefix, MOXMAN_Http_Uri::escapeUriString($url));
         // Add suffix to URL
         if ($suffix) {
             $url .= $suffix;
         }
         return $url;
     }
     return "";
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:68,代码来源:FileUrlProvider.php


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