Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: text_plain__substr.inc.php,v 2.3 2004/03/09 15:02:28 nijel Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5 function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') {
6 // possibly use a global transform and feed it with special options:
7 // include('./libraries/transformations/global.inc.php');
8  
9 // further operations on $buffer using the $options[] array.
10 if (!isset($options[0]) || $options[0] == '') {
11 $options[0] = 0;
12 }
13  
14 if (!isset($options[1]) || $options[1] == '') {
15 $options[1] = 'all';
16 }
17  
18 if (!isset($options[2]) || $options[2] == '') {
19 $options[2] = '...';
20 }
21  
22 $newtext = '';
23 if ($options[1] != 'all') {
24 $newtext = PMA_substr($buffer, $options[0], $options[1]);
25 } else {
26 $newtext = PMA_substr($buffer, $options[0]);
27 }
28  
29 $length = strlen($newtext);
30 $baselength = strlen($buffer);
31 if ($length != $baselength) {
32 if ($options[0] != 0) {
33 $newtext = $options[2] . $newtext;
34 }
35  
36 if (($length + $options[0]) != $baselength) {
37 $newtext .= $options[2];
38 }
39 }
40  
41 return $newtext;
42 }
43  
44 ?>