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