Simplewiki  1.1
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.

Version
1.1
Date
October 22, 2012
See Also
Muster_SimpleWiki_DocNode (constants) for documentation on properties of the individual docnode types.

Definition at line 23 of file emitter.php.

Constructor & Destructor Documentation

__construct ( )

The constructor.

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

Returns
void

Definition at line 70 of file 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 988 of file emitter.php.

_blockdivider_emit (   $node)
protected

emit html for block divider.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 941 of file emitter.php.

_code_emit (   $node)
protected

emit html for code.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 955 of file emitter.php.

_def_desc_emit (   $node)
protected

emit html for definition description.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 818 of file emitter.php.

_def_list_emit (   $node)
protected

emit html for definition list.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 792 of file emitter.php.

_def_term_emit (   $node)
protected

emit html for definition term.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 805 of file emitter.php.

_document_emit (   $node)
protected

emit html for document.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 602 of file emitter.php.

_emphasis_emit (   $node)
protected

emit html for emphasis.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 653 of file emitter.php.

_heading_emit (   $node)
protected

emit html for heading.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 640 of file emitter.php.

_horizontalrule_emit (   $node)
protected

emit html for horizontalrule.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 677 of file emitter.php.

_image_emit (   $node)
protected

emit html for image.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 753 of file emitter.php.

_linebreak_emit (   $node)
protected

emit html for linebreak.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 669 of file emitter.php.

_link_emit (   $node)
protected

emit html for link.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 686 of file emitter.php.

_list_item_emit (   $node)
protected

emit html for list item.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 859 of file emitter.php.

_macro_emit (   $node)
protected

emit html for macro.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 1031 of file emitter.php.

_ordered_list_emit (   $node)
protected

emit html for ordered list.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 831 of file emitter.php.

_paragraph_emit (   $node)
protected

emit html for paragraph.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 617 of file emitter.php.

_preformatted_emit (   $node)
protected

emit html for preformatted.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 970 of file emitter.php.

_span_emit (   $node)
protected

emit html for span.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 927 of file emitter.php.

_strong_emit (   $node)
protected

emit html for strong.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 661 of file 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 912 of file emitter.php.

_table_emit (   $node)
protected

emit html for table.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 873 of file 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 899 of file emitter.php.

_table_row_emit (   $node)
protected

emit html for table row.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 886 of file emitter.php.

_text_emit (   $node)
protected

emit html for text node.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 630 of file emitter.php.

_unordered_list_emit (   $node)
protected

emit html for unordered list.

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 846 of file emitter.php.

blocktags (   $blocktaglist = NULL)

get or set collection of block declarations recognized by emitter

Definition at line 178 of file emitter.php.

call_classes (   $node)
protected

triggered from prepare_node.

Returns
object modified document node
See Also
prepare_node

Definition at line 359 of file 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 410 of file 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 345 of file 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 384 of file 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 584 of file 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 113 of file 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 131 of file 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 154 of file emitter.php.

emit_node (   $node)
protected

controller directs flow to one of the node emit methods.

Parameters
object$node
Returns
html

Definition at line 122 of file 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 144 of file 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 330 of file 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 312 of file 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 434 of file 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 477 of file emitter.php.

prepare_macro_node (   $node)
protected

trigger callouts; prepare output property

Parameters
object$nodedocument node
Returns
object modified document node

Definition at line 521 of file 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 537 of file emitter.php.

register_blockdef_handler (   $handler)

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

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

Definition at line 300 of file emitter.php.

register_charfilter_handler (   $handler)

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

Definition at line 225 of file emitter.php.

register_class_callouts (   $callouts)

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

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

Definition at line 239 of file emitter.php.

register_events (   $callbacks)

['event']=>'methodref'.

Definition at line 192 of file emitter.php.

register_macro_callouts (   $callouts)

[$macroname]=>$methodref.

Typically called by SimpleWiki (as facade).

Definition at line 286 of file emitter.php.

register_property_callouts (   $callouts)

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

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

Definition at line 263 of file emitter.php.

register_rawlink_handler (   $handler)

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

Definition at line 232 of file emitter.php.

register_symlink_handler (   $handler)

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

Definition at line 218 of file emitter.php.

register_symlinks (   $symlinks)

[$symlink]=>$value.

Definition at line 207 of file 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 102 of file 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 79 of file 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 576 of file emitter.php.

symlink_handler ( )

returns registered symlink handler

Definition at line 173 of file emitter.php.

symlinks ( )

returns registered symlinks

Definition at line 168 of file emitter.php.

Field Documentation

$_blockdef_handler
protected

array($objectref,'methodname')

Definition at line 62 of file 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 35 of file emitter.php.

$_charfilter_handler
protected

array($objectref,'methodname')

Definition at line 58 of file emitter.php.

$_class_callouts = array()
protected

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

Definition at line 46 of file emitter.php.

$_dom
protected

document object model, through the root node

Definition at line 27 of file emitter.php.

$_events = array()
protected

['event']=>'methodref'

Definition at line 60 of file emitter.php.

$_image_re
protected

image link regular expressions, external link and symlink

Definition at line 33 of file emitter.php.

$_link_re
protected

link regular expressions, external link, symlink, and anchor

Definition at line 31 of file emitter.php.

$_macro_callouts = array()
protected

[$macroname]=>$methodref

Definition at line 50 of file emitter.php.

$_property_callouts = array()
protected

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

Definition at line 48 of file emitter.php.

$_rawlink_handler
protected

array($objectref,'methodname')

Definition at line 56 of file emitter.php.

$_rules
protected

regex rules combined into applied regular expressions

Definition at line 29 of file emitter.php.

$_symlink_handler
protected

array($objectref,'methodname')

Definition at line 54 of file emitter.php.

$_symlinks = array()
protected

[$symlink]=>$value

Definition at line 52 of file emitter.php.


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