Contao\StringUtil::decodeEntities PHP Метод

decodeEntities() публичный статический Метод

Decode all entities
public static decodeEntities ( string $strString, integer $strQuoteStyle = ENT_COMPAT, string $strCharset = null ) : string
$strString string The string to decode
$strQuoteStyle integer The quote style (defaults to ENT_COMPAT)
$strCharset string An optional charset
Результат string The decoded string
    public static function decodeEntities($strString, $strQuoteStyle = ENT_COMPAT, $strCharset = null)
    {
        if ($strString == '') {
            return '';
        }
        if ($strCharset === null) {
            $strCharset = \Config::get('characterSet');
        }
        $strString = preg_replace('/(&#*\\w+)[\\x00-\\x20]+;/i', '$1;', $strString);
        $strString = preg_replace('/(&#x*)([0-9a-f]+);/i', '$1$2;', $strString);
        return html_entity_decode($strString, $strQuoteStyle, $strCharset);
    }

Usage Example

 /**
  * Decode all entities.
  *
  * @param string  $strString     The string to decode.
  * @param integer $strQuoteStyle The quote style (defaults to ENT_COMPAT).
  * @param string  $strCharset    An optional charset.
  *
  * @return string The decoded string
  */
 public static function decodeEntities($strString, $strQuoteStyle = ENT_COMPAT, $strCharset = null)
 {
     if (self::isStringUtilAvailable()) {
         return StringUtil::decodeEntities($strString, $strQuoteStyle, $strCharset);
     }
     return \Contao\String::decodeEntities($strString, $strQuoteStyle, $strCharset);
 }
All Usage Examples Of Contao\StringUtil::decodeEntities