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


PHP Configure::load方法代码示例

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


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

示例1: initMenu

 /**
  * Ustawienie menu
  */
 private function initMenu()
 {
     $menu = Cache::read('menu-' . $this->userRole);
     if (!isset($menu) || $menu === false) {
         // Pobranie menu z configa
         Configure::load('Admin.app_menu', 'default');
         $menuConfig = Configure::read('menu');
         $that = $this;
         $generateMenu = function ($array) use($that, &$generateMenu) {
             $menu = array();
             foreach ($array as $key => $item) {
                 $link = $item['link'];
                 // czy ma dostep
                 if (!$link || $that->permission->check($link['controller'], $link['action'])) {
                     $childs = [];
                     if (isset($item['childs']) && !empty($item['childs'])) {
                         $childs = $generateMenu($item['childs']);
                         $item['childs'] = $childs;
                     }
                     // Nie dodaje pustych elementów do menu bez linku
                     if (count($childs) == 0 && !$link) {
                         continue;
                     }
                     $menu[$key] = $item;
                 }
             }
             return $menu;
         };
         $menu = $generateMenu($menuConfig);
         Cache::write('menu-' . $this->userRole, $menu);
     }
     $this->set('params', $this->request->params);
     $this->set('menu', $menu);
 }
开发者ID:bartekpie3,项目名称:cakeAdmiin,代码行数:37,代码来源:AppController.php

示例2: onControllerInit

 public function onControllerInit($event)
 {
     $controller = $event->subject();
     if (isset($controller->request->params['prefix'])) {
         $menuFile = $controller->request->params['prefix'] . '_menus';
         if ($theme = Configure::read('App.admin.theme')) {
             if ($theme != '' && $theme != 'RearEngine' && Plugin::loaded($theme)) {
                 $controller->viewBuilder()->theme($theme);
             }
         }
         foreach (Plugin::loaded() as $plugin) {
             try {
                 Configure::load($plugin . '.' . $menuFile, 'default', true);
             } catch (\Exception $e) {
                 if (Configure::read('debug')) {
                     Log::warning('Unable to load app ' . $plugin . '/Config/' . $menuFile . ' config file', ['scope' => 'RearEngine plugin']);
                 }
             }
         }
         try {
             Configure::load($menuFile, 'default', true);
         } catch (\Exception $e) {
             if (Configure::read('debug')) {
                 Log::warning('Unable to load App/Config/' . $menuFile . ' config file.', ['scope' => 'RearEngine plugin']);
             }
         }
     }
 }
开发者ID:mindforce,项目名称:cakephp-rear-engine,代码行数:28,代码来源:CoreEvent.php

示例3: api

 /**
  * Wrap Moxiemanager's api.php in a controller action.
  *
  * @return void
  */
 public function api()
 {
     try {
         $pluginPath = Plugin::path('CkTools');
         define('MOXMAN_CLASSES', $pluginPath . 'src/Lib/moxiemanager/classes');
         define('MOXMAN_PLUGINS', $pluginPath . 'src/Lib/moxiemanager/plugins');
         define('MOXMAN_ROOT', $pluginPath . 'src/Lib/moxiemanager');
         define('MOXMAN_API_FILE', __FILE__);
         $appConfig = Configure::read('CkTools.moxiemanager');
         Configure::load('CkTools.moxiemanager');
         $moxieManagerConfig = Configure::read('moxiemanager');
         if (is_array($appConfig)) {
             $moxieManagerConfig = Hash::merge($moxieManagerConfig, $appConfig);
         }
         $GLOBALS['moxieManagerConfig'] = $moxieManagerConfig;
         require_once MOXMAN_CLASSES . '/MOXMAN.php';
         $context = \MOXMAN_Http_Context::getCurrent();
         $pluginManager = \MOXMAN::getPluginManager();
         foreach ($pluginManager->getAll() as $plugin) {
             if ($plugin instanceof \MOXMAN_Http_IHandler) {
                 $plugin->processRequest($context);
             }
         }
     } catch (Exception $e) {
         \MOXMAN_Exception::printException($e);
     }
     return $this->render(false, false);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:33,代码来源:MoxiemanagerController.php

示例4: testStartupWithExistingConfigFile

 /**
  * Test StartupWithExistingConfigFile
  *
  * @return void
  */
 public function testStartupWithExistingConfigFile()
 {
     Configure::config('default', new PhpConfig(PATH_TO_CONFIG_FILES));
     Configure::load('recaptchaWithExistingKeys', 'default', false);
     // check that secret is well imported
     $this->assertEquals('goodsecret', Configure::read('Recaptcha.secret'));
 }
开发者ID:cake17,项目名称:cakephp-recaptcha,代码行数:12,代码来源:RecaptchaComponentTest.php

示例5:

 function __construct()
 {
     Configure::load('amazon', 'default');
     $this->awsAccessKey = Configure::read('AwsAccessKey');
     $this->awsSecretKey = Configure::read('AwsSecretKey');
     $this->associateTag = Configure::read('AssociateTag');
 }
开发者ID:matdion,项目名称:Product-Tracker,代码行数:7,代码来源:AmazonHelper.php

示例6: linkedinget

 /**
  *
  */
 public function linkedinget($resource, $token)
 {
     Configure::load('Linkedin.linkedin_credentials');
     $credentials = Configure::read('credentials');
     $linkedIn = new LinkedInLib($credentials['api_key'], $credentials['api_secret']);
     $result = $linkedIn->linkedinget($resource, $token);
     return $result;
 }
开发者ID:oxenti,项目名称:linkedin,代码行数:11,代码来源:LinkedinComponent.php

示例7: __construct

 /**
  * 初期化処理
  *
  * @access public
  */
 public function __construct()
 {
     // 「app.php」から画像アップロード先のパスを取得する
     Configure::config('default', new PhpConfig());
     Configure::load('app', 'default', false);
     $this->uploadFilePath = Configure::read('App.uploadFilePath');
     $this->uploadTempFilePath = Configure::read('App.uploadTempFilePath');
 }
开发者ID:bumptakayuki,项目名称:cakephp_20150919,代码行数:13,代码来源:ImageFileUtil.php

示例8: ensureConfig

 /**
  * Make sure the CrudView config exists
  *
  * If it doesn't, load the defaults file
  *
  * @return array
  */
 public function ensureConfig()
 {
     $config = Configure::read('CrudView');
     if ($config !== null) {
         return $config;
     }
     return Configure::load('CrudView.defaults');
 }
开发者ID:surjit,项目名称:crud-view,代码行数:15,代码来源:ViewListener.php

示例9: country

 /**
  * Returns the translated version of the given country
  *
  * @param string $country E.g. "de", "en"
  * @return string
  */
 public function country($country)
 {
     if (!Configure::read('countries')) {
         Configure::load('CkTools.countries');
     }
     $countries = Configure::read('countries');
     return isset($countries[$country]) ? $countries[$country] : $country;
 }
开发者ID:kiliansch,项目名称:cake-cktools,代码行数:14,代码来源:CkToolsHelper.php

示例10: initialize

 public function initialize(array $config)
 {
     Configure::load('UploadManager.uploads', 'default');
     $this->maxFileSize = Configure::read('Uploads.maxFileSize');
     $this->maxFileSize *= 1048576;
     // Multiply by bytes per mb
     $this->storagePath = Configure::read('Uploads.storagePath');
     $this->storeOwner = Configure::read('Uploads.storeOwner');
 }
开发者ID:propellerstudios,项目名称:UploadManager,代码行数:9,代码来源:UploaderComponent.php

示例11: load

 /**
  * Wrapper para Configure::load().
  * Faz uma verificação para ver se o plugin está instalado. (@see PluginStarter::install()).
  * 
  * @param string $pluginName O nome do plugin a ser carregado.
  * @return bool              O retorno do chamado Configure::load().
  */
 public function load($pluginName)
 {
     $settingsFile = $this->pluginInstallationFolder . $pluginName . DS . 'settings.php';
     if (!file_exists($settingsFile)) {
         $this->install($pluginName);
     }
     $configPath = Text::insert('Plugins/:plugin/settings', ['plugin' => $pluginName]);
     return Configure::load($configPath);
 }
开发者ID:mswagencia,项目名称:msw-appcore,代码行数:16,代码来源:PluginStarter.php

示例12: __construct

 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($this->user('role')) {
         $this->role = $this->user('role');
     }
     if (!file_exists(CONFIG . "locker.php")) {
         throw new Exception(_('locker.php not found in config directory'));
     }
     //Load configuration directives for Locker
     $params = $this->request->params;
     Configure::load('locker');
     $this->roles = Configure::read('locker.roles');
     $this->controllers = Configure::read('locker.controllers');
     $path = "/{$params['controller']}/{$params['action']}";
     if (!empty($params['prefix'])) {
         $path = "/{$params['prefix']}" . $path;
     }
     if (!empty($params['plugin'])) {
         $path = "/{$params['plugin']}" . $path;
     }
     $base = strtolower($path);
     $exact = strtolower($path . '/' . implode('/', $params['pass']));
     $wildcard = strtolower($base . '/*');
     if ($this->role != 'public' && !in_array($this->role, $this->roles)) {
         throw new Exception(__('Your user role is not present in locker configuration'));
     }
     if (!empty($this->controllers[$exact])) {
         if ($this->check($exact)) {
             return $this->allow();
         }
         if ($this->user()) {
             throw new MethodNotAllowedException(sprintf(__("You do not have permission to access this area: %s"), $exact));
         }
         return;
     }
     if (!empty($this->controllers[$wildcard]) && !empty($params['pass'])) {
         if ($this->check($wildcard)) {
             return $this->allow();
         }
         if ($this->user()) {
             throw new MethodNotAllowedException(sprintf(__("You do not have permission to access this area: %s"), $wildcard));
         }
         return;
     }
     if (!empty($this->controllers[$base])) {
         if ($this->check($base)) {
             return $this->allow();
         }
         if ($this->user()) {
             throw new MethodNotAllowedException(sprintf(__("You do not have permission to access this area: %s"), $base));
         }
         return;
     }
     throw new Exception(__('Method is not present on locker.php configuration'));
 }
开发者ID:andrecavallari,项目名称:locker,代码行数:56,代码来源:LockerComponent.php

示例13: initConfig

 /**
  * @return void
  */
 public function initConfig()
 {
     // Local config without extra config file
     $conf = (array) Configure::read('Queue');
     // Fallback to Plugin config which can be overwritten via local app config.
     Configure::load('Queue.queue');
     $defaultConf = (array) Configure::read('Queue');
     $conf = array_merge($defaultConf, $conf);
     Configure::write('Queue', $conf);
 }
开发者ID:ameyrf,项目名称:cakephp-queue,代码行数:13,代码来源:QueuedTasksTable.php

示例14: initialize

 /**
  * 初期化処理
  * beforeFilter()メソッドの前に呼び出される。
  *
  * @access public
  */
 public function initialize()
 {
     parent::initialize();
     // コンポーネント読み込み
     $this->loadComponent('Csrf');
     $this->loadComponent('Cookie');
     // 登録確認メールのURLを取得する
     Configure::config('default', new PhpConfig());
     Configure::load('app', 'default', false);
     $this->sendMailUrl = Configure::read('Email.default.addUserSendMailUrl');
 }
开发者ID:bumptakayuki,项目名称:cakephp_20150919,代码行数:17,代码来源:LoginController.php

示例15: __construct

 public function __construct()
 {
     if ($this->config === null) {
         $this->config = Configure::load('CakeD.config')['FTP'];
     }
     $this->instance = $this->getClient();
     if (!$this->dir_exists($this->config['directory']['root']) && $this->config['directory']['create']) {
         $this->mkdir($this->config['directory']['root']);
     }
     $this->cd($this->config['directory']['root']);
 }
开发者ID:denvolj,项目名称:caked,代码行数:11,代码来源:FTPAdapter.php


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