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


PHP Configure::consume方法代码示例

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


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

示例1: testEmptyEncryptSaltInitialization

 public function testEmptyEncryptSaltInitialization()
 {
     Configure::consume('App.Encrypt.salt');
     $this->setExpectedException('\\Cake\\Core\\Exception\\Exception');
     $table = TableRegistry::get('BinaryValues');
     $config = ['fields' => ['name' => 'string']];
     $cypherBehaviorInstance = new CipherBehavior($table, $config);
 }
开发者ID:lorenzo,项目名称:cakephp-cipher-behavior,代码行数:8,代码来源:CipherBehaviorTest.php

示例2: consume

 function consume($key, $default = null)
 {
     $ret = $default;
     if (Configure::check($key)) {
         $ret = Configure::consume($key);
     }
     return $ret;
 }
开发者ID:gourmet,项目名称:platform,代码行数:8,代码来源:functions.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $this->__resetAppConfig = Configure::read('App');
     Configure::write('App.www_root', dirname(dirname(dirname(__DIR__))) . DS . 'test_app' . DS . 'webroot' . DS);
     $this->__resetAsseticConfig = Configure::consume('Assetic');
     // Configure::write('Assetic', ['cssGroups' => ['main' => ['cake.group']]]);
     $view = $this->getMock('Cake\\View\\View', array('append'));
     $this->Assetic = new AsseticHelper($view);
 }
开发者ID:gourmet,项目名称:assetic,代码行数:10,代码来源:AsseticHelperTest.php

示例4: startup

 /**
  * startup callback
  *
  * @param \Cake\Event\Event $event Event.
  *
  * @return void
  */
 public function startup(Event $event)
 {
     $secret = Configure::consume('Recaptcha.secret');
     // throw an exception if the secret is not defined in config/recaptcha.php file
     if (empty($secret)) {
         throw new Exception(__d('recaptcha', "You must set the secret Recaptcha key in config/recaptcha.php file"));
     }
     // instantiate Recaptcha object that deals with retrieving data from google recaptcha
     $this->recaptcha = new Recaptcha(new RecaptchaResponse(), $secret);
     $controller = $event->subject();
     $this->setController($controller);
 }
开发者ID:cakephp-fr,项目名称:recaptcha,代码行数:19,代码来源:RecaptchaComponent.php

示例5: beforeRender

 /**
  * Called after the Controller::beforeRender(), after the view class is loaded, and before the
  * Controller::render()
  *
  * @param \Cake\Event\Event $event
  * @return \Cake\Network\Response|null|void
  */
 public function beforeRender(Event $event)
 {
     if (!$this->Controller->request->is('ajax')) {
         return;
     }
     $headerKey = $this->config('headerKey');
     if (!$headerKey) {
         return;
     }
     $ajaxMessages = array_merge((array) $this->Controller->request->session()->consume('FlashMessage'), (array) Configure::consume('FlashMessage'));
     // The header can be read with JavaScript and a custom Message can be displayed
     $this->Controller->response->header($headerKey, json_encode($ajaxMessages));
 }
开发者ID:alescx,项目名称:cakephp-tools,代码行数:20,代码来源:FlashComponent.php

示例6: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     //データベース接続設定
     $connectionInfo = self::$_connectionInfo;
     //cacheの設定はしていないためcacheを無効にする
     Cache::disable();
     //defaultは使わないがいないとエラーになるのでテストと同じものを設定する
     Configure::write('Datasources.default', $connectionInfo);
     Configure::write('Datasources.test', $connectionInfo);
     ConnectionManager::config(Configure::consume('Datasources'));
     //APPが定義されていないとエラーになるため。(逆に何か設定してあればとりあえず動くみたい?)
     if (!defined('APP')) {
         define('APP', self::$_appInfo);
     }
 }
开发者ID:satthi,项目名称:plugin-test-support,代码行数:16,代码来源:AppTestCase.php

示例7: testConsumeEmpty

 /**
  * testConsumeEmpty
  *
  * @return void
  */
 public function testConsumeEmpty()
 {
     Configure::write('Test', ['key' => 'value', 'key2' => 'value2']);
     $result = Configure::consume('');
     $this->assertNull($result);
     $result = Configure::consume(null);
     $this->assertNull($result);
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:13,代码来源:ConfigureTest.php

示例8: env

if (!Configure::read('App.fullBaseUrl')) {
    $s = null;
    if (env('HTTPS')) {
        $s = 's';
    }
    $httpHost = env('HTTP_HOST');
    if (isset($httpHost)) {
        Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
    }
    unset($httpHost, $s);
}
Cache::config(Configure::consume('Cache'));
ConnectionManager::config(Configure::consume('Datasources'));
Email::configTransport(Configure::consume('EmailTransport'));
Email::config(Configure::consume('Email'));
Log::config(Configure::consume('Log'));
/**
 * Setup detectors for mobile and tablet.
 */
Request::addDetector('mobile', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isMobile();
});
Request::addDetector('tablet', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isTablet();
});
/**
 * Custom Inflector rules, can be set to correctly pluralize or singularize table, model, controller names or whatever other
 * string is passed to the inflection functions
 *
开发者ID:cuchitto,项目名称:estadisticas-log,代码行数:31,代码来源:bootstrap.php

示例9:

 */
//Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
//Inflector::rules('irregular', ['red' => 'redlings']);
//Inflector::rules('uninflected', ['dontinflectme']);
//Inflector::rules('transliteration', ['/å/' => 'aa']);
/*
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
/*
 * Only try to load DebugKit in development mode
 * Debug Kit should not be installed on a production system
 */
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
// Handle the CakeQueuesadilla
Plugin::load('Josegonzalez/CakeQueuesadilla');
\Josegonzalez\CakeQueuesadilla\Queue\Queue::config(Configure::consume('Queuesadilla'));
Plugin::load('AssetCompress', ['bootstrap' => true]);
Plugin::load('BootstrapUI');
Plugin::load('Crud');
Plugin::load('CrudView');
Plugin::load('Josegonzalez/Upload');
Plugin::load('Migrations');
Plugin::load('Search');
开发者ID:josegonzalez,项目名称:app,代码行数:31,代码来源:bootstrap.php

示例10: env

    $s = null;
    if (env('HTTPS')) {
        $s = 's';
    }
    $httpHost = env('HTTP_HOST');
    if (isset($httpHost)) {
        Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
    }
    unset($httpHost, $s);
}
Cache::config(Configure::consume('Cache'));
ConnectionManager::config(Configure::consume('Datasources'));
Email::configTransport(Configure::consume('EmailTransport'));
Email::config(Configure::consume('Email'));
Log::config(Configure::consume('Log'));
Security::salt(Configure::consume('Security.salt'));
/**
 * The default crypto extension in 3.0 is OpenSSL.
 * If you are migrating from 2.x uncomment this code to
 * use a more compatible Mcrypt based implementation
 */
// Security::engine(new \Cake\Utility\Crypto\Mcrypt());
/**
 * Setup detectors for mobile and tablet.
 */
Request::addDetector('mobile', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isMobile();
});
Request::addDetector('tablet', function ($request) {
    $detector = new \Detection\MobileDetect();
开发者ID:Aerue,项目名称:avalia,代码行数:31,代码来源:bootstrap.php

示例11: testDefaultProfile

 /**
  * test that default profile is used by constructor if available.
  *
  * @return void
  */
 public function testDefaultProfile()
 {
     $config = ['test' => 'ok', 'test2' => true];
     Configure::write('Email.default', $config);
     Email::config(Configure::consume('Email'));
     $Email = new Email();
     $this->assertSame($Email->profile(), $config);
     Configure::delete('Email');
     Email::drop('default');
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:15,代码来源:EmailTest.php

示例12:

<?php

// file:   bootstrap.php
// date:   2016-01-12
// author: Michael Leßnau <michael.lessnau@gmail.com>
use Cake\Core\Configure;
use Cake\Datasource\ConnectionManager;
require __DIR__ . '/../vendor/autoload.php';
Configure::write('Datasources', ['default' => ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Sqlite', 'database' => __DIR__ . '/default.sqlite', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => false, 'log' => false], 'test' => ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Sqlite', 'database' => __DIR__ . '/test.sqlite', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => false, 'log' => false]]);
ConnectionManager::config(Configure::consume('Datasources'));
开发者ID:bus-factor,项目名称:cakephp-json-rest-api,代码行数:10,代码来源:bootstrap.php

示例13: consume

 /**
  * Reads and deletes a variable from Configure.
  *
  * @param string $name The key to read and remove (or a path as sent to Hash.extract).
  * @return mixed The value of the Configure variable, null if not available
  */
 public function consume($name)
 {
     return Configure::consume($name);
 }
开发者ID:dereuromark,项目名称:cakephp-shim,代码行数:10,代码来源:ConfigureHelper.php

示例14: isset

<?php

use Cake\Core\Configure;
use Cake\Cache\Cache;
use PipingBag\Di\PipingBag;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\AnnotationReader;
$config = Configure::consume('PipingBag');
$modules = !empty($config['modules']) ? $config['modules'] : [];
$cache = isset($config['cacheConfig']) ? $config['cacheConfig'] : 'default';
AnnotationReader::addGlobalIgnoredName('triggers');
AnnotationRegistry::registerFile(dirname(__DIR__) . '/src/Annotation/Assisted.php');
$instance = Cache::read('pipingbag.instance', $cache);
if (!$instance) {
    $instance = PipingBag::create($modules);
}
PipingBag::container($instance);
register_shutdown_function(function () use($instance, $cache) {
    Cache::write('pipingbag.instance', $instance, $cache);
});
开发者ID:lorenzo,项目名称:piping-bag,代码行数:20,代码来源:bootstrap.php

示例15:

<?php

/**
 * MultiTenant Plugin
 * Copyright (c) PRONIQUE Software (http://pronique.com)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) PRONIQUE Software (http://pronique.com)
 * @link          http://github.com/pronique/multitenant MultiTenant Plugin Project
 * @since         0.5.1
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace MultiTenant\Config;

use MultiTenant\Core\MTApp;
use Cake\Configure\Engine\PhpConfig;
use Cake\Core\Configure;
MTApp::config(Configure::consume('MultiTenant'));
开发者ID:pdata,项目名称:multitenant,代码行数:21,代码来源:bootstrap.php


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