public function __construct(&$root, $text) { global $preformat_ltrim; parent::__construct(); if (substr($text, 0, 2) === '# ') { $text = substr($text, 1); } $this->elements[] = !$preformat_ltrim || empty($text) || substr($text, 0, 1) !== ' ' ? $text : substr($text, 1); }
public function __construct($out) { parent::__construct('dl', 'dt', ':', $out[0]); $element = new ListElement($this->level, 'dd'); $this->last = Element::insert($element); if (!empty($out[1])) { $this->last = $this->last->insert(ElementFactory::factory('InlineElement', null, $out[1])); } }
public function __construct($out) { parent::__construct(); $cells = explode('|', $out[1]); $this->col = count($cells); $this->type = strtolower($out[2]); $this->types = array($this->type); $is_template = $this->type === 'c'; $row = array(); foreach ($cells as $cell) { $row[] = new TableCell($cell, $is_template); } $this->elements[] = $row; }
public function __construct($row = array('cell1 ', ' cell2 ', ' cell3')) { parent::__construct(); $str = array(); $col = count($row); $matches = $_value = $_align = array(); foreach ($row as $cell) { if (preg_match('/^(\\s+)?(.+?)(\\s+)?$/', $cell, $matches)) { if ($matches[2] == '==') { // Colspan $_value[] = FALSE; $_align[] = FALSE; } else { $_value[] = $matches[2]; if (empty($matches[1])) { $_align[] = ''; // left } else { if (isset($matches[3])) { $_align[] = 'center'; } else { $_align[] = 'right'; } } } } else { $_value[] = $cell; $_align[] = ''; } } for ($i = 0; $i < $col; $i++) { if ($_value[$i] === FALSE) { continue; } $colspan = 1; while (isset($_value[$i + $colspan]) && $_value[$i + $colspan] === FALSE) { ++$colspan; } $colspan = $colspan > 1 ? ' colspan="' . $colspan . '"' : ''; $text = preg_match("/\\S+/", $_value[$i]) ? InlineFactory::factory($_value[$i]) : ''; $class = empty($text) || !preg_match("/\\S+/", $text) ? 'blank-cell' : ''; $align = $_align[$i] ? ' style="text-align:' . $_align[$i] . '"' : ''; $str[] = '<td class="' . $class . '"' . $align . $colspan . '>' . $text . '</td>'; unset($_value[$i], $_align[$i], $text); } $this->col = $col; $this->elements[] = implode('', $str); }
public function toString() { if ($this->is_guiedit) { $text = parent::toString(); $text = preg_replace_callback("/___COMMENT___(\n___COMMENT___)*/", array(&$this, 'comment'), $text); return $text . "\n"; } // #contents return preg_replace_callback('/<#_contents_>/', array($this, 'replaceContents'), parent::toString()); }
public function __construct($out) { parent::__construct(); list(, $this->name, $this->param, $this->text) = array_pad($out, 4, ''); }
public function toString() { return $this->wrap(parent::toString(), 'p', $this->param); }
public function toString() { if ($this->rowspan == 0 || $this->colspan == 0) { return ''; } $param = $this->is_blank === true ? ' class="blank-cell' : ''; if ($this->rowspan > 1) { $param .= ' rowspan="' . $this->rowspan . '"'; } if ($this->colspan > 1) { $param .= ' colspan="' . $this->colspan . '"'; unset($this->style['width']); } if (!empty($this->lang)) { $param .= ' lang="' . $this->lang . '"'; } if (!empty($this->style)) { $style = ''; foreach ($this->style as $key => $value) { $style .= $key . ':' . $value . ';'; } $param .= ' style="' . strtolower(Utility::htmlsc($style)) . '"'; } return $this->wrap(parent::toString(), $this->tag, $param, FALSE); }
public function __construct(&$root, $text) { global $preformat_ltrim; parent::__construct(); $this->elements[] = Utility::htmlsc(!$preformat_ltrim || empty($text) || $text[0] != ' ' ? $text : substr($text, 1)); }
public function __construct($out) { parent::__construct(); list(, $this->name, $this->param) = array_pad($out, 3, null); }
public function toString() { return $this->wrap(parent::toString(), $this->tag, $this->style); }
public function toString() { return $this->wrap(parent::toString(), $this->head); }
public function __construct($text) { parent::__construct(); $this->elements[] = trim(substr($text, 0, 1) === "\n" ? $text : InlineFactory::factory($text)); }
public function toString() { return $this->wrap(parent::toString(), 'blockquote'); }
public function __construct(&$root, $text) { parent::__construct(); }
public function toString() { list($this->text, $fixed_anchor) = Rules::getHeading($this->text, FALSE); $id = empty($fixed_anchor) ? $this->id : $fixed_anchor; return $this->msg_top . $this->wrap(parent::toString(), 'h' . $this->level, ' id="' . $id . '"'); }