Helper for injecting text by substituting placeholders.
More...
|
| __construct (array $markers=[]) |
|
| newMarker ( $name) |
| Associates a new marker with the given parameters, and returns it. More...
|
|
| 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. More...
|
|
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).
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
◆ __construct()
Wikibase\Repo\ParserOutput\TextInjector::__construct |
( |
array |
$markers = [] | ) |
|
- Parameters
-
array[] | $markers | Markers generated by another instance of TextInjector, for use by inject(); a map of string markers associated with parameter arrays. |
◆ getMarkers()
Wikibase\Repo\ParserOutput\TextInjector::getMarkers |
( |
| ) |
|
- Returns
- array[] Array mapping marker names to arrays of callback arguments.
◆ inject()
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.
- Parameters
-
string | $html | |
callable | $callback | |
- Returns
- string HTML
◆ newMarker()
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.
- Parameters
-
- Returns
- string
◆ $markerIndex
Wikibase\Repo\ParserOutput\TextInjector::$markerIndex |
|
private |
◆ $markers
Wikibase\Repo\ParserOutput\TextInjector::$markers |
|
private |
◆ $uniqPrefix
Wikibase\Repo\ParserOutput\TextInjector::$uniqPrefix |
|
private |
The documentation for this class was generated from the following file: