Fix translation
[phpmyadmin-themes.git] / libraries / transformations / text_plain__substr.inc.php
blob67d45365b4a8e111ca2b1cecc5f5c3b2725ae0a8
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @package phpMyAdmin-Transformation
5 */
7 function PMA_transformation_text_plain__substr_info() {
8 return array(
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: "...").'),
13 /**
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] == '') {
22 $options[0] = 0;
25 if (!isset($options[1]) || $options[1] == '') {
26 $options[1] = 'all';
29 if (!isset($options[2]) || $options[2] == '') {
30 $options[2] = '...';
33 $newtext = '';
34 if ($options[1] != 'all') {
35 $newtext = PMA_substr($buffer, $options[0], $options[1]);
36 } else {
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];
52 return $newtext;