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


PHP Sanitize::filepath方法代码示例

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


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

示例1: get

 public static function get($downloadURL, $savePath = "", $baseDir = false)
 {
     $fileContents = file_get_contents($downloadURL);
     // Return false if the download was unsuccessful
     if ($fileContents === false) {
         return false;
     }
     // If you are attempting to save the file locally, run the save function
     if ($savePath != "") {
         $basePath = $baseDir == false ? SITE_PATH : dirname(SYS_PATH);
         $savePath = Sanitize::filepath($savePath);
         $savePath = ltrim($savePath, "/");
         File::write($basePath . '/' . $savePath, $fileContents);
     }
     // Return the downloaded content
     return $fileContents;
 }
开发者ID:SkysteedDevelopment,项目名称:Deity,代码行数:17,代码来源:Download.php

示例2: getConfig

 public static function getConfig($class, $dir = "")
 {
     // Prepare Values
     $class = Sanitize::variable($class);
     $slashClass = str_replace("_", "/", $class);
     $classConfig = $class . "_config";
     // If a directory is provided, ONLY look through that directory for plugins
     if ($dir !== "") {
         $dir = rtrim(Sanitize::filepath($dir), "/");
         $fullDir = $dir . "/" . $slashClass . "/" . $class . ".config.php";
         if (is_file($fullDir)) {
             // TODO: Eventually this needs to be resolved - all configs should use the new format.
             if (!class_exists($classConfig)) {
                 $config = (require $fullDir);
                 if (is_array($config)) {
                     return $config;
                 }
             }
             $classConfig = new $classConfig();
             $classConfig->data['path'] = $dir . "/" . $slashClass;
             $classConfig->data['type'] = "???";
             return $classConfig;
         }
         return false;
     }
     // Attempt to load an application class
     $dir = APP_PATH . "/classes/" . $slashClass . "/" . $class . ".config.php";
     if (is_file($dir)) {
         if (!class_exists($classConfig)) {
             $config = (require $dir);
             if (is_array($config)) {
                 return $config;
             }
         }
         $classConfig = new $classConfig();
         $classConfig->data['path'] = APP_PATH . "/classes/" . $slashClass;
         $classConfig->data['type'] = "app";
         return $classConfig;
     }
     // Attempt to load a core class
     $dir = SYS_PATH . "/core-classes/" . $slashClass . "/" . $class . ".config.php";
     if (is_file($dir)) {
         if (!class_exists($classConfig)) {
             $config = (require $dir);
             if (is_array($config)) {
                 return $config;
             }
         }
         $classConfig = new $classConfig();
         $classConfig->data['path'] = SYS_PATH . "/core-classes/" . $slashClass;
         $classConfig->data['type'] = "core";
         return $classConfig;
     }
     // Attempt to load a plugin class
     $dir = SYS_PATH . "/plugin-classes/" . $slashClass . "/" . $class . ".config.php";
     if (is_file($dir)) {
         if (!class_exists($classConfig)) {
             $config = (require $dir);
             if (is_array($config)) {
                 return $config;
             }
         }
         $classConfig = new $classConfig();
         $classConfig->data['path'] = SYS_PATH . "/plugin-classes/" . $slashClass;
         $classConfig->data['type'] = "addon";
         return $classConfig;
     }
     return false;
 }
开发者ID:SkysteedDevelopment,项目名称:Deity,代码行数:69,代码来源:Classes_Meta.php


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