當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AppConfig類代碼示例

本文整理匯總了PHP中AppConfig的典型用法代碼示例。如果您正苦於以下問題:PHP AppConfig類的具體用法?PHP AppConfig怎麽用?PHP AppConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AppConfig類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAppConfig

 /**
  * get the application's config
  *
  * @param unknown_type $app_name
  * @param unknown_type $env
  */
 public static function getAppConfig($app_name, $env)
 {
     $app_conf = new AppConfig();
     $app_conf->setup();
     // init frameowk's dirs
     // TODO Make these dirs configable
     rtConfig::set('rt_apps_dir', rtConfig::get('rt_project_dir') . DS . 'apps');
     rtConfig::set('rt_app_dir', rtConfig::get('rt_apps_dir') . DS . $app_name);
     rtConfig::set('rt_app_config_dir', rtConfig::get('rt_app_dir') . DIRECTORY_SEPARATOR . 'config');
     rtConfig::set('rt_app_controllers_dir', rtConfig::get('rt_app_dir') . DS . 'controllers');
     rtConfig::set('rt_app_components_dir', rtConfig::get('rt_app_controllers_dir') . DS . 'components');
     rtConfig::set('rt_app_views_dir', rtConfig::get('rt_app_dir') . DS . 'views');
     rtConfig::set('rt_app_views_layout_dir', rtConfig::get('rt_app_views_dir') . DS . 'layout');
     rtConfig::set('rt_models_dir', rtConfig::get('rt_project_dir') . DS . 'lib' . DS . 'models');
     rtConfig::set('rt_app_helpers_dir', rtConfig::get('rt_app_dir') . DS . 'helper');
     rtConfig::set('rt_config_dir', rtConfig::get('rt_project_dir') . DS . 'config');
     rtConfig::set('rt_web_dir', rtConfig::get('rt_project_dir') . DS . 'web');
     rtConfig::set('rt_data_dir', rtConfig::get('rt_project_dir') . DS . 'data');
     rtAutoloader::addPath(rtConfig::get('rt_project_dir') . DS . 'lib');
     rtAutoloader::addPath(rtConfig::get('rt_models_dir'), rtConfig::get('rt_models_dir') . DS . 'generated', rtConfig::get('rt_app_controllers_dir'), rtConfig::get('rt_app_components_dir'));
     // setup app config
     require rtConfig::get('rt_app_config_dir') . DS . $app_name . 'AppConfig.class.php';
     $app_class_name = $app_name . 'AppConfig';
     $class = new $app_class_name();
     $class->setup();
     return $class;
 }
開發者ID:reeze,項目名稱:rythm,代碼行數:33,代碼來源:rtAppConfig.class.php

示例2: app_controller

function app_controller()
{
    global $session, $route, $mysqli;
    $result = false;
    include "Modules/app/AppConfig_model.php";
    $appconfig = new AppConfig($mysqli);
    if ($route->format == 'html') {
        if ($route->action == "" && $session['write']) {
            $result = view("Modules/app/client.php", array());
        }
    }
    if ($route->format == 'json') {
        if ($route->action == "setconfig" && $session['write']) {
            $result = $appconfig->set($session['userid'], get('data'));
        }
        if ($route->action == "getconfig" && $session['read']) {
            $result = $appconfig->get($session['userid']);
        }
        if ($route->action == "dataremote") {
            $id = (int) get("id");
            $start = (double) get("start");
            $end = (double) get("end");
            $interval = (int) get("interval");
            $result = json_decode(file_get_contents("http://emoncms.org/feed/data.json?id={$id}&start={$start}&end={$end}&interval={$interval}&skipmissing=0&limitinterval=0"));
        }
        if ($route->action == "valueremote") {
            $id = (int) get("id");
            $result = (double) json_decode(file_get_contents("http://emoncms.org/feed/value.json?id={$id}"));
        }
    }
    return array('content' => $result, 'fullwidth' => true);
}
開發者ID:ReneHezser,項目名稱:app,代碼行數:32,代碼來源:app_controller.php

示例3: __construct

 /**
  * 構造函數
  * @param AppConfig $app_config 應用程序的配置文件
  * @param string $action 要鎖定的動作
  * @param string $unique_id 識別的唯一id
  * @return ActionLocker
  */
 public function __construct(AppConfig $app_config, $action, $unique_id = null)
 {
     $this->uid = $unique_id;
     $cache = $app_config->getLockCacheInstance();
     $this->locker = new MemLocker($cache);
     $this->action = $action;
 }
開發者ID:GameCrusherTechnology,項目名稱:HeroTowerServer,代碼行數:14,代碼來源:ActionLocker.class.php

示例4: getActionMethodName

 /**
  * 
  * @param Request $request
  * @param \AppConfig $appConfig
  * @throws \Exception
  * @return string
  */
 public function getActionMethodName(Request $request, \AppConfig $appConfig)
 {
     if (!$appConfig->getApplicationConfig() instanceof ArrayObject) {
         throw new \Exception("Method getApplicationConfig should return Zend\\Stdlib\\ArrayObject instance");
     }
     $it = $appConfig->getApplicationConfig()->getIterator();
     while ($it->valid()) {
         if ($request->getActionName() == $it->key()) {
             return $it->current();
         }
     }
 }
開發者ID:6975usa,項目名稱:liteframe_old,代碼行數:19,代碼來源:ActionProxy.php

示例5: __construct

 public function __construct()
 {
     $this->redis = new Redis();
     if (!$this->redis->connect(AppConfig::getValue('redis_socket'))) {
         AppController::fatalError('unable to connect to Redis server');
     }
 }
開發者ID:bitcalc,項目名稱:allspark,代碼行數:7,代碼來源:redisconnection.php

示例6: getInstance

 /**
  * @return AppConfig
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new AppConfig();
     }
     return self::$_instance;
 }
開發者ID:Codealist,項目名稱:patterns,代碼行數:10,代碼來源:AppConfig.php

示例7: getDB

 public static function getDB()
 {
     if (is_null(self::$db)) {
         self::$db = self::getMongo()->{AppConfig::get("db.mongodb.name")};
     }
     return self::$db;
 }
開發者ID:aommiez,項目名稱:allianzsteel,代碼行數:7,代碼來源:MongoDB.php

示例8: get_table

 function get_table($paged = 0)
 {
     /* Execute a prepared statement by passing an array of values */
     $dbh = new PDO('mysql:dbname=' . AppConfig::gacv("AC_db") . ';host=' . AppConfig::gacv("AC_server"), AppConfig::gacv("AC_user"), AppConfig::gacv("AC_pass"));
     $sql = sprintf("select * from %s WHERE " . $this->lookup_tbl_id_col . " = :lookup_tbl_id_col OR 1 = :lookup_not_set order by %s", $this->tbl_name, $this->lookup_value_col);
     if ($paged) {
         $sql .= MyEDB_Pager::get_sql_limit_clause();
     }
     $sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY));
     //
     //$sth->execute(array(':lookup_tbl_id_col' => ($_REQUEST[$this->lookup_tbl_id_col])? $_REQUEST[$this->lookup_tbl_id_col] : $this->lookup_tbl_id_col));
     $sth->bindParam(':lookup_tbl_id_col', $lookup_tbl_id_col);
     $sth->bindParam(':lookup_not_set', $lookup_not_set);
     $lookup_tbl_id_col = $_REQUEST[$this->lookup_tbl_id_col];
     $lookup_not_set = $_REQUEST[$this->lookup_tbl_id_col] ? 0 : 1;
     $sth->execute();
     $res = $sth->fetchAll(PDO::FETCH_BOTH);
     //echo $sql.$this->lookup_tbl_id_col;//
     $table_hash = array();
     //print_r($res);
     foreach ($res as $ar) {
         //echo $sql."-".$lookup_tbl_id_col." ".$lookup_not_set;
         $table_hash[$ar[0]] = array($ar[1], "lookup_table_id" => $ar[$this->lookup_tbl_id_col], "disabled" => $ar['disabled']);
     }
     return $table_hash;
 }
開發者ID:awgtek,項目名稱:myedb,代碼行數:26,代碼來源:SubLookupTable.php

示例9: get_config_data

 public static function get_config_data()
 {
     if (!($config = AppConfig::get()->first())) {
         return [];
     }
     return $config->forAPI();
 }
開發者ID:ehyland,項目名稱:some-painter-cms,代碼行數:7,代碼來源:AppConfigDataUtil.php

示例10: process

 public function process(Vtiger_Request $request)
 {
     $shortURL = str_replace('index.php', '', AppConfig::main('site_URL'));
     $viewer = $this->getViewer($request);
     $viewer->assign('URLCSS', $shortURL . Yeti_Layout::getLayoutFile('modules/AJAXChat/Chat.css'));
     $viewer->assign('URL', $shortURL . "libraries/AJAXChat/index.php");
     $viewer->view('Index.tpl', 'AJAXChat');
 }
開發者ID:nikdejan,項目名稱:YetiForceCRM,代碼行數:8,代碼來源:Index.php

示例11: getDefaultViewComments

 static function getDefaultViewComments()
 {
     if (AppConfig::module('ModComments', 'DEFAULT_VIEW') == 'Timeline') {
         return 'Timeline';
     } else {
         return 'List';
     }
 }
開發者ID:nikdejan,項目名稱:YetiForceCRM,代碼行數:8,代碼來源:Module.php

示例12: __construct

 public function __construct()
 {
     $this->config = AppConfig::getInstance()->get();
     $this->api = new DigitalOcean($this->config->config->token);
     while (true) {
         $this->checkDroplets();
         sleep(self::UPDATE_TIME * 60);
     }
 }
開發者ID:nic-d,項目名稱:digitalocean-elasticity,代碼行數:9,代碼來源:ServerManager.php

示例13: __construct

 public function __construct()
 {
     if (AppConfig::read('Smtp.enabled')) {
         $config = array('transport' => 'Smtp', 'from' => array(AppConfig::read('Smtp.email') => AppConfig::read('Smtp.name')), 'host' => AppConfig::read('Smtp.host'), 'port' => AppConfig::read('Smtp.port'), 'timeout' => 30, 'username' => AppConfig::read('Smtp.login'), 'password' => AppConfig::read('Smtp.password'), 'client' => null, 'log' => false, 'charset' => 'utf-8', 'headerCharset' => 'utf-8');
     } else {
         $config = array('transport' => 'Mail', 'from' => array(AppConfig::read('Smtp.email') => AppConfig::read('Smtp.name')), 'charset' => 'utf-8', 'headerCharset' => 'utf-8');
     }
     $this->default = $config;
 }
開發者ID:knyk,項目名稱:kAdmin,代碼行數:9,代碼來源:email.php

示例14: getInstance

 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
開發者ID:aslikeyou,項目名稱:php_design_patterns,代碼行數:7,代碼來源:AppConfigExample.php

示例15: getInstance

 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Config();
     }
     return self::$_instance;
 }
開發者ID:TorinoL,項目名稱:activity_git1,代碼行數:7,代碼來源:index.php


注:本文中的AppConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。