clean() Functionality Enhancement
Page: 1
Got tired of CRLF being associated in each use of the clean() method throughout activeCollab.
So I tracked down the method in '/environment/functions/general.php' on (or around) line 72.
This method looks like:
<?php
function clean($str) {
$str = preg_replace('/&(?!#[0-9]+;)/s', '&', $str);
$str = str_replace(array('<', '>', '"'), array('<', '>', '"'), $str);
return $str;
} // clean
?>
Below the str_replace() iteration you can add a nl2br() method to convert the CRLF to line break tags (eg. <br>). My new clean() method looks like..
<?php
function clean($str) {
$str = preg_replace('/&(?!#[0-9]+;)/s', '&', $str);
$str = str_replace(array('<', '>', '"'), array('<', '>', '"'), $str);
$str = nl2br($str);
return $str;
} // clean
?>
The result? Instead of never having line breaks (which seems to drive my team mad), every time ENTER is pressed you will get your expected result.
Regards,
Anthony aka firespade
So I tracked down the method in '/environment/functions/general.php' on (or around) line 72.
This method looks like:
<?php
function clean($str) {
$str = preg_replace('/&(?!#[0-9]+;)/s', '&', $str);
$str = str_replace(array('<', '>', '"'), array('<', '>', '"'), $str);
return $str;
} // clean
?>
Below the str_replace() iteration you can add a nl2br() method to convert the CRLF to line break tags (eg. <br>). My new clean() method looks like..
<?php
function clean($str) {
$str = preg_replace('/&(?!#[0-9]+;)/s', '&', $str);
$str = str_replace(array('<', '>', '"'), array('<', '>', '"'), $str);
$str = nl2br($str);
return $str;
} // clean
?>
The result? Instead of never having line breaks (which seems to drive my team mad), every time ENTER is pressed you will get your expected result.
Regards,
Anthony aka firespade
Topic is locked. If you have something important to say about issues discussed on this page please write at hi@a51dev.com.



