本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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();
}
}
}
示例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');
}
}
示例6: getInstance
/**
* @return AppConfig
*/
public static function getInstance()
{
if (!self::$_instance) {
self::$_instance = new AppConfig();
}
return self::$_instance;
}
示例7: getDB
public static function getDB()
{
if (is_null(self::$db)) {
self::$db = self::getMongo()->{AppConfig::get("db.mongodb.name")};
}
return self::$db;
}
示例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;
}
示例9: get_config_data
public static function get_config_data()
{
if (!($config = AppConfig::get()->first())) {
return [];
}
return $config->forAPI();
}
示例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');
}
示例11: getDefaultViewComments
static function getDefaultViewComments()
{
if (AppConfig::module('ModComments', 'DEFAULT_VIEW') == 'Timeline') {
return 'Timeline';
} else {
return 'List';
}
}
示例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);
}
}
示例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;
}
示例14: getInstance
public static function getInstance()
{
if (empty(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
示例15: getInstance
public static function getInstance()
{
if (is_null(self::$_instance)) {
self::$_instance = new Config();
}
return self::$_instance;
}