wiki.techinc.nl/includes/CommentFormatter
C. Scott Ananian b855c62f66 Move Linker::makeExternalLink() to the LinkRenderer service
Move Linker::makeExternalLink to the LinkRenderer service, as has been
done with the other static methods of Linker.

In order to allow phan's SecurityCheckPlugin to perform a more accurate
analysis of taintedness, tweak the API of Linker::makeExternalLink to
clearly indicate via the type system whether the link text has already
been escaped or not: a `string` argument will always be escaped, and
if the argument is already escaped it should be passed as an HtmlArmor
object.  In refactoring, `Message` arguments were also common, and accept
them as-is to avoid the caller having to think about whether to call
Message::text() or Message::escaped().

This allows us to provide a more precise taint type to the $text argument,
avoids an opaque boolean argument, and avoids spurious errors from
SecurityCheck.

We also require the caller to explicitly pass a Title context, instead
of implicitly relying on the global $wgTitle.  This works cleanly
everywhere except for CommentParser, which has a $selfLinkTarget which
generally works as the title context for the external link, but which
is nullable.  The original Linker::makeExternalLink() used $wgTitle as
a fallback, but $wgTitle can also be null in some circumstances.  The
title context only determines how $wgNoFollowNsExceptions is handled,
so existing code basically just ignored $wgNoFollowNsExceptions when
$wgTitle was null, which isn't terrible.  A future refactor could/should
clean up CommentParser to ensure that there is always a non-null title
context that can be used.

Change-Id: I9bcf4780f388ba639a9cc882dd9dd42eda5736ae
2024-06-10 18:47:32 +00:00
..
CommentBatch.php
CommentFormatter.php Update name & email for bvibber 2024-02-08 17:02:16 -08:00
CommentItem.php
CommentParser.php Move Linker::makeExternalLink() to the LinkRenderer service 2024-06-10 18:47:32 +00:00
CommentParserFactory.php Namespace includes/cache 2024-02-20 10:28:03 -05:00
RevisionCommentBatch.php
RowCommentFormatter.php Split a base class out of CommentStore 2023-01-01 22:34:36 +00:00
RowCommentIterator.php Namespace TitleValue under \MediaWiki\Title 2023-09-18 18:24:39 +01:00
StringCommentIterator.php Get rid of warnings on PHP 8.1 2022-06-13 04:42:20 -04:00