Skip to content

Commit

Permalink
Replace deprecated wfMsg* calls, state MediaWiki 1.27 support
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Aug 4, 2016
1 parent 43e28b2 commit 57d7703
Show file tree
Hide file tree
Showing 18 changed files with 205 additions and 223 deletions.
3 changes: 2 additions & 1 deletion README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ their newer versions.

= Requirements =

* MediaWiki 1.19-1.26 or higher, or Mediawiki4Intranet 1.18.
* MediaWiki 1.19-1.27, or Mediawiki4Intranet 1.18.
* A MySQL or PostgreSQL database backend.
* ParserFunctions extension.
= Installation =

Expand Down
35 changes: 17 additions & 18 deletions SpecialWikilog.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ public function webOutput( FormOptions $opts ) {
'rel' => 'alternate',
'href' => $wgTitle->getLocalURL( $altquery ),
'type' => $wgMimeType,
'title' => wfMsgExt( "wikilog-view-{$alt}",
array( 'content', 'parsemag' ) )
'title' => wfMessage( "wikilog-view-{$alt}" )->inContentLanguage()->text(),
) );
}
}
Expand Down Expand Up @@ -276,7 +275,7 @@ public function getMarkAllReadLink()
$query = $wgRequest->getValues();
$query['markallread'] = wfTimestamp( TS_MW );
return Xml::wrapClass(
Xml::element( 'a', array( 'href' => $wgTitle->getFullUrl( $query ) ), wfMsg( 'wikilog-mark-all-read' ) ),
Xml::element( 'a', array( 'href' => $wgTitle->getFullUrl( $query ) ), wfMessage( 'wikilog-mark-all-read' )->text() ),
'markallread', 'p'
);
}
Expand All @@ -299,7 +298,7 @@ public function feedOutput( $format, FormOptions $opts ) {
* and also the name that will be listed in Special:Specialpages.
*/
public function getDescription() {
return wfMsg( 'wikilog-specialwikilog-title' );
return wfMessage( 'wikilog-specialwikilog-title' )->text();
}

/**
Expand Down Expand Up @@ -372,7 +371,7 @@ protected function getHeader( FormOptions $opts ) {
}

$out = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
$out = Xml::fieldset( wfMsg( 'wikilog-form-legend' ), $out,
$out = Xml::fieldset( wfMessage( 'wikilog-form-legend' )->text(), $out,
array( 'class' => 'wl-options' )
);
$out .= WikilogMainPage::formNewItem( NULL );
Expand Down Expand Up @@ -531,11 +530,11 @@ protected function getQueryFormFields( FormOptions $opts ) {
if ( count( $values ) > 0 )
{
$select = new XmlSelect( $valueid, 'wl-'.$valueid, $formvalues[$valueid] );
$select->addOption( wfMsg('wikilog-form-all'), '' );
$select->addOption( wfMessage( 'wikilog-form-all' )->text(), '' );
foreach( $values as $o )
$select->addOption( $o[0], count($o) > 1 ? $o[1] : false );
$fields[$valueid] = array(
Xml::label( wfMsg( 'wikilog-form-'.$valueid ), 'wl-'.$valueid ),
Xml::label( wfMessage( 'wikilog-form-'.$valueid )->text(), 'wl-'.$valueid ),
$select->getHTML()
);
}
Expand All @@ -545,44 +544,44 @@ protected function getQueryFormFields( FormOptions $opts ) {
else
{
$fields[$valueid] = Xml::inputLabelSep(
wfMsg( 'wikilog-form-'.$valueid ), $valueid, 'wl-'.$valueid, 40,
wfMessage( 'wikilog-form-'.$valueid )->text(), $valueid, 'wl-'.$valueid, 40,
$formvalues[$valueid]
);
}
}

$month_select = new XmlSelect( 'month', 'wl-month', $opts->consumeValue( 'month' ) );
$month_select->setAttribute( 'onchange', "{var wly=document.getElementById('wl-year');if(wly&&!wly.value){wly.value='".date('Y')."';}}" );
$month_select->addOption( wfMsg('monthsall'), '' );
$month_select->addOption( wfMessage( 'monthsall' )->text(), '' );
for ($i = 1; $i <= 12; $i++)
$month_select->addOption( $wgLang->getMonthName( $i ), $i );
$year_field = Xml::input( 'year', 4, $opts->consumeValue( 'year' ), array( 'maxlength' => 4, 'id' => 'wl-year' ) );
$fields['date'] = array(
Xml::label( wfMsg( 'wikilog-form-date' ), 'wl-month' ),
Xml::label( wfMessage( 'wikilog-form-date' )->text(), 'wl-month' ),
$month_select->getHTML() . "&nbsp;" . $year_field
);
$opts->consumeValue( 'day' ); // ignore day, not really useful

$viewSelect = new XmlSelect( 'view', 'wl-view', $opts->consumeValue( 'view' ) );
$viewSelect->addOption( wfMsg( 'wikilog-view-summary' ), 'summary' );
$viewSelect->addOption( wfMsg( 'wikilog-view-archives' ), 'archives' );
$viewSelect->addOption( wfMessage( 'wikilog-view-summary' )->text(), 'summary' );
$viewSelect->addOption( wfMessage( 'wikilog-view-archives' )->text(), 'archives' );
$fields['view'] = array(
Xml::label( wfMsg( 'wikilog-form-view' ), 'wl-view' ),
Xml::label( wfMessage( 'wikilog-form-view' )->text(), 'wl-view' ),
$viewSelect->getHTML()
);
if( $wgUser && $wgUser->getID() )
{
$statusSelect = new XmlSelect( 'show', 'wl-status', $opts->consumeValue( 'show' ) );
$statusSelect->addOption( wfMsg( 'wikilog-show-all' ), 'all' );
$statusSelect->addOption( wfMsg( 'wikilog-show-published' ), 'published' );
$statusSelect->addOption( wfMsg( 'wikilog-show-drafts' ), 'drafts' );
$statusSelect->addOption( wfMessage( 'wikilog-show-all' )->text(), 'all' );
$statusSelect->addOption( wfMessage( 'wikilog-show-published' )->text(), 'published' );
$statusSelect->addOption( wfMessage( 'wikilog-show-drafts' )->text(), 'drafts' );
$fields['status'] = array(
Xml::label( wfMsg( 'wikilog-form-status' ), 'wl-status' ),
Xml::label( wfMessage( 'wikilog-form-status' )->text(), 'wl-status' ),
$statusSelect->getHTML()
);
}

$fields['submit'] = Xml::submitbutton( wfMsg( 'allpagessubmit' ) );
$fields['submit'] = Xml::submitbutton( wfMessage( 'allpagessubmit' )->text() );
return $fields;
}

Expand Down
24 changes: 12 additions & 12 deletions SpecialWikilogSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ protected function webOutputPartial( $opts, $key, $offsetReplacement, $limitRepl
global $wgOut, $wgLang;

$html = '<div>';
$html .= '<h2>' . wfMsgNoTrans( 'wikilog-subscription-' . $key ) . '</h2>';
$html .= '<h2>' . wfMessage( 'wikilog-subscription-'.$key )->plain() . '</h2>';
if ( count( $opts[$key] ) > 0 ) {
$html .= '<table class="wikitable">';
$html .= '<tr><th>' . wfMsgNoTrans( 'wikilog-subscription-header-action');
$html .= '</th><th>' . wfMsgNoTrans( 'wikilog-subscription-header-' . $key ) . '</th>';
$html .= '<tr><th>' . wfMessage( 'wikilog-subscription-header-action' )->plain();
$html .= '</th><th>' . wfMessage( 'wikilog-subscription-header-'.$key )->plain() . '</th>';
foreach ( $opts[$key] as $title ) {
$html .= $this->itemHTML( $title, $key == 'comments' );
}
$html .= '</table>';
} else {
$html .= wfMsgNoTrans( 'wikilog-subscription-' . $key . '-empty' );
$html .= wfMessage( 'wikilog-subscription-'.$key.'-empty' )->plain();
}
$html .= '</div>';
$wgOut->addHtml( $html );
Expand Down Expand Up @@ -213,19 +213,19 @@ protected function subscribe() {

if ( $subscribe ) {
$wgOut->addHtml(
'<p>' . wfMsgNoTrans( 'wikilog-subscription-blog-subscribed', $wgUser->getSkin()->link( $title, $title->getPrefixedText() ) ) .
'<p>' . wfMessage( 'wikilog-subscription-blog-subscribed', $this->getContext()->getSkin()->link( $title, $title->getPrefixedText() ) )->plain() .
'</p><p>' . self::generateSubscriptionLink( $title, true, true ) . '</p>'
);
} elseif ( $isComments ) {
$wi = Wikilog::getWikilogInfo( $title );
$key = ( $wi->isMain() ? 'wikilog-subscription-comment-unsubscribed-blog' : 'wikilog-subscription-comment-unsubscribed-article' );
$wgOut->addHtml(
'<p>' . wfMsgNoTrans( $key, $title->getPrefixedText() ) .
'<p>' . wfMessage( $key, $title->getPrefixedText() )->plain() .
'</p><p>' . $this->getCommentSubscription( $title->getTalkPage() ) . '</p>'
);
} else {
$wgOut->addHtml(
'<p>' . wfMsgNoTrans( 'wikilog-subscription-blog-unsubscribed', $wgUser->getSkin()->link( $title, $title->getPrefixedText() ) ) .
'<p>' . wfMessage( 'wikilog-subscription-blog-unsubscribed', $this->getContext()->getSkin()->link( $title, $title->getPrefixedText() ) )->plain() .
'</p><p>' . self::generateSubscriptionLink( $title, false, true ) . '</p>'
);
}
Expand All @@ -251,8 +251,8 @@ protected function itemHTML( $title, $comments = false ) {
if ( $comments ) {
$query ['comment'] = 1;
}
$unsubscribeLink = $wgUser->getSkin()->link( $this->mTitle, wfMsgNoTrans( 'wikilog-subscription-item-unsubscribe' ), $params, $query );
$titleLink = $wgUser->getSkin()->link( $title, $title->getPrefixedText() );
$unsubscribeLink = $this->getContext()->getSkin()->link( $this->mTitle, wfMessage( 'wikilog-subscription-item-unsubscribe' )->plain(), $params, $query );
$titleLink = $this->getContext()->getSkin()->link( $title, $title->getPrefixedText() );
$html = <<<END_STRING
<tr>
<td>{$unsubscribeLink}</td>
Expand All @@ -268,7 +268,7 @@ protected function itemHTML( $title, $comments = false ) {
* @return string
*/
protected function getCommentSubscription( $title ) {
return wfMsgNoTrans( 'wikilog-subscription-comment-subscription', $title->getLinkUrl(), $title->getPrefixedText() );
return wfMessage( 'wikilog-subscription-comment-subscription', $title->getLinkUrl(), $title->getPrefixedText() )->plain();
}

/**
Expand Down Expand Up @@ -311,8 +311,8 @@ public static function generateSubscriptionLink( $title, $subscribed = null, $fo
* @return string
*/
public static function subcriptionsRuleLink( $lang = NULL ) {
global $wgUser, $wgLang;
return $wgUser->getSkin()->link(
global $wgLang;
return RequestContext::getMain()->getSkin()->link(
SpecialPage::getTitleFor( 'wikilogsubscriptions' ),
wfMessage( 'wikilog-subscription-return-link' )
->inLanguage( $lang ? $lang : $wgLang )->plain()
Expand Down
2 changes: 1 addition & 1 deletion Wikilog.i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
# Comments
'wikilog-comment-header' => '',
'wikilog-comment-footer' => '— $2 • $5 $6',
'wikilog-comment-permalink' => '{{#if:$3|$1 at $2 ($3)|<b>$1 at $2 ($3) [unread]</b>}}',
'wikilog-comment-permalink' => '{{#if:$4|$1 at $2 ($3)|<b>$1 at $2 ($3) [unread]</b>}}',
'wikilog-comment-note-item' => 'posted to $1',
'wikilog-comment-note-edited' => 'last edited on $1 at $2',
'wikilog-comment-anonsig' => '$3 (anonymous)',
Expand Down
4 changes: 2 additions & 2 deletions Wikilog.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => 'Wikilog',
'version' => '2.0',
'version' => '2.0.1',
'author' => 'Juliano F. Ravasi, Vitaliy Filippov',
'descriptionmsg' => 'wikilog-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:Wikilog',
Expand Down Expand Up @@ -446,7 +446,7 @@ private static function skinConfigViewsLinks( WikilogInfo &$wi, $skin, &$views )
if ( $wi->isMain() && $skin->getTitle()->quickUserCan( 'edit' ) ) {
$views['wikilog'] = array(
'class' => ( $action == 'wikilog' ) ? 'selected' : false,
'text' => wfMsg( 'wikilog-tab' ),
'text' => wfMessage( 'wikilog-tab' )->text(),
'href' => $skin->getTitle()->getLocalUrl( 'action=wikilog' )
);
}
Expand Down
8 changes: 4 additions & 4 deletions WikilogCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ static function makePagingLinks($months, $pager)
$prev = array('dir' => 'next', 'offset' => ($prevmonth = $months[count($months)-1]).'01000000', 'limit' => $urlLimit );
$html = '<p class="wl-calendar-nav">';
if ($prev)
$html .= $pager->makeLink(wfMsg('wikilog-calendar-prev', self::monthName(self::prevMonth($prevmonth))), $prev, 'prev');
$html .= $pager->makeLink(wfMessage('wikilog-calendar-prev', self::monthName(self::prevMonth($prevmonth)))->text(), $prev, 'prev');
if ($next)
$html .= $pager->makeLink(wfMsg('wikilog-calendar-next', self::monthName($nextmonth)), $next, 'next');
$html .= $pager->makeLink(wfMessage('wikilog-calendar-next', self::monthName($nextmonth))->text(), $next, 'next');
$html .= '</p>';
return $html;
}
Expand Down Expand Up @@ -185,10 +185,10 @@ static function sidebarCalendar($pager)
'month' => substr($date, 4, 2),
'day' => substr($date, 6, 2),
)),
'title' => wfMsgExt('wikilog-calendar-archive-link-title', 'parseinline',
'title' => wfMessage('wikilog-calendar-archive-link-title',
$sp->getPrefixedText(),
date('Y-m-d', wfTimestamp(TS_UNIX, $row->wlp_pubdate))
),
)->parse(),
);
}
}
Expand Down
Loading

0 comments on commit 57d7703

Please sign in to comment.