Revisión | 0cf09f05034fb960be972692176e737406b2b244 (tree) |
---|---|
Tiempo | 2022-04-03 14:47:29 |
Autor | ![]() |
Commiter | haifun |
BugTrack/2568 Avoid notice error
@@ -39,15 +39,15 @@ class Element | ||
39 | 39 | function __construct() |
40 | 40 | { |
41 | 41 | $this->elements = array(); |
42 | - $this->last = & $this; | |
42 | + $this->last = $this; | |
43 | 43 | } |
44 | 44 | |
45 | - function setParent(& $parent) | |
45 | + function setParent($parent) | |
46 | 46 | { |
47 | - $this->parent = & $parent; | |
47 | + $this->parent = $parent; | |
48 | 48 | } |
49 | 49 | |
50 | - function & add(& $obj) | |
50 | + function add($obj) | |
51 | 51 | { |
52 | 52 | if ($this->canContain($obj)) { |
53 | 53 | return $this->insert($obj); |
@@ -56,15 +56,15 @@ class Element | ||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - function & insert(& $obj) | |
59 | + function insert($obj) | |
60 | 60 | { |
61 | 61 | $obj->setParent($this); |
62 | - $this->elements[] = & $obj; | |
62 | + $this->elements[] = $obj; | |
63 | 63 | |
64 | - return $this->last = & $obj->last; | |
64 | + return $this->last = $obj->last; | |
65 | 65 | } |
66 | 66 | |
67 | - function canContain(& $obj) | |
67 | + function canContain($obj) | |
68 | 68 | { |
69 | 69 | return TRUE; |
70 | 70 | } |
@@ -97,7 +97,7 @@ class Element | ||
97 | 97 | } |
98 | 98 | |
99 | 99 | // Returns inline-related object |
100 | -function & Factory_Inline($text) | |
100 | +function Factory_Inline($text) | |
101 | 101 | { |
102 | 102 | // Check the first letter of the line |
103 | 103 | if (substr($text, 0, 1) == '~') { |
@@ -107,7 +107,7 @@ function & Factory_Inline($text) | ||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -function & Factory_DList(& $root, $text) | |
110 | +function Factory_DList($root, $text) | |
111 | 111 | { |
112 | 112 | $out = explode('|', ltrim($text), 2); |
113 | 113 | if (count($out) < 2) { |
@@ -118,7 +118,7 @@ function & Factory_DList(& $root, $text) | ||
118 | 118 | } |
119 | 119 | |
120 | 120 | // '|'-separated table |
121 | -function & Factory_Table(& $root, $text) | |
121 | +function Factory_Table($root, $text) | |
122 | 122 | { |
123 | 123 | if (! preg_match('/^\|(.+)\|([hHfFcC]?)$/', $text, $out)) { |
124 | 124 | return Factory_Inline($text); |
@@ -128,7 +128,7 @@ function & Factory_Table(& $root, $text) | ||
128 | 128 | } |
129 | 129 | |
130 | 130 | // Comma-separated table |
131 | -function & Factory_YTable(& $root, $text) | |
131 | +function Factory_YTable($root, $text) | |
132 | 132 | { |
133 | 133 | if ($text == ',') { |
134 | 134 | return Factory_Inline($text); |
@@ -137,7 +137,7 @@ function & Factory_YTable(& $root, $text) | ||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | -function & Factory_Div(& $root, $text) | |
140 | +function Factory_Div($root, $text) | |
141 | 141 | { |
142 | 142 | $matches = array(); |
143 | 143 |
@@ -180,13 +180,13 @@ class Inline extends Element | ||
180 | 180 | $text : make_link($text)); |
181 | 181 | } |
182 | 182 | |
183 | - function & insert(& $obj) | |
183 | + function insert($obj) | |
184 | 184 | { |
185 | 185 | $this->elements[] = $obj->elements[0]; |
186 | 186 | return $this; |
187 | 187 | } |
188 | 188 | |
189 | - function canContain(& $obj) | |
189 | + function canContain($obj) | |
190 | 190 | { |
191 | 191 | return is_a($obj, 'Inline'); |
192 | 192 | } |
@@ -197,7 +197,7 @@ class Inline extends Element | ||
197 | 197 | return join(($line_break ? '<br />' . "\n" : "\n"), $this->elements); |
198 | 198 | } |
199 | 199 | |
200 | - function & toPara($class = '') | |
200 | + function toPara($class = '') | |
201 | 201 | { |
202 | 202 | $obj = new Paragraph('', $class); |
203 | 203 | $obj->insert($this); |
@@ -226,7 +226,7 @@ class Paragraph extends Element | ||
226 | 226 | $this->insert(Factory_Inline($text)); |
227 | 227 | } |
228 | 228 | |
229 | - function canContain(& $obj) | |
229 | + function canContain($obj) | |
230 | 230 | { |
231 | 231 | return is_a($obj, 'Inline'); |
232 | 232 | } |
@@ -246,11 +246,11 @@ class Heading extends Element | ||
246 | 246 | var $id; |
247 | 247 | var $msg_top; |
248 | 248 | |
249 | - function Heading(& $root, $text) | |
249 | + function Heading($root, $text) | |
250 | 250 | { |
251 | 251 | $this->__construct($root, $text); |
252 | 252 | } |
253 | - function __construct(& $root, $text) | |
253 | + function __construct($root, $text) | |
254 | 254 | { |
255 | 255 | parent::__construct(); |
256 | 256 |
@@ -260,13 +260,13 @@ class Heading extends Element | ||
260 | 260 | $this->level++; // h2,h3,h4 |
261 | 261 | } |
262 | 262 | |
263 | - function & insert(& $obj) | |
263 | + function insert($obj) | |
264 | 264 | { |
265 | 265 | parent::insert($obj); |
266 | - return $this->last = & $this; | |
266 | + return $this->last = $this; | |
267 | 267 | } |
268 | 268 | |
269 | - function canContain(& $obj) | |
269 | + function canContain($obj) | |
270 | 270 | { |
271 | 271 | return FALSE; |
272 | 272 | } |
@@ -282,16 +282,16 @@ class Heading extends Element | ||
282 | 282 | // Horizontal Rule |
283 | 283 | class HRule extends Element |
284 | 284 | { |
285 | - function HRule(& $root, $text) | |
285 | + function HRule($root, $text) | |
286 | 286 | { |
287 | 287 | $this->__construct($root, $text); |
288 | 288 | } |
289 | - function __construct(& $root, $text) | |
289 | + function __construct($root, $text) | |
290 | 290 | { |
291 | 291 | parent::__construct(); |
292 | 292 | } |
293 | 293 | |
294 | - function canContain(& $obj) | |
294 | + function canContain($obj) | |
295 | 295 | { |
296 | 296 | return FALSE; |
297 | 297 | } |
@@ -326,16 +326,16 @@ class ListContainer extends Element | ||
326 | 326 | |
327 | 327 | parent::insert(new ListElement($this->level, $tag2)); |
328 | 328 | if ($text != '') |
329 | - $this->last = & $this->last->insert(Factory_Inline($text)); | |
329 | + $this->last = $this->last->insert(Factory_Inline($text)); | |
330 | 330 | } |
331 | 331 | |
332 | - function canContain(& $obj) | |
332 | + function canContain($obj) | |
333 | 333 | { |
334 | 334 | return (! is_a($obj, 'ListContainer') |
335 | 335 | || ($this->tag == $obj->tag && $this->level == $obj->level)); |
336 | 336 | } |
337 | 337 | |
338 | - function setParent(& $parent) | |
338 | + function setParent($parent) | |
339 | 339 | { |
340 | 340 | parent::setParent($parent); |
341 | 341 |
@@ -346,10 +346,10 @@ class ListContainer extends Element | ||
346 | 346 | $this->style = sprintf(pkwk_list_attrs_template(), $this->level, $step); |
347 | 347 | } |
348 | 348 | |
349 | - function & insert(& $obj) | |
349 | + function insert($obj) | |
350 | 350 | { |
351 | 351 | if (! is_a($obj, get_class($this))) |
352 | - return $this->last = & $this->last->insert($obj); | |
352 | + return $this->last = $this->last->insert($obj); | |
353 | 353 | |
354 | 354 | // Break if no elements found (BugTrack/524) |
355 | 355 | if (count($obj->elements) == 1 && empty($obj->elements[0]->elements)) |
@@ -381,7 +381,7 @@ class ListElement extends Element | ||
381 | 381 | $this->head = $head; |
382 | 382 | } |
383 | 383 | |
384 | - function canContain(& $obj) | |
384 | + function canContain($obj) | |
385 | 385 | { |
386 | 386 | return (! is_a($obj, 'ListContainer') || ($obj->level > $this->level)); |
387 | 387 | } |
@@ -397,11 +397,11 @@ class ListElement extends Element | ||
397 | 397 | // - Three |
398 | 398 | class UList extends ListContainer |
399 | 399 | { |
400 | - function UList(& $root, $text) | |
400 | + function UList($root, $text) | |
401 | 401 | { |
402 | 402 | $this->__construct($root, $text); |
403 | 403 | } |
404 | - function __construct(& $root, $text) | |
404 | + function __construct($root, $text) | |
405 | 405 | { |
406 | 406 | parent::__construct('ul', 'li', '-', $text); |
407 | 407 | } |
@@ -412,11 +412,11 @@ class UList extends ListContainer | ||
412 | 412 | // + Three |
413 | 413 | class OList extends ListContainer |
414 | 414 | { |
415 | - function OList(& $root, $text) | |
415 | + function OList($root, $text) | |
416 | 416 | { |
417 | 417 | $this->__construct($root, $text); |
418 | 418 | } |
419 | - function __construct(& $root, $text) | |
419 | + function __construct($root, $text) | |
420 | 420 | { |
421 | 421 | parent::__construct('ol', 'li', '+', $text); |
422 | 422 | } |
@@ -434,9 +434,9 @@ class DList extends ListContainer | ||
434 | 434 | function __construct($out) |
435 | 435 | { |
436 | 436 | parent::__construct('dl', 'dt', ':', $out[0]); |
437 | - $this->last = & Element::insert(new ListElement($this->level, 'dd')); | |
437 | + $this->last = Element::insert(new ListElement($this->level, 'dd')); | |
438 | 438 | if ($out[1] != '') |
439 | - $this->last = & $this->last->insert(Factory_Inline($out[1])); | |
439 | + $this->last = $this->last->insert(Factory_Inline($out[1])); | |
440 | 440 | } |
441 | 441 | } |
442 | 442 |
@@ -446,11 +446,11 @@ class BQuote extends Element | ||
446 | 446 | { |
447 | 447 | var $level; |
448 | 448 | |
449 | - function BQuote(& $root, $text) | |
449 | + function BQuote($root, $text) | |
450 | 450 | { |
451 | 451 | $this->__construct($root, $text); |
452 | 452 | } |
453 | - function __construct(& $root, $text) | |
453 | + function __construct($root, $text) | |
454 | 454 | { |
455 | 455 | parent::__construct(); |
456 | 456 |
@@ -461,29 +461,29 @@ class BQuote extends Element | ||
461 | 461 | if ($head == '<') { // Blockquote close |
462 | 462 | $level = $this->level; |
463 | 463 | $this->level = 0; |
464 | - $this->last = & $this->end($root, $level); | |
464 | + $this->last = $this->end($root, $level); | |
465 | 465 | if ($text != '') |
466 | - $this->last = & $this->last->insert(Factory_Inline($text)); | |
466 | + $this->last = $this->last->insert(Factory_Inline($text)); | |
467 | 467 | } else { |
468 | 468 | $this->insert(Factory_Inline($text)); |
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
472 | - function canContain(& $obj) | |
472 | + function canContain($obj) | |
473 | 473 | { |
474 | 474 | return (! is_a($obj, get_class($this)) || $obj->level >= $this->level); |
475 | 475 | } |
476 | 476 | |
477 | - function & insert(& $obj) | |
477 | + function insert($obj) | |
478 | 478 | { |
479 | 479 | // BugTrack/521, BugTrack/545 |
480 | 480 | if (is_a($obj, 'inline')) |
481 | 481 | return parent::insert($obj->toPara(' class="quotation"')); |
482 | 482 | |
483 | 483 | if (is_a($obj, 'BQuote') && $obj->level == $this->level && count($obj->elements)) { |
484 | - $obj = & $obj->elements[0]; | |
484 | + $obj = $obj->elements[0]; | |
485 | 485 | if (is_a($this->last, 'Paragraph') && count($obj->elements)) |
486 | - $obj = & $obj->elements[0]; | |
486 | + $obj = $obj->elements[0]; | |
487 | 487 | } |
488 | 488 | return parent::insert($obj); |
489 | 489 | } |
@@ -493,14 +493,14 @@ class BQuote extends Element | ||
493 | 493 | return $this->wrap(parent::toString(), 'blockquote'); |
494 | 494 | } |
495 | 495 | |
496 | - function & end(& $root, $level) | |
496 | + function end(& $root, $level) | |
497 | 497 | { |
498 | - $parent = & $root->last; | |
498 | + $parent = $root->last; | |
499 | 499 | |
500 | 500 | while (is_object($parent)) { |
501 | 501 | if (is_a($parent, 'BQuote') && $parent->level == $level) |
502 | 502 | return $parent->parent; |
503 | - $parent = & $parent->parent; | |
503 | + $parent = $parent->parent; | |
504 | 504 | } |
505 | 505 | return $this; |
506 | 506 | } |
@@ -553,17 +553,17 @@ class TableCell extends Element | ||
553 | 553 | |
554 | 554 | if ($text != '' && $text[0] == '#') { |
555 | 555 | // Try using Div class for this $text |
556 | - $obj = & Factory_Div($this, $text); | |
556 | + $obj = Factory_Div($this, $text); | |
557 | 557 | if (is_a($obj, 'Paragraph')) |
558 | - $obj = & $obj->elements[0]; | |
558 | + $obj = $obj->elements[0]; | |
559 | 559 | } else { |
560 | - $obj = & Factory_Inline($text); | |
560 | + $obj = Factory_Inline($text); | |
561 | 561 | } |
562 | 562 | |
563 | 563 | $this->insert($obj); |
564 | 564 | } |
565 | 565 | |
566 | - function setStyle(& $style) | |
566 | + function setStyle($style) | |
567 | 567 | { |
568 | 568 | foreach ($style as $key=>$value) |
569 | 569 | if (! isset($this->style[$key])) |
@@ -616,12 +616,12 @@ class Table extends Element | ||
616 | 616 | $this->elements[] = $row; |
617 | 617 | } |
618 | 618 | |
619 | - function canContain(& $obj) | |
619 | + function canContain($obj) | |
620 | 620 | { |
621 | 621 | return is_a($obj, 'Table') && ($obj->col == $this->col); |
622 | 622 | } |
623 | 623 | |
624 | - function & insert(& $obj) | |
624 | + function insert($obj) | |
625 | 625 | { |
626 | 626 | $this->elements[] = $obj->elements[0]; |
627 | 627 | $this->types[] = $obj->type; |
@@ -636,7 +636,7 @@ class Table extends Element | ||
636 | 636 | for ($ncol = 0; $ncol < $this->col; $ncol++) { |
637 | 637 | $rowspan = 1; |
638 | 638 | foreach (array_reverse(array_keys($this->elements)) as $nrow) { |
639 | - $row = & $this->elements[$nrow]; | |
639 | + $row = $this->elements[$nrow]; | |
640 | 640 | if ($row[$ncol]->rowspan == 0) { |
641 | 641 | ++$rowspan; |
642 | 642 | continue; |
@@ -652,9 +652,9 @@ class Table extends Element | ||
652 | 652 | // Set colspan and style |
653 | 653 | $stylerow = NULL; |
654 | 654 | foreach (array_keys($this->elements) as $nrow) { |
655 | - $row = & $this->elements[$nrow]; | |
655 | + $row = $this->elements[$nrow]; | |
656 | 656 | if ($this->types[$nrow] == 'c') |
657 | - $stylerow = & $row; | |
657 | + $stylerow = $row; | |
658 | 658 | $colspan = 1; |
659 | 659 | foreach (array_keys($row) as $ncol) { |
660 | 660 | if ($row[$ncol]->colspan == 0) { |
@@ -680,7 +680,7 @@ class Table extends Element | ||
680 | 680 | foreach (array_keys($this->elements) as $nrow) { |
681 | 681 | if ($this->types[$nrow] != $type) |
682 | 682 | continue; |
683 | - $row = & $this->elements[$nrow]; | |
683 | + $row = $this->elements[$nrow]; | |
684 | 684 | $row_string = ''; |
685 | 685 | foreach (array_keys($row) as $ncol) |
686 | 686 | $row_string .= $row[$ncol]->toString(); |
@@ -755,12 +755,12 @@ class YTable extends Element | ||
755 | 755 | $this->elements[] = implode('', $str); |
756 | 756 | } |
757 | 757 | |
758 | - function canContain(& $obj) | |
758 | + function canContain($obj) | |
759 | 759 | { |
760 | 760 | return is_a($obj, 'YTable') && ($obj->col == $this->col); |
761 | 761 | } |
762 | 762 | |
763 | - function & insert(& $obj) | |
763 | + function insert($obj) | |
764 | 764 | { |
765 | 765 | $this->elements[] = $obj->elements[0]; |
766 | 766 | return $this; |
@@ -794,12 +794,12 @@ class Pre extends Element | ||
794 | 794 | (! $preformat_ltrim || $text == '' || $text[0] != ' ') ? $text : substr($text, 1)); |
795 | 795 | } |
796 | 796 | |
797 | - function canContain(& $obj) | |
797 | + function canContain($obj) | |
798 | 798 | { |
799 | 799 | return is_a($obj, 'Pre'); |
800 | 800 | } |
801 | 801 | |
802 | - function & insert(& $obj) | |
802 | + function insert($obj) | |
803 | 803 | { |
804 | 804 | $this->elements[] = $obj->elements[0]; |
805 | 805 | return $this; |
@@ -827,7 +827,7 @@ class Div extends Element | ||
827 | 827 | list(, $this->name, $this->param) = array_pad($out, 3, ''); |
828 | 828 | } |
829 | 829 | |
830 | - function canContain(& $obj) | |
830 | + function canContain($obj) | |
831 | 831 | { |
832 | 832 | return FALSE; |
833 | 833 | } |
@@ -854,7 +854,7 @@ class Align extends Element | ||
854 | 854 | $this->align = $align; |
855 | 855 | } |
856 | 856 | |
857 | - function canContain(& $obj) | |
857 | + function canContain($obj) | |
858 | 858 | { |
859 | 859 | return is_a($obj, 'Inline'); |
860 | 860 | } |
@@ -891,13 +891,13 @@ class Body extends Element | ||
891 | 891 | { |
892 | 892 | $this->id = $id; |
893 | 893 | $this->contents = new Element(); |
894 | - $this->contents_last = & $this->contents; | |
894 | + $this->contents_last = $this->contents; | |
895 | 895 | parent::__construct(); |
896 | 896 | } |
897 | 897 | |
898 | 898 | function parse(& $lines) |
899 | 899 | { |
900 | - $this->last = & $this; | |
900 | + $this->last = $this; | |
901 | 901 | $matches = array(); |
902 | 902 | |
903 | 903 | while (! empty($lines)) { |
@@ -908,7 +908,7 @@ class Body extends Element | ||
908 | 908 | |
909 | 909 | if (preg_match('/^(LEFT|CENTER|RIGHT):(.*)$/', $line, $matches)) { |
910 | 910 | // <div style="text-align:..."> |
911 | - $this->last = & $this->last->add(new Align(strtolower($matches[1]))); | |
911 | + $this->last = $this->last->add(new Align(strtolower($matches[1]))); | |
912 | 912 | if ($matches[2] == '') continue; |
913 | 913 | $line = $matches[2]; |
914 | 914 | } |
@@ -917,7 +917,7 @@ class Body extends Element | ||
917 | 917 | |
918 | 918 | // Empty |
919 | 919 | if ($line == '') { |
920 | - $this->last = & $this; | |
920 | + $this->last = $this; | |
921 | 921 | continue; |
922 | 922 | } |
923 | 923 |
@@ -954,7 +954,7 @@ class Body extends Element | ||
954 | 954 | |
955 | 955 | // Pre |
956 | 956 | if ($head == ' ' || $head == "\t") { |
957 | - $this->last = & $this->last->add(new Pre($this, $line)); | |
957 | + $this->last = $this->last->add(new Pre($this, $line)); | |
958 | 958 | continue; |
959 | 959 | } |
960 | 960 |
@@ -965,19 +965,19 @@ class Body extends Element | ||
965 | 965 | // Other Character |
966 | 966 | if (isset($this->classes[$head])) { |
967 | 967 | $classname = $this->classes[$head]; |
968 | - $this->last = & $this->last->add(new $classname($this, $line)); | |
968 | + $this->last = $this->last->add(new $classname($this, $line)); | |
969 | 969 | continue; |
970 | 970 | } |
971 | 971 | |
972 | 972 | // Other Character |
973 | 973 | if (isset($this->factories[$head])) { |
974 | 974 | $factoryname = 'Factory_' . $this->factories[$head]; |
975 | - $this->last = & $this->last->add($factoryname($this, $line)); | |
975 | + $this->last = $this->last->add($factoryname($this, $line)); | |
976 | 976 | continue; |
977 | 977 | } |
978 | 978 | |
979 | 979 | // Default |
980 | - $this->last = & $this->last->add(Factory_Inline($line)); | |
980 | + $this->last = $this->last->add(Factory_Inline($line)); | |
981 | 981 | } |
982 | 982 | } |
983 | 983 |
@@ -1000,14 +1000,14 @@ class Body extends Element | ||
1000 | 1000 | } |
1001 | 1001 | $text = trim($text); |
1002 | 1002 | // Add 'page contents' link to its heading |
1003 | - $this->contents_last = & $this->contents_last->add(new Contents_UList($text, $level, $id)); | |
1003 | + $this->contents_last = $this->contents_last->add(new Contents_UList($text, $level, $id)); | |
1004 | 1004 | // Add heding |
1005 | 1005 | return array($text . $anchor, $this->count > 1 ? "\n" . $top : '', $autoid); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - function & insert(& $obj) | |
1008 | + function insert($obj) | |
1009 | 1009 | { |
1010 | - if (is_a($obj, 'Inline')) $obj = & $obj->toPara(); | |
1010 | + if (is_a($obj, 'Inline')) $obj = $obj->toPara(); | |
1011 | 1011 | return parent::insert($obj); |
1012 | 1012 | } |
1013 | 1013 |
@@ -1050,7 +1050,7 @@ class Contents_UList extends ListContainer | ||
1050 | 1050 | $this->insert(Factory_Inline($text)); |
1051 | 1051 | } |
1052 | 1052 | |
1053 | - function setParent(& $parent) | |
1053 | + function setParent($parent) | |
1054 | 1054 | { |
1055 | 1055 | parent::setParent($parent); |
1056 | 1056 | $step = $this->level; |