mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Improved code to handle LR throughout
This commit is contained in:
@@ -112,11 +112,11 @@ if ($_GET['action']=="load") {
|
||||
if($encoding=="") {
|
||||
$encoding="UTF-8";
|
||||
}
|
||||
// Left trim any \r from start of text after setting HTML entities on it according to encoding
|
||||
$loadedFile = ltrim(htmlentities($loadedFile,ENT_COMPAT,$encoding),"\r");
|
||||
if (substr($loadedFile,0,1) == "\n") {
|
||||
$loadedFile = " ".substr($loadedFile,1);
|
||||
}
|
||||
// Get content and set HTML entities on it according to encoding
|
||||
$loadedFile = htmlentities($loadedFile,ENT_COMPAT,$encoding);
|
||||
// Remove \r chars and replace \n with carriage return HTML entity char
|
||||
$loadedFile = preg_replace('/\\r/','',$loadedFile);
|
||||
$loadedFile = preg_replace('/\\n/',' ',$loadedFile);
|
||||
echo '</script><textarea name="loadedFile" id="loadedFile">'.$loadedFile.'</textarea><script>';
|
||||
// Run our custom processes
|
||||
include_once("../processes/on-file-load.php");
|
||||
|
||||
Reference in New Issue
Block a user