import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
21
libs/Monkeys/Lib.php
Normal file
21
libs/Monkeys/Lib.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class Monkeys_Lib
|
||||
{
|
||||
/**
|
||||
* Converts the HTML BR tag into plain-text linebreaks
|
||||
*
|
||||
* Taken from comments on the nl2br function PHP's online manual.
|
||||
* "Since nl2br doesn't remove the line breaks when adding in the <br /> tags, it is necessary to strip those off before you convert all of the tags, otherwise you will get double spacing"
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
static function br2nl($str)
|
||||
{
|
||||
$str = preg_replace("/(\r\n|\n|\r)/", "", $str);
|
||||
return preg_replace('=<br */?>=i', "\n", $str);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user