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


PHP Application::getConfig方法代码示例

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


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

示例1: getKey

 /**
  * Get the key for hashing
  * 
  * @return string
  */
 private static function getKey()
 {
     if (static::$key === null) {
         static::$key = Application::getConfig('application', 'key');
     }
     return static::$key;
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:12,代码来源:Cookie.php

示例2: hostName

 /**
  * Get the host name of request or null
  * 
  * @return string
  */
 public static function hostName()
 {
     if (isset($_SERVER['HTTP_HOST'])) {
         return $_SERVER['HTTP_HOST'];
     } else {
         $siteUrl = Application::getConfig('application', 'site_url');
         return substr($siteUrl, strpos($siteUrl, '//') + 2);
     }
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:14,代码来源:Request.php

示例3: connect

 /**
  * Connects to MySQL instance with Config params
  *
  * @throws \Kernel\Exception\DatabaseException When connection is failed
  */
 private function connect()
 {
     $config = \Application::getConfig();
     if (!($this->_connection = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']))) {
         throw new DatabaseException('Could not connect to MySQL server');
     }
     if (!mysql_select_db($config['db_name'])) {
         throw new DatabaseException(sprintf('Database "%s" was not found', $config['db_name']));
     }
 }
开发者ID:dgilan,项目名称:test,代码行数:15,代码来源:Connection.php

示例4: __

 function __($var = null)
 {
     $languange = new Language();
     Application::setConfig();
     $id_lang = Application::getConfig('id_lang');
     $base = Application::getConfig('base_url');
     $lang = $this->getISO($id_lang);
     $filename = "application/core/language/" . $lang . ".php";
     if (file_exists($filename)) {
         include $filename;
     }
     $var = strtolower($var);
     if (!empty($_LANGADM[$var])) {
         return $_LANGADM[$var];
     } else {
         return $var;
     }
 }
开发者ID:novayadi85,项目名称:CBR,代码行数:18,代码来源:basic.php

示例5: safeQuery

 public function safeQuery($sql, $params, $cacheKey = null)
 {
     if (Application::getConfig("enableCache") != false) {
         if ($cacheKey == null) {
             $cacheKey = md5($sql . implode("-", $params));
         }
         $results = $this->cache->get($cacheKey);
         if ($results != null) {
             return $results;
         } else {
             $results = $this->db->rawQuery($sql, $params);
             $this->cache->set($cacheKey, $results);
             return $results;
         }
     } else {
         $results = $this->db->rawQuery($sql, $params);
         return $results;
     }
 }
开发者ID:guadin,项目名称:pylon,代码行数:19,代码来源:MysqlManager.php

示例6: mailQueueProcessAction

 public function mailQueueProcessAction()
 {
     include 'libs/class.phpmailer.php';
     include 'libs/class.smtp.php';
     $config = Application::getConfig()['mail'];
     $items = Model_MailQueue::getUnprocessedItem();
     $processedIds = array();
     foreach ($items as $item) {
         $mail = new phpMailer();
         $mail->XMailer = 'Foxmail 6.1';
         //$mail->SMTPDebug = 3;
         $mail->isSmtp(true);
         $mail->SMTPAuth = true;
         $mail->SMTPSecure = $config['smtp_secure'];
         $mail->Host = $config['smtp_host'];
         $mail->Port = $config['smtp_port'];
         $mail->Username = $config['smtp_user'];
         $mail->Password = $config['smtp_password'];
         $mail->From = $config['smtp_user'];
         $mail->FromName = 'RCR Notify';
         $mail->CharSet = 'UTF-8';
         $mail->isHtml();
         $recipients = explode(',', $item['to']);
         foreach ($recipients as $r) {
             $mail->addAddress(trim($r));
         }
         $mail->Subject = $item['subject'];
         $mail->Body = $item['message'];
         if ($mail->send()) {
             $processedIds[] = $item['id'];
         } else {
             echo $mail->ErrorInfo;
         }
     }
     Model_MailQueue::setItemAsProcessedBatch($processedIds);
 }
开发者ID:RobertCar,项目名称:RobertCarrential,代码行数:36,代码来源:ConsoleController.php

示例7: init

 /**
  * Initialize the session handler and session itself
  * 
  * @throws Exception
  */
 private static function init()
 {
     if (!static::$initialized) {
         static::$initialized = true;
         $config = Application::getConfig('session');
         if ($config === null) {
             throw new Exception('Missing config file for sessions');
         }
         session_set_cookie_params($config['cookie_life'], $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']);
         session_name($config['session_name']);
         if (isset($config['driver'])) {
             if (in_array($config['driver'], array('\\Koldy\\Session\\Driver\\File', '\\Koldy\\Session\\Driver\\Db')) && PHP_VERSION_ID < 50400) {
                 throw new Exception('PHP 5.4 or greater is reqired to use this session driver: ' . $config['driver']);
             }
             $driverClass = $config['driver'];
             $handler = new $driverClass(isset($config['options']) ? $config['options'] : array());
             if (!$handler instanceof \SessionHandlerInterface) {
                 throw new Exception('Your session driver doesn\'t implement the \\SessionHandlerInterface');
             }
             session_set_save_handler($handler);
         }
         session_start();
     }
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:29,代码来源:Session.php

示例8: editAction

 /**
  * Updates post
  *
  * @param int $id
  *
  * @return string
  */
 public function editAction($id)
 {
     if (!$this->getUser()) {
         $this->redirect('/', 'Please, login first!');
     }
     $model = new Post();
     $date = new \DateTime();
     $date->setTimezone(new \DateTimeZone(\Application::getConfig('timezone')));
     $model->set('title', Request::get('title'))->set('content', Request::get('content'))->set('id', $id)->set('updated_at', $date->format('Y-m-d H:i:s'));
     if ($model->isValid()) {
         try {
             $model->update();
             $this->redirect('/', 'The data has been saved successfully');
         } catch (DatabaseException $e) {
             array_push($errors, $e->getMessage());
         }
     } else {
         $post = $model->getFieldsObject();
         return $this->_renderView('form.html', array('post' => $post, 'errors' => $model->getErrors(), 'action' => '/posts/' . $id . '/edit'));
     }
 }
开发者ID:dgilan,项目名称:test,代码行数:28,代码来源:BlogController.php

示例9: isEnabled

 /**
  * You can check if configure mail driver is enabled or not.
  * 
  * @param string $driver [optional] will use default if not set
  * @return boolean
  */
 public static function isEnabled($driver = null)
 {
     self::init();
     if ($driver === null) {
         $driver = self::$defaultDriver;
     }
     $config = Application::getConfig('mail');
     if (!isset($config[$driver])) {
         Log::error("Mail driver '{$driver}' is not defined in config");
         Application::error(500, "Mail driver '{$driver}' is not defined in config");
     }
     return $config[$driver]['enabled'];
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:19,代码来源:Mail.php

示例10: htmlspecialchars_decode

<?php

$date = new \DateTime();
$date->setTimestamp(strtotime($post->updated_at));
$date->setTimezone(new \DateTimeZone(Application::getConfig('timezone')));
?>

<div class="row">
    <h1><?php 
echo $post->title;
?>
</h1>

    <p class="small"><?php 
echo $date->format('F j, Y H:i:s');
?>
</p>
    <?php 
echo htmlspecialchars_decode($post->content);
?>
</div>
开发者ID:dgilan,项目名称:test,代码行数:21,代码来源:show.html.php

示例11: bookingAction

    public function bookingAction()
    {
        $this->view->activeMenu = 'booking';
        $this->view->vehicleTypes = (new Model_VehicleType())->fetchPagedList(1, 999999)['rows'];
        if (!$this->_request->isPost()) {
            return;
        }
        $arp = new AjaxResponse();
        $arp->setStatus(AjaxResponse::STATUS_FAILED);
        $availableParams = array('forwho', 'city', 'contact-name', 'contact-email', 'contact-phone', 'passenger-names', 'passenger-phone', 'passenger-num', 'when', 'pickup-address', 'dropoff-address', 'vehicle', 'payment-method', 'notes');
        $via = $this->_getParam('via-address', array());
        $viaToSave = array();
        if (is_array($via)) {
            foreach ($via as $k => $v) {
                if (!empty(trim($v))) {
                    $viaToSave[] = trim($v);
                }
            }
        }
        $via = json_encode($viaToSave);
        $sn = Model_Order::generateSn();
        $order = new Model_Order();
        $order->set('sn', $sn);
        $order->set('user_id', $this->user->get('id'));
        foreach ($availableParams as $paramName) {
            $value = trim($this->getParam($paramName, ''));
            $colName = str_replace('-', '_', $paramName);
            $order->set($colName, $value);
        }
        $order->set('via', $via);
        $order->set('created_time', time());
        $order->save();
        //Mail it.
        $time = date('Y-m-d H:i', $order->get('created_time'));
        $mailBody = <<<EOT
<!DOCTYPE html>
<html lang="en">
<head>
\t<meta charset="UTF-8">
\t<title>新订单</title>
</head>
<body>
<style>
dt {
\tfont-weight:bold;
\tfont-size:12px;
}
dd {
\tfont-size:14px;
}
</style>
<h2>新订单:{$order->get('sn')}</h2>
<dl>
<dt>下单时间</dt><dd>{$time}</dd>
<dt>下单人</dt><dd>{$order->get('contact_name')}</dd>
<dt>乘客</dt><dd>{$order->get('passenger_names')}</dd>
<dt>时间</dt><dd>{$order->get('when')}</dd>
<dt>城市</dt><dd>{$order->get('city')}</dd>
<dt>起始地</dt><dd>{$order->get('pickup_address')}</dd>
<dt>终点</dt><dd>{$order->get('dropoff_address')}</dd>
</dl>
<p><a href="http://www.carrentalsbeijing.com/private-car-management/order-detail?sn={$order->get('sn')}" target="_blank">查看订单详情</a></p>
✉
</body>
</html>
EOT;
        $mailSubject = "新订单 {$order->get('passenger_names')}从{$order->get('pickup_address')}到{$order->get('dropoff_address')}";
        $mailRecipients = Application::getConfig()['order_mail_recipients'];
        $mailQueue = new Model_MailQueue();
        $mailQueue->set('to', $mailRecipients);
        $mailQueue->set('subject', $mailSubject);
        $mailQueue->set('message', $mailBody);
        $mailQueue->set('created_time', time());
        $mailQueue->save();
        $arp->setStatus(AjaxResponse::STATUS_OK);
        $arp->setMessage($sn);
        $this->json($arp);
    }
开发者ID:RobertCar,项目名称:RobertCarrential,代码行数:78,代码来源:PrivateCarController.php

示例12: _getCurrentDate

 /**
  * @return \DateTime
  */
 private function _getCurrentDate()
 {
     $date = new \DateTime();
     $date->setTimezone(new \DateTimeZone(\Application::getConfig('timezone')));
     return $date;
 }
开发者ID:dgilan,项目名称:test,代码行数:9,代码来源:SecurityModel.php

示例13: hasDriver

 /**
  * Does given driver exists (this will also return true if driver is disabled)
  * 
  * @param string $driver
  * @return boolean
  * @link http://koldy.net/docs/cache#engines
  */
 public static function hasDriver($driver)
 {
     return Application::getConfig('cache', $driver) !== null;
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:11,代码来源:Cache.php

示例14: current

 /**
  * Get the complete current URL with domain and protocol and request URI
  * 
  * @return null|string will return NULL in CLI environment
  */
 public static function current()
 {
     if (!isset($_SERVER['REQUEST_URI'])) {
         return null;
     }
     return Application::getConfig('application', 'site_url') . $_SERVER['REQUEST_URI'];
 }
开发者ID:nkammah,项目名称:Crash-Analytics,代码行数:12,代码来源:Url.php

示例15: Application

<?php

/**
 * Created by Boomerang
 * Project: CMS(Site)
 * Date: 05 Month 2013 Year
 * Site created on PHP,MySQL
 */
/*include '../../constants.php';
include '../../libraries/application/loader.php';

loader::init();*/
$baseurl = Url::getBase();
$app = new Application();
$config = $app->getConfig();
$template = $config->template;
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Главная</title>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="<?php 
echo $baseurl;
?>
/templates/<?php 
echo $template;
?>
/css/main.css"/>
开发者ID:moomot,项目名称:Simple-MVC-CMS,代码行数:31,代码来源:index.php


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