/////////////////////////////////////////////////
// PukiWiki - Yet another WikiWikiWeb clone.
//
-// $Id: html.php,v 1.15 2004/11/23 11:33:25 henoheno Exp $
+// $Id: html.php,v 1.20 2004/12/25 00:38:21 henoheno Exp $
//
// ËÜʸ¤ò½ÐÎÏ
// Cut fixed-anchors
$id = '';
$matches = array();
- if (preg_match('/^(\*{0,3})(.*?)\[#([a-z][a-f0-9]{7})\](.*?)$/m', $str, $matches)) {
+ if (preg_match('/^(\*{0,3})(.*?)\[#([A-Za-z][\w-]+)\](.*?)$/m', $str, $matches)) {
$str = $matches[2] . $matches[4];
$id = $matches[3];
} else {
return array ($s_page, $anchor, FALSE);
}
}
+
+// Check header()s were sent already, or
+// there're blank lines or something out of php blocks
+function pkwk_headers_sent()
+{
+ if (version_compare(PHP_VERSION, '4.3.0', '>=')) {
+ if (headers_sent($file, $line))
+ die('Headers already sent at ' .
+ htmlspecialchars($file) .
+ ' line ' . $line . '.');
+ } else {
+ if (headers_sent())
+ die('Headers already sent.');
+ }
+}
+
+function pkwk_common_headers()
+{
+ if (! PKWK_OPTIMISE) pkwk_headers_sent();
+
+ $matches = array();
+ if(ini_get('zlib.output_compression') &&
+ preg_match('/\b(gzip|deflate)\b/i', $_SERVER['HTTP_ACCEPT_ENCODING'], $matches)) {
+ header('Content-Encoding: ' . $matches[1]);
+ header('Vary: Accept-Encoding');
+ }
+}
?>