本文整理汇总了PHP中Configurator类的典型用法代码示例。如果您正苦于以下问题:PHP Configurator类的具体用法?PHP Configurator怎么用?PHP Configurator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Configurator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param \Nette\Http\Session $session Session
* @param \Nette\Caching\IStorage $cacheStorage Cache storage
* @param array $config Custom configuration
*/
public function __construct(\Nette\Http\Session $session, \Nette\Caching\IStorage $cacheStorage, $config)
{
$this->session = $session;
$this->cacheStorage = $cacheStorage;
$configurator = new Configurator();
$this->parameters = $configurator->createConfig($config);
}
示例2: setLastRobin
function setLastRobin($lastRobin)
{
require_once 'modules/Configurator/Configurator.php';
$cfg = new Configurator();
$cfg->config['aop']['last_robin'] = $lastRobin;
$cfg->saveConfig();
}
示例3: process
/**
* @see SugarView::process()
*/
public function process()
{
global $current_user;
if (!is_admin($current_user)) {
sugar_die("Unauthorized access to administration.");
}
// Check if default_theme is valid
if (isset($_REQUEST['default_theme']) && !in_array($_REQUEST['default_theme'], array_keys(SugarThemeRegistry::allThemes()))) {
sugar_die("Default theme is invalid.");
}
if (isset($_REQUEST['disabled_themes'])) {
$toDecode = html_entity_decode($_REQUEST['disabled_themes'], ENT_QUOTES);
$disabledThemes = json_decode($toDecode, true);
if (($key = array_search(SugarThemeRegistry::current()->__toString(), $disabledThemes)) !== FALSE) {
unset($disabledThemes[$key]);
}
$_REQUEST['disabled_themes'] = implode(',', $disabledThemes);
$configurator = new Configurator();
$configurator->config['disabled_themes'] = $_REQUEST['disabled_themes'];
$configurator->config['default_theme'] = $_REQUEST['default_theme'];
$configurator->handleOverride();
echo "true";
} else {
parent::process();
}
}
示例4: process
/**
* @see SugarView::process()
*/
public function process()
{
global $current_user;
if (!is_admin($current_user)) {
sugar_die("Unauthorized access to administration.");
}
// Check if the theme is valid
if (!isset($_REQUEST['theme']) || !in_array($_REQUEST['theme'], array_keys(SugarThemeRegistry::allThemes()))) {
sugar_die("theme is invalid.");
}
if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') {
$theme_config = SugarThemeRegistry::getThemeConfig($_REQUEST['theme']);
$configurator = new Configurator();
foreach ($theme_config as $name => $def) {
if (isset($_REQUEST[$name])) {
if ($_REQUEST[$name] == 'true') {
$_REQUEST[$name] = true;
} else {
if ($_REQUEST[$name] == 'false') {
$_REQUEST[$name] = false;
}
}
$configurator->config['theme_settings'][$_REQUEST['theme']][$name] = $_REQUEST[$name];
}
}
$configurator->handleOverride();
SugarApplication::redirect('index.php?module=Administration&action=ThemeSettings');
exit;
}
parent::process();
}
示例5: display
/**
* @see SugarView::display()
*/
public function display()
{
global $current_user, $mod_strings, $app_strings, $app_list_strings, $sugar_config, $locale;
$configurator = new Configurator();
$sugarConfig = SugarConfig::getInstance();
$focus = new Administration();
$configurator->parseLoggerSettings();
$focus->retrieveSettings();
if (!empty($_POST['restore'])) {
$configurator->restoreConfig();
}
$this->ss->assign('MOD', $mod_strings);
$this->ss->assign('APP', $app_strings);
$this->ss->assign('APP_LIST', $app_list_strings);
$this->ss->assign('config', $configurator->config);
$this->ss->assign('error', $configurator->errors);
$this->ss->assign("AUTO_REFRESH_INTERVAL_OPTIONS", get_select_options_with_id($app_list_strings['dashlet_auto_refresh_options_admin'], isset($configurator->config['dashlet_auto_refresh_min']) ? $configurator->config['dashlet_auto_refresh_min'] : 30));
$this->ss->assign('LANGUAGES', get_languages());
$this->ss->assign("JAVASCRIPT", get_set_focus_js() . get_configsettings_js());
$this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
$this->ss->assign("settings", $focus->settings);
$this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
if (!empty($focus->settings['proxy_on'])) {
$this->ss->assign("PROXY_CONFIG_DISPLAY", 'inline');
} else {
$this->ss->assign("PROXY_CONFIG_DISPLAY", 'none');
}
if (!empty($focus->settings['proxy_auth'])) {
$this->ss->assign("PROXY_AUTH_DISPLAY", 'inline');
} else {
$this->ss->assign("PROXY_AUTH_DISPLAY", 'none');
}
if (!empty($configurator->config['logger']['level'])) {
$this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), $configurator->config['logger']['level']));
} else {
$this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), ''));
}
if (!empty($configurator->config['lead_conv_activity_opt'])) {
$this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), $configurator->config['lead_conv_activity_opt']));
} else {
$this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), ''));
}
if (!empty($configurator->config['logger']['file']['suffix'])) {
$this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, $configurator->config['logger']['file']['suffix']));
} else {
$this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, ''));
}
echo $this->getModuleTitle(false);
$this->ss->display('modules/Configurator/tpls/EditView.tpl');
$javascript = new javascript();
$javascript->setFormName("ConfigureSettings");
$javascript->addFieldGeneric("notify_fromaddress", "email", $mod_strings['LBL_NOTIFY_FROMADDRESS'], TRUE, "");
$javascript->addFieldGeneric("notify_subject", "varchar", $mod_strings['LBL_NOTIFY_SUBJECT'], TRUE, "");
$javascript->addFieldGeneric("proxy_host", "varchar", $mod_strings['LBL_PROXY_HOST'], TRUE, "");
$javascript->addFieldGeneric("proxy_port", "int", $mod_strings['LBL_PROXY_PORT'], TRUE, "");
$javascript->addFieldGeneric("proxy_password", "varchar", $mod_strings['LBL_PROXY_PASSWORD'], TRUE, "");
$javascript->addFieldGeneric("proxy_username", "varchar", $mod_strings['LBL_PROXY_USERNAME'], TRUE, "");
echo $javascript->getScript();
}
示例6: testConfiguratorAddsRoutesFromLoaderToCollection
public function testConfiguratorAddsRoutesFromLoaderToCollection()
{
$collection = $this->getMockCollection();
$loader = $this->getMockLoader();
$loader->expects($this->once())->method('loadRoutes')->with($collection);
$instance = new Configurator($loader);
$instance->configure($collection);
}
示例7: install_aod
function install_aod()
{
require_once 'modules/Configurator/Configurator.php';
$cfg = new Configurator();
if (empty($cfg->config['aod'])) {
$cfg->config['aod'] = array('enable_aod' => true);
}
$cfg->saveConfig();
addAODSchedulers();
}
示例8: setAppSettings
function setAppSettings($appId, $appSecret)
{
if (ctype_alnum($appId) && strlen($appId) == 20 && ctype_alnum($appSecret) && strlen($appSecret) == 40) {
$configurator = new Configurator();
$configurator->config['authenticationClass'] = "LatchAuthenticate";
$configurator->config['appId'] = $appId;
$configurator->config['appSecret'] = $appSecret;
$configurator->handleOverride();
}
}
示例9: testPopulateFromPostConvertsBoolValuesFromStrings
public function testPopulateFromPostConvertsBoolValuesFromStrings()
{
$_POST = array('disable_export' => 'true', 'admin_export_only' => 'false', 'upload_dir' => 'yummy');
$cfg = new Configurator();
$cfg->populateFromPost();
$this->assertEquals($cfg->config['disable_export'], true);
$this->assertEquals($cfg->config['admin_export_only'], false);
$this->assertEquals($cfg->config['upload_dir'], 'yummy');
$_POST = array();
}
示例10: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
$admin = Administration::getSettings();
require 'modules/Trackers/config.php';
///////////////////////////////////////////////////////////////////////////////
//// HANDLE CHANGES
if (isset($_POST['process'])) {
if ($_POST['process'] == 'true') {
foreach ($tracker_config as $entry) {
if (isset($entry['bean'])) {
//If checkbox is unchecked, we add the entry into the config table; otherwise delete it
if (empty($_POST[$entry['name']])) {
$admin->saveSetting('tracker', $entry['name'], 1);
} else {
$db = DBManagerFactory::getInstance();
$db->query("DELETE FROM config WHERE category = 'tracker' and name = '" . $entry['name'] . "'");
}
}
}
//foreach
//save the tracker prune interval
if (!empty($_POST['tracker_prune_interval'])) {
$admin->saveSetting('tracker', 'prune_interval', $_POST['tracker_prune_interval']);
}
//save log slow queries and slow query interval
$configurator = new Configurator();
$configurator->saveConfig();
}
//if
header('Location: index.php?module=Administration&action=index');
}
echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", translate('LBL_TRACKER_SETTINGS', 'Administration')), false);
$trackerManager = TrackerManager::getInstance();
$disabledMonitors = $trackerManager->getDisabledMonitors();
$trackerEntries = array();
foreach ($tracker_config as $entry) {
if (isset($entry['bean'])) {
$disabled = !empty($disabledMonitors[$entry['name']]);
$trackerEntries[$entry['name']] = array('label' => $mod_strings['LBL_' . strtoupper($entry['name']) . '_DESC'], 'helpLabel' => $mod_strings['LBL_' . strtoupper($entry['name']) . '_HELP'], 'disabled' => $disabled);
}
}
$configurator = new Configurator();
$this->ss->assign('config', $configurator->config);
$config_strings = return_module_language($GLOBALS['current_language'], 'Configurator');
$mod_strings['LOG_SLOW_QUERIES'] = $config_strings['LOG_SLOW_QUERIES'];
$mod_strings['SLOW_QUERY_TIME_MSEC'] = $config_strings['SLOW_QUERY_TIME_MSEC'];
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('app', $app_strings);
$this->ss->assign('trackerEntries', $trackerEntries);
$this->ss->assign('tracker_prune_interval', !empty($admin->settings['tracker_prune_interval']) ? $admin->settings['tracker_prune_interval'] : 30);
$this->ss->display('modules/Trackers/tpls/TrackerSettings.tpl');
}
示例11: clearFTSFlags
/**
* After the notification is displayed, clear the fts flags
* @return null
*/
protected function clearFTSFlags()
{
if (is_admin($GLOBALS['current_user'])) {
$admin = Administration::getSettings();
if (!empty($settings->settings['info_fts_index_done'])) {
$admin->saveSetting('info', 'fts_index_done', 0);
}
// remove notification disabled notification
$cfg = new Configurator();
$cfg->config['fts_disable_notification'] = false;
$cfg->handleOverride();
}
}
示例12: store_api_key
public function store_api_key($api, $args)
{
if (!isset($args['api_key'])) {
return array('success' => 0, 'error_code' => '200', 'error_message' => 'No API Key was sent.');
}
$api_key = $args['api_key'];
$configuratorObj = new Configurator();
//Load config
$configuratorObj->loadConfig();
//Update the API setting
$configuratorObj->config['ClockworkSMSApiKey'] = $api_key;
//Save the new setting
$configuratorObj->saveConfig();
return array('success' => 1);
}
示例13: process
/**
* @see SugarView::process()
*/
public function process()
{
global $current_user;
if (is_admin($current_user) && isset($_REQUEST['disabled_themes'])) {
$_REQUEST['disabled_themes'] = explode(',', $_REQUEST['disabled_themes']);
if (($key = array_search(SugarThemeRegistry::current()->__toString(), $_REQUEST['disabled_themes'])) !== FALSE) {
unset($_REQUEST['disabled_themes'][$key]);
}
$_REQUEST['disabled_themes'] = implode(',', $_REQUEST['disabled_themes']);
$configurator = new Configurator();
$configurator->config['disabled_themes'] = $_REQUEST['disabled_themes'];
$configurator->handleOverride();
}
parent::process();
}
示例14: GetConnectionCredentials
private function GetConnectionCredentials($databaseName = '')
{
$this->mDbCredentials['database_host'] = Configurator::GetInstance()->GetSettings('database_host_' . $this->mConnenctionType);
$this->mDbCredentials['database_user'] = Configurator::GetInstance()->GetSettings('database_user_' . $this->mConnenctionType);
$this->mDbCredentials['database_password'] = Configurator::GetInstance()->GetSettings('database_password_' . $this->mConnenctionType);
$this->mDbCredentials['database_database'] = $databaseName == '' ? Configurator::GetInstance()->GetSettings('database_name_' . $this->mConnenctionType) : $databaseName;
}
示例15: getInstance
public static function getInstance()
{
if (is_null(self::$c_instance)) {
self::$c_instance = new Configurator();
}
return self::$c_instance;
}