All transformations are now in separate package.
[phpmyadmin/last10db.git] / libraries / transformations / text_plain__substr.inc.php
blob6b9520e6c87b0baba4304545be62ff4df2476b2a
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @package phpMyAdmin-Transformation
5 * @version $Id$
6 */
8 /**
11 function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') {
12 // possibly use a global transform and feed it with special options:
13 // include './libraries/transformations/global.inc.php';
15 // further operations on $buffer using the $options[] array.
16 if (!isset($options[0]) || $options[0] == '') {
17 $options[0] = 0;
20 if (!isset($options[1]) || $options[1] == '') {
21 $options[1] = 'all';
24 if (!isset($options[2]) || $options[2] == '') {
25 $options[2] = '...';
28 $newtext = '';
29 if ($options[1] != 'all') {
30 $newtext = PMA_substr($buffer, $options[0], $options[1]);
31 } else {
32 $newtext = PMA_substr($buffer, $options[0]);
35 $length = strlen($newtext);
36 $baselength = strlen($buffer);
37 if ($length != $baselength) {
38 if ($options[0] != 0) {
39 $newtext = $options[2] . $newtext;
42 if (($length + $options[0]) != $baselength) {
43 $newtext .= $options[2];
47 return $newtext;