Simplewiki 1

Muster_SimpleWiki_Emitter Class Reference

$emitter = new SimpleWiki_Emitter() - create new instance of emitter
$html = $emitter->emit($dom); see Muster_SimpleWiki_DocNode for docnode type documentation. More...

Public Member Functions

Property accessors
 symlinks ()
 returns registered symlinks
 symlink_handler ()
 returns registered symlink handler
 blocktags ($blocktaglist=NULL)
 get or set collection of block declarations recognized by emitter
Register callouts

Clients register callouts for classes, macros, symlinks, and events. All callbacks are passed nodes

 register_events ($callbacks)
 ['event']=>'methodref'.
 register_symlinks ($symlinks)
 [$symlink]=>$value.
 register_symlink_handler ($handler)
 Default handler for symlinks not registered: array($objectref,'methodname').
 register_charfilter_handler ($handler)
 Handler for rawlinks: array($objectref,'methodname').
 register_rawlink_handler ($handler)
 Handler for rawlinks: array($objectref,'methodname').
 register_class_callouts ($callouts)
 [$nodetype][$classname]=>$methodref.
 register_property_callouts ($callouts)
 [$nodetype][$propertyname]=>$methodref.
 register_macro_callouts ($callouts)
 [$macroname]=>$methodref.
 register_blockdef_handler ($handler)
 Handler for block definitions: array($objectref,'methodname').

Protected Member Functions

Invoke callouts
 expand_symlink ($node)
 triggered from prepare_link_node.
 expand_rawlink ($node)
 triggered from prepare_link_node.
 call_macro ($node)
 triggered from prepare_macro.
 call_classes ($node)
 triggered from prepare_node.
 call_properties ($node)
 triggered from prepare_node.
 call_event ($event, $node)
 triggered from _document_emit
Support methods
 prepare_image_node ($node)
 interpret address, inlcuding symlink; prepare src, alt, title attributes.
 prepare_link_node ($node)
 identify anchor for special handling; prepare attributes - name, href, title.
 prepare_macro_node ($node)
 trigger callouts; prepare output property
 prepare_node ($node)
 Standard data preparation for emitting html.
 standard_assembly ($node)
 Assembles and returns standard node html components.
 char_filter ($text, $node=NULL)
 Filters text with htmlspecialchars($text) by default.
Node emitters
 _document_emit ($node)
 emit html for document.
 _paragraph_emit ($node)
 emit html for paragraph.
 _text_emit ($node)
 emit html for text node.
 _heading_emit ($node)
 emit html for heading.
 _emphasis_emit ($node)
 emit html for emphasis.
 _strong_emit ($node)
 emit html for strong.
 _linebreak_emit ($node)
 emit html for linebreak.
 _horizontalrule_emit ($node)
 emit html for horizontalrule.
 _link_emit ($node)
 emit html for link.
 _image_emit ($node)
 emit html for image.
 _def_list_emit ($node)
 emit html for definition list.
 _def_term_emit ($node)
 emit html for definition term.
 _def_desc_emit ($node)
 emit html for definition description.
 _ordered_list_emit ($node)
 emit html for ordered list.
 _unordered_list_emit ($node)
 emit html for unordered list.
 _list_item_emit ($node)
 emit html for list item.
 _table_emit ($node)
 emit html for table.
 _table_row_emit ($node)
 emit html for table row.
 _table_headcell_emit ($node)
 emit html for table head cell.
 _table_cell_emit ($node)
 emit html for table data cell.
 _span_emit ($node)
 emit html for span.
 _blockdivider_emit ($node)
 emit html for block divider.
 _code_emit ($node)
 emit html for code.
 _preformatted_emit ($node)
 emit html for preformatted.
 _blockdef_emit ($node)
 emit html for blockdef.
 _macro_emit ($node)
 emit html for macro.

Protected Attributes

Data properties
 $_dom
 document object model, through the root node
 $_rules
 regex rules combined into applied regular expressions
 $_link_re
 link regular expressions, external link, symlink, and anchor
 $_image_re
 image link regular expressions, external link and symlink
 $_blocktags
 supported block tags
Registered data
 $_class_callouts = array()
 [$nodetype][$classname]=>$methodref
 $_property_callouts = array()
 [$nodetype][$propertyname]=>$methodref
 $_macro_callouts = array()
 [$macroname]=>$methodref
 $_symlinks = array()
 [$symlink]=>$value
 $_symlink_handler
 array($objectref,'methodname')
 $_rawlink_handler
 array($objectref,'methodname')
 $_charfilter_handler
 array($objectref,'methodname')
 $_events = array()
 ['event']=>'methodref'
 $_blockdef_handler
 array($objectref,'methodname')

Creation

 __construct ()
 The constructor.
 set_rules ()
 Sets rules used in the class.
 set_re ($rules)
 Sets the regelar expressions applied.

Control methods

 emit ($dom)
 generate html from the passed document object model.
 emit_children ($node)
 collects and returns html for chilren.
 emit_node_text ($node)
 text only, no html or other markup.
 emit_node ($node)
 controller directs flow to one of the node emit methods.
 emit_children_text ($node)
 supports emit_node_text.

Detailed Description

$emitter = new SimpleWiki_Emitter() - create new instance of emitter
$html = $emitter->emit($dom); see Muster_SimpleWiki_DocNode for docnode type documentation.

Author:
copyright (c) Henrik Bechmann, 2009-2012, Toronto, Canada. All rights reserved. simplewiki.org Licence: BSD, see licence.txt
Version:
1.0
Date:
February 9, 2012
See also:
Muster_SimpleWiki_DocNode (constants) for documentation on properties of the individual docnode types.

Definition at line 17 of file muster_simplewiki_emitter.php.


Constructor & Destructor Documentation

__construct ( )

The constructor.

Sets regex rules, and combines them into applied regex. No parameters.

Returns:
void

Definition at line 64 of file muster_simplewiki_emitter.php.


Member Function Documentation

_blockdef_emit ( node) [protected]

emit html for blockdef.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 976 of file muster_simplewiki_emitter.php.

_blockdivider_emit ( node) [protected]

emit html for block divider.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 930 of file muster_simplewiki_emitter.php.

_code_emit ( node) [protected]

emit html for code.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 944 of file muster_simplewiki_emitter.php.

_def_desc_emit ( node) [protected]

emit html for definition description.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 807 of file muster_simplewiki_emitter.php.

_def_list_emit ( node) [protected]

emit html for definition list.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 781 of file muster_simplewiki_emitter.php.

_def_term_emit ( node) [protected]

emit html for definition term.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 794 of file muster_simplewiki_emitter.php.

_document_emit ( node) [protected]

emit html for document.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 596 of file muster_simplewiki_emitter.php.

_emphasis_emit ( node) [protected]

emit html for emphasis.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 647 of file muster_simplewiki_emitter.php.

_heading_emit ( node) [protected]

emit html for heading.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 634 of file muster_simplewiki_emitter.php.

_horizontalrule_emit ( node) [protected]

emit html for horizontalrule.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 671 of file muster_simplewiki_emitter.php.

_image_emit ( node) [protected]

emit html for image.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 742 of file muster_simplewiki_emitter.php.

_linebreak_emit ( node) [protected]

emit html for linebreak.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 663 of file muster_simplewiki_emitter.php.

_link_emit ( node) [protected]

emit html for link.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 680 of file muster_simplewiki_emitter.php.

_list_item_emit ( node) [protected]

emit html for list item.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 848 of file muster_simplewiki_emitter.php.

_macro_emit ( node) [protected]

emit html for macro.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 1019 of file muster_simplewiki_emitter.php.

_ordered_list_emit ( node) [protected]

emit html for ordered list.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 820 of file muster_simplewiki_emitter.php.

_paragraph_emit ( node) [protected]

emit html for paragraph.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 611 of file muster_simplewiki_emitter.php.

_preformatted_emit ( node) [protected]

emit html for preformatted.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 959 of file muster_simplewiki_emitter.php.

_span_emit ( node) [protected]

emit html for span.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 916 of file muster_simplewiki_emitter.php.

_strong_emit ( node) [protected]

emit html for strong.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 655 of file muster_simplewiki_emitter.php.

_table_cell_emit ( node) [protected]

emit html for table data cell.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 901 of file muster_simplewiki_emitter.php.

_table_emit ( node) [protected]

emit html for table.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 862 of file muster_simplewiki_emitter.php.

_table_headcell_emit ( node) [protected]

emit html for table head cell.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 888 of file muster_simplewiki_emitter.php.

_table_row_emit ( node) [protected]

emit html for table row.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 875 of file muster_simplewiki_emitter.php.

_text_emit ( node) [protected]

emit html for text node.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 624 of file muster_simplewiki_emitter.php.

_unordered_list_emit ( node) [protected]

emit html for unordered list.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 835 of file muster_simplewiki_emitter.php.

blocktags ( blocktaglist = NULL)

get or set collection of block declarations recognized by emitter

Definition at line 172 of file muster_simplewiki_emitter.php.

call_classes ( node) [protected]

triggered from prepare_node.

Returns:
object modified document node
See also:
prepare_node

Definition at line 353 of file muster_simplewiki_emitter.php.

call_event ( event,
node 
) [protected]

triggered from _document_emit

Parameters:
string$eventthe event being triggered
object$nodethe current document node
Returns:
object modified document node
See also:
_document_edit

Definition at line 404 of file muster_simplewiki_emitter.php.

call_macro ( node) [protected]

triggered from prepare_macro.

Parameters:
object$nodethe current document node
Returns:
object modified document node
See also:
prepare_macro

Definition at line 339 of file muster_simplewiki_emitter.php.

call_properties ( node) [protected]

triggered from prepare_node.

Parameters:
object$nodethe current document node
Returns:
object modified document node
See also:
prepare_node

Definition at line 378 of file muster_simplewiki_emitter.php.

char_filter ( text,
node = NULL 
) [protected]

Filters text with htmlspecialchars($text) by default.

But allows substitution of alternate or custom character filters.

Definition at line 578 of file muster_simplewiki_emitter.php.

emit ( dom)

generate html from the passed document object model.

Parameters:
object$domthe root node of the document object model for which html is being emitted.
Returns:
string html

Definition at line 107 of file muster_simplewiki_emitter.php.

emit_children ( node)

collects and returns html for chilren.

Can be useful for registered method classes, macros and events, so it is public.

Parameters:
object$node
Returns:
html

Definition at line 125 of file muster_simplewiki_emitter.php.

emit_children_text ( node) [protected]

supports emit_node_text.

text only, no html or other markup, helpful for registrants.

See also:
emit_node_text

Definition at line 148 of file muster_simplewiki_emitter.php.

emit_node ( node) [protected]

controller directs flow to one of the node emit methods.

Parameters:
object$node
Returns:
html

Definition at line 116 of file muster_simplewiki_emitter.php.

emit_node_text ( node)

text only, no html or other markup.

Can be helpful for registrants, so it is public.

Definition at line 138 of file muster_simplewiki_emitter.php.

expand_rawlink ( node) [protected]

triggered from prepare_link_node.

Parameters:
object$nodethe current document node
Returns:
object modified document node
See also:
prepare_link_node

Definition at line 324 of file muster_simplewiki_emitter.php.

expand_symlink ( node) [protected]

triggered from prepare_link_node.

Parameters:
object$nodethe current document node
Returns:
object modified document node
See also:
prepare_link_node

Definition at line 306 of file muster_simplewiki_emitter.php.

prepare_image_node ( node) [protected]

interpret address, inlcuding symlink; prepare src, alt, title attributes.

Then call standard prepare_node

Parameters:
object$nodethe current document node
Returns:
object modified document node
See also:
prepare_node

Definition at line 428 of file muster_simplewiki_emitter.php.

prepare_link_node ( node) [protected]

identify anchor for special handling; prepare attributes - name, href, title.

Then call standard prepare_node

Parameters:
object$node
Returns:
object modified document node
See also:
prepare_node

Definition at line 471 of file muster_simplewiki_emitter.php.

prepare_macro_node ( node) [protected]

trigger callouts; prepare output property

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 515 of file muster_simplewiki_emitter.php.

prepare_node ( node) [protected]

Standard data preparation for emitting html.

trigger class and property callouts; prepare attributes, classes, and styles for HTML by combining into single attribute array

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 531 of file muster_simplewiki_emitter.php.

register_blockdef_handler ( handler)

Handler for block definitions: array($objectref,'methodname').

$param methodref $handler normally array($object,'methodname')

Definition at line 294 of file muster_simplewiki_emitter.php.

register_charfilter_handler ( handler)

Handler for rawlinks: array($objectref,'methodname').

Definition at line 219 of file muster_simplewiki_emitter.php.

register_class_callouts ( callouts)

[$nodetype][$classname]=>$methodref.

Typically called by SimpleWiki (as facade). One callback per type class.

Definition at line 233 of file muster_simplewiki_emitter.php.

register_events ( callbacks)

['event']=>'methodref'.

Definition at line 186 of file muster_simplewiki_emitter.php.

register_macro_callouts ( callouts)

[$macroname]=>$methodref.

Typically called by SimpleWiki (as facade).

Definition at line 280 of file muster_simplewiki_emitter.php.

register_property_callouts ( callouts)

[$nodetype][$propertyname]=>$methodref.

Typically called by SimpleWiki (as facade). One callback per type class.

Definition at line 257 of file muster_simplewiki_emitter.php.

register_rawlink_handler ( handler)

Handler for rawlinks: array($objectref,'methodname').

Definition at line 226 of file muster_simplewiki_emitter.php.

register_symlink_handler ( handler)

Default handler for symlinks not registered: array($objectref,'methodname').

Definition at line 212 of file muster_simplewiki_emitter.php.

register_symlinks ( symlinks)

[$symlink]=>$value.

Definition at line 201 of file muster_simplewiki_emitter.php.

set_re ( rules) [protected]

Sets the regelar expressions applied.

_link_re for link addresses; _image_re for image addresses (excludes anchors)

Definition at line 96 of file muster_simplewiki_emitter.php.

set_rules ( ) [protected]

Sets rules used in the class.

lists prototypes, sets regex for external url's, symlinks, and anchors

Definition at line 73 of file muster_simplewiki_emitter.php.

standard_assembly ( node) [protected]

Assembles and returns standard node html components.

opentag_head, node attributes, opentag_tail, elementcontent, and closetag.

Parameters:
object$nodedocument node
Returns:
object modified document node

Definition at line 570 of file muster_simplewiki_emitter.php.

symlink_handler ( )

returns registered symlink handler

Definition at line 167 of file muster_simplewiki_emitter.php.

symlinks ( )

returns registered symlinks

Definition at line 162 of file muster_simplewiki_emitter.php.


Field Documentation

$_blockdef_handler [protected]

array($objectref,'methodname')

Definition at line 56 of file muster_simplewiki_emitter.php.

$_blocktags [protected]
Initial value:
 
                array
                (
                        'div', 'blockquote', # division, blockquote
                        'table', 'thead', 'tbody', 'tr', 'td', 'th', 'tfoot', 'caption', # table
                        'ul', 'ol', 'li', 'dl', 'dt', 'dd', # lists
                        'dlmodule','dlwidget','dlsettings','dlmarker' #dlml
                )

supported block tags

Definition at line 29 of file muster_simplewiki_emitter.php.

$_charfilter_handler [protected]

array($objectref,'methodname')

Definition at line 52 of file muster_simplewiki_emitter.php.

$_class_callouts = array() [protected]

[$nodetype][$classname]=>$methodref

Definition at line 40 of file muster_simplewiki_emitter.php.

$_dom [protected]

document object model, through the root node

Definition at line 21 of file muster_simplewiki_emitter.php.

$_events = array() [protected]

['event']=>'methodref'

Definition at line 54 of file muster_simplewiki_emitter.php.

$_image_re [protected]

image link regular expressions, external link and symlink

Definition at line 27 of file muster_simplewiki_emitter.php.

$_link_re [protected]

link regular expressions, external link, symlink, and anchor

Definition at line 25 of file muster_simplewiki_emitter.php.

$_macro_callouts = array() [protected]

[$macroname]=>$methodref

Definition at line 44 of file muster_simplewiki_emitter.php.

$_property_callouts = array() [protected]

[$nodetype][$propertyname]=>$methodref

Definition at line 42 of file muster_simplewiki_emitter.php.

$_rawlink_handler [protected]

array($objectref,'methodname')

Definition at line 50 of file muster_simplewiki_emitter.php.

$_rules [protected]

regex rules combined into applied regular expressions

Definition at line 23 of file muster_simplewiki_emitter.php.

$_symlink_handler [protected]

array($objectref,'methodname')

Definition at line 48 of file muster_simplewiki_emitter.php.

$_symlinks = array() [protected]

[$symlink]=>$value

Definition at line 46 of file muster_simplewiki_emitter.php.


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