Permalink
Browse files

Delete global redeclaration for superglobal $_GET, $_POST precount fo…

…r better performance.
  • Loading branch information...
1 parent fd54577 commit 54530451ef424caf1c5a03d327b82989a7238b2f @acidvertigo acidvertigo committed Aug 15, 2011
Showing with 7 additions and 10 deletions.
  1. +7 −10 catalog/includes/functions/html_output.php
@@ -166,8 +166,7 @@ function tep_draw_form($name, $action, $method = 'post', $parameters = '', $toke
////
// Output a form input field
function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
- global $_GET, $_POST;
-
+
$field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';
if ( ($reinsert_value == true) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
@@ -198,8 +197,7 @@ function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="4
////
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
- global $_GET, $_POST;
-
+
$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';
if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';
@@ -231,7 +229,6 @@ function tep_draw_radio_field($name, $value = '', $checked = false, $parameters
// Output a form textarea field
// The $wrap parameter is no longer used in the core xhtml template
function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
- global $_GET, $_POST;
$field = '<textarea name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';
@@ -257,7 +254,6 @@ function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $par
////
// Output a form hidden field
function tep_draw_hidden_field($name, $value = '', $parameters = '') {
- global $_GET, $_POST;
$field = '<input type="hidden" name="' . tep_output_string($name) . '"';
@@ -291,8 +287,7 @@ function tep_hide_session_id() {
////
// Output a form pull down menu
function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
- global $_GET, $_POST;
-
+
$field = '<select name="' . tep_output_string($name) . '"';
if (tep_not_null($parameters)) $field .= ' ' . $parameters;
@@ -307,7 +302,8 @@ function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = ''
}
}
- for ($i=0, $n=sizeof($values); $i<$n; $i++) {
+ $n=sizeof($values);
+ for ($i=0; $i<$n; $i++) {
$field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
if ($default == $values[$i]['id']) {
$field .= ' selected="selected"';
@@ -328,7 +324,8 @@ function tep_get_country_list($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = tep_get_countries();
- for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
+ $n=sizeof($countries);
+ for ($i=0; $i<$n; $i++) {
$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
}

0 comments on commit 5453045

Please sign in to comment.