mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-15 10:17:49 +00:00
Trim/fix whitespace
This commit is contained in:
parent
d1b3021d6f
commit
4db154c598
|
@ -21,7 +21,7 @@ class TitleBlacklist {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all configured blacklist sources
|
* Load all configured blacklist sources
|
||||||
*/
|
*/
|
||||||
public function load() {
|
public function load() {
|
||||||
global $wgTitleBlacklistSources, $wgMemc, $wgTitleBlacklistCaching;
|
global $wgTitleBlacklistSources, $wgMemc, $wgTitleBlacklistCaching;
|
||||||
wfProfileIn( __METHOD__ );
|
wfProfileIn( __METHOD__ );
|
||||||
|
@ -46,7 +46,7 @@ class TitleBlacklist {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all configured whitelist sources
|
* Load all configured whitelist sources
|
||||||
*/
|
*/
|
||||||
public function loadWhitelist() {
|
public function loadWhitelist() {
|
||||||
global $wgMemc, $wgTitleBlacklistCaching;
|
global $wgMemc, $wgTitleBlacklistCaching;
|
||||||
wfProfileIn( __METHOD__ );
|
wfProfileIn( __METHOD__ );
|
||||||
|
@ -66,7 +66,7 @@ class TitleBlacklist {
|
||||||
*
|
*
|
||||||
* @param $source A blacklist source from $wgTitleBlacklistSources
|
* @param $source A blacklist source from $wgTitleBlacklistSources
|
||||||
* @return The content of the blacklist source as a string
|
* @return The content of the blacklist source as a string
|
||||||
*/
|
*/
|
||||||
private static function getBlacklistText( $source ) {
|
private static function getBlacklistText( $source ) {
|
||||||
if( !is_array( $source ) || count( $source ) <= 0 ) {
|
if( !is_array( $source ) || count( $source ) <= 0 ) {
|
||||||
return ''; //Return empty string in error case
|
return ''; //Return empty string in error case
|
||||||
|
@ -111,7 +111,7 @@ class TitleBlacklist {
|
||||||
*
|
*
|
||||||
* @param $list Text of a blacklist source, as a string
|
* @param $list Text of a blacklist source, as a string
|
||||||
* @return An array of TitleBlacklistEntry entries
|
* @return An array of TitleBlacklistEntry entries
|
||||||
*/
|
*/
|
||||||
public static function parseBlacklist( $list ) {
|
public static function parseBlacklist( $list ) {
|
||||||
wfProfileIn( __METHOD__ );
|
wfProfileIn( __METHOD__ );
|
||||||
$lines = preg_split( "/\r?\n/", $list );
|
$lines = preg_split( "/\r?\n/", $list );
|
||||||
|
@ -138,7 +138,7 @@ class TitleBlacklist {
|
||||||
* @param $override If set to true, overrides work
|
* @param $override If set to true, overrides work
|
||||||
* @return The corresponding TitleBlacklistEntry if blacklisted;
|
* @return The corresponding TitleBlacklistEntry if blacklisted;
|
||||||
* otherwise FALSE
|
* otherwise FALSE
|
||||||
*/
|
*/
|
||||||
public function userCannot( $title, $user, $action = 'edit', $override = true ) {
|
public function userCannot( $title, $user, $action = 'edit', $override = true ) {
|
||||||
if( $override && self::userCanOverride( $action ) )
|
if( $override && self::userCanOverride( $action ) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -154,7 +154,7 @@ class TitleBlacklist {
|
||||||
* @param $action Action to check; 'edit' if unspecified
|
* @param $action Action to check; 'edit' if unspecified
|
||||||
* @return The corresponding TitleBlacklistEntry if blacklisted;
|
* @return The corresponding TitleBlacklistEntry if blacklisted;
|
||||||
* otherwise FALSE
|
* otherwise FALSE
|
||||||
*/
|
*/
|
||||||
public function isBlacklisted( $title, $action = 'edit' ) {
|
public function isBlacklisted( $title, $action = 'edit' ) {
|
||||||
if( !($title instanceof Title) ) {
|
if( !($title instanceof Title) ) {
|
||||||
$title = Title::newFromText( $title );
|
$title = Title::newFromText( $title );
|
||||||
|
@ -178,7 +178,7 @@ class TitleBlacklist {
|
||||||
* @param $title Title to check
|
* @param $title Title to check
|
||||||
* @param $action Action to check; 'edit' if unspecified
|
* @param $action Action to check; 'edit' if unspecified
|
||||||
* @return TRUE if whitelisted; otherwise FALSE
|
* @return TRUE if whitelisted; otherwise FALSE
|
||||||
*/
|
*/
|
||||||
public function isWhitelisted( $title, $action = 'edit' ) {
|
public function isWhitelisted( $title, $action = 'edit' ) {
|
||||||
global $wgUser;
|
global $wgUser;
|
||||||
if( !($title instanceof Title) ) {
|
if( !($title instanceof Title) ) {
|
||||||
|
@ -197,7 +197,7 @@ class TitleBlacklist {
|
||||||
* Get the current blacklist
|
* Get the current blacklist
|
||||||
*
|
*
|
||||||
* @return Array of TitleBlacklistEntry items
|
* @return Array of TitleBlacklistEntry items
|
||||||
*/
|
*/
|
||||||
public function getBlacklist() {
|
public function getBlacklist() {
|
||||||
if( is_null( $this->mBlacklist ) ) {
|
if( is_null( $this->mBlacklist ) ) {
|
||||||
$this->load();
|
$this->load();
|
||||||
|
@ -209,7 +209,7 @@ class TitleBlacklist {
|
||||||
* Get the current whitelist
|
* Get the current whitelist
|
||||||
*
|
*
|
||||||
* @return Array of TitleBlacklistEntry items
|
* @return Array of TitleBlacklistEntry items
|
||||||
*/
|
*/
|
||||||
public function getWhitelist() {
|
public function getWhitelist() {
|
||||||
if( is_null( $this->mWhitelist ) ) {
|
if( is_null( $this->mWhitelist ) ) {
|
||||||
$this->loadWhitelist();
|
$this->loadWhitelist();
|
||||||
|
@ -222,7 +222,7 @@ class TitleBlacklist {
|
||||||
*
|
*
|
||||||
* @param $source URL of the blacklist source
|
* @param $source URL of the blacklist source
|
||||||
* @return The content of the blacklist source as a string
|
* @return The content of the blacklist source as a string
|
||||||
*/
|
*/
|
||||||
private static function getHttp( $url ) {
|
private static function getHttp( $url ) {
|
||||||
global $messageMemc, $wgTitleBlacklistCaching;
|
global $messageMemc, $wgTitleBlacklistCaching;
|
||||||
$key = "title_blacklist_source:" . md5( $url ); // Global shared
|
$key = "title_blacklist_source:" . md5( $url ); // Global shared
|
||||||
|
|
Loading…
Reference in a new issue