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


PHP static::files方法代码示例

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


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

示例1: setupBeforeClass

    public static function setupBeforeClass()
    {
        static::$root = sys_get_temp_dir() . '/insulin';
        static::$files = array(static::$root . '/modules/', static::$root . '/sugar/', static::$root . '/sugar/custom/', static::$root . '/sugar/include/', static::$root . '/sugar/include/entryPoint.php', static::$root . '/sugar/include/MVC/', static::$root . '/sugar/include/MVC/SugarApplication.php', static::$root . '/sugar/config.php', static::$root . '/sugar/sugar_version.php');
        static::$links = array(static::$root . '/modules' => static::$root . '/sugar/modules', static::$root . '/sugar/custom' => static::$root . '/custom');
        if (is_dir(static::$root)) {
            static::tearDownAfterClass();
        } else {
            mkdir(static::$root);
        }
        foreach (static::$files as $file) {
            if ('/' === substr($file, -1) && !is_dir($file)) {
                mkdir($file);
            } else {
                touch($file);
            }
        }
        foreach (static::$links as $target => $link) {
            symlink($target, $link);
        }
        file_put_contents(static::$root . '/sugar/sugar_version.php', '<?php
$sugar_version      = \'6.5.3\';
$sugar_db_version   = \'6.5.3\';
$sugar_flavor       = \'ENT\';
$sugar_build        = \'123\';
$sugar_timestamp    = \'2008-08-01 12:00am\';
');
    }
开发者ID:insulin,项目名称:cli,代码行数:28,代码来源:FinderTest.php

示例2: initialize

 protected static function initialize()
 {
     if (static::$initialized) {
         return;
     }
     static::$initialized = true;
     static::$parentPath = __FILE__;
     for ($i = substr_count(get_class(), static::$nsChar); $i >= 0; $i--) {
         static::$parentPath = dirname(static::$parentPath);
     }
     static::$paths = array();
     static::$files = array(__FILE__);
 }
开发者ID:smileytechguy,项目名称:nLine,代码行数:13,代码来源:loader.php

示例3: setupBeforeClass

 public static function setupBeforeClass()
 {
     static::$root = sys_get_temp_dir() . '/insulin';
     static::$files = array(static::$root . '/modules/', static::$root . '/sugar/', static::$root . '/sugar/custom/', static::$root . '/sugar/include/', static::$root . '/sugar/include/entryPoint.php', static::$root . '/sugar/include/MVC/', static::$root . '/sugar/include/MVC/SugarApplication.php', static::$root . '/sugar/config.php', static::$root . '/sugar/sugar_version.php');
     if (is_dir(static::$root)) {
         static::tearDownAfterClass();
     } else {
         mkdir(static::$root);
     }
     foreach (static::$files as $file) {
         if ('/' === substr($file, -1) && !is_dir($file)) {
             mkdir($file);
         } else {
             touch($file);
         }
     }
 }
开发者ID:insulin,项目名称:cli,代码行数:17,代码来源:ManagerTest.php

示例4: init

 public static function init()
 {
     $uri = explode('?', $_SERVER['REQUEST_URI']);
     $ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;
     static::$params = ['user_agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $_SERVER['REDIRECT_STATUS'], 'host' => $_SERVER['SERVER_NAME'], 'port' => $_SERVER['SERVER_PORT'], 'ip_address' => $_SERVER['REMOTE_ADDR'], 'method' => strtolower($_SERVER['REQUEST_METHOD']), 'query_string' => $_SERVER['QUERY_STRING'], 'uri' => $uri[0], 'ajax' => $ajax, 'accept' => $_SERVER['HTTP_ACCEPT'], 'accept_encoding' => $_SERVER['HTTP_ACCEPT_ENCODING'], 'accept_language' => $_SERVER['HTTP_ACCEPT_LANGUAGE']];
     if (isset($_POST['_method'])) {
         static::$params['method'] = strtolower($_POST['_method']);
         unset($_POST['_method']);
     }
     foreach ($_GET as $key => $value) {
         static::$inputs[$key] = $value;
     }
     foreach ($_POST as $key => $value) {
         static::$inputs[$key] = $value;
     }
     foreach ($_FILES as $input_name => $file_properties) {
         if (is_array($file_properties['name'])) {
             // Closure
             $filter = function ($path) use($input_name) {
                 // get the type as: name, tmp_name, size, error, type (mime-type)
                 $type = substr($path, 0, strpos($path, '.'));
                 // get the value of path in $_FILES array from $path :P
                 $pathWitoutType = substr($path, strpos($path, '.') + 1);
                 if ($type === 'tmp_name') {
                     $file = new File(get_array_value($_FILES, $input_name . '.tmp_name.' . $pathWitoutType), static::$file_error_codes[get_array_value($_FILES, $input_name . '.error.' . $pathWitoutType)], get_array_value($_FILES, $input_name . '.name.' . $pathWitoutType));
                     $file->setArrayPath($input_name . '.' . $pathWitoutType);
                     return $file;
                 }
                 return null;
             };
             static::$files = array_merge(static::$files, array_paths($_FILES[$input_name], [], null, $filter));
         } else {
             $file = new File($file_properties['tmp_name'], static::$file_error_codes[$file_properties['error']], $file_properties['name']);
             $file->setArrayPath($input_name);
             static::$files = array_merge(static::$files, [$file]);
         }
     }
     unset($_FILES);
     unset($_GET);
     unset($_POST);
     unset($_SERVER);
 }
开发者ID:ramee,项目名称:alien-framework,代码行数:42,代码来源:Request.php

示例5: setFiles

 public static function setFiles(array $files)
 {
     static::$files = $files;
 }
开发者ID:control-corp,项目名称:brands,代码行数:4,代码来源:autoload.php

示例6: findByFileExt

 /**
  * @return $this
  */
 public static function findByFileExt($loc, $fileExt)
 {
     $finder = new static();
     return $finder->files()->name('*.' . $fileExt)->in($loc);
 }
开发者ID:phpcrystal,项目名称:phpcrystal,代码行数:8,代码来源:Finder.php

示例7: resetCache

 /**
  * Resets the internal static cache.
  *
  * Used by unit tests to ensure a clean slate.
  */
 public function resetCache()
 {
     static::$files = array();
 }
开发者ID:jeyram,项目名称:camp-gdl,代码行数:9,代码来源:ExtensionDiscovery.php

示例8: reset

 public static function reset()
 {
     static::$files = array();
 }
开发者ID:bjargud,项目名称:drush,代码行数:4,代码来源:ExtensionDiscovery.php

示例9: getFoundFilesFromCache

 public function getFoundFilesFromCache()
 {
     static::$files = Cache::get('ModuleLoader::findFile', []);
 }
开发者ID:BlueCatTAT,项目名称:kodicms-laravel,代码行数:4,代码来源:ModuleLoader.php

示例10: mount

 static function mount($config)
 {
     static::$config = $config;
     //not configurables
     static::$root = ROOT;
     static::$php = ROOT . '.app/';
     static::$ctrl = ROOT . '.app/controller/';
     static::$html = ROOT . '.app/html/';
     static::$upload = ROOT . '.app/upload/';
     static::$style = ROOT . 'css/';
     static::$script = ROOT . 'js/';
     //Detect SSL access
     if (!isset($_SERVER['SERVER_PORT'])) {
         $_SERVER['SERVER_PORT'] = 80;
     }
     $http = isset($_SERVER['HTTPS']) && ($_SERVER["HTTPS"] == "on" || $_SERVER["HTTPS"] == 1 || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
     //What's base??!
     $base = isset($_SERVER['PHAR_SCRIPT_NAME']) ? dirname($_SERVER['PHAR_SCRIPT_NAME']) : rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), ' /');
     if ($_SERVER['SERVER_PORT'] != 80) {
         $base .= ':' . $_SERVER['SERVER_PORT'];
     }
     //URL & REQST Constants:
     defined('RQST') || define('RQST', urldecode(isset($_SERVER['REQUEST_URI']) ? urldecode(trim(str_replace($base, '', trim($_SERVER['REQUEST_URI'])), ' /')) : ''));
     defined('URL') || define('URL', isset($_SERVER['SERVER_NAME']) ? $http . $_SERVER['SERVER_NAME'] . $base . '/' : '');
     static::$url = URL;
     static::$rqst = explode('/', RQST);
     static::$files = URL . 'files/';
 }
开发者ID:pedra,项目名称:Xhat,代码行数:28,代码来源:qzumba.php

示例11: reset

 /**
  * Reset the class variables to null.
  */
 public static function reset()
 {
     static::$query = null;
     static::$post = null;
     static::$properties = null;
     static::$server = null;
     static::$cookies = null;
     static::$files = null;
     static::$headers = null;
     static::$method = null;
     static::$pathInfo = null;
     static::$requestUri = null;
     static::$requestPath = null;
     static::$basePath = null;
     static::$baseUrl = null;
 }
开发者ID:avalonphp,项目名称:avalon,代码行数:19,代码来源:Request.php

示例12: process

 /**
  * Normalize the $_FILES array and store the result in $files
  *
  * @return	void
  */
 public static function process($config = array())
 {
     // process runtime config
     if (is_array($config)) {
         static::$config = array_merge(static::$config, $config);
     }
     // processed files array's
     static::$files = array();
     $files = array();
     // any files uploaded?
     if (empty($_FILES)) {
         throw new \FuelException('No file upload was initiated. Did you specify "enctype" in your &lt;form&gt; tag?');
     }
     // normalize the multidimensional fields in the $_FILES array
     foreach ($_FILES as $name => $value) {
         if (is_array($value['name'])) {
             foreach ($value as $field => $content) {
                 foreach (\Arr::flatten($content) as $element => $data) {
                     $_FILES[$name . ':' . $element][$field] = $data;
                 }
             }
             unset($_FILES[$name]);
         }
     }
     // normalize the $_FILES array
     foreach ($_FILES as $name => $value) {
         // store the file data
         $file = array('field' => $name, 'file' => $value['tmp_name']);
         if ($value['error']) {
             $file['error'] = true;
             $file['errors'][] = array('error' => $value['error']);
         } else {
             $file['error'] = false;
             $file['errors'] = array();
         }
         unset($value['tmp_name']);
         $files[] = array_merge($value, $file);
     }
     // verify and augment the files data
     foreach ($files as $key => $value) {
         // add some filename details (pathinfo can't be trusted with utf-8 filenames!)
         $files[$key]['extension'] = ltrim(strrchr(ltrim($files[$key]['name'], '.'), '.'), '.');
         if (empty($files[$key]['extension'])) {
             $files[$key]['filename'] = $files[$key]['name'];
         } else {
             $files[$key]['filename'] = substr($files[$key]['name'], 0, strlen($files[$key]['name']) - (strlen($files[$key]['extension']) + 1));
         }
         // does this upload exceed the maximum size?
         if (!empty(static::$config['max_size']) and $files[$key]['size'] > static::$config['max_size']) {
             $files[$key]['error'] = true;
             $files[$key]['errors'][] = array('error' => static::UPLOAD_ERR_MAX_SIZE);
         }
         // add mimetype information
         if (!$files[$key]['error']) {
             $handle = finfo_open(FILEINFO_MIME_TYPE);
             $files[$key]['mimetype'] = finfo_file($handle, $value['file']);
             finfo_close($handle);
             if ($files[$key]['mimetype'] == 'application/octet-stream' and $files[$key]['type'] != $files[$key]['mimetype']) {
                 $files[$key]['mimetype'] = $files[$key]['type'];
             }
             // make sure it contains something valid
             if (empty($files[$key]['mimetype'])) {
                 $files[$key]['mimetype'] = 'application/octet-stream';
             }
         }
         // check the file extension black- and whitelists
         if (!$files[$key]['error']) {
             if (in_array(strtolower($files[$key]['extension']), (array) static::$config['ext_blacklist'])) {
                 $files[$key]['error'] = true;
                 $files[$key]['errors'][] = array('error' => static::UPLOAD_ERR_EXT_BLACKLISTED);
             } elseif (!empty(static::$config['ext_whitelist']) and !in_array(strtolower($files[$key]['extension']), (array) static::$config['ext_whitelist'])) {
                 $files[$key]['error'] = true;
                 $files[$key]['errors'][] = array('error' => static::UPLOAD_ERR_EXT_NOT_WHITELISTED);
             }
         }
         // check the file type black- and whitelists
         if (!$files[$key]['error']) {
             // split the mimetype info so we can run some tests
             preg_match('|^(.*)/(.*)|', $files[$key]['mimetype'], $mimeinfo);
             if (in_array($mimeinfo[1], (array) static::$config['type_blacklist'])) {
                 $files[$key]['error'] = true;
                 $files[$key]['errors'][] = array('error' => static::UPLOAD_ERR_TYPE_BLACKLISTED);
             }
             if (!empty(static::$config['type_whitelist']) and !in_array($mimeinfo[1], (array) static::$config['type_whitelist'])) {
                 $files[$key]['error'] = true;
                 $files[$key]['errors'][] = array('error' => static::UPLOAD_ERR_TYPE_NOT_WHITELISTED);
             }
         }
         // check the file mimetype black- and whitelists
         if (!$files[$key]['error']) {
             if (in_array($files[$key]['mimetype'], (array) static::$config['mime_blacklist'])) {
                 $files[$key]['error'] = true;
                 $files[$key]['errors'][] = array('error' => static::UPLOAD_ERR_MIME_BLACKLISTED);
             } elseif (!empty(static::$config['mime_whitelist']) and !in_array($files[$key]['mimetype'], (array) static::$config['mime_whitelist'])) {
                 $files[$key]['error'] = true;
//.........这里部分代码省略.........
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:101,代码来源:upload.php

示例13: mount

 static function mount(Router $router)
 {
     static::$router = $router;
     static::$root = WEB_PATH;
     static::$php = APP_PATH . '';
     static::$ctrl = APP_PATH . 'controller/';
     static::$html = HTML_PATH . '';
     static::$upload = APP_PATH . 'upload/';
     static::$style = WEB_PATH . 'css/';
     static::$script = WEB_PATH . 'js/';
     static::$url = URL;
     static::$rqst = explode('/', RQST);
     static::$files = URL . 'files/';
 }
开发者ID:3razil,项目名称:frame,代码行数:14,代码来源:app.php

示例14: setUpBeforeClass

 /**
  * initializes the test environment
  */
 public static function setUpBeforeClass()
 {
     static::$files = array('composer' => sys_get_temp_dir() . '/composer.phar', 'other_composer' => sys_get_temp_dir() . '/other/dir/composer.phar', 'stream' => sys_get_temp_dir() . '/wrapper-unittest.stream');
 }
开发者ID:tobias2k,项目名称:composer-wrapper,代码行数:7,代码来源:WrapperTest.php

示例15: __construct

 /**
  * Constructs a new ExtensionDiscovery object.
  *
  * @param string $root
  *   The app root.
  * @param bool $use_file_cache
  *   (optional) Whether file cache should be used. Defaults to TRUE.
  * @param string[]|null $profile_directories
  *   (optional) The available profile directories. Defaults to NULL, which
  *   will cause this object to search for profile directories based on
  *   settings.
  * @param string|null $site_path
  *   (optional) The site path within the Drupal installation. Defaults to
  *   NULL, which will cause this object to determine the site based on the
  *   request information.
  */
 public function __construct($root, $use_file_cache = TRUE, $profile_directories = NULL, $site_path = NULL)
 {
     $this->root = $root;
     $this->profileDirectories = $profile_directories;
     $this->sitePath = $site_path;
     // Invalidate the cache if we're using a new root directory. We must do this
     // since $files is static.
     if ($this->root != static::$cacheRoot) {
         static::$files = [];
         static::$cacheRoot = $this->root;
     }
 }
开发者ID:paul-m,项目名称:drupal-merge-plugin,代码行数:28,代码来源:ExtensionDiscovery.php


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