public function mainPath($buffer)
{
$content_type = NULL;
foreach (headers_list() as $header) {
if (strpos(strtolower($header), 'content-type:') === 0) {
$pieces = explode(':', strtolower($header));
$content_type = trim($pieces[1]);
break;
}
}
if (is_null($content_type) || substr($content_type, 0, 9) === 'text/html') {
$buffer = preg_replace('/https?:/i', '', $buffer);
}
return $buffer;
}
}