| 32 |
return $ret; |
return $ret; |
| 33 |
} |
} |
| 34 |
|
|
| 35 |
function split_line($str, $prefix = "", $width = 76, $lines_limit = PHP_INT_MAX) |
function split_line($str, $prefix = "", $width = 76, $lines_limit = PHP_INT_MAX, $end_of_line = "\n") |
| 36 |
{ |
{ |
| 37 |
if ($width <= 0) |
if ($width <= 0) |
| 38 |
return $str; |
return $str; |
| 57 |
|
|
| 58 |
if ($c == "\n") |
if ($c == "\n") |
| 59 |
{ |
{ |
| 60 |
$result .= ($line . "\n"); |
if ($lines_count + 1 >= $lines_limit) |
| 61 |
|
{ |
| 62 |
|
break; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
$result .= ($line . $end_of_line); |
| 66 |
$lines_count++; |
$lines_count++; |
| 67 |
$line = $prefix; |
$line = $prefix; |
| 68 |
$line_len = $prefix_len; |
$line_len = $prefix_len; |
| 90 |
break; |
break; |
| 91 |
} |
} |
| 92 |
|
|
| 93 |
$result .= ($line . "\n"); |
$result .= ($line . $end_of_line); |
| 94 |
$lines_count++; |
$lines_count++; |
| 95 |
$line = $prefix; |
$line = $prefix; |
| 96 |
$line_len = $prefix_len; |
$line_len = $prefix_len; |
| 111 |
break; |
break; |
| 112 |
} |
} |
| 113 |
|
|
| 114 |
$result .= ($line . "\n"); |
$result .= ($line . $end_of_line); |
| 115 |
$lines_count++; |
$lines_count++; |
| 116 |
$line = $prefix; |
$line = $prefix; |
| 117 |
$line_len = $prefix_len; |
$line_len = $prefix_len; |