Simplewiki  1.1
docnode.php
Go to the documentation of this file.
1 <?php
2 // Muster Software Copyright (c) Henrik Bechmann, Toronto, Canada 2009-2012. All rights reserved.
3 // See "musterlicence.txt" for licencing information.
4 // mustersoftware.net
5 
6 namespace Muster\Simplewiki;
7 
12 #==========================================================================#
13 #--------------------------[ DOCUMENT NODE ]-------------------------------#
14 #==========================================================================#
15 
18 class DocNode
19 {
27  const DOCUMENT = 'document';
28 
38  const TEXT = 'text';
39 
51  const PARAGRAPH = 'paragraph';
52 
64  const HEADING = 'heading';
65 
73  const EMPHASIS = 'emphasis';
74 
81  const STRONG = 'strong';
82 
89  const LINEBREAK = 'linebreak';
90 
97  const HORIZONTALRULE = 'horizontalrule';
98 
122  const LINK = 'link';
123 
139  const IMAGE = 'image';
140 
151  const ORDERED_LIST = 'ordered_list';
152 
163  const UNORDERED_LIST = 'unordered_list';
164 
175  const LIST_ITEM = 'list_item';
176 
187  const DEF_LIST = 'def_list';
188 
199  const DEF_TERM = 'def_term';
200 
211  const DEF_DESC = 'def_desc';
212 
223  const TABLE = 'table';
224 
233  const TABLE_ROW = 'table_row';
234 
245  const TABLE_HEADCELL = 'table_headcell';
246 
257  const TABLE_CELL = 'table_cell';
258 
269  const SPAN = 'span';
270 
281  const BLOCKDIVIDER = 'blockdivider';
282 
295  const CODE = 'code';
296 
309  const PREFORMATTED = 'preformatted';
310 
324  const BLOCKDEF = 'blockdef';
325 
338  const MACRO = 'macro';
339 
342 
343  public $parent;
345  public $children;
347  public $type;
355  public function __construct($type, $parent=NULL)
356  {
357  $this->children = array();
358  $this->type = $type;
359  $this->parent = $parent;
360  if (!empty($parent))
361  $parent->child_append($this);
362  }
367  protected function child_append($child)
368  {
369  $this->children[] = $child;
370  }
373  public function get_display_list() // for debug
374  {
375  $clone = clone $this;
376  unset($clone->parent);
377  unset($clone->children);
378  return $clone;
379  }
380 }