Skip to content

Commit

Permalink
More RequestContext to avoid global state where absolutely not needed (
Browse files Browse the repository at this point in the history
…#20)

* More RequestContext to avoid global state where absolutely not needed

* Fix indentation in LibertyTemplate#contentsToolbox to make CI happy
  • Loading branch information
mary-kate authored Oct 17, 2023
1 parent b293c7a commit 58c02ee
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions LibertyTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,9 @@ protected function contentsToolbox() {
<i class="far fa-share-square"></i>
<?php echo $skin->msg( 'liberty-share' )->escaped() ?>
</button>
<?php } ?>
<?php
// @codingStandardsIgnoreStart
<?php
}
// @codingStandardsIgnoreStart
?>
<button type="button" class="btn btn-secondary tools-btn dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
Expand Down Expand Up @@ -877,8 +877,9 @@ protected function parseNavbar() {

$headings = [];
$currentHeading = null;
$userName = $this->getSkin()->getUser()->getName();
$userLang = $this->getSkin()->getLanguage()->mCode;
$skin = $this->getSkin();
$userName = $skin->getUser()->getName();
$userLang = $skin->getLanguage()->mCode;
$globalData = ContentHandler::getContentText( WikiPage::factory(
Title::newFromText( 'Liberty-Navbar', NS_MEDIAWIKI )
)->getContent( RevisionRecord::RAW ) );
Expand Down Expand Up @@ -940,7 +941,7 @@ protected function parseNavbar() {
// thing on the right side of the pipe isn't the name of a MW:
// message, then and _only_ then render it as-is
if ( isset( $data['display'] ) ) {
$textObj = wfMessage( $data['display'] );
$textObj = $skin->msg( $data['display'] );
if ( $textObj->isDisabled() ) {
$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
} else {
Expand All @@ -957,7 +958,7 @@ protected function parseNavbar() {

// Title
if ( isset( $data['title'] ) ) {
$titleObj = wfMessage( $data['title'] );
$titleObj = $skin->msg( $data['title'] );
if ( $titleObj->isDisabled() ) {
$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
} else {
Expand Down Expand Up @@ -1039,7 +1040,7 @@ protected function parseNavbar() {
// thing on the right side of the pipe isn't the name of a MW:
// message, then and _only_ then render it as-is
if ( isset( $data['display'] ) ) {
$textObj = wfMessage( $data['display'] );
$textObj = $skin->msg( $data['display'] );
if ( $textObj->isDisabled() ) {
$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
} else {
Expand All @@ -1056,7 +1057,7 @@ protected function parseNavbar() {

// Title
if ( isset( $data['title'] ) ) {
$titleObj = wfMessage( $data['title'] );
$titleObj = $skin->msg( $data['title'] );
if ( $titleObj->isDisabled() ) {
$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
} else {
Expand Down Expand Up @@ -1136,14 +1137,14 @@ protected function parseNavbar() {
// thing on the right side of the pipe isn't the name of a MW:
// message, then and _only_ then render it as-is
if ( isset( $data['display'] ) ) {
$textObj = wfMessage( $data['display'] );
$textObj = $skin->msg( $data['display'] );
if ( $textObj->isDisabled() ) {
$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
} else {
$text = $textObj->text();
}
} else {
$text = "";
$text = '';
}

// If icon and text both empty
Expand All @@ -1153,7 +1154,7 @@ protected function parseNavbar() {

// Title
if ( isset( $data['title'] ) ) {
$titleObj = wfMessage( $data['title'] );
$titleObj = $skin->msg( $data['title'] );
if ( $titleObj->isDisabled() ) {
$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
} else {
Expand Down

0 comments on commit 58c02ee

Please sign in to comment.