[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 377 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
HtmlFormatter:: (14 methods):
__construct()
wrapHTML()
onHtmlReady()
getDoc()
setRemoveMedia()
remove()
flatten()
flattenAllTags()
filterContent()
removeElements()
fixLibXML()
getText()
parseSelector()
parseItemsToRemove()
Class: HtmlFormatter - X-Ref
Performs transformations of HTML by wrapping around libxml2 and working__construct( $html ) X-Ref |
Constructor param: string $html Text to process |
wrapHTML( $html ) X-Ref |
Turns a chunk of HTML into a proper document param: string $html return: string |
onHtmlReady( $html ) X-Ref |
Override this in descendant class to modify HTML after it has been converted from DOM tree param: string $html HTML to process return: string Processed HTML |
getDoc() X-Ref |
return: DOMDocument DOM to manipulate |
setRemoveMedia( $flag = true ) X-Ref |
Sets whether images/videos/sounds should be removed from output param: bool $flag |
remove( $selectors ) X-Ref |
Adds one or more selector of content to remove. A subset of CSS selector syntax is supported: <tag> <tag>.class .<class> #<id> param: array|string $selectors Selector(s) of stuff to remove |
flatten( $elements ) X-Ref |
Adds one or more element name to the list to flatten (remove tag, but not its content) Can accept undelimited regexes Note this interface may fail in surprising unexpected ways due to usage of regexes, so should not be relied on for HTML markup security measures. param: array|string $elements Name(s) of tag(s) to flatten |
flattenAllTags() X-Ref |
Instructs the formatter to flatten all tags |
filterContent() X-Ref |
Removes content we've chosen to remove. The text of the removed elements can be extracted with the getText method. return: array Array of removed DOMElements |
removeElements( $elements ) X-Ref |
No description |
fixLibXML( $html ) X-Ref |
libxml in its usual pointlessness converts many chars to entities - this function perfoms a reverse conversion param: string $html return: string |
getText( $element = null ) X-Ref |
Performs final transformations and returns resulting HTML. Note that if you want to call this both without an element and with an element you should call it without an element first. If you specify the $element in the method it'll change the underlying dom and you won't be able to get it back. param: DOMElement|string|null $element ID of element to get HTML from or return: string Processed HTML |
parseSelector( $selector, &$type, &$rawName ) X-Ref |
Helper function for parseItemsToRemove(). This function extracts the selector type and the raw name of a selector from a CSS-style selector string and assigns those values to parameters passed by reference. For example, if given '#toc' as the $selector parameter, it will assign 'ID' as the $type and 'toc' as the $rawName. param: string $selector CSS selector to parse param: string $type The type of selector (ID, CLASS, TAG_CLASS, or TAG) param: string $rawName The raw name of the selector return: bool Whether the selector was successfully recognised |
parseItemsToRemove() X-Ref |
Transforms CSS-style selectors into an internal representation suitable for processing by filterContent() return: array |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |