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


PHP App::config方法代码示例

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


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

示例1: createApplication

 /**
  * @param string $config
  *
  * @return \Songbird\App
  */
 public static function createApplication($config = '')
 {
     $app = new App(require __DIR__ . '/../config/di.php');
     $app->add('Config', new Config($config));
     $app->add('Symfony\\Component\\HttpFoundation\\Response', new Response());
     $app->add('Symfony\\Component\\HttpFoundation\\Request', Request::createFromGlobals());
     $app->add('Filesystem', 'League\\Flysystem\\Filesystem')->withArgument(new CachedAdapter(new Adapter($app->config('app.paths.resources')), new CacheStore()));
     $app->get('Logger')->pushHandler(new StreamHandler(vsprintf('%s/songbird-%s.log', [$app->config('app.paths.log'), date('Y-d-m')]), Logger::INFO));
     $app->inflector('League\\Container\\ContainerAwareInterface')->invokeMethod('setContainer', [$app]);
     $app->inflector('League\\Event\\EmitterAwareInterface')->invokeMethod('setEmitter', [$app->get('Emitter')]);
     $app->inflector('Psr\\Log\\LoggerAwareInterface')->invokeMethod('setLogger', [$app->get('Logger')]);
     $app->inflector('Songbird\\FilesystemAwareInterface')->invokeMethod('setFilesystem', ['Filesystem']);
     $app->add('Repository', $app->get('RepositoryFactory')->createContentRepository());
     return $app;
 }
开发者ID:williamgb,项目名称:songbird,代码行数:20,代码来源:AppFactory.php

示例2: getConfig

 public static function getConfig($key)
 {
     if (self::$config === null) {
         self::$config = (include_once 'app/config/main.php');
     }
     return isset(self::$config[$key]) ? self::$config[$key] : false;
 }
开发者ID:schulz-brander,项目名称:vk.loc.mvc,代码行数:7,代码来源:index.php

示例3: start

 public static function start()
 {
     self::configuration(json_decode(App::config()->file('Sessions.sessions.json')->read(), true));
     if (session_status() == PHP_SESSION_NONE) {
         ini_set('session.cookie_httponly', true);
         //start session
         //set session name
         session_name(self::$_sessionName);
         session_start();
         //generate key
         Session::generate(self::$_userSessionsKey);
         Cookie::generate(self::$_userCookiesKey);
         //check initiated status
         if (intval(Session::get(self::$_initiatedKey)) == 0) {
             //regen
             session_regenerate_id();
             Session::generate(self::$_userSessionsKey);
             Session::set(self::$_initiatedKey, 1);
         }
         //check for corresponding user agent on same session
         if (Session::get(self::$_userAgentKey) !== false) {
             if (Session::get(self::$_userAgentKey) != hash('sha512', $_SERVER['HTTP_USER_AGENT'] . self::$_salt)) {
                 //invalid user agent detected
                 self::destroy();
                 die;
             }
         } else {
             Session::set(self::$_userAgentKey, hash('sha512', $_SERVER['HTTP_USER_AGENT'] . self::$_salt));
         }
     }
 }
开发者ID:liammartens,项目名称:xtend,代码行数:31,代码来源:SessionHandler.php

示例4: __construct

 public function __construct()
 {
     include 'config/config.php';
     include 'core/Controller.php';
     self::$config = $config;
     $this->route();
 }
开发者ID:jnethery,项目名称:angular-blog,代码行数:7,代码来源:index.php

示例5: init

 static function init()
 {
     $version_file = APP_PATH . '/../version';
     if (file_exists($version_file)) {
         self::$version = trim(@file_get_contents($version_file));
     }
     $config_file = APP_PATH . '/config/config.php';
     if (!file_exists($config_file)) {
         throw new Exception("No config file");
     }
     $config = (include $config_file);
     self::$config = $config;
     self::$env = $config['env'];
     #self::$context = new stdClass();
     self::$context = new Context();
     Logger::init($config['logger']);
     if (isset($config['db'])) {
         Db::init($config['db']);
     }
     if (get_magic_quotes_gpc()) {
         foreach ($_GET as $k => $v) {
             $_GET[$k] = Text::stripslashes($v);
         }
         foreach ($_POST as $k => $v) {
             $_POST[$k] = Text::stripslashes($v);
         }
         foreach ($_COOKIE as $k => $v) {
             $_COOKIE[$k] = Text::stripslashes($v);
         }
     }
     $_REQUEST = $_GET + $_POST + $_COOKIE;
 }
开发者ID:GoodCloudGary,项目名称:iphp,代码行数:32,代码来源:App.php

示例6: run

 /**
  * 运行应用实例
  * @access public
  * @return void
  */
 public function run()
 {
     //引入编译、缓存过的引入文件
     $compiledIncFile = $this->getCompiledIncFileName();
     if (App::config('compile_include_files') && is_file($compiledIncFile)) {
         self::$includeFiles = (require $compiledIncFile);
     }
     //检测控制器文件是否存在
     if (!is_file(APP_PATH . '/controller/' . self::$controller . 'Controller.class.php')) {
         die("<h1>Invalid Request</h1>\nController <strong>" . self::$controller . "</strong> not found.");
     }
     //导入必需文件
     irequire(PHPFW_PATH . '/common/common.php');
     is_file(APP_PATH . '/common/common.php') && irequire(APP_PATH . '/common/common.php');
     irequire(PHPFW_PATH . '/core/Controller.class.php');
     irequire(APP_PATH . '/controller/' . self::$controller . 'Controller.class.php');
     //实例化控制器并运行
     $controllerName = self::$controller . 'Controller';
     $controller = new $controllerName();
     $controller->run(self::$action);
     //编译、缓存 引入文件
     if (App::config('compile_include_files') && !is_file($compiledIncFile)) {
         $this->compileIncFiles();
     }
 }
开发者ID:BGCX067,项目名称:eyesphp-svn-to-git,代码行数:30,代码来源:App.class.php

示例7: create

 /**
  * @param  DownloadTokenModel $downloadToken
  * @return DownloadTokenModel
  */
 public function create(models\ModelAbstract $downloadToken)
 {
     if (!$downloadToken instanceof DownloadTokenModel) {
         throw new InvalidArgumentException('Supplied data must be a download token model');
     }
     $downloadToken->token = UserService::getInstance()->generatePassword(60);
     $brandService = BrandService::getInstance();
     $brand = $brandService->loadByOrganization(\App::getOrgUserLogged());
     $router = \Zend_Controller_Front::getInstance()->getRouter();
     $downloadToken->url = $brand->endPoint . $router->assemble(array('controller' => $downloadToken->controller, 'action' => $downloadToken->action, 'token' => $downloadToken->token), 'downloadToken');
     $downloadToken->orgId = \App::getOrgUserLogged()->getId();
     $downloadToken->expireDatetime = \App::config('downloadTokenLifeTime', "+1 day");
     $ident = \Zend_Auth::getInstance()->getIdentity();
     if (isset($ident['username'])) {
         $downloadToken->username = $ident['username'];
     }
     if (isset($ident['authType'])) {
         $downloadToken->authType = $ident['authType'];
     }
     if (isset($ident['apiId'])) {
         $downloadToken->apiId = $ident['apiId'];
     }
     if (isset($ident['impersonation'])) {
         $downloadToken->impersonation = $ident['impersonation'];
     }
     return parent::create($downloadToken);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:31,代码来源:DownloadTokenService.php

示例8: __construct

 protected function __construct($config)
 {
     if (count($config) != 4) {
         throw new \Exception("Le nombre d'arguments n'est pas valable!");
     }
     self::$config = $config;
 }
开发者ID:SMartignier,项目名称:prw2,代码行数:7,代码来源:App.class.php

示例9: setUp

 public function setUp()
 {
     $this->_watcherService = WatcherService::getInstance();
     $this->_txId = uniqid('test-', true);
     $user = \App::getUserLogged();
     $this->_watcher = new WatcherModel();
     $this->_watcher->scope = 'user';
     $this->_watcher->scopeId = $user->id;
     $this->_watcher->owner = $user->id;
     $this->_watcher->namespace = 'connectivity';
     $this->_watcher->entityType = 'transaction';
     $this->_watcher->entityIds = array($this->_txId);
     $this->_watcher->transport = 'popbox';
     $this->_watcher->priority = WatcherModel::PRIORITY_LOW;
     $this->_watcher->status = WatcherModel::STATUS_ACTIVE;
     $this->_watcher->expire = strtotime(\App::config('watchers.expire', "+1 day"));
     $this->_watcher->remove = strtotime(\App::config('watchers.autoremove', "+6 months"));
     $this->_watcher->tags = array('context_' . $user->getOrganizationId());
     $this->_watcher->maxEvents = 1;
     $this->_watcher->maxEventStackSize = 1;
     $this->_watcher->params = new StructConfigModel();
     $this->_watcher->hiddenParams = new StructConfigModel();
     $this->_event = new EventModel();
     $this->_event->namespace = 'connectivity';
     $this->_event->entityType = 'transaction';
     $this->_event->entityId = $this->_txId;
     $this->_event->created = time();
     $this->_event->modified = time();
     $this->_event->pushEventData = true;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:30,代码来源:PublishAsyncTest.php

示例10: _getConfigMaxErrorsBeforeCompress

 protected function _getConfigMaxErrorsBeforeCompress()
 {
     if (!isset($this->_configMaxErrorsBeforeCompress)) {
         $this->_configMaxErrorsBeforeCompress = \App::config('watcher.event.maxErrorsBeforeCompress', 15);
     }
     return $this->_configMaxErrorsBeforeCompress;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:7,代码来源:EventCompressorAbstract.php

示例11: close

 /**
  * close the application, by creating a CLOSED file
  * @param string $message the message to display
  * @since 1.2
  */
 public static function close($message = '')
 {
     $file = App::configPath('CLOSED');
     file_put_contents($file, $message);
     if (App::config()) {
         chmod($file, App::config()->chmodFile);
     }
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:13,代码来源:AppManager.php

示例12: defaultLoader

 /**
  * Get the default disco twig loader which enables extension-less template use.
  *
  *
  * @param null|string|array $path The absolute path to the template directory, or an array of directories.
  *
  * @return \Disco\classes\TemplateLoader
  */
 public static function defaultLoader($path = null)
 {
     if ($path === null) {
         $path = \App::path() . '/' . trim(\App::config('TEMPLATE_PATH'), '/');
     }
     //if
     return new \Disco\classes\TemplateLoader($path);
 }
开发者ID:discophp,项目名称:framework,代码行数:16,代码来源:Template.class.php

示例13: __construct

 /**
  * 构造方法
  *
  * @param App $app
  */
 public function __construct($app)
 {
     $this->app = $app;
     $this->appConfig = $app->config();
     $this->request = $app->request();
     $this->response = $app->response();
     $app->controller = $this;
 }
开发者ID:chaoyanjie,项目名称:MonkeyPHP,代码行数:13,代码来源:Controller.php

示例14: getApp

 /**
  * Get the app. It's a singleton.
  * @param  array $config  The default config
  * @return App
  */
 public static function getApp($config)
 {
     if (self::$_app === null) {
         self::$config = (include_once $config);
         self::$_app = new App();
     }
     return self::$_app;
 }
开发者ID:biluo62,项目名称:phpMongoAdmin,代码行数:13,代码来源:App.php

示例15: hash

 /**
  * Hash with sha512.
  * If no salt is provided the salt stored in `app/config/config.php` with key `SHA512_SALT` will be used as the 
  * salt value.
  *
  *
  * @param  string $value Value to hash using SHA512.
  * @param null|string $salt The salt to use in the hash.
  *
  * @return string The hashed value of $s.
  */
 public function hash($value, $salt = '')
 {
     if ($salt === '') {
         $salt = \App::config('SHA512_SALT');
     }
     //if
     return hash('sha512', $salt . $value);
 }
开发者ID:discophp,项目名称:framework,代码行数:19,代码来源:Crypt.class.php


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