[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_3-3759-ge0b32c7

Michal Čihař nijel at users.sourceforge.net
Mon May 24 12:04:35 CEST 2010


The branch, master has been updated
       via  e0b32c7aaad348635044a2bda2e9d5712b198e6b (commit)
      from  31010806f75222e2c6a70429d1f3003eaf323f40 (commit)


- Log -----------------------------------------------------------------
commit e0b32c7aaad348635044a2bda2e9d5712b198e6b
Author: Michal Čihař <mcihar at novell.com>
Date:   Mon May 24 12:04:20 2010 +0200

    Convert transformation descriptions to gettext.

-----------------------------------------------------------------------

Summary of changes:
 Documentation.html                                 |   12 ++++++++++++
 libraries/messages.inc.php                         |   13 -------------
 libraries/transformations/TEMPLATE                 |    6 ++++++
 .../application_octetstream__download.inc.php      |    6 ++++++
 .../application_octetstream__hex.inc.php           |    6 ++++++
 .../transformations/image_jpeg__inline.inc.php     |    6 ++++++
 libraries/transformations/image_jpeg__link.inc.php |    6 ++++++
 .../transformations/image_png__inline.inc.php      |    6 ++++++
 .../transformations/text_plain__dateformat.inc.php |    6 ++++++
 .../transformations/text_plain__external.inc.php   |    6 ++++++
 .../transformations/text_plain__formatted.inc.php  |    6 ++++++
 .../transformations/text_plain__imagelink.inc.php  |    6 ++++++
 libraries/transformations/text_plain__link.inc.php |    6 ++++++
 .../transformations/text_plain__longToIpv4.inc.php |    6 ++++++
 libraries/transformations/text_plain__sql.inc.php  |    6 ++++++
 .../transformations/text_plain__substr.inc.php     |    6 ++++++
 transformation_overview.php                        |   12 ++++++++++--
 17 files changed, 106 insertions(+), 15 deletions(-)

diff --git a/Documentation.html b/Documentation.html
index 13bdc90..bbf6d2a 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -2576,6 +2576,18 @@ setfacl -d -m "g:www-data:rwx" tmp
         field (i.e. 'text/plain', 'image/jpeg' etc.)</li>
 </ol>
 
+<p> Additionally you should also provide additional function to provide 
+    information about the transformation to the user. This function should
+    have same name as transformation function just with appended
+    <code>_info</code> suffix. This function accepts no parameters and returns
+    array with information about the transformation. Currently following keys
+    can be used:
+<p>
+<dl>
+    <dt><code>info</code></dt>
+    <dd>Long description of the transformation.</dd>
+</dl>
+
 <!-- FAQ -->
 <h2 id="faq">FAQ - Frequently Asked Questions</h2>
 
diff --git a/libraries/messages.inc.php b/libraries/messages.inc.php
index d071f75..cc5bac9 100644
--- a/libraries/messages.inc.php
+++ b/libraries/messages.inc.php
@@ -129,17 +129,4 @@ $strShowStatusThreads_cachedDescr = __('The number of threads in the thread cach
 $strShowStatusThreads_connectedDescr = __('The number of currently open connections.');
 $strShowStatusThreads_createdDescr = __('The number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. (Normally this doesn\'t give a notable performance improvement if you have a good thread implementation.)');
 $strShowStatusThreads_runningDescr = __('The number of threads that are not sleeping.');
-
-$strTransformation_application_octetstream__download = __('Displays a link to download the binary data of the field. You can use the first option to specify the filename, or use the second option as the name of a field which contains the filename. If you use the second option, you need to set the first option to the empty string.');
-$strTransformation_application_octetstream__hex = __('Displays hexadecimal representation of data. Optional first parameter specifies how often space will be added (defaults to 2 nibbles).');
-$strTransformation_image_jpeg__inline = __('Displays a clickable thumbnail. The options are the maximum width and height in pixels. The original aspect ratio is preserved.');
-$strTransformation_image_jpeg__link = __('Displays a link to download this image.');
-$strTransformation_image_png__inline = __('See image/jpeg: inline');
-$strTransformation_text_plain__dateformat = __('Displays a TIME, TIMESTAMP, DATETIME or numeric unix timestamp field as formatted date. The first option is the offset (in hours) which will be added to the timestamp (Default: 0). Use second option to specify a different date/time format string. Third option determines whether you want to see local date or UTC one (use "local" or "utc" strings) for that. According to that, date format has different value - for "local" see the documentation for PHP\'s strftime() function and for "utc" it is done using gmdate() function.');
-$strTransformation_text_plain__external = __('LINUX ONLY: Launches an external application and feeds it the field data via standard input. Returns the standard output of the application. The default is Tidy, to pretty-print HTML code. For security reasons, you have to manually edit the file libraries/transformations/text_plain__external.inc.php and list the tools you want to make available. The first option is then the number of the program you want to use and the second option is the parameters for the program. The third option, if set to 1, will convert the output using htmlspecialchars() (Default 1). The fourth option, if set to 1, will prevent wrapping and ensure that the output appears all on one line (Default 1).');
-$strTransformation_text_plain__formatted = __('Displays the contents of the field as-is, without running it through htmlspecialchars(). That is, the field is assumed to contain valid HTML.');
-$strTransformation_text_plain__imagelink = __('Displays an image and a link; the field contains the filename. The first option is a URL prefix like "http://www.example.com/". The second and third options are the width and the height in pixels.');
-$strTransformation_text_plain__link = __('Displays a link; the field contains the filename. The first option is a URL prefix like "http://www.example.com/". The second option is a title for the link.');
-$strTransformation_text_plain__sql = __('Formats text as SQL query with syntax highlighting.');
-$strTransformation_text_plain__substr = __('Displays a part of a string. The first option is the number of characters to skip from the beginning of the string (Default 0). The second option is the number of characters to return (Default: until end of string). The third option is the string to append and/or prepend when truncation occurs (Default: "...").');
 ?>
diff --git a/libraries/transformations/TEMPLATE b/libraries/transformations/TEMPLATE
index f3000ad..eabb194 100644
--- a/libraries/transformations/TEMPLATE
+++ b/libraries/transformations/TEMPLATE
@@ -12,6 +12,12 @@
  * extension. For further information regarding naming conventions see the /Documentation.html file.
  */
 
+function PMA_transformation_[ENTER_FILENAME_HERE]_info() {
+    return array(
+        'info' =>  __('Description of the transformation.'),
+        );
+}
+
 function PMA_transformation_[ENTER_FILENAME_HERE]($buffer, $options = array(), $meta = '') {
     // possibly use a global transform and feed it with special options:
     // include('./libraries/transformations/global.inc.php');
diff --git a/libraries/transformations/application_octetstream__download.inc.php b/libraries/transformations/application_octetstream__download.inc.php
index 2025632..369126d 100644
--- a/libraries/transformations/application_octetstream__download.inc.php
+++ b/libraries/transformations/application_octetstream__download.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_application_octetstream__download_info() {
+    return array(
+        'info' =>  __('Displays a link to download the binary data of the field. You can use the first option to specify the filename, or use the second option as the name of a field which contains the filename. If you use the second option, you need to set the first option to the empty string.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/application_octetstream__hex.inc.php b/libraries/transformations/application_octetstream__hex.inc.php
index a9b485f..7122354 100644
--- a/libraries/transformations/application_octetstream__hex.inc.php
+++ b/libraries/transformations/application_octetstream__hex.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_application_octetstream__hex_info() {
+    return array(
+        'info' =>  __('Displays hexadecimal representation of data. Optional first parameter specifies how often space will be added (defaults to 2 nibbles).'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/image_jpeg__inline.inc.php b/libraries/transformations/image_jpeg__inline.inc.php
index d97dcb9..682e4a0 100644
--- a/libraries/transformations/image_jpeg__inline.inc.php
+++ b/libraries/transformations/image_jpeg__inline.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_image_jpeg__inline_info() {
+    return array(
+        'info' => __('Displays a clickable thumbnail. The options are the maximum width and height in pixels. The original aspect ratio is preserved.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/image_jpeg__link.inc.php b/libraries/transformations/image_jpeg__link.inc.php
index 43fd9c8..5223e50 100644
--- a/libraries/transformations/image_jpeg__link.inc.php
+++ b/libraries/transformations/image_jpeg__link.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_image_jpeg__link_info() {
+    return array(
+        'info' => __('Displays a link to download this image.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/image_png__inline.inc.php b/libraries/transformations/image_png__inline.inc.php
index 1801878..f631aa4 100644
--- a/libraries/transformations/image_png__inline.inc.php
+++ b/libraries/transformations/image_png__inline.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_image_png__inline_info() {
+    return array(
+        'info' => __('Displays a clickable thumbnail. The options are the maximum width and height in pixels. The original aspect ratio is preserved.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__dateformat.inc.php b/libraries/transformations/text_plain__dateformat.inc.php
index c1386fa..3f11fa9 100644
--- a/libraries/transformations/text_plain__dateformat.inc.php
+++ b/libraries/transformations/text_plain__dateformat.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__dateformat_info() {
+    return array(
+        'info' => __('Displays a TIME, TIMESTAMP, DATETIME or numeric unix timestamp field as formatted date. The first option is the offset (in hours) which will be added to the timestamp (Default: 0). Use second option to specify a different date/time format string. Third option determines whether you want to see local date or UTC one (use "local" or "utc" strings) for that. According to that, date format has different value - for "local" see the documentation for PHP\'s strftime() function and for "utc" it is done using gmdate() function.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__external.inc.php b/libraries/transformations/text_plain__external.inc.php
index 69100de..981faec 100644
--- a/libraries/transformations/text_plain__external.inc.php
+++ b/libraries/transformations/text_plain__external.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__external_info() {
+    return array(
+        'info' => __('LINUX ONLY: Launches an external application and feeds it the field data via standard input. Returns the standard output of the application. The default is Tidy, to pretty-print HTML code. For security reasons, you have to manually edit the file libraries/transformations/text_plain__external.inc.php and list the tools you want to make available. The first option is then the number of the program you want to use and the second option is the parameters for the program. The third option, if set to 1, will convert the output using htmlspecialchars() (Default 1). The fourth option, if set to 1, will prevent wrapping and ensure that the output appears all on one line (Default 1).'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__formatted.inc.php b/libraries/transformations/text_plain__formatted.inc.php
index 65e1458..7a1e8f8 100644
--- a/libraries/transformations/text_plain__formatted.inc.php
+++ b/libraries/transformations/text_plain__formatted.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__formatted_info() {
+    return array(
+        'info' => __('Displays the contents of the field as-is, without running it through htmlspecialchars(). That is, the field is assumed to contain valid HTML.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__imagelink.inc.php b/libraries/transformations/text_plain__imagelink.inc.php
index 8540d76..d743a16 100644
--- a/libraries/transformations/text_plain__imagelink.inc.php
+++ b/libraries/transformations/text_plain__imagelink.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__imagelink_info() {
+    return array(
+        'info' => __('Displays an image and a link; the field contains the filename. The first option is a URL prefix like "http://www.example.com/". The second and third options are the width and the height in pixels.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__link.inc.php b/libraries/transformations/text_plain__link.inc.php
index 9295de4..f9e2bf1 100644
--- a/libraries/transformations/text_plain__link.inc.php
+++ b/libraries/transformations/text_plain__link.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__link_info() {
+    return array(
+        'info' => __('Displays a link; the field contains the filename. The first option is a URL prefix like "http://www.example.com/". The second option is a title for the link.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__longToIpv4.inc.php b/libraries/transformations/text_plain__longToIpv4.inc.php
index 7f9d6b8..bcfc12a 100644
--- a/libraries/transformations/text_plain__longToIpv4.inc.php
+++ b/libraries/transformations/text_plain__longToIpv4.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__longToIpv4_info() {
+    return array(
+        'info' => __('Converts an (IPv4) Internet network address into a string in Internet standard dotted format.'),
+        );
+}
+
 /**
  * returns IPv4 address
  *
diff --git a/libraries/transformations/text_plain__sql.inc.php b/libraries/transformations/text_plain__sql.inc.php
index 7bc38d4..5d5bfb1 100644
--- a/libraries/transformations/text_plain__sql.inc.php
+++ b/libraries/transformations/text_plain__sql.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__sql_info() {
+    return array(
+        'info' => __('Formats text as SQL query with syntax highlighting.'),
+        );
+}
+
 /**
  *
  */
diff --git a/libraries/transformations/text_plain__substr.inc.php b/libraries/transformations/text_plain__substr.inc.php
index 6b9520e..9982dcb 100644
--- a/libraries/transformations/text_plain__substr.inc.php
+++ b/libraries/transformations/text_plain__substr.inc.php
@@ -5,6 +5,12 @@
  * @version $Id$
  */
 
+function PMA_transformation_text_plain__substr_info() {
+    return array(
+        'info' => __('Displays a part of a string. The first option is the number of characters to skip from the beginning of the string (Default 0). The second option is the number of characters to return (Default: until end of string). The third option is the string to append and/or prepend when truncation occurs (Default: "...").'),
+        );
+}
+
 /**
  *
  */
diff --git a/transformation_overview.php b/transformation_overview.php
index fa7a0b0..12ca395 100644
--- a/transformation_overview.php
+++ b/transformation_overview.php
@@ -53,11 +53,19 @@ foreach ($types['mimetype'] as $key => $mimetype) {
 $odd_row = true;
 foreach ($types['transformation'] as $key => $transform) {
     $func = strtolower(str_ireplace('.inc.php', '', $types['transformation_file'][$key]));
-    $desc = 'strTransformation_' . $func;
+    require './libraries/transformations/' . $types['transformation_file'][$key];
+    $funcname = 'PMA_transformation_' . $func . '_info';
+    $desc = '<i>' . sprintf(__('No description is available for this transformation.<br />Please ask the author what %s does.'), 'PMA_transformation_' . $func . '()') . '</i>';
+    if (function_exists($funcname)) {
+        $desc_arr = $funcname();
+        if (isset($desc_arr['info'])) {
+            $desc = $desc_arr['info'];
+        }
+    }
     ?>
     <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
         <td><?php echo $transform; ?></td>
-        <td><?php echo (isset($$desc) ? $$desc : '<i>' . sprintf(__('No description is available for this transformation.<br />Please ask the author what %s does.'), 'PMA_transformation_' . $func . '()') . '</i>'); ?></td>
+        <td><?php echo $desc; ?></td>
     </tr>
     <?php
     $odd_row = !$odd_row;


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list