[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/parser/ -> Preprocessor.php (summary)

Interfaces for preprocessors This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 344 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

Preprocessor:: (5 methods):
  __construct()
  newFrame()
  newCustomFrame()
  newPartNodeArray()
  preprocessToObj()

PPFrame:: (19 methods):
  newChild()
  cachedExpand()
  expand()
  implodeWithFlags()
  implode()
  virtualImplode()
  virtualBracketedImplode()
  isEmpty()
  getArguments()
  getNumberedArguments()
  getNamedArguments()
  getArgument()
  loopCheck()
  isTemplate()
  setVolatile()
  isVolatile()
  getTTL()
  setTTL()
  getTitle()

PPNode:: (10 methods):
  getChildren()
  getFirstChild()
  getNextSibling()
  getChildrenOfType()
  getLength()
  item()
  getName()
  splitArg()
  splitExt()
  splitHeading()


Interface: Preprocessor  - X-Ref


__construct( $parser )   X-Ref
Create a new preprocessor object based on an initialised Parser object

param: Parser $parser

newFrame()   X-Ref
Create a new top-level frame for expansion of a page

return: PPFrame

newCustomFrame( $args )   X-Ref
Create a new custom frame for programmatic use of parameter replacement
as used in some extensions.

param: array $args
return: PPFrame

newPartNodeArray( $values )   X-Ref
Create a new custom node for programmatic use of parameter replacement
as used in some extensions.

param: array $values

preprocessToObj( $text, $flags = 0 )   X-Ref
Preprocess text to a PPNode

param: string $text
param: int $flags
return: PPNode

Interface: PPFrame  - X-Ref


newChild( $args = false, $title = false, $indexOffset = 0 )   X-Ref
Create a child frame

param: array|bool $args
param: bool|Title $title
param: int $indexOffset A number subtracted from the index attributes of the arguments
return: PPFrame

cachedExpand( $key, $root, $flags = 0 )   X-Ref
Expand a document tree node, caching the result on its parent with the given key

param: string|int $key
param: string|PPNode $root
param: int $flags
return: string

expand( $root, $flags = 0 )   X-Ref
Expand a document tree node

param: string|PPNode $root
param: int $flags
return: string

implodeWithFlags( $sep, $flags )   X-Ref
Implode with flags for expand()

param: string $sep
param: int $flags
param: string|PPNode $args,...
return: string

implode( $sep )   X-Ref
Implode with no flags specified

param: string $sep
param: string|PPNode $args,...
return: string

virtualImplode( $sep )   X-Ref
Makes an object that, when expand()ed, will be the same as one obtained
with implode()

param: string $sep
param: string|PPNode $args,...
return: PPNode

virtualBracketedImplode( $start, $sep, $end )   X-Ref
Virtual implode with brackets

param: string $start
param: string $sep
param: string $end
param: string|PPNode $args,...
return: PPNode

isEmpty()   X-Ref
Returns true if there are no arguments in this frame

return: bool

getArguments()   X-Ref
Returns all arguments of this frame

return: array

getNumberedArguments()   X-Ref
Returns all numbered arguments of this frame

return: array

getNamedArguments()   X-Ref
Returns all named arguments of this frame

return: array

getArgument( $name )   X-Ref
Get an argument to this frame by name

param: string $name
return: bool

loopCheck( $title )   X-Ref
Returns true if the infinite loop check is OK, false if a loop is detected

param: Title $title
return: bool

isTemplate()   X-Ref
Return true if the frame is a template frame

return: bool

setVolatile( $flag = true )   X-Ref
Set the "volatile" flag.

Note that this is somewhat of a "hack" in order to make extensions
with side effects (such as Cite) work with the PHP parser. New
extensions should be written in a way that they do not need this
function, because other parsers (such as Parsoid) are not guaranteed
to respect it, and it may be removed in the future.

param: bool $flag

isVolatile()   X-Ref
Get the "volatile" flag.

Callers should avoid caching the result of an expansion if it has the
volatile flag set.

return: bool

getTTL()   X-Ref
Get the TTL of the frame's output.

This is the maximum amount of time, in seconds, that this frame's
output should be cached for. A value of null indicates that no
maximum has been specified.

Note that this TTL only applies to caching frames as parts of pages.
It is not relevant to caching the entire rendered output of a page.

return: int|null

setTTL( $ttl )   X-Ref
Set the TTL of the output of this frame and all of its ancestors.
Has no effect if the new TTL is greater than the one already set.
Note that it is the caller's responsibility to change the cache
expiry of the page as a whole, if such behavior is desired.

param: int $ttl

getTitle()   X-Ref
Get a title of frame

return: Title

Interface: PPNode  - X-Ref

There are three types of nodes:
* Tree nodes, which have a name and contain other nodes as children
* Array nodes, which also contain other nodes but aren't considered part of a tree
* Leaf nodes, which contain the actual data

This interface provides access to the tree structure and to the contents of array nodes,
but it does not provide access to the internal structure of leaf nodes. Access to leaf
data is provided via two means:
* PPFrame::expand(), which provides expanded text
* The PPNode::split*() functions, which provide metadata about certain types of tree node
getChildren()   X-Ref
Get an array-type node containing the children of this node.
Returns false if this is not a tree node.

return: PPNode

getFirstChild()   X-Ref
Get the first child of a tree node. False if there isn't one.

return: PPNode

getNextSibling()   X-Ref
Get the next sibling of any node. False if there isn't one

return: PPNode

getChildrenOfType( $type )   X-Ref
Get all children of this tree node which have a given name.
Returns an array-type node, or false if this is not a tree node.

param: string $type
return: bool|PPNode

getLength()   X-Ref
Returns the length of the array, or false if this is not an array-type node


item( $i )   X-Ref
Returns an item of an array-type node

param: int $i
return: bool|PPNode

getName()   X-Ref
Get the name of this node. The following names are defined here:

h             A heading node.
template      A double-brace node.
tplarg        A triple-brace node.
title         The first argument to a template or tplarg node.
part          Subsequent arguments to a template or tplarg node.
#nodelist     An array-type node

The subclass may define various other names for tree and leaf nodes.
return: string

splitArg()   X-Ref
Split a "<part>" node into an associative array containing:
name          PPNode name
index         String index
value         PPNode value

return: array

splitExt()   X-Ref
Split an "<ext>" node into an associative array containing name, attr, inner and close
All values in the resulting array are PPNodes. Inner and close are optional.

return: array

splitHeading()   X-Ref
Split an "<h>" node

return: array



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1