mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-21 23:52:31 -05:00
Add helper function to the DashboardModel that converts line breaks to <br />s
This commit is contained in:
parent
ced98ebb81
commit
8f4764f9b6
1 changed files with 10 additions and 0 deletions
|
@ -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
|
* Find the desired image dimensions based on a maximum width and height
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue