|
MediaWiki master
|
Renders a slot diff by doing a text diff on the native representation. More...
Inherits SlotDiffRenderer.

Public Member Functions | |||||||
| getContentModel () | |||||||
| Get the content model ID that this renderer acts on. | |||||||
| getDiff (?Content $oldContent=null, ?Content $newContent=null) | |||||||
Get a diff between two content objects.One of them might be null (meaning a slot was created or removed), but both cannot be. $newContent (or if it's null then $oldContent) must have the same content model that was used to obtain this diff renderer.
| |||||||
| getExtraCacheKeys () | |||||||
Return any extra keys to split the diff cache by.
| |||||||
| getTablePrefix (IContextSource $context, Title $newTitle) | |||||||
Get the content to add above the main diff table.
| |||||||
| getTextDiff (string $oldText, string $newText) | |||||||
| Diff the text representations of two content objects (or just two pieces of text in general). | |||||||
| localizeDiff ( $diff, $options=[]) | |||||||
| setContentModel (string $contentModel) | |||||||
| setEngine ( $type, $executable=null) | |||||||
| Set which diff engine to use. | |||||||
| setFormat ( $format) | |||||||
| Set the TextDiffer format. | |||||||
| setHookContainer (HookContainer $hookContainer) | |||||||
| setInlineToggleEnabled ( $enabled=true) | |||||||
| Set a flag indicating whether the inline toggle switch is shown. | |||||||
| setLanguage (Language $language) | |||||||
| This has no effect since MW 1.41. | |||||||
| setStatsdDataFactory (IBufferingStatsdDataFactory $statsdDataFactory) | |||||||
| This has no effect since MW 1.43. | |||||||
| setStatsFactory (StatsFactory $statsFactory) | |||||||
| setTextDiffer (TextDiffer $textDiffer) | |||||||
Public Member Functions inherited from SlotDiffRenderer | |||||||
| addModules (OutputPage $output) | |||||||
| Add modules needed for correct styling/behavior of the diff. | |||||||
| localizeDiff (string $diff, array $options=[]) | |||||||
| Localize language-independent text returned by getDiff(), making it suitable for display. | |||||||
Static Public Member Functions | |
| static | diff ( $oldText, $newText, $options=[]) |
| Convenience helper to use getTextDiff without an instance. | |
Public Attributes | |
| const | ENGINE_EXTERNAL = 'external' |
| Use an external executable. | |
| const | ENGINE_PHP = 'php' |
| Use the PHP diff implementation (DiffEngine). | |
| const | ENGINE_WIKIDIFF2 = 'wikidiff2' |
| Use the wikidiff2 PHP module. | |
| const | ENGINE_WIKIDIFF2_INLINE = 'wikidiff2inline' |
| Use the wikidiff2 PHP module. | |
| const | INLINE_LEGEND_KEY = '10_mw-diff-inline-legend' |
| const | INLINE_SWITCHER_KEY = '60_mw-diff-inline-switch' |
Protected Member Functions | |
| getTextDiffInternal ( $oldText, $newText) | |
| Diff the text representations of two content objects (or just two pieces of text in general). | |
Protected Member Functions inherited from SlotDiffRenderer | |
| normalizeContents (?Content &$oldContent=null, ?Content &$newContent=null, $allowedClasses=null) | |
| Helper method to normalize the input of getDiff(). | |
Renders a slot diff by doing a text diff on the native representation.
If you want to use this without content objects (to call getTextDiff() on some non-content-related texts), obtain an instance with ContentHandlerFactory::getContentHandler( CONTENT_MODEL_TEXT ) ->getSlotDiffRenderer( RequestContext::getMain() )
Definition at line 39 of file TextSlotDiffRenderer.php.
|
static |
Convenience helper to use getTextDiff without an instance.
| string | $oldText | |
| string | $newText | |
| array | $options |
Definition at line 87 of file TextSlotDiffRenderer.php.
References CONTENT_MODEL_TEXT.
| TextSlotDiffRenderer::getContentModel | ( | ) |
Get the content model ID that this renderer acts on.
Definition at line 223 of file TextSlotDiffRenderer.php.
Get a diff between two content objects.One of them might be null (meaning a slot was created or removed), but both cannot be. $newContent (or if it's null then $oldContent) must have the same content model that was used to obtain this diff renderer.
| Content | null | $oldContent | |
| Content | null | $newContent |
Reimplemented from SlotDiffRenderer.
Definition at line 228 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::getExtraCacheKeys | ( | ) |
Return any extra keys to split the diff cache by.
Reimplemented from SlotDiffRenderer.
Definition at line 76 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::getTablePrefix | ( | IContextSource | $context, |
| Title | $newTitle ) |
Get the content to add above the main diff table.
| IContextSource | $context | |
| Title | $newTitle |
Reimplemented from SlotDiffRenderer.
Definition at line 245 of file TextSlotDiffRenderer.php.
References MediaWiki\Title\Title\getLocalURL(), MediaWiki\Context\IContextSource\getRequest(), and MessageLocalizer\msg().
| TextSlotDiffRenderer::getTextDiff | ( | string | $oldText, |
| string | $newText ) |
Diff the text representations of two content objects (or just two pieces of text in general).
| string | $oldText | |
| string | $newText |
tags, or an empty string if the inputs are identical.
Definition at line 291 of file TextSlotDiffRenderer.php.
|
protected |
Diff the text representations of two content objects (or just two pieces of text in general).
This does the actual diffing, getTextDiff() wraps it with logging and resource limiting.
| string | $oldText | |
| string | $newText |
| Exception |
Definition at line 334 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::localizeDiff | ( | $diff, | |
| $options = [] ) |
Definition at line 238 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::setContentModel | ( | string | $contentModel | ) |
| TextSlotDiffRenderer::setEngine | ( | $type, | |
| $executable = null ) |
Set which diff engine to use.
| string | $type | One of the ENGINE_* constants. |
| null | $executable | Must be null since 1.41. Previously a path to execute. |
Definition at line 148 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::setFormat | ( | $format | ) |
Set the TextDiffer format.
| string | $format |
Definition at line 191 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::setHookContainer | ( | HookContainer | $hookContainer | ) |
| HookContainer | $hookContainer |
Definition at line 130 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::setInlineToggleEnabled | ( | $enabled = true | ) |
Set a flag indicating whether the inline toggle switch is shown.
| bool | $enabled |
Definition at line 213 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::setLanguage | ( | Language | $language | ) |
This has no effect since MW 1.41.
The language is now injected via setTextDiffer().
| Language | $language |
Definition at line 121 of file TextSlotDiffRenderer.php.
References wfDeprecated().
| TextSlotDiffRenderer::setStatsdDataFactory | ( | IBufferingStatsdDataFactory | $statsdDataFactory | ) |
This has no effect since MW 1.43.
| IBufferingStatsdDataFactory | $statsdDataFactory |
Definition at line 103 of file TextSlotDiffRenderer.php.
References wfDeprecated().
| TextSlotDiffRenderer::setStatsFactory | ( | StatsFactory | $statsFactory | ) |
| StatsFactory | $statsFactory |
Definition at line 111 of file TextSlotDiffRenderer.php.
| TextSlotDiffRenderer::setTextDiffer | ( | TextDiffer | $textDiffer | ) |
Definition at line 195 of file TextSlotDiffRenderer.php.
| const TextSlotDiffRenderer::ENGINE_EXTERNAL = 'external' |
Use an external executable.
Definition at line 51 of file TextSlotDiffRenderer.php.
| const TextSlotDiffRenderer::ENGINE_PHP = 'php' |
Use the PHP diff implementation (DiffEngine).
Definition at line 42 of file TextSlotDiffRenderer.php.
| const TextSlotDiffRenderer::ENGINE_WIKIDIFF2 = 'wikidiff2' |
Use the wikidiff2 PHP module.
Definition at line 45 of file TextSlotDiffRenderer.php.
| const TextSlotDiffRenderer::ENGINE_WIKIDIFF2_INLINE = 'wikidiff2inline' |
Use the wikidiff2 PHP module.
Definition at line 48 of file TextSlotDiffRenderer.php.
| const TextSlotDiffRenderer::INLINE_LEGEND_KEY = '10_mw-diff-inline-legend' |
Definition at line 53 of file TextSlotDiffRenderer.php.
| const TextSlotDiffRenderer::INLINE_SWITCHER_KEY = '60_mw-diff-inline-switch' |
Definition at line 55 of file TextSlotDiffRenderer.php.