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


PHP Loader::addPath方法代码示例

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


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

示例1: testAdditionalPathAfterInitialRegister

 public function testAdditionalPathAfterInitialRegister()
 {
     Loader::register();
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'controller' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS . 'exceptions' . DS));
     Loader::addPath(THINKUP_ROOT_PATH . 'tests' . DS . 'classes');
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'controller' . DS, THINKUP_WEBAPP_PATH . '_lib' . DS . 'model' . DS . 'exceptions' . DS, THINKUP_ROOT_PATH . 'tests' . DS . 'classes'));
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:7,代码来源:TestOfLoader.php

示例2: testAdditionalPathAfterInitialRegister

 public function testAdditionalPathAfterInitialRegister()
 {
     Loader::register();
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib/model/', THINKUP_WEBAPP_PATH . '_lib/controller/', THINKUP_WEBAPP_PATH . '_lib/model/exceptions/'));
     Loader::addPath(THINKUP_ROOT_PATH . 'tests/classes');
     $this->assertEqual(Loader::getLookupPath(), array(THINKUP_WEBAPP_PATH . '_lib/model/', THINKUP_WEBAPP_PATH . '_lib/controller/', THINKUP_WEBAPP_PATH . '_lib/model/exceptions/', THINKUP_ROOT_PATH . 'tests/classes'));
 }
开发者ID:randi2kewl,项目名称:ThinkUp,代码行数:7,代码来源:TestOfLoader.php

示例3: addPath

 * @package core
 * @author stefano.azzolini@caffeinalab.com
 * @version 1.0
 * @copyright Caffeina srl - 2014 - http://caffeina.co
 */
namespace phpcore;

class Loader
{
    protected static $paths = [];
    public static function addPath($path, $name = null)
    {
        static::$paths[$path] = $name;
    }
    public static function register()
    {
        ini_set('unserialize_callback_func', 'spl_autoload_call');
        spl_autoload_register(function ($class) {
            $cfile = strtr($class, '_\\', '//') . '.php';
            foreach (static::$paths as $path => $v) {
                $file = rtrim($path, '/') . '/' . $cfile;
                if (is_file($file)) {
                    return include $file;
                }
            }
            return false;
        }, false, true);
    }
}
Loader::addPath(__DIR__);
Loader::register();
开发者ID:evil-enterprises,项目名称:phpcore,代码行数:31,代码来源:Loader.php

示例4: initalizeApp

 /**
  * Initalize app
  * Load config file and required plugins
  * @throws Exception
  */
 private function initalizeApp()
 {
     $classname = get_class($this);
     if ($classname != "InstallerController") {
         //Initialize config
         $config = Config::getInstance();
         if ($config->getValue('debug')) {
             ini_set("display_errors", 1);
             ini_set("error_reporting", E_STRICT);
         }
         if ($classname != "BackupController") {
             //Init plugins
             $plugin_dao = DAOFactory::getDAO('PluginDAO');
             $active_plugins = $plugin_dao->getActivePlugins();
             Loader::definePathConstants();
             foreach ($active_plugins as $active_plugin) {
                 //add plugin's model and controller folders as Loader paths here
                 Loader::addPath(THINKUP_WEBAPP_PATH . 'plugins/' . $active_plugin->folder_name . "/model/");
                 Loader::addPath(THINKUP_WEBAPP_PATH . 'plugins/' . $active_plugin->folder_name . "/controller/");
                 //require the main plugin registration file here
                 if (file_exists(THINKUP_WEBAPP_PATH . 'plugins/' . $active_plugin->folder_name . "/controller/" . $active_plugin->folder_name . ".php")) {
                     require_once THINKUP_WEBAPP_PATH . 'plugins/' . $active_plugin->folder_name . "/controller/" . $active_plugin->folder_name . ".php";
                 }
             }
         }
     }
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:32,代码来源:class.ThinkUpController.php

示例5: initalizeApp

 /**
  * Initalize app
  * Load config file and required plugins
  * @throws Exception
  */
 private function initalizeApp()
 {
     if (get_class($this) != "InstallerController") {
         //Initialize config
         $config = Config::getInstance();
         if ($config->getValue('timezone')) {
             date_default_timezone_set($config->getValue('timezone'));
         }
         if ($config->getValue('debug')) {
             ini_set("display_errors", 1);
             ini_set("error_reporting", E_ALL);
         }
         //Init plugins
         $pdao = DAOFactory::getDAO('PluginDAO');
         $active_plugins = $pdao->getActivePlugins();
         foreach ($active_plugins as $ap) {
             Utils::defineConstants();
             //add plugin's model and controller folders as Loader paths here
             Loader::addPath(THINKUP_WEBAPP_PATH . 'plugins/' . $ap->folder_name . "/model/");
             Loader::addPath(THINKUP_WEBAPP_PATH . 'plugins/' . $ap->folder_name . "/controller/");
             //require the main plugin registration file here
             require_once THINKUP_WEBAPP_PATH . 'plugins/' . $ap->folder_name . "/controller/" . $ap->folder_name . ".php";
         }
     }
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:30,代码来源:class.ThinkUpController.php

示例6: Setup

 /**
  * Set up class properties etc.
  */
 private function Setup()
 {
     // place for additional sets
     // e.g. $this->aConfig[ section_key ][ value_key ] = value
     $sAppConfigIni = DOCROOT . $this->oConfig->getValue(sprintf('applications.%s.config_file', $this->oRouter->getApplicationName()));
     $this->oConfig->loadIniFile($sAppConfigIni);
     $this->sLogsDirectory = $this->getConfig('General.Logs_directory', DOCROOT . 'logs/');
     $this->sLogsDirectory .= date('Y-m-d') . '/';
     // set main framework path
     $this->addPath('Lithium');
     // set application path received from config file
     if ($sAppPath = $this->getConfig('General.App_path')) {
         $this->addPath($sAppPath);
         Loader::addPath(DOCROOT . $sAppPath);
     }
     // add path for external classes
     Loader::addPath(DOCROOT);
     // set language
     if ($sLanguage = $this->getConfig('Locale.Language')) {
         $this->sLanguage = $sLanguage;
     }
     Core_Model::setLithium($this);
     Core_Module::setLithium($this);
     Database_Driver::setLithium($this);
     // initialize router
     $this->oRouter->init();
     View::setRouter($this->oRouter);
     Module_Sorter::setRouter($this->oRouter);
     Module_Pagination::setRouter($this->oRouter);
 }
开发者ID:maxwroc,项目名称:PHP,代码行数:33,代码来源:Lithium.php

示例7: setModule

 /**
  * Add module name to autoloader
  * @param  string $module 
  * @return void
  */
 private function setModule($module)
 {
     self::$module = $module;
     \Loader::addPath($module, "api/{$module}");
 }
开发者ID:arthurkhlghatyan,项目名称:scaler,代码行数:10,代码来源:Manager.php

示例8: define

<?php

/**
 * Front Controller
 */
define('APP_DIR', dirname(__DIR__));
define('APP_MODE_CLI', false);
require APP_DIR . '/vendor/autoload.php';
$_response_send = new Deferred(function () {
    Response::sent() || Response::send();
});
// Load Classes
Loader::addPath(APP_DIR . '/classes');
// Load options
Options::loadPHP(APP_DIR . '/config.php');
// Temp directory
define('TEMP_DIR', Options::get('cache.directory', sys_get_temp_dir()));
// Caching strategy
Cache::using(['files' => ['cache_dir' => TEMP_DIR]]);
// Init Views
View::using(new View\Twig(APP_DIR . '/templates', ['cache' => Options::get('cache.views', true) ? TEMP_DIR : false, 'auto_reload' => Options::get('debug', false)]));
View::addGlobals(['BASE_URL' => rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/', 'CACHEBUST' => Options::get('debug', false) ? '?v=' . time() : '']);
// App bootstrap
include APP_DIR . '/boot.php';
Event::trigger('app.run');
// Routes
foreach (glob(APP_DIR . '/routes/*.php') as $routedef) {
    include $routedef;
}
Event::trigger('app.dispatch');
Route::dispatch();
开发者ID:caffeina-core,项目名称:base-application,代码行数:31,代码来源:index.php


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