diff --git a/libraries/Util.php b/libraries/Util.php index 64eda190a4..ca6589ae75 100644 --- a/libraries/Util.php +++ b/libraries/Util.php @@ -2604,40 +2604,31 @@ class Util foreach ($choices as $choice_value => $choice_label) { - if (! empty($class)) { - $radio_html .= '
'; - } - if (! $id_prefix) { $id_prefix = $html_field_name; } $html_field_id = $id_prefix . '_' . $choice_value; - $radio_html .= '' - . ($escape_label - ? htmlspecialchars($choice_label) - : $choice_label) - . ''; - - if ($line_break) { - $radio_html .= '
'; + else{ + $checked = 0; } - - if (! empty($class)) { - $radio_html .= '
'; - } - $radio_html .= "\n"; + $radio_html .= Template::get('radio_fields')->render([ + 'class' => $class, + 'html_field_name' => $html_field_name, + 'html_field_id' => $html_field_id, + 'choice_value' => $choice_value, + 'is_line_break' => $line_break, + 'choice_label' => $choice_label, + 'escape_label' => $escape_label, + 'checked' => $checked + ]); } return $radio_html; + } /** @@ -2660,38 +2651,27 @@ class Util public static function getDropdown( $select_name, $choices, $active_choice, $id, $class = '', $placeholder = null ) { - $result = ''; - - $resultOptions = ''; + $resultOptions = []; $selected = false; foreach ($choices as $one_choice_value => $one_choice_label) { - $resultOptions .= '' - . $resultOptions; - } - - $result .= $resultOptions - . ''; - - return $result; + return Template::get('dropdown')->render([ + 'select_name' => $select_name, + 'id' => $id, + 'class' => $class, + 'placeholder' => $placeholder, + 'selected' => $selected, + 'resultOptions' => $resultOptions, + ]); } /** diff --git a/templates/dropdown.phtml b/templates/dropdown.phtml new file mode 100644 index 0000000000..831f8745d9 --- /dev/null +++ b/templates/dropdown.phtml @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/templates/radio_fields.phtml b/templates/radio_fields.phtml new file mode 100644 index 0000000000..8faaa4d395 --- /dev/null +++ b/templates/radio_fields.phtml @@ -0,0 +1,11 @@ + +
+ + /> + + +
+ + +
+ \ No newline at end of file diff --git a/test/classes/DbSearchTest.php b/test/classes/DbSearchTest.php index 0cca012cb4..98add2b51c 100644 --- a/test/classes/DbSearchTest.php +++ b/test/classes/DbSearchTest.php @@ -204,23 +204,23 @@ class DbSearchTest extends PMATestCase . '
' . "\n" + . '' . "\n" . '
' . "\n" . '' . "\n" . '
' . "\n" + . '' . "\n" . '
' . "\n" . '' . "\n" - . '
' + . '' . "\n" . '
' . "\n" . '' . "\n" . '
' . "\n" + . ' alt="Documentation" class="icon ic_b_help" />' . "\n" . '
' . "\n" . 'Inside tables:' . '' + '', + . 'Native MySQL authentication' + . "\n" + . '' . "\n" . '', $actualHtml ); @@ -2544,10 +2547,12 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase ); $this->assertEquals( '', + . 'Native MySQL authentication' + . "\n" . '' . "\n" . '', $actualHtml ); @@ -2559,9 +2564,10 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase ); $this->assertEquals( '', + . 'Native MySQL authentication'. "\n" .'', $actualHtml ); @@ -2574,9 +2580,11 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase ); $this->assertEquals( '', + . 'id="select_authentication_plugin_cp" >' + . "\n" + . '' + . "\n" . '', $actualHtml ); diff --git a/test/libraries/common/PMA_getDropdown_test.php b/test/libraries/common/PMA_getDropdown_test.php index 40974f184b..107c1f686d 100644 --- a/test/libraries/common/PMA_getDropdown_test.php +++ b/test/libraries/common/PMA_getDropdown_test.php @@ -33,7 +33,7 @@ class PMA_GetDropdownTest extends PHPUnit_Framework_TestCase $id = "test_<dropdown>_name"; $result = ''; + . htmlspecialchars($id) . '" >' . "\n" . ''; $this->assertEquals( $result, @@ -56,15 +56,15 @@ class PMA_GetDropdownTest extends PHPUnit_Framework_TestCase $id = "test_<dropdown>_name"; $result = ''; + $result .= "\n" . ''; $this->assertEquals( $result, @@ -87,14 +87,16 @@ class PMA_GetDropdownTest extends PHPUnit_Framework_TestCase $id = "test_<dropdown>_name"; $result = ''; $this->assertEquals( diff --git a/test/libraries/common/PMA_getRadioFields_test.php b/test/libraries/common/PMA_getRadioFields_test.php index 734cce495a..6e60d9d29d 100644 --- a/test/libraries/common/PMA_getRadioFields_test.php +++ b/test/libraries/common/PMA_getRadioFields_test.php @@ -54,6 +54,7 @@ class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase $out .= ' />' . "\n"; $out .= ''; + $out .= "\n"; $out .= '
'; $out .= "\n"; } @@ -86,6 +87,7 @@ class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase $out .= ' />' . "\n"; $out .= ''; + $out .= "\n"; $out .= '
'; $out .= "\n"; } @@ -114,6 +116,7 @@ class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase foreach ($choices as $choice_value => $choice_label) { $html_field_id = $name . '_' . $choice_value; $out .= '
'; + $out .= "\n"; $out .= '' . $choice_label . ''; + $out .= "\n"; $out .= '
'; + $out .= "\n"; $out .= '
'; $out .= "\n"; } @@ -190,6 +195,7 @@ class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase $out .= ' />' . "\n"; $out .= ''; + $out .= "\n"; $out .= '
'; $out .= "\n"; } @@ -224,6 +230,7 @@ class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase $out .= ' />' . "\n"; $out .= ''; + $out .= "\n"; $out .= '
'; $out .= "\n"; } @@ -252,6 +259,7 @@ class PMA_GetRadioFieldsTest extends PHPUnit_Framework_TestCase foreach ($choices as $choice_value => $choice_label) { $html_field_id = $name . '_' . $choice_value; $out .= '
'; + $out .= "\n"; $out .= '' . htmlspecialchars($choice_label) . ''; + $out .= "\n"; $out .= '
'; + $out .= "\n"; $out .= '
'; $out .= "\n"; }