Functions | Variables

Services/XHTMLValidator/validator/supported_chars.php File Reference

Go to the source code of this file.

Functions

 match_aliases ($str)
 callback function for array_map().
 test_charset ($charset)
 test if the given charset is supported by the local iconv() implementation

Variables

 $file = file_get_contents('http://www.iana.org/assignments/character-sets')
 $charsets [1] = array_map('match_aliases', $charsets[1])
 $total = count($charsets[0])
 $total_alias = count($charsets[1])
 $ok = 0
 $aliases = 0
 for ($i=0;$i< $total;$i++) = "SELECT * FROM object_data WHERE type='typ' AND title='rolt'"

Function Documentation

match_aliases ( str  ) 

callback function for array_map().

matches aliases and returns an array

Definition at line 4 of file supported_chars.php.

                             {
    if (!preg_match_all('/Alias:\s*(\S+)/S', $str, $matches) ||
        $matches[1][0] == 'None') {
        return array();
    }

    return $matches[1];

}

test_charset ( charset  ) 

test if the given charset is supported by the local iconv() implementation

Definition at line 16 of file supported_chars.php.

                                {
    return (bool) @iconv($charset, 'UTF-8', 'a');
}



$file = file_get_contents('http://www.iana.org/assignments/character-sets');

preg_match_all('/Name:\s*(\S+).*[\r\n]+MIBenum:.*[\r\n]+Source:.*[\r\n]+((?:Alias:\s*\S+.*[\r\n]+)*)/', $file, $charsets);

array_shift($charsets);
$charsets[1] = array_map('match_aliases', $charsets[1]);
usort($charsets[0], 'strnatcasecmp');

$total = count($charsets[0]);
$total_alias = count($charsets[1]);
$ok = 0;
$aliases = 0;

for ($i = 0; $i < $total; $i++) {

    echo $charsets[0][$i] . ': ';

    if (test_charset($charsets[0][$i])) {
        ++$ok;
        $valid[] = $charsets[0][$i];
        echo "true";
        $a = array();

        foreach ($charsets[1][$i] as $alias) {
            if (test_charset($alias)) {
                ++$aliases;
                $a[] = $alias;
            }
        }

        if($a = join($a, ', '))
            echo "; Valid aliases: $a";

        echo "\n";

    } else {
        echo "false\n";
    }
}


Variable Documentation

$aliases = 0

Definition at line 33 of file supported_chars.php.

$charsets[1] = array_map('match_aliases', $charsets[1])

Definition at line 27 of file supported_chars.php.

$file = file_get_contents('http://www.iana.org/assignments/character-sets')

Definition at line 22 of file supported_chars.php.

$ok = 0
$total = count($charsets[0])
$total_alias = count($charsets[1])

Definition at line 31 of file supported_chars.php.

for = "SELECT * FROM object_data WHERE type='typ' AND title='rolt'"

Definition at line 35 of file supported_chars.php.

Referenced by Core::highlight_text().