本文整理汇总了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);
}
示例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']);
}
}
}
}
示例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);
}
示例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'));
}
示例5:
function __construct()
{
Configure::load('amazon', 'default');
$this->awsAccessKey = Configure::read('AwsAccessKey');
$this->awsSecretKey = Configure::read('AwsSecretKey');
$this->associateTag = Configure::read('AssociateTag');
}
示例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;
}
示例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');
}
示例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');
}
示例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;
}
示例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');
}
示例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);
}
示例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'));
}
示例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);
}
示例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');
}
示例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']);
}