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


PHP FileSystem::getInstance方法代码示例

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


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

示例1: init

 /**
  * Initialize the application
  */
 public function init()
 {
     // Load the application configuration
     $this->singleton('conf', Conf::getInstance());
     // Load the application error Handler
     $this->singleton('errorHandler', ErrorHandler::getInstance());
     // Load the application logger
     $this->singleton('logger', Logger::getInstance());
     // Load the filesystem library
     $this->singleton('fs', FileSystem::getInstance());
     // Load the application session
     $this->singleton('session', Session::getInstance());
     // Load the application router
     $this->singleton('router', Router::getInstance());
     // Load the application HTTP request
     $this->singleton('request', Request::getInstance());
     // Load the application HTTP response
     $this->singleton('response', Response::getInstance());
     // Load the application cache
     $this->singleton('cache', Cache::getInstance());
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:24,代码来源:App.php

示例2: error_log

    }
    if (!$fs->create($thumb_location, "NO_OP", "NO_OP")) {
        error_log("Error copying thumb " . $thumb_location);
    }
    unlink($user_image_location);
    unlink($thumb_location);
}
// 10. Save literature file to storage
if ($literature_name != "") {
    $lit_resourcedir = '/tmp/';
    $upload_literature_location = $lit_resourcedir . $modified_literature_name;
    if (!move_uploaded_file($_FILES['upload_literature']['tmp_name'], $upload_literature_location)) {
        throw new Exception("Error moving uploaded file to {$upload_literature_location}");
    }
    if (!isset($fs)) {
        $fs = FileSystem::getInstance();
    }
    if (!$fs->create($upload_literature_location, "NO_OP", "NO_OP")) {
        error_log("Error copying literature " . $upload_literature_location);
    }
    unlink($upload_literature_location);
}
// 11. Update the image names back to the database.
// Note: this update is in it's own transaction, after the images are
// properly stored. It is a single statement transaction and with autocommit
// on, we do not need to start and commit.
if (isset($_POST['addeventsubmit'])) {
    $updatese = new ColumnFamily($conn, 'SOCIALEVENT');
    $updatese->insert($eventid, array('imageurl' => $modified_image_name, 'imagethumburl' => $imagethumb, 'literatureurl' => $modified_literature_name));
} else {
    if (isset($_POST['addeventsubmitupdate'])) {
开发者ID:njanani,项目名称:olio-cassandra,代码行数:31,代码来源:addEventResult.php

示例3: plugin_dir_url

 *
 * @wordpress-plugin
 * Plugin Name:       SilverWp
 * Description:       SilverWp is a framework to help developers create themes or plugins
 * Version:           0.1
 * Author:            Michal Kalkowski
 * Author URI:        http://www.silversite.pl/
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       silverwp
 * Domain Path:       /languages
 */
namespace SilverWp;

// Exit if accessed directly
if (!defined('ABSPATH')) {
    die;
}
require_once 'vendor/autoload.php';
try {
    SilverWp::getInstance()->isPlugin(new \SilverWp\Plugin());
    $views = SILVERWP_LIBS_PATH . 'ssvafpress/views';
    $assets_uri = plugin_dir_url(__FILE__) . 'assets';
    FileSystem::getInstance()->addDirectory('assets_uri', $assets_uri);
    FileSystem::getInstance()->addDirectory('views', $views);
    Translate::$language_path = plugin_dir_path(__FILE__) . 'languages/';
    Translate::$text_domain = 'silverwp';
    Translate::init();
} catch (\SilverWp\Exception $ex) {
    $ex->catchException();
}
开发者ID:silversite,项目名称:silverwp,代码行数:31,代码来源:silverwp.php

示例4: load

 /**
  * Load a file containing the wanted class
  *
  * @param string $classname The class to load
  */
 public static function load($classname)
 {
     // Load the cache file for the first time the autload is called
     if (empty(self::$cache) && is_file(Cache::getInstance()->getCacheFilePath(self::CACHE_FILE))) {
         self::$cache = Cache::getInstance()->includeCache(self::CACHE_FILE);
     }
     // Check the class file is registered in cache
     if (isset(self::$cache[$classname])) {
         // The file is registered in cache, include it, and exit the function
         include self::$cache[$classname];
         return true;
     }
     $parts = explode('\\', $classname);
     if (count($parts) > 1) {
         $namespace = implode('\\', array_slice($parts, 0, -1));
     } else {
         $namespace = '';
     }
     $class = end($parts);
     $filename = "{$class}.php";
     // The file is not registered in cache, let's find it. Any class file must be as <classname>.php
     $dirs = array();
     $searchDirectories = array('Hawk' => array(LIB_DIR, CUSTOM_LIB_DIR), 'Hawk\\View\\Plugins' => array(LIB_DIR . 'view-plugins/'), '' => array(LIB_DIR . 'ext', CUSTOM_LIB_DIR));
     if (isset($searchDirectories[$namespace])) {
         $dirs = $searchDirectories[$namespace];
     } elseif (strpos($namespace, 'Hawk\\Plugins\\') === 0) {
         // Find the plugins associated to this namespace
         $plugins = Plugin::getAll();
         foreach ($plugins as $plugin) {
             if ($plugin->getNamespace() === $namespace) {
                 $dirs = array($plugin->getRootDir());
                 break;
             }
         }
     } else {
         // If the class exists, it is in custom-libs directory
         $dirs = array(CUSTOM_LIB_DIR, LIB_DIR . 'ext/');
     }
     // Cross any search folder to find out the class file
     foreach ($dirs as $dir) {
         $files = FileSystem::getInstance()->find($dir, $filename, FileSystem::FIND_FILE_ONLY);
         if (!empty($files)) {
             $file = $files[0];
             // The class file has been found, include it
             include $file;
             // Register this file, associated to the class name, in cache
             self::$cache[$classname] = $file;
             self::$cacheUpdated = true;
             return true;
         }
     }
     if (strpos($namespace, 'Hawk\\Plugins\\') === 0) {
         // If the class is an hawk class called from a plugin ,
         // create an alias from the Hawk class to the plugin namespace
         $alias = '\\Hawk\\' . $class;
         if (class_exists($alias) || trait_exists($alias)) {
             class_alias($alias, $classname);
             return true;
         }
     }
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:66,代码来源:autoload.php


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