|
MediaWiki REL1_39
|
This is the main service interface for converting single-line comments from various DB comment fields into HTML. More...


Public Member Functions | |
| __construct (CommentParserFactory $parserFactory) | |
| createBatch () | |
| Format comments using a fluent interface. | |
| createRevisionBatch () | |
| Format a batch of revision comments using a fluent interface. | |
| format (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false) | |
| Format a single comment. | |
| formatBlock (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false, $useParentheses=true) | |
| Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return an empty string. | |
| formatItems ( $items) | |
| Format an iterator over CommentItem objects. | |
| formatItemsInternal ( $items, $selfLinkTarget=null, $samePage=null, $wikiId=null, $enableSectionLinks=null, $useBlock=null, $useParentheses=null) | |
| formatLinks (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false) | |
| Format links in a comment, ignoring section links in C-style comments. | |
| formatLinksUnsafe (string $comment, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false) | |
| Format a comment, passing through HTML in the input to the output. | |
| formatRevision (RevisionRecord $revision, Authority $authority, $samePage=false, $isPublic=false, $useParentheses=true) | |
| Wrap and format the given revision's comment block, if the specified user is allowed to view it. | |
| formatRevisions ( $revisions, Authority $authority, $samePage=false, $isPublic=false, $useParentheses=true, $indexById=false) | |
| Format multiple revision comments. | |
| formatStrings ( $strings, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false) | |
| Format comments which are provided as strings and all have the same self-link target and other options. | |
| formatStringsAsBlock ( $strings, LinkTarget $selfLinkTarget=null, $samePage=false, $wikiId=false, $useParentheses=true) | |
| Given an array of comments as strings which all have the same self link target, format the comments and wrap them in standard punctuation and formatting. | |
Protected Member Functions | |
| wrapCommentWithBlock ( $formatted, $useParentheses) | |
| Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string. | |
Protected Attributes | |
| CommentParserFactory | $parserFactory |
This is the main service interface for converting single-line comments from various DB comment fields into HTML.
Definition at line 16 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::__construct | ( | CommentParserFactory | $parserFactory | ) |
| CommentParserFactory | $parserFactory |
Definition at line 25 of file CommentFormatter.php.
References MediaWiki\CommentFormatter\CommentFormatter\$parserFactory.
| MediaWiki\CommentFormatter\CommentFormatter::createBatch | ( | ) |
Format comments using a fluent interface.
Definition at line 34 of file CommentFormatter.php.
Referenced by MediaWiki\CommentFormatter\RowCommentFormatter\formatRows().
| MediaWiki\CommentFormatter\CommentFormatter::createRevisionBatch | ( | ) |
Format a batch of revision comments using a fluent interface.
Definition at line 280 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::format | ( | string | $comment, |
| LinkTarget | $selfLinkTarget = null, | ||
| $samePage = false, | |||
| $wikiId = false ) |
Format a single comment.
Similar to the old Linker::formatComment().
| string | $comment | |
| LinkTarget | null | $selfLinkTarget | The title used for fragment-only and section links, formerly $title. |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| string | false | null | $wikiId | ID of the wiki to link to (if not the local wiki), as used by WikiMap. |
Definition at line 50 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatBlock | ( | string | $comment, |
| LinkTarget | $selfLinkTarget = null, | ||
| $samePage = false, | |||
| $wikiId = false, | |||
| $useParentheses = true ) |
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return an empty string.
| string | $comment | |
| LinkTarget | null | $selfLinkTarget | The title used for fragment-only and section links, formerly $title. |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| string | false | null | $wikiId | ID of the wiki to link to (if not the local wiki), as used by WikiMap. |
| bool | $useParentheses |
Definition at line 71 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatItems | ( | $items | ) |
Format an iterator over CommentItem objects.
A shortcut for createBatch()->comments()->execute() for when you need to pass no other options.
| iterable<CommentItem>|Traversable | $items |
Definition at line 293 of file CommentFormatter.php.
References MediaWiki\CommentFormatter\CommentFormatter\formatItemsInternal().
| MediaWiki\CommentFormatter\CommentFormatter::formatItemsInternal | ( | $items, | |
| $selfLinkTarget = null, | |||
| $samePage = null, | |||
| $wikiId = null, | |||
| $enableSectionLinks = null, | |||
| $useBlock = null, | |||
| $useParentheses = null ) |
Format comments with nullable batch options.
| iterable<CommentItem> | $items | |
| LinkTarget | null | $selfLinkTarget | |
| bool | null | $samePage | |
| string | false | null | $wikiId | |
| bool | null | $enableSectionLinks | |
| bool | null | $useBlock | |
| bool | null | $useParentheses |
Definition at line 311 of file CommentFormatter.php.
References MediaWiki\CommentFormatter\CommentFormatter\wrapCommentWithBlock().
Referenced by MediaWiki\CommentFormatter\CommentFormatter\formatItems().
| MediaWiki\CommentFormatter\CommentFormatter::formatLinks | ( | string | $comment, |
| LinkTarget | $selfLinkTarget = null, | ||
| $samePage = false, | |||
| $wikiId = false ) |
Format links in a comment, ignoring section links in C-style comments.
| string | $comment | |
| LinkTarget | null | $selfLinkTarget | The title used for fragment-only and section links, formerly $title. |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| string | false | null | $wikiId | ID of the wiki to link to (if not the local wiki), as used by WikiMap. |
Definition at line 117 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatLinksUnsafe | ( | string | $comment, |
| LinkTarget | $selfLinkTarget = null, | ||
| $samePage = false, | |||
| $wikiId = false ) |
Format a comment, passing through HTML in the input to the output.
This is unsafe and exists only for backwards compatibility with Linker::formatLinksInComment().
In new code, use formatLinks() or createBatch()->disableSectionLinks().
| string | $comment | |
| LinkTarget | null | $selfLinkTarget | The title used for fragment-only and section links, formerly $title. |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| string | false | null | $wikiId | ID of the wiki to link to (if not the local wiki), as used by WikiMap. |
Definition at line 96 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatRevision | ( | RevisionRecord | $revision, |
| Authority | $authority, | ||
| $samePage = false, | |||
| $isPublic = false, | |||
| $useParentheses = true ) |
Wrap and format the given revision's comment block, if the specified user is allowed to view it.
This method produces HTML that requires CSS styles in mediawiki.interface.helpers.styles.
NOTE: revision comments are special. This is not the same as getting a revision comment as a string and then formatting it with format().
| RevisionRecord | $revision | The revision to extract the comment and title from. The title should always be populated, to avoid an additional DB query. |
| Authority | $authority | The user viewing the comment |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| bool | $isPublic | Show only if all users can see it |
| bool | $useParentheses | Whether the comment is wrapped in parentheses |
Definition at line 227 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatRevisions | ( | $revisions, | |
| Authority | $authority, | ||
| $samePage = false, | |||
| $isPublic = false, | |||
| $useParentheses = true, | |||
| $indexById = false ) |
Format multiple revision comments.
| iterable<RevisionRecord> | $revisions | |
| Authority | $authority | |
| bool | $samePage | |
| bool | $isPublic | |
| bool | $useParentheses | |
| bool | $indexById |
Definition at line 252 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatStrings | ( | $strings, | |
| LinkTarget | $selfLinkTarget = null, | ||
| $samePage = false, | |||
| $wikiId = false ) |
Format comments which are provided as strings and all have the same self-link target and other options.
If you need a different title for each comment, use createBatch().
| string[] | $strings | |
| LinkTarget | null | $selfLinkTarget | The title used for fragment-only and section links, formerly $title. |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| string | false | null | $wikiId | ID of the wiki to link to (if not the local wiki), as used by WikiMap. |
Definition at line 167 of file CommentFormatter.php.
| MediaWiki\CommentFormatter\CommentFormatter::formatStringsAsBlock | ( | $strings, | |
| LinkTarget | $selfLinkTarget = null, | ||
| $samePage = false, | |||
| $wikiId = false, | |||
| $useParentheses = true ) |
Given an array of comments as strings which all have the same self link target, format the comments and wrap them in standard punctuation and formatting.
If you need a different title for each comment, use createBatch().
| string[] | $strings | |
| LinkTarget | null | $selfLinkTarget | The title used for fragment-only and section links, formerly $title. |
| bool | $samePage | If true, self links are rendered with a fragment- only URL. Formerly $local. |
| string | false | null | $wikiId | ID of the wiki to link to (if not the local wiki), as used by WikiMap. |
| bool | $useParentheses |
Definition at line 195 of file CommentFormatter.php.
References MediaWiki\CommentFormatter\CommentFormatter\wrapCommentWithBlock().
|
protected |
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty string.
| string | $formatted | |
| bool | $useParentheses | Whether the comment is wrapped in parentheses |
Definition at line 345 of file CommentFormatter.php.
References wfMessage().
Referenced by MediaWiki\CommentFormatter\CommentFormatter\formatItemsInternal(), and MediaWiki\CommentFormatter\CommentFormatter\formatStringsAsBlock().
|
protected |
Definition at line 18 of file CommentFormatter.php.
Referenced by MediaWiki\CommentFormatter\CommentFormatter\__construct().