Skip to content

Commit

Permalink
Improve function names
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Delisle <marc@infomarc.info>
  • Loading branch information
lem9 committed Jan 2, 2014
1 parent 0dd1fa9 commit a6926c4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 45 deletions.
50 changes: 25 additions & 25 deletions libraries/server_privileges.lib.php
Expand Up @@ -411,7 +411,7 @@ function PMA_getGrantsArray()
*
* @return string $html_output html snippet
*/
function PMA_getHtmlForDisplayColumnPrivileges($columns, $row, $name_for_select,
function PMA_getHtmlForColumnPrivileges($columns, $row, $name_for_select,
$priv_for_header, $name, $name_for_dfn, $name_for_current
) {
$html_output = '<div class="item" id="div_item_' . $name . '">' . "\n"
Expand Down Expand Up @@ -698,7 +698,7 @@ function PMA_getHtmlToDisplayPrivilegesTable($db = '*',
*
* @return string html snippet
*/
function PMA_getHtmlForDisplayResourceLimits($row)
function PMA_getHtmlForResourceLimits($row)
{
$html_output = '<fieldset>' . "\n"
. '<legend>' . __('Resource limits') . '</legend>' . "\n"
Expand Down Expand Up @@ -856,22 +856,22 @@ function PMA_getHtmlForTableSpecificPrivileges(
*/
function PMA_getHtmlForAttachedPrivilegesToTableSpecificColumn($columns, $row)
{
$html_output = PMA_getHtmlForDisplayColumnPrivileges(
$html_output = PMA_getHtmlForColumnPrivileges(
$columns, $row, 'Select_priv', 'SELECT',
'select', __('Allows reading data.'), 'Select'
);

$html_output .= PMA_getHtmlForDisplayColumnPrivileges(
$html_output .= PMA_getHtmlForColumnPrivileges(
$columns, $row, 'Insert_priv', 'INSERT',
'insert', __('Allows inserting and replacing data.'), 'Insert'
);

$html_output .= PMA_getHtmlForDisplayColumnPrivileges(
$html_output .= PMA_getHtmlForColumnPrivileges(
$columns, $row, 'Update_priv', 'UPDATE',
'update', __('Allows changing data.'), 'Update'
);

$html_output .= PMA_getHtmlForDisplayColumnPrivileges(
$html_output .= PMA_getHtmlForColumnPrivileges(
$columns, $row, 'References_priv', 'REFERENCES', 'references',
__('Has no effect in this MySQL version.'), 'References'
);
Expand Down Expand Up @@ -1016,7 +1016,7 @@ function PMA_getHtmlForGlobalOrDbSpecificPrivs($db, $table, $row)

// The "Resource limits" box is not displayed for db-specific privs
if ($db == '*') {
$html_output .= PMA_getHtmlForDisplayResourceLimits($row);
$html_output .= PMA_getHtmlForResourceLimits($row);
}
// for Safari 2.0.2
$html_output .= '<div class="clearfloat"></div>';
Expand Down Expand Up @@ -1245,7 +1245,7 @@ function PMA_getHtmlForGlobalPrivTableWithCheckboxes(
*
* @return string $html_output a HTML snippet
*/
function PMA_getHtmlForDisplayLoginInformationFields($mode = 'new')
function PMA_getHtmlForLoginInformationFields($mode = 'new')
{
list($username_length, $hostname_length) = PMA_getUsernameAndHostnameLength();

Expand Down Expand Up @@ -1681,7 +1681,7 @@ function PMA_getHtmlForAddUser($dbname)
. '<form name="usersForm" class="ajax" id="addUsersForm"'
. ' action="server_privileges.php" method="post" autocomplete="off" >' . "\n"
. PMA_URL_getHiddenInputs('', '')
. PMA_getHtmlForDisplayLoginInformationFields('new');
. PMA_getHtmlForLoginInformationFields('new');

$html_output .= '<fieldset id="fieldset_add_user_database">' . "\n"
. '<legend>' . __('Database for user') . '</legend>' . "\n";
Expand Down Expand Up @@ -2470,7 +2470,7 @@ function PMA_getChangeLoginInformationHtmlForm($username, $hostname)
. '<fieldset id="fieldset_change_copy_user">' . "\n"
. '<legend>' . __('Change Login Information / Copy User')
. '</legend>' . "\n"
. PMA_getHtmlForDisplayLoginInformationFields('change');
. PMA_getHtmlForLoginInformationFields('change');

$html_output .= '<fieldset id="fieldset_mode">' . "\n"
. ' <legend>'
Expand Down Expand Up @@ -2648,7 +2648,7 @@ function PMA_getUserSpecificRights($tables, $user_host_condition, $dbname)
*
* @return array $found_rows, $html_output
*/
function PMA_getHtmlForDisplayUserRightsInRows($db_rights, $dbname,
function PMA_getHtmlForUserRights($db_rights, $dbname,
$hostname, $username
) {
$html_output = '';
Expand Down Expand Up @@ -2728,7 +2728,7 @@ function PMA_getHtmlForDisplayUserRightsInRows($db_rights, $dbname,
*
* @return array $html_output, $found_rows
*/
function PMA_getTableForDisplayAllTableSpecificRights(
function PMA_getHtmlForAllTableSpecificRights(
$username, $hostname, $dbname
) {
// table header
Expand Down Expand Up @@ -2782,7 +2782,7 @@ function PMA_getTableForDisplayAllTableSpecificRights(

$html_output .= '<tbody>' . "\n";
// display rows
list ($found_rows, $html_out) = PMA_getHtmlForDisplayUserRightsInRows(
list ($found_rows, $html_out) = PMA_getHtmlForUserRights(
$db_rights, $dbname, $hostname, $username
);

Expand All @@ -2800,7 +2800,7 @@ function PMA_getTableForDisplayAllTableSpecificRights(
*
* @return string HTML snippet
*/
function PMA_getHtmlForDisplaySelectDbInEditPrivs($found_rows)
function PMA_getHtmlForSelectDbInEditPrivs($found_rows)
{
// we already have the list of databases from libraries/common.inc.php
// via $pma = new PMA;
Expand Down Expand Up @@ -2941,7 +2941,7 @@ function PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir)
. '</thead>' . "\n";

$html_output .= '<tbody>' . "\n";
$html_output .= PMA_getTableBodyForUserRightsTable($db_rights);
$html_output .= PMA_getHtmlTableBodyForUserRights($db_rights);
$html_output .= '</tbody>'
. '</table>' . "\n";

Expand Down Expand Up @@ -2978,7 +2978,7 @@ function PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir)
*
* @return string HTML snippet
*/
function PMA_getTableBodyForUserRightsTable($db_rights)
function PMA_getHtmlTableBodyForUserRights($db_rights)
{
if ($GLOBALS['cfgRelation']['menuswork']) {
$users_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
Expand Down Expand Up @@ -3144,7 +3144,7 @@ function PMA_getFieldsetForAddDeleteUser()
*
* @return string HTML snippet
*/
function PMA_getHtmlForDisplayTheInitials($array_initials)
function PMA_getHtmlForInitials($array_initials)
{
// initialize to false the letters A-Z
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
Expand Down Expand Up @@ -3721,7 +3721,7 @@ function PMA_getAddUserHtmlFieldset()
*
* @return string $html_output
*/
function PMA_getHtmlHeaderForDisplayUserProperties(
function PMA_getHtmlHeaderForUserProperties(
$dbname_is_wildcard, $url_dbname, $dbname, $username, $hostname, $tablename
) {
$html_output = '<h2>' . "\n"
Expand Down Expand Up @@ -3783,7 +3783,7 @@ function PMA_getHtmlHeaderForDisplayUserProperties(
*
* @return string $html_output
*/
function PMA_getHtmlForDisplayUserOverviewPage($pmaThemeImage, $text_dir)
function PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir)
{
$html_output = '<h2>' . "\n"
. PMA_Util::getIcon('b_usrlist.png')
Expand Down Expand Up @@ -3848,7 +3848,7 @@ function PMA_getHtmlForDisplayUserOverviewPage($pmaThemeImage, $text_dir)
* Also not necessary if there is less than 20 privileges
*/
if ($GLOBALS['dbi']->numRows($res_all) > 20) {
$html_output .= PMA_getHtmlForDisplayTheInitials($array_initials);
$html_output .= PMA_getHtmlForInitials($array_initials);
}

/**
Expand Down Expand Up @@ -3906,10 +3906,10 @@ function PMA_getHtmlForDisplayUserOverviewPage($pmaThemeImage, $text_dir)
*
* @return string $html_output
*/
function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname,
function PMA_getHtmlForUserProperties($dbname_is_wildcard,$url_dbname,
$username, $hostname, $dbname, $tablename
) {
$html_output = PMA_getHtmlHeaderForDisplayUserProperties(
$html_output = PMA_getHtmlHeaderForUserProperties(
$dbname_is_wildcard, $url_dbname, $dbname, $username, $hostname, $tablename
);

Expand All @@ -3923,7 +3923,7 @@ function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname,
$html_output .= PMA_Message::error(
__('The selected user was not found in the privilege table.')
)->getDisplay();
$html_output .= PMA_getHtmlForDisplayLoginInformationFields();
$html_output .= PMA_getHtmlForLoginInformationFields();
//exit;
}

Expand Down Expand Up @@ -3960,14 +3960,14 @@ function PMA_getHtmlForDisplayUserProperties($dbname_is_wildcard,$url_dbname,
// unescape wildcards in dbname at table level
$unescaped_db = PMA_Util::unescapeMysqlWildcards($dbname);
list($html_rightsTable, $found_rows)
= PMA_getTableForDisplayAllTableSpecificRights(
= PMA_getHtmlForAllTableSpecificRights(
$username, $hostname, $unescaped_db
);
$html_output .= $html_rightsTable;

if (! strlen($dbname)) {
// no database name was given, display select db
$html_output .= PMA_getHtmlForDisplaySelectDbInEditPrivs($found_rows);
$html_output .= PMA_getHtmlForSelectDbInEditPrivs($found_rows);

} else {
$html_output .= PMA_displayTablesInEditPrivs($dbname, $found_rows);
Expand Down
4 changes: 2 additions & 2 deletions server_privileges.php
Expand Up @@ -360,7 +360,7 @@
if (! isset($username)) {
// No username is given --> display the overview
$response->addHTML(
PMA_getHtmlForDisplayUserOverviewPage($pmaThemeImage, $text_dir)
PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir)
);
} else {
// A user was selected -> display the user's properties
Expand All @@ -375,7 +375,7 @@
)
);
$response->addHTML(
PMA_getHtmlForDisplayUserProperties(
PMA_getHtmlForUserProperties(
((isset ($dbname_is_wildcard)) ? $dbname_is_wildcard : ''),
$url_dbname, $username, $hostname,
(isset($dbname) ? $dbname : ''),
Expand Down
36 changes: 18 additions & 18 deletions test/libraries/PMA_server_privileges_test.php
Expand Up @@ -303,11 +303,11 @@ public function testPMAGetGrantsArray()
}

/**
* Test for PMA_getHtmlForDisplayColumnPrivileges
* Test for PMA_getHtmlForColumnPrivileges
*
* @return void
*/
public function testPMAGetHtmlForDisplayColumnPrivileges()
public function testPMAGetHtmlForColumnPrivileges()
{
$columns = array(
'row1' => 'name1'
Expand All @@ -321,7 +321,7 @@ public function testPMAGetHtmlForDisplayColumnPrivileges()
$name_for_dfn = 'name_for_dfn';
$name_for_current = 'name_for_current';

$html = PMA_getHtmlForDisplayColumnPrivileges(
$html = PMA_getHtmlForColumnPrivileges(
$columns, $row, $name_for_select,
$priv_for_header, $name, $name_for_dfn, $name_for_current
);
Expand Down Expand Up @@ -420,11 +420,11 @@ public function testPMAGetHtmlToChooseUserGroup()
}

/**
* Test for PMA_getHtmlForDisplayResourceLimits
* Test for PMA_getHtmlForResourceLimits
*
* @return void
*/
public function testPMAGetHtmlForDisplayResourceLimits()
public function testPMAGetHtmlForResourceLimits()
{
$row = array(
'max_questions' => 'max_questions',
Expand All @@ -433,8 +433,8 @@ public function testPMAGetHtmlForDisplayResourceLimits()
'max_user_connections' => 'max_user_connections',
);

//PMA_getHtmlForDisplayResourceLimits
$html = PMA_getHtmlForDisplayResourceLimits($row);
//PMA_getHtmlForResourceLimits
$html = PMA_getHtmlForResourceLimits($row);
$this->assertContains(
'<legend>' . __('Resource limits') . '</legend>',
$html
Expand Down Expand Up @@ -909,7 +909,7 @@ public function testPMAGetHtmlToDisplayPrivilegesTable()
$html
);

//validate 5: PMA_getHtmlForDisplayResourceLimits
//validate 5: PMA_getHtmlForResourceLimits
$this->assertContains(
'<legend>' . __('Resource limits') . '</legend>',
$html
Expand Down Expand Up @@ -1053,11 +1053,11 @@ public function testPMAGetHtmlForTableSpecificPrivileges()
}

/**
* Test for PMA_getHtmlForDisplayLoginInformationFields
* Test for PMA_getHtmlForLoginInformationFields
*
* @return void
*/
public function testPMAGetHtmlForDisplayLoginInformationFields()
public function testPMAGetHtmlForLoginInformationFields()
{
$GLOBALS['username'] = 'pma_username';

Expand All @@ -1081,7 +1081,7 @@ public function testPMAGetHtmlForDisplayLoginInformationFields()

$GLOBALS['dbi'] = $dbi;

$html = PMA_getHtmlForDisplayLoginInformationFields();
$html = PMA_getHtmlForLoginInformationFields();
list($username_length, $hostname_length)
= PMA_getUsernameAndHostnameLength();

Expand Down Expand Up @@ -1200,9 +1200,9 @@ public function testPMAGetHtmlForAddUser()
$html
);

//validate 2: PMA_getHtmlForDisplayLoginInformationFields
//validate 2: PMA_getHtmlForLoginInformationFields
$this->assertContains(
PMA_getHtmlForDisplayLoginInformationFields('new'),
PMA_getHtmlForLoginInformationFields('new'),
$html
);

Expand Down Expand Up @@ -1669,9 +1669,9 @@ public function testPMAGetChangeLoginInformationHtmlForm()
$html
);

//PMA_getHtmlForDisplayLoginInformationFields
//PMA_getHtmlForLoginInformationFields
$this->assertContains(
PMA_getHtmlForDisplayLoginInformationFields('change'),
PMA_getHtmlForLoginInformationFields('change'),
$html
);

Expand Down Expand Up @@ -1930,11 +1930,11 @@ public function testPMAGetAddUserHtmlFieldset()
}

/**
* Test for PMA_getHtmlHeaderForDisplayUserProperties
* Test for PMA_getHtmlHeaderForUserProperties
*
* @return void
*/
public function testPMAGetHtmlHeaderForDisplayUserProperties()
public function testPMAGetHtmlHeaderForUserProperties()
{
$dbname_is_wildcard = true;
$url_dbname = "url_dbname";
Expand All @@ -1944,7 +1944,7 @@ public function testPMAGetHtmlHeaderForDisplayUserProperties()
$tablename = "tablename";
$_REQUEST['tablename'] = "tablename";

$html = PMA_getHtmlHeaderForDisplayUserProperties(
$html = PMA_getHtmlHeaderForUserProperties(
$dbname_is_wildcard, $url_dbname, $dbname,
$username, $hostname, $tablename
);
Expand Down

0 comments on commit a6926c4

Please sign in to comment.