Login or Register

RSS IconRecent posts in this topic

avatar
firespade on May 14. 2007. 6:33 pm
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', '&amp;', $str);
$str = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $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', '&amp;', $str);
$str = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $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
avatar
levi on May 15. 2007. 2:12 pm
I did the same thing firespade. I think this functionality is desired by most (if not all) users.
Topic is locked. If you have something important to say about issues discussed on this page please write at hi@a51dev.com.

RSS IconRecent posts in this topic