]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/blog/themeinfo.php
Reformat code
[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
49     function WikiTheme_blog($theme_name = 'blog')
50     {
51         $this->WikiTheme($theme_name);
52         $this->calendarInit(true);
53     }
54
55     /* overload to load from Sidebar */
56     function _findFile($file, $missing_okay = false)
57     {
58         if (file_exists($this->_path . "themes/" . $this->_name . "/$file"))
59             return "themes/" . $this->_name . "/$file";
60         if (file_exists($this->_path . "themes/Sidebar/$file"))
61             return "themes/Sidebar/$file";
62         return parent::_findFile($file, $missing_okay);
63     }
64
65     function _labelForAction($action)
66     {
67         switch ($action) {
68             case 'edit':
69                 return _("Edit");
70             case 'diff':
71                 return _("Diff");
72             case 'logout':
73                 return _("Sign Out");
74             case 'login':
75                 return _("Sign In");
76             case 'lock':
77                 return _("Lock");
78             case 'unlock':
79                 return _("Unlock");
80             case 'remove':
81                 return _("Remove");
82             default:
83                 return gettext(ucfirst($action));
84         }
85     }
86
87     function getRecentChangesFormatter($format)
88     {
89         include_once($this->file('lib/RecentChanges.php'));
90         if (preg_match('/^rss|^sidebar/', $format))
91             return false; // use default
92         if ($format == 'box')
93             return '_blog_RecentChanges_BoxFormatter';
94         return '_blog_RecentChanges_Formatter';
95     }
96
97     /* TODO: use the blog summary as label instead of the pagename */
98     function linkExistingWikiWord($wikiword, $linktext = '', $version = false)
99     {
100         global $request;
101         if ($version !== false and !$this->HTML_DUMP_SUFFIX)
102             $url = WikiURL($wikiword, array('version' => $version));
103         else
104             $url = WikiURL($wikiword);
105
106         // Extra steps for dumping page to an html file.
107         if ($this->HTML_DUMP_SUFFIX) {
108             $url = preg_replace('/^\./', '%2e', $url); // dot pages
109         }
110
111         $link = HTML::a(array('href' => $url));
112
113         if (isa($wikiword, 'WikiPageName'))
114             $default_text = $wikiword->shortName;
115         else
116             $default_text = $wikiword;
117
118         if (!empty($linktext)) {
119             $link->pushContent($linktext);
120             $link->setAttr('class', 'named-wiki');
121             $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
122         } else {
123             //TODO: check if wikiblog
124             $link->pushContent($this->maybeSplitWikiWord($default_text));
125             $link->setAttr('class', 'wiki');
126         }
127         return $link;
128     }
129
130     function load()
131     {
132         // CSS file defines fonts, colors and background images for this
133         // style.
134
135         // override sidebar definitions:
136         $this->setDefaultCSS(_("blog"), 'Kubrick.css');
137         if (isBrowserIE()) {
138             $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IEFixes.css'), 'all'));
139         }
140         $this->addButtonAlias(_("(diff)"), "[diff]");
141         $this->addButtonAlias("...", "alltime");
142
143         $this->setButtonSeparator("");
144
145         /**
146          * WikiWords can automatically be split by inserting spaces between
147          * the words. The default is to leave WordsSmashedTogetherLikeSo.
148          */
149         $this->setAutosplitWikiWords(false);
150
151         /**
152          * If true (default) show create '?' buttons on not existing pages, even if the
153          * user is not signed in.
154          * If false, anon users get no links and it looks cleaner, but then they
155          * cannot easily fix missing pages.
156          */
157         $this->setAnonEditUnknownLinks(false);
158
159         /*
160          * You may adjust the formats used for formatting dates and times
161          * below.  (These examples give the default formats.)
162          * Formats are given as format strings to PHP strftime() function See
163          * http://www.php.net/manual/en/function.strftime.php for details.
164          * Do not include the server's zone (%Z), times are converted to the
165          * user's time zone.
166          */
167         //$this->setDateFormat("%B %d, %Y");
168         $this->setDateFormat("%A, %B %e, %Y"); // must not contain time
169         $this->setTimeFormat("%H:%M:%S");
170     }
171 }
172
173 $WikiTheme = new WikiTheme_blog('blog');
174 define("PAGETRAIL_ARROW", " ยป ");
175
176 // Local Variables:
177 // mode: php
178 // tab-width: 8
179 // c-basic-offset: 4
180 // c-hanging-comment-ender-p: nil
181 // indent-tabs-mode: nil
182 // End: