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