oxstrregular.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class oxStrRegular
00007 {
00013     protected $_sEncoding = 'ISO8859-15';
00014 
00020     protected $_aUmls = array( "\344", "\366", "\374", "\304", "\326", "\334", "\337" );
00021 
00026     protected $_aUmlEntities = array('&auml;', '&ouml;', '&uuml;', '&Auml;', '&Ouml;', '&Uuml;', '&szlig;' );
00027 
00035     public function strlen($sStr)
00036     {
00037         return strlen($sStr);
00038     }
00039 
00049     public function substr($sStr, $iStart, $iLength = null)
00050     {
00051         if (is_null($iLength)) {
00052             return substr($sStr, $iStart);
00053         } else {
00054             return substr($sStr, $iStart, $iLength);
00055         }
00056     }
00057 
00067     public function strpos($sHaystack, $sNeedle, $iOffset = null)
00068     {
00069         if (is_null($iOffset)) {
00070             return strpos($sHaystack, $sNeedle);
00071         } else {
00072             return strpos($sHaystack, $sNeedle, $iOffset);
00073         }
00074     }
00075 
00084     public function strstr($sHaystack, $sNeedle)
00085     {
00086         return strstr($sHaystack, $sNeedle);
00087     }
00088 
00096     public function strtolower($sString)
00097     {
00098         return strtolower($sString);
00099     }
00100 
00108     public function strtoupper($sString)
00109     {
00110         return strtoupper($sString);
00111     }
00112 
00120     public function htmlspecialchars($sString)
00121     {
00122         return htmlspecialchars( $sString, ENT_QUOTES, $this->_sEncoding );
00123     }
00124 
00132     public function htmlentities($sString)
00133     {
00134         return htmlentities( $sString, ENT_QUOTES, $this->_sEncoding );
00135     }
00136 
00144     public function html_entity_decode($sString)
00145     {
00146         return html_entity_decode( $sString, ENT_QUOTES, $this->_sEncoding );
00147     }
00148 
00159     public function preg_split($sPattern, $sString, $iLimit = -1, $iFlag = 0)
00160     {
00161         return preg_split( $sPattern, $sString, $iLimit, $iFlag );
00162     }
00163 
00175     public function preg_replace($sPattern, $sString, $sSubject, $iLimit = -1, $iCount = null)
00176     {
00177         return preg_replace( $sPattern, $sString, $sSubject, $iLimit, $iCount);
00178     }
00179 
00191     public function preg_match($sPattern, $sSubject, &$aMatches = null, $iFlags = null, $iOffset = null)
00192     {
00193         return preg_match( $sPattern, $sSubject, $aMatches, $iFlags, $iOffset);
00194     }
00195 
00203     public function ucfirst($sSubject)
00204     {
00205         $sString = $this->strtoupper($this->substr($sSubject, 0, 1));
00206         return $sString . $this->substr($sSubject, 1);
00207     }
00208 
00219     public function wordwrap($sString, $iLength = 75, $sBreak = "\n", $blCut = null )
00220     {
00221         return wordwrap($sString, $iLength, $sBreak, $blCut);
00222     }
00223 
00236     public function recodeEntities( $sInput, $blToHtmlEntities = false, $aUmls = array(), $aUmlEntities = array() )
00237     {
00238         $aUmls = ( count( $aUmls ) > 0 ) ? array_merge( $this->_aUmls, $aUmls) : $this->_aUmls;
00239         $aUmlEntities = ( count( $aUmlEntities ) > 0 ) ? array_merge( $this->_aUmlEntities, $aUmlEntities) : $this->_aUmlEntities;
00240         return $blToHtmlEntities ? str_replace( $aUmls, $aUmlEntities, $sInput ) : str_replace( $aUmlEntities, $aUmls, $sInput );
00241     }
00242 
00250     public function hasSpecialChars( $sStr )
00251     {
00252         return $this->preg_match( "/(".implode( "|", $this->_aUmls  )."|(&amp;))/", $sStr );
00253     }
00254 
00264     public function cleanStr( $sStr, $sCleanChr = ' ' )
00265     {
00266         return $this->preg_replace( "/\"|\'|\.|\:|\!|\?|\n|\r|\t|\x95|\xa0|;/", $sCleanChr, $sStr );
00267     }
00268 }

Generated on Wed Apr 22 12:26:31 2009 for OXID eShop CE by  doxygen 1.5.5