Add OK and Cancel button for grid editing
[phpmyadmin/arisferyanto.git] / libraries / transformations / text_plain__substr.inc.php
blobc220b0602d553aa83b9733f3ebb574e9b800d588
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()
9 return array(
10 '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: "...").'),
14 /**
17 function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '')
19 // possibly use a global transform and feed it with special options:
20 // include './libraries/transformations/global.inc.php';
22 // further operations on $buffer using the $options[] array.
23 if (!isset($options[0]) || $options[0] == '') {
24 $options[0] = 0;
27 if (!isset($options[1]) || $options[1] == '') {
28 $options[1] = 'all';
31 if (!isset($options[2]) || $options[2] == '') {
32 $options[2] = '...';
35 $newtext = '';
36 if ($options[1] != 'all') {
37 $newtext = PMA_substr($buffer, $options[0], $options[1]);
38 } else {
39 $newtext = PMA_substr($buffer, $options[0]);
42 $length = strlen($newtext);
43 $baselength = strlen($buffer);
44 if ($length != $baselength) {
45 if ($options[0] != 0) {
46 $newtext = $options[2] . $newtext;
49 if (($length + $options[0]) != $baselength) {
50 $newtext .= $options[2];
54 return $newtext;