Skip to content

Commit

Permalink
Whoopsie. Broke text formatting entirely.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kroc committed May 13, 2013
1 parent 8141475 commit dfcc46f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/websafe.php
Expand Up @@ -102,14 +102,16 @@ function safeUTF8 (

//Some interesting references:
//http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805

return $text;
}

/* safeTrim : trim *all* kinds of whitespace, not just the ASCII space / tab / CRLF!
---------------------------------------------------------------------------------------------------------------------- */
function safeTrim (&$text) {
//PHP `trim` doesn't cover a wide variety of Unicode; the private-use area is left, should the Apple logo be used
//<nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories>
$text = preg_replace ('/^[\pZ\p{Cc}\p{Cf}\p{Cn}\p{Cs}]+|[\pZ\p{Cc}\p{Cf}\p{Cn}\p{Cs}]+$/u', '', $text);
return $text = preg_replace ('/^[\pZ\p{Cc}\p{Cf}\p{Cn}\p{Cs}]+|[\pZ\p{Cc}\p{Cf}\p{Cn}\p{Cs}]+$/u', '', $text);
}

/* safeSpaces: normalise space-like characters
Expand Down

0 comments on commit dfcc46f

Please sign in to comment.