firstChild ) { $classInfoText = 'external text'; // The "external free" class is reserved for links which // are syntactically unbracketed; see commit // 65fcb7a94528ea56d461b3c7b9cb4d4fe4e99211 in core. if ( WTUtils::usesURLLinkSyntax( $a ) ) { $classInfoText = 'external free'; } elseif ( WTUtils::usesMagicLinkSyntax( $a ) ) { // PHP uses specific suffixes for RFC/PMID/ISBN (the last of // which is an internal link, not an mw:ExtLink), but we'll // keep it simple since magic links are deprecated. $classInfoText = 'external mw-magiclink'; } } $a->setAttribute( 'class', $classInfoText ); } } }