From ce5ed096e6d88ccd6b663d8ac0f0af2611e70625 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Sun, 1 Apr 2012 13:25:02 +0300 Subject: [PATCH 1/4] remove unused functions PMA_transformation_global_plain and PMA_transformation_global_html --- libraries/transformations/global.inc.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libraries/transformations/global.inc.php b/libraries/transformations/global.inc.php index 87c7c903f5..2c0ef7ba99 100644 --- a/libraries/transformations/global.inc.php +++ b/libraries/transformations/global.inc.php @@ -25,16 +25,6 @@ /** * */ -function PMA_transformation_global_plain($buffer, $options = array(), $meta = '') -{ - return htmlspecialchars($buffer); -} - -function PMA_transformation_global_html($buffer, $options = array(), $meta = '') -{ - return $buffer; -} - function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') { if (!isset($options['string'])) { From 1c99e59eaf78651e2251cf88fdb57b449f62c4bc Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Sun, 1 Apr 2012 14:01:43 +0300 Subject: [PATCH 2/4] coding style improvements --- libraries/transformations/global.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/transformations/global.inc.php b/libraries/transformations/global.inc.php index 2c0ef7ba99..db4204ec01 100644 --- a/libraries/transformations/global.inc.php +++ b/libraries/transformations/global.inc.php @@ -27,11 +27,15 @@ */ function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') { - if (!isset($options['string'])) { + if ( ! isset($options['string']) ) { $options['string'] = ''; } - if (isset($options['regex']) && isset($options['regex_replace'])) { + if ( + isset($options['regex']) + && + isset($options['regex_replace']) + ) { $buffer = preg_replace('@' . str_replace('@', '\@', $options['regex']) . '@si', $options['regex_replace'], $buffer); } From 74492de2addd3054da48c096c35f49ed1fb7fd29 Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Sun, 1 Apr 2012 14:03:12 +0300 Subject: [PATCH 3/4] remove unused argument from PMA_transformation_global_html_replace --- libraries/transformations/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/transformations/global.inc.php b/libraries/transformations/global.inc.php index db4204ec01..54a161a76d 100644 --- a/libraries/transformations/global.inc.php +++ b/libraries/transformations/global.inc.php @@ -25,7 +25,7 @@ /** * */ -function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') +function PMA_transformation_global_html_replace($buffer, $options = array()) { if ( ! isset($options['string']) ) { $options['string'] = ''; From b7d615c8bfca7554426e4ee067379824cfaa26da Mon Sep 17 00:00:00 2001 From: Alex Marin Date: Sun, 1 Apr 2012 14:41:50 +0300 Subject: [PATCH 4/4] add comment to function --- libraries/transformations/global.inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libraries/transformations/global.inc.php b/libraries/transformations/global.inc.php index 54a161a76d..373c3cc539 100644 --- a/libraries/transformations/global.inc.php +++ b/libraries/transformations/global.inc.php @@ -23,7 +23,20 @@ */ /** + * Replaces "[__BUFFER__]" occurences found in $options['string'] with the text + * in $buffer, after performing a regular expression search and replace on + * $buffer using $options['regex'] and $options['regex_replace']. * + * @param string $buffer text that will be replaced in $options['string'], + * after being formatted + * @param array $options the options required to format $buffer + * = array ( + * 'string' => 'string', // text containing "[__BUFFER__]" + * 'regex' => 'mixed', // the pattern to search for + * 'regex_replace' => 'mixed', // string or array of strings to replace with + * ); + * + * @return string containing the text with all the replacements */ function PMA_transformation_global_html_replace($buffer, $options = array()) {