]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MacOSX/themeinfo.php
Reformat code
[SourceForge/phpwiki.git] / themes / MacOSX / 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  * A PhpWiki theme inspired by the Aqua appearance of Mac OS X.
11  *
12  * The images used with this theme depend on the PNG alpha channel to
13  * blend in with whatever background color or texture is on the page.
14  * When viewed with an older browser, the images may be incorrectly
15  * rendered with a thick solid black border. When viewed with a modern
16  * browser, the images will display with nice edges and blended
17  * shadows.
18  *
19  * The defaut link icons I want to move into this theme, and come up
20  * with some new linkicons for the default look. (Any ideas,
21  * feedback?)
22  *
23  * Do you like the icons used in the buttons?
24  *
25  * See buttons/README for more info on the buttons.
26  *
27  * The background image is a subtle brushed paper texture or stucco
28  * effect very close to white. If your monitor isn't calibrated well
29  * you may not see it.
30  * */
31
32 require_once 'lib/WikiTheme.php';
33
34 class WikiTheme_MacOSX extends WikiTheme
35 {
36     function getCSS()
37     {
38         // FIXME: this is a hack which will not be needed once
39         //        we have dynamic CSS.
40         $css = WikiTheme::getCSS();
41         $css->pushcontent(HTML::style(array('type' => 'text/css'),
42             new RawXml(sprintf("<!--\nbody {background-image: url(%s);}\n-->\n",
43                 $this->getImageURL('bgpaper8')))));
44         //for non-browse pages, like former editpage, message etc.
45         //$this->getImageURL('bggranular')));
46         return $css;
47     }
48
49     function getRecentChangesFormatter($format)
50     {
51         include_once($this->file('lib/RecentChanges.php'));
52         if (preg_match('/^rss|^sidebar/', $format))
53             return false; // use default
54         return '_MacOSX_RecentChanges_Formatter';
55     }
56
57     function getPageHistoryFormatter($format)
58     {
59         include_once($this->file('lib/RecentChanges.php'));
60         if (preg_match('/^rss|^sidebar/', $format))
61             return false; // use default
62         return '_MacOSX_PageHistory_Formatter';
63     }
64
65     function linkUnknownWikiWord($wikiword, $linktext = '')
66     {
67         global $request;
68
69         // Get rid of anchors on unknown wikiwords
70         if (isa($wikiword, 'WikiPageName')) {
71             $default_text = $wikiword->shortName;
72             $wikiword = $wikiword->name;
73         } else {
74             $default_text = $wikiword;
75         }
76
77         $url = WikiURL($wikiword, array('action' => 'create'));
78         //$link = HTML::span(HTML::a(array('href' => $url), '?'));
79         $button = $this->makeButton('?', $url);
80         $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
81         $link = HTML::span($button);
82
83
84         if (!empty($linktext)) {
85             $link->unshiftContent(HTML::u($linktext));
86             $link->setAttr('class', 'named-wikiunknown');
87         } else {
88             $link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
89             $link->setAttr('class', 'wikiunknown');
90         }
91
92         return $link;
93     }
94
95     function load()
96     {
97         // CSS file defines fonts, colors and background images for this
98         // style.  The companion '*-heavy.css' file isn't defined, it's just
99         // expected to be in the same directory that the base style is in.
100
101         // This should result in phpwiki-printer.css being used when
102         // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
103         $this->setDefaultCSS('MacOSX', array('' => 'MacOSX.css', 'print' => 'phpwiki-printer.css'));
104
105         // This allows one to manually select "Printer" style (when browsing page)
106         // to see what the printer style looks like.
107         $this->addAlternateCSS(_("Printer"), 'phpwiki-printer.css', 'print, screen');
108         $this->addAlternateCSS(_("Top & bottom toolbars"), 'MacOSX-topbottombars.css');
109
110         /**
111          * The logo image appears on every page and links to the HomePage.
112          */
113         $this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
114
115         /**
116          * The Signature image is shown after saving an edited page. If this
117          * is set to false then the "Thank you for editing..." screen will
118          * be omitted.
119          */
120         $this->addImageAlias('signature', WIKI_NAME . "Signature.png");
121         // Uncomment this next line to disable the signature.
122         //$this->addImageAlias('signature', false);
123
124         /*
125          * Link icons.
126          */
127         $this->setLinkIcon('http');
128         $this->setLinkIcon('https');
129         $this->setLinkIcon('ftp');
130         $this->setLinkIcon('mailto');
131         $this->setLinkIcon('interwiki');
132         $this->setLinkIcon('wikiuser');
133         $this->setLinkIcon('*', 'url');
134
135         $this->setButtonSeparator(""); //use no separator instead of default
136
137         $this->addButtonAlias('?', 'uww');
138         $this->addButtonAlias(_("Lock Page"), "Lock Page");
139         $this->addButtonAlias(_("Unlock Page"), "Unlock Page");
140         $this->addButtonAlias(_("Page Locked"), "Page Locked");
141         $this->addButtonAlias("...", "alltime");
142
143         /**
144          * WikiWords can automatically be split by inserting spaces between
145          * the words. The default is to leave WordsSmashedTogetherLikeSo.
146          */
147         //$this->setAutosplitWikiWords(false);
148
149         /*
150          * You may adjust the formats used for formatting dates and times
151          * below.  (These examples give the default formats.)
152          * Formats are given as format strings to PHP strftime() function See
153          * http://www.php.net/manual/en/function.strftime.php for details.
154          * Do not include the server's zone (%Z), times are converted to the
155          * user's time zone.
156          */
157         $this->setDateFormat("%A, %B %d, %Y"); // must not contain time
158         $this->setTimeFormat("%I:%M:%S %p");
159     }
160 }
161
162 $WikiTheme = new WikiTheme_MacOSX('MacOSX');
163
164 // Local Variables:
165 // mode: php
166 // tab-width: 8
167 // c-basic-offset: 4
168 // c-hanging-comment-ender-p: nil
169 // indent-tabs-mode: nil
170 // End: