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


PHP Config::Instance方法代码示例

本文整理汇总了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;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:Ticket.php

示例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);
 }
开发者ID:jowino,项目名称:bd786110cact,代码行数:8,代码来源:ZSystem.class.php

示例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;
}
开发者ID:jowino,项目名称:bd786110cact,代码行数:9,代码来源:common.php

示例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');
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:13,代码来源:index.php

示例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);
 }
开发者ID:jowino,项目名称:bd786110cact,代码行数:14,代码来源:DB.class.php

示例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;
 }
开发者ID:jowino,项目名称:bd786110cact,代码行数:15,代码来源:Cache.class.php

示例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;
 }
开发者ID:TyroCCC,项目名称:ERP_Test,代码行数:17,代码来源:SqlHelper.php

示例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);
 }
开发者ID:norain2050,项目名称:zuituware,代码行数:17,代码来源:ZSystem.class.php

示例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;
 }
开发者ID:serker72,项目名称:master-72,代码行数:20,代码来源:Setting.class.php

示例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();
 }
开发者ID:norain2050,项目名称:zuituware,代码行数:20,代码来源:Cache.class.php

示例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());
     }
 }
开发者ID:napoleonu,项目名称:repeat8.com,代码行数:21,代码来源:DB.class.php

示例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();
 }
开发者ID:nobuhiko,项目名称:Instaphp,代码行数:26,代码来源:webrequest.php

示例13: set_config

function set_config($key, $value)
{
    $config = Config::Instance();
    return $config->get($key, $value);
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:5,代码来源:lib.php

示例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']);
 }
开发者ID:yfix,项目名称:yf,代码行数:6,代码来源:test_globals_vs_class.php

示例15: GetUserToken

 function GetUserToken()
 {
     return ToolMethod::Instance()->GetCookies(Config::Instance()->LoginUser["UserToken"]);
 }
开发者ID:TyroCCC,项目名称:ERP_Test,代码行数:4,代码来源:User.php


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