Simplewiki 1

muster_simplewiki_docnode.php

Go to the documentation of this file.
00001 <?php
00008 #==========================================================================#
00009 #--------------------------[ DOCUMENT NODE ]-------------------------------#
00010 #==========================================================================#
00011 
00014 class Muster_SimpleWiki_DocNode 
00015 {
00023         const DOCUMENT = 'document';
00024         
00034         const TEXT = 'text';
00035         
00047         const PARAGRAPH = 'paragraph';
00048         
00060         const HEADING = 'heading';
00061         
00069         const EMPHASIS = 'emphasis';
00070         
00077         const STRONG = 'strong';
00078         
00085         const LINEBREAK = 'linebreak';
00086         
00093         const HORIZONTALRULE = 'horizontalrule';
00094         
00118         const LINK = 'link';
00119         
00135         const IMAGE = 'image';
00136         
00147         const ORDERED_LIST = 'ordered_list';
00148         
00159         const UNORDERED_LIST = 'unordered_list';
00160         
00171         const LIST_ITEM = 'list_item';
00172         
00183         const DEF_LIST = 'def_list';
00184         
00195         const DEF_TERM = 'def_term';
00196         
00207         const DEF_DESC = 'def_desc';
00208         
00219         const TABLE = 'table';
00220         
00229         const TABLE_ROW = 'table_row';
00230         
00241         const TABLE_HEADCELL = 'table_headcell';
00242         
00253         const TABLE_CELL = 'table_cell';
00254         
00265         const SPAN = 'span';
00266         
00277         const BLOCKDIVIDER = 'blockdivider';
00278         
00291         const CODE = 'code';
00292         
00305         const PREFORMATTED = 'preformatted';
00306         
00320         const BLOCKDEF = 'blockdef';
00321         
00334         const MACRO = 'macro';
00335         
00338 
00339         public $parent;
00341         public $children;
00343         public $type;
00351     public function __construct($type, $parent=NULL)
00352         {
00353         $this->children = array();
00354         $this->type = $type;
00355         $this->parent = $parent;
00356         if (!empty($parent))
00357             $parent->child_append($this);
00358         }
00363         protected function child_append($child)
00364         {
00365                 $this->children[] = $child;
00366         }
00369         public function get_display_list() // for debug
00370         {
00371                 $array = (array) $this;
00372                 $retarr = array();
00373                 foreach ($array as $property => $value)
00374                 {
00375                         if (($property != 'children') and ($property != 'parent'))
00376                                 $retarray[$property] = $value;
00377                 }
00378                 return $retarray;
00379         }
00380 }
00381