2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * @package phpMyAdmin-Transformation
7 function PMA_transformation_text_plain__substr_info() {
9 '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: "...").'),
16 function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') {
17 // possibly use a global transform and feed it with special options:
18 // include './libraries/transformations/global.inc.php';
20 // further operations on $buffer using the $options[] array.
21 if (!isset($options[0]) ||
$options[0] == '') {
25 if (!isset($options[1]) ||
$options[1] == '') {
29 if (!isset($options[2]) ||
$options[2] == '') {
34 if ($options[1] != 'all') {
35 $newtext = PMA_substr($buffer, $options[0], $options[1]);
37 $newtext = PMA_substr($buffer, $options[0]);
40 $length = strlen($newtext);
41 $baselength = strlen($buffer);
42 if ($length != $baselength) {
43 if ($options[0] != 0) {
44 $newtext = $options[2] . $newtext;
47 if (($length +
$options[0]) != $baselength) {
48 $newtext .= $options[2];