<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: html.php,v 1.21 2004/12/31 09:10:45 henoheno Exp $
+// $Id: html.php,v 1.22 2005/01/08 02:34:11 henoheno Exp $
//
// HTML-publishing related functions
}
}
-// Check header()s were sent already, or
+// Check HTTP header()s were sent already, or
// there're blank lines or something out of php blocks
function pkwk_headers_sent()
{
}
}
+// Output common HTTP headers
function pkwk_common_headers()
{
if (! PKWK_OPTIMISE) pkwk_headers_sent();
header('Vary: Accept-Encoding');
}
}
+
+// DTD definitions
+define('PKWK_DTD_XHTML_1_1', 17); // Strict only
+define('PKWK_DTD_XHTML_1_0', 16); // Strict
+define('PKWK_DTD_XHTML_1_0_STRICT', 16);
+define('PKWK_DTD_XHTML_1_0_TRANSITIONAL', 15);
+define('PKWK_DTD_XHTML_1_0_FRAMESET', 14);
+define('PKWK_DTD_HTML_4_01', 3); // Strict
+define('PKWK_DTD_HTML_4_01_STRICT', 3);
+define('PKWK_DTD_HTML_4_01_TRANSITIONAL', 2);
+define('PKWK_DTD_HTML_4_01_FRAMESET', 1);
+
+// Output HTML DTD, <html> start tag. Return content-type.
+function pkwk_output_dtd($pkwk_dtd = PKWK_DTD_XHTML_1_1)
+{
+ static $called;
+ if (isset($called)) die('pkwk_output_dtd() already called. Why?');
+ $called = TRUE;
+
+ $type = 'XHTML';
+ $option = '';
+ switch($pkwk_dtd){
+ case PKWK_DTD_XHTML_1_1 : $version = '1.1' ; $dtd = 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'; break;
+ case PKWK_DTD_XHTML_1_0_STRICT : $version = '1.0' ; $option = 'Strict'; $dtd = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'; break;
+ case PKWK_DTD_XHTML_1_0_TRANSITIONAL: $version = '1.0' ; $option = 'Transitional'; $dtd = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'; break;
+ case PKWK_DTD_HTML_4_01_STRICT : $type = 'HTML'; $version = '4.01'; $dtd = 'http://www.w3.org/TR/html4/strict.dtd'; break;
+ case PKWK_DTD_HTML_4_01_TRANSITIONAL: $type = 'HTML'; $version = '4.01'; $option = 'Transitional'; $dtd = 'http://www.w3.org/TR/html4/loose.dtd'; break;
+ default: die('DTD not specified or invalid DTD'); break;
+ }
+
+ // Output XML or not
+ if ($type == 'XHTML') echo '<?xml version="1.0" encoding="' . CONTENT_CHARSET . '" ?>' . "\n";
+
+ // Output doctype
+ echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD ' . $type . ' ' . $version . ($option != '' ? ' ' . $option : '') . '//EN" "' . $dtd . '">' . "\n";
+
+ // Output <html> start tag
+ echo '<html';
+ if ($type == 'XHTML') {
+ echo ' xmlns="http://www.w3.org/1999/xhtml"'; // dir="ltr" /* LeftToRight */
+ echo ' xml:lang="' . LANG . '"';
+ if ($version == '1.0') echo ' lang="' . LANG . '"';
+ } else {
+ echo ' lang="' . LANG . '"'; // HTML
+ }
+ echo '>' . "\n"; // <html>
+
+ // Return content-type (with MIME type)
+ if ($type == 'XHTML') {
+ // NOTE: XHTML 1.1 browser will ignore http-equiv
+ return '<meta http-equiv="content-type" content="application/xhtml+xml; charset=' . CONTENT_CHARSET . '" />' . "\n";
+ } else {
+ return '<meta http-equiv="content-type" content="text/html; charset=' . CONTENT_CHARSET . '" />' . "\n";
+ }
+}
?>
<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: pukiwiki.skin.php,v 1.32 2004/12/24 15:22:10 henoheno Exp $
+// $Id: pukiwiki.skin.php,v 1.33 2005/01/08 02:36:11 henoheno Exp $
//
// PukiWiki default skin
case 'ja': $css_charset = 'Shift_JIS'; break;
}
-// Output header
+// Output HTTP headers
pkwk_common_headers();
header('Cache-control: no-cache');
header('Pragma: no-cache');
header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
-// Output body
-echo '<?xml version="1.0" encoding="' . CONTENT_CHARSET . '"?>';
-if ($html_transitional) { ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo LANG ?>" lang="<?php echo LANG ?>">
-<?php } else { ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo LANG ?>">
-<?php } ?>
+// Output HTML DTD, <html>, and receive content-type
+if (TRUE || $html_transitional) {
+ $meta_content_type = pkwk_output_dtd(PKWK_DTD_XHTML_1_0_TRANSITIONAL);
+} else {
+ $meta_content_type = pkwk_output_dtd();
+}
+
+?>
<head>
- <meta http-equiv="content-type" content="application/xhtml+xml; charset=<?php echo CONTENT_CHARSET ?>" />
+ <?php echo $meta_content_type ?>
<meta http-equiv="content-style-type" content="text/css" />
<?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
<?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: tdiary.skin.php,v 1.3 2004/12/31 01:08:47 henoheno Exp $
+// $Id: tdiary.skin.php,v 1.4 2005/01/08 02:36:11 henoheno Exp $
//
// tDiary-wrapper skin
case 'ja': $css_charset = 'Shift_JIS'; break;
}
-// Output header
+// Output HTTP headers
pkwk_common_headers();
header('Cache-control: no-cache');
header('Pragma: no-cache');
header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
-// Output body
+// Output HTML DTD, <html>, and receive content-type
+$meta_content_type = pkwk_output_dtd(PKWK_DTD_HTML_4_01);
+
?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="<?php echo LANG ?>">
<head>
- <meta http-equiv="content-type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" />
+ <?php echo $meta_content_type ?>
<meta http-equiv="content-style-type" content="text/css" />
<?php if (! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
<?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
</div>
</div><!-- class="body" -->
-<?php if ($notes) { ?>
+<?php if ($notes != '') { ?>
<div class="comment"><!-- Design for tDiary "Comments" -->
<div class="caption"> </div>
<div class="commentbody"><br/>
</div>
<?php } ?>
-<?php if ($attaches) { ?>
+<?php if ($attaches != '') { ?>
<div class="comment">
<div class="caption"> </div>
<div class="commentshort">
</div>
<?php } ?>
-<?php if ($related) { ?>
+<?php if ($related != '') { ?>
<div class="comment">
<div class="caption"> </div>
<div class="commentshort">
<?php } ?>
<!-- Design for tDiary "Today's referrer" -->
-<div class="referer"><?php if ($lastmodified) echo 'Last-modified: ' . $lastmodified; ?></div>
+<div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
</div><!-- class="day" -->