public static function ImageOverlayLinkBegin($dummy, \Title $target, &$text, &$customAttribs, &$query, &$options, &$ret) {
	    global $wgDIQAImageOverlayWhitelist;
	    global $wgDIQADownloadWhitelist;
	       
	    if (!self::isImage($target->mNamespace)) {
	        // don't rewrite links not pointing to images
	        return true; 
	    }
	    
        $file = wfFindFile($target);
        if ( !$file ) { 
            // don't rewrite links to non-existing files
            return true; 
        }
	    
        $ext = $file->getExtension();
	    if ( in_array( $ext, $wgDIQAImageOverlayWhitelist )) { 
	        // open in overlay
	        $ret = Html::rawElement ( 
	            'a', 
	            array ( 'href' => $file->getFullURL(), 'class' => 'imageOverlay' ), 
	            self::getDisplayTitle($target) );
	        return false;
	    }
	    
	    if ( in_array( $ext, $wgDIQADownloadWhitelist )) { 
	        // download
	        $ret = Html::rawElement ( 
	            'a', 
	            array ( 'href' => $file->getFullURL() ), 
	            self::getDisplayTitle($target) );
            return false;
	    }
	    
	    // don't rewrite links to files with inappropriate extensions
	    return true; 
	}