2 // Avoid direct call to this file.
3 // PHPWIKI_VERSION is defined in lib/prepend.php
4 if (!defined('PHPWIKI_VERSION')) {
10 * This file defines a blog theme for PhpWiki,
11 * based on Rui Carmo's excellent http://the.taoofmac.com/space/
12 * which is based on the Kubrick theme: http://binarybonsai.com/kubrick/
13 * The layout was designed and built by Michael Heilemann,
14 * whose blog you will find at http://binarybonsai.com/
16 * [Stanley Kubrick]"Good afternoon, gentlemen. I am a HAL 9000
17 * computer. I became operational at the H.A.L. plant in Urbana,
18 * Illinois on the 12th of January 1992. My instructor was
19 * Mr. Langley, and he taught me to sing a song. If you'd like to hear
20 * it I can sing it for you."
22 * The CSS, XHTML and design is released under GPL:
23 * http://www.opensource.org/licenses/gpl-license.php
25 * Default is a one-person (ADMIN_USER) blog (at the BlogHomePage), but
26 * other blogs are also enabled for every authenticated user.
28 * Actionbar: Edit, Home, About, Archives, News, ..., Info [ Search ]
29 * PageTrail: > .. > ..
30 * Right sidebar boxes: Archives, Syndication, Links, GoogleAds
32 * For the livesearch feature (autodropdown of the results while you tip)
33 * you'll have to copy livesearch.js from http://blog.bitflux.ch/wiki/LiveSearch
34 * to themes/default/, change the liveSearchReq.open line to:
35 liveSearchReq.open("GET", liveSearchURI + "?format=livesearch&paging=none&limit=25&s=" + document.forms.searchform.s.value);
36 * and define ENABLE_LIVESEARCH in config.ini to true.
38 * Better autodropdown's are in consideration:
39 * http://momche.net/publish/article.php?page=acdropdown)
44 require_once 'lib/WikiTheme.php';
46 class WikiTheme_blog extends WikiTheme {
48 function WikiTheme_blog ($theme_name='blog') {
49 $this->WikiTheme($theme_name);
50 $this->calendarInit(true);
53 /* overload to load from Sidebar */
54 function _findFile ($file, $missing_okay=false) {
55 if (file_exists($this->_path . "themes/".$this->_name."/$file"))
56 return "themes/".$this->_name."/$file";
57 if (file_exists($this->_path . "themes/Sidebar/$file"))
58 return "themes/Sidebar/$file";
59 return parent::_findFile($file, $missing_okay);
62 function _labelForAction ($action) {
64 case 'edit': return _("Edit");
65 case 'diff': return _("Diff");
66 case 'logout': return _("Sign Out");
67 case 'login': return _("Sign In");
68 case 'lock': return _("Lock");
69 case 'unlock': return _("Unlock");
70 case 'remove': return _("Remove");
72 return gettext(ucfirst($action));
76 function getRecentChangesFormatter ($format) {
77 include_once($this->file('lib/RecentChanges.php'));
78 if (preg_match('/^rss|^sidebar/', $format))
79 return false; // use default
81 return '_blog_RecentChanges_BoxFormatter';
82 return '_blog_RecentChanges_Formatter';
85 /* TODO: use the blog summary as label instead of the pagename */
86 function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
88 if ($version !== false and !$this->HTML_DUMP_SUFFIX)
89 $url = WikiURL($wikiword, array('version' => $version));
91 $url = WikiURL($wikiword);
93 // Extra steps for dumping page to an html file.
94 if ($this->HTML_DUMP_SUFFIX) {
95 $url = preg_replace('/^\./', '%2e', $url); // dot pages
98 $link = HTML::a(array('href' => $url));
100 if (isa($wikiword, 'WikiPageName'))
101 $default_text = $wikiword->shortName;
103 $default_text = $wikiword;
105 if (!empty($linktext)) {
106 $link->pushContent($linktext);
107 $link->setAttr('class', 'named-wiki');
108 $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
111 //TODO: check if wikiblog
112 $link->pushContent($this->maybeSplitWikiWord($default_text));
113 $link->setAttr('class', 'wiki');
119 // CSS file defines fonts, colors and background images for this
122 // override sidebar definitions:
123 $this->setDefaultCSS(_("blog"), 'Kubrick.css');
125 $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IEFixes.css'),'all'));
127 $this->addButtonAlias(_("(diff)"), "[diff]" );
128 $this->addButtonAlias("...", "alltime");
130 $this->setButtonSeparator("");
133 * WikiWords can automatically be split by inserting spaces between
134 * the words. The default is to leave WordsSmashedTogetherLikeSo.
136 $this->setAutosplitWikiWords(false);
139 * If true (default) show create '?' buttons on not existing pages, even if the
140 * user is not signed in.
141 * If false, anon users get no links and it looks cleaner, but then they
142 * cannot easily fix missing pages.
144 $this->setAnonEditUnknownLinks(false);
147 * You may adjust the formats used for formatting dates and times
148 * below. (These examples give the default formats.)
149 * Formats are given as format strings to PHP strftime() function See
150 * http://www.php.net/manual/en/function.strftime.php for details.
151 * Do not include the server's zone (%Z), times are converted to the
154 //$this->setDateFormat("%B %d, %Y");
155 $this->setDateFormat("%A, %B %e, %Y"); // must not contain time
156 $this->setTimeFormat("%H:%M:%S");
160 $WikiTheme = new WikiTheme_blog('blog');
161 define("PAGETRAIL_ARROW", " ยป ");
167 // c-hanging-comment-ender-p: nil
168 // indent-tabs-mode: nil