本文整理匯總了PHP中ConfigManager::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigManager::getInstance方法的具體用法?PHP ConfigManager::getInstance怎麽用?PHP ConfigManager::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getInstance方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
$this->app_path = APP_PATH;
$configManager = ConfigManager::getInstance();
if ($configManager->valueExists('global.app_path')) {
$this->app_path = $configManager->getValue('global.app_path');
}
}
示例2: getControllerUrl
public function getControllerUrl($params, $prefix = "")
{
$app_path = APP_PATH;
$configManager = ConfigManager::getInstance();
if ($configManager->valueExists('global.app_path')) {
$app_path = $configManager->getValue('global.app_path');
}
$href = "#";
if (!MOD_REWRITE) {
if (isset($params["controller"])) {
$href = $app_path . "/index.php?opcion=" . $params["controller"];
if (isset($params["action"])) {
$href .= "&action=" . $params["action"];
}
}
} else {
$href = $app_path;
if ($this->locale != '') {
$href .= "/" . $this->locale;
}
if ($prefix != "") {
$href .= "/" . $prefix;
} else {
if ($this->defaultUrlPrefix != "") {
$href .= "/" . $this->defaultUrlPrefix;
}
}
if (isset($params["controller"])) {
$href .= "/" . $params["controller"];
if (isset($params["action"])) {
$href .= "/" . $params["action"];
}
if (isset($params["params"])) {
if (is_array($params["params"])) {
foreach ($params["params"] as $param) {
$href .= "/" . $param;
}
} else {
$href .= "/" . $params["params"];
}
}
}
}
return $href;
}
示例3: wsi_addSplashImageWpFooter
/**
* Fontion utililée dans le blog (dans le footer)
*/
public function wsi_addSplashImageWpFooter()
{
// Chargement des données en base
$configBean = ConfigManager::getInstance()->get();
$siBean = SplashImageManager::getInstance()->get(1);
// Si le plugin n'est pas activé dans ses options, on ne fait rien
if ($configBean->isSplash_active() != 'true') {
return;
}
// If not in First Load Mode, exit the function
if ($configBean->isWsi_first_load_mode_active() == 'true') {
return;
}
// Si la Splash Image n'est pas dans sa plage de validité, on ne fait rien
if (WsiCommons::getdate_is_in_validities_dates() == "false") {
return;
}
// If option selected, hide splash image on mobile devices
if ($siBean->isWsi_hide_on_mobile_devices() == 'true') {
if (is_mobile_browser()) {
return;
}
}
// If wsi_display_always option is activated, not paying attention to idle time
if ($siBean->isWsi_display_always() != 'true') {
// Si l'utilisateur n'a pas été inactif assez longtemps, on ne fait rien
if (WsiCommons::enough_idle_to_splash($this->last_display) == false) {
return;
}
}
require "splash/content.inc.php";
}
示例4:
$siBean->setWsi_picture_link_url($_POST['wsi_picture_link_url']);
$siBean->setWsi_picture_link_target($_POST['wsi_picture_link_target']);
$siBean->setWsi_include_url($_POST['wsi_include_url']);
$siBean->setWsi_type($_POST['wsi_type']);
$siBean->setWsi_opacity($_POST['wsi_opacity']);
$siBean->setWsi_idle_time($_POST['wsi_idle_time']);
// Dates management
$siBean->setDatepicker_start($_POST['datepicker_start']);
$siBean->setDatepicker_end($_POST['datepicker_end']);
// Booleans management
$configBean->setSplash_active(isset($_POST['splash_active']));
$configBean->setWsi_first_load_mode_active(isset($_POST['wsi_first_load_mode_active']));
$siBean->setWsi_close_on_esc_function(isset($_POST['wsi_close_on_esc_function']));
$siBean->setWsi_close_on_click_function(isset($_POST['wsi_close_on_click_function']));
$siBean->setWsi_hide_cross(isset($_POST['wsi_hide_cross']));
$siBean->setWsi_disable_shadow_border(isset($_POST['wsi_disable_shadow_border']));
$siBean->setWsi_youtube_autoplay(isset($_POST['wsi_youtube_autoplay']));
$siBean->setWsi_youtube_loop(isset($_POST['wsi_youtube_loop']));
$siBean->setWsi_fixed_splash(isset($_POST['wsi_fixed_splash']));
$siBean->setWsi_display_always(isset($_POST['wsi_display_always']));
$siBean->setWsi_hide_on_mobile_devices(isset($_POST['wsi_hide_on_mobile_devices']));
// Valeurs des onglets
$siBean->setWsi_youtube($_POST['wsi_youtube']);
$siBean->setWsi_yahoo($_POST['wsi_yahoo']);
$siBean->setWsi_dailymotion($_POST['wsi_dailymotion']);
$siBean->setWsi_metacafe($_POST['wsi_metacafe']);
$siBean->setWsi_swf($_POST['wsi_swf']);
// Remove slash in HTML code.
$siBean->setWsi_html(stripslashes($_POST['wsi_html']));
ConfigManager::getInstance()->save($configBean);
SplashImageManager::getInstance()->save($siBean);
示例5: startUpDoctrine
protected function startUpDoctrine()
{
$configManager = ConfigManager::getInstance();
Doctrine_Manager::connection($configManager->getDbConnectionString());
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
Doctrine::loadModels(CLASSPATH . '/models');
}
示例6: get
/**
* Cherche une valeur de configuration
*
* @param string $name Le nom de la propriété à récupérer
* @return ConfigContainer|null La valeur venant de la configuration
*/
public static function get($name)
{
return ConfigManager::getInstance()->__get($name);
}
示例7: reset
/**
* Remise de toutes les options aux valeurs par défaut
*/
public function reset()
{
ConfigManager::getInstance()->reset();
SplashImageManager::getInstance()->reset();
}
示例8: run
public static function run($entrance)
{
spl_autoload_register(array('Application', 'autoload'));
//psr-0
/**
* 獲取配置信息
* 同步配置包括 / 入口配置 / 模塊配置 / app配置 / 默認配置 相互覆蓋
* 驗證 D(C()); / D(ConfigManager::getInstance($entrance));
*/
ConfigManager::getInstance($entrance)->load();
//OK 配置完成 驗證
/**
* 計算路由信息
* 驗證D(C('Router'))
*/
Router::getInstance()->load();
//路由信息 D(C('Router'));
// if($router['method_modules']){
// $basepath = $app['APP_PATH'].'Modules/'.$app['modulelist'][$router['method_modules']].'/';
// }else{
// $basepath = $hspath;
// }
Bootstrap::init();
//初始化執行
/**
* 對係統信息運算完畢,準備轉交控製權
* 轉交控製權
*/
//app-> [APP_PATH] => ../App/
// [GRACE_PATH] => ../Grace/
//加載Seter
spl_autoload_register(array('Application', 'autoload_controller'));
//psr-0
includeIfExist(C('app')['APP_PATH'] . '/Seter/I.php');
self::DoController();
exit;
exit;
/**
*
D(C());
//
// D($request->headers);
// D($request->env);
// D($request->cookies);
//
// exit;
// D(C('env'));
//// D($request->getMethod()); //提交的方法
//// D($request->isGet()); //提交的方法
//// D($request->isPost()); //提交的方法
//// D($request->isPut()); //提交的方法
//// D($request->isPatch()); //提交的方法
//// D($request->isDelete()); //提交的方法
//// D($request->isOptions()); //提交的方法
//
// D($request->getHost());
// D($request->getHostWithPort());
// D($request->getPort());
// echo '------';
// /**
// * 下麵三個path模式下不準確
// * /
// D($request->getScriptName());
// D($request->getRootUri());
// D($request->getPath());
// D($request->getPathInfo()); //同下
// D($request->getResourceUri()); //同上
//
// D($request->getIp());
//
// D($request->getRootUri());
*/
/**
* 調試
//驗證係列配置數據
D(ConfigManager::get('modulelist'));
D(ConfigManager::get('app_defaultConfig'));
D(ConfigManager::get('ent'));
D(ConfigManager::get('env'));
D(ConfigManager::get('app'));
D(C());
*/
/**
* 對request的驗證
*/
/**
* 生成對象
* router
* config
* request
* bootstrap::ini();
->>>>>>>>>>>>
在 go 中
//=================================
request ok
router ok
config ok
bootrun ok
//=================================
go中 ini ok
//.........這裏部分代碼省略.........
示例9: set_include_path
set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH . "/controllers");
set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH . "/helpers");
set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH . "/managers");
set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH . "/components");
set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH . "/filters");
set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH . "/dispatchers");
//For Doctrine. Uncomment if you use a DataBase.
//set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH."/models");
//Some extra useful includes - You can uncomment the ones you need or add new ones
//set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH."/components/plogger"); //Logger class
//set_include_path(get_include_path() . PATH_SEPARATOR . CLASSPATH."/components/phpMailer_v2.3"); //PHP Mailer
//Doctrine include. Uncomment if you use a DataBase.
//require_once(DOCTRINE_FOLDER.'/Doctrine.php');
//This is used for class loading DO NOT REMOVE!!
require_once 'FileSystem.php';
//Autoloaders registrations
//For Doctrine. Uncomment if you use a DataBase.
//spl_autoload_register(array('Doctrine', 'autoload'));
spl_autoload_register(array('FileSystem', 'autoload'));
//For Doctrine. Uncomment if you use a DataBase.
//Doctrine configuration. This works fine for most projects but you can change it as needed to suit your needs
/*$con = Doctrine_Manager::connection("{$db_conn_type}://{$db_user}:{$db_pass}@{$db_host}/{$db_name}");
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
$con->setCharset('utf8');
$con->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true);
Doctrine::loadModels(CLASSPATH.'/models');
*/
$configManager = ConfigManager::getInstance();
$configManager->setDebugLevel(2);
session_start();
示例10: wp_splash_image_options
/**
* Fonction utilisée dans la partie Admin
*/
public function wp_splash_image_options()
{
// L'utilisateur a-t-il les droits suffisants pour afficher la page
if (!current_user_can('manage_options')) {
wp_die(__("You do not have sufficient permissions to access this page.", 'wp-splash-image'));
}
$updated = false;
$reseted = false;
if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'update':
require "actions/UpdateAction.inc.php";
$updated = true;
break;
case 'reset':
require "actions/ResetAction.inc.php";
$reseted = true;
break;
}
}
// Pour le moment on ne charge que le 1er splash screen
$configBean = ConfigManager::getInstance()->get();
$siBean = SplashImageManager::getInstance()->get(1);
?>
<div class="wsi-back wrap">
<!-- Logo Info -->
<div id="display_info">
<a href="https://wordpress.org/plugins/wsi/" target="_blank">
<img id="info_img" class="tooltipped" data-position="bottom"
data-tooltip="<?php
echo __('Infos', 'wp-splash-image');
?>
"
alt="<?php
echo __('Infos', 'wp-splash-image');
?>
"
src="<?php
echo WsiCommons::getURL();
?>
/style/info.png" />
</a>
</div>
<!-- Logo Feedback -->
<div id="display_feedback">
<a target="_blank" href="https://gitter.im/ben-barbier/WP-Splash-Image">
<img id="feedback_img" class="tooltipped" data-position="bottom"
data-tooltip="<?php
echo __('Chat', 'wp-splash-image');
?>
"
alt="<?php
echo __('Chat', 'wp-splash-image');
?>
"
src="<?php
echo WsiCommons::getURL();
?>
/style/chat_logo.png" />
</a>
</div>
<!-- Logo "Buy me a Beer" -->
<div id="display_buyMeABeer">
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CKGNM6TBHU72C" target="_blank">
<img id="buyMeABeer_img" class="tooltipped" data-position="bottom"
data-tooltip="<?php
echo __('Buy me a Beer', 'wp-splash-image');
?>
"
alt="<?php
echo __('Buy me a Beer', 'wp-splash-image');
?>
"
src="<?php
echo WsiCommons::getURL();
?>
/style/beer.png" />
</a>
</div>
<!-- Logo Reset -->
<div id="display_reset" title="<?php
echo __('Reset', 'wp-splash-image');
?>
">
<form method="post" action="<?php
echo $_SERVER['REQUEST_URI'];
?>
" style="height:32px;">
<?php
wp_nonce_field('reset', 'nonce_reset_field');
?>
<input type="hidden" name="action" value="reset" />
//.........這裏部分代碼省略.........
示例11: log
/**
* Default Logger
*
* @param string $message
* @param int $level
*/
private function log($message, $level = LoggingLevel::INFO)
{
if ($this->isLoggingEnabled) {
$config = ConfigManager::getInstance()->getConfigHashmap();
// Check if logging in live
if (array_key_exists('mode', $config) && $config['mode'] == 'live') {
// Live should not have logging level above INFO.
if ($this->loggingLevel >= LoggingLevel::INFO) {
// If it is at Debug Level, throw an warning in the log.
if ($this->loggingLevel == LoggingLevel::DEBUG) {
error_log("[" . date('d-m-Y h:i:s') . "] " . $this->loggerName . ": ERROR\t: Not allowed to keep 'Debug' level for Live Environments. Reduced to 'INFO'\n", 3, $this->loggerFile);
}
// Reducing it to info level
$this->loggingLevel = LoggingLevel::INFO;
}
}
if ($level <= $this->loggingLevel) {
error_log("[" . date('d-m-Y h:i:s') . "] " . $this->loggerName . ": {$message}\n", 3, $this->loggerFile);
}
}
}
示例12: getModule
/** 獨立運行 不依賴於本類的其他方法 運行處模塊名,並且傳遞出去
* @return array
* 這個在conf中第一個被調用時入口程序
//根據pathinfo_query 獲取模塊信息
*/
public function getModule()
{
//計算模塊
//並且返回
$config = ConfigManager::getInstance();
//未完成的
$pathinfo_query = $config->env['pathinfo_query'];
$modulelist = is_array($config->modulelist) ? $config->modulelist : [];
//根據這兩個計算出模塊信息
// D($pathinfo_query);
// D($modulelist);
$pathinfo_query = strtolower($pathinfo_query);
$pq = explode('&', $pathinfo_query);
//第一個存在等號
if (!isset(explode('=', current($pq))[1])) {
$mo_ = current(explode('/', trim(array_shift($pq), '/')));
//如果存在的話,mo就是第一個/之前的值
}
foreach ($pq as $key => $value) {
$pq_ = explode('=', $value);
$pq_[0] && $pq_[1] && ($pq__[$pq_[0]] = $pq_[1]);
}
$mo_ = $pq__['m'] ?: $mo_ ?: '';
//監測是否在modulelist中
if ($mo_) {
$mo = in_array($mo_, $modulelist) ? $mo_ : '';
}
return $mo;
}