get::initXhtmlentities PHP Method

initXhtmlentities() protected static method

Initialize the character maps needed for the xhtmlentities() method and verifies the argument values passed to it are valid.
protected static initXhtmlentities ( integer $quoteStyle, string $charset, boolean $doubleEncode )
$quoteStyle integer
$charset string Only valid options are UTF-8 and ISO-8859-1 (Latin-1)
$doubleEncode boolean
    protected static function initXhtmlentities($quoteStyle, $charset, $doubleEncode)
    {
        $chars = get_html_translation_table(HTML_ENTITIES, $quoteStyle);
        if (isset($chars)) {
            unset($chars['<'], $chars['>']);
            $charMaps[$quoteStyle]['ISO-8859-1'][true] = $chars;
            $charMaps[$quoteStyle]['ISO-8859-1'][false] = array_combine(array_values($chars), $chars);
            $charMaps[$quoteStyle]['UTF-8'][true] = array_combine(array_map('utf8_encode', array_keys($chars)), $chars);
            $charMaps[$quoteStyle]['UTF-8'][false] = array_merge($charMaps[$quoteStyle]['ISO-8859-1'][false], $charMaps[$quoteStyle]['UTF-8'][true]);
            self::$loadedObjects['xhtmlEntities'] = $charMaps;
        }
        if (!isset($charMaps[$quoteStyle][$charset][$doubleEncode])) {
            if (!isset($chars)) {
                $invalidArgument = 'quoteStyle = ' . $quoteStyle;
            } else {
                if (!isset($charMaps[$quoteStyle][$charset])) {
                    $invalidArgument = 'charset = ' . $charset;
                } else {
                    $invalidArgument = 'doubleEncode = ' . (string) $doubleEncode;
                }
            }
            trigger_error('Undefined argument sent to xhtmlentities() method: ' . $invalidArgument, E_USER_NOTICE);
        }
    }