function wfBlogsOnBeforeInitialize(&$title, &$article, &$output, User $user, $request, $mediaWiki) { global $wgAutoloadClasses; // this line causes initialization of the skin // title before redirect handling is passed causing BugId:7282 - it will be fixed in "AfterInitialize" hook $skinName = get_class($user->getSkin()); if ($skinName == 'SkinMonoBook') { $wgAutoloadClasses['CreateBlogPage'] = __DIR__ . '/monobook/SpecialCreateBlogPage.php'; } return true; }
function wfCreatePageOnBeforeInitialize(&$title, &$article, &$output, User &$user, $request, $mediaWiki) { global $wgAutoloadClasses; // this line causes initialization of the skin // title before redirect handling is passed causing BugId:7282 - it will be fixed in "AfterInitialize" hook $skinName = get_class($user->getSkin()); if ($skinName == 'SkinMonoBook') { // use different class to handle Special:CreatePage $dir = dirname(__FILE__) . '/monobook'; $wgAutoloadClasses['SpecialCreatePage'] = $dir . '/SpecialCreatePage.class.php'; $wgAutoloadClasses['SpecialEditPage'] = $dir . '/SpecialEditPage.class.php'; } return true; }
/** * Links to different places. * @param $userpage Title: Target user page * @param $talkpage Title: Talk page * @param $target User: Target user object * @param $subject User: The viewing user ($wgUser is still checked in some cases, like userrights page!!) */ public static function getUserLinks(Title $userpage, Title $talkpage, User $target, User $subject) { $sk = $subject->getSkin(); $id = $target->getId(); $username = $target->getName(); $tools[] = $sk->link($talkpage, wfMsgHtml('sp-contributions-talk')); if ($id !== null || $id === null && IP::isIPAddress($username)) { if ($subject->isAllowed('block')) { # Block / Change block / Unblock links if ($target->isBlocked()) { $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Block', $username), wfMsgHtml('change-blocklink')); $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Unblock', $username), wfMsgHtml('unblocklink')); } else { # User is not blocked $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Block', $username), wfMsgHtml('blocklink')); } } # Block log link $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Log', 'block'), wfMsgHtml('sp-contributions-blocklog'), array(), array('page' => $userpage->getPrefixedText())); } # Uploads $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Listfiles', $username), wfMsgHtml('sp-contributions-uploads')); # Other logs link $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Log', $username), wfMsgHtml('sp-contributions-logs')); # Add link to deleted user contributions for priviledged users if ($subject->isAllowed('deletedhistory')) { $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('DeletedContributions', $username), wfMsgHtml('sp-contributions-deleted')); } # Add a link to change user rights for privileged users $userrightsPage = new UserrightsPage(); if ($id !== null && $userrightsPage->userCanChangeRights($target)) { $tools[] = $sk->linkKnown(SpecialPage::getTitleFor('Userrights', $username), wfMsgHtml('sp-contributions-userrights')); } wfRunHooks('ContributionsToolLinks', array($id, $userpage, &$tools)); return $tools; }
/** * Displays the sections and changes for the user to review * @param $page TranslatablePage * @param $sections array */ public function showPage( TranslatablePage $page, Array $sections ) { global $wgOut, $wgContLang; $wgOut->setSubtitle( $this->user->getSkin()->link( $page->getTitle() ) ); $wgOut->addModules( 'ext.translate.special.pagetranslation' ); $wgOut->addWikiMsg( 'tpt-showpage-intro' ); $formParams = array( 'method' => 'post', 'action' => $this->getTitle()->getFullURL(), 'class' => 'mw-tpt-sp-markform', ); $wgOut->addHTML( Xml::openElement( 'form', $formParams ) . Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . Html::hidden( 'revision', $page->getRevision() ) . Html::hidden( 'target', $page->getTitle()->getPrefixedtext() ) . Html::hidden( 'token', $this->user->editToken() ) ); $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-oldnew' ); $diffOld = wfMsgHtml( 'tpt-diff-old' ); $diffNew = wfMsgHtml( 'tpt-diff-new' ); foreach ( $sections as $s ) { if ( $s->type === 'new' ) { $input = Xml::input( 'tpt-sect-' . $s->id, 15, $s->name ); $name = wfMsgHtml( 'tpt-section-new', $input ); } else { $name = wfMsgHtml( 'tpt-section', htmlspecialchars( $s->name ) ); } if ( $s->type === 'changed' ) { $diff = new DifferenceEngine; if ( method_exists( 'DifferenceEngine', 'setTextLanguage' ) ) { $diff->setTextLanguage( $wgContLang ); } $diff->setReducedLineNumbers(); $diff->setText( $s->getOldText(), $s->getText() ); $text = $diff->getDiff( $diffOld, $diffNew ); $diffOld = $diffNew = null; $diff->showDiffStyle(); $id = "tpt-sect-{$s->id}-action-nofuzzy"; $text = Xml::checkLabel( wfMsg( 'tpt-action-nofuzzy' ), $id, $id, false ) . $text; } else { $text = TranslateUtils::convertWhiteSpaceToHTML( $s->getText() ); } # For changed text, the language is set by $diff->setTextLanguage() $lang = $s->type === 'changed' ? null : $wgContLang; $wgOut->addHTML( MessageWebImporter::makeSectionElement( $name, $s->type, $text, $lang ) ); } $deletedSections = $page->getParse()->getDeletedSections(); if ( count( $deletedSections ) ) { $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-deleted' ); foreach ( $deletedSections as $s ) { $name = wfMsgHtml( 'tpt-section-deleted', htmlspecialchars( $s->id ) ); $text = TranslateUtils::convertWhiteSpaceToHTML( $s->getText() ); $wgOut->addHTML( MessageWebImporter::makeSectionElement( $name, $s->type, $text, $wgContLang ) ); } } // Display template changes if applicable if ( $page->getMarkedTag() !== false ) { $newTemplate = $page->getParse()->getTemplatePretty(); $oldPage = TranslatablePage::newFromRevision( $page->getTitle(), $page->getMarkedTag() ); $oldTemplate = $oldPage->getParse()->getTemplatePretty(); if ( $oldTemplate !== $newTemplate ) { $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-template' ); $diff = new DifferenceEngine; if ( method_exists( 'DifferenceEngine', 'setTextLanguage' ) ) { $diff->setTextLanguage( $wgContLang ); } $diff->setText( $oldTemplate, $newTemplate ); $text = $diff->getDiff( wfMsgHtml( 'tpt-diff-old' ), wfMsgHtml( 'tpt-diff-new' ) ); $diff->showDiffStyle(); $diff->setReducedLineNumbers(); $contentParams = array( 'class' => 'mw-tpt-sp-content' ); $wgOut->addHTML( Xml::tags( 'div', $contentParams, $text ) ); } } $wgOut->addHTML( Xml::submitButton( wfMsg( 'tpt-submit' ) ) . Xml::closeElement( 'form' ) ); }