Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit dba26fde22099dff685aed8d68d8effa25a5a51c 1 parent 46ae483
Rouslan Placella roccivic authored
22 libraries/common.lib.php
@@ -1307,7 +1307,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice',
1307 1307 // avoid displaying a Profiling checkbox that could
1308 1308 // be checked, which would reexecute an INSERT, for example
1309 1309 if (! empty($refresh_link)) {
1310   - PMA_profilingCheckbox($sql_query);
  1310 + echo PMA_getProfilingForm($sql_query);
1311 1311 }
1312 1312 // if needed, generate an invisible form that contains controls for the
1313 1313 // Inline link; this way, the behavior of the Inline link does not
@@ -1395,16 +1395,18 @@ function PMA_profilingSupported()
1395 1395 *
1396 1396 * @access public
1397 1397 */
1398   -function PMA_profilingCheckbox($sql_query)
  1398 +function PMA_getProfilingForm($sql_query)
1399 1399 {
  1400 + $retval = '';
1400 1401 if (PMA_profilingSupported()) {
1401   - echo '<form action="sql.php" method="post">' . "\n";
1402   - echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
1403   - echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
1404   - echo '<input type="hidden" name="profiling_form" value="1" />' . "\n";
1405   - PMA_display_html_checkbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true);
1406   - echo ' </form>' . "\n";
  1402 + $retval .= '<form action="sql.php" method="post">' . "\n";
  1403 + $retval .= PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
  1404 + $retval .= '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
  1405 + $retval .= '<input type="hidden" name="profiling_form" value="1" />' . "\n";
  1406 + $retval .= PMA_getCheckbox('profiling', __('Profiling'), isset($_SESSION['profiling']), true);
  1407 + $retval .= ' </form>' . "\n";
1407 1408 }
  1409 + return $retval;
1408 1410 }
1409 1411
1410 1412 /**
@@ -2626,10 +2628,10 @@ function PMA_externalBug($functionality, $component, $minimum_version, $bugref)
2626 2628 *
2627 2629 * @return void
2628 2630 */
2629   -function PMA_display_html_checkbox($html_field_name, $label, $checked, $onclick)
  2631 +function PMA_getCheckbox($html_field_name, $label, $checked, $onclick)
2630 2632 {
2631 2633
2632   - echo '<input type="checkbox" name="' . $html_field_name . '" id="'
  2634 + return '<input type="checkbox" name="' . $html_field_name . '" id="'
2633 2635 . $html_field_name . '"' . ($checked ? ' checked="checked"' : '')
2634 2636 . ($onclick ? ' class="autosubmit"' : '') . ' /><label for="'
2635 2637 . $html_field_name . '">' . $label . '</label>';
8 libraries/display_tbl.lib.php
@@ -792,17 +792,17 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0,
792 792 }
793 793
794 794 echo '<div class="formelement">';
795   - PMA_display_html_checkbox(
  795 + echo PMA_getCheckbox(
796 796 'display_binary', __('Show binary contents'),
797 797 ! empty($_SESSION['tmp_user_values']['display_binary']), false
798 798 );
799 799 echo '<br />';
800   - PMA_display_html_checkbox(
  800 + echo PMA_getCheckbox(
801 801 'display_blob', __('Show BLOB contents'),
802 802 ! empty($_SESSION['tmp_user_values']['display_blob']), false
803 803 );
804 804 echo '<br />';
805   - PMA_display_html_checkbox(
  805 + echo PMA_getCheckbox(
806 806 'display_binary_as_hex', __('Show binary contents as HEX'),
807 807 ! empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false
808 808 );
@@ -813,7 +813,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0,
813 813 // per SQL query, and at the same time have a default that displays
814 814 // the transformations.
815 815 echo '<div class="formelement">';
816   - PMA_display_html_checkbox(
  816 + echo PMA_getCheckbox(
817 817 'hide_transformation', __('Hide browser transformation'),
818 818 ! empty($_SESSION['tmp_user_values']['hide_transformation']), false
819 819 );
6 server_privileges.php
@@ -2388,13 +2388,13 @@ function PMA_getGrants($user, $host)
2388 2388 echo '<fieldset id="fieldset_add_user_database">' . "\n"
2389 2389 . '<legend>' . __('Database for user') . '</legend>' . "\n";
2390 2390
2391   - PMA_display_html_checkbox('createdb-1', __('Create database with same name and grant all privileges'), false, false);
  2391 + echo PMA_getCheckbox('createdb-1', __('Create database with same name and grant all privileges'), false, false);
2392 2392 echo '<br />' . "\n";
2393   - PMA_display_html_checkbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false);
  2393 + echo PMA_getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false);
2394 2394 echo '<br />' . "\n";
2395 2395
2396 2396 if (! empty($dbname) ) {
2397   - PMA_display_html_checkbox('createdb-3', sprintf(__('Grant all privileges on database &quot;%s&quot;'), htmlspecialchars($dbname)), true, false);
  2397 + echo PMA_getCheckbox('createdb-3', sprintf(__('Grant all privileges on database &quot;%s&quot;'), htmlspecialchars($dbname)), true, false);
2398 2398 echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
2399 2399 echo '<br />' . "\n";
2400 2400 }

0 comments on commit dba26fd

Please sign in to comment.
Something went wrong with that request. Please try again.