function getCharsets()
{
if ($this->charsets !== null) {
return $this->charsets;
}
$this->charsets = array();
if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
return $this->charsets;
}
foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) {
if (!empty($charset)) {
$this->charsets[] = preg_replace('/;.*/', '', $charset);
}
}
return $this->charsets;
}