]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/blog/themeinfo.php
Remove $Id$
[SourceForge/phpwiki.git] / themes / blog / themeinfo.php
1 <?php
2 // Avoid direct call to this file.
3 // PHPWIKI_VERSION is defined in lib/prepend.php
4 if (!defined('PHPWIKI_VERSION')) {
5     header("Location: /");
6     exit;
7 }
8
9 /**
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/
15  *
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."
21  *
22  * The CSS, XHTML and design is released under GPL:
23  * http://www.opensource.org/licenses/gpl-license.php
24  *
25  * Default is a one-person (ADMIN_USER) blog (at the BlogHomePage), but
26  * other blogs are also enabled for every authenticated user.
27  *
28  * Actionbar: Edit, Home, About, Archives, News, ..., Info  [ Search ]
29  * PageTrail: > .. > ..
30  * Right sidebar boxes: Archives, Syndication, Links, GoogleAds
31  *
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.
37  *
38  * Better autodropdown's are in consideration:
39  *   http://momche.net/publish/article.php?page=acdropdown)
40  *
41  * Happy blogging.
42  */
43
44 require_once 'lib/WikiTheme.php';
45
46 class WikiTheme_blog extends WikiTheme {
47
48     function WikiTheme_blog ($theme_name='blog') {
49         $this->WikiTheme($theme_name);
50         $this->calendarInit(true);
51     }
52
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);
60     }
61
62     function _labelForAction ($action) {
63         switch ($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");
71             default:
72                 return gettext(ucfirst($action));
73         }
74     }
75
76     function getRecentChangesFormatter ($format) {
77         include_once($this->file('lib/RecentChanges.php'));
78         if (preg_match('/^rss|^sidebar/', $format))
79             return false;       // use default
80         if ($format == 'box')
81             return '_blog_RecentChanges_BoxFormatter';
82         return '_blog_RecentChanges_Formatter';
83     }
84
85     /* TODO: use the blog summary as label instead of the pagename */
86     function linkExistingWikiWord($wikiword, $linktext = '', $version = false) {
87         global $request;
88         if ($version !== false and !$this->HTML_DUMP_SUFFIX)
89             $url = WikiURL($wikiword, array('version' => $version));
90         else
91             $url = WikiURL($wikiword);
92
93         // Extra steps for dumping page to an html file.
94         if ($this->HTML_DUMP_SUFFIX) {
95             $url = preg_replace('/^\./', '%2e', $url); // dot pages
96         }
97
98         $link = HTML::a(array('href' => $url));
99
100         if (isa($wikiword, 'WikiPageName'))
101              $default_text = $wikiword->shortName;
102          else
103              $default_text = $wikiword;
104
105         if (!empty($linktext)) {
106             $link->pushContent($linktext);
107             $link->setAttr('class', 'named-wiki');
108             $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
109         }
110         else {
111             //TODO: check if wikiblog
112             $link->pushContent($this->maybeSplitWikiWord($default_text));
113             $link->setAttr('class', 'wiki');
114         }
115         return $link;
116     }
117
118     function load() {
119     // CSS file defines fonts, colors and background images for this
120     // style.
121
122     // override sidebar definitions:
123     $this->setDefaultCSS(_("blog"), 'Kubrick.css');
124     if (isBrowserIE()) {
125         $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IEFixes.css'),'all'));
126     }
127     $this->addButtonAlias(_("(diff)"), "[diff]" );
128     $this->addButtonAlias("...", "alltime");
129
130     $this->setButtonSeparator("");
131
132     /**
133      * WikiWords can automatically be split by inserting spaces between
134      * the words. The default is to leave WordsSmashedTogetherLikeSo.
135      */
136     $this->setAutosplitWikiWords(false);
137
138     /**
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.
143      */
144     $this->setAnonEditUnknownLinks(false);
145
146     /*
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
152      * user's time zone.
153      */
154     //$this->setDateFormat("%B %d, %Y");
155     $this->setDateFormat("%A, %B %e, %Y"); // must not contain time
156     $this->setTimeFormat("%H:%M:%S");
157     }
158 }
159
160 $WikiTheme = new WikiTheme_blog('blog');
161 define("PAGETRAIL_ARROW", " ยป ");
162
163 // Local Variables:
164 // mode: php
165 // tab-width: 8
166 // c-basic-offset: 4
167 // c-hanging-comment-ender-p: nil
168 // indent-tabs-mode: nil
169 // End: