ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Public Member Functions | |
__construct () | |
#- More... | |
firstCallInit () | |
Do various kinds of initialisation on the first call of the parser. More... | |
clearState () | |
Clear Parser state. More... | |
setOutputType ($ot) | |
uniqPrefix () | |
Accessor for mUniqPrefix. More... | |
parse ($text, &$title, $options, $linestart=true, $clearState=true, $revid=null) | |
Convert wikitext to HTML Do not call this function recursively. More... | |
recursiveTagParse ($text) | |
Recursive parser entry point that can be called from an extension tag hook. More... | |
preprocess ($text, $title, $options) | |
Expand templates and variables in the text, producing valid, static wikitext. More... | |
& | getTitle () |
getOptions () | |
getFunctionLang () | |
strip ($text, $state, $stripcomments=false, $dontstrip=array()) | |
Strips and renders nowiki, pre, math, hiero If $render is set, performs necessary rendering operations on plugins Returns the text, and fills an array with data needed in unstrip() More... | |
unstrip ($text, $state) | |
Restores pre, math, and other extensions removed by strip() More... | |
unstripNoWiki ($text, $state) | |
Always call this after unstrip() to preserve the order. More... | |
unstripForHTML ($text) | |
insertStripItem ($text, &$state) | |
Add an item to the strip state Returns the unique tag which must be inserted into the stripped text The tag will be replaced with the original text in unstrip() More... | |
doTableStuff ($text) | |
parse the wiki syntax used to render tables More... | |
internalParse ($text) | |
Helper function for parse() that transforms wiki markup into HTML. More... | |
& | doMagicLinks (&$text) |
Replace special strings like "ISBN xxx" and "RFC xxx" with magic external links. More... | |
magicLinkCallback ($m) | |
doHeadings ($text) | |
Parse headers and return html. More... | |
doAllQuotes ($text) | |
Replace single quotes with HTML markup. More... | |
doQuotes ($text) | |
Helper function for doAllQuotes() More... | |
replaceExternalLinks ($text) | |
Replace external links. More... | |
replaceFreeExternalLinks ($text) | |
Replace anything that looks like a URL with a link. More... | |
maybeMakeExternalImage ($url) | |
make an image if it's allowed, either through the global option or through the exception More... | |
replaceInternalLinks ($s) | |
Process [[ ]] wikilinks. More... | |
makeLinkHolder (&$nt, $text='', $query='', $trail='', $prefix='') | |
Make a link placeholder. More... | |
makeKnownLinkHolder ($nt, $text='', $query='', $trail='', $prefix='') | |
Render a forced-blue link inline; protect against double expansion of URLs if we're in a mode that prepends full URL prefixes to internal links. More... | |
armorLinks ($text) | |
Insert a NOPARSE hacky thing into any inline links in a chunk that's going to go through further parsing steps before inline URL expansion. More... | |
areSubpagesAllowed () | |
Return true if subpage links should be expanded on this page. More... | |
maybeDoSubpageLink ($target, &$text) | |
Handle link to subpage if necessary. More... | |
closeParagraph () | |
#+ Used by doBlockLevels() More... | |
getCommon ($st1, $st2) | |
openList ($char) | |
nextItem ($char) | |
closeList ($char) | |
doBlockLevels ($text, $linestart) | |
#- More... | |
findColonNoLinks ($str, &$before, &$after) | |
Split up a string on ':', ignoring any occurences inside tags to prevent illegal overlapping. More... | |
getVariableValue ($index) | |
Return value of a magic variable (like PAGENAME) More... | |
initialiseVariables () | |
initialise the magic variables (like CURRENTMONTHNAME) More... | |
replace_callback ($text, $callbacks) | |
parse any parentheses in format ((title|part|part)) and call callbacks to get a replacement text for any found piece More... | |
replaceVariables ($text, $args=array(), $argsOnly=false) | |
Replace magic variables, templates, and template arguments with the appropriate text. More... | |
variableSubstitution ($matches) | |
Replace magic variables. More... | |
braceSubstitution ($piece) | |
Return the text of a template, after recursively replacing any variables or templates within the template. More... | |
fetchTemplate ($title) | |
Fetch the unparsed text of a template and register a reference to it. More... | |
interwikiTransclude ($title, $action) | |
Transclude an interwiki link. More... | |
fetchScaryTemplateMaybeFromCache ($url) | |
argSubstitution ($matches) | |
Triple brace replacement – used for template arguments. More... | |
incrementIncludeSize ($type, $size) | |
Increment an include size counter. More... | |
stripNoGallery (&$text) | |
Detect NOGALLERY magic word and set a placeholder. More... | |
stripToc ($text) | |
Detect TOC magic word and set a placeholder. More... | |
formatHeadings ($text, $isMain=true) | |
This function accomplishes several tasks: 1) Auto-number headings if that option is enabled 2) Add an [edit] link to sections for logged in users who have enabled the option 3) Add a Table of contents on the top for users who have enabled the option 4) Auto-anchor headings. More... | |
preSaveTransform ($text, &$title, $user, $options, $clearState=true) | |
Transform wiki markup when saving a page by doing -> conversion, substitting signatures, {{subst:}} templates, etc. More... | |
pstPass2 ($text, &$stripState, $user) | |
Pre-save transform helper function. More... | |
getUserSig (&$user) | |
Fetch the user's signature text, if any, and normalize to validated, ready-to-insert wikitext. More... | |
validateSig ($text) | |
Check that the user's signature contains no bad XML. More... | |
cleanSig ($text, $parsing=false) | |
Clean up signature text. More... | |
cleanSigInSig ($text) | |
Strip ~~~, ~~~~ and ~~~~~ out of signatures. More... | |
startExternalParse (&$title, $options, $outputType, $clearState=true) | |
Set up some variables which are usually set up in parse() so that an external function can call some class members with confidence. More... | |
transformMsg ($text, $options) | |
Transform a MediaWiki message by replacing magic variables. More... | |
setHook ($tag, $callback) | |
Create an HTML-style tag, e.g. More... | |
setFunctionHook ($id, $callback, $flags=0) | |
Create a function, e.g. More... | |
getFunctionHooks () | |
Get all registered function hook identifiers. More... | |
replaceLinkHolders (&$text, $options=0) | |
Replace link placeholders with actual links, in the buffer Placeholders created in Skin::makeLinkObj() Returns an array of links found, indexed by PDBK: 0 - broken 1 - normal link 2 - stub $options is a bit field, RLH_FOR_UPDATE to select for update. More... | |
replaceLinkHoldersText ($text) | |
Replace link placeholders with plain text of links (not HTML-formatted). More... | |
replaceLinkHoldersTextCallback ($matches) | |
renderPreTag ($text, $attribs) | |
Tag hook handler for 'pre'. More... | |
renderImageGallery ($text, $params) | |
Renders an image gallery from a text with one line per image. More... | |
makeImage ($nt, $options) | |
Parse image options text and use it to make an image. More... | |
disableCache () | |
Set a flag in the output object indicating that the content is dynamic and shouldn't be cached. More... | |
attributeStripCallback (&$text, $args) | |
#+ Callback from the Sanitizer for expanding items found in HTML attribute values, so they can be safely tested and escaped. More... | |
Title ($x=null) | |
#- More... | |
Options ($x=null) | |
OutputType ($x=null) | |
getTags () | |
#- More... | |
getSection ($text, $section, $deftext='') | |
This function returns the text of a section, specified by a number ($section). More... | |
replaceSection ($oldtext, $section, $text) | |
getRevisionTimestamp () | |
Get the timestamp associated with the current revision, adjusted for the default server-local timestamp. More... | |
setDefaultSort ($sort) | |
Mutator for $mDefaultSort. More... | |
getDefaultSort () | |
Accessor for $mDefaultSort Will use the title/prefixed title if none is set. More... | |
Static Public Member Functions | |
getRandomString () | |
Get a random string. More... | |
extractTagsAndParams ($elements, $text, &$matches, $uniq_prefix='') | |
Replaces all occurrences of HTML-style comments and the given tags in the text with a random marker and returns teh next text. More... | |
tidy ($text) | |
Interface with html tidy, used if $wgUseTidy = true. More... | |
externalTidy ($text) | |
Spawn an external HTML tidy process and get corrected markup back from it. More... | |
internalTidy ($text) | |
Use the HTML tidy PECL extension to use the tidy library in-process, saving the overhead of spawning a new process. More... | |
static | replaceUnusualEscapes ($url) |
Replace unusual URL escape codes with their equivalent characters. More... | |
static | createAssocArgs ($args) |
Clean up argument array - refactored in 1.9 so parserfunctions can use it, too. More... | |
Private Member Functions | |
extractSections ($text, $section, $mode, $newtext='') | |
#- More... | |
Static Private Member Functions | |
static | replaceUnusualEscapesCallback ($matches) |
Callback function used in replaceUnusualEscapes(). More... | |
Definition at line 90 of file Parser.php.
Parser::__construct | ( | ) |
Parser::areSubpagesAllowed | ( | ) |
Return true if subpage links should be expanded on this page.
Definition at line 1990 of file Parser.php.
Referenced by magicLinkCallback().
Parser::argSubstitution | ( | $matches | ) |
Triple brace replacement – used for template arguments.
Definition at line 3494 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::armorLinks | ( | $text | ) |
Insert a NOPARSE hacky thing into any inline links in a chunk that's going to go through further parsing steps before inline URL expansion.
In particular this is important when using action=render, which causes full URLs to be included.
Oh man I hate our multi-layer parser!
string | more-or-less HTML |
Definition at line 1977 of file Parser.php.
Referenced by magicLinkCallback().
Parser::attributeStripCallback | ( | & | $text, |
$args | |||
) |
#+ Callback from the Sanitizer for expanding items found in HTML attribute values, so they can be safely tested and escaped.
string | $text | |
array | $args |
Definition at line 4712 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::braceSubstitution | ( | $piece | ) |
Return the text of a template, after recursively replacing any variables or templates within the template.
array | $piece | The parts of the template $piece['text']: matched text $piece['title']: the title, i.e. the part before the | $piece['parts']: the parameter array |
Definition at line 3038 of file Parser.php.
Referenced by createAssocArgs().
Parser::cleanSig | ( | $text, | |
$parsing = false |
|||
) |
Clean up signature text.
1) Strip ~~~, ~~~~ and ~~~~~ out of signatures
string | $text | |
$parsing | Whether we're cleaning (preferences save) or parsing |
Definition at line 3984 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::cleanSigInSig | ( | $text | ) |
Strip ~~~, ~~~~ and ~~~~~ out of signatures.
string | $text |
Definition at line 4006 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::clearState | ( | ) |
Clear Parser state.
Prefix for temporary replacement strings for the multipass parser. should never appear in input as it's disallowed in XML. Using it at the front also gives us a little extra robustness since it shouldn't match when butted up against identifier-like string constructs.
Definition at line 211 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache(), and setOutputType().
Parser::closeList | ( | $char | ) |
Definition at line 2145 of file Parser.php.
References $i, $id, $index, $mRevisionId, $output, $ret, $rule, $state, $t, $text, array, closeParagraph(), date, doBlockLevels(), findColonNoLinks(), getCommon(), getRevisionTimestamp(), getVariableValue(), images, initialiseVariables(), MW_COLON_STATE_CLOSETAG, MW_COLON_STATE_COMMENT, MW_COLON_STATE_COMMENTDASH, MW_COLON_STATE_COMMENTDASHDASH, MW_COLON_STATE_TAG, MW_COLON_STATE_TAGSLASH, MW_COLON_STATE_TAGSTART, MW_COLON_STATE_TEXT, nextItem(), openList(), OT_MSG, OT_WIKI, replace_callback(), replaceVariables(), time, and variableSubstitution().
Parser::closeParagraph | ( | ) |
#+ Used by doBlockLevels()
Definition at line 2074 of file Parser.php.
Referenced by closeList(), magicLinkCallback(), and openList().
|
static |
Clean up argument array - refactored in 1.9 so parserfunctions can use it, too.
Definition at line 3004 of file Parser.php.
References $action, $function, $i, $index, $m, $message, $mTemplatePath, $name, $result, $text, $title, $url, array, braceSubstitution(), disableCache(), fetchScaryTemplateMaybeFromCache(), fetchTemplate(), incrementIncludeSize(), insertStripItem(), interwikiTransclude(), is, maybeDoSubpageLink(), Title\newFromRedirect(), Title\newFromText(), NS_SPECIAL, Sanitizer\removeHTMLcomments(), Sanitizer\removeHTMLtags(), replaceVariables(), strip(), to, variableSubstitution(), and wfMsg().
Parser::disableCache | ( | ) |
Set a flag in the output object indicating that the content is dynamic and shouldn't be cached.
Definition at line 4698 of file Parser.php.
Referenced by createAssocArgs(), and fetchScaryTemplateMaybeFromCache().
Parser::doAllQuotes | ( | $text | ) |
Replace single quotes with HTML markup.
Definition at line 1176 of file Parser.php.
Referenced by magicLinkCallback().
Parser::doBlockLevels | ( | $text, | |
$linestart | |||
) |
#-
Make lists from lines starting with ':', '*', '#', etc.
Definition at line 2171 of file Parser.php.
Referenced by closeList(), and setOutputType().
Parser::doHeadings | ( | $text | ) |
Parse headers and return html.
Definition at line 1155 of file Parser.php.
Referenced by magicLinkCallback().
& Parser::doMagicLinks | ( | & | $text | ) |
Replace special strings like "ISBN xxx" and "RFC xxx" with magic external links.
Definition at line 1091 of file Parser.php.
Parser::doQuotes | ( | $text | ) |
Helper function for doAllQuotes()
Definition at line 1194 of file Parser.php.
Referenced by magicLinkCallback().
Parser::doTableStuff | ( | $text | ) |
parse the wiki syntax used to render tables
Definition at line 843 of file Parser.php.
|
static |
Spawn an external HTML tidy process and get corrected markup back from it.
Definition at line 765 of file Parser.php.
|
private |
#-
Break wikitext input into sections, and either pull or replace some particular section's text.
External callers should use the getSection and replaceSection methods.
$text | Page wikitext |
$section | Numbered section. 0 pulls the text before the first heading; other numbers will pull the given section along with its lower-level subsections. |
$mode | One of "get" or "replace" |
$newtext | Replacement text for section data. |
Definition at line 4763 of file Parser.php.
Referenced by replaceSection().
|
static |
Replaces all occurrences of HTML-style comments and the given tags in the text with a random marker and returns teh next text.
The output parameter $matches will be an associative array filled with data in the form: 'UNIQ-xxxxx' => array( 'element', 'tag content', array( 'param' => 'x' ), '<element param="x">tag content</element>' ) )
$elements | list of element names. Comments are always extracted. |
$text | Source text string. |
$uniq_prefix |
Definition at line 490 of file Parser.php.
Parser::fetchScaryTemplateMaybeFromCache | ( | $url | ) |
Definition at line 3459 of file Parser.php.
References $alignments, $current, $d, $html, $i, $id, $key, $m, $options, $params, $query, $res, $s, $size, $t, $tag, $text, $time, $title, $type, $url, $x, argSubstitution(), array, attributeStripCallback(), cleanSig(), cleanSigInSig(), clearState(), date, disableCache(), Sanitizer\escapeId(), formatHeadings(), getFunctionHooks(), getUserSig(), incrementIncludeSize(), makeImage(), Title\makeName(), Title\makeTitle(), Title\newFromDBkey(), Title\newFromText(), OT_HTML, OT_MSG, OT_PREPROCESS, OT_WIKI, parse(), preSaveTransform(), pstPass2(), renderImageGallery(), renderPreTag(), replaceInternalLinks(), replaceLinkHolders(), replaceLinkHoldersText(), replaceLinkHoldersTextCallback(), replaceVariables(), RLH_FOR_UPDATE, setFunctionHook(), setHook(), setOutputType(), SFH_NO_HASH, startExternalParse(), strip(), Sanitizer\stripAllTags(), stripNoGallery(), stripToc(), time, Title(), transformMsg(), validateSig(), Sanitizer\validateTagAttributes(), and wfMsg().
Referenced by createAssocArgs().
Parser::fetchTemplate | ( | $title | ) |
Fetch the unparsed text of a template and register a reference to it.
Definition at line 3411 of file Parser.php.
Referenced by createAssocArgs().
Parser::findColonNoLinks | ( | $str, | |
& | $before, | ||
& | $after | ||
) |
Split up a string on ':', ignoring any occurences inside tags to prevent illegal overlapping.
string | $str | the string to split |
string | &$before | set to everything before the ':' |
string | &$after | set to everything after the ':' return string the position of the ':', or false if none found |
Definition at line 2344 of file Parser.php.
Referenced by closeList().
Parser::firstCallInit | ( | ) |
Do various kinds of initialisation on the first call of the parser.
Definition at line 156 of file Parser.php.
Parser::formatHeadings | ( | $text, | |
$isMain = true |
|||
) |
This function accomplishes several tasks: 1) Auto-number headings if that option is enabled 2) Add an [edit] link to sections for logged in users who have enabled the option 3) Add a Table of contents on the top for users who have enabled the option 4) Auto-anchor headings.
It loops through all headlines, collects the necessary data, then splits up the string and re-inserts the newly formatted headlines.
string | $text | |
boolean | $isMain |
Definition at line 3582 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::getCommon | ( | $st1, | |
$st2 | |||
) |
Definition at line 2087 of file Parser.php.
References $i.
Referenced by closeList().
Parser::getDefaultSort | ( | ) |
Accessor for $mDefaultSort Will use the title/prefixed title if none is set.
Definition at line 4947 of file Parser.php.
Referenced by magicLinkCallback(), and replaceSection().
Parser::getFunctionHooks | ( | ) |
Get all registered function hook identifiers.
Definition at line 4150 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::getFunctionLang | ( | ) |
Definition at line 466 of file Parser.php.
Parser::getOptions | ( | ) |
Definition at line 461 of file Parser.php.
|
static |
Parser::getRevisionTimestamp | ( | ) |
Get the timestamp associated with the current revision, adjusted for the default server-local timestamp.
Definition at line 4899 of file Parser.php.
Referenced by closeList(), and replaceSection().
Parser::getSection | ( | $text, | |
$section, | |||
$deftext = '' |
|||
) |
This function returns the text of a section, specified by a number ($section).
A section is text under a heading like == Heading == or <h1>Heading</h1>, or the first section before any such heading (section 0).
If a section contains subsections, these are also returned.
$text | String: text to look in |
$section | Integer: section number |
$deftext | default to return if section is not found |
Definition at line 4885 of file Parser.php.
Parser::getTags | ( | ) |
& Parser::getTitle | ( | ) |
Definition at line 457 of file Parser.php.
Parser::getUserSig | ( | & | $user | ) |
Fetch the user's signature text, if any, and normalize to validated, ready-to-insert wikitext.
User | $user |
Definition at line 3937 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::getVariableValue | ( | $index | ) |
Return value of a magic variable (like PAGENAME)
Some of these require message or data lookups and can be expensive to check many times.
Definition at line 2506 of file Parser.php.
Referenced by closeList().
Parser::incrementIncludeSize | ( | $type, | |
$size | |||
) |
Increment an include size counter.
string | $type | The type of expansion |
integer | $size | The size of the text |
Definition at line 3521 of file Parser.php.
Referenced by createAssocArgs(), and fetchScaryTemplateMaybeFromCache().
Parser::initialiseVariables | ( | ) |
initialise the magic variables (like CURRENTMONTHNAME)
Definition at line 2704 of file Parser.php.
Referenced by closeList().
Parser::insertStripItem | ( | $text, | |
& | $state | ||
) |
Add an item to the strip state Returns the unique tag which must be inserted into the stripped text The tag will be replaced with the original text in unstrip()
Definition at line 720 of file Parser.php.
Referenced by createAssocArgs().
Parser::internalParse | ( | $text | ) |
Helper function for parse() that transforms wiki markup into HTML.
Only called for $mOutputType == OT_HTML.
Definition at line 1032 of file Parser.php.
Referenced by setOutputType().
|
static |
Use the HTML tidy PECL extension to use the tidy library in-process, saving the overhead of spawning a new process.
Currently written to the PHP 4.3.x version of the extension, may not work on PHP 5.
'pear install tidy' should be able to compile the extension module.
Definition at line 817 of file Parser.php.
Parser::interwikiTransclude | ( | $title, | |
$action | |||
) |
Transclude an interwiki link.
Definition at line 3443 of file Parser.php.
Referenced by createAssocArgs().
Parser::magicLinkCallback | ( | $m | ) |
Definition at line 1112 of file Parser.php.
References $h, $i, $id, $img, $m, $output, GuzzleHttp\Psr7\$protocol, $query, $r, $result, $ret, $s, $state, $target, $text, $url, areSubpagesAllowed(), armorLinks(), array, Sanitizer\cleanUrl(), closeParagraph(), Sanitizer\decodeCharReferences(), doAllQuotes(), doHeadings(), doQuotes(), EXT_IMAGE_REGEX, EXT_LINK_BRACKETED, EXT_LINK_URL_CLASS, getDefaultSort(), image, is, Title\legalChars(), makeImage(), makeKnownLinkHolder(), makeLinkHolder(), maybeDoSubpageLink(), maybeMakeExternalImage(), Title\newFromText(), NS_SPECIAL, replaceExternalLinks(), replaceFreeExternalLinks(), replaceInternalLinks(), replaceUnusualEscapes(), replaceUnusualEscapesCallback(), to, top, wfMsg(), and wfUrlProtocols().
Parser::makeImage | ( | $nt, | |
$options | |||
) |
Parse image options text and use it to make an image.
Definition at line 4598 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache(), and magicLinkCallback().
Parser::makeKnownLinkHolder | ( | $nt, | |
$text = '' , |
|||
$query = '' , |
|||
$trail = '' , |
|||
$prefix = '' |
|||
) |
Render a forced-blue link inline; protect against double expansion of URLs if we're in a mode that prepends full URL prefixes to internal links.
Since this little disaster has to split off the trail text to avoid breaking URLs in the following text without breaking trails on the wiki links, it's been made into a horrible function.
Title | $nt | |
string | $text | |
string | $query | |
string | $trail | |
string | $prefix |
Definition at line 1957 of file Parser.php.
Referenced by magicLinkCallback().
Parser::makeLinkHolder | ( | & | $nt, |
$text = '' , |
|||
$query = '' , |
|||
$trail = '' , |
|||
$prefix = '' |
|||
) |
Make a link placeholder.
The text returned can be later resolved to a real link with replaceLinkHolders(). This is done for two reasons: firstly to avoid further parsing of interwiki links, and secondly to allow all existence checks and article length checks (for stub links) to be bundled into a single query.
Definition at line 1915 of file Parser.php.
Referenced by magicLinkCallback().
Parser::maybeDoSubpageLink | ( | $target, | |
& | $text | ||
) |
Handle link to subpage if necessary.
string | $target | the source of the link |
string | &$text | the link text, modified as necessary |
Definition at line 2004 of file Parser.php.
Referenced by createAssocArgs(), and magicLinkCallback().
Parser::maybeMakeExternalImage | ( | $url | ) |
make an image if it's allowed, either through the global option or through the exception
Definition at line 1589 of file Parser.php.
Referenced by magicLinkCallback().
Parser::nextItem | ( | $char | ) |
Definition at line 2125 of file Parser.php.
Referenced by closeList().
Parser::openList | ( | $char | ) |
Definition at line 2105 of file Parser.php.
References $result, and closeParagraph().
Referenced by closeList().
Parser::Options | ( | $x = null | ) |
Definition at line 4728 of file Parser.php.
Parser::OutputType | ( | $x = null | ) |
Definition at line 4732 of file Parser.php.
Parser::parse | ( | $text, | |
& | $title, | ||
$options, | |||
$linestart = true , |
|||
$clearState = true , |
|||
$revid = null |
|||
) |
Convert wikitext to HTML Do not call this function recursively.
string | $text | Text we want to parse |
Title | &$title | A title object |
array | $options | |
boolean | $linestart | |
boolean | $clearState | |
int | $revid | number to pass in {{REVISIONID}} |
First pass–just handle <nowiki> sections, pass the rest off to internalParse() which does all the real work.
Definition at line 298 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache(), and setOutputType().
Parser::preprocess | ( | $text, | |
$title, | |||
$options | |||
) |
Expand templates and variables in the text, producing valid, static wikitext.
Also removes comments.
Definition at line 427 of file Parser.php.
Parser::preSaveTransform | ( | $text, | |
& | $title, | ||
$user, | |||
$options, | |||
$clearState = true |
|||
) |
Transform wiki markup when saving a page by doing
->
conversion, substitting signatures, {{subst:}} templates, etc.
string | $text | the text to transform |
Title | &$title | the Title object for the current article |
User | &$user | the User object describing the current user |
ParserOptions | $options | parsing options |
bool | $clearState | whether to clear the parser state first |
Definition at line 3839 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::pstPass2 | ( | $text, | |
& | $stripState, | ||
$user | |||
) |
Pre-save transform helper function.
Definition at line 3864 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::recursiveTagParse | ( | $text | ) |
Recursive parser entry point that can be called from an extension tag hook.
Definition at line 412 of file Parser.php.
Parser::renderImageGallery | ( | $text, | |
$params | |||
) |
Renders an image gallery from a text with one line per image.
text labels may be given by using |-style alternative text. E.g. Image:one.jpg|The number "1" Image:tree.jpg|A tree given as text will return the HTML of a gallery with two images, labeled 'The number "1"' and 'A tree'.
Definition at line 4529 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::renderPreTag | ( | $text, | |
$attribs | |||
) |
Tag hook handler for 'pre'.
Definition at line 4509 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::replace_callback | ( | $text, | |
$callbacks | |||
) |
parse any parentheses in format ((title|part|part)) and call callbacks to get a replacement text for any found piece
string | $text | The text to parse |
array | $callbacks | rules in form: '{' => array( # opening parentheses 'end' => '}', # closing parentheses 'cb' => array(2 => callback, # replacement callback to call if {{..}} is found 3 => callback # replacement callback to call if {{{..}}} is found ) ) 'min' => 2, # Minimum parenthesis count in cb 'max' => 3, # Maximum parenthesis count in cb |
Definition at line 2734 of file Parser.php.
Referenced by closeList().
Parser::replaceExternalLinks | ( | $text | ) |
Replace external links.
Note: this is all very hackish and the order of execution matters a lot. Make sure to run maintenance/parserTests.php if you change this code.
Definition at line 1380 of file Parser.php.
Referenced by magicLinkCallback().
Parser::replaceFreeExternalLinks | ( | $text | ) |
Replace anything that looks like a URL with a link.
Definition at line 1466 of file Parser.php.
Referenced by magicLinkCallback().
Parser::replaceInternalLinks | ( | $s | ) |
Process [[ ]] wikilinks.
Strip the whitespace Category links produce, see bug 87
Definition at line 1610 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache(), and magicLinkCallback().
Parser::replaceLinkHolders | ( | & | $text, |
$options = 0 |
|||
) |
Replace link placeholders with actual links, in the buffer Placeholders created in Skin::makeLinkObj() Returns an array of links found, indexed by PDBK: 0 - broken 1 - normal link 2 - stub $options is a bit field, RLH_FOR_UPDATE to select for update.
Definition at line 4164 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache(), and setOutputType().
Parser::replaceLinkHoldersText | ( | $text | ) |
Replace link placeholders with plain text of links (not HTML-formatted).
string | $text |
Definition at line 4470 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::replaceLinkHoldersTextCallback | ( | $matches | ) |
array | $matches |
Definition at line 4490 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::replaceSection | ( | $oldtext, | |
$section, | |||
$text | |||
) |
Definition at line 4890 of file Parser.php.
References $mDefaultSort, $mRevisionTimestamp, $section, $text, $timestamp, array, extractSections(), getDefaultSort(), getRevisionTimestamp(), and setDefaultSort().
|
static |
Replace unusual URL escape codes with their equivalent characters.
string |
Definition at line 1554 of file Parser.php.
Referenced by magicLinkCallback().
|
staticprivate |
Callback function used in replaceUnusualEscapes().
Replaces unusual URL escape codes with their equivalent character
Definition at line 1569 of file Parser.php.
Referenced by magicLinkCallback().
Parser::replaceVariables | ( | $text, | |
$args = array() , |
|||
$argsOnly = false |
|||
) |
Replace magic variables, templates, and template arguments with the appropriate text.
Templates are substituted recursively, taking care to avoid infinite loops.
Note that the substitution depends on value of $mOutputType: OT_WIKI: only {{subst:}} templates OT_MSG: only magic variables OT_HTML: all templates and magic variables
string | $tex | The text to transform |
array | $args | Key-value pairs representing template parameters to substitute |
bool | $argsOnly | Only do argument (triple-brace) expansion, not double-brace expansion |
Definition at line 2921 of file Parser.php.
Referenced by closeList(), createAssocArgs(), and fetchScaryTemplateMaybeFromCache().
Parser::setDefaultSort | ( | $sort | ) |
Mutator for $mDefaultSort.
$sort | New value |
Definition at line 4936 of file Parser.php.
Referenced by replaceSection().
Parser::setFunctionHook | ( | $id, | |
$callback, | |||
$flags = 0 |
|||
) |
Create a function, e.g.
{{sum:1|2|3}} The callback function should have the form: function myParserFunction( &$parser, $arg1, $arg2, $arg3 ) { ... }
The callback may either return the text result of the function, or an array with the text in element 0, and a number of flags in the other elements. The names of the flags are specified in the keys. Valid flags are: found The text returned is valid, stop processing the template. This is on by default. nowiki Wiki markup in the return value should be escaped noparse Unsafe HTML tags should not be stripped, etc. noargs Don't replace triple-brace arguments in the return value isHTML The returned text is HTML, armour it against wikitext transformation
string | $id | The magic word ID |
mixed | $callback | The callback function (and object) to use |
integer | $flags | a combination of the following flags: SFH_NO_HASH No leading hash, i.e. {{plural:...}} instead of {{if:...}} |
Definition at line 4113 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::setHook | ( | $tag, | |
$callback | |||
) |
Create an HTML-style tag, e.g.
<yourtag>special text</yourtag> The callback should have the following form: function myParserHook( $text, $params, &$parser ) { ... }
Transform and return $text. Use $parser for any required context, e.g. use $parser->getTitle() and $parser->getOptions() not $wgTitle or $wgOut->mParserOptions
mixed | $tag | The tag to use, e.g. 'hook' for <hook> |
mixed | $callback | The callback function (and object) to use for the tag |
Definition at line 4080 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::setOutputType | ( | $ot | ) |
Definition at line 264 of file Parser.php.
References $mRevisionId, $mRevisionTimestamp, $mUniqPrefix, $options, $ot, $text, $title, array, clearState(), doBlockLevels(), expand(), ILIAS\FileDelivery\http(), internalParse(), is, Sanitizer\normalizeCharReferences(), OT_HTML, OT_MSG, OT_PREPROCESS, OT_WIKI, parse(), replaceLinkHolders(), strip(), tidy(), uniqPrefix(), and up().
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::startExternalParse | ( | & | $title, |
$options, | |||
$outputType, | |||
$clearState = true |
|||
) |
Set up some variables which are usually set up in parse() so that an external function can call some class members with confidence.
Definition at line 4017 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::strip | ( | $text, | |
$state, | |||
$stripcomments = false , |
|||
$dontstrip = array() |
|||
) |
Strips and renders nowiki, pre, math, hiero If $render is set, performs necessary rendering operations on plugins Returns the text, and fills an array with data needed in unstrip()
StripState | $state | |
bool | $stripcomments | when set, HTML comments will be stripped in addition to other tags. This is important for section editing, where these comments cause confusion when counting the sections in the wikisource |
array | dontstrip contains tags which should not be stripped; used to prevent stipping of <gallery> when saving (fixes bug 2700) |
Definition at line 570 of file Parser.php.
Referenced by createAssocArgs(), fetchScaryTemplateMaybeFromCache(), and setOutputType().
Parser::stripNoGallery | ( | & | $text | ) |
Detect NOGALLERY magic word and set a placeholder.
Definition at line 3534 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::stripToc | ( | $text | ) |
Detect TOC magic word and set a placeholder.
Definition at line 3545 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
|
static |
Interface with html tidy, used if $wgUseTidy = true.
If tidy isn't able to correct the markup, the original will be returned in all its glory with a warning comment appended.
Either the external tidy program or the in-process tidy extension will be used depending on availability. Override the default $wgTidyInternal setting to disable the internal if it's not working.
string | $text | Hideous HTML input |
Definition at line 741 of file Parser.php.
Referenced by setOutputType().
Parser::Title | ( | $x = null | ) |
#-
#+ Accessor/mutator
Definition at line 4724 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::transformMsg | ( | $text, | |
$options | |||
) |
Transform a MediaWiki message by replacing magic variables.
string | $text | the text to transform |
ParserOptions | $options | options |
Definition at line 4035 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::uniqPrefix | ( | ) |
Accessor for mUniqPrefix.
Definition at line 281 of file Parser.php.
Referenced by setOutputType().
Parser::unstrip | ( | $text, | |
$state | |||
) |
Restores pre, math, and other extensions removed by strip()
always call unstripNoWiki() after this one
Definition at line 689 of file Parser.php.
Parser::unstripForHTML | ( | $text | ) |
Parser::unstripNoWiki | ( | $text, | |
$state | |||
) |
Always call this after unstrip() to preserve the order.
Definition at line 700 of file Parser.php.
Parser::validateSig | ( | $text | ) |
Check that the user's signature contains no bad XML.
string | $text |
Definition at line 3969 of file Parser.php.
Referenced by fetchScaryTemplateMaybeFromCache().
Parser::variableSubstitution | ( | $matches | ) |
Replace magic variables.
Definition at line 2968 of file Parser.php.
Referenced by closeList(), and createAssocArgs().
Parser::$mArgStack |
Definition at line 108 of file Parser.php.
Parser::$mAutonumber |
Definition at line 104 of file Parser.php.
Parser::$mDefaultSort |
Definition at line 115 of file Parser.php.
Referenced by replaceSection().
Parser::$mDTopen |
Definition at line 105 of file Parser.php.
Parser::$mFunctionHooks |
Definition at line 98 of file Parser.php.
Parser::$mFunctionSynonyms |
Definition at line 99 of file Parser.php.
Parser::$mIncludeCount |
Definition at line 107 of file Parser.php.
Parser::$mIncludeSizes |
Definition at line 114 of file Parser.php.
Parser::$mInPre |
Definition at line 110 of file Parser.php.
Parser::$mInterwikiLinkHolders |
Definition at line 111 of file Parser.php.
Parser::$mLastSection |
Definition at line 109 of file Parser.php.
Parser::$mLinkHolders |
Definition at line 112 of file Parser.php.
Parser::$mOptions |
Definition at line 124 of file Parser.php.
Parser::$mOutput |
Definition at line 103 of file Parser.php.
Parser::$mOutputType |
Definition at line 128 of file Parser.php.
Parser::$mRevIdForTs |
Definition at line 136 of file Parser.php.
Parser::$mRevisionId |
Definition at line 132 of file Parser.php.
Referenced by closeList(), and setOutputType().
Parser::$mRevisionTimestamp |
Definition at line 134 of file Parser.php.
Referenced by replaceSection(), and setOutputType().
Parser::$mStripState |
Definition at line 106 of file Parser.php.
Parser::$mTagHooks |
#+
Definition at line 97 of file Parser.php.
Parser::$mTemplatePath |
Definition at line 119 of file Parser.php.
Referenced by createAssocArgs().
Parser::$mTemplates |
Definition at line 116 of file Parser.php.
Parser::$mTitle |
Definition at line 126 of file Parser.php.
Parser::$mUniqPrefix |
Definition at line 113 of file Parser.php.
Referenced by setOutputType().
Parser::$mVariables |
Definition at line 100 of file Parser.php.
Parser::$ot |
Definition at line 130 of file Parser.php.
Referenced by setOutputType().
const Parser::VERSION = MW_PARSER_VERSION |
Definition at line 92 of file Parser.php.