本文整理汇总了PHP中Config::Instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::Instance方法的具体用法?PHP Config::Instance怎么用?PHP Config::Instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::Instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCompanyEmail
static function getCompanyEmail($company_id)
{
// Get the email address for the company
// Use the first Technical address that is not defined as name TICKET_SUPPORT
// TICKET_SUPPORT is defined in conf/config.php
// If that does not exist, use the main address
$config = Config::Instance();
$contact = '';
$company = new Company();
$company->load($company_id);
$party = $company->party;
$sh = new SearchHandler(new PartyContactMethodCollection(new PartyContactMethod()), false);
$sh->AddConstraint(new Constraint('type', '=', 'E'));
$ticket_support = $config->get('TICKET_SUPPORT');
if (!empty($ticket_support)) {
$sh->AddConstraint(new Constraint('name', '!=', $ticket_support));
}
$party->addSearchHandler('contactmethods', $sh);
$methods = $party->contactmethods;
foreach ($methods as $method) {
if ($method->technical == true) {
// Technical contact favoured above all else
$contact = $method->contact;
break;
}
if ($method->main == true) {
// If no contact yet found and this contact is the main contact, use this instead
$contact = $method->contact;
}
}
return $contact;
}
示例2: GetINI
public static function GetINI()
{
$INI = Config::Instance('php');
$SYS = Table::Fetch('system', 1);
$SYS = Utility::ExtraDecode($SYS['value']);
$INI = Config::MergeINI($INI, $SYS);
return self::BuildINI($INI);
}
示例3: I
function I($key)
{
global $lang_properties, $LC;
if (!$lang_properties) {
$ini = DIR_ROOT . '/i18n/' . $LC . '/properties.ini';
$lang_properties = Config::Instance($ini);
}
return isset($lang_properties[$key]) ? $lang_properties[$key] : $key;
}
示例4: uzerp_exception_handler
function uzerp_exception_handler($exception)
{
$smarty = new Smarty();
$config = Config::Instance();
$smarty->assign('config', $config->get_all());
$smarty->compile_dir = DATA_ROOT . 'templates_c';
$smarty->assign('exception_message', $exception->getMessage());
$smarty->assign('support_email', $config->get('ADMIN_EMAIL'));
$email_body = "Request: " . $_SERVER['REQUEST_URI'] . "\n";
$email_body .= "uzERP Version: " . $config->get('SYSTEM_VERSION') . "\n\n" . $exception->getMessage();
$smarty->assign('email_body', rawurlencode($email_body));
$smarty->display(STANDARD_TPL_ROOT . 'error.tpl');
}
示例5: __construct
function __construct()
{
$config = Config::Instance('php');
$host = (string) $config['db']['host'];
$user = (string) $config['db']['user'];
$pass = (string) $config['db']['pass'];
$name = (string) $config['db']['name'];
self::$mConnection = mysql_connect($host, $user, $pass);
if (mysql_errno()) {
throw new Exception("Connect failed: " . mysql_error());
}
@mysql_select_db($name, self::$mConnection);
@mysql_query("SET NAMES UTF8;", self::$mConnection);
}
示例6: _CreateCacheInstance
private static function _CreateCacheInstance()
{
$ini = Config::Instance('ini');
settype($ini['memcache'], 'array');
if (!class_exists('Memcache')) {
return new FalseCache();
}
$cache_instance = new Memcache();
foreach ($ini['memcache'] as $one) {
$server = (string) $one;
list($ip, $port, $weight) = explode(':', $server);
$cache_instance->addServer($ip, $port, true, $weight, 1, 15, true, array('Cache', 'FailureCallback'));
}
return $cache_instance;
}
示例7: Connect
private function Connect()
{
if (!self::$_connectSource) {
if (Config::Instance()->DB["port"] != "") {
//存在端口号
self::$_connectSource = mysql_connect(Config::Instance()->DB["host"] . ":" . Config::Instance()->DB["port"], Config::Instance()->DB["user"], Config::Instance()->DB["password"]);
} else {
self::$_connectSource = mysql_connect(Config::Instance()->DB["host"], Config::Instance()->DB["user"], Config::Instance()->DB["password"]);
}
if (!self::$_connectSource) {
throw new Exception("mysql connect error" . mysql_error());
}
mysql_select_db(Config::Instance()->DB["database"], self::$_connectSource);
mysql_query("set names UTF8", self::$_connectSource);
}
return self::$_connectSource;
}
示例8: GetINI
public static function GetINI()
{
global $INI;
/* load from php*/
$dbphp = DIR_CONFIGURE . '/db.php';
if (file_exists($dbphp)) {
configure_load();
} else {
/* end */
$INI = Config::Instance('php');
$SYS = Table::Fetch('system', 1);
$SYS = Utility::ExtraDecode($SYS['value']);
$INI = Config::MergeINI($INI, $SYS);
}
$INI = ZSystem::WebRoot();
return self::BuildINI($INI);
}
示例9: GetTag
static function GetTag($tagname = 'dochead', $ass = null)
{
$xml = Config::Instance('xml');
$r = array();
if (!$xml->{$tagname}->item) {
return $r;
}
foreach ($xml->{$tagname}->item as $one) {
$attr = $one->attributes();
$pa = array();
foreach ($attr as $k => $v) {
$pa[strval($k)] = strval($v);
}
$r[] = $pa;
}
if ($ass) {
return Utility::AssColumn($r, 'id');
}
return $r;
}
示例10: _CreateCacheInstance
private static function _CreateCacheInstance()
{
global $INI;
$ini = Config::Instance('php');
settype($ini['memcache'], 'array');
if (!class_exists('Memcache', false)) {
return new FalseCache();
}
$cache_instance = new Memcache();
foreach ($INI['memcache'] as $one) {
$server = (string) $one;
list($ip, $port, $weight) = explode(':', $server);
if (!$ip || !$port || !$weight) {
continue;
}
$cache_instance->addServer($ip, $port, true, $weight, 1, 15, true, array('Cache', 'FailureCallback'));
self::$mIndex++;
}
return self::$mIndex ? $cache_instance : new FalseCache();
}
示例11: __construct
function __construct($type = 'master')
{
$config = Config::Instance('php');
$s_host = (string) $config['db']['host']['s'];
$m_host = (string) $config['db']['host']['m'];
$user = (string) $config['db']['user'];
$pass = (string) $config['db']['pass'];
$name = (string) $config['db']['name'];
if ($type == 'master') {
self::$mConnection = mysql_connect($m_host, $user, $pass, true);
@mysql_select_db($name, self::$mConnection);
@mysql_query("SET NAMES UTF8;", self::$mConnection);
} else {
self::$sConnection = mysql_connect($s_host, $user, $pass, true);
@mysql_select_db($name, self::$sConnection);
@mysql_query("SET NAMES UTF8;", self::$sConnection);
}
if (mysql_errno()) {
throw new Exception("Connect failed: " . mysql_error());
}
}
示例12: __construct
/**
* Constructor is private final. Can only be instantiated via WebRequest::Instance()
* @access private
* @final
*/
private final function __construct()
{
$this->mh = curl_multi_init();
if (isset(Config::Instance()->Endpoint['timeout'])) {
$this->_options[CURLOPT_TIMEOUT] = Config::Instance()->Endpoint['timeout'];
}
$this->_options[CURLOPT_USERAGENT] = 'Instaphp/v' . INSTAPHP_VERSION;
//-- this is an interesting hack to make curl+ssl+windows follow redirects
//-- without skipping verification. For some reason, the version of libcurl/curl
//-- included with ZendServer CE doesn't use the systems CA bundle, so, we specify
//-- the path to the cert here (via config setting)
if (isset(Config::Instance()->Instaphp->CACertBundlePath) && !empty(Config::Instance()->Instaphp->CACertBundlePath)) {
$this->_options[CURLOPT_SSL_VERIFYPEER] = true;
$this->_options[CURLOPT_SSL_VERIFYHOST] = 2;
$this->_options[CURLOPT_SSLVERSION] = 3;
$this->_options[CURLOPT_CAINFO] = Config::Instance()->Instaphp->CACertBundlePath;
}
$this->_options[CURLOPT_HTTPHEADER] = array("Connection: keep-alive", "Keep-Alive: 300", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Accept-Language: en-us,en;q=0.5");
$this->_requests = array();
$this->_responses = array();
}
示例13: set_config
function set_config($key, $value)
{
$config = Config::Instance();
return $config->get($key, $value);
}
示例14: test_class_wrap_read
public function test_class_wrap_read()
{
$config = Config::Instance();
$this->_class_wrap_read();
$this->assertEquals($config->variable('array'), $GLOBALS['var']);
}
示例15: GetUserToken
function GetUserToken()
{
return ToolMethod::Instance()->GetCookies(Config::Instance()->LoginUser["UserToken"]);
}