2 /********************************************************************************
3 * include/wrapper.inc.php : text wrapper
4 * -------------------------
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
10 function wrap($_text,$_prefix="",$_length=72) {
11 $parts = preg_split("/\n-- ?\n/", $_text);
12 if (count($parts) >1) {
13 $sign = "\n-- \n" . array_pop($parts);
14 $text = join("\n-- \n", $parts);
20 $cmd = "echo ".escapeshellarg($text)." | perl -MText::Autoformat -e 'autoformat {left=>1, right=>$_length, all=>1 };'";
23 return $_prefix.join("\n$_prefix", $result).($_prefix ?
'' : $sign);