From 606369c3f6017df5e59f7eb049f855b859a1b102 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Tue, 18 Mar 2003 15:30:25 +0000 Subject: [PATCH] New transform functions. --- ChangeLog | 12 +++ libraries/common.lib.php3 | 8 +- libraries/display_tbl.lib.php3 | 11 ++- .../text_plain__dateformat.inc.php3 | 52 +++++++++++++ .../text_plain__external.inc.php3 | 75 +++++++++++++++++++ .../text_plain__substr.inc.php3 | 56 ++++++++++++++ 6 files changed, 208 insertions(+), 6 deletions(-) create mode 100644 libraries/transformations/text_plain__dateformat.inc.php3 create mode 100644 libraries/transformations/text_plain__external.inc.php3 create mode 100644 libraries/transformations/text_plain__substr.inc.php3 diff --git a/ChangeLog b/ChangeLog index 14b8eb8b8..87a592880 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,18 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-03-18 Garvin Hicking + * libraries/display_export.lib.php3: Fixed variable usage. + * lang/*, libraries/transformations/*, libraries/display_tbl.lib.php3, + libraries/common.lib.php3: Added new transforms for a substr() + function, a dateformat() modified and a basic plugin for external + programs. Support for TIDY has been experimentally been built in. + External programs make use of piping and thus cannot be used in + Windows. + Added the ability for transforms to adjust the "nowrap" option of a + cell. + Some german translation. + 2003-03-18 Marc Delisle * libraries/select_lang.lib.php3: modify order of Russian lang files because MSIE does not accept cp866 and users do not see anything, diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index b1285be63..fbd354410 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -1628,15 +1628,19 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} * * @access public */ - function PMA_localisedDate($timestamp = -1) + function PMA_localisedDate($timestamp = -1, $format = '') { global $datefmt, $month, $day_of_week; + if ($format == '') { + $format = $datefmt; + } + if ($timestamp == -1) { $timestamp = time(); } - $date = ereg_replace('%[aA]', $day_of_week[(int)strftime('%w', $timestamp)], $datefmt); + $date = ereg_replace('%[aA]', $day_of_week[(int)strftime('%w', $timestamp)], $format); $date = ereg_replace('%[bB]', $month[(int)strftime('%m', $timestamp)-1], $date); return strftime($date, $timestamp); diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index ec3795c40..2585013c9 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -1123,7 +1123,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { - $vertical_display['data'][$row_no][$i] = ' '; + $vertical_display['data'][$row_no][$i] = ' '; reset($analyzed_sql[0]['select_expr']); while (list ($select_expr_position, $select_expr) = each ($analyzed_sql[0]['select_expr'])) { @@ -1166,7 +1166,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { } $vertical_display['data'][$row_no][$i] .= '' . "\n"; } else { - $vertical_display['data'][$row_no][$i] = '  ' . "\n"; + $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } // b l o b @@ -1202,7 +1202,6 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { } // loic1: displays all space characters, 4 space // characters for tabulations and / - $row[$pointer] = ($default_function != $transform_function ? $transform_function($row[$pointer], $transform_options) : $default_function($row[$pointer])); $row[$pointer] = str_replace("\011", '    ', str_replace(' ', '  ', $row[$pointer])); $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$pointer]); @@ -1245,8 +1244,12 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) { $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$pointer]); } + // garvin: transform functions may enable nowrapping: + $function_nowrap = $transform_function . '_nowrap'; + $bool_nowrap = (($default_function != $transform_function && function_exists($function_nowrap)) ? $function_nowrap($transform_options) : false); + // loic1: do not wrap if date field type - $nowrap = (eregi('DATE|TIME', $meta->type) ? ' nowrap="nowrap"' : ''); + $nowrap = ((eregi('DATE|TIME', $meta->type) || $bool_nowrap) ? ' nowrap="nowrap"' : ''); $vertical_display['data'][$row_no][$i] = ' '; reset($analyzed_sql[0]['select_expr']); diff --git a/libraries/transformations/text_plain__dateformat.inc.php3 b/libraries/transformations/text_plain__dateformat.inc.php3 new file mode 100644 index 000000000..d9c9d152b --- /dev/null +++ b/libraries/transformations/text_plain__dateformat.inc.php3 @@ -0,0 +1,52 @@ +