if ( !class_exists( $classOrCallable ) ) {
return false;
}
- $obj = new $classOrCallable( $page, $context );
- return $obj;
+ return new $classOrCallable( $page, $context );
}
if ( is_callable( $classOrCallable ) ) {
} else {
$actionName = 'view';
}
- } elseif ( $actionName == 'editredlink' ) {
+ } elseif ( $actionName === 'editredlink' ) {
$actionName = 'edit';
}
}
}
- if ( $this->requiresUnblock() && $user->isBlocked() ) {
+ // If the action requires an unblock, explicitly check the user's block.
+ if ( $this->requiresUnblock() && $user->isBlockedFrom( $this->getTitle() ) ) {
$block = $user->getBlock();
- throw new UserBlockedError( $block );
+ if ( $block ) {
+ throw new UserBlockedError( $block );
+ }
+
+ throw new PermissionsError( $this->getName(), [ 'badaccess-group0' ] );
}
// This should be checked at the end so that the user won't think the
*/
protected function setHeaders() {
$out = $this->getOutput();
- $out->setRobotPolicy( "noindex,nofollow" );
+ $out->setRobotPolicy( 'noindex,nofollow' );
$out->setPageTitle( $this->getPageTitle() );
$out->setSubtitle( $this->getDescription() );
$out->setArticleRelated( true );