[Phpmyadmin-devel] Bit of code to contribute

XTender groblewis at mac.com
Tue Mar 13 20:19:48 CET 2012


Hi, Devs. 

I'm no real programmer, but I did cook up a new transformation for phpMyAdmin. All it does is append a specified string to the table data. I use it to add "°F" to a field containing temperature data. 

Only one problem: the tooltip that appears when defining the transformation (on the Structure page) says "No description is available for this transformation…". I don't know how to fix this. The function
PMA_transformation_text_plain__append_info()
returns
"Appends text to a string. The only option is the text to be appended (enclosed in single quotes, default empty string)." 

As evidence, my function does appear correctly (with its description) on the transformation_overview.php page.  

If you can give me a hint how to fix the tooltip I will. The function code is short enough that I'm including it here: 

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

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * @package phpMyAdmin-Transformation
 * ******GRL 3/13/2012 based on the "substring" transformation included w/phpMyAdmin
 * Has one option: the text to be appended (default '')
 */

function PMA_transformation_text_plain__append_info() {
    return array(
        'info' => __('Appends text to a string. The only option is the text to be appended (enclosed in single quotes, default empty string).'),
        );
}

function PMA_transformation_text_plain__append($buffer, $options = array(), $meta = '') {

    if (!isset($options[0]) ||  $options[0] == '') {
        $options[0] = '';
    }

    $newtext = $buffer . $options[0];  //just append the option to the original text

    return $newtext;
}

?>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20120313/537b073e/attachment.html>


More information about the Developers mailing list