/**
* Allows a post to be seperated into languages, and will return the content for
* the visitor's langauge
*/
function posttools_lang($args = null, $content) {
global $posttools_languageShown;
if ($posttools_languageShown) {
return '';
}
if ($_COOKIE['pt_lang']) {
$language = $_COOKIE['pt_lang'];
} else {
$language = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
}
if ($args['what'] === $language) {
$posttools_languageShown = true;
return $content;
}
return '';
}