Simplewiki  1.1
SimpleWiki Class Reference

Facade, and default method classes, macros, events and symlinks public methods. More...

Public Member Functions

constructor
 __construct ($text=NULL)
 The constructor for Simplewiki.
 
 __clone ()
 
settings methods
 allow_html ($bool=NULL)
 Get or set permission to allow html in markup.
 
 register_class_callbacks ($callbacks)
 Set callbacks for class methods.
 
 register_property_callbacks ($callbacks)
 Set callbacks for property methods.
 
 register_symlinks ($symlinks)
 Set specific symlinks for link and image markup.
 
 register_symlink_handler ($handler)
 Set symlink handler, to handle any number of symlinks.
 
 register_rawlink_handler ($handler)
 Set rawlink handler.
 
 register_charfilter_handler ($handler)
 Set charfilter handler.
 
 register_blockdef_handler ($handler)
 Set blockdef handler.
 
 register_macro_callbacks ($callbacks)
 Registers macro callbacks.
 
 register_events ($callbacks)
 Registers events.
 
operational methods
 prepare ($raw)
 Prepare the markup for processing.
 
 get_html ($markup=NULL)
 Generate html from the markup text, as passed to the constructor, or to prepare.
 
accessor methods
 parser ($parser=NULL)
 Get or set the instance of the parser used by Simplewiki.
 
 emitter ($emitter=NULL)
 Get or set the instance of the emitter used by Simplewiki.
 
 get_metadata ()
 Get metadata from prepared markup.
 
 get_markerdata ()
 Get marker data from prepared markup.
 
 get_preprocessed_markup ()
 Get markup from prepared markup.
 
standard class callbacks

Standard class callbacks are registered in the constructor (__construct) with register_class_callbacks

 callback_paragraph_nop ($node)
 Standard callback |:p nop:| (no paragraph).
 
 callback_paragraph_div ($node)
 Standard callback |:p div:| (paragraph to div).
 
 callback_code_html ($node)
 Standard callback c html% code to html.
 
 callback_blockdef_frame ($node)
 Standard callback (:div frame:) frame.
 
 callback_image_frame ($node)
 Standard callback left or right frame.
 
 callback_pre_html ($node)
 Standard callback block html.
 
 callback_span_comment ($node)
 Standard callback %s comment%...%%.
 
 callback_span_footnote ($node)
 Standard callback %s footnote%...%%.
 
 callback_span_superscript ($node)
 Standard callback %s superscript%.
 
 callback_span_subscript ($node)
 Standard callback %s subscript%.
 
 callback_link_newwin ($node)
 Standard callback %l newwin%[[...
 
standard macros
 macro_quicktoc ($node)
 quicktoc macro.
 
standard event methods
 render_footnotes ($document)
 
 auto_quicktoc ($document)
 

Protected Member Functions

 macro_quicktoc_assemble_headings ($node, $contents)
 

Protected Attributes

 $_parser
 
 $_allow_html = TRUE
 
 $_emitter
 
 $_footnotes
 
 $_footnotereferences
 
 $_working_parser
 

Detailed Description

Facade, and default method classes, macros, events and symlinks public methods.

$wiki = new SimpleWiki($markup) - create object to process markup text

note that SimpleWiki registers a number of default behaviours with SimpleWikiEmitter

Definition at line 153 of file simplewiki.php.

Constructor & Destructor Documentation

__construct (   $text = NULL)

The constructor for Simplewiki.

The constructor does the following:

  • invokes internal instances of the parser and emitter
  • registers standard callbacks, macros, and symlinks
Parameters
string$textthe markup text to be processed.
Returns
void
See Also
prepare
register_class_callbacks
register_property_callbacks
register_macro_callbacks
register_symlinks
Specific operations:

instantiate and save new parser

instantiate and save new emitter

register standard class callbacks

register standard macro callbacks

register standard symlinks

Definition at line 178 of file simplewiki.php.

Member Function Documentation

__clone ( )

Definition at line 218 of file simplewiki.php.

allow_html (   $bool = NULL)

Get or set permission to allow html in markup.

...from within "<pre>" elements.

Parameters
boolean$booltrue allows html (default), false disallows
Returns
boolean
Todo:
trace and document how allow_html is enforced

Definition at line 232 of file simplewiki.php.

auto_quicktoc (   $document)

Definition at line 876 of file simplewiki.php.

callback_blockdef_frame (   $node)

Standard callback (:div frame:) frame.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 518 of file simplewiki.php.

callback_code_html (   $node)

Standard callback c html% code to html.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 502 of file simplewiki.php.

callback_image_frame (   $node)

Standard callback left or right frame.

%i lframe%{{... or %i lframe%{{...

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 528 of file simplewiki.php.

callback_link_newwin (   $node)

Standard callback %l newwin%[[...

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 655 of file simplewiki.php.

callback_paragraph_div (   $node)

Standard callback |:p div:| (paragraph to div).

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 490 of file simplewiki.php.

callback_paragraph_nop (   $node)

Standard callback |:p nop:| (no paragraph).

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 478 of file simplewiki.php.

callback_pre_html (   $node)

Standard callback block html.

|:pre html:|{{{... pre to html.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 554 of file simplewiki.php.

callback_span_comment (   $node)

Standard callback %s comment%...%%.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 570 of file simplewiki.php.

callback_span_footnote (   $node)

Standard callback %s footnote%...%%.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 583 of file simplewiki.php.

callback_span_subscript (   $node)

Standard callback %s subscript%.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 643 of file simplewiki.php.

callback_span_superscript (   $node)

Standard callback %s superscript%.

Parameters
object$nodeclass DocNode
Returns
object DocNode

Definition at line 631 of file simplewiki.php.

emitter (   $emitter = NULL)

Get or set the instance of the emitter used by Simplewiki.

The emitter method allows the caller to set a different instance of the emitter, or to obtain the current instance of the emitter.

Parameters
$emitterobject, optional, class Emitter
See Also
Emitter

Definition at line 434 of file simplewiki.php.

get_html (   $markup = NULL)

Generate html from the markup text, as passed to the constructor, or to prepare.

See Also
__construct, prepare

Definition at line 395 of file simplewiki.php.

get_markerdata ( )

Get marker data from prepared markup.

Returns
object
See Also
Parser::markerdata

Definition at line 453 of file simplewiki.php.

get_metadata ( )

Get metadata from prepared markup.

Gets the metadata from the metadata section of the parsed markup.

Returns
object
See Also
Parser::metadata

Definition at line 445 of file simplewiki.php.

get_preprocessed_markup ( )

Get markup from prepared markup.

Returns
string
See Also
Parser::preprocessed_markup

Definition at line 461 of file simplewiki.php.

macro_quicktoc (   $node)

quicktoc macro.

enclosing div is given class 'quicktoc-platform'
to suppress heading inclusion, give header element the attribute toc=no

Definition at line 670 of file simplewiki.php.

macro_quicktoc_assemble_headings (   $node,
  $contents 
)
protected

Definition at line 784 of file simplewiki.php.

parser (   $parser = NULL)

Get or set the instance of the parser used by Simplewiki.

The parser method allows the caller to set a different instance of the parser, or to obtain the current instance of the parser.

Parameters
object$parserclass Parser
Returns
object, class Parser
See Also
Parser

Definition at line 422 of file simplewiki.php.

prepare (   $raw)

Prepare the markup for processing.

Parameters
string$raw(markup text)
Returns
object $this (so the method can be chained)

This method is a facade for the parser object (Parser), to which the markup is passed directly.

See Also
Parser::prepare

Definition at line 387 of file simplewiki.php.

register_blockdef_handler (   $handler)

Set blockdef handler.

The blockdef handler is called for any known blockdef, with a param of the blockdef node.

Parameters
method$handlertypically in the form array(objectref,'methodname')
Returns
void

Definition at line 338 of file simplewiki.php.

register_charfilter_handler (   $handler)

Set charfilter handler.

The charfilter handler is called by the emitter where normally htmlspecialchars would be applied (the default), allowing clients to substitute alternate or custom character filters.

Parameters
method$handlertypically in the form array(objectref,'methodname')
Returns
void

Definition at line 328 of file simplewiki.php.

register_class_callbacks (   $callbacks)

Set callbacks for class methods.

Parameters
array$callbacks[$nodetype][$classname]=>$methodref
$methodref is typically array(objectref,'methodname')
Returns
void

$classname can be any valid class string

Callback methods are passed a DocNode object, and are expected to manipulate and return that object

This method is a facade for the emitter object (Emitter), to which the callbacks are passed directly.

See Also
DocNode::$type for $nodetype options
Emitter::register_class_callouts

Definition at line 253 of file simplewiki.php.

register_events (   $callbacks)

Registers events.

Parameters
array$callbacksin the form [$eventname]=>$methodref
$methodref is typically array(objectref,'methodname')
Returns
void

$eventname can be 'onemit' or 'onafteremit'

$event callbacks are handed a DocNode object, and are expected to manipulate and return that object.

This method is a facade for the emitter object (Emitter), to which the callbacks are passed directly.

See Also
Emitter::register_events

Definition at line 372 of file simplewiki.php.

register_macro_callbacks (   $callbacks)

Registers macro callbacks.

Parameters
array$callbacksin the form [$macroname]=>$methodref
$methodref is typically array(objectref,'methodname')
Returns
void

$macro callbacks are handed a DocNode object, and are expected to manipulate and return that object.

This method is a facade for the emitter object (Emitter), to which the callbacks are passed directly.

See Also
Emitter::register_macro_callouts

Definition at line 354 of file simplewiki.php.

register_property_callbacks (   $callbacks)

Set callbacks for property methods.

Parameters
array$callbacks[$nodetype][$propertyname]=>$methodref
$methodref is typically array(objectref,'methodname')
Returns
void

$propertyname can be any valid class string

Callback methods are passed a DocNode object, and are expected to manipulate and return that object

This method is a facade for the emitter object (Emitter), to which the callbacks are passed directly.

See Also
DocNode::$type for $nodetype options
Emitter::register_property_callouts

Definition at line 273 of file simplewiki.php.

register_rawlink_handler (   $handler)

Set rawlink handler.

The rawlink handler is called for any links that are not anchors, external links (with recognized prototcol), or symlinks.

Parameters
method$handlertypically in the form array(objectref,'methodname')
Returns
void

Definition at line 317 of file simplewiki.php.

register_symlink_handler (   $handler)

Set symlink handler, to handle any number of symlinks.

Parameters
method$handlertypically in the form array(objectref,'methodname')
Returns
void

$handler is handed a DocNode object, and is expected to manipulate and return that object.

This method is a facade for the emitter object (Emitter), to which the callbacks are passed directly.

See Also
register_symlinks
Emitter::register_symlink_handler

Definition at line 307 of file simplewiki.php.

register_symlinks (   $symlinks)

Set specific symlinks for link and image markup.

Parameters
array$symlinks[$symlink]=>$value
$value should be an absolute or relative html link (href/src)
Returns
void

$symlink can be any string of letters with a leading uppercase letter.

This method is a facade for the emitter object (Emitter), to which the callbacks are passed directly.

See Also
register_symlink_handler
Emitter::register_symlinks

Definition at line 290 of file simplewiki.php.

render_footnotes (   $document)

Definition at line 820 of file simplewiki.php.

Field Documentation

$_allow_html = TRUE
protected

Definition at line 156 of file simplewiki.php.

$_emitter
protected

Definition at line 157 of file simplewiki.php.

$_footnotereferences
protected

Definition at line 159 of file simplewiki.php.

$_footnotes
protected

Definition at line 158 of file simplewiki.php.

$_parser
protected

Definition at line 155 of file simplewiki.php.

$_working_parser
protected

Definition at line 160 of file simplewiki.php.


The documentation for this class was generated from the following file: