本文整理汇总了PHP中Configure::Read方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::Read方法的具体用法?PHP Configure::Read怎么用?PHP Configure::Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* destruct method
*
* Allow timer info to be displayed if the code dies or is being debugged before rendering the view
* Cheat and use the debug log class for formatting
*
* @return void
* @access private
*/
function __destruct()
{
$_this =& DebugKitDebugger::getInstance();
if (!Configure::Read() || !$_this->__benchmarks) {
return;
}
$timers = array_values(DebugKitDebugger::getTimers());
$end = end($timers);
echo '<table class="cake-sql-log"><tbody>';
echo '<caption>Debug timer info</caption>';
echo '<tr><th>Message</th><th>Start Time (ms)</th><th>End Time (ms)</th><th>Duration (ms)</th></tr>';
$i = 0;
foreach ($timers as $timer) {
$indent = 0;
for ($j = 0; $j < $i; $j++) {
if ($timers[$j]['end'] > $timer['start'] && $timers[$j]['end'] > $timer['end']) {
$indent++;
}
}
$indent = str_repeat(' » ', $indent);
extract($timer);
$start = round($start * 1000, 0);
$end = round($end * 1000, 0);
$time = round($time * 1000, 0);
echo "<tr><td>{$indent}{$message}</td><td>{$start}</td><td>{$end}</td><td>{$time}</td></tr>";
$i++;
}
echo '</tbody></table>';
}
示例2: changeStatus
public function changeStatus($personIdentification = null, $status = null)
{
if ($status != null && $personIdentification != null) {
$searchParam = array('Users.id' => $personIdentification);
if ($this->Users->hasAny($searchParam)) {
$person = $this->Users->findById($personIdentification);
$message = "";
switch ($status) {
case Configure::Read('STATUS.MODIFIED'):
$person['Users']['status'] = Configure::Read('STATUS.MODIFIED');
$message = __('Deshabilitado con exito.');
break;
case Configure::Read('STATUS.INITIAL'):
$person['Users']['status'] = Configure::Read('STATUS.INITIAL');
$message = __('Activado con exito.');
break;
default:
$this->Session->setFlash(__('Hubo un problema al actulizar.'), 'flash_orange');
return $this->redirect(array('action' => 'index'));
break;
}
if ($this->Users->save($person)) {
$this->Session->setFlash($message, 'flash_green');
} else {
$this->Session->setFlash(__('Hubo un problema al actulizara.'), 'flash_orange');
}
return $this->redirect(array('action' => 'index'));
}
}
$this->Session->setFlash(__('Hubo un problema al actulizar.'), 'flash_orange');
return $this->redirect(array('action' => 'index'));
}
示例3: main
public function main()
{
set_time_limit(300);
//Set your subject and message. HTML works in the message
$subject = 'This is my subject';
$message = 'This is my message<br /><br />Best, Scott';
$sendgrid = new SendGrid(Configure::Read('Sendgrid.username'), Configure::Read('Sendgrid.password'));
$mail = new SendGrid\Email();
$this->loadModel('User');
$recipients = $this->User->find('all', array('conditions' => array('User.is_active' => true, 'User.is_subscribed' => true, 'OR' => array(array('User.role_id' => Configure::read('Role.Campaigner_ID')), array('User.role_id' => Configure::read('Role.CampaignerAdmin_ID')), array('User.role_id' => Configure::read('Role.CampaignerUser_ID')), array('User.role_id' => Configure::read('Role.Activist_ID')), array('User.role_id' => Configure::read('Role.AdminAdmin_ID')), array('User.role_id' => Configure::read('Role.AdminUser_ID')))), 'recursive' => -1));
$to_array = array();
foreach ($recipients as $recipient) {
array_push($to_array, $recipient['User']['username']);
}
//Uncomment the mail session below when you're ready to send the email
/* $mail
->setTos($to_array)
->setFrom('admin@amplifyd.com')
->setFromName('Amplifyd')
->setSubject($subject)
->setText($message)
->setHtml($this->emailTemplate($message));
$sendgrid->send($mail);*/
$task = 'Newsletter main';
$out_message = 'There were ' . count($to_array) . ' newsletter blast emails sent.
<br /><br />Time executed: ' . $this->timestamp();
$this->email_adminOut($task, $out_message);
$this->out($out_message);
}
开发者ID:suspended,项目名称:CakePHP-Coming-Soon-Website-With-Referral-Rewards,代码行数:30,代码来源:NewsletterShell.php
示例4: beforeSave
public function beforeSave($options = array())
{
# code...
if (empty($this->data[$this->alias]['id'])) {
//INSERT
$this->data[$this->alias]['status'] = Configure::Read('STATUS.INITIAL');
$this->data[$this->alias]['register_date'] = date('Y-m-d');
}
return true;
}
示例5: beforeSave
public function beforeSave($options = array())
{
# code...
if (empty($this->data[$this->alias]['id'])) {
//INSERT
$this->data[$this->alias]['status'] = Configure::Read('STATUS.INITIAL');
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] = Authsome::hash($this->data[$this->alias]['password']);
}
}
return true;
}
示例6: dump
function dump($object = 'options')
{
if ($object == 'view') {
$this->set('header', 'Dumping a View Object');
$this->render('view_dump');
} elseif ($object == 'controller') {
$this->Gatekeeper->restrict_from_app_modes(array('production'), '/demo/gatekeeper/blocked', 'this option is blocked in production mode');
$REPORT = array($this->name => $this);
$this->set('header', 'Dumping the Controller Object');
$this->set('data', $REPORT);
$this->render('report');
} elseif ($object == 'config') {
$REPORT = array('App.mode' => Configure::Read('App.mode'), 'App.domain' => Configure::Read('App.domain'), 'debug' => Configure::read('debug'), 'Configure::Read(\'App\')' => Configure::Read('App'));
$this->set('header', 'Cakewell Context-Specific App Values');
$this->set('data', $REPORT);
$this->render('report');
} elseif ($object == 'phpinfo') {
$this->Gatekeeper->restrict_from_app_modes(array('production'), '/demo/', 'this action is blocked in production mode');
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
$this->set('content_for_view', $phpinfo);
$this->render('blank', 'default');
} elseif ($object == 'request_handler') {
$Report = array('$this->Session->id()' => $this->Session->id(), '$this->Session->id' => $this->Session->id, '$this->RequestHandler->getReferrer()' => $this->RequestHandler->getReferrer(), '$_SERVER[\'HTTP_REFERER\']' => $_SERVER['HTTP_REFERER'], '$_SERVER[\'HTTP_USER_AGENT\']' => $_SERVER['HTTP_USER_AGENT'], 'Controller::referer' => Controller::referer(), '$this->RequestHandler->getClientIP()' => $this->RequestHandler->getClientIP(), 'FULL_BASE_URL + Router::url(\'\', false)' => FULL_BASE_URL . Router::url('', false), '$this->RequestHandler' => $this->RequestHandler);
$this->set('header', 'showing RequestHandler info for client at ip ' . $this->RequestHandler->getClientIP());
$this->set('data', $Report);
$this->render('report');
} elseif ($object == 'referer') {
$Data = array('referer' => $this->referer(), 'SERVER[\'HTTP_REFERER\']' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'NULL', 'Configure::read(\'Security.level\')' => Configure::read('Security.level'));
$this->set('header', 'Checking Referrer');
$this->set('data', $Data);
$this->render('report');
} elseif ($object == 'constants') {
$this->set('header', 'Some CakePHP Constants and Globals (<a href="http://book.cakephp.org/view/122/Core-Definition-Constants">docs</a>)');
$this->set('data', $this->_cake_constants());
$this->render('report');
} else {
$content = <<<EOMENU
<h3>choose an object to dump</h3>
<a href="/demo/dump/controller/">controller object</a><br />
<a href="/demo/dump/view/">view object</a><br />
<a href="/demo/dump/config/">configuration app values</a><br />
<a href="/demo/dump/request_handler/">request handler</a><br />
<a href="/demo/dump/referer/">referrer</a><br />
<a href="/demo/dump/constants/">cakephp constants</a><br />
<a href="/demo/dump/phpinfo/">phpinfo</a><br />
EOMENU;
$this->set('header', 'Object Dumper');
$this->set('content', $content);
$this->render('index');
}
}
示例7: restrict_from_app_modes
function restrict_from_app_modes($ModeList, $redirect_url = null, $message = null)
{
/*
This method bases restriction on the App.mode configuration setting
specific to the Cakewell configuration model.
*/
if (!($mode = Configure::Read('App.mode'))) {
trigger_error('App.mode configuration value not found', E_USER_ERROR);
die('access denied by gatekeeper');
}
if (!in_array($mode, $ModeList)) {
return 1;
}
return $this->_restrict($redirect_url, $message);
}
示例8: beforeSave
public function beforeSave($options = array())
{
# code...
if (empty($this->data[$this->alias]['id'])) {
# INSERT
App::uses('String', 'Utility');
$this->data[$this->alias]['status'] = Configure::Read('STATUS.INITIAL');
$code = $this->Jurisdiction->find('first', array('conditions' => array('Jurisdiction.id' => $this->data[$this->alias]['jurisdiction_id'])));
$code = $code['Jurisdiction']['code'];
$uuid = explode('-', String::uuid());
$client = $code . $uuid[2];
$chief = $code . $uuid[3];
$this->data['Sail']['auth_client'] = $client;
$this->data['Sail']['auth_chief'] = $chief;
}
return true;
}
示例9: __construct
public function __construct($id = false, $table = null, $ds = null)
{
parent::__construct($id, $table, $ds);
$this->_store = new Redis();
$handler = Configure::Read('Session.handler');
$host = 'localhost';
$port = 6379;
if (!empty($handler['host'])) {
$host = $handler['host'];
}
if (!empty($handler['port'])) {
$port = $handler['port'];
}
$this->_store->connect($host, $port);
if (!empty($handler['password'])) {
$this->_store->auth($handler['password']);
}
if (!empty($handler['db'])) {
$this->_store->select($handler['db']);
}
}
示例10: getCanonical
function getCanonical($request = null)
{
$url = rtrim(Configure::Read('Serveur.site'), "/");
// Url change only for FR
$subdomain = strtolower(substr(env("HTTP_HOST"), 0, strpos(env("HTTP_HOST"), ".")));
if ($subdomain == 'fr') {
$url = rtrim(Configure::Read('Serveur.canonical'), "/");
}
return $url . $request;
}
示例11: newPerson
public function newPerson()
{
if ($this->request->is('post')) {
$data = $this->request->data;
$data['User']['rol'] = Configure::Read('ROL.PERSON');
$data['Person']['identification'] = $data['Person']['type_id'] . $data['Person']['identification'];
unset($data['Person']['type_id']);
$this->Person->create();
if ($this->Person->saveAssociated($data)) {
$this->set('isValid', 'isValid');
$this->Session->setFlash(__('Persona registrada con exito.'), 'flash_green');
} else {
$this->Session->setFlash(__('No se pudo registrar la persona.'), 'flash_orange');
}
}
$this->layout = 'foundation';
$this->set('license_type', array("Capitan de Yate" => "Capitan de Yate", "Patron Deportivo de Primera" => "Patron Deportivo de Primera", "Patron Deportivo de Segunda" => "Patron Deportivo de Segunda", "Patron Deportivo de Tercera" => "Patron Deportivo de Tercera"));
}
示例12: getWithViewPoweredByGoogle
public function getWithViewPoweredByGoogle()
{
$google_shop_ref = $this->request->data['shop_ref'] . "";
$google_search_id = $this->request->data['shop_id'] . "";
if (!$google_shop_ref || !$google_search_id) {
return $this->responseNg('Invalid parameters.');
}
$api_key = Configure::Read('Google.ApiKey');
$shop = $this->Shop->findByGoogleId($api_key, $google_shop_ref, $google_search_id);
if (!$shop) {
return $this->responseNg('Cannot find shop.');
}
$viewed_shop = $this->Shop->makeShopDetailViewedJSON($shop);
$linkMap = $linkWeb = $linkPhone = "";
if (!empty($viewed_shop["Shop"]["lat"])) {
$linkMap = "http://maps.google.com/maps?ll={$viewed_shop['Shop']['lat']},{$viewed_shop['Shop']['lng']}";
}
if (!empty($viewed_shop["Shop"]["url"])) {
$linkWeb = "{$viewed_shop['Shop']['url']}";
}
if (!empty($viewed_shop["Shop"]["phone"])) {
$linkPhone = "tel:{$viewed_shop['Shop']['phone']}";
$linkPhone = str_replace(" ", "", $linkPhone);
}
$result = array("data" => $viewed_shop['Shop'], "comments" => array(), "img" => @$shop['photo_urls'][0], "linkMap" => $linkMap, "linkWeb" => $linkWeb, "linkPhone" => $linkPhone);
return $this->responseOk($result);
}
示例13: approved_sail
public function approved_sail()
{
$data = $this->request->input('json_decode', true);
$Message = array('message' => 'Error revise sus datos.', 'code' => 400);
if ($data != null && isset($data['sailId']) && isset($data['authClient']) && isset($data['authChief'])) {
$conditions = array('Sail.auth_client' => $data['authClient'], 'Sail.auth_chief' => $data['authChief'], 'Sail.status' => Configure::Read('STATUS.INITIAL'));
if ($this->Sail->hasAny($conditions)) {
$sail = $this->Sail->find('first', array('conditions' => $conditions));
$sail['Sail']['status'] = Configure::Read('STATUS.MODIFIED');
if ($this->Sail->save($sail)) {
$Message['message'] = 'Solicitud aprobada con exito.';
$Message['code'] = 200;
}
} else {
$Message['message'] = 'Solicitud no encontrada en el sistema o ya aprobada.';
}
}
$this->set(array('Message' => $Message, '_serialize' => array('Message')));
}
示例14: cancelSail
public function cancelSail($auth_client)
{
$conditions = array('Sail.auth_client' => $auth_client, 'Sail.status' => Configure::Read('STATUS.INITIAL'));
if ($this->Sail->hasAny($conditions)) {
$sail = $this->Sail->find('first', array('conditions' => $conditions));
$sail['Sail']['status'] = Configure::Read('STATUS.UNAVAILABLE');
if ($this->Sail->save($sail)) {
$this->Session->setFlash(__('Solicitud cancelada con exito.'), 'flash_green');
return $this->redirect(array('action' => 'indexComodoro'));
}
}
$this->Session->setFlash(__('Solicitud ya cancelada.'), 'flash_orange');
return $this->redirect(array('action' => 'indexComodoro'));
}
示例15: changeStatus
public function changeStatus($status = null, $shipPlate = null)
{
if ($status != null && $shipPlate != null) {
$searchParam = array('Ship.plate' => $shipPlate);
if ($this->Ship->hasAny($searchParam)) {
$ship = $this->Ship->findByPlate($shipPlate);
$message = "";
$date = date("Y-m-d");
$sailValidation = array('Sail.status' => Configure::Read('STATUS.INITIAL'), 'Sail.ship_id' => $ship['Ship']['id'], "Sail.sail_date" => $date);
if ($this->Ship->Sail->hasAny($sailValidation)) {
$this->Session->setFlash(__('La embarcacion tiene zarpes pendientes.'), 'flash_orange');
return $this->redirect(array('action' => 'index'));
}
switch ($status) {
case Configure::Read('STATUS.MODIFIED'):
$ship['Ship']['status'] = Configure::Read('STATUS.MODIFIED');
$message = __('Embarcacion deshabilitada con exito.');
break;
case Configure::Read('STATUS.INITIAL'):
$ship['Ship']['status'] = Configure::Read('STATUS.INITIAL');
$message = __('Embarcacion activada con exito.');
break;
default:
$this->Session->setFlash(__('Hubo un problema al actulizar la embarcacion.'), 'flash_orange');
return $this->redirect(array('action' => 'index'));
break;
}
if ($this->Ship->save($ship)) {
$this->Session->setFlash($message, 'flash_green');
} else {
$this->Session->setFlash(__('Hubo un problema al actulizar la embarcacion.'), 'flash_orange');
}
return $this->redirect(array('action' => 'index'));
}
}
$this->Session->setFlash(__('Hubo un problema al actulizar la embarcacion.'), 'flash_orange');
return $this->redirect(array('action' => 'index'));
}