snytkine / LampCMS

Open source Question and Answer program similar to StackOverflow and Quora in PHP + MongoDB. Follow @snytkine on Twitter
http://support.lampcms.com
323 stars 104 forks source link

Add BrowserHeaders class #85

Open snytkine opened 12 years ago

snytkine commented 12 years ago

Add class BrowserHeaders to parse Accept-Language and Accept-Encoding headers. The return for these should be always an array of values ordered in the order they appear in headers The value of "q=" should be used according the W3C standards. When there is no q then just use the order of appearance, otherwise use value of "q"

Then we can use these values to set the Translation's object locale to the first match of supported language

For Charset we always serve pages in UTF-8 format but if utf-8 is not in the list of accepted charsets then we can recode into the user's prefered charset using iconv() from the output buffer but only if iconv extension is available.

For this to work we should not hard-code the utf-8 into headers like we do now in index.php

snytkine commented 12 years ago

This will be done in PR3 when Intl extension is used.