Permalink
Browse files

Return strings from functions, instead of using 'echo()'

  • Loading branch information...
1 parent 46ae483 commit dba26fde22099dff685aed8d68d8effa25a5a51c @roccivic roccivic committed May 8, 2012
Showing with 19 additions and 17 deletions.
  1. +12 −10 libraries/common.lib.php
  2. +4 −4 libraries/display_tbl.lib.php
  3. +3 −3 server_privileges.php
@@ -1307,7 +1307,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice',
// avoid displaying a Profiling checkbox that could
// be checked, which would reexecute an INSERT, for example
if (! empty($refresh_link)) {
- PMA_profilingCheckbox($sql_query);
+ echo PMA_getProfilingForm($sql_query);
}
// if needed, generate an invisible form that contains controls for the
// Inline link; this way, the behavior of the Inline link does not
@@ -1395,16 +1395,18 @@ function PMA_profilingSupported()
*
* @access public
*/
-function PMA_profilingCheckbox($sql_query)
+function PMA_getProfilingForm($sql_query)
{
+ $retval = '';
if (PMA_profilingSupported()) {
- echo '<form action="sql.php" method="post">' . "\n";
- echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
- echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
- echo '<input type="hidden" name="profiling_form" value="1" />' . "\n";
- PMA_display_html_checkbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true);
- echo ' </form>' . "\n";
+ $retval .= '<form action="sql.php" method="post">' . "\n";
+ $retval .= PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
+ $retval .= '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
+ $retval .= '<input type="hidden" name="profiling_form" value="1" />' . "\n";
+ $retval .= PMA_getCheckbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true);
+ $retval .= ' </form>' . "\n";
}
+ return $retval;
}
/**
@@ -2626,10 +2628,10 @@ function PMA_externalBug($functionality, $component, $minimum_version, $bugref)
*
* @return void
*/
-function PMA_display_html_checkbox($html_field_name, $label, $checked, $onclick)
+function PMA_getCheckbox($html_field_name, $label, $checked, $onclick)
{
- echo '<input type="checkbox" name="' . $html_field_name . '" id="'
+ return '<input type="checkbox" name="' . $html_field_name . '" id="'
. $html_field_name . '"' . ($checked ? ' checked="checked"' : '')
. ($onclick ? ' class="autosubmit"' : '') . ' /><label for="'
. $html_field_name . '">' . $label . '</label>';
@@ -792,17 +792,17 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0,
}
echo '<div class="formelement">';
- PMA_display_html_checkbox(
+ echo PMA_getCheckbox(
'display_binary', __('Show binary contents'),
! empty($_SESSION['tmp_user_values']['display_binary']), false
);
echo '<br />';
- PMA_display_html_checkbox(
+ echo PMA_getCheckbox(
'display_blob', __('Show BLOB contents'),
! empty($_SESSION['tmp_user_values']['display_blob']), false
);
echo '<br />';
- PMA_display_html_checkbox(
+ echo PMA_getCheckbox(
'display_binary_as_hex', __('Show binary contents as HEX'),
! empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false
);
@@ -813,7 +813,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0,
// per SQL query, and at the same time have a default that displays
// the transformations.
echo '<div class="formelement">';
- PMA_display_html_checkbox(
+ echo PMA_getCheckbox(
'hide_transformation', __('Hide browser transformation'),
! empty($_SESSION['tmp_user_values']['hide_transformation']), false
);
@@ -2388,13 +2388,13 @@ function PMA_getGrants($user, $host)
echo '<fieldset id="fieldset_add_user_database">' . "\n"
. '<legend>' . __('Database for user') . '</legend>' . "\n";
- PMA_display_html_checkbox('createdb-1', __('Create database with same name and grant all privileges'), false, false);
+ echo PMA_getCheckbox('createdb-1', __('Create database with same name and grant all privileges'), false, false);
echo '<br />' . "\n";
- PMA_display_html_checkbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false);
+ echo PMA_getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false);
echo '<br />' . "\n";
if (! empty($dbname) ) {
- PMA_display_html_checkbox('createdb-3', sprintf(__('Grant all privileges on database &quot;%s&quot;'), htmlspecialchars($dbname)), true, false);
+ echo PMA_getCheckbox('createdb-3', sprintf(__('Grant all privileges on database &quot;%s&quot;'), htmlspecialchars($dbname)), true, false);
echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
echo '<br />' . "\n";
}

0 comments on commit dba26fd

Please sign in to comment.