add section link for talk pages
[lhc/web/wiklou.git] / includes / SkinPHPTal.php
1 <?php
2 # Generic PHPTal (http://phptal.sourceforge.net/) skin
3 # Based on Brion's smarty skin
4 # Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
5 #
6 # Todo: Needs some serious refactoring into functions that correspond
7 # to the computations individual esi snippets need. Most importantly no body
8 # parsing for most of those of course.
9 #
10 # Set this in LocalSettings to enable phptal:
11 # set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
12 # $wgUsePHPTal = true;
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write to the Free Software Foundation, Inc.,
26 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # http://www.gnu.org/copyleft/gpl.html
28
29 require_once "PHPTAL.php";
30
31 class MediaWiki_I18N extends PHPTAL_I18N
32 {
33 var $_context = array();
34
35 function set($varName, $value) {
36 $this->_context[$varName] = $value;
37 }
38
39 function translate($value) {
40 $value = wfMsg( $value );
41 // interpolate variables
42 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
43 list($src, $var) = $m;
44 $varValue = @$this->_context[$var];
45 $value = str_replace($src, $varValue, $value);
46 }
47 return $value;
48 }
49 }
50
51 class SkinPHPTal extends Skin {
52 var $template;
53
54 function initPage( &$out ) {
55 parent::initPage( $out );
56 $this->skinname = "davinci";
57 $this->template = "xhtml_slim";
58 }
59
60 function outputPage( &$out ) {
61 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
62 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
63 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
64 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
65
66 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
67
68 $this->initPage( $out );
69 $tpl = new PHPTAL($this->template . '.pt', 'templates');
70
71 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
72 $tpl->setTranslator(new MediaWiki_I18N());
73 #}
74
75 $this->thispage = $wgTitle->getPrefixedDbKey();
76 $this->thisurl = $wgTitle->getPrefixedURL();
77 $this->loggedin = $wgUser->getID() != 0;
78 $this->username = $wgUser->getName();
79 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
80 $this->userpageurl = $this->makeUrl($this->userpage);
81
82 if( $this->loggedin ) {
83 $this->usercss = $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css');
84 $this->usercsse = htmlspecialchars($this->usercss);
85 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
86 $this->userjse = htmlspecialchars($this->userjs);
87 } else {
88 $this->usercss = $this->usercsse = $this->userjs = $this->userjse = false;
89 }
90 $this->titletxt = $wgTitle->getPrefixedText();
91
92 $tpl->set( "title", $wgOut->getPageTitle() );
93 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
94
95 $tpl->setRef( "thispage", &$this->thispage );
96 $subpagestr = $this->subPageSubtitle();
97 $tpl->set(
98 "subtitle", !empty($subpagestr)?
99 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
100 $out->getSubtitle()
101 );
102 $tpl->set( 'catlinks', $this->getCategories());
103 if( $wgOut->isSyndicated() ) {
104 $feeds = array();
105 foreach( $wgFeedClasses as $format => $class ) {
106 $feeds[$format] = array(
107 'text' => $format,
108 'href' => $wgRequest->appendQuery( "feed=$format" ),
109 'ttip' => wfMsg('tooltip-'.$format)
110 );
111 }
112 $tpl->setRef( 'feeds', &$feeds );
113 }
114 $tpl->setRef( 'mimetype', &$wgMimeType );
115 $tpl->setRef( 'charset', &$wgOutputEncoding );
116 $tpl->set( 'headlinks', $out->getHeadLinks() );
117 $tpl->setRef( 'skinname', &$this->skinname );
118 $tpl->setRef( "loggedin", &$this->loggedin );
119 /* XXX currently unused, might get useful later
120 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
121 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
122 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
123 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
124 $tpl->set( "helppage", wfMsg('helppage'));
125 $tpl->set( "sysop", $wgUser->isSysop() );
126 */
127 $tpl->set( "searchaction", $this->escapeSearchLink() );
128 $tpl->setRef( "stylepath", &$wgStylePath );
129 $tpl->setRef( "logopath", &$wgLogo );
130 $tpl->setRef( "lang", &$wgLanguageCode );
131 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
132 $tpl->set( "rtl", $wgLang->isRTL() );
133 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
134 $tpl->setRef( "username", &$this->username );
135 $tpl->setRef( "userpage", &$this->userpage);
136 $tpl->setRef( "userpageurl", &$this->userpageurl);
137 $tpl->setRef( "usercss", &$this->usercss);
138 $tpl->setRef( "usercsse", &$this->usercsse);
139 $tpl->setRef( "userjs", &$this->userjs);
140 $tpl->setRef( "userjse", &$this->userjse);
141 if( $wgUser->getNewtalk() ) {
142 $usertitle = Title::newFromText( $this->userpage );
143 $usertalktitle = $usertitle->getTalkPage();
144 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
145
146 $ntl = wfMsg( "newmessages",
147 $this->makeKnownLink(
148 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
149 . ":" . $this->username,
150 wfMsg("newmessageslink") )
151 );
152 }
153 } else {
154 $ntl = "";
155 }
156
157 $tpl->setRef( "newtalk", &$ntl );
158 $tpl->setRef( "skin", &$this);
159 $tpl->set( "logo", $this->logoText() );
160 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
161 if ( !$wgDisableCounters ) {
162 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
163 if ( $viewcount ) {
164 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
165 }
166 }
167 $tpl->set('lastmod', $this->lastModified());
168 $tpl->set('copyright',$this->getCopyright());
169 }
170 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
171 $tpl->set( "poweredbyico", $this->getPoweredBy() );
172 $tpl->set( "disclaimer", $this->disclaimerLink() );
173 $tpl->set( "about", $this->aboutLink() );
174
175 $tpl->setRef( "debug", &$out->mDebugtext );
176 $tpl->set( "reporttime", $out->reportTime() );
177
178 $tpl->setRef( "bodytext", &$out->mBodytext );
179
180 $language_urls = array();
181 foreach( $wgOut->getLanguageLinks() as $l ) {
182 $nt = Title::newFromText( $l );
183 $language_urls[] = array('href' => $nt->getFullURL(),
184 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
185 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
186 }
187 if(count($language_urls)) {
188 $tpl->setRef( 'language_urls', &$language_urls);
189 } else {
190 $tpl->set('language_urls', false);
191 }
192 $tpl->set('personal_urls', $this->buildPersonalUrls());
193 $content_actions = $this->buildContentActionUrls();
194 $tpl->setRef('content_actions', &$content_actions);
195 // XXX: attach this from javascript, same with section editing
196 if(isset($content_actions['edit']['href']) &&
197 !(isset($content_actions['edit']['class']) && $content_actions['edit']['class'] != '') &&
198 $wgUser->getOption("editondblclick") )
199 {
200 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
201 } else {
202 $tpl->set('body-ondblclick', '');
203 }
204 $tpl->set( "nav_urls", $this->buildNavUrls() );
205
206 // execute template
207 $res = $tpl->execute();
208 // result may be an error
209 if (PEAR::isError($res)) {
210 echo $res->toString(), "\n";
211 } else {
212 echo $res;
213 }
214
215 }
216
217 # build array of urls for personal toolbar
218 function buildPersonalUrls() {
219 /* set up the default links for the personal toolbar */
220 global $wgShowIPinHeader;
221 $personal_urls = array();
222 if ($this->loggedin) {
223 $personal_urls['userpage'] = array(
224 'text' => $this->username,
225 'href' => &$this->userpageurl,
226 'ttip' => wfMsg('tooltip-userpage'),
227 'akey' => wfMsg('accesskey-userpage')
228 );
229 $personal_urls['mytalk'] = array(
230 'text' => wfMsg('mytalk'),
231 'href' => $this->makeTalkUrl($this->userpage),
232 'ttip' => wfMsg('tooltip-mytalk'),
233 'akey' => wfMsg('accesskey-mytalk')
234 );
235 $personal_urls['preferences'] = array(
236 'text' => wfMsg('preferences'),
237 'href' => $this->makeSpecialUrl('Preferences'),
238 'ttip' => wfMsg('tooltip-preferences'),
239 'akey' => wfMsg('accesskey-preferences')
240 );
241 $personal_urls['watchlist'] = array(
242 'text' => wfMsg('watchlist'),
243 'href' => $this->makeSpecialUrl('Watchlist'),
244 'ttip' => wfMsg('tooltip-watchlist'),
245 'akey' => wfMsg('accesskey-watchlist')
246 );
247 $personal_urls['mycontris'] = array(
248 'text' => wfMsg('mycontris'),
249 'href' => $this->makeSpecialUrl('Contributions','target=' . $this->username),
250 'ttip' => wfMsg('tooltip-mycontris'),
251 'akey' => wfMsg('accesskey-mycontris')
252 );
253 $personal_urls['logout'] = array(
254 'text' => wfMsg('userlogout'),
255 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl),
256 'ttip' => wfMsg('tooltip-logout'),
257 'akey' => wfMsg('accesskey-logout')
258 );
259 } else {
260 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
261 $personal_urls['anonuserpage'] = array(
262 'text' => $this->username,
263 'href' => $this->makeUrl($this->userpage),
264 'ttip' => wfMsg('tooltip-anonuserpage'),
265 'akey' => wfMsg('accesskey-anonuserpage')
266 );
267 $personal_urls['anontalk'] = array(
268 'text' => wfMsg('anontalk'),
269 'href' => $this->makeTalkUrl($this->userpage),
270 'ttip' => wfMsg('tooltip-anontalk'),
271 'akey' => wfMsg('accesskey-anontalk')
272 );
273 $personal_urls['anonlogin'] = array(
274 'text' => wfMsg('userlogin'),
275 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
276 'ttip' => wfMsg('tooltip-login'),
277 'akey' => wfMsg('accesskey-login')
278 );
279 } else {
280
281 $personal_urls['login'] = array(
282 'text' => wfMsg('userlogin'),
283 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
284 'ttip' => wfMsg('tooltip-login'),
285 'akey' => wfMsg('accesskey-login')
286 );
287 }
288 }
289
290 return $personal_urls;
291 }
292
293 # an array of edit links by default used for the tabs
294 function buildContentActionUrls () {
295 global $wgTitle, $wgUser, $wgRequest;
296 $action = $wgRequest->getText( 'action' );
297 $section = $wgRequest->getText( 'section' );
298 $oldid = $wgRequest->getVal( 'oldid' );
299 $diff = $wgRequest->getVal( 'diff' );
300 $content_actions = array();
301
302 $iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
303 if( $iscontent) {
304
305 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : '',
306 'text' => wfMsg('article'),
307 'href' => $this->makeArticleUrl($this->thispage),
308 'ttip' => wfMsg('tooltip-article'),
309 'akey' => wfMsg('accesskey-article'));
310
311 /* set up the classes for the talk link */
312 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : '');
313 $talktitle = Title::newFromText( $this->titletxt );
314 $talktitle = $talktitle->getTalkPage();
315 $this->checkTitle(&$talktitle, &$this->titletxt);
316 if($talktitle->getArticleId() != 0) {
317 $content_actions['talk'] = array(
318 'class' => $talk_class,
319 'text' => wfMsg('talk'),
320 'href' => $this->makeTalkUrl($this->titletxt),
321 'ttip' => wfMsg('tooltip-talk'),
322 'akey' => wfMsg('accesskey-talk')
323 );
324 } else {
325 $content_actions['talk'] = array(
326 'class' => $talk_class?$talk_class.' new':'new',
327 'text' => wfMsg('talk'),
328 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
329 'ttip' => wfMsg('tooltip-talk'),
330 'akey' => wfMsg('accesskey-talk')
331 );
332 }
333
334 if ( $wgTitle->userCanEdit() ) {
335 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
336 $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
337 $istalkclass = $istalk?' istalk':'';
338 $content_actions['edit'] = array(
339 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
340 'text' => wfMsg('edit'),
341 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
342 'ttip' => wfMsg('tooltip-edit'),
343 'akey' => wfMsg('accesskey-edit')
344 );
345 if ( $istalk ) {
346 $content_actions['addsection'] = array(
347 'class' => $section == 'new'?'selected':'',
348 'text' => wfMsg('addsection'),
349 'href' => $this->makeUrl($this->thispage, 'action=edit&section=new'),
350 'ttip' => wfMsg('tooltip-addsection'),
351 'akey' => wfMsg('accesskey-addsection')
352 );
353 }
354 } else {
355 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
356 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : '',
357 'text' => wfMsg('viewsource'),
358 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
359 'ttip' => wfMsg('tooltip-viewsource'),
360 'akey' => wfMsg('accesskey-viewsource'));
361 }
362
363 if ( $wgTitle->getArticleId() ) {
364
365 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : '',
366 'text' => wfMsg('history_short'),
367 'href' => $this->makeUrl($this->thispage, 'action=history'),
368 'ttip' => wfMsg('tooltip-history'),
369 'akey' => wfMsg('accesskey-history'));
370
371 # XXX: is there a rollback action anywhere or is it planned?
372 # Don't recall where i got this from...
373 /*if( $wgUser->getNewtalk() ) {
374 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : '',
375 'text' => wfMsg('rollback_short'),
376 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
377 'ttip' => wfMsg('tooltip-rollback'),
378 'akey' => wfMsg('accesskey-rollback'));
379 }*/
380
381 if($wgUser->isSysop()){
382 if(!$wgTitle->isProtected()){
383 $content_actions['protect'] = array(
384 'class' => ($action == 'protect') ? 'selected' : '',
385 'text' => wfMsg('protect'),
386 'href' => $this->makeUrl($this->thispage, 'action=protect'),
387 'ttip' => wfMsg('tooltip-protect'),
388 'akey' => wfMsg('accesskey-protect')
389 );
390
391 } else {
392 $content_actions['unprotect'] = array(
393 'class' => ($action == 'unprotect') ? 'selected' : '',
394 'text' => wfMsg('unprotect'),
395 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
396 'ttip' => wfMsg('tooltip-protect'),
397 'akey' => wfMsg('accesskey-protect')
398 );
399 }
400 $content_actions['delete'] = array(
401 'class' => ($action == 'delete') ? 'selected' : '',
402 'text' => wfMsg('delete'),
403 'href' => $this->makeUrl($this->thispage, 'action=delete'),
404 'ttip' => wfMsg('tooltip-delete'),
405 'akey' => wfMsg('accesskey-delete')
406 );
407 }
408 if ( $wgUser->getID() != 0 ) {
409 if ( $wgTitle->userCanEdit()) {
410 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : '',
411 'text' => wfMsg('move'),
412 'href' => $this->makeSpecialUrl('Movepage', 'target='.$this->thispage),
413 'ttip' => wfMsg('tooltip-move'),
414 'akey' => wfMsg('accesskey-move'));
415 } else {
416 $content_actions['move'] = array('class' => 'inactive',
417 'text' => wfMsg('move'),
418 'href' => false,
419 'ttip' => wfMsg('tooltip-nomove'),
420 'akey' => false);
421
422 }
423 }
424 } else {
425 //article doesn't exist or is deleted
426 if($wgUser->isSysop()){
427 if( $n = $wgTitle->isDeleted() ) {
428 $content_actions['delete'] = array(
429 'class' => '',
430 'text' => wfMsg( "undelete_short", $n ),
431 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
432 'ttip' => wfMsg('tooltip-undelete', $n),
433 'akey' => wfMsg('accesskey-undelete')
434 );
435 }
436 }
437 }
438
439 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
440 if( !$wgTitle->userIsWatching()) {
441 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : '',
442 'text' => wfMsg('watch'),
443 'href' => $this->makeUrl($this->thispage, 'action=watch'),
444 'ttip' => wfMsg('tooltip-watch'),
445 'akey' => wfMsg('accesskey-watch'));
446 } else {
447 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : '',
448 'text' => wfMsg('unwatch'),
449 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
450 'ttip' => wfMsg('tooltip-unwatch'),
451 'akey' => wfMsg('accesskey-unwatch'));
452
453 }
454 }
455 } else {
456 /* show special page tab */
457
458 $content_actions['article'] = array('class' => 'selected',
459 'text' => wfMsg('specialpage'),
460 'href' => false,
461 'ttip' => wfMsg('tooltip-specialpage'),
462 'akey' => false);
463 }
464
465 return $content_actions;
466 }
467
468 # build array of common navigation links
469 function buildNavUrls () {
470 global $wgTitle, $wgUser, $wgRequest;
471 global $wgSiteSupportPage;
472
473 $action = $wgRequest->getText( 'action' );
474 $oldid = $wgRequest->getVal( 'oldid' );
475 $diff = $wgRequest->getVal( 'diff' );
476 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
477 $nav_urls = array();
478 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
479 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
480 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
481 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.$this->thispage)));
482 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : '';
483 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : '';
484 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.$this->thispage)));
485 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
486 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
487 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
488 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
489 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
490 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
491
492
493 $id=User::idFromName($wgTitle->getText());
494 $ip=User::isIP($wgTitle->getText());
495
496 if($id || $ip) { # both anons and non-anons have contri list
497 $nav_urls['contributions'] = array(
498 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
499 );
500 }
501 if ( 0 != $wgUser->getID() ) { # show only to signed in users
502 if($id) { # can only email non-anons
503 $nav_urls['emailuser'] = array(
504 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
505 );
506 }
507 }
508
509
510 return $nav_urls;
511 }
512
513 /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
514 $title = Title::makeTitle( NS_SPECIAL, $name );
515 $this->checkTitle(&$title, &$name);
516 return $title->getLocalURL( $urlaction );
517 }
518 /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
519 $title = Title::newFromText( $name );
520 $title = $title->getTalkPage();
521 $this->checkTitle(&$title, &$name);
522 return $title->getLocalURL( $urlaction );
523 }
524 /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
525 $title = Title::newFromText( $name );
526 $title= $title->getSubjectPage();
527 $this->checkTitle(&$title, &$name);
528 return $title->getLocalURL( $urlaction );
529 }
530 /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
531 $title = Title::newFromText( wfMsg($name) );
532 $this->checkTitle(&$title, &$name);
533 return $title->getLocalURL( $urlaction );
534 }
535 /*static*/ function makeUrl ( $name, $urlaction='' ) {
536 $title = Title::newFromText( $name );
537 $this->checkTitle(&$title, &$name);
538 return $title->getLocalURL( $urlaction );
539 }
540
541 # make sure we have some title to operate on, mind the '&'
542 /*static*/ function checkTitle ( &$title, &$name ) {
543 if(!is_object($title)) {
544 $title = Title::newFromText( $name );
545 if(!is_object($title)) {
546 $title = Title::newFromText( '<error: link target missing>' );
547 }
548 }
549 }
550
551
552 }
553
554 class SkinDaVinci extends SkinPHPTal {
555 function initPage( &$out ) {
556 SkinPHPTal::initPage( $out );
557 $this->skinname = "davinci";
558 }
559 }
560
561 class SkinMono extends SkinPHPTal {
562 function initPage( &$out ) {
563 SkinPHPTal::initPage( $out );
564 $this->skinname = "mono";
565 }
566 }
567
568 class SkinMonoBook extends SkinPHPTal {
569 function initPage( &$out ) {
570 SkinPHPTal::initPage( $out );
571 $this->skinname = "monobook";
572 }
573 }
574
575 ?>