本文整理汇总了PHP中PMA_persistOption函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_persistOption函数的具体用法?PHP PMA_persistOption怎么用?PHP PMA_persistOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_persistOption函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
}
/* Add message to response */
if ($response->isAjax()) {
if ($_REQUEST['exception_type'] == 'js') {
$response->addJSON('message', $msg);
} else {
$response->addJSON('_errSubmitMsg', $msg);
}
} elseif ($_REQUEST['exception_type'] == 'php') {
$jsCode = 'PMA_ajaxShowMessage("<div class=\\"error\\">' . $msg . '</div>", false);';
$response->getFooter()->getScripts()->addCode($jsCode);
}
if ($_REQUEST['exception_type'] == 'php') {
// clear previous errors & save new ones.
$GLOBALS['error_handler']->savePreviousErrors();
}
/* Persist always send settings */
if (isset($_REQUEST['always_send']) && $_REQUEST['always_send'] === "true") {
PMA_persistOption("SendErrorReports", "always", "ask");
}
}
} elseif (!empty($_REQUEST['get_settings'])) {
$response->addJSON('report_setting', $GLOBALS['cfg']['SendErrorReports']);
} else {
if ($_REQUEST['exception_type'] == 'js') {
$response->addHTML(PMA_getErrorReportForm());
} else {
// clear previous errors & save new ones.
$GLOBALS['error_handler']->savePreviousErrors();
}
}
示例2: setUserValue
/**
* Sets config value which is stored in user preferences (if available)
* or in a cookie.
*
* If user preferences are not yet initialized, option is applied to
* global config and added to a update queue, which is processed
* by {@link loadUserPreferences()}
*
* @param string $cookie_name can be null
* @param string $cfg_path configuration path
* @param mixed $new_cfg_value new value
* @param mixed $default_value default value
*
* @return void
*/
function setUserValue($cookie_name, $cfg_path, $new_cfg_value, $default_value = null)
{
// use permanent user preferences if possible
$prefs_type = $this->get('user_preferences');
if ($prefs_type) {
include_once './libraries/user_preferences.lib.php';
if ($default_value === null) {
$default_value = PMA_arrayRead($cfg_path, $this->default);
}
PMA_persistOption($cfg_path, $new_cfg_value, $default_value);
}
if ($prefs_type != 'db' && $cookie_name) {
// fall back to cookies
if ($default_value === null) {
$default_value = PMA_arrayRead($cfg_path, $this->settings);
}
$this->setCookie($cookie_name, $new_cfg_value, $default_value);
}
PMA_arrayWrite($cfg_path, $GLOBALS['cfg'], $new_cfg_value);
PMA_arrayWrite($cfg_path, $this->settings, $new_cfg_value);
}
示例3: testPersistOption
/**
* Test for PMA_persistOption
*
* @return void
*/
public function testPersistOption()
{
$_SESSION['relation'][$GLOBALS['server']]['PMA_VERSION'] = PMA_VERSION;
$_SESSION['relation'][$GLOBALS['server']]['userconfigwork'] = null;
$_SESSION['userconfig'] = array();
$_SESSION['userconfig']['ts'] = "123";
$_SESSION['userconfig']['db'] = array('Server/hide_db' => true, 'Server/only_db' => true);
$GLOBALS['server'] = 2;
$_SESSION['relation'][2]['userconfigwork'] = null;
$this->assertNull(PMA_persistOption('Server/hide_db', 'val', 'val'));
$this->assertNull(PMA_persistOption('Server/hide_db', 'val2', 'val'));
$this->assertNull(PMA_persistOption('Server/hide_db2', 'val', 'val'));
}