X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSkin.php;h=2720affbeede48e54faa081640c0165064fac56b;hb=8f22cb45b1ccd2d18bb4ef1247a18efbb9a87e2d;hp=0b677fa6dab2c27b7d866f6d282421fda942a5d2;hpb=dc8ac4172432261faae9bb157583ddccff0c42fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 0b677fa6da..2720affbee 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1,6 +1,7 @@ "Standard", + 'nostalgia' => "Nostalgia", + 'cologneblue' => "CologneBlue" ); -if( $wgUseSmarty ) { - $wgValidSkinNames[] = "Smarty"; - $wgValidSkinNames[] = "Montparnasse"; +if( $wgUsePHPTal ) { + #$wgValidSkinNames[] = "PHPTal"; + #$wgValidSkinNames['davinci'] = "DaVinci"; + #$wgValidSkinNames['mono'] = "Mono"; + $wgValidSkinNames['monobook'] = "MonoBook"; + #$wgValidSkinNames['monobookminimal'] = "MonoBookMinimal"; } -include_once( "RecentChange.php" ); - -# For some odd PHP bug, this function can't be part of a class -function getCategories () -{ - global $wgOut , $wgTitle , $wgUseCategoryMagic , $wgUser , $wgParser ; - if ( !isset ( $wgUseCategoryMagic ) || !$wgUseCategoryMagic ) return "" ; - if ( count ( $wgParser->mCategoryLinks ) == 0 ) return "" ; - if ( !$wgOut->isArticle() ) return "" ; - $sk = $wgUser->getSkin() ; - $s = "" ; - $s .= "\n
\n"; - $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ; - $t = implode ( " | " , $wgParser->mCategoryLinks ) ; - if ( $t != "" ) $s .= " : " ; - $s .= $t ; - return $s ; -} +require_once( "RecentChange.php" ); class RCCacheEntry extends RecentChange { @@ -86,15 +75,52 @@ class Skin { function initPage( &$out ) { - global $wgStyleSheetPath; $fname = "Skin::initPage"; wfProfileIn( $fname ); - $out->addLink( "shortcut icon", "", "/favicon.ico" ); + $out->addLink( array( "rel" => "shortcut icon", "href" => "/favicon.ico" ) ); + $this->addMetadataLinks($out); + wfProfileOut( $fname ); } + function addMetadataLinks( &$out ) { + global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf, $wgRdfMimeType, $action; + global $wgRightsPage, $wgRightsUrl; + + if( $out->isArticleRelated() ) { + # note: buggy CC software only reads first "meta" link + if( $wgEnableCreativeCommonsRdf ) { + $out->addMetadataLink( array( + 'title' => 'Creative Commons', + 'type' => 'application/rdf+xml', + 'href' => $wgTitle->getLocalURL( "action=creativecommons") ) ); + } + if( $wgEnableDublinCoreRdf ) { + $out->addMetadataLink( array( + 'title' => 'Dublin Core', + 'type' => 'application/rdf+xml', + 'href' => $wgTitle->getLocalURL( "action=dublincore" ) ) ); + } + } + $copyright = ""; + if( $wgRightsPage ) { + $copy = Title::newFromText( $wgRightsPage ); + if( $copy ) { + $copyright = $copy->getLocalURL(); + } + } + if( !$copyright && $wgRightsUrl ) { + $copyright = $wgRightsUrl; + } + if( $copyright ) { + $out->addLink( array( + "rel" => "copyright", + "href" => $copyright ) ); + } + } + function outputPage( &$out ) { global $wgDebugComments; @@ -114,7 +140,7 @@ class Skin { } $out->out( $this->beforeContent() ); - $out->out( $out->mBodytext ); + $out->out( $out->mBodytext . "\n" ); $out->out( $this->afterContent() ); @@ -125,25 +151,21 @@ class Skin { } function getHeadScripts() { - global $wgStyleSheetPath; - $r = "\n"; + global $wgStylePath; + $r = "\n"; return $r; } function getUserStyles() { - global $wgOut, $wgStyleSheetPath; - if( $wgOut->isPrintable() ) { - $sheet = "wikiprintable.css"; - } else { - $sheet = $this->getStylesheet(); - } - $s = "\n"; + $s .= "\n"; return $s; } @@ -157,7 +179,7 @@ class Skin { } else { # CHECK MERGE @@@ # Force no underline - $s .= "a.stub, a.new, a.internal, a.external { " . + $s .= "a { " . "text-decoration: none; }\n"; } if ( 1 == $wgUser->getOption( "highlightbroken" ) ) { @@ -171,21 +193,22 @@ class Skin { function getBodyOptions() { - global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $oldid, $redirect, $diff,$action; + global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest; + + extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) ); if ( 0 != $wgTitle->getNamespace() ) { $a = array( "bgcolor" => "#ffffec" ); } else $a = array( "bgcolor" => "#FFFFFF" ); - if($wgOut->isArticle() && $wgUser->getOption("editondblclick") - && - (!$wgTitle->isProtected() || $wgUser->isSysop()) - - ) { + if($wgOut->isArticle() && $wgUser->getOption("editondblclick") && + (!$wgTitle->isProtected() || $wgUser->isSysop()) ) { $t = wfMsg( "editthispage" ); $oid = $red = ""; - if ( $redirect ) { $red = "&redirect={$redirect}"; } - if ( $oldid && ! isset( $diff ) ) { + if ( !empty($redirect) ) { + $red = "&redirect={$redirect}"; + } + if ( !empty($oldid) && ! isset( $diff ) ) { $oid = "&oldid={$oldid}"; } $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" ); @@ -206,8 +229,7 @@ class Skin { $link = str_replace( "_", " ", $link ); $link = wfEscapeHTML( $link ); - if ( $wgOut->isPrintable() ) { $r = " class='printable'"; } - else { $r = " class='external'"; } + $r = " class='external'"; if ( 1 == $wgUser->getOption( "hover" ) ) { $r .= " title=\"{$link}\""; @@ -223,14 +245,12 @@ class Skin { $link = str_replace( "_", " ", $link ); $link = wfEscapeHTML( $link ); - if ( $wgOut->isPrintable() ) { - $r = " class='printable'"; - } else if ( $broken == "stub" ) { + if ( $broken == "stub" ) { $r = " class='stub'"; } else if ( $broken == "yes" ) { $r = " class='new'"; } else { - $r = " class='internal'"; + $r = ""; } if ( 1 == $wgUser->getOption( "hover" ) ) { @@ -243,14 +263,12 @@ class Skin { { global $wgUser, $wgOut; - if ( $wgOut->isPrintable() ) { - $r = " class='printable'"; - } else if ( $broken == "stub" ) { + if ( $broken == "stub" ) { $r = " class='stub'"; } else if ( $broken == "yes" ) { $r = " class='new'"; } else { - $r = " class='internal'"; + $r = ""; } if ( 1 == $wgUser->getOption( "hover" ) ) { @@ -272,11 +290,6 @@ class Skin { { global $wgUser, $wgOut, $wgSiteNotice; - if ( $wgOut->isPrintable() ) { - $s = $this->pageTitle() . $this->pageSubtitle() . "\n"; - $s .= "\n
"; - return $s; - } if( $wgSiteNotice ) { $note = "\n
$wgSiteNotice
\n"; } else { @@ -303,47 +316,60 @@ class Skin { $borderhack = "class='top'"; } - $s .= "\n
\n
" . - ""; + $s .= "\n
\n
\n" . + "
\n\n"; $shove = ($qb != 0); $left = ($qb == 1 || $qb == 3); if($wgLang->isRTL()) $left = !$left; if ( !$shove ) { - $s .= ""; } elseif( $left ) { $s .= $this->getQuickbarCompensator( $rows ); } $l = $wgLang->isRTL() ? "right" : "left"; - $s .= "\n\n"; + $s .= "\n
" . $this->searchForm() . ""; if ( $langlinks ) { - $s .= "\n"; + $s .= "\n\n\n"; } if ( $shove && !$left ) { # Right $s .= $this->getQuickbarCompensator( $rows ); } - $s .= "
" . + $s .= "\n" . $this->logoText() . ""; + $s .= "\n"; $s .= $this->topLinks() ; - $s .= "

" . $this->pageTitleLinks(); + $s .= "

" . $this->pageTitleLinks() . "

\n"; $r = $wgLang->isRTL() ? "left" : "right"; - $s .= "
"; + $s .= ""; $s .= $this->nameAndLogin(); - $s .= "\n
" . $this->searchForm() . "
$langlinks
$langlinks
\n
\n"; - $s .= "\n
"; + $s .= "\n\n
\n"; + $s .= "\n
\n"; $s .= $this->pageTitle(); $s .= $this->pageSubtitle() ; - $s .= getCategories(); // For some odd reason, zhis can't be a function of the object - $s .= "\n

"; + $s .= $this->getCategories(); wfProfileOut( $fname ); return $s; } + + function getCategories () { + global $wgOut, $wgTitle, $wgUser, $wgParser; + global $wgUseCategoryMagic; + if( !$wgUseCategoryMagic ) return "" ; + if( count( $wgOut->mCategoryLinks ) == 0 ) return ""; + if( !$wgOut->isArticle() ) return ""; + + $t = implode ( " | " , $wgOut->mCategoryLinks ) ; + $s = $this->makeKnownLink( "Special:Categories", + wfMsg( "categories" ), "article=" . urlencode( $wgTitle->getPrefixedDBkey() ) ) + . ": " . $t; + return "

"; + } function getQuickbarCompensator( $rows = 1 ) { @@ -357,24 +383,17 @@ class Skin { global $wgUser, $wgOut, $wgServer; global $wgTitle, $wgLang; - if ( $wgOut->isPrintable() ) { - $s = "\n
\n"; - - $u = htmlspecialchars( $wgServer . $wgTitle->getFullURL() ); - $u = "$u"; - $rf = wfMsg( "retrievedfrom", $u ); - - if ( $wgOut->isArticle() ) { - $lm = "
" . $this->lastModified(); - } else { $lm = ""; } - - $cr = wfMsg( "gnunote" ); - $s .= "

" . $wgLang->emphasize("{$rf}{$lm} {$cr}\n"); - return $s; - } - return $this->doAfterContent(); + $printfooter = "

\n" . $this->printFooter() . "
\n"; + return $printfooter . $this->doAfterContent(); } - + + function printFooter() { + global $wgTitle; + $url = htmlspecialchars( $wgTitle->getFullURL() ); + return "

" . wfMsg( "retrievedfrom", "$url" ) . + "

\n\n

" . $this->pageStats() . "

\n"; + } + function doAfterContent() { global $wgUser, $wgOut, $wgLang; @@ -382,9 +401,9 @@ class Skin { wfProfileIn( $fname ); wfProfileIn( "$fname-1" ); - $s = "\n

\n"; + $s = "\n

\n"; $s .= "\n\");\n"; + + $toolbar.="/*]]>*/\n"; return $toolbar; } } -include_once( "SkinStandard.php" ); -include_once( "SkinNostalgia.php" ); -include_once( "SkinCologneBlue.php" ); +require_once( "SkinStandard.php" ); +require_once( "SkinNostalgia.php" ); +require_once( "SkinCologneBlue.php" ); -if( $wgUseSmarty ) { - include_once( "SkinSmarty.php" ); +if( $wgUsePHPTal ) { + require_once( "SkinPHPTal.php" ); } + ?>