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


PHP loader::get_root方法代码示例

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


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

示例1: __construct

 function __construct($base = null)
 {
     if (!$base) {
         $base = loader::get_root() . '../cache/';
     }
     $this->set_root($base);
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:7,代码来源:sape_cacher.php

示例2: connect

 /**
  * @param array
  *   server = path to file
  */
 function connect()
 {
     if (!class_exists('SQLite3', 0)) {
         throw new dbal_exception('Sqlite support not compiled with PHP!');
     }
     if (empty($this->dbname)) {
         throw new dbal_exception('Sqlite connect empty database!');
     }
     // check is relative path (to site root)
     // $dbname = (substr($this->dbname, 0, 1) == '/')
     //    ? substr($this->dbname, 1)
     //    : ('../' . $this->dbname);
     $this->_db_file = loader::get_root($this->dbname);
     if (!file_exists($this->_db_file)) {
         throw new dbal_exception('No database: ' . $this->_db_file);
     }
     core::dprint(array('CONNECT %s %s', __CLASS__, $this->_db_file), core::E_SQL);
     $error = '';
     $this->_connect_id = new SQLite3($this->_db_file, SQLITE3_OPEN_READWRITE);
     if ($this->_connect_id) {
         $this->_connect_id->exec('PRAGMA short_column_names = 1');
         $this->_connect_id->exec('PRAGMA encoding = "UTF-8"');
     } else {
         throw new dbal_exception('Cant connect to database ' . $this->_db_file);
     }
     return $this->_connect_id;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:31,代码来源:sqlite3.php

示例3: configure

 /**
  * To disable chroot
  * [lib_sape_cacher]
  * root = cache
  * 
  * @param mixed $config
  */
 function configure($config)
 {
     if (isset($config['root'])) {
         $this->set_root(loader::get_root($config['root'] . '/'));
     }
     if (isset($config['subdir_length'])) {
         $this->subdir_length = $config['subdir_length'];
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:16,代码来源:sape_cacher.php

示例4: __construct

 /**
  * Create
  */
 function __construct()
 {
     $memcache_domain = 'i' . substr(md5(loader::get_root()), 27);
     try {
         $this->engines['mem'] = new MultiCacheMemcache();
         $this->engines['mem']->set_domain($memcache_domain);
     } catch (exception $e) {
         // no memcache
         $this->engines['mem'] = false;
     }
     $this->engines['file'] = new MultiCacheFile();
     $this->engines['file']->cacheDir = loader::get_root() . '../cache/system';
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:16,代码来源:cache.php

示例5: register

 /**
  * Register module
  * @throws modules_exception
  * @return object|bool module
  */
 public function register($module)
 {
     core::dprint('[mod_register] ' . $module);
     $module_class = loader::CLASS_PREFIX . $module;
     $module_path = loader::get_root() . loader::DIR_MODULES . $module . '/';
     $module_file = $module_path . 'module' . loader::DOT_PHP;
     if (!fs::file_exists($module_file)) {
         throw new modules_exception('Failed to register module ' . $module . '. File does not exists');
     }
     require_once $module_file;
     $this->set($module, new $module_class($module_path));
     return $this->get($module);
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:18,代码来源:modules.php

示例6: __construct

 function __construct($config)
 {
     $this->_config = $config;
     $this->persistency = @$config['persistency'];
     $this->user = $config['login'];
     $this->password = $config['password'];
     $this->server = isset($config['server']) ? $config['server'] : 'localhost';
     $this->dbname = $config['database'];
     $this->prefix = $config['prefix'];
     $this->root = loader::get_root();
     if (is_callable(array($this, 'configure'))) {
         $this->configure($config);
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:14,代码来源:mysql.php

示例7: set_template

 /**
  * Set root
  */
 static function set_template($template)
 {
     if (defined('IN_EDITOR')) {
         self::$template_dir = loader::get_root() . loader::DIR_EDITOR . loader::DIR_TEMPLATES;
     } else {
         self::$template_dir = loader::get_root() . loader::DIR_TEMPLATES . $template;
     }
     self::$parser->template_dir = self::$template_dir;
     /*
      * If using template, compile directory must exists /cache/tpl/{template}
      */
     $c_postfix = defined('IN_EDITOR') ? 'editor/' : $template . '/';
     self::$parser->compile_dir = loader::get_root() . loader::DIR_TEMPLATES_C . $c_postfix;
     self::$parser->cache_dir = loader::get_root() . loader::DIR_TEMPLATES_C . $c_postfix;
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:18,代码来源:tplparser.php

示例8: get_doctrine

 /**
  * Create a database handle
  * Factory method
  * @param array params
  *  engine - pdo
  *      type - mysql
  *
  * @return \Doctrine\DBAL\Connection
  */
 public static function get_doctrine($id = self::DEFAULT_CONNECTION, array $config = array())
 {
     if (empty($config) && !isset(self::$dbs[$id])) {
         throw new dbal_exception('Try to get unloaded db connection : ' . $id);
     }
     $engine = @$config['engine'] ?: 'pdo_mysql';
     if (isset(self::$dbs[$id])) {
         return self::$dbs[$id];
     }
     core::dprint('[dbloader|doctrine::get] ' . $id . '(' . $engine . ')');
     if ($engine == 'null') {
         if (!class_exists('null_db', 0)) {
             require "modules/core/dbal/null.php";
         }
         $conn = new null_db();
         self::$dbs[$id] = $conn;
     } else {
         $d_config = new \Doctrine\DBAL\Configuration();
         $d_config->setSQLLogger(new \SatCMS\Modules\Core\Dbal\Doctrine\Logger());
         /*
         *    'dbname'    => @$config['database']
            , 'user'      => @$config['login'] ?: 'root'
            , 'password'  => @$config['password']
            , 'host'      => @$config['server'] ?: 'localhost'
            , 'driver'    => $engine
            , 'path'      => (isset($config['path']) ? loader::get_root($config['path']) : null)
         */
         $connection_params = array('driver' => $engine, 'prefix' => @$config['prefix'], 'charset' => 'UTF8');
         unset($config['engine']);
         // fix path
         if (isset($config['path'])) {
             $config['path'] = loader::get_root($config['path']);
         }
         // merge params
         $connection_params = array_merge($connection_params, $config);
         core::dprint_r($connection_params);
         try {
             $conn = \Doctrine\DBAL\DriverManager::getConnection($connection_params, $d_config);
             self::$dbs[$id] = $conn;
         } catch (Exception $e) {
             core::dprint($e->getMessage());
             return false;
         }
     }
     return self::$dbs[$id];
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:55,代码来源:db_loader.php

示例9: get

 /**
  * Create a database handle
  * Factory method
  * @param array params
  */
 public static function get(array $config)
 {
     $engine = $config['engine'];
     if (isset(self::$dbs[$engine])) {
         return self::$dbs[$engine];
     }
     $engine_script = loader::get_root() . loader::DIR_MODULES . 'core/dbal/' . $engine . loader::DOT_PHP;
     core::dprint('[db] ' . $engine_script);
     fs::req($engine_script, true);
     if (!isset($config['server'])) {
         $config['server'] = 'localhost';
     }
     // create instance
     $class = "{$engine}_db";
     try {
         return self::$dbs[$engine] = new $class($config['server'], $config['login'], $config['password'], $config['database'], $config['prefix']);
     } catch (dbal_exception $e) {
         return false;
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:25,代码来源:database.php

示例10: configure

 /**
  * To disable chroot
  * [lib_cache]
  * file_root = cache/system 
  * 
  * @param mixed $c
  */
 function configure($c)
 {
     if (isset($c['file_root'])) {
         $this->cacheDir = loader::get_root($c['file_root']);
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:13,代码来源:file.php

示例11: ini_set

*/
// header("X-LIGHTTPD-send-file: " . $_GET['id']);
// header("X-Sendfile: " . $_GET['id']);
// header("X-Sendfile: /home/thumb/lexiclips.com/public_html/uploads/videos/original/48.mp4");
require "../modules/core/loader.php";
core::set_debug(666);
ini_set('display_errors', 'on');
error_reporting(E_ALL);
$core = core::get_instance();
if (($user = core::lib('auth')->get_user()) && !$user->payd_user) {
    die('Restricted');
} else {
    // Send file
    $id = functions::request_var('id', '');
    $file = loader::get_root() . substr($id, 1);
    if (strpos($id, '/uploads/videos') !== false && ($file = loader::get_root() . substr($id, 1)) && file_exists($file) && is_readable($file)) {
        $mime_type = 'video/mp4';
        // 'video/H264';
        if (false !== strpos($id, 'videos/original')) {
            $mime_type = "application/force-download";
        }
        //header('Content-disposition: attachment;filename="' . (basename($file)) . '";');
        header('Content-type: ' . $mime_type);
        header('Content-length: ' . filesize($file));
        header("X-LIGHTTPD-send-file: " . $file);
        die;
        // readfile($file);
    } else {
        header(' ', true, 403);
        echo "Restticted";
    }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:31,代码来源:index.php

示例12: create_upload_dir

 /**
  * Create uploads
  */
 function create_upload_dir()
 {
     if ($dir = $this->get_uploads_path()) {
         $dir = loader::get_root() . $dir;
         return mkdir($dir, 0770);
     }
     return false;
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:11,代码来源:item.php

示例13: define

<?php

/**
 * Sape interface
 * 
 * @package    TwoFace
 * @author     Golovkin Vladimir <r00t@skillz.ru> http://www.skillz.ru
 * @copyright  SurSoft (C) 2008
 * @version    $Id: sape.php,v 1.2 2009/08/05 08:45:21 surg30n Exp $
 */
$_su = core::get_instance()->get_cfg_var('sape_user');
if (!empty($_su)) {
    if (!defined('_SAPE_USER')) {
        define(_SAPE_USER, $_su);
    }
    require_once loader::get_root() . $_su . '/sape.php';
}
if (!class_exists('SAPE_client')) {
    class SAPE_client
    {
        function SAPE_client($p = array())
        {
            // mock
            core::dprint('[LIB_SAPE] Using mock', core::E_ERROR);
        }
    }
}
class sape extends SAPE_client
{
    function __construct()
    {
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:31,代码来源:sape.php

示例14: set_template

 /**
  * Set root
  */
 static function set_template($template)
 {
     if (core::in_editor()) {
         self::$template_dir = loader::get_public() . loader::DIR_EDITOR . loader::DIR_TEMPLATES;
     } else {
         self::$template_dir = loader::get_public() . loader::DIR_TEMPLATES . $template;
     }
     self::$parser->template_dir = self::$template_dir;
     /*
      * If using template, compile directory must exists /cache/tpl/{template}
      */
     $c_postfix = core::in_editor() ? 'editor/' : $template . '/';
     self::$parser->compile_dir = loader::get_root(loader::DIR_TEMPLATES_C . $c_postfix);
     self::$parser->cache_dir = loader::get_root(loader::DIR_TEMPLATES_C . $c_postfix);
     if (!file_exists(self::$parser->compile_dir)) {
         mkdir(self::$parser->compile_dir, 0777, true);
         // chmod this right
     }
     /*
     if (!file_exists(self::$parser->cache_dir)) {            
         mkdir(self::$parser->cache_dir, 0777, true); // chmod this right
     }
     */
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:27,代码来源:tpl_loader.php

示例15: import_langwords

 /** 
  * Parse module langwords into one
  * huge array. Used in templates later.
  * Module lang start with m_
  * [lang.var]
  */
 public function import_langwords($module)
 {
     $lang = $this->get_cfg_var('lang');
     $lang_file = loader::get_root() . loader::DIR_MODULES . $module . '/' . loader::DIR_LANGS . $lang;
     if (fs::file_exists($lang_file)) {
         $temp = parse_ini_file($lang_file, true);
         self::dprint('[LANG_INCLUDE] ' . $lang_file . " (x" . count($temp) . ")");
         if ('core' == $module) {
             $this->langwords = array_merge_recursive($this->langwords, $temp);
         } else {
             $this->langwords['m_'][$module] = $temp;
         }
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:20,代码来源:core.php


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