Add helper function to the DashboardModel that converts line breaks to <br />s

This commit is contained in:
Kevin MacMartin 2023-07-03 21:15:43 -04:00
parent ced98ebb81
commit 8f4764f9b6

View file

@ -171,6 +171,16 @@ class DashboardModel extends Model
}
}
/**
* Convert line breaks to <br />s
*
* @return string
*/
public static function lineBreakToBr($string)
{
return preg_replace("/<br[^>]*>/", "<br> ", str_replace([ "\r\n", "\r", "\n" ], [ "", "", "" ], nl2br($string)));
}
/**
* Find the desired image dimensions based on a maximum width and height
*