Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: text_plain__substr.inc.php,v 2.3 2004/03/09 15:02:28 nijel Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00005 function PMA_transformation_text_plain__substr($buffer, $options = array(), $meta = '') { 00006 // possibly use a global transform and feed it with special options: 00007 // include('./libraries/transformations/global.inc.php'); 00008 00009 // further operations on $buffer using the $options[] array. 00010 if (!isset($options[0]) || $options[0] == '') { 00011 $options[0] = 0; 00012 } 00013 00014 if (!isset($options[1]) || $options[1] == '') { 00015 $options[1] = 'all'; 00016 } 00017 00018 if (!isset($options[2]) || $options[2] == '') { 00019 $options[2] = '...'; 00020 } 00021 00022 $newtext = ''; 00023 if ($options[1] != 'all') { 00024 $newtext = PMA_substr($buffer, $options[0], $options[1]); 00025 } else { 00026 $newtext = PMA_substr($buffer, $options[0]); 00027 } 00028 00029 $length = strlen($newtext); 00030 $baselength = strlen($buffer); 00031 if ($length != $baselength) { 00032 if ($options[0] != 0) { 00033 $newtext = $options[2] . $newtext; 00034 } 00035 00036 if (($length + $options[0]) != $baselength) { 00037 $newtext .= $options[2]; 00038 } 00039 } 00040 00041 return $newtext; 00042 } 00043 00044 ?>