Extensions too!
[toast/cookiecaptcha.git] / ConfirmEdit.php
index 55fa2fb5a3412909a289dc904ef2606305091f93..f6cab654887d27b3090be8f81473857806205b90 100644 (file)
@@ -486,22 +486,16 @@ class SimpleCaptcha {
         */
        function filterLink( $url ) {
                global $wgCaptchaWhitelist;
-               $whitelist = false;
                $source = wfMsgForContent( 'captcha-addurl-whitelist' );
 
-               if( $source && $source != '<captcha-addurl-whitelist>' ) {
-                       $whitelist = $this->buildRegexes( explode( "\n", $source ) );
-               }
+               $whitelist = wfEmptyMsg( 'captcha-addurl-whitelist', $source ) 
+                       ? false
+                       : $this->buildRegexes( explode( "\n", $source ) );
 
-               if ( $whitelist === false && $wgCaptchaWhitelist === false ) {
-                       // $whitelist is empty, $wgCaptchaWhitelist is default
-                       return true;
-               } elseif ( $whitelist === false && $wgCaptchaWhitelist !== false ) {
-                       // $whitelist is empty
-                       return !( preg_match( $wgCaptchaWhitelist, $url ) );
-               } else {
-                       return !( preg_match( $wgCaptchaWhitelist, $url ) || preg_match( $whitelist, $url ) );
-               }
+               $cwl = $wgCaptchaWhitelist !== false ? preg_match( $wgCaptchaWhitelist, $url ) : false;
+               $wl  = $whitelist          !== false ? preg_match( $whitelist, $url )          : false;
+
+               return !( $cwl || $wl );
        }
 
        /**
@@ -781,4 +775,4 @@ class CaptchaCacheStore {
 
 } # End invocation guard
 
-?>
+