Wikibase
MediaWiki Wikibase extension
|
Helper for injecting text by substituting placeholders. More...
Public Member Functions | |
__construct (array $markers=[]) | |
newMarker ( $name) | |
Associates a new marker with the given parameters, and returns it. | |
getMarkers () | |
inject ( $html, $callback) | |
Replaces the markers in $html by calling $callback for each marker in $markers, passing the arguments associated with each marker to $callback. | |
Private Attributes | |
$uniqPrefix | |
$markerIndex | |
$markers | |
Helper for injecting text by substituting placeholders.
This class is designed to aid with the technique of putting placeholders into cacheable HTML (in ParserOutput), and later replacing it with non-cacheable HTML snippets (for use by OutputPage).
Wikibase\Repo\ParserOutput\TextInjector::__construct | ( | array | $markers = [] | ) |
array[] | $markers | Markers generated by another instance of TextInjector, for use by inject(); a map of string markers associated with parameter arrays. |
Wikibase\Repo\ParserOutput\TextInjector::getMarkers | ( | ) |
Wikibase\Repo\ParserOutput\TextInjector::inject | ( | $html, | |
$callback | |||
) |
Replaces the markers in $html by calling $callback for each marker in $markers, passing the arguments associated with each marker to $callback.
string | $html | |
callable | $callback |
Wikibase\Repo\ParserOutput\TextInjector::newMarker | ( | $name | ) |
Associates a new marker with the given parameters, and returns it.
All parameters passed to this function will be associated with the marker.
string | $name |
|
private |
|
private |
|
private |