}
return $wgValidSkinNames;
}
-
+
/**
* Fetch the skinname messages for available skins.
* @return array of strings
}
/**
- * Make a <script> tag containing global variables
+ * Make a "<script>" tag containing global variables
*
* @deprecated in 1.19
* @param $unused
* inside ->getOutput() is deprecated. The $out arg is kept
* for compatibility purposes with skins.
* @param $out OutputPage
- * @delete
+ * @todo delete
*/
abstract function setupSkinUserCss( OutputPage $out );
/**
* This will be called by OutputPage::headElement when it is creating the
- * <body> tag, skins can override it if they have a need to add in any
+ * "<body>" tag, skins can override it if they have a need to add in any
* body attributes or classes of their own.
* @param $out OutputPage
* @param $bodyAttrs Array
}
/**
- * This gets called shortly before the </body> tag.
+ * This gets called shortly before the "</body>" tag.
*
- * @return String HTML-wrapped JS code to be put before </body>
+ * @return String HTML-wrapped JS code to be put before "</body>"
*/
function bottomScripts() {
// TODO and the suckage continues. This function is really just a wrapper around
}
/**
- * @param $name string
- * @param $urlaction string
+ * Make a URL for a Special Page using the given query and protocol.
+ *
+ * If $proto is set to null, make a local URL. Otherwise, make a full
+ * URL with the protocol specified.
+ *
+ * @param $name string Name of the Special page
+ * @param $urlaction string Query to append
+ * @param $proto Protocol to use or null for a local URL
* @return String
*/
- static function makeSpecialUrl( $name, $urlaction = '' ) {
+ static function makeSpecialUrl( $name, $urlaction = '', $proto = null ) {
$title = SpecialPage::getSafeTitleFor( $name );
- return $title->getLocalURL( $urlaction );
+ if( is_null( $proto ) ) {
+ return $title->getLocalURL( $urlaction );
+ } else {
+ return $title->getFullURL( $urlaction, false, $proto );
+ }
}
/**
$ntl = '';
if ( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
- $userTitle = $this->getUser()->getUserPage();
- $userTalkTitle = $userTitle->getTalkPage();
+ $userTalkTitle = $this->getUser()->getTalkPage();
if ( !$userTalkTitle->equals( $out->getTitle() ) ) {
+ $lastSeenRev = isset( $newtalks[0]['rev'] ) ? $newtalks[0]['rev'] : null;
+ $nofAuthors = 0;
+ if ( $lastSeenRev !== null ) {
+ $plural = true; // Default if we have a last seen revision: if unknown, use plural
+ $latestRev = Revision::newFromTitle ($userTalkTitle);
+ if ( $latestRev !== null ) {
+ // Singular if only 1 unseen revision, plural if several unseen revisions.\r
+ $plural = $latestRev->getParentId() !== $lastSeenRev->getId();\r
+ $nofAuthors = $userTalkTitle->countAuthorsBetween( $lastSeenRev, $latestRev, 10, 'include_new' );
+ }
+ } else {
+ // Singular if no revision -> diff link will show latest change only in any case
+ $plural = false;
+ }
+ $plural = $plural ? 2 : 1;
+ // 2 signifies "more than one revision". We don't know how many, and even if we did,
+ // the number of revisions or authors is not necessarily the same as the number of
+ // "messages".
$newMessagesLink = Linker::linkKnown(
$userTalkTitle,
- $this->msg( 'newmessageslink' )->escaped(),
+ $this->msg( 'newmessageslinkplural' )->params( $plural )->escaped(),
array(),
array( 'redirect' => 'no' )
);
$newMessagesDiffLink = Linker::linkKnown(
$userTalkTitle,
- $this->msg( 'newmessagesdifflink' )->escaped(),
+ $this->msg( 'newmessagesdifflinkplural' )->params( $plural )->escaped(),
array(),
- array( 'diff' => 'cur' )
+ $lastSeenRev !== null
+ ? array( 'oldid' => $lastSeenRev->getId(), 'diff' => 'cur' )
+ : array( 'diff' => 'cur' )
);
- $ntl = $this->msg(
- 'youhavenewmessages',
- $newMessagesLink,
- $newMessagesDiffLink
- )->text();
+ if ( $nofAuthors >= 1 && $nofAuthors <= 10 ) {
+ $ntl = $this->msg(
+ 'youhavenewmessagesfromusers',
+ $newMessagesLink,
+ $newMessagesDiffLink
+ )->numParams( $nofAuthors );
+ } else {
+ // $nofAuthors === 11 signifies "11 or more" ("more than 10")
+ $ntl = $this->msg(
+ $nofAuthors > 10 ? 'youhavenewmessagesmanyusers' : 'youhavenewmessages',
+ $newMessagesLink,
+ $newMessagesDiffLink
+ );
+ }
+ $ntl = $ntl->text();
# Disable Squid cache
$out->setSquidMaxage( 0 );
}