function __construct()
{
$this->elements = array();
- $this->last = & $this;
+ $this->last = $this;
}
- function setParent(& $parent)
+ function setParent($parent)
{
- $this->parent = & $parent;
+ $this->parent = $parent;
}
- function & add(& $obj)
+ function add($obj)
{
if ($this->canContain($obj)) {
return $this->insert($obj);
}
}
- function & insert(& $obj)
+ function insert($obj)
{
$obj->setParent($this);
- $this->elements[] = & $obj;
+ $this->elements[] = $obj;
- return $this->last = & $obj->last;
+ return $this->last = $obj->last;
}
- function canContain(& $obj)
+ function canContain($obj)
{
return TRUE;
}
}
// Returns inline-related object
-function & Factory_Inline($text)
+function Factory_Inline($text)
{
// Check the first letter of the line
if (substr($text, 0, 1) == '~') {
}
}
-function & Factory_DList(& $root, $text)
+function Factory_DList($root, $text)
{
$out = explode('|', ltrim($text), 2);
if (count($out) < 2) {
}
// '|'-separated table
-function & Factory_Table(& $root, $text)
+function Factory_Table($root, $text)
{
if (! preg_match('/^\|(.+)\|([hHfFcC]?)$/', $text, $out)) {
return Factory_Inline($text);
}
// Comma-separated table
-function & Factory_YTable(& $root, $text)
+function Factory_YTable($root, $text)
{
if ($text == ',') {
return Factory_Inline($text);
}
}
-function & Factory_Div(& $root, $text)
+function Factory_Div($root, $text)
{
$matches = array();
$text : make_link($text));
}
- function & insert(& $obj)
+ function insert($obj)
{
$this->elements[] = $obj->elements[0];
return $this;
}
- function canContain(& $obj)
+ function canContain($obj)
{
return is_a($obj, 'Inline');
}
return join(($line_break ? '<br />' . "\n" : "\n"), $this->elements);
}
- function & toPara($class = '')
+ function toPara($class = '')
{
$obj = new Paragraph('', $class);
$obj->insert($this);
$this->insert(Factory_Inline($text));
}
- function canContain(& $obj)
+ function canContain($obj)
{
return is_a($obj, 'Inline');
}
var $id;
var $msg_top;
- function Heading(& $root, $text)
+ function Heading($root, $text)
{
$this->__construct($root, $text);
}
- function __construct(& $root, $text)
+ function __construct($root, $text)
{
parent::__construct();
$this->level++; // h2,h3,h4
}
- function & insert(& $obj)
+ function insert($obj)
{
parent::insert($obj);
- return $this->last = & $this;
+ return $this->last = $this;
}
- function canContain(& $obj)
+ function canContain($obj)
{
return FALSE;
}
// Horizontal Rule
class HRule extends Element
{
- function HRule(& $root, $text)
+ function HRule($root, $text)
{
$this->__construct($root, $text);
}
- function __construct(& $root, $text)
+ function __construct($root, $text)
{
parent::__construct();
}
- function canContain(& $obj)
+ function canContain($obj)
{
return FALSE;
}
parent::insert(new ListElement($this->level, $tag2));
if ($text != '')
- $this->last = & $this->last->insert(Factory_Inline($text));
+ $this->last = $this->last->insert(Factory_Inline($text));
}
- function canContain(& $obj)
+ function canContain($obj)
{
return (! is_a($obj, 'ListContainer')
|| ($this->tag == $obj->tag && $this->level == $obj->level));
}
- function setParent(& $parent)
+ function setParent($parent)
{
parent::setParent($parent);
$this->style = sprintf(pkwk_list_attrs_template(), $this->level, $step);
}
- function & insert(& $obj)
+ function insert($obj)
{
if (! is_a($obj, get_class($this)))
- return $this->last = & $this->last->insert($obj);
+ return $this->last = $this->last->insert($obj);
// Break if no elements found (BugTrack/524)
if (count($obj->elements) == 1 && empty($obj->elements[0]->elements))
$this->head = $head;
}
- function canContain(& $obj)
+ function canContain($obj)
{
return (! is_a($obj, 'ListContainer') || ($obj->level > $this->level));
}
// - Three
class UList extends ListContainer
{
- function UList(& $root, $text)
+ function UList($root, $text)
{
$this->__construct($root, $text);
}
- function __construct(& $root, $text)
+ function __construct($root, $text)
{
parent::__construct('ul', 'li', '-', $text);
}
// + Three
class OList extends ListContainer
{
- function OList(& $root, $text)
+ function OList($root, $text)
{
$this->__construct($root, $text);
}
- function __construct(& $root, $text)
+ function __construct($root, $text)
{
parent::__construct('ol', 'li', '+', $text);
}
function __construct($out)
{
parent::__construct('dl', 'dt', ':', $out[0]);
- $this->last = & Element::insert(new ListElement($this->level, 'dd'));
+ $this->last = Element::insert(new ListElement($this->level, 'dd'));
if ($out[1] != '')
- $this->last = & $this->last->insert(Factory_Inline($out[1]));
+ $this->last = $this->last->insert(Factory_Inline($out[1]));
}
}
{
var $level;
- function BQuote(& $root, $text)
+ function BQuote($root, $text)
{
$this->__construct($root, $text);
}
- function __construct(& $root, $text)
+ function __construct($root, $text)
{
parent::__construct();
if ($head == '<') { // Blockquote close
$level = $this->level;
$this->level = 0;
- $this->last = & $this->end($root, $level);
+ $this->last = $this->end($root, $level);
if ($text != '')
- $this->last = & $this->last->insert(Factory_Inline($text));
+ $this->last = $this->last->insert(Factory_Inline($text));
} else {
$this->insert(Factory_Inline($text));
}
}
- function canContain(& $obj)
+ function canContain($obj)
{
return (! is_a($obj, get_class($this)) || $obj->level >= $this->level);
}
- function & insert(& $obj)
+ function insert($obj)
{
// BugTrack/521, BugTrack/545
if (is_a($obj, 'inline'))
return parent::insert($obj->toPara(' class="quotation"'));
if (is_a($obj, 'BQuote') && $obj->level == $this->level && count($obj->elements)) {
- $obj = & $obj->elements[0];
+ $obj = $obj->elements[0];
if (is_a($this->last, 'Paragraph') && count($obj->elements))
- $obj = & $obj->elements[0];
+ $obj = $obj->elements[0];
}
return parent::insert($obj);
}
return $this->wrap(parent::toString(), 'blockquote');
}
- function & end(& $root, $level)
+ function end(& $root, $level)
{
- $parent = & $root->last;
+ $parent = $root->last;
while (is_object($parent)) {
if (is_a($parent, 'BQuote') && $parent->level == $level)
return $parent->parent;
- $parent = & $parent->parent;
+ $parent = $parent->parent;
}
return $this;
}
if ($text != '' && $text[0] == '#') {
// Try using Div class for this $text
- $obj = & Factory_Div($this, $text);
+ $obj = Factory_Div($this, $text);
if (is_a($obj, 'Paragraph'))
- $obj = & $obj->elements[0];
+ $obj = $obj->elements[0];
} else {
- $obj = & Factory_Inline($text);
+ $obj = Factory_Inline($text);
}
$this->insert($obj);
}
- function setStyle(& $style)
+ function setStyle($style)
{
foreach ($style as $key=>$value)
if (! isset($this->style[$key]))
$this->elements[] = $row;
}
- function canContain(& $obj)
+ function canContain($obj)
{
return is_a($obj, 'Table') && ($obj->col == $this->col);
}
- function & insert(& $obj)
+ function insert($obj)
{
$this->elements[] = $obj->elements[0];
$this->types[] = $obj->type;
for ($ncol = 0; $ncol < $this->col; $ncol++) {
$rowspan = 1;
foreach (array_reverse(array_keys($this->elements)) as $nrow) {
- $row = & $this->elements[$nrow];
+ $row = $this->elements[$nrow];
if ($row[$ncol]->rowspan == 0) {
++$rowspan;
continue;
// Set colspan and style
$stylerow = NULL;
foreach (array_keys($this->elements) as $nrow) {
- $row = & $this->elements[$nrow];
+ $row = $this->elements[$nrow];
if ($this->types[$nrow] == 'c')
- $stylerow = & $row;
+ $stylerow = $row;
$colspan = 1;
foreach (array_keys($row) as $ncol) {
if ($row[$ncol]->colspan == 0) {
foreach (array_keys($this->elements) as $nrow) {
if ($this->types[$nrow] != $type)
continue;
- $row = & $this->elements[$nrow];
+ $row = $this->elements[$nrow];
$row_string = '';
foreach (array_keys($row) as $ncol)
$row_string .= $row[$ncol]->toString();
$this->elements[] = implode('', $str);
}
- function canContain(& $obj)
+ function canContain($obj)
{
return is_a($obj, 'YTable') && ($obj->col == $this->col);
}
- function & insert(& $obj)
+ function insert($obj)
{
$this->elements[] = $obj->elements[0];
return $this;
(! $preformat_ltrim || $text == '' || $text[0] != ' ') ? $text : substr($text, 1));
}
- function canContain(& $obj)
+ function canContain($obj)
{
return is_a($obj, 'Pre');
}
- function & insert(& $obj)
+ function insert($obj)
{
$this->elements[] = $obj->elements[0];
return $this;
list(, $this->name, $this->param) = array_pad($out, 3, '');
}
- function canContain(& $obj)
+ function canContain($obj)
{
return FALSE;
}
$this->align = $align;
}
- function canContain(& $obj)
+ function canContain($obj)
{
return is_a($obj, 'Inline');
}
{
$this->id = $id;
$this->contents = new Element();
- $this->contents_last = & $this->contents;
+ $this->contents_last = $this->contents;
parent::__construct();
}
function parse(& $lines)
{
- $this->last = & $this;
+ $this->last = $this;
$matches = array();
while (! empty($lines)) {
if (preg_match('/^(LEFT|CENTER|RIGHT):(.*)$/', $line, $matches)) {
// <div style="text-align:...">
- $this->last = & $this->last->add(new Align(strtolower($matches[1])));
+ $this->last = $this->last->add(new Align(strtolower($matches[1])));
if ($matches[2] == '') continue;
$line = $matches[2];
}
// Empty
if ($line == '') {
- $this->last = & $this;
+ $this->last = $this;
continue;
}
// Pre
if ($head == ' ' || $head == "\t") {
- $this->last = & $this->last->add(new Pre($this, $line));
+ $this->last = $this->last->add(new Pre($this, $line));
continue;
}
// Other Character
if (isset($this->classes[$head])) {
$classname = $this->classes[$head];
- $this->last = & $this->last->add(new $classname($this, $line));
+ $this->last = $this->last->add(new $classname($this, $line));
continue;
}
// Other Character
if (isset($this->factories[$head])) {
$factoryname = 'Factory_' . $this->factories[$head];
- $this->last = & $this->last->add($factoryname($this, $line));
+ $this->last = $this->last->add($factoryname($this, $line));
continue;
}
// Default
- $this->last = & $this->last->add(Factory_Inline($line));
+ $this->last = $this->last->add(Factory_Inline($line));
}
}
}
$text = trim($text);
// Add 'page contents' link to its heading
- $this->contents_last = & $this->contents_last->add(new Contents_UList($text, $level, $id));
+ $this->contents_last = $this->contents_last->add(new Contents_UList($text, $level, $id));
// Add heding
return array($text . $anchor, $this->count > 1 ? "\n" . $top : '', $autoid);
}
- function & insert(& $obj)
+ function insert($obj)
{
- if (is_a($obj, 'Inline')) $obj = & $obj->toPara();
+ if (is_a($obj, 'Inline')) $obj = $obj->toPara();
return parent::insert($obj);
}
$this->insert(Factory_Inline($text));
}
- function setParent(& $parent)
+ function setParent($parent)
{
parent::setParent($parent);
$step = $this->level;