本文整理汇总了PHP中Configure::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::get方法的具体用法?PHP Configure::get怎么用?PHP Configure::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* 设置某cookie变量的值
*
* @access public
*
* @param string $name cookie的变量名
* @param mixed $value cookie值
* @param integer $expire cookie的生存周期
* @param string $path cookie所存放的目录
* @param string $domain cookie所支持的域名
*
* @return boolean
*/
public static function set($name, $value, $expire = null, $path = null, $domain = null)
{
//参数分析
if (!$name) {
return false;
}
//获取cookie的配置信息
if (is_null($expire)) {
$configExpire = Configure::get('cookie.expire');
$expire = !$configExpire ? self::$_defaultConfig['expire'] : $configExpire;
}
if (is_null($path)) {
$configPath = Configure::get('cookie.path');
$configPath = !$configPath ? $configPath : rtrim($configPath, '/') . '/';
$path = !$configPath ? self::$_defaultConfig['path'] : $configPath;
}
if (is_null($domain)) {
$configDomain = Configure::get('cookie.domain');
$domain = !$configDomain ? self::$_defaultConfig['domain'] : $configDomain;
}
$expire = time() + $expire;
setcookie($name, $value, $expire, $path, $domain);
$_COOKIE[$name] = $value;
return true;
}
示例2: __construct
/**
* 构造方法
*
* 用于初始化运行环境,或对基本变量进行赋值
*
* @access public
*
* @param array $params 数据库连接参数,如主机名,数据库用户名,密码等
*
* @return boolean
*/
public function __construct($params = array())
{
if (!extension_loaded('mongo')) {
Controller::halt('The mongo extension to be loaded!');
}
//参数分析
if (!$params || !is_array($params)) {
//加载数据库配置文件.
$params = Configure::get('mongo');
}
$params = is_array($params) ? $params + $this->_defaultConfig : $this->_defaultConfig;
if (!isset($params['dbname']) || !$params['dbname']) {
Controller::halt('The file of MongoDB config is error, dbname is not found!');
}
try {
//实例化mongo
$this->_mongo = new Mongo($params['dsn'], $params['option']);
//连接mongo数据库
$this->_dbLink = $this->_mongo->selectDB($params['dbname']);
//用户登录
if (isset($params['username']) && isset($params['password'])) {
$this->_dbLink->authenticate($params['username'], $params['password']);
}
return true;
} catch (Exception $exception) {
//抛出异常信息
throw new DoitException('MongoDb connect error!<br/>' . $exception->getMessage(), $exception->getCode());
}
}
示例3: __construct
public function __construct($options)
{
$this->options = array_merge($this->options, $options);
$this->Session = Session::getInstance();
$this->db = Orm::loadModel('Users');
$this->options['salt'] = Configure::get('globals.salt');
}
示例4: __construct
/**
* Initialize
*/
public function __construct()
{
parent::__construct();
// Set the company ID
$this->company_id = Configure::get("Blesta.company_id");
$this->dir = PLUGINDIR . "css_javascript_toolbox/includes/" . $this->company_id . "/";
Language::loadLang("model", null, PLUGINDIR . "css_javascript_toolbox" . DS . "language" . DS);
}
示例5: setMeta
/**
* Sets the meta data to use for this invoice. This method is invoked after
* __construct() but before makeDocument()
*
* @param array $meta An array of meta data including:
* -background The absolute path to the background graphic
* -logo The absolute path to the logo graphic
* -company_name The name of the company
* -company_address The address of the company
* -terms The terms to display on this invoice
* -paper_size The size of paper to use (e.g. "A4" or "Letter")
* -tax An array of tax info including:
* -tax_id The Tax ID/VATIN of this company
* -cascade_tax Whether or not taxes are cascading
*/
public function setMeta($meta)
{
$this->meta = $meta;
$font = isset($this->meta['settings']['inv_font_' . Configure::get("Blesta.language")]) ? $this->meta['settings']['inv_font_' . Configure::get("Blesta.language")] : null;
$this->pdf = new HtmlInvoicePdf("P", "px", $this->meta['paper_size'], true, 'UTF-8', false, $font);
$this->html = new HtmlInvoiceHtm("P", "px", $this->meta['paper_size'], true, 'UTF-8', false, $font);
// Set the meta data to use for this invoice
$this->pdf->meta = $this->meta;
$this->html->meta = $this->meta;
}
示例6: init
public static function init()
{
$databaseConfigure = Configure::get('database');
if ($databaseConfigure['type'] == 'mysql') {
self::setup('mysql:host=' . $databaseConfigure['host'] . ';dbname=' . $databaseConfigure['databasename'], $databaseConfigure['account'], $databaseConfigure['password']);
//for both mysql or mariaDB
} else {
self::setup();
}
}
示例7: __construct
public function __construct()
{
Language::loadLang("admin", null, dirname(__FILE__) . DS . "language" . DS);
// Load components required by this plugin
Loader::loadComponents($this, array("Input", "Record"));
// Load modules for this plugun
Loader::loadModels($this, array("ModuleManager"));
$this->loadConfig(dirname(__FILE__) . DS . "config.json");
$this->upload_path = PLUGINDIR . "css_javascript_toolbox/includes/" . Configure::get("Blesta.company_id") . DS;
}
示例8: __construct
public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8')
{
Language::loadLang("html_invoice", null, dirname(__FILE__) . DS . "language" . DS);
Loader::loadModels($this, array("Companies", "Transactions"));
$company_id = Configure::get("Blesta.company_id");
$this->company = $this->Companies->get($company_id);
$this->Html = new Html();
$buffer = '';
$this->rtl = '';
}
示例9: init
/**
* Performs necessary initialization
*/
private function init()
{
// Require login
$this->parent->requireLogin();
// Set the company ID
$this->company_id = Configure::get("Blesta.company_id");
$this->uses(array("CssJavascriptToolbox.Toolbox"));
$this->Date = $this->parent->Date;
// Set the plugin ID
$this->plugin_id = isset($this->get[0]) ? $this->get[0] : null;
$this->dir = PLUGINDIR . "css_javascript_toolbox/includes/" . $this->company_id . "/";
// Set the page title
$this->parent->structure->set("page_title", Language::_("CssJavascriptToolboxPlugin." . Loader::fromCamelCase($this->action ? $this->action : "index") . ".page_title", true));
// Set the view to render for all actions under this controller
$this->view->setView(null, "CssJavascriptToolbox.default");
// $directory = CONTROLLERDIR ;
}
示例10: __construct
/**
* 构造函数
*
* @access public
*
* @param array $params 数据库连接参数,如主机名,数据库用户名,密码等
*
* @return boolean
*/
public function __construct($options = null)
{
if (!extension_loaded('redis')) {
Controller::halt('The redis extension to be loaded!');
}
//当参数为空时,程序则自动加载配置文件中数据库连接参数
if (!$options || !is_array($options)) {
$options = Configure::get('redis');
if (!$options) {
$options = array();
}
}
$options += $this->_defaultServer;
//连接数据库
$this->_dbLink = new Redis();
$this->_dbLink->connect($options['host'], $options['port']);
return true;
}
示例11: __construct
/**
* 构造方法
*
* 用于初始化本类的运行环境,或对基本变量进行赋值
*
* @access public
* @return boolean
*/
public function __construct()
{
//时区设置,默认为中国(北京时区)
date_default_timezone_set(Configure::get('application.defaultTimeZone'));
//设置异常处理
set_exception_handler(array($this, '_exception'));
//关闭魔术变量,提高PHP运行效率
if (get_magic_quotes_runtime()) {
@set_magic_quotes_runtime(0);
}
//将全局变量进行魔术变量处理,过滤掉系统自动加上的'\'.
if (get_magic_quotes_gpc()) {
$_POST = $_POST ? $this->_stripSlashes($_POST) : array();
$_GET = $_GET ? $this->_stripSlashes($_GET) : array();
$_SESSION = $_SESSION ? $this->_stripSlashes($_SESSION) : array();
$_COOKIE = $_COOKIE ? $this->_stripSlashes($_COOKIE) : array();
}
//实例化视图对象
self::$_viewObject = $this->initView();
//回调函数,实例化控制器(Controller)时,执行所要补充的程序
$this->init();
return true;
}
示例12: __construct
/**
* 构造方法
*
* @access public
*
* @param array $params 数据库连接参数,如主机名,数据库用户名,密码等
*
* @return boolean
*/
public function __construct($options = null)
{
//分析memcache扩展模块的加载
if (!extension_loaded('memcache')) {
Controller::halt('The memcache extension to be loaded before use!');
}
//获取Memcache服务器连接参数
if (!$options || !is_array($options)) {
$options = Configure::get('memcache');
}
if (is_array($options) && $options) {
$this->_defaultOptions = $options + $this->_defaultOptions;
}
if (!$this->_defaultOptions['servers']) {
$this->_defaultOptions['servers'][] = $this->_defaultServer;
}
$this->_dbLink = new Memcache();
foreach ($this->_defaultOptions['servers'] as $server) {
$server += array('host' => '127.0.0.1', 'port' => 11211, 'persistent' => true);
$this->_dbLink->addServer($server['host'], $server['port'], $this->_defaultOptions['persistent']);
}
return true;
}
示例13: FinalTemplate
public function FinalTemplate($Header = null, $HtmlDir = null, $HtmlTitle = null, $RtlCss = null, $drawBackground = null, $drawLogo = null, $drawPaidWatermark = null, $drawInvoiceType = null, $drawInvoiceInfo = null, $drawReturnAddress = null, $drawAddress = null, $drawLineHeader = null, $drawInvoice = null, $SubTotals = null, $Taxes = array(), $Totals = null, $PublicNotes = null, $drawPayments = null, $drawTerms = null, $Footer = null, $PrintBtn = null, $DownloadBtn = null, $PaymentBtn = null, $EditBtn = null)
{
/*
*
NOTE , The $Header include all the header
*
*/
// print_r($drawInvoiceInfo['invoice_view']);
if (strpos($_SERVER['REQUEST_URI'], Configure::get("Route.admin"))) {
$return_rl = WEBDIR . Configure::get("Route.admin") . "/clients/view/" . $drawInvoiceInfo['client_view'] . "/";
$payment_btn = '
<div class="btn-group">
<button type="button" class="btn btn-warning btn-lg dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.add_payment", true) . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . WEBDIR . Configure::get("Route.admin") . '/clients/makepayment/' . $drawInvoiceInfo['client_view'] . '/' . $drawInvoiceInfo['invoice_view'] . '"><span class="glyphicon glyphicon-credit-card" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.pay_invoice", true) . '</a></li>
<li class="divider"></li>
<li><a href="' . WEBDIR . Configure::get("Route.admin") . '/clients/recordpayment/' . $drawInvoiceInfo['client_view'] . '/' . $drawInvoiceInfo['invoice_view'] . '"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.record_invoice", true) . '</a></li>
</ul>
</div>';
$edit_btn = '
<button type="button" class="btn btn-info btn-lg " onclick="window.location.href=\'' . WEBDIR . Configure::get("Route.admin") . '/clients/editinvoice/' . $drawInvoiceInfo['client_view'] . '/' . $drawInvoiceInfo['invoice_view'] . '\'">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.edit_invoice", true) . '
</button>';
} else {
$return_rl = WEBDIR . Configure::get("Route.client") . "/";
$payment_btn = '
<button type="button" class="btn btn-warning btn-lg" onclick="window.location.href=\'' . WEBDIR . Configure::get("Route.client") . '/pay/method/' . $drawInvoiceInfo['invoice_view'] . '/\'">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.pay_invoice", true) . '
</button>';
$edit_btn = '';
}
$paid_watermark = '
<button type="button" class="btn btn-success btn-lg active" >
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.watermark_paid", true) . '
</button>';
$unpaid_watermark = '
<button type="button" class="btn btn-danger btn-lg active" >
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.watermark_unpaid", true) . '
</button>';
$download_btn = '
<button type="button" class="btn btn-primary btn-lg " onclick="window.location.href=\'' . $_SERVER['REQUEST_URI'] . '/pdf/\'">
<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.download_invoice", true) . '
</button>';
$print_btn = '
<button type="button" class="btn btn-primary btn-lg" onclick="javascript:window.print();" >
<span class="glyphicon glyphicon-print" aria-hidden="true"></span> ' . Language::_("HtmlInvoice.print_invoice", true) . '
</button>';
$draw_terms = '
<div class="row">
<div class="col-xs-12">
<h3><span class="label label-default">' . Language::_("HtmlInvoice.terms_heading", true) . '</span></h3>
<div class="well well-sm">' . nl2br($drawTerms) . '</div>
</div>
</div>';
$taxe_line = "";
foreach ($Taxes as $Taxe) {
$taxe_line .= '
<tr>
<th colspan="2" class="warning text-right"><h4>' . $Taxe['label'] . '</h4></th>
<th class="warning text-right"><h4>' . $Taxe['value'] . '</h4></th>
</tr>';
}
$content = '
<!doctype html>
<html dir="' . $HtmlDir . '">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>' . $HtmlTitle . ' </title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
' . (Language::_("AppController.lang.dir", true) == "rtl" ? '<link rel="stylesheet" href="//cdn.rawgit.com/morteza/bootstrap-rtl/master/dist/cdnjs/3.3.1/css/bootstrap-rtl.min.css">' : '') . '
<style>
' . $drawBackground . '
' . $RtlCss . '
header {margin-top: 70px;}
</style>
</head>
<body>
<div class="container">
<header class="header">
<div class="row">
<div class="col-md-5 col-xs-12 ">
<div class="thumbnail">
<div class=" text-left">' . $drawLogo . '</div>
</div>
</div>
<div class="col-md-5 col-xs-12 col-md-offset-2 text-right flip ">
<h1>' . $drawInvoiceType . '</h1>
<div class="row">
<div class="col-md-8 col-md-offset-4 col-xs-12">
<dl class="dl-horizontal">
<dt>' . $drawInvoiceType . Language::_("HtmlInvoice.invoice_id_code", true) . '</dt>
<dd>' . $drawInvoiceInfo['invoice_id'] . '</dd>
<dt>' . Language::_("HtmlInvoice.client_id_code", true) . '</dt>
//.........这里部分代码省略.........
示例14: init
public static function init()
{
$routeType = Configure::get('route.type');
if ($routeType == 'custom') {
self::custom();
} else {
self::pathInfo();
}
}
示例15: _getLogFilePath
/**
* 获取当前日志文件名
*
* @example
*
* $this->__getLogFilePath('sql');
* 或
* $this->__getLogFilePath('2012-11.2012-11-23');
* 或
* $this->__getLogFilePath('2012-11/2012-11-23');
*
* @access private
*
* @param $logFileName 日志文件名
*
* @return string
*/
private static function _getLogFilePath($logFileName = null)
{
//参数分析
if ($logFileName && strpos($logFileName, '.') !== false) {
$logFileName = str_replace('.', '/', $logFileName);
}
//组装日志文件路径
$logFilePath = rtrim(Configure::get('application.logPath'), '/') . DIRECTORY_SEPARATOR;
if (!$logFileName) {
$logFilePath .= date('Y-m') . '/' . date('Y-m-d');
} else {
if (strpos($logFileName, '/') !== false) {
$logFilePath .= $logFileName;
} else {
$logFilePath .= date('Y-m') . '/' . $logFileName;
}
}
$logFilePath .= '.log';
return $logFilePath;
}