本文整理汇总了PHP中Cake\Core\Configure::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::check方法的具体用法?PHP Configure::check怎么用?PHP Configure::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Core\Configure
的用法示例。
在下文中一共展示了Configure::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startup
/**
* Override startup of the Shell
*
* @return void
*/
public function startup()
{
parent::startup();
if (isset($this->params['connection'])) {
$this->connection = $this->params['connection'];
}
$class = Configure::read('Acl.classname');
if (strpos($class, '\\') === false && strpos($class, '.') === false) {
$className = App::classname('Acl.' . $class, 'Adapter');
} else {
$className = App::classname($class, 'Adapter');
}
if ($class !== 'DbAcl' && !is_subclass_of($className, 'Acl\\Adapter\\DbAcl')) {
$out = "--------------------------------------------------\n";
$out .= __d('cake_acl', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n";
$out .= __d('cake_acl', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
$out .= "--------------------------------------------------\n";
$out .= __d('cake_acl', 'Current ACL Classname: {0}', [$class]) . "\n";
$out .= "--------------------------------------------------\n";
$this->err($out);
$this->_stop();
}
if ($this->command) {
if (Configure::check('Datasource') === null) {
$this->out(__d('cake_acl', 'Your database configuration was not found. Take a moment to create one.'));
$this->args = null;
$this->DbConfig->execute();
return;
}
try {
TableRegistry::get('Aros')->schema();
TableRegistry::remove('Aros');
} catch (\Cake\Database\Exception $e) {
$this->out(__d('cake_acl', 'Acl database tables not found. To create them, run:'));
$this->out();
$this->out(' bin/cake Migrations.migrations migrate -p Acl');
$this->out();
$this->_stop();
return;
}
$registry = new ComponentRegistry();
$this->Acl = new AclComponent($registry);
}
}
示例2: __construct
/**
* Constructor
*
*/
public function __construct()
{
parent::__construct();
if (Configure::check('Acl.cacheConfig')) {
$this->_cacheConfig = Configure::read('Acl.cacheConfig');
}
}
示例3: render
public function render(array $data, ContextInterface $context)
{
// debug($data);
// debug($this->_templates);
$date_data = ['type' => 'text', 'name' => $data['name'] . '__date__', 'id' => $this->get_dom_id($data['name'] . '-date'), 'language' => $data['language'], 'datepicker_format' => $data['datepicker_format'], 'upper_datepicker_id' => isset($data['upper_datepicker_name']) ? $this->get_dom_id($data['upper_datepicker_name'] . '-date') : null, 'upper_datepicker_name' => isset($data['upper_datepicker_name']) ? $data['upper_datepicker_name'] : null, 'format_on_blur' => $data['format_on_blur'], 'alaxos_js_format' => $data['alaxos_js_format'], 'class' => 'form-control inputDate'];
// debug($date_data);
$time_data = ['type' => 'text', 'name' => $data['name'] . '__time__', 'id' => $this->get_dom_id($data['name'] . '-time'), 'class' => 'form-control inputTime'];
$hidden_data = ['type' => 'hidden', 'name' => $data['name'], 'id' => $this->get_dom_id($data['name'] . '-hidden')];
$display_timezone = null;
if (Configure::check('display_timezone')) {
$display_timezone = Configure::read('display_timezone');
} elseif (Configure::check('default_display_timezone')) {
$display_timezone = Configure::read('default_display_timezone');
}
/*
* Case of posted data
*/
if (isset($data['val']) && !empty($data['val']) && is_string($data['val'])) {
$data['val'] = Time::parse($data['val'], $display_timezone);
}
if (isset($data['val']) && (is_a($data['val'], 'Cake\\I18n\\Time') || is_a($data['val'], 'Cake\\I18n\\FrozenTime'))) {
if (isset($display_timezone)) {
$data['val']->setTimezone($display_timezone);
//it doesn't change the timezone internally, but it changes the tz used for display
}
$datetime = $data['val'];
$date_data['value'] = $datetime->format($data['php_date_format']);
$time_data['value'] = $datetime->format('H:i');
$hidden_data['value'] = $date_data['value'] . ' ' . $time_data['value'];
}
$input = $this->get_html_code($date_data, $time_data, $hidden_data);
$input .= $this->get_js_code($date_data, $time_data, $hidden_data);
return $input;
}
示例4: config
/**
* Gets config values stored in the configuration.
* It will first look in the MeCms configuration, then in the application configuration
* @param string|null $key Configuration key
* @return mixed Configuration value
*/
function config($key = null)
{
if ($key !== null && Configure::check(sprintf('MeCms.%s', $key))) {
return Configure::read(sprintf('MeCms.%s', $key));
}
return Configure::read($key);
}
示例5: startup
/**
* Override startup of the Shell
*
* @return void
*/
public function startup()
{
parent::startup();
if (isset($this->params['connection'])) {
$this->connection = $this->params['connection'];
}
$class = Configure::read('Acl.classname');
$className = App::classname('Acl.' . $class, 'Adapter');
if ($class !== 'DbAcl' && !is_subclass_of($className, 'Acl\\Adapter\\DbAcl')) {
$out = "--------------------------------------------------\n";
$out .= __d('cake_acl', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n";
$out .= __d('cake_acl', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
$out .= "--------------------------------------------------\n";
$out .= __d('cake_acl', 'Current ACL Classname: %s', $class) . "\n";
$out .= "--------------------------------------------------\n";
$this->err($out);
return $this->_stop();
}
if ($this->command) {
if (Configure::check('Datasource') === null) {
$this->out(__d('cake_acl', 'Your database configuration was not found. Take a moment to create one.'));
$this->args = null;
return $this->DbConfig->execute();
}
if (!in_array($this->command, ['initdb'])) {
$registry = new ComponentRegistry();
$this->Acl = new AclComponent($registry);
$controller = new Controller();
}
}
}
示例6: initialize
/**
* Initialization
* @return void
*/
public function initialize()
{
parent::initialize();
$this->loadComponent('Math');
if (!Configure::check('twitter')) {
throw new \LogicException('Configuration Twitter is not defined');
}
}
示例7: initialize
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
$table = Configure::check('CakephpBlueimpUpload.upload_table') ? Configure::read('CakephpBlueimpUpload.upload_table') : 'uploads';
$this->table($table);
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Timestamp');
}
示例8: read
function read($key, $default = null)
{
$ret = $default;
if (Configure::check($key)) {
$ret = Configure::read($key);
}
return $ret;
}
示例9: index
/**
* Index method
*
* @return void
*/
public function index()
{
if (Configure::check('Notifications.default_language')) {
$this->NotificationContents->locale(Configure::read('Notifications.default_language'));
} else {
$this->NotificationContents->locale('eng');
}
$this->set('notificationContents', $this->paginate($this->NotificationContents));
}
示例10: __construct
/**
* Creates a Transport instance
*
* @param array $config transport-specific configuration options
*/
public function __construct(array $config)
{
parent::__construct($config);
$keys = Configure::read('Notifications.transports.push_message');
if (Configure::check('Notifications.transports.push_message.' . ENVIRONMENT)) {
// prefer environment specific config keys
$keys = Configure::read('Notifications.transports.push_message.' . ENVIRONMENT);
}
ParseClient::initialize($keys['app_id'], $keys['rest_key'], $keys['master_key']);
}
示例11: getOptionParser
/**
* Display help for this console.
*
* @return ConsoleOptionParser
*/
public function getOptionParser()
{
$file = Runner::ROBOFILE;
if (Configure::check('Path.robofile')) {
$file = Configure::read('Path.robofile');
}
$parser = new ConsoleOptionParser('robot', false);
$parser->description('This shell provides a Robo runner.' . "\n\n" . 'You will need to have robo installed for this Shell to work. ')->addOption('config', ['help' => __d('cake_console', 'Path to your RoboFile class'), 'default' => $file]);
return $parser;
}
示例12: loopResolver
/**
* @return LoopInterface
*/
function loopResolver()
{
if (Configure::check('WyriHaximus.Ratchet.loop') && Configure::read('WyriHaximus.Ratchet.loop') instanceof LoopInterface) {
return Configure::read('WyriHaximus.Ratchet.loop');
}
if (class_exists('PipingBag\\Di\\PipingBag') && Configure::check('WyriHaximus.Ratchet.pipingbag.loop')) {
return PipingBag::get(Configure::read('WyriHaximus.Ratchet.pipingbag.loop'));
}
return Factory::create();
}
示例13: _welcome
protected function _welcome()
{
if (!Configure::check('DelayedJobs')) {
throw new Exception('Could not load config, check your load settings in bootstrap.php');
}
$hostname = php_uname('n');
$this->clear();
$this->out('Hostname: <info>' . $hostname . '</info>');
$this->hr();
}
示例14: beforeFilter
/**
* Event
*
* @param Event $event event
* @return void
*/
public function beforeFilter(\Cake\Event\Event $event)
{
$this->loadModel('Notifications.NotificationContents');
if (Configure::check('Notifications.default_language')) {
$this->NotificationContents->locale(Configure::read('Notifications.default_language'));
} else {
$this->NotificationContents->locale('eng');
}
parent::beforeFilter($event);
}
示例15: dontSeeInConfig
/**
* Asserts that a given key (and value) do not exist in the configuration.
*
* @param string|array $key Configuration key or array of key/values.
* @param mixed $value Value to check for. If `NULL`, checks only key.
*/
public function dontSeeInConfig($key, $value = null)
{
if (is_array($key)) {
array_walk($key, function ($v, $k) {
$this->dontSeeInConfig($k, $v);
});
return;
}
$message = "Unexpectedly managed to find the {$key} config key";
if (is_null($value)) {
$this->assertFalse(Configure::check($key), $message);
return;
}
$message .= ' with ' . json_encode($value);
$this->assertNotEquals($value, Configure::read($key), $message);
}