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


PHP Loader::getInstance方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     // Loader initialiseren
     $this->_loader = Loader::getInstance();
     // input class initialiseren
     $this->_input = new Input();
 }
开发者ID:liesenborghspuntkristof,项目名称:Jurassic_Terrarium,代码行数:7,代码来源:Controller.php

示例2: __construct

 function __construct()
 {
     $this->titan = Loader::getInstance();
     // Get config elements
     $this->config = $this->titan->config('cache');
     // Set configurations
     $this->path = APP_DIR . $this->config['path'];
     $this->extension = $this->config['extension'];
     $this->default_expire_time = $this->config['default_expire_time'];
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:10,代码来源:Cache.php

示例3: __construct

 function __construct()
 {
     $this->titan = Loader::getInstance();
     if (ENVIRONMENT != 'production') {
         $this->config = $this->titan->config('db', 'dev');
     } else {
         $this->config = $this->titan->config('db');
     }
     require_once SYSTEM_DIR . 'plugins/Database.php';
     $this->db = Database::init($this->config);
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:11,代码来源:Model.php

示例4: __construct

 function __construct()
 {
     // Configurations for security
     ini_set('session.cookie_httponly', 1);
     ini_set('session.use_only_cookies', 1);
     $this->titan = Loader::getInstance();
     // Getting config elements
     $this->config = $this->titan->config('config');
     // Initialize Session
     $this->init();
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:11,代码来源:Session.php

示例5: __

function __($string, $variables = NULL)
{
    $filename = 'Locale/' . $_SESSION['lang' . APPKEY] . '.po';
    $loader = Loader::getInstance();
    $match = $loader->load($filename);
    $string = htmlspecialchars($string);
    $find = preg_match('/msgid "(' . $string . ')"\\nmsgstr "(.+)"/', $match, $matches);
    $find = htmlspecialchars_decode($find);
    if ($find) {
        return vsprintf($matches[2], $variables);
    } else {
        return vsprintf($string, $variables);
    }
}
开发者ID:AnaClaudiaConde,项目名称:teste-lazyphp,代码行数:14,代码来源:locale.php

示例6: customMapping

 /**
  * 自定义路由
  * @param $uri
  * @return bool|int|string
  */
 private function customMapping($uri)
 {
     $mappings = Loader::getInstance()->getConfig(self::CONFIG_N_MAPPINGS, self::CONFIG_F_ROUTER);
     //将url与controller进行映射
     $matches = array();
     foreach ($mappings as $class_name => $mapping) {
         foreach ($mapping as $pattern) {
             $pattern = str_replace('/', '\\/', $pattern);
             if (preg_match("/{$pattern}/i", $uri, $matches)) {
                 Application::getInstance()->getDispatcher()->getRequest()->setRouterMatches($matches);
                 return $class_name;
             }
         }
     }
     return false;
 }
开发者ID:zhxia,项目名称:nspf,代码行数:21,代码来源:Router.php

示例7: __construct

 /**
  * Constructor for the core
  * it loads in all configuration and interfaces
  * and then continues to load all components.
  * When that's done the Loader component will be loaded in an instructed
  * to load the designated controller.
  */
 public function __construct()
 {
     // Include all configurations
     require_once "application/config/config.php";
     require_once "application/config/database.php";
     // Include all interfaces
     require_once "system/interfaces/isystemcomponent.php";
     require_once "system/interfaces/isystemcomponentdatacompatible.php";
     require_once "system/interfaces/icontroller.php";
     require_once "system/interfaces/imodel.php";
     require_once "system/interfaces/itable.php";
     // Include all components
     $sysFiles = glob("system/components/*.php");
     foreach ($sysFiles as $file) {
         require_once $file;
     }
     /*
      * If controller is not set default to
      * the default controller.
      * If the controller is set we use it. 
      */
     if (!isset($_GET["c"])) {
         $_GET["c"] = DEFAULT_CONTROLLER;
     }
     // Check for the controller's actual file.
     if (!file_exists("application/controllers/" . $_GET["c"] . ".php")) {
         if (DEBUG_MODE) {
             die("Couldn't find controller: " . $_GET["c"] . " :(");
         }
     }
     // Get it.
     require_once "application/controllers/" . $_GET["c"] . ".php";
     // Link it, detach the GET request and add the Controller affix.
     $controllerActual = $_GET["c"] . "Controller";
     $_GET["c"] = null;
     // Define the loader
     $this->load = Loader::getInstance();
     // Register the loader to the core
     self::$loader = Loader::getInstance();
     // Use the loader to load the controller
     $this->load->controller($controllerActual);
 }
开发者ID:kveler,项目名称:webchat,代码行数:49,代码来源:core.php

示例8: lang

 function lang($file = '', $key = '', $change = '')
 {
     global $lang;
     $titan = Loader::getInstance();
     $config = $titan->config('language');
     if (!is_string($file) || !is_string($key)) {
         return false;
     }
     $appLangDir = APP_DIR . 'languages/' . strtolower($config['languages'][get_lang()]) . '/' . strtolower($file) . '.php';
     $sysLangDir = SYSTEM_DIR . 'languages/' . strtolower($config['languages'][get_lang()]) . '/' . strtolower($file) . '.php';
     if (file_exists($appLangDir)) {
         require_once $appLangDir;
     } elseif (file_exists($sysLangDir)) {
         require_once $sysLangDir;
     }
     $zone = strtolower($file);
     if (array_key_exists($key, $lang[$zone])) {
         $str = $lang[$zone][$key];
         // Change special words
         if (!is_array($change)) {
             if (!empty($change)) {
                 return str_replace('%s', $change, $str);
             } else {
                 return $str;
             }
         } else {
             if (!empty($change)) {
                 $keys = [];
                 $vals = [];
                 foreach ($change as $key => $value) {
                     $keys[] = $key;
                     $vals[] = $value;
                 }
                 return str_replace($keys, $vals, $str);
             } else {
                 return $str;
             }
         }
     } else {
         return false;
     }
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:42,代码来源:Functions.php

示例9: bootstrap

 public function bootstrap()
 {
     $bootstrapClass = Bootstrap_Abstract::YAF_DEFAULT_BOOTSTRAP;
     if (isset($this->_options['bootstrap'])) {
         $bootstrap = $this->_options['bootstrap'];
     } else {
         $bootstrap = $this->getAppDirectory() . DIRECTORY_SEPARATOR . $bootstrapClass . '.' . G::get('ext');
     }
     $loader = Loader::getInstance();
     if (Loader::import($bootstrap)) {
         if (!class_exists($bootstrapClass)) {
             throw new Exception('Couldn\'t find class Bootstrap in ' . $bootstrap);
         } else {
             $bootstrap = new $bootstrapClass();
             if (!$bootstrap instanceof Bootstrap_Abstract) {
                 throw new Exception('Expect a Yaf_Bootstrap_Abstract instance, ' . get_class($bootstrap) . ' give ');
             }
             if (version_compare(PHP_VERSION, '5.2.6') === -1) {
                 $class = new \ReflectionObject($bootstrap);
                 $classMethods = $class->getMethods();
                 $methodNames = array();
                 foreach ($classMethods as $method) {
                     $methodNames[] = $method->getName();
                 }
             } else {
                 $methodNames = get_class_methods($bootstrap);
             }
             $initMethodLength = strlen(Bootstrap_Abstract::YAF_BOOTSTRAP_INITFUNC_PREFIX);
             foreach ($methodNames as $method) {
                 if ($initMethodLength < strlen($method) && Bootstrap_Abstract::YAF_BOOTSTRAP_INITFUNC_PREFIX === substr($method, 0, $initMethodLength)) {
                     $bootstrap->{$method}($this->_dispatcher);
                 }
             }
         }
     } else {
         throw new Exception('Couldn\'t find bootstrap file ' . $bootstrap);
     }
     return $this;
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:39,代码来源:Application.php

示例10: __construct

 public function __construct()
 {
     $this->titan = Loader::getInstance();
     // Getting config file
     $this->config = $this->titan->config('config');
     // Setting default controller and method
     $this->controller = $this->config['default_controller'];
     $this->method = $this->config['default_method'];
     // Setting controller directory
     if ($this->config['default_directory']) {
         $this->directory = 'controllers/' . $this->config['default_directory'] . '/';
     } else {
         $this->directory = 'controllers/';
     }
     // Getting current URL
     $this->url = $this->parseURL();
     // Getting routes
     $this->routes = $this->titan->config('routes');
     if ($this->run() === false) {
         // Getting Controller
         $this->set_controller($this->url);
         // Getting Method
         $this->set_action($this->url);
         // Getting parameters
         $this->set_params($this->url);
     }
     // Composer Autoload
     if ($this->config['composer'] == true) {
         if (file_exists('vendor/autoload.php')) {
             require_once 'vendor/autoload.php';
         } else {
             echo '<span style="color:#bc5858;"><strong>UYARI:</strong> Composer yükleyicisi bulunamadı.</span>';
         }
     }
     call_user_func_array([$this->controller, $this->method], $this->params);
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:36,代码来源:App.php

示例11: __construct

 public function __construct()
 {
     $this->loader = Loader::getInstance();
 }
开发者ID:GillesAzais,项目名称:lokale_bak,代码行数:4,代码来源:Controller.php

示例12: __construct

 function __construct()
 {
     $this->titan = Loader::getInstance();
     // Getting config elements
     $this->config = $this->titan->config('config');
 }
开发者ID:tkaratug,项目名称:titan-mvc,代码行数:6,代码来源:Cookie.php

示例13: initialize

 protected function initialize()
 {
     $arrConf = Loader::getInstance()->getConfig();
     if ($arrConf) {
         //初始化插件列表
         if (isset($arrConf['plugins'])) {
             foreach ($arrConf['plugins'] as $p) {
                 $plugin = new $p();
                 $this->_dispatcher->addPlugin($plugin);
             }
         }
         //初始化请求类
         if (isset($arrConf['request_class']) && $arrConf['request_class']) {
             $request = new $arrConf['request_class']();
             $this->_dispatcher->setRequest($request);
         }
         //初始化响应类
         if (isset($arrConf['response_class']) && $arrConf['response_class']) {
             $response = new $arrConf['response_class']();
             $this->_dispatcher->setResponse($response);
         }
         //初始化试图类
         if (isset($arrConf['view_class']) && $arrConf['view_class']) {
             $view = new $arrConf['view_class']();
             $this->_dispatcher->setView($view);
         }
         if (isset($arrConf['enable_debug']) && $arrConf['enable_debug']) {
             $this->setDebugEnabled(true);
         }
     }
 }
开发者ID:zhxia,项目名称:nspf,代码行数:31,代码来源:Application.php

示例14: getSession

 /**
  * @return Session
  */
 public function getSession()
 {
     return Loader::getInstance()->get('Session');
 }
开发者ID:sayi21cn,项目名称:apify-library,代码行数:7,代码来源:Request.php

示例15: dispatch

 /**
  * 请求分发
  */
 public function dispatch()
 {
     if (!$this->_request) {
         $this->_request = new Request();
     }
     if (!$this->_response) {
         $this->_response = new Response();
     }
     if (!$this->_router) {
         $this->_router = new Router();
     }
     if (!$this->_view) {
         $this->_view = new View();
     }
     //router startup
     $this->executePlugins(Plugin::STEP_ROUTER_STARTUP);
     $class = $this->_router->mapping();
     //router shutdown
     $this->executePlugins(Plugin::STEP_ROUTER_SHUTDOWN);
     $controller = new $class();
     //dispatchloop startup
     $this->executePlugins(Plugin::STEP_DISPATCH_LOOP_STARTUP);
     //load current controller's interceptors
     self::$_interceptors = Loader::getInstance()->loadInterceptors($class);
     $this->executeInterceptor(Interceptor::INVOKE_BEFORE);
     while (true) {
         //preDispatch
         $this->executePlugins(Plugin::STEP_DISPATCH_STARTUP);
         $result = $controller->execute();
         //postDispatch
         $this->executePlugins(Plugin::STEP_DISPATCH_SHUTDOWN);
         if ($result instanceof Controller) {
             $controller = $result;
             continue;
         }
         break;
     }
     if (empty($result)) {
         //尝试根据controller名字自动加载视图
         $result = $this->getAutoView($class);
     }
     if (is_string($result)) {
         $this->_view->display($result);
     }
     $this->executeInterceptor(Interceptor::INVOKE_AFTER);
     //dispatch loop shutdown
     $this->executePlugins(Plugin::STEP_DISPATCH_LOOP_SHUTDOWN);
 }
开发者ID:zhxia,项目名称:nspf,代码行数:51,代码来源:Dispatcher.php


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