當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。