本文整理汇总了PHP中Configure::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::check方法的具体用法?PHP Configure::check怎么用?PHP Configure::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load()
{
if (Cache::read('qe.dbconfig_' . hash("md5", "qe_dbconfig"), QEResp::QUICK_EMAILER_CACHE)) {
return true;
}
if (Configure::check('qe.dbconfig')) {
if (!file_exists(APP . 'Config' . DS . 'database.php')) {
return QEResp::RESPOND(QEResp::ERROR, QuickEmailerErrorDefinitions::NO_DATABASE_CONFIGURED());
}
try {
$datasource = ConnectionManager::getDataSource(Configure::read('qe.dbconfig'));
if ($datasource->connected) {
$this->CheckTables($datasource);
Cache::write('qe.dbconfig_' . hash("md5", "qe_dbconfig"), true, QEResp::QUICK_EMAILER_CACHE);
return true;
}
return QEResp::RESPOND(QEResp::ERROR, QuickEmailerErrorDefinitions::NO_DATABASE_CONFIGURED());
} catch (Exception $e) {
$excep_message = QuickEmailerResponseHandler::AddExceptionInfo(QuickEmailerErrorDefinitions::NO_DATABASE_CONFIGURED(), $e);
//TODO: Log errors
return QEResp::RESPOND(QEResp::ERROR, $excep_message);
}
} else {
return QEResp::RESPOND(QEResp::ERROR, QuickEmailerErrorDefinitions::NO_DATABASE_CONFIGURED());
}
}
示例2: _setConfig
/**
* Set config
* @param array $config
*/
private function _setConfig(array $config)
{
if (Configure::check('MediaPost')) {
$config = array_merge($config, Configure::read('MediaPost'));
}
$this->config = $config;
}
示例3: loadTwitter
protected function loadTwitter()
{
if (isset($this->Twitter)) {
if ($this->Twitter) {
return $this->Twitter;
}
}
if (!class_exists('Endroid\\Twitter\\Twitter')) {
App::uses('endroid/twitter/src/endroid/twitter', 'Vendor');
}
if (!class_exists('Endroid\\Twitter\\Twitter')) {
return false;
}
if (!is_file(APP . DS . 'Config' . DS . 'twitter.php')) {
return false;
}
if (!Configure::load('twitter')) {
return false;
}
if (!Configure::check('Twitter')) {
return false;
}
$settings = Configure::read('Twitter');
if (empty($settings)) {
return false;
}
extract($settings);
$this->controller->Twitter = new Endroid\Twitter\Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
return $this->controller->Twitter ?: !$this->log(array("InitializeComponent->twitter" => array('request->here' => $this->controller->request->here, 'request->params' => $this->controller->request->params) + compact('settings')), 'debug');
}
示例4: main
/**
* Scans SVN for changes, and queues those plugins for update and refresh.
*
* @return int Shell return code.
*/
function main()
{
$max = 100;
if (isset($this->args[0]) && is_numeric($this->args[0]) && $this->args[0] > 0) {
$max = (int) $this->args[0];
}
$this->out(__('Checking latest revision from SVN...'));
$latest_revision = $this->_getLatestRevision();
if (!Configure::check('App.svn_revision')) {
$this->out(__('<info>First update detected, skipping to revision %d.</info>', $latest_revision));
$this->Setting->write('App.svn_revision', $latest_revision);
$this->_unlock();
return 0;
}
$revision = Configure::read('App.svn_revision');
$last_revision = $revision + $max;
if ($last_revision > $latest_revision) {
$last_revision = $latest_revision;
}
if ($revision == $latest_revision) {
$this->out(__('<info>No new changes, finished scanning.</info>'));
$this->_unlock();
return 0;
}
$this->out(__('Scanning SVN revisions %d through %d...', $revision, $last_revision));
$plugin_slugs = $this->_getModifiedPlugins($revision, $last_revision);
$this->_refreshPlugins($plugin_slugs);
$this->_updatePlugins($plugin_slugs);
$this->out(__('<info>Finished scanning.</info>'));
$this->Setting->write('App.svn_revision', $last_revision);
$this->_unlock();
return 0;
}
示例5: __construct
public function __construct(View $View, $settings = array())
{
if (!Configure::check('Ipay')) {
throw new NotFoundException('Ipay config is not found');
}
$this->config = Configure::read('Ipay');
parent::__construct($View, $settings);
}
示例6: send
/**
* {@inheritdoc}
*/
public function send($content, array $records)
{
$email = 'CakeEmail';
if (Configure::check('Email.classname')) {
$email = Configure::read('Email.classname');
}
$email::deliver($this->_to, $this->_subject, $content, $this->_config);
}
示例7: _checkComplete
protected function _checkComplete()
{
if (!Configure::check('Users.data')) {
$this->setErrorMessage(__('Users configure settings is absent'));
return true;
}
return false;
}
示例8: find
/**
* 名前をキーとしてインスタンスを探す
*
* @param string $name 名前
* @return BcAbstractDetector|null
*/
public static function find($name)
{
$key = static::$_configName . ".{$name}";
if (!Configure::check($key)) {
return null;
}
return new static($name, Configure::read($key));
}
示例9: getConfig
public function getConfig()
{
$key = 'Socialites.Providers.' . $this->_providerId;
if (Configure::check($key)) {
return Configure::read($key);
}
return false;
}
示例10: __construct
/**
* Constructor
*
* @return ProPayProcessor
*/
public function __construct()
{
$url = 'http://protectpaytest.propay.com/api/sps.svc?wsdl';
if (Configure::check('ProPay.wsdlUrl')) {
$url = Configure::read('ProPay.wsdlUrl');
}
$this->initialize(new SPS(array(), $url), new ID(Configure::read('ProPay.authenticationToken'), Configure::read('ProPay.billerAccountId')));
}
示例11: find
/**
* 名前をキーとしてインスタンスを探す
*
* @param string $name 名前
* @return BcAgent|null
*/
public static function find($name)
{
$key = "BcAgent.{$name}";
if (!Configure::check($key)) {
return null;
}
return new static($name, Configure::read($key));
}
示例12: isDeletable
/**
* Checks wether given $path is deletable
*
* A file is deleteable when it resides under directories registered in
* FileManager.deletablePaths
*
* @param string $path Path to check
* @return boolean true when file is deletable
*/
public function isDeletable($path)
{
$deletablePaths = Configure::check('FileManager.deletablePaths') ? Configure::read('FileManager.deletablePaths') : array();
foreach ($deletablePaths as $deletablePath) {
if ($this->_isWithinPath($deletablePath, $path)) {
return true;
}
}
return false;
}
示例13: init
/**
* Initialize the configuration
*
* Priority: env(WAKATIME_API_KEY) > config('wakatime.api_key')
* @throws InvalidArgumentException if no WakaTime API key is detected.
* @see WakaTimeComponent::initialize()
* @return void
*/
public function init()
{
if (getenv('WAKATIME_API_KEY')) {
$this->WakaTime->setApiKey(getenv('WAKATIME_API_KEY'));
} elseif (Configure::check('wakatime.api_key')) {
$this->WakaTime->setApiKey(Configure::read('wakatime.api_key'));
} else {
throw new InvalidArgumentException('WakaTime config file required for tests.');
}
}
示例14: admin_index
/**
* List of themes
*/
public function admin_index()
{
$this->set('title_for_layout', __d('hurad', 'Themes'));
$currentTheme = array();
$themes = HuradTheme::getThemeData();
$current = Configure::read('template');
if (Configure::check('template') && !empty($current)) {
$currentTheme = $themes[Configure::read('template')];
}
$this->set(compact('themes', 'currentTheme'));
}
示例15: getResizeToSize
/**
* Return configured main image resize attributes
* @return array
*/
public function getResizeToSize()
{
$width = $height = 0;
if (Configure::check('GalleryOptions.Pictures.resize_to.0')) {
$width = Configure::read('GalleryOptions.Pictures.resize_to.0');
}
if (Configure::check('GalleryOptions.Pictures.resize_to.1')) {
$height = Configure::read('GalleryOptions.Pictures.resize_to.1');
}
$crop = Configure::read('GalleryOptions.Pictures.resize_to.2');
$action = $crop ? "crop" : "";
return array('width' => $width, 'height' => $height, 'action' => $action);
}