• R/O
  • HTTP
  • SSH
  • HTTPS

pukiwiki: Commit


Commit MetaInfo

Revision0cf09f05034fb960be972692176e737406b2b244 (tree)
Time2022-04-03 14:47:29
Authorhaifun <haifun@user...>
Commiterhaifun

Log Message

BugTrack/2568 Avoid notice error

Change Summary

Incremental Difference

--- a/lib/convert_html.php
+++ b/lib/convert_html.php
@@ -39,15 +39,15 @@ class Element
3939 function __construct()
4040 {
4141 $this->elements = array();
42- $this->last = & $this;
42+ $this->last = $this;
4343 }
4444
45- function setParent(& $parent)
45+ function setParent($parent)
4646 {
47- $this->parent = & $parent;
47+ $this->parent = $parent;
4848 }
4949
50- function & add(& $obj)
50+ function add($obj)
5151 {
5252 if ($this->canContain($obj)) {
5353 return $this->insert($obj);
@@ -56,15 +56,15 @@ class Element
5656 }
5757 }
5858
59- function & insert(& $obj)
59+ function insert($obj)
6060 {
6161 $obj->setParent($this);
62- $this->elements[] = & $obj;
62+ $this->elements[] = $obj;
6363
64- return $this->last = & $obj->last;
64+ return $this->last = $obj->last;
6565 }
6666
67- function canContain(& $obj)
67+ function canContain($obj)
6868 {
6969 return TRUE;
7070 }
@@ -97,7 +97,7 @@ class Element
9797 }
9898
9999 // Returns inline-related object
100-function & Factory_Inline($text)
100+function Factory_Inline($text)
101101 {
102102 // Check the first letter of the line
103103 if (substr($text, 0, 1) == '~') {
@@ -107,7 +107,7 @@ function & Factory_Inline($text)
107107 }
108108 }
109109
110-function & Factory_DList(& $root, $text)
110+function Factory_DList($root, $text)
111111 {
112112 $out = explode('|', ltrim($text), 2);
113113 if (count($out) < 2) {
@@ -118,7 +118,7 @@ function & Factory_DList(& $root, $text)
118118 }
119119
120120 // '|'-separated table
121-function & Factory_Table(& $root, $text)
121+function Factory_Table($root, $text)
122122 {
123123 if (! preg_match('/^\|(.+)\|([hHfFcC]?)$/', $text, $out)) {
124124 return Factory_Inline($text);
@@ -128,7 +128,7 @@ function & Factory_Table(& $root, $text)
128128 }
129129
130130 // Comma-separated table
131-function & Factory_YTable(& $root, $text)
131+function Factory_YTable($root, $text)
132132 {
133133 if ($text == ',') {
134134 return Factory_Inline($text);
@@ -137,7 +137,7 @@ function & Factory_YTable(& $root, $text)
137137 }
138138 }
139139
140-function & Factory_Div(& $root, $text)
140+function Factory_Div($root, $text)
141141 {
142142 $matches = array();
143143
@@ -180,13 +180,13 @@ class Inline extends Element
180180 $text : make_link($text));
181181 }
182182
183- function & insert(& $obj)
183+ function insert($obj)
184184 {
185185 $this->elements[] = $obj->elements[0];
186186 return $this;
187187 }
188188
189- function canContain(& $obj)
189+ function canContain($obj)
190190 {
191191 return is_a($obj, 'Inline');
192192 }
@@ -197,7 +197,7 @@ class Inline extends Element
197197 return join(($line_break ? '<br />' . "\n" : "\n"), $this->elements);
198198 }
199199
200- function & toPara($class = '')
200+ function toPara($class = '')
201201 {
202202 $obj = new Paragraph('', $class);
203203 $obj->insert($this);
@@ -226,7 +226,7 @@ class Paragraph extends Element
226226 $this->insert(Factory_Inline($text));
227227 }
228228
229- function canContain(& $obj)
229+ function canContain($obj)
230230 {
231231 return is_a($obj, 'Inline');
232232 }
@@ -246,11 +246,11 @@ class Heading extends Element
246246 var $id;
247247 var $msg_top;
248248
249- function Heading(& $root, $text)
249+ function Heading($root, $text)
250250 {
251251 $this->__construct($root, $text);
252252 }
253- function __construct(& $root, $text)
253+ function __construct($root, $text)
254254 {
255255 parent::__construct();
256256
@@ -260,13 +260,13 @@ class Heading extends Element
260260 $this->level++; // h2,h3,h4
261261 }
262262
263- function & insert(& $obj)
263+ function insert($obj)
264264 {
265265 parent::insert($obj);
266- return $this->last = & $this;
266+ return $this->last = $this;
267267 }
268268
269- function canContain(& $obj)
269+ function canContain($obj)
270270 {
271271 return FALSE;
272272 }
@@ -282,16 +282,16 @@ class Heading extends Element
282282 // Horizontal Rule
283283 class HRule extends Element
284284 {
285- function HRule(& $root, $text)
285+ function HRule($root, $text)
286286 {
287287 $this->__construct($root, $text);
288288 }
289- function __construct(& $root, $text)
289+ function __construct($root, $text)
290290 {
291291 parent::__construct();
292292 }
293293
294- function canContain(& $obj)
294+ function canContain($obj)
295295 {
296296 return FALSE;
297297 }
@@ -326,16 +326,16 @@ class ListContainer extends Element
326326
327327 parent::insert(new ListElement($this->level, $tag2));
328328 if ($text != '')
329- $this->last = & $this->last->insert(Factory_Inline($text));
329+ $this->last = $this->last->insert(Factory_Inline($text));
330330 }
331331
332- function canContain(& $obj)
332+ function canContain($obj)
333333 {
334334 return (! is_a($obj, 'ListContainer')
335335 || ($this->tag == $obj->tag && $this->level == $obj->level));
336336 }
337337
338- function setParent(& $parent)
338+ function setParent($parent)
339339 {
340340 parent::setParent($parent);
341341
@@ -346,10 +346,10 @@ class ListContainer extends Element
346346 $this->style = sprintf(pkwk_list_attrs_template(), $this->level, $step);
347347 }
348348
349- function & insert(& $obj)
349+ function insert($obj)
350350 {
351351 if (! is_a($obj, get_class($this)))
352- return $this->last = & $this->last->insert($obj);
352+ return $this->last = $this->last->insert($obj);
353353
354354 // Break if no elements found (BugTrack/524)
355355 if (count($obj->elements) == 1 && empty($obj->elements[0]->elements))
@@ -381,7 +381,7 @@ class ListElement extends Element
381381 $this->head = $head;
382382 }
383383
384- function canContain(& $obj)
384+ function canContain($obj)
385385 {
386386 return (! is_a($obj, 'ListContainer') || ($obj->level > $this->level));
387387 }
@@ -397,11 +397,11 @@ class ListElement extends Element
397397 // - Three
398398 class UList extends ListContainer
399399 {
400- function UList(& $root, $text)
400+ function UList($root, $text)
401401 {
402402 $this->__construct($root, $text);
403403 }
404- function __construct(& $root, $text)
404+ function __construct($root, $text)
405405 {
406406 parent::__construct('ul', 'li', '-', $text);
407407 }
@@ -412,11 +412,11 @@ class UList extends ListContainer
412412 // + Three
413413 class OList extends ListContainer
414414 {
415- function OList(& $root, $text)
415+ function OList($root, $text)
416416 {
417417 $this->__construct($root, $text);
418418 }
419- function __construct(& $root, $text)
419+ function __construct($root, $text)
420420 {
421421 parent::__construct('ol', 'li', '+', $text);
422422 }
@@ -434,9 +434,9 @@ class DList extends ListContainer
434434 function __construct($out)
435435 {
436436 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'));
438438 if ($out[1] != '')
439- $this->last = & $this->last->insert(Factory_Inline($out[1]));
439+ $this->last = $this->last->insert(Factory_Inline($out[1]));
440440 }
441441 }
442442
@@ -446,11 +446,11 @@ class BQuote extends Element
446446 {
447447 var $level;
448448
449- function BQuote(& $root, $text)
449+ function BQuote($root, $text)
450450 {
451451 $this->__construct($root, $text);
452452 }
453- function __construct(& $root, $text)
453+ function __construct($root, $text)
454454 {
455455 parent::__construct();
456456
@@ -461,29 +461,29 @@ class BQuote extends Element
461461 if ($head == '<') { // Blockquote close
462462 $level = $this->level;
463463 $this->level = 0;
464- $this->last = & $this->end($root, $level);
464+ $this->last = $this->end($root, $level);
465465 if ($text != '')
466- $this->last = & $this->last->insert(Factory_Inline($text));
466+ $this->last = $this->last->insert(Factory_Inline($text));
467467 } else {
468468 $this->insert(Factory_Inline($text));
469469 }
470470 }
471471
472- function canContain(& $obj)
472+ function canContain($obj)
473473 {
474474 return (! is_a($obj, get_class($this)) || $obj->level >= $this->level);
475475 }
476476
477- function & insert(& $obj)
477+ function insert($obj)
478478 {
479479 // BugTrack/521, BugTrack/545
480480 if (is_a($obj, 'inline'))
481481 return parent::insert($obj->toPara(' class="quotation"'));
482482
483483 if (is_a($obj, 'BQuote') && $obj->level == $this->level && count($obj->elements)) {
484- $obj = & $obj->elements[0];
484+ $obj = $obj->elements[0];
485485 if (is_a($this->last, 'Paragraph') && count($obj->elements))
486- $obj = & $obj->elements[0];
486+ $obj = $obj->elements[0];
487487 }
488488 return parent::insert($obj);
489489 }
@@ -493,14 +493,14 @@ class BQuote extends Element
493493 return $this->wrap(parent::toString(), 'blockquote');
494494 }
495495
496- function & end(& $root, $level)
496+ function end(& $root, $level)
497497 {
498- $parent = & $root->last;
498+ $parent = $root->last;
499499
500500 while (is_object($parent)) {
501501 if (is_a($parent, 'BQuote') && $parent->level == $level)
502502 return $parent->parent;
503- $parent = & $parent->parent;
503+ $parent = $parent->parent;
504504 }
505505 return $this;
506506 }
@@ -553,17 +553,17 @@ class TableCell extends Element
553553
554554 if ($text != '' && $text[0] == '#') {
555555 // Try using Div class for this $text
556- $obj = & Factory_Div($this, $text);
556+ $obj = Factory_Div($this, $text);
557557 if (is_a($obj, 'Paragraph'))
558- $obj = & $obj->elements[0];
558+ $obj = $obj->elements[0];
559559 } else {
560- $obj = & Factory_Inline($text);
560+ $obj = Factory_Inline($text);
561561 }
562562
563563 $this->insert($obj);
564564 }
565565
566- function setStyle(& $style)
566+ function setStyle($style)
567567 {
568568 foreach ($style as $key=>$value)
569569 if (! isset($this->style[$key]))
@@ -616,12 +616,12 @@ class Table extends Element
616616 $this->elements[] = $row;
617617 }
618618
619- function canContain(& $obj)
619+ function canContain($obj)
620620 {
621621 return is_a($obj, 'Table') && ($obj->col == $this->col);
622622 }
623623
624- function & insert(& $obj)
624+ function insert($obj)
625625 {
626626 $this->elements[] = $obj->elements[0];
627627 $this->types[] = $obj->type;
@@ -636,7 +636,7 @@ class Table extends Element
636636 for ($ncol = 0; $ncol < $this->col; $ncol++) {
637637 $rowspan = 1;
638638 foreach (array_reverse(array_keys($this->elements)) as $nrow) {
639- $row = & $this->elements[$nrow];
639+ $row = $this->elements[$nrow];
640640 if ($row[$ncol]->rowspan == 0) {
641641 ++$rowspan;
642642 continue;
@@ -652,9 +652,9 @@ class Table extends Element
652652 // Set colspan and style
653653 $stylerow = NULL;
654654 foreach (array_keys($this->elements) as $nrow) {
655- $row = & $this->elements[$nrow];
655+ $row = $this->elements[$nrow];
656656 if ($this->types[$nrow] == 'c')
657- $stylerow = & $row;
657+ $stylerow = $row;
658658 $colspan = 1;
659659 foreach (array_keys($row) as $ncol) {
660660 if ($row[$ncol]->colspan == 0) {
@@ -680,7 +680,7 @@ class Table extends Element
680680 foreach (array_keys($this->elements) as $nrow) {
681681 if ($this->types[$nrow] != $type)
682682 continue;
683- $row = & $this->elements[$nrow];
683+ $row = $this->elements[$nrow];
684684 $row_string = '';
685685 foreach (array_keys($row) as $ncol)
686686 $row_string .= $row[$ncol]->toString();
@@ -755,12 +755,12 @@ class YTable extends Element
755755 $this->elements[] = implode('', $str);
756756 }
757757
758- function canContain(& $obj)
758+ function canContain($obj)
759759 {
760760 return is_a($obj, 'YTable') && ($obj->col == $this->col);
761761 }
762762
763- function & insert(& $obj)
763+ function insert($obj)
764764 {
765765 $this->elements[] = $obj->elements[0];
766766 return $this;
@@ -794,12 +794,12 @@ class Pre extends Element
794794 (! $preformat_ltrim || $text == '' || $text[0] != ' ') ? $text : substr($text, 1));
795795 }
796796
797- function canContain(& $obj)
797+ function canContain($obj)
798798 {
799799 return is_a($obj, 'Pre');
800800 }
801801
802- function & insert(& $obj)
802+ function insert($obj)
803803 {
804804 $this->elements[] = $obj->elements[0];
805805 return $this;
@@ -827,7 +827,7 @@ class Div extends Element
827827 list(, $this->name, $this->param) = array_pad($out, 3, '');
828828 }
829829
830- function canContain(& $obj)
830+ function canContain($obj)
831831 {
832832 return FALSE;
833833 }
@@ -854,7 +854,7 @@ class Align extends Element
854854 $this->align = $align;
855855 }
856856
857- function canContain(& $obj)
857+ function canContain($obj)
858858 {
859859 return is_a($obj, 'Inline');
860860 }
@@ -891,13 +891,13 @@ class Body extends Element
891891 {
892892 $this->id = $id;
893893 $this->contents = new Element();
894- $this->contents_last = & $this->contents;
894+ $this->contents_last = $this->contents;
895895 parent::__construct();
896896 }
897897
898898 function parse(& $lines)
899899 {
900- $this->last = & $this;
900+ $this->last = $this;
901901 $matches = array();
902902
903903 while (! empty($lines)) {
@@ -908,7 +908,7 @@ class Body extends Element
908908
909909 if (preg_match('/^(LEFT|CENTER|RIGHT):(.*)$/', $line, $matches)) {
910910 // <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])));
912912 if ($matches[2] == '') continue;
913913 $line = $matches[2];
914914 }
@@ -917,7 +917,7 @@ class Body extends Element
917917
918918 // Empty
919919 if ($line == '') {
920- $this->last = & $this;
920+ $this->last = $this;
921921 continue;
922922 }
923923
@@ -954,7 +954,7 @@ class Body extends Element
954954
955955 // Pre
956956 if ($head == ' ' || $head == "\t") {
957- $this->last = & $this->last->add(new Pre($this, $line));
957+ $this->last = $this->last->add(new Pre($this, $line));
958958 continue;
959959 }
960960
@@ -965,19 +965,19 @@ class Body extends Element
965965 // Other Character
966966 if (isset($this->classes[$head])) {
967967 $classname = $this->classes[$head];
968- $this->last = & $this->last->add(new $classname($this, $line));
968+ $this->last = $this->last->add(new $classname($this, $line));
969969 continue;
970970 }
971971
972972 // Other Character
973973 if (isset($this->factories[$head])) {
974974 $factoryname = 'Factory_' . $this->factories[$head];
975- $this->last = & $this->last->add($factoryname($this, $line));
975+ $this->last = $this->last->add($factoryname($this, $line));
976976 continue;
977977 }
978978
979979 // Default
980- $this->last = & $this->last->add(Factory_Inline($line));
980+ $this->last = $this->last->add(Factory_Inline($line));
981981 }
982982 }
983983
@@ -1000,14 +1000,14 @@ class Body extends Element
10001000 }
10011001 $text = trim($text);
10021002 // 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));
10041004 // Add heding
10051005 return array($text . $anchor, $this->count > 1 ? "\n" . $top : '', $autoid);
10061006 }
10071007
1008- function & insert(& $obj)
1008+ function insert($obj)
10091009 {
1010- if (is_a($obj, 'Inline')) $obj = & $obj->toPara();
1010+ if (is_a($obj, 'Inline')) $obj = $obj->toPara();
10111011 return parent::insert($obj);
10121012 }
10131013
@@ -1050,7 +1050,7 @@ class Contents_UList extends ListContainer
10501050 $this->insert(Factory_Inline($text));
10511051 }
10521052
1053- function setParent(& $parent)
1053+ function setParent($parent)
10541054 {
10551055 parent::setParent($parent);
10561056 $step = $this->level;
Show on old repository browser