2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: tdiary.skin.php,v 1.37 2011/01/25 15:01:01 henoheno Exp $
5 // 2002-2006 PukiWiki Developers Team
6 // 2001-2002 Originally written by yu-ji
7 // License: GPL v2 or (at your option) any later version
9 // tDiary-wrapper skin (Updated for tdiary-theme 2.1.2)
11 // ------------------------------------------------------------
12 // Settings (define before here, if you want)
14 // Set site identities
15 $_IMAGE['skin']['favicon'] = ''; // Sample: 'image/favicon.ico';
18 if (! defined('TDIARY_THEME'))
19 define('TDIARY_THEME', 'loose-leaf'); // Default
21 // Show link(s) at your choice, with <div class="calendar"> design
22 // NOTE: Some theme become looking worse with this!
23 // NULL = Show nothing
25 // 1 = Show reload URL
26 if (! defined('TDIARY_CALENDAR_DESIGN'))
27 define('TDIARY_CALENDAR_DESIGN', NULL); // NULL, 0, 1
29 // Show / Hide navigation bar UI at your choice
30 // NOTE: This is not stop their functionalities!
31 if (! defined('PKWK_SKIN_SHOW_NAVBAR'))
32 define('PKWK_SKIN_SHOW_NAVBAR', 1); // 1, 0
34 // Show toolbar at your choice, with <div class="footer"> design
35 // NOTE: Some theme become looking worse with this!
36 if (! defined('PKWK_SKIN_SHOW_TOOLBAR'))
37 define('PKWK_SKIN_SHOW_TOOLBAR', 0); // 0, 1
39 // TDIARY_SIDEBAR_POSITION: See below
41 // ------------------------------------------------------------
44 // Prohibit direct access
45 if (! defined('UI_LANG')) die('UI_LANG is not set');
46 if (! isset($_LANG)) die('$_LANG is not set');
47 if (! defined('PKWK_READONLY')) die('PKWK_READONLY is not set');
49 // ------------------------------------------------------------
52 if (! defined('TDIARY_THEME') || TDIARY_THEME == '') {
53 die('Theme is not specified. Set "TDIARY_THEME" correctly');
55 $theme = rawurlencode(TDIARY_THEME); // Supress all nasty letters
56 $theme_css = SKIN_DIR . 'theme/' . $theme . '/' . $theme . '.css';
57 if (! file_exists($theme_css)) {
58 echo 'tDiary theme wrapper: ';
59 echo 'Theme not found: ' . htmlsc($theme_css) . '<br />';
60 echo 'You can get tdiary-theme from: ';
61 echo 'http://sourceforge.net/projects/tdiary/';
66 // ------------------------------------------------------------
67 // tDiary theme: Exception
69 // Adjust DTD (bug between these theme(=CSS) and MSIE)
71 // PukiWiki default: PKWK_DTD_XHTML_1_1
72 // tDiary's default: PKWK_DTD_HTML_4_01_STRICT
75 $pkwk_dtd = PKWK_DTD_HTML_4_01_STRICT; // or centering will be ignored via MSIE
79 // Adjust reverse-link default design manually
80 $disable_backlink = FALSE;
82 case 'hatena': /* FALLTHROUGH */
85 case 'hatena-darkgray':
87 case 'hatena-lightblue':
88 case 'hatena-lightgray':
92 case 'hatena_cinnamon':
93 case 'hatena_japanese':
96 $disable_backlink = TRUE; // or very viewable title color
100 // ------------------------------------------------------------
101 // tDiary theme: Select CSS color theme (Now testing:black only)
103 if (defined('TDIARY_COLOR_THEME')) {
104 $css_theme = rawurlencode(TDIARY_COLOR_THEME);
108 switch(TDIARY_THEME){
111 case 'black-lingerie':
116 case 'digital_gadgets':
121 case 'hatena_savanna-blue':
122 case 'hatena_savanna-green':
123 case 'hatena_savanna-red':
138 case 'tinybox_green':
139 case 'white-lingerie':
146 $css_theme = 'black';
148 // Another theme needed?
153 case 'smoking_black':
158 // ------------------------------------------------------------
159 // tDiary theme: Page title design (which is fancy, date and text?)
161 if (defined('TDIARY_TITLE_DESIGN_DATE') &&
162 (TDIARY_TITLE_DESIGN_DATE == 0 ||
163 TDIARY_TITLE_DESIGN_DATE == 1 ||
164 TDIARY_TITLE_DESIGN_DATE == 2)) {
165 $title_design_date = TDIARY_TITLE_DESIGN_DATE;
167 $title_design_date = 1; // Default: Select the date desin, or 'the same design'
168 switch(TDIARY_THEME){
169 case '3minutes': /* FALLTHROUGH */
172 case 'black-lingerie':
175 case 'book2-feminine':
182 case 'kitchen-classic':
183 case 'kitchen-french':
184 case 'kitchen-natural':
206 case 'sleepy_kitten':
212 case 'white-lingerie':
216 $title_design_date = 0; // Select text design
225 $title_design_date = 2; // Show both :)
230 // ------------------------------------------------------------
231 // tDiary 'Sidebar' position
234 if (defined('TDIARY_SIDEBAR_POSITION')) {
235 $sidebar = TDIARY_SIDEBAR_POSITION;
237 $sidebar = 'another'; // Default: Show as an another page below
239 // List of themes having sidebar CSS < (AllTheme / 2)
240 // $ grep div.sidebar */*.css | cut -d: -f1 | cut -d/ -f1 | sort | uniq
242 // 142 list-sidebar.txt
244 switch(TDIARY_THEME){
245 case '3minutes': /*FALLTHROUGH*/
250 case 'artnouveau-blue':
251 case 'artnouveau-green':
252 case 'artnouveau-red':
253 case 'asterisk-blue':
254 case 'asterisk-lightgray':
255 case 'asterisk-maroon':
256 case 'asterisk-orange':
257 case 'asterisk-pink':
265 case 'book2-feminine':
273 case 'cherry_blossom':
274 case 'chiffon_leafgreen':
276 case 'chiffon_skyblue':
287 case 'digital_gadgets':
292 case 'dotted_line-blue':
293 case 'dotted_line-green':
294 case 'dotted_line-red':
305 case 'hatena-darkgray':
307 case 'hatena-lightblue':
308 case 'hatena-lightgray':
310 case 'hatena-orange':
312 case 'hatena-purple':
317 case 'hatena_cinnamon':
318 case 'hatena_japanese':
320 case 'hatena_rainyseason':
321 case 'hatena_savanna-blue':
322 case 'hatena_savanna-green':
323 case 'hatena_savanna-red':
324 case 'hatena_savanna-white':
329 case 'kitchen-classic':
330 case 'kitchen-french':
331 case 'kitchen-natural':
345 case 'orange_flower':
358 case 'rim-daidaiiro':
361 case 'rim-sakurairo':
362 case 'rim-tanpopoiro':
363 case 'rim-wakabairo':
371 case 'sleepy_kitten':
372 case 'smoking_black':
373 case 'smoking_white':
381 case 'tinybox_green':
387 $sidebar = 'bottom'; // This is the default position of tDiary's.
391 // Manually adjust sidebar's default position
392 switch(TDIARY_THEME){
395 case '90': // But upper navigatin UI will be hidden by sidebar
402 // 'top': Assuming sidebar is above of the body
403 case 'autumn': /*FALLTHROUGH*/
405 case 'dice': // Sidebar text (white) seems unreadable
409 case 'paper': // Sidebar text (white) seems unreadable
411 case 'tinybox': // For MSIE with narrow window width, seems meanless
412 case 'tinybox_green': // The same
417 // 'strict': Strict separation between sidebar and main contents needed
418 case '3minutes': /*FALLTHROUGH*/
422 case 'artnouveau-blue':
423 case 'artnouveau-green':
424 case 'artnouveau-red':
425 case 'asterisk-blue':
426 case 'asterisk-lightgray':
427 case 'asterisk-maroon':
428 case 'asterisk-orange':
429 case 'asterisk-pink':
433 case 'chiffon_leafgreen':
435 case 'chiffon_skyblue':
444 case 'dotted_line-blue':
445 case 'dotted_line-green':
446 case 'dotted_line-red':
453 case 'hatena-darkgray':
455 case 'hatena-lightblue':
456 case 'hatena-lightgray':
458 case 'hatena-orange':
460 case 'hatena-purple':
468 case 'kitchen-classic':
469 case 'kitchen-french':
470 case 'kitchen-natural':
483 case 'moo': // For MSIE, strict seems meanless
495 case 's-blue': // For MSIE, strict seems meanless
508 // 'another': They have sidebar-design, but can not show it
509 // at the 'side' of the contents
510 case 'babypink': /*FALLTHROUGH*/
521 case 'smoking_black':
523 $sidebar = 'another'; // Show as an another page below
527 // 'none': Show no sidebar
529 // Check menu (sidebar) is ready and $menubar is there
530 if ($sidebar == 'none') {
533 $menu = (arg_check('read') && is_page($GLOBALS['menubar']) &&
534 exist_plugin_convert('menu'));
536 $menu_body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
537 '<h3 $1><span class="sanchor"></span> $2</h3>',
538 do_plugin_convert('menu'));
542 // ------------------------------------------------------------
543 // Code continuing ...
545 $lang = & $_LANG['skin'];
547 $image = & $_IMAGE['skin'];
548 $rw = ! PKWK_READONLY;
550 // Decide charset for CSS
551 $css_charset = 'iso-8859-1';
553 case 'ja': $css_charset = 'Shift_JIS'; break;
556 // ------------------------------------------------------------
560 pkwk_common_headers();
561 header('Cache-control: no-cache');
562 header('Pragma: no-cache');
563 header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
565 // HTML DTD, <html>, and receive content-type
566 if (isset($pkwk_dtd)) {
567 $meta_content_type = pkwk_output_dtd($pkwk_dtd);
569 $meta_content_type = pkwk_output_dtd();
574 <?php echo $meta_content_type ?>
575 <meta http-equiv="content-style-type" content="text/css" />
576 <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
577 <?php if (PKWK_ALLOW_JAVASCRIPT && isset($javascript)) { ?> <meta http-equiv="Content-Script-Type" content="text/javascript" /><?php } ?>
579 <title><?php echo $title ?> - <?php echo $page_title ?></title>
581 <link rel="SHORTCUT ICON" href="<?php echo $image['favicon'] ?>" />
582 <link rel="stylesheet" type="text/css" media="all" href="skin/theme/base.css" />
583 <link rel="stylesheet" type="text/css" media="all" href="skin/theme/<?php echo $theme ?>/<?php echo $theme ?>.css" />
584 <link rel="stylesheet" type="text/css" media="screen" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&color=<?php echo $css_theme ?>" charset="<?php echo $css_charset ?>" />
585 <link rel="stylesheet" type="text/css" media="print" href="skin/tdiary.css.php?charset=<?php echo $css_charset ?>&color=<?php echo $css_theme ?>&media=print" charset="<?php echo $css_charset ?>" />
586 <link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $link['rss'] ?>" /><?php // RSS auto-discovery ?>
588 <?php if (PKWK_ALLOW_JAVASCRIPT && $trackback_javascript) { ?> <script type="text/javascript" src="skin/trackback.js"></script><?php } ?>
590 <?php echo $head_tag ?>
592 <body><!-- Theme:<?php echo htmlsc($theme) . ' Sidebar:' . $sidebar ?> -->
594 <?php if ($menu && $sidebar == 'strict') { ?>
596 <div class="sidebar">
598 <?php echo $menu_body ?>
600 </div><!-- class="sidebar" -->
602 <div class="pkwk_body">
604 <?php } // if ($menu && $sidebar == 'strict') ?>
606 <!-- Navigation buttuns -->
607 <?php if (PKWK_SKIN_SHOW_NAVBAR) { ?>
608 <div class="adminmenu"><div id="navigator">
610 function _navigator($key, $value = '', $javascript = ''){
611 $lang = $GLOBALS['_LANG']['skin'];
612 $link = $GLOBALS['_LINK'];
613 if (! isset($lang[$key])) { echo 'LANG NOT FOUND'; return FALSE; }
614 if (! isset($link[$key])) { echo 'LINK NOT FOUND'; return FALSE; }
615 if (! PKWK_ALLOW_JAVASCRIPT) $javascript = '';
617 echo '<span class="adminmenu"><a href="' . $link[$key] . '" ' . $javascript . '>' .
618 (($value === '') ? $lang[$key] : $value) .
624 <?php _navigator('top') ?>
626 <?php if ($is_page) { ?>
628 <?php _navigator('edit') ?>
629 <?php if ($is_read && $function_freeze) { ?>
630 <?php (! $is_freeze) ? _navigator('freeze') : _navigator('unfreeze') ?>
633 <?php _navigator('diff') ?>
634 <?php if ($do_backup) { ?>
635 <?php _navigator('backup') ?>
637 <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
638 <?php _navigator('upload') ?>
640 <?php _navigator('reload') ?>
645 <?php _navigator('new') ?>
647 <?php _navigator('list') ?>
648 <?php if (arg_check('list')) { ?>
649 <?php _navigator('filelist') ?>
651 <?php _navigator('search') ?>
652 <?php _navigator('recent') ?>
653 <?php _navigator('help') ?>
655 <?php if ($trackback) { ?>
656 <?php _navigator('trackback', $lang['trackback'] . '(' . tb_count($_page) . ')',
657 ($trackback_javascript == 1) ? 'onclick="OpenTrackback(this.href); return false"' : '') ?>
659 <?php if ($referer) { ?>
660 <?php _navigator('refer') ?>
664 <div id="navigator"></div>
665 <?php } // PKWK_SKIN_SHOW_NAVBAR ?>
667 <h1><?php echo $page_title ?></h1>
669 <div class="calendar">
670 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
671 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
672 <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
674 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
680 <?php if ($menu && $sidebar == 'top') { ?>
681 <!-- Sidebar compat top -->
682 <div class="sidebar">
684 <?php echo $menu_body ?>
686 </div><!-- class="sidebar" -->
687 <?php } // if ($menu && $sidebar == 'top') ?>
690 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
691 <div class="pkwk_body">
700 // Page title (page name)
702 if ($disable_backlink) {
704 $title = htmlsc($_page);
706 $title = $page; // Search, or something message
712 $title = htmlsc($_page);
715 $title_date = $title_text = '';
716 switch($title_design_date){
717 case 1: $title_date = & $title; break;
718 case 0: $title_text = & $title; break;
720 // Show both (for debug or someting)
721 $title_date = & $title;
722 $title_text = & $title;
726 <h2><span class="date"><?php echo $title_date ?></span>
727 <span class="title"><?php echo $title_text ?></span></h2>
730 <div class="section">
732 // For read and preview: tDiary have no <h2> inside body
733 $body = preg_replace('#<h2 ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h2>#',
734 '<h3 $1><a $3><span class="sanchor">_</span></a> $2</h3>', $body);
735 $body = preg_replace('#<h([34]) ([^>]*)>(.*?)<a class="anchor_super" ([^>]*)>.*?</a></h\1>#',
736 '<h$1 $2><a $4>_</a> $3</h$1>', $body);
737 $body = preg_replace('#<h2 ([^>]*)>(.*?)</h2>#',
738 '<h3 $1><span class="sanchor">_</span> $2</h3>', $body);
743 // Edit, preview, search, etc
744 echo preg_replace('/(<form) (action="' . preg_quote($script, '/') .
745 ')/', '$1 class="update" $2', $body);
749 </div><!-- class="body" -->
752 <?php if ($notes != '') { ?>
753 <div class="comment"><!-- Design for tDiary "Comments" -->
754 <div class="caption"> </div>
755 <div class="commentbody"><br />
757 $notes = preg_replace('#<span class="small">(.*?)</span>#', '<p>$1</p>', $notes);
758 echo preg_replace('#<a (id="notefoot_[^>]*)>(.*?)</a>#',
759 '<div class="commentator"><a $1><span class="canchor"></span> ' .
760 '<span class="commentator">$2</span></a>' .
761 '<span class="commenttime"></span></div>', $notes);
767 <?php if ($attaches != '') { ?>
768 <div class="comment">
769 <div class="caption"> </div>
770 <div class="commentshort">
771 <?php echo $attaches ?>
776 <?php if ($related != '') { ?>
777 <div class="comment">
778 <div class="caption"> </div>
779 <div class="commentshort">
780 Link: <?php echo $related ?>
785 <!-- Design for tDiary "Today's referrer" -->
786 <div class="referer"><?php if ($lastmodified != '') echo 'Last-modified: ' . $lastmodified; ?></div>
788 </div><!-- class="day" -->
793 <?php if ($menu && $sidebar == 'another') { ?>
794 </div><!-- class="main" -->
795 </div><!-- class="pkwk_body" -->
797 <!-- Sidebar another -->
798 <div class="pkwk_body">
800 <div class="calendar"></div>
803 <h2><span class="date"></span><span class="title"> </span></h2>
805 <div class="section">
806 <?php echo $menu_body ?>
809 <div class="referer"></div>
812 </div><!-- class="pkwk_body" -->
814 <div class="pkwk_body">
816 <?php } // if ($menu && $sidebar == 'another') ?>
819 <?php if ($menu && ($sidebar == 'top' || $sidebar == 'bottom')) { ?>
820 </div><!-- class="main" -->
821 </div><!-- class="pkwk_body" -->
825 <?php if ($menu && $sidebar == 'bottom') { ?>
826 <!-- Sidebar compat bottom -->
827 <div class="sidebar">
829 <?php echo $menu_body ?>
831 </div><!-- class="sidebar" -->
832 <?php } // if ($menu && $sidebar == 'bottom') ?>
836 <?php if (PKWK_SKIN_SHOW_TOOLBAR) { ?>
840 // Set toolbar-specific images
841 $_IMAGE['skin']['reload'] = 'reload.png';
842 $_IMAGE['skin']['new'] = 'new.png';
843 $_IMAGE['skin']['edit'] = 'edit.png';
844 $_IMAGE['skin']['freeze'] = 'freeze.png';
845 $_IMAGE['skin']['unfreeze'] = 'unfreeze.png';
846 $_IMAGE['skin']['diff'] = 'diff.png';
847 $_IMAGE['skin']['upload'] = 'file.png';
848 $_IMAGE['skin']['copy'] = 'copy.png';
849 $_IMAGE['skin']['rename'] = 'rename.png';
850 $_IMAGE['skin']['top'] = 'top.png';
851 $_IMAGE['skin']['list'] = 'list.png';
852 $_IMAGE['skin']['search'] = 'search.png';
853 $_IMAGE['skin']['recent'] = 'recentchanges.png';
854 $_IMAGE['skin']['backup'] = 'backup.png';
855 $_IMAGE['skin']['help'] = 'help.png';
856 $_IMAGE['skin']['rss'] = 'rss.png';
857 $_IMAGE['skin']['rss10'] = & $_IMAGE['skin']['rss'];
858 $_IMAGE['skin']['rss20'] = 'rss20.png';
859 $_IMAGE['skin']['rdf'] = 'rdf.png';
861 function _toolbar($key, $x = 20, $y = 20){
862 $lang = & $GLOBALS['_LANG']['skin'];
863 $link = & $GLOBALS['_LINK'];
864 $image = & $GLOBALS['_IMAGE']['skin'];
865 if (! isset($lang[$key]) ) { echo 'LANG NOT FOUND'; return FALSE; }
866 if (! isset($link[$key]) ) { echo 'LINK NOT FOUND'; return FALSE; }
867 if (! isset($image[$key])) { echo 'IMAGE NOT FOUND'; return FALSE; }
869 echo '<a href="' . $link[$key] . '">' .
870 '<img src="' . IMAGE_DIR . $image[$key] . '" width="' . $x . '" height="' . $y . '" ' .
871 'alt="' . $lang[$key] . '" title="' . $lang[$key] . '" />' .
876 <?php _toolbar('top') ?>
878 <?php if ($is_page) { ?>
881 <?php _toolbar('edit') ?>
882 <?php if ($is_read && $function_freeze) { ?>
883 <?php if (! $is_freeze) { _toolbar('freeze'); } else { _toolbar('unfreeze'); } ?>
886 <?php _toolbar('diff') ?>
887 <?php if ($do_backup) { ?>
888 <?php _toolbar('backup') ?>
890 <?php if ($rw && (bool)ini_get('file_uploads')) { ?>
891 <?php _toolbar('upload') ?>
894 <?php _toolbar('copy') ?>
895 <?php _toolbar('rename') ?>
897 <?php _toolbar('reload') ?>
901 <?php _toolbar('new') ?>
903 <?php _toolbar('list') ?>
904 <?php _toolbar('search') ?>
905 <?php _toolbar('recent') ?>
906 <?php _toolbar('help') ?>
907 <?php _toolbar('rss10', 36, 14) ?>
909 <?php } // PKWK_SKIN_SHOW_TOOLBAR ?>
911 <!-- Copyright etc -->
912 Site admin: <a href="<?php echo $modifierlink ?>"><?php echo $modifier ?></a><p />
913 <?php echo S_COPYRIGHT ?>.
914 Powered by PHP <?php echo PHP_VERSION ?><br />
915 HTML convert time: <?php echo $taketime ?> sec.
917 </div><!-- class="footer" -->
919 <?php if ($menu && ($sidebar != 'top' && $sidebar != 'bottom')) { ?>
920 </div><!-- class="main" -->
921 </div><!-- class="pkwk_body" -->