default function makes string formatting.

This commit is contained in:
Garvin Hicking
2003-07-10 15:53:33 +00:00
parent 0ec27642ae
commit 96f8327116
2 changed files with 15 additions and 5 deletions

View File

@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-07-10 Garvin Hicking <me@supergarv.de>
* libraries/display_tbl.lib.php3: Let the default function take
the honor to replace special strings, so that a non-default function
does not necessary have them introduced. Very convenient for the
text/plain->formatted display, which would otherwise get every
CR/LF converted to a <br> and introduce nasty skew.
2003-07-10 Marc Delisle <lem9@users.sourceforge.net>
* pdf_schema.php3: do not display a foreign table if it's not selected
by user to be on the schema

View File

@@ -1085,7 +1085,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
}
// garvin: Wrap MIME-transformations. [MIME]
$default_function = 'htmlspecialchars'; // default_function
$default_function = 'default_function'; // default_function
$transform_function = $default_function;
$transform_options = array();
@@ -1214,8 +1214,6 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// loic1: displays all space characters, 4 space
// characters for tabulations and <cr>/<lf>
$row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options) : $default_function($row[$pointer]));
$row[$pointer] = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $row[$pointer]));
$row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '<br />', $row[$pointer]);
$vertical_display['data'][$row_no][$i] = ' <td valign="top" ' . $column_style . ' bgcolor="' . $bgcolor . '">' . $row[$pointer] . '</td>' . "\n";
} else {
@@ -1250,8 +1248,6 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// characters for tabulations and <cr>/<lf>
else {
$row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options) : $default_function($row[$pointer]));
$row[$pointer] = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $row[$pointer]));
$row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '<br />', $row[$pointer]);
}
// garvin: transform functions may enable nowrapping:
@@ -1674,5 +1670,12 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
}
} // end of the 'PMA_displayTable()' function
function default_function($buffer) {
$buffer = htmlspecialchars($buffer);
$buffer = str_replace("\011", ' &nbsp;&nbsp;&nbsp;', str_replace(' ', ' &nbsp;', $buffer));
$buffer = ereg_replace("((\015\012)|(\015)|(\012))", '<br />', $buffer);
return $buffer;
}
} // $__PMA_DISPLAY_TBL_LIB__
?>