This class provides sundry helpers needed by extensions.
More...
|
static | escapeWtEntities (string $text) |
| Entity-escape anything that would decode to a valid wikitext entity.
|
|
static | decodeWtEntities (string $text) |
| Decode HTML5 entities in wikitext.
|
|
static | parseMediaDimensions (SiteConfig $siteConfig, string $str, bool $onlyOne=false, bool $localized=false) |
| Parse media dimensions.
|
|
static | entityEncodeAll (string $s) |
| Encode all characters as entity references.
|
|
static | validateMediaParam (?int $num) |
| Validate media parameters More generally, this is defined by the media handler in core.
|
|
This class provides sundry helpers needed by extensions.
◆ decodeWtEntities()
static Wikimedia\Parsoid\Ext\Utils::decodeWtEntities |
( |
string | $text | ) |
|
|
static |
Decode HTML5 entities in wikitext.
NOTE that wikitext only allows semicolon-terminated entities, while HTML allows a number of "legacy" entities to be decoded without a terminating semicolon. This function deliberately does not decode these HTML-only entity forms.
- Parameters
-
- Returns
- string
◆ entityEncodeAll()
static Wikimedia\Parsoid\Ext\Utils::entityEncodeAll |
( |
string | $s | ) |
|
|
static |
Encode all characters as entity references.
This is done to make characters safe for wikitext (regardless of whether they are HTML-safe). Typically only called with single-codepoint strings.
- Parameters
-
- Returns
- string
◆ escapeWtEntities()
static Wikimedia\Parsoid\Ext\Utils::escapeWtEntities |
( |
string | $text | ) |
|
|
static |
Entity-escape anything that would decode to a valid wikitext entity.
Note that HTML5 allows certain "semicolon-less" entities, like ¶
; these aren't allowed in wikitext and won't be escaped by this function.
- Parameters
-
- Returns
- string
◆ parseMediaDimensions()
static Wikimedia\Parsoid\Ext\Utils::parseMediaDimensions |
( |
SiteConfig | $siteConfig, |
|
|
string | $str, |
|
|
bool | $onlyOne = false, |
|
|
bool | $localized = false ) |
|
static |
Parse media dimensions.
- Parameters
-
SiteConfig | $siteConfig | |
string | $str | media dimension string to parse |
bool | $onlyOne | If set, returns null if multiple dimenstions are present |
bool | $localized | Defaults to false; set to true if the $str has already been matched against img_width to localize the px suffix. |
- Returns
- array{x:int,y?:int}|null
◆ validateMediaParam()
static Wikimedia\Parsoid\Ext\Utils::validateMediaParam |
( |
?int | $num | ) |
|
|
static |
Validate media parameters More generally, this is defined by the media handler in core.
- Parameters
-
- Returns
- bool
The documentation for this class was generated from the following file: