$this->request = $request;
// Add parser hooks
- global $wgParser;
- $wgParser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] );
- $wgParser->setHook( 'doclink', [ $this, 'docLink' ] );
+ $parser = MediaWikiServices::getInstance()->getParser();
+ $parser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] );
+ $parser->setHook( 'doclink', [ $this, 'docLink' ] );
}
/**
return $this->session;
}
- if ( isset( $session['happyPages'] ) ) {
- $this->happyPages = $session['happyPages'];
- } else {
- $this->happyPages = [];
- }
+ $this->happyPages = $session['happyPages'] ?? [];
- if ( isset( $session['skippedPages'] ) ) {
- $this->skippedPages = $session['skippedPages'];
- } else {
- $this->skippedPages = [];
- }
+ $this->skippedPages = $session['skippedPages'] ?? [];
$lowestUnhappy = $this->getLowestUnhappy();
* @return array
*/
public function getSession( $name, $default = null ) {
- if ( !isset( $this->session[$name] ) ) {
- return $default;
- } else {
- return $this->session[$name];
- }
+ return $this->session[$name] ?? $default;
}
/**
if ( !isset( $params['labelAttribs'] ) ) {
$params['labelAttribs'] = [];
}
- if ( isset( $params['rawtext'] ) ) {
- $labelText = $params['rawtext'];
- } else {
- $labelText = $this->parse( wfMessage( $params['label'] )->text() );
- }
+ $labelText = $params['rawtext'] ?? $this->parse( wfMessage( $params['label'] )->plain() );
return "<div class=\"config-input-check\">\n" .
$params['help'] .
public function getRadioSet( $params ) {
$items = $this->getRadioElements( $params );
- if ( !isset( $params['label'] ) ) {
- $label = '';
- } else {
- $label = $params['label'];
- }
+ $label = $params['label'] ?? '';
if ( !isset( $params['controlName'] ) ) {
$params['controlName'] = 'config_' . $params['var'];
if ( $value === null ) {
// Checkbox?
$this->setVar( $name, false );
+ } elseif ( stripos( $name, 'password' ) !== false ) {
+ $this->setPassword( $name, $value );
} else {
- if ( stripos( $name, 'password' ) !== false ) {
- $this->setPassword( $name, $value );
- } else {
- $this->setVar( $name, $value );
- }
+ $this->setVar( $name, $value );
}
}