Limit Line Breaks
The edit shown below will limit excess line breaks within posts, pm's, etc. if you wish to restrict this input on your forum.
The example uses 3 as the limit whereas one can change that number to the desired limit.
This only involves adding 2 lines of code so I thought it best to post it in this section as opposed to creating a mod for it.
File: ../Sources/Load.php
find:
// Replace all vulgar words with respective proper words. (substring or whole words..)
function &censorText(&$text, $force = false)
{
global $modSettings, $options, $settings, $txt;
static $censor_vulgar = null, $censor_proper;
add after the above code:
$limitBreaks = 3;
$text = preg_replace("#(?:(\<br( />)){" . $limitBreaks . ",})#m", str_repeat("<br />", $limitBreaks), $text);
I believe that is the only type of line break within a post or pm therefore the above regex should suffice.
However, if for some reason one needs to handle carriage returns then use the following edit:
$limitBreaks = 3;
$text = preg_replace("#(?:(\\n|\\r|\<br( />)){" . $limitBreaks . ",})#m", str_repeat("<br />", $limitBreaks), $text);
Regards.