From 1a177f10ae822fd9d7f67d770f31ff6a424b5b47 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sun, 28 Oct 2012 17:08:27 +0530 Subject: [PATCH] Coding style: Fix some methods names --- libraries/Config.class.php | 6 +++--- libraries/config/FormDisplay.class.php | 2 +- libraries/user_preferences.lib.php | 22 +++++++++++----------- prefs_forms.php | 8 ++++---- prefs_manage.php | 18 +++++++++--------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 3bbbe22eebb3..3d62595996ad 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -692,9 +692,9 @@ function loadUserPreferences() ) { // load required libraries include_once './libraries/user_preferences.lib.php'; - $prefs = PMA_load_userprefs(); + $prefs = PMA_loadUserprefs(); $_SESSION['cache'][$cache_key]['userprefs'] - = PMA_apply_userprefs($prefs['config_data']); + = PMA_applyUserprefs($prefs['config_data']); $_SESSION['cache'][$cache_key]['userprefs_mtime'] = $prefs['mtime']; $_SESSION['cache'][$cache_key]['userprefs_type'] = $prefs['type']; $_SESSION['cache'][$cache_key]['config_mtime'] = $config_mtime; @@ -834,7 +834,7 @@ function setUserValue($cookie_name, $cfg_path, $new_cfg_value, if ($default_value === null) { $default_value = PMA_arrayRead($cfg_path, $this->default); } - PMA_persist_option($cfg_path, $new_cfg_value, $default_value); + PMA_persistOption($cfg_path, $new_cfg_value, $default_value); } if ($prefs_type != 'db' && $cookie_name) { // fall back to cookies diff --git a/libraries/config/FormDisplay.class.php b/libraries/config/FormDisplay.class.php index cb1442a8d1ed..48cade2f6b32 100644 --- a/libraries/config/FormDisplay.class.php +++ b/libraries/config/FormDisplay.class.php @@ -736,7 +736,7 @@ private function _getOptName($path) private function _loadUserprefsInfo() { if ($this->_userprefs_keys === null) { - $this->_userprefs_keys = array_flip(PMA_read_userprefs_fieldnames()); + $this->_userprefs_keys = array_flip(PMA_readUserprefsFieldNames()); // read real config for user preferences display $userprefs_disallow = defined('PMA_SETUP') ? ConfigFile::getInstance()->get('UserprefsDisallow', array()) diff --git a/libraries/user_preferences.lib.php b/libraries/user_preferences.lib.php index e67d564793de..afc8b50d3601 100644 --- a/libraries/user_preferences.lib.php +++ b/libraries/user_preferences.lib.php @@ -14,9 +14,9 @@ * * @return void */ -function PMA_userprefs_pageinit() +function PMA_userprefsPageInit() { - $forms_all_keys = PMA_read_userprefs_fieldnames($GLOBALS['forms']); + $forms_all_keys = PMA_readUserprefsFieldNames($GLOBALS['forms']); $cf = ConfigFile::getInstance(); $cf->resetConfigData(); // start with a clean instance $cf->setAllowedKeys($forms_all_keys); @@ -39,7 +39,7 @@ function PMA_userprefs_pageinit() * * @return array */ -function PMA_load_userprefs() +function PMA_loadUserprefs() { $cfgRelation = PMA_getRelationsParam(); if (! $cfgRelation['userconfigwork']) { @@ -76,7 +76,7 @@ function PMA_load_userprefs() * * @return true|PMA_Message */ -function PMA_save_userprefs(array $config_array) +function PMA_saveUserprefs(array $config_array) { $cfgRelation = PMA_getRelationsParam(); $server = isset($GLOBALS['server']) @@ -137,7 +137,7 @@ function PMA_save_userprefs(array $config_array) * * @return array */ -function PMA_apply_userprefs(array $config_data) +function PMA_applyUserprefs(array $config_data) { $cfg = array(); $blacklist = array_flip($GLOBALS['cfg']['UserprefsDisallow']); @@ -147,7 +147,7 @@ function PMA_apply_userprefs(array $config_data) $blacklist['Error_Handler/gather'] = true; $blacklist['DBG/sql'] = true; } - $whitelist = array_flip(PMA_read_userprefs_fieldnames()); + $whitelist = array_flip(PMA_readUserprefsFieldNames()); // whitelist some additional fields which are custom handled $whitelist['ThemeDefault'] = true; $whitelist['fontsize'] = true; @@ -171,7 +171,7 @@ function PMA_apply_userprefs(array $config_data) * * @return array */ -function PMA_read_userprefs_fieldnames(array $forms = null) +function PMA_readUserprefsFieldNames(array $forms = null) { static $names; @@ -205,9 +205,9 @@ function PMA_read_userprefs_fieldnames(array $forms = null) * * @return void */ -function PMA_persist_option($path, $value, $default_value) +function PMA_persistOption($path, $value, $default_value) { - $prefs = PMA_load_userprefs(); + $prefs = PMA_loadUserprefs(); if ($value === $default_value) { if (isset($prefs['config_data'][$path])) { unset($prefs['config_data'][$path]); @@ -217,7 +217,7 @@ function PMA_persist_option($path, $value, $default_value) } else { $prefs['config_data'][$path] = $value; } - PMA_save_userprefs($prefs['config_data']); + PMA_saveUserprefs($prefs['config_data']); } /** @@ -231,7 +231,7 @@ function PMA_persist_option($path, $value, $default_value) * * @return void */ -function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name, +function PMA_userprefsRedirect(array $forms, array $old_settings, $file_name, $params = null, $hash = null ) { $reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame']; diff --git a/prefs_forms.php b/prefs_forms.php index 023d8ba18caa..e613c0cd8ead 100644 --- a/prefs_forms.php +++ b/prefs_forms.php @@ -18,7 +18,7 @@ require_once 'libraries/config/FormDisplay.class.php'; require 'libraries/config/user_preferences.forms.php'; -PMA_userprefs_pageinit(); +PMA_userprefsPageInit(); // handle form processing @@ -52,13 +52,13 @@ $error = null; if ($form_display->process(false) && !$form_display->hasErrors()) { // save settings - $old_settings = PMA_load_userprefs(); - $result = PMA_save_userprefs(ConfigFile::getInstance()->getConfigArray()); + $old_settings = PMA_loadUserprefs(); + $result = PMA_saveUserprefs(ConfigFile::getInstance()->getConfigArray()); if ($result === true) { // reload config $GLOBALS['PMA_Config']->loadUserPreferences(); $hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#'); - PMA_userprefs_redirect( + PMA_userprefsRedirect( $forms, $old_settings, 'prefs_forms.php', array('form' => $form_param), $hash ); diff --git a/prefs_manage.php b/prefs_manage.php index 5e38a4fbca45..4644e5532034 100644 --- a/prefs_manage.php +++ b/prefs_manage.php @@ -18,7 +18,7 @@ require_once 'libraries/config/FormDisplay.class.php'; require 'libraries/config/user_preferences.forms.php'; -PMA_userprefs_pageinit(); +PMA_userprefsPageInit(); $error = ''; if (isset($_POST['submit_export']) @@ -28,11 +28,11 @@ PMA_Response::getInstance()->disable(); $filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json'; PMA_downloadHeader($filename, 'application/json'); - $settings = PMA_load_userprefs(); + $settings = PMA_loadUserprefs(); echo json_encode($settings['config_data']); exit; } else if (isset($_POST['submit_get_json'])) { - $settings = PMA_load_userprefs(); + $settings = PMA_loadUserprefs(); $response = PMA_Response::getInstance(); $response->addJSON('prefs', json_encode($settings['config_data'])); $response->addJSON('mtime', $settings['mtime']); @@ -164,8 +164,8 @@ } // save settings - $old_settings = PMA_load_userprefs(); - $result = PMA_save_userprefs($cf->getConfigArray()); + $old_settings = PMA_loadUserprefs(); + $result = PMA_saveUserprefs($cf->getConfigArray()); if ($result === true) { if ($return_url) { $query = explode('&', parse_url($return_url, PHP_URL_QUERY)); @@ -183,15 +183,15 @@ } // reload config $GLOBALS['PMA_Config']->loadUserPreferences(); - PMA_userprefs_redirect($forms, $old_settings, $return_url, $params); + PMA_userprefsRedirect($forms, $old_settings, $return_url, $params); exit; } else { $error = $result; } } } else if (isset($_POST['submit_clear'])) { - $old_settings = PMA_load_userprefs(); - $result = PMA_save_userprefs(array()); + $old_settings = PMA_loadUserprefs(); + $result = PMA_saveUserprefs(array()); if ($result === true) { $params = array(); if ($_SESSION['PMA_Theme_Manager']->theme->getId() != 'original') { @@ -208,7 +208,7 @@ } $GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection'); $GLOBALS['PMA_Config']->removeCookie('pma_lang'); - PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php', $params); + PMA_userprefsRedirect($forms, $old_settings, 'prefs_manage.php', $params); exit; } else { $error = $result;