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 ( $wgOut->mCategoryLinks ) == 0 ) return "" ;
- if ( !$wgOut->isArticle() ) return "" ;
- $sk = $wgUser->getSkin() ;
- $s = "" ;
- $s .= $sk->makeKnownLink ( "Special:Categories" , "Categories" , "article=".$wgTitle->getDBkey() ) ;
- $t = implode ( " | " , $wgOut->mCategoryLinks ) ;
- if ( $t != "" ) $s .= ": " ;
- $s .= $t ;
- return "<p class='catlinks'>$s</p>";
-}
-
class RCCacheEntry extends RecentChange
{
var $secureName, $link;
$s .= $this->pageTitle();
$s .= $this->pageSubtitle() ;
- $s .= getCategories(); // For some odd reason, zhis can't be a function of the object
+ $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 "<p class='catlinks'>$s</p>";
+ }
function getQuickbarCompensator( $rows = 1 )
{
$action = $wgRequest->getText( 'action' );
$s = $this->printableLink();
- if ( wfMsg ( "disclaimers" ) != "" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
+ if ( wfMsg ( "disclaimers" ) != "-" ) $s .= " | " . $this->makeKnownLink( wfMsg( "disclaimerpage" ), wfMsg( "disclaimers" ) ) ;
if ( $wgOut->isArticleRelated() ) {
if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
function pageSubtitle()
{
- global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
+ global $wgOut;
$sub = $wgOut->getSubtitle();
if ( "" == $sub ) {
global $wgExtraSubtitle;
$sub = wfMsg( "fromwikipedia" ) . $wgExtraSubtitle;
}
+ $subpages = $this->subPageSubtitle();
+ $sub .= !empty($subpages)?"</p><p class='subpages'>$subpages":'';
+ $s = "<p class='subtitle'>{$sub}</p>\n";
+ return $s;
+ }
+
+ function subPageSubtitle()
+ {
+ global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
+ $subpages = '';
if($wgOut->isArticle() && !empty($wgNamespacesWithSubpages[$wgTitle->getNamespace()])) {
$ptext=$wgTitle->getPrefixedText();
if(preg_match("/\//",$ptext)) {
- $sub.="</p><p class='subpages'>";
$links=explode("/",$ptext);
$c=0;
$growinglink="";
$getlink = $this->makeLink( $growinglink, $link );
if(preg_match("/class='new'/i",$getlink)) { break; } # this is a hack, but it saves time
if ($c>1) {
- $sub .= " | ";
+ $subpages .= " | ";
} else {
- $sub .="< ";
+ $subpages .="< ";
}
- $sub .= $getlink;
+ $subpages .= $getlink;
$growinglink.="/";
}
-
}
}
}
- $s = "<p class='subtitle'>{$sub}</p>\n";
- return $s;
+ return $subpages;
}
function nameAndLogin()
function pageStats()
{
global $wgOut, $wgLang, $wgArticle, $wgRequest;
- global $wgDisableCounters, $wgMaxCredits;
-
+ global $wgDisableCounters;
+
extract( $wgRequest->getValues( 'oldid', 'diff' ) );
if ( ! $wgOut->isArticle() ) { return ""; }
if ( isset( $oldid ) || isset( $diff ) ) { return ""; }
$s = wfMsg( "viewcount", $count );
}
}
- if (!isset($wgMaxCredits) || $wgMaxCredits <= 0) {
- $s .= $this->lastModified();
- } else {
- $s .= " " . $this->getCredits();
- }
+
+ $s .= " " . $this->getCredits();
return $s . " " . $this->getCopyright();
}
function getCredits() {
- $s = $this->getAuthorCredits();
- $s .= "<br />\n " . $this->getContributorCredits();
- return $s;
+ global $wgMaxCredits;
+
+ $s = '';
+
+ if (!isset($wgMaxCredits) || $wgMaxCredits == 0) {
+ $s = $this->lastModified();
+ } else {
+ $s = $this->getAuthorCredits();
+ if ($wgMaxCredits > 1) {
+ $s .= " " . $this->getContributorCredits();
+ }
+ }
+
+ return $s;
}
function getAuthorCredits() {
function getContributorCredits() {
global $wgArticle, $wgMaxCredits, $wgLang;
-
- $contributors = $wgArticle->getContributors($wgMaxCredits);
+
+ # don't count last editor
+
+ $contributors = $wgArticle->getContributors($wgMaxCredits - 1);
$real_names = array();
$user_names = array();
$creds = $wgLang->listToText(array($real, $user, $anon));
- return wfMsg("contributions", $creds);
+ return wfMsg("othercontribs", $creds);
}
function getCopyright() {
}
// only show watchlist link if logged in
- if ( wfMsg ( "currentevents" ) != "" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
+ if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
$s .= "\n<br /><hr class='sep' />";
$articleExists = $wgTitle->getArticleId();
if ( $wgOut->isArticle() || $action =="edit" || $action =="history" || $wpPreview) {
return "<strong>{$prefix}{$text}{$inside}</strong>{$trail}";
}
+ /* these are used extensively in SkinPHPTal, but also some other places */
+ /*static*/ function makeSpecialUrl( $name, $urlaction='' ) {
+ $title = Title::makeTitle( NS_SPECIAL, $name );
+ $this->checkTitle(&$title, &$name);
+ return $title->getLocalURL( $urlaction );
+ }
+ /*static*/ function makeTalkUrl ( $name, $urlaction='' ) {
+ $title = Title::newFromText( $name );
+ $title = $title->getTalkPage();
+ $this->checkTitle(&$title, &$name);
+ return $title->getLocalURL( $urlaction );
+ }
+ /*static*/ function makeArticleUrl ( $name, $urlaction='' ) {
+ $title = Title::newFromText( $name );
+ $title= $title->getSubjectPage();
+ $this->checkTitle(&$title, &$name);
+ return $title->getLocalURL( $urlaction );
+ }
+ /*static*/ function makeI18nUrl ( $name, $urlaction='' ) {
+ $title = Title::newFromText( wfMsg($name) );
+ $this->checkTitle(&$title, &$name);
+ return $title->getLocalURL( $urlaction );
+ }
+ /*static*/ function makeUrl ( $name, $urlaction='' ) {
+ $title = Title::newFromText( $name );
+ $this->checkTitle(&$title, &$name);
+ return $title->getLocalURL( $urlaction );
+ }
+
+ # make sure we have some title to operate on, mind the '&'
+ /*static*/ function &checkTitle ( $title, $name ) {
+ if(!is_object($title)) {
+ $title = Title::newFromText( $name );
+ if(!is_object($title)) {
+ $title = Title::newFromText( '<error: link target missing>' );
+ }
+ }
+ }
+
function fnamePart( $url )
{
$basename = strrchr( $url, "/" );
$thumbUrl = $url;
} else {
$boxheight = intval( $height/($width/$boxwidth) );
- if ( $boxwidth > $width ) {
- $boxwidth = $width;
- $boxheight = $height;
- }
+ # if ( $boxwidth > $width ) {
+ # $boxwidth = $width;
+ # $boxheight = $height;
+ #}
$thumbUrl = $img->createThumb( $boxwidth );
}
$oboxwidth = $boxwidth + 2;