From 0762605399cc4c3181ae882f2a65456ce99c5475 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 17 Dec 2014 14:32:36 +0100 Subject: [PATCH 1/7] Optimize html output functions Remove the noeed to check if superglobal $_GET is_string as the superglobals are always of type string. Remove double check for $_GET and $_POST superglobals --- catalog/includes/functions/html_output.php | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/catalog/includes/functions/html_output.php b/catalog/includes/functions/html_output.php index 79c721263..a7cbedc1f 100644 --- a/catalog/includes/functions/html_output.php +++ b/catalog/includes/functions/html_output.php @@ -178,10 +178,10 @@ function tep_draw_form($name, $action, $method = 'post', $parameters = '', $toke function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true, $class = 'form-control') { $field = ' Date: Wed, 17 Dec 2014 15:31:22 +0100 Subject: [PATCH 2/7] Fix typo --- catalog/includes/functions/html_output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/functions/html_output.php b/catalog/includes/functions/html_output.php index a7cbedc1f..36ab93d86 100644 --- a/catalog/includes/functions/html_output.php +++ b/catalog/includes/functions/html_output.php @@ -271,7 +271,7 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') { if ( tep_not_null($value) ) { $field .= ' value="' . tep_output_string($value) . '"'; } elseif ( isset($_GET[$name] ) || ( isset($_POST[$name]) ) ) { - if (isset($_GET[$name]) { + if ( isset($_GET[$name]) ) { $field .= ' value="' . tep_output_string(stripslashes($_GET[$name])) . '"'; } elseif ( isset($_POST[$name]) ) { $field .= ' value="' . tep_output_string(stripslashes($_POST[$name])) . '"'; From c2da7c1d75f6d2c7a796375e939437177978fa9f Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 17 Dec 2014 16:27:20 +0100 Subject: [PATCH 3/7] Remove is_String check for supeglobals --- .../admin/includes/functions/html_output.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/catalog/admin/includes/functions/html_output.php b/catalog/admin/includes/functions/html_output.php index 92c41f0c2..e5f8cfc72 100644 --- a/catalog/admin/includes/functions/html_output.php +++ b/catalog/admin/includes/functions/html_output.php @@ -198,10 +198,10 @@ function tep_draw_input_field($name, $value = '', $parameters = '', $required = $field = ' Date: Thu, 18 Dec 2014 08:53:13 +0100 Subject: [PATCH 4/7] Remove $_GET and $_POST double check --- catalog/admin/includes/functions/html_output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/admin/includes/functions/html_output.php b/catalog/admin/includes/functions/html_output.php index e5f8cfc72..814618e65 100644 --- a/catalog/admin/includes/functions/html_output.php +++ b/catalog/admin/includes/functions/html_output.php @@ -335,7 +335,7 @@ function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '' $field .= '>'; - if (empty($default) && ( (isset($_GET[$name]) ) || (isset($_POST[$name]) ) ) ) { + if ( empty($default) ) { if ( isset($_GET[$name]) ) { $default = stripslashes($_GET[$name]); } elseif ( isset($_POST[$name]) ) { From 3b465cd909b0deec33f9a741b266769ce9c7132c Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 18 Dec 2014 08:55:23 +0100 Subject: [PATCH 5/7] Remove $_GET and $_POST double check --- catalog/includes/functions/html_output.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/catalog/includes/functions/html_output.php b/catalog/includes/functions/html_output.php index 36ab93d86..e8d8b3a50 100644 --- a/catalog/includes/functions/html_output.php +++ b/catalog/includes/functions/html_output.php @@ -270,13 +270,12 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') { if ( tep_not_null($value) ) { $field .= ' value="' . tep_output_string($value) . '"'; - } elseif ( isset($_GET[$name] ) || ( isset($_POST[$name]) ) ) { - if ( isset($_GET[$name]) ) { + } elseif ( isset($_GET[$name]) ) { $field .= ' value="' . tep_output_string(stripslashes($_GET[$name])) . '"'; - } elseif ( isset($_POST[$name]) ) { - $field .= ' value="' . tep_output_string(stripslashes($_POST[$name])) . '"'; - } + } elseif ( isset($_POST[$name]) ) { + $field .= ' value="' . tep_output_string(stripslashes($_POST[$name])) . '"'; } + } if (tep_not_null($parameters)) $field .= ' ' . $parameters; From 95067e07f9564a4df4c829d1830f46168552dccf Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 18 Dec 2014 20:54:29 +0100 Subject: [PATCH 6/7] fix parse error --- catalog/includes/functions/html_output.php | 1 - 1 file changed, 1 deletion(-) diff --git a/catalog/includes/functions/html_output.php b/catalog/includes/functions/html_output.php index e8d8b3a50..69f455558 100644 --- a/catalog/includes/functions/html_output.php +++ b/catalog/includes/functions/html_output.php @@ -275,7 +275,6 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') { } elseif ( isset($_POST[$name]) ) { $field .= ' value="' . tep_output_string(stripslashes($_POST[$name])) . '"'; } - } if (tep_not_null($parameters)) $field .= ' ' . $parameters; From 47b0355b4129c24ed8a60e00fa6c9e331693810b Mon Sep 17 00:00:00 2001 From: Luca Date: Fri, 19 Dec 2014 23:45:12 +0100 Subject: [PATCH 7/7] Fix extra space --- catalog/includes/functions/html_output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/functions/html_output.php b/catalog/includes/functions/html_output.php index 69f455558..b709ac038 100644 --- a/catalog/includes/functions/html_output.php +++ b/catalog/includes/functions/html_output.php @@ -271,7 +271,7 @@ function tep_draw_hidden_field($name, $value = '', $parameters = '') { if ( tep_not_null($value) ) { $field .= ' value="' . tep_output_string($value) . '"'; } elseif ( isset($_GET[$name]) ) { - $field .= ' value="' . tep_output_string(stripslashes($_GET[$name])) . '"'; + $field .= ' value="' . tep_output_string(stripslashes($_GET[$name])) . '"'; } elseif ( isset($_POST[$name]) ) { $field .= ' value="' . tep_output_string(stripslashes($_POST[$name])) . '"'; }