21 protected $_aUmls = array(
"\xc3\xa4",
"\xc3\xb6",
"\xc3\xbc",
"\xC3\x84",
"\xC3\x96",
"\xC3\x9C",
"\xC3\x9F");
28 protected $_aUmlEntities = array(
'ä',
'ö',
'ü',
'Ä',
'Ö',
'Ü',
'ß');
46 return mb_strlen($sStr, $this->_sEncoding);
58 public function substr($sStr, $iStart, $iLength = null)
60 $iLength = is_null($iLength) ? $this->
strlen($sStr) : $iLength;
62 return mb_substr($sStr, $iStart, $iLength, $this->_sEncoding);
74 public function strpos($sHaystack, $sNeedle, $iOffset = null)
77 if ($sHaystack && $sNeedle) {
78 $iOffset = is_null($iOffset) ? 0 : $iOffset;
79 $iPos = mb_strpos($sHaystack, $sNeedle, $iOffset, $this->_sEncoding);
93 public function strstr($sHaystack, $sNeedle)
100 return mb_strstr($sHaystack, $sNeedle,
false, $this->_sEncoding);
112 return mb_strtolower($sString, $this->_sEncoding);
124 return mb_strtoupper($sString, $this->_sEncoding);
150 return htmlentities($sString, $iQuotStyle, $this->_sEncoding);
176 public function preg_split($sPattern, $sString, $iLimit = -1, $iFlag = 0)
178 return preg_split($sPattern .
'u', $sString, $iLimit, $iFlag);
192 public function preg_replace($aPattern, $sString, $sSubject, $iLimit = -1, $iCount = null)
194 if (is_array($aPattern)) {
195 foreach ($aPattern as &$sPattern) {
196 $sPattern = $sPattern .
'u';
199 $aPattern = $aPattern .
'u';
202 return preg_replace($aPattern, $sString, $sSubject, $iLimit, $iCount);
218 if (is_array($pattern)) {
219 foreach ($pattern as &$item) {
223 $pattern = $pattern .
'u';
240 public function preg_match($sPattern, $sSubject, &$aMatches = null, $iFlags = null, $iOffset = null)
242 return preg_match($sPattern .
'u', $sSubject, $aMatches, $iFlags, $iOffset);
256 public function preg_match_all($sPattern, $sSubject, &$aMatches = null, $iFlags = null, $iOffset = null)
258 return preg_match_all($sPattern .
'u', $sSubject, $aMatches, $iFlags, $iOffset);
272 return $sString . $this->
substr($sSubject, 1);
285 public function wordwrap($sString, $iLength = 75, $sBreak =
"\n", $blCut = null)
288 $sRegexp =
"/^(.{1,{$iLength}}\r?(\s|$|\n)|.{1,{$iLength}}[^\r\s\n]*\r?(\n|\s|$))/u";
290 $sRegexp =
"/^([^\s]{{$iLength}}|.{1,{$iLength}}\s)/u";
293 $iStrLen = mb_strlen($sString, $this->_sEncoding);
294 $iWraps = floor($iStrLen / $iLength);
300 $iWraps = floor(mb_strlen($sString, $this->_sEncoding) / $iLength);
303 if (
preg_match($sRegexp, $sString, $aMatches)) {
304 $sStr = $aMatches[0];
305 $sReturn .=
preg_replace(
'/\s$/s',
'', $sStr) . $sBreak;
306 $sString = $this->
substr($sString, mb_strlen($sStr, $this->_sEncoding));
314 $sReturn .= $sBreak . $sString;
332 public function recodeEntities($sInput, $blToHtmlEntities =
false, $aUmls = array(), $aUmlEntities = array())
334 $aUmls = (count($aUmls) > 0) ? array_merge($this->_aUmls, $aUmls) :
$this->_aUmls;
335 $aUmlEntities = (count($aUmlEntities) > 0) ? array_merge($this->_aUmlEntities, $aUmlEntities) :
$this->_aUmlEntities;
337 return $blToHtmlEntities ? str_replace($aUmls, $aUmlEntities, $sInput) : str_replace($aUmlEntities, $aUmls, $sInput);
349 return $this->
preg_match(
"/(" . implode(
"|", $this->_aUmls) .
"|(&))/", $sStr);
363 return $this->
preg_replace(
"/\n|\r|\t|\xc2\x95|\xc2\xa0|;/", $sCleanChr, $sStr);
375 return json_encode($data);
388 if (stripos($sAllowableTags,
'<style>') ===
false) {
390 $sString = $this->
preg_replace(
"'<style[^>]*>.*</style>'siU",
'', $sString);
407 return -strcmp($sStr1, $sStr2);