MediaWiki  1.34.0
TextExtracts\ExtractFormatter Class Reference

Provides text-only or limited-HTML extracts of page HTML. More...

Inheritance diagram for TextExtracts\ExtractFormatter:
Collaboration diagram for TextExtracts\ExtractFormatter:

Public Member Functions

 __construct ( $text, $plainText)
 
 filterContent ()
 Removes content we've chosen to remove then removes class and style attributes from the remaining span elements. More...
 
 getText ( $element=null)
 Performs final transformations (such as newline replacement for plaintext option) and returns resulting HTML. More...
 
 onHtmlReady ( $html)
 

Public Attributes

const SECTION_MARKER_END = "\2\1"
 
const SECTION_MARKER_START = "\1\2"
 

Private Attributes

bool $plainText
 

Detailed Description

Provides text-only or limited-HTML extracts of page HTML.

Note
GPL-2.0-or-later

Definition at line 13 of file ExtractFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

TextExtracts\ExtractFormatter::__construct (   $text,
  $plainText 
)
Parameters
string$textText to convert
bool$plainTextWhether extract should be plaintext

Definition at line 26 of file ExtractFormatter.php.

Member Function Documentation

◆ filterContent()

TextExtracts\ExtractFormatter::filterContent ( )

Removes content we've chosen to remove then removes class and style attributes from the remaining span elements.

Returns
array Array of removed DOMElements

Definition at line 82 of file ExtractFormatter.php.

◆ getText()

TextExtracts\ExtractFormatter::getText (   $element = null)

Performs final transformations (such as newline replacement for plaintext option) and returns resulting HTML.

Parameters
DOMElement | string | null$elementID of element to get HTML from. Ignored
Returns
string Processed HTML

Definition at line 47 of file ExtractFormatter.php.

◆ onHtmlReady()

TextExtracts\ExtractFormatter::onHtmlReady (   $html)
Parameters
string$htmlHTML string to process
Returns
string Processed HTML

Definition at line 66 of file ExtractFormatter.php.

Member Data Documentation

◆ $plainText

bool TextExtracts\ExtractFormatter::$plainText
private

Definition at line 20 of file ExtractFormatter.php.

◆ SECTION_MARKER_END

const TextExtracts\ExtractFormatter::SECTION_MARKER_END = "\2\1"

Definition at line 15 of file ExtractFormatter.php.

◆ SECTION_MARKER_START

const TextExtracts\ExtractFormatter::SECTION_MARKER_START = "\1\2"

Definition at line 14 of file ExtractFormatter.php.


The documentation for this class was generated from the following file: