4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
5 require_once(
"./Services/COPage/classes/class.ilWysiwygUtil.php");
39 $childs = $a_node->child_nodes();
40 for ($i=0; $i<count($childs); $i++)
42 if ($childs[$i]->node_name() ==
"Paragraph")
44 $this->par_node = $childs[$i];
58 $this->par_node =& $this->dom->create_element(
"Paragraph");
59 $this->par_node =& $this->node->append_child($this->par_node);
60 $this->par_node->set_attribute(
"Language",
"");
61 $node->append_child ($this->node);
73 if($succ_node =
$node->next_sibling())
75 $this->node = $succ_node->insert_before($this->node, $succ_node);
79 $parent_node =
$node->parent_node();
80 $this->node = $parent_node->append_child($this->node);
82 $this->par_node = $this->dom->create_element(
"Paragraph");
83 $this->par_node = $this->node->append_child($this->par_node);
84 $this->par_node->set_attribute(
"Language",
"");
94 function create(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
97 $this->node =& $this->dom->create_element(
"PageContent");
99 $this->par_node =& $this->dom->create_element(
"Paragraph");
100 $this->par_node =& $this->node->append_child($this->par_node);
101 $this->par_node->set_attribute(
"Language",
"");
110 function setText($a_text, $a_auto_split =
false)
114 if (!is_array($a_text))
116 $text = array(array(
"level" => 0,
"text" => $a_text));
130 foreach ($text as
$t)
132 $check.=
"<Paragraph>".$t[
"text"].
"</Paragraph>";
136 $temp_dom =
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$check.
'</Paragraph>',
143 $temp_dom =
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$text[0][
"text"].
'</Paragraph>',
147 $children = $this->par_node->child_nodes();
148 for($i=0; $i<count($children); $i++)
150 $this->par_node->remove_child($children[$i]);
155 $path =
"//Paragraph";
157 if (count(
$res->nodeset) == 1)
159 $new_par_node =&
$res->nodeset[0];
160 $new_childs = $new_par_node->child_nodes();
162 for($i=0; $i<count($new_childs); $i++)
164 $cloned_child =& $new_childs[$i]->clone_node(
true);
165 $this->par_node->append_child($cloned_child);
171 if ((count($text) > 1) && (substr($orig_characteristic, 0, 8) ==
"Headline"))
173 $orig_characteristic =
"";
175 if ($text[0][
"level"] > 0)
177 $this->par_node->set_attribute(
"Characteristic",
'Headline'.$text[0][
"level"]);
185 for ($i=1; $i<count($text); $i++)
190 $next_par->createAfter($c_node);
192 if ($text[$i][
"level"] > 0)
194 $next_par->setCharacteristic(
"Headline".$text[$i][
"level"]);
198 $next_par->setCharacteristic($orig_characteristic);
200 $ok = $next_par->setText($text[$i][
"text"],
false);
201 $c_node = $next_par->node;
210 $text = str_replace(
"<br>",
"\n", $check);
211 $text = str_replace(
"<br/>",
"\n", $text);
212 $text = str_replace(
"<br />",
"\n", $text);
213 $text = str_replace(
"</SimpleListItem>",
"</SimpleListItem>\n", $text);
214 $text = str_replace(
"<SimpleBulletList>",
"\n<SimpleBulletList>", $text);
215 $text = str_replace(
"<SimpleNumberedList>",
"\n<SimpleNumberedList>", $text);
216 $text = str_replace(
"<Paragraph>\n",
"<Paragraph>", $text);
217 $text = str_replace(
"</Paragraph>",
"</Paragraph>\n", $text);
218 include_once(
"./Services/Dom/classes/class.ilDomDocument.php");
219 $doc =
new ilDOMDocument();
220 $text =
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$text.
'</Paragraph>';
222 $this->success = $doc->loadXML($text);
227 $e = str_replace(
" in Entity",
"", $e);
241 if (is_object($this->par_node))
244 $childs = $this->par_node->child_nodes();
245 for($i=0; $i<count($childs); $i++)
247 $content .= $this->dom->dump_node($childs[$i]);
266 $this->par_node->set_attribute(
"Characteristic", $a_char);
270 if ($this->par_node->has_attribute(
"Characteristic"))
272 $this->par_node->remove_attribute(
"Characteristic");
284 if (is_object($this->par_node))
286 return $this->par_node->get_attribute(
"Characteristic");
298 $this->par_node->set_attribute(
"SubCharacteristic", $a_char);
302 if ($this->par_node->has_attribute(
"SubCharacteristic"))
304 $this->par_node->remove_attribute(
"SubCharacteristic");
316 return $this->par_node->get_attribute(
"AutoIndent");
323 $this->par_node->set_attribute(
"AutoIndent", $a_char);
327 if ($this->par_node->has_attribute(
"AutoIndent"))
329 $this->par_node->remove_attribute(
"AutoIndent");
339 return $this->par_node->get_attribute(
"SubCharacteristic");
350 $this->par_node->set_attribute(
"DownloadTitle", $a_char);
354 if ($this->par_node->has_attribute(
"DownloadTitle"))
356 $this->par_node->remove_attribute(
"DownloadTitle");
366 return $this->par_node->get_attribute(
"DownloadTitle");
375 $a_char = empty($a_char)?
"n":$a_char;
377 $this->par_node->set_attribute(
"ShowLineNumbers", $a_char);
386 return $this->par_node->get_attribute(
"ShowLineNumbers");
394 $this->par_node->set_attribute(
"Language", $a_lang);
402 return $this->par_node->get_attribute(
"Language");
405 function input2xml($a_text, $a_wysiwyg = 0, $a_handle_lists =
true)
413 static function _input2xml($a_text, $a_lang, $a_wysiwyg = 0, $a_handle_lists =
true)
419 $a_text = trim($a_text);
424 $a_text = str_replace(
"&",
"&",$a_text);
425 $a_text = str_replace(
"<",
"<",$a_text);
426 $a_text = str_replace(
">",
">",$a_text);
429 $a_text = preg_replace(
'/<([\s\/]*?PageTurn.*?)>/i',
"<$1>",$a_text);
430 $a_text = preg_replace(
'/<([\s\/]*?BibItemIdentifier.*?)>/i',
"<$1>",$a_text);
441 $a_text = str_replace(chr(13).chr(10),
"<br />",$a_text);
442 $a_text = str_replace(chr(13),
"<br />", $a_text);
443 $a_text = str_replace(chr(10),
"<br />", $a_text);
451 $a_text = eregi_replace(
"\[com\]",
"<Comment Language=\"".$a_lang.
"\">",$a_text);
452 $a_text = eregi_replace(
"\[\/com\]",
"</Comment>",$a_text);
453 $a_text = eregi_replace(
"\[emp\]",
"<Emph>",$a_text);
454 $a_text = eregi_replace(
"\[\/emp\]",
"</Emph>",$a_text);
455 $a_text = eregi_replace(
"\[str\]",
"<Strong>",$a_text);
456 $a_text = eregi_replace(
"\[\/str\]",
"</Strong>",$a_text);
457 $a_text = eregi_replace(
"\[fn\]",
"<Footnote>",$a_text);
458 $a_text = eregi_replace(
"\[\/fn\]",
"</Footnote>",$a_text);
459 $a_text = eregi_replace(
"\[quot\]",
"<Quotation Language=\"".$a_lang.
"\">",$a_text);
460 $a_text = eregi_replace(
"\[\/quot\]",
"</Quotation>",$a_text);
461 $a_text = eregi_replace(
"\[code\]",
"<Code>",$a_text);
462 $a_text = eregi_replace(
"\[\/code\]",
"</Code>",$a_text);
463 $a_text = eregi_replace(
"\[acc\]",
"<Accent>",$a_text);
464 $a_text = eregi_replace(
"\[\/acc\]",
"</Accent>",$a_text);
465 $a_text = eregi_replace(
"\[imp\]",
"<Important>",$a_text);
466 $a_text = eregi_replace(
"\[\/imp\]",
"</Important>",$a_text);
467 $a_text = eregi_replace(
"\[kw\]",
"<Keyw>",$a_text);
468 $a_text = eregi_replace(
"\[\/kw\]",
"</Keyw>",$a_text);
472 $ws=
"[ \t\r\f\v\n]*";
474 while (eregi(
"\[(iln$ws((inst$ws=$ws([\"0-9])*)?$ws".
475 "((page|chap|term|media|htlm|lm|dbk|glo|exc|tst|svy|webr|cat|crs|grp|file|fold|mep|sahs|mcst|obj|dfile)$ws=$ws([\"0-9])*)$ws".
476 "(target$ws=$ws(\"(New|FAQ|Media)\"))?$ws(anchor$ws=$ws(\"([^\"])*\"))?$ws))\]", $a_text, $found))
479 $inst_str = $attribs[
"inst"];
481 if (isset($attribs[
"page"]))
484 if (!empty($found[10]))
486 $tframestr =
" TargetFrame=\"".$found[10].
"\" ";
489 if ($attribs[
"anchor"] !=
"")
491 $ancstr =
' Anchor="'.$attribs[
"anchor"].
'" ';
493 $a_text = eregi_replace(
"\[".$found[1].
"\]",
494 "<IntLink Target=\"il_".$inst_str.
"_pg_".$attribs[page].
"\" Type=\"PageObject\"".$tframestr.$ancstr.
">", $a_text);
497 else if (isset($attribs[
"chap"]))
499 if (!empty($found[10]))
501 $tframestr =
" TargetFrame=\"".$found[10].
"\" ";
507 $a_text = eregi_replace(
"\[".$found[1].
"\]",
508 "<IntLink Target=\"il_".$inst_str.
"_st_".$attribs[chap].
"\" Type=\"StructureObject\"".$tframestr.
">", $a_text);
511 else if (isset($attribs[
"term"]))
516 $tframestr =
" TargetFrame=\"New\" ";
520 $tframestr =
" TargetFrame=\"Glossary\" ";
523 $a_text = eregi_replace(
"\[".$found[1].
"\]",
524 "<IntLink Target=\"il_".$inst_str.
"_git_".$attribs[term].
"\" Type=\"GlossaryItem\" $tframestr>", $a_text);
527 else if (isset($attribs[
"media"]))
529 if (!empty($found[10]))
531 $tframestr =
" TargetFrame=\"".$found[10].
"\" ";
532 $a_text = eregi_replace(
"\[".$found[1].
"\]",
533 "<IntLink Target=\"il_".$inst_str.
"_mob_".$attribs[media].
"\" Type=\"MediaObject\"".$tframestr.
">", $a_text);
537 $a_text = eregi_replace(
"\[".$found[1].
"\]",
538 "<IntLink Target=\"il_".$inst_str.
"_mob_".$attribs[media].
"\" Type=\"MediaObject\"/>", $a_text);
542 else if (isset($attribs[
"dfile"]))
544 $a_text = eregi_replace(
"\[".$found[1].
"\]",
545 "<IntLink Target=\"il_".$inst_str.
"_dfile_".$attribs[dfile].
"\" Type=\"File\">", $a_text);
549 else if (isset($attribs[
"lm"]) || isset($attribs[
"dbk"]) || isset($attribs[
"glo"])
550 || isset($attribs[
"exc"]) || isset($attribs[
"tst"])
551 || isset($attribs[
"svy"]) || isset($attribs[
"obj"]) || isset($attribs[
'webr'])
552 || isset($attribs[
"htlm"]) || isset($attribs[
"grp"])
553 || isset($attribs[
"fold"]) || isset($attribs[
"sahs"]) || isset($attribs[
"mcst"])
554 || isset($attribs[
"mep"]) || isset($attribs[
"wiki"])
555 || isset($attribs[
"cat"]) || isset($attribs[
"crs"]) || isset($attribs[
"file"]))
557 $obj_id = (isset($attribs[
"lm"])) ? $attribs[
"lm"] : $obj_id;
558 $obj_id = (isset($attribs[
"dbk"])) ? $attribs[
"dbk"] : $obj_id;
559 $obj_id = (isset($attribs[
"glo"])) ? $attribs[
"glo"] : $obj_id;
560 $obj_id = (isset($attribs[
"exc"])) ? $attribs[
"exc"] : $obj_id;
561 $obj_id = (isset($attribs[
"htlm"])) ? $attribs[
"htlm"] : $obj_id;
562 $obj_id = (isset($attribs[
"tst"])) ? $attribs[
"tst"] : $obj_id;
563 $obj_id = (isset($attribs[
"svy"])) ? $attribs[
"svy"] : $obj_id;
564 $obj_id = (isset($attribs[
"obj"])) ? $attribs[
"obj"] : $obj_id;
565 $obj_id = (isset($attribs[
"webr"])) ? $attribs[
"webr"] : $obj_id;
566 $obj_id = (isset($attribs[
"fold"])) ? $attribs[
"fold"] : $obj_id;
567 $obj_id = (isset($attribs[
"cat"])) ? $attribs[
"cat"] : $obj_id;
568 $obj_id = (isset($attribs[
"crs"])) ? $attribs[
"crs"] : $obj_id;
569 $obj_id = (isset($attribs[
"grp"])) ? $attribs[
"grp"] : $obj_id;
570 $obj_id = (isset($attribs[
"file"])) ? $attribs[
"file"] : $obj_id;
571 $obj_id = (isset($attribs[
"sahs"])) ? $attribs[
"sahs"] : $obj_id;
572 $obj_id = (isset($attribs[
"mcst"])) ? $attribs[
"mcst"] : $obj_id;
573 $obj_id = (isset($attribs[
"mep"])) ? $attribs[
"mep"] : $obj_id;
574 $obj_id = (isset($attribs[
"wiki"])) ? $attribs[
"wiki"] : $obj_id;
579 $a_text = eregi_replace(
"\[".$found[1].
"\]",
580 "<IntLink Target=\"il_".$inst_str.
"_obj_".$obj_id.
"\" Type=\"RepositoryItem\">", $a_text);
584 $a_text = eregi_replace(
"\[".$found[1].
"\]",
585 "<IntLink Target=\"il_".$inst_str.
"_".$found[6].
"_".$obj_id.
"\" Type=\"RepositoryItem\">", $a_text);
590 $a_text = eregi_replace(
"\[".$found[1].
"\]",
"[error: iln".$found[1].
"]",$a_text);
593 while (eregi(
"\[(iln$ws((inst$ws=$ws([\"0-9])*)?".$ws.
"media$ws=$ws([\"0-9])*)$ws)/\]", $a_text, $found))
596 $inst_str = $attribs[
"inst"];
597 $a_text = eregi_replace(
"\[".$found[1].
"/\]",
598 "<IntLink Target=\"il_".$inst_str.
"_mob_".$attribs[media].
"\" Type=\"MediaObject\"/>", $a_text);
600 $a_text = eregi_replace(
"\[\/iln\]",
"</IntLink>",$a_text);
603 $ws=
"[ \t\r\f\v\n]*";
604 while (eregi(
"\[(xln$ws(url$ws=$ws\"([^\"])*\")$ws(target$ws=$ws(\"(Glossary|FAQ|Media)\"))?$ws)\]", $a_text, $found))
607 if (isset($attribs[
"url"]))
611 if (in_array($a2[
"target"], array(
"FAQ",
"Glossary",
"Media")))
613 $tstr =
' TargetFrame="'.$a2[
"target"].
'"';
615 $a_text = str_replace(
"[".$found[1].
"]",
"<ExtLink Href=\"".$attribs[
"url"].
"\"$tstr>", $a_text);
619 $a_text = str_replace(
"[".$found[1].
"]",
"[error: xln".$found[1].
"]",$a_text);
622 $a_text = eregi_replace(
"\[\/xln\]",
"</ExtLink>",$a_text);
625 $ws=
"[ \t\r\f\v\n]*";
626 while (eregi(
"\[(anc$ws(name$ws=$ws\"([^\"])*\")$ws)\]", $a_text, $found))
629 $a_text = str_replace(
"[".$found[1].
"]",
"<Anchor Name=\"".$attribs[
"name"].
"\">", $a_text);
631 $a_text = eregi_replace(
"\[\/anc\]",
"</Anchor>",$a_text);
645 $rows = explode(
"<br />", $a_text.
"<br />");
652 foreach ($rows as
$row)
655 if (str_replace(
"#",
"*", substr($row, 0, 3)) ==
"***")
659 else if (str_replace(
"#",
"*", substr($row, 0, 2)) ==
"**")
663 else if (str_replace(
"#",
"*", substr($row, 0, 1)) ==
"*")
669 if ($level < $old_level)
671 for ($i = $old_level; $i > $level; $i--)
673 $text.=
"</SimpleListItem></".$clist[$i].
">";
677 $text.=
"</SimpleListItem>";
680 else if ($old_level > 0 && $level > 0 && ($level == $old_level))
682 $text.=
"</SimpleListItem>";
684 else if (($level == $old_level) && $text !=
"")
690 if ($level > $old_level)
692 for($i = $old_level + 1; $i <= $level; $i++)
694 if (substr($row, $i - 1, 1) ==
"*")
696 $clist[$i] =
"SimpleBulletList";
700 $clist[$i] =
"SimpleNumberedList";
702 $text.=
"<".$clist[$i].
"><SimpleListItem>";
705 else if ($old_level > 0 && $level > 0)
707 $text.=
"<SimpleListItem>";
709 $text.= substr($row, $level);
715 if (substr($text, strlen($text) - 6) ==
"<br />")
717 $text = substr($text, 0, strlen($text) - 6);
733 "</SimpleListItem>",
"<SimpleListItem>",
"<SimpleListItem/>",
"<SimpleNumberedList>",
"</SimpleNumberedList>"));
735 $current_list = array();
737 for ($i=0; $i<= count($segments); $i++)
739 if ($segments[$i] ==
"<SimpleBulletList>")
741 if (count($current_list) == 0)
745 array_push($current_list,
"*");
748 else if ($segments[$i] ==
"<SimpleNumberedList>")
750 if (count($current_list) == 0)
754 array_push($current_list,
"#");
757 else if ($segments[$i] ==
"</SimpleBulletList>")
759 array_pop($current_list);
762 else if ($segments[$i] ==
"</SimpleNumberedList>")
764 array_pop($current_list);
767 else if ($segments[$i] ==
"<SimpleListItem>")
771 else if ($segments[$i] ==
"</SimpleListItem>")
775 else if ($segments[$i] ==
"<SimpleListItem/>")
782 foreach($current_list as $list)
798 foreach($current_list as $list)
803 $text.= $segments[$i];
813 if ($segments[count($segments) - 1] ==
"</SimpleBulletList>" ||
814 $segments[count($segments) - 1] ==
"</SimpleNumberedList>" &&
815 substr($text, strlen($text) - 6) ==
"<br />")
817 $text = substr($text, 0, strlen($text) - 6);
830 $nothing_found =
false;
831 while (!$nothing_found)
833 $nothing_found =
true;
835 foreach($a_needles as $needle)
837 $pos = stripos($a_haystack, $needle);
838 if (is_int(
$pos) && (
$pos < $found || $found == -1))
841 $found_needle = $needle;
842 $nothing_found =
false;
847 $segments[] = substr($a_haystack, 0, $found);
848 $a_haystack = substr($a_haystack, $found);
852 $segments[] = substr($a_haystack, 0, strlen($found_needle));
853 $a_haystack = substr($a_haystack, strlen($found_needle));
856 if ($a_haystack !=
"")
858 $segments[] = $a_haystack;
878 $a_text = eregi_replace(
"<Comment[^>]*>",
"[com]",$a_text);
879 $a_text = eregi_replace(
"</Comment>",
"[/com]",$a_text);
880 $a_text = eregi_replace(
"<Comment/>",
"[com][/com]",$a_text);
881 $a_text = eregi_replace(
"<Emph>",
"[emp]",$a_text);
882 $a_text = eregi_replace(
"</Emph>",
"[/emp]",$a_text);
883 $a_text = eregi_replace(
"<Emph/>",
"[emp][/emp]",$a_text);
884 $a_text = eregi_replace(
"<Strong>",
"[str]",$a_text);
885 $a_text = eregi_replace(
"</Strong>",
"[/str]",$a_text);
886 $a_text = eregi_replace(
"<Strong/>",
"[str][/str]",$a_text);
887 $a_text = eregi_replace(
"<Footnote[^>]*>",
"[fn]",$a_text);
888 $a_text = eregi_replace(
"</Footnote>",
"[/fn]",$a_text);
889 $a_text = eregi_replace(
"<Footnote/>",
"[fn][/fn]",$a_text);
890 $a_text = eregi_replace(
"<Quotation[^>]*>",
"[quot]",$a_text);
891 $a_text = eregi_replace(
"</Quotation>",
"[/quot]",$a_text);
892 $a_text = eregi_replace(
"<Quotation/>",
"[quot][/quot]",$a_text);
893 $a_text = eregi_replace(
"<Code[^>]*>",
"[code]",$a_text);
894 $a_text = eregi_replace(
"</Code>",
"[/code]",$a_text);
895 $a_text = eregi_replace(
"<Code/>",
"[code][/code]",$a_text);
896 $a_text = eregi_replace(
"<Accent>",
"[acc]",$a_text);
897 $a_text = eregi_replace(
"</Accent>",
"[/acc]",$a_text);
898 $a_text = eregi_replace(
"<Important>",
"[imp]",$a_text);
899 $a_text = eregi_replace(
"</Important>",
"[/imp]",$a_text);
900 $a_text = eregi_replace(
"<Keyw>",
"[kw]",$a_text);
901 $a_text = eregi_replace(
"</Keyw>",
"[/kw]",$a_text);
907 while (eregi(
"<IntLink($any)>", $a_text, $found))
911 $target = explode(
"_", $attribs[
"Target"]);
913 $inst_str = (!is_int(strpos($attribs[
"Target"],
"__")))
914 ? $inst_str =
"inst=\"".$target[1].
"\" "
916 switch($attribs[
"Type"])
919 $tframestr = (!empty($attribs[
"TargetFrame"]))
920 ?
" target=\"".$attribs[
"TargetFrame"].
"\""
922 $ancstr = (!empty($attribs[
"Anchor"]))
923 ?
' anchor="'.$attribs[
"Anchor"].
'"'
925 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"page=\"".
$target_id.
"\"$tframestr$ancstr]",$a_text);
928 case "StructureObject":
929 $tframestr = (!empty($attribs[
"TargetFrame"]))
930 ?
" target=\"".$attribs[
"TargetFrame"].
"\""
932 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"chap=\"".
$target_id.
"\"$tframestr]",$a_text);
936 $tframestr = (empty($attribs[
"TargetFrame"]) || $attribs[
"TargetFrame"] ==
"Glossary")
938 :
" target=\"".$attribs[
"TargetFrame"].
"\"";
939 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"term=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
943 if (empty($attribs[
"TargetFrame"]))
945 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"media=\"".
$target_id.
"\"/]",$a_text);
949 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln media=\"".
$target_id.
"\"".
950 " target=\"".$attribs[
"TargetFrame"].
"\"]",$a_text);
955 case "RepositoryItem":
962 $rtype = $target[count($target) - 2];
965 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"$target_type=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
970 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"dfile=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
974 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln]",$a_text);
978 $a_text = eregi_replace(
"</IntLink>",
"[/iln]",$a_text);
981 while (eregi(
"<ExtLink($any)>", $a_text, $found))
987 if (in_array($attribs[
"TargetFrame"], array(
"FAQ",
"Glossary",
"Media")))
989 $tstr =
' target="'.$attribs[
"TargetFrame"].
'"';
991 $a_text = str_replace(
"<ExtLink".$found[1].
">",
"[xln url=\"".$attribs[
"Href"].
"\"$tstr]",$a_text);
993 $a_text = eregi_replace(
"</ExtLink>",
"[/xln]",$a_text);
996 while (eregi(
"<Anchor($any)>", $a_text, $found))
1000 $a_text = str_replace(
"<Anchor".$found[1].
">",
"[anc name=\"".$attribs[
"Name"].
"\"]",$a_text);
1002 $a_text = eregi_replace(
"</Anchor>",
"[/anc]",$a_text);
1006 $a_text = str_replace(
"<br />",
"\n", $a_text);
1007 $a_text = str_replace(
"<br/>",
"\n", $a_text);
1010 $a_text = str_replace(
"{",
"{", $a_text);
1011 $a_text = str_replace(
"}",
"}", $a_text);
1014 $a_text = str_replace(
"<",
"<", $a_text);
1015 $a_text = str_replace(
">",
">",$a_text);
1018 $a_text = str_replace(
""",
"\"", $a_text);
1022 $a_text = str_replace(
"&",
"&", $a_text);
1025 $a_text = str_replace(
"<",
"&lt;", $a_text);
1026 $a_text = str_replace(
">",
"&gt;", $a_text);
1040 $a_text = str_replace (
"=<SimpleBulletList>",
"=<br /><SimpleBulletList>", $a_text);
1041 $a_text = str_replace (
"=<SimpleNumberedList>",
"=<br /><SimpleNumberedList>", $a_text);
1042 $a_text = str_replace (
"</SimpleBulletList>=",
"</SimpleBulletList><br />=", $a_text);
1043 $a_text = str_replace (
"</SimpleNumberedList>=",
"</SimpleNumberedList><br />=", $a_text);
1044 $a_text =
"<br />".$a_text.
"<br />";
1049 while ($c_text !=
"")
1053 $s1 = strpos($c_text,
"<br />=");
1057 $s2 = strpos($c_text,
"<br />==");
1058 if (is_int($s2) && $s2 <= $s1)
1061 $s3 = strpos($c_text,
"<br />===");
1062 if (is_int($s3) && $s3 <= $s2)
1065 $n = strpos($c_text,
"<br />", $s3 + 1);
1066 if ($n > ($s3+9) && substr($c_text, $n-3, 9) ==
"===<br />")
1070 if ($s3 > 0 || $head !=
"")
1073 $chunks[] = array(
"level" => 0,
1077 $chunks[] = array(
"level" => 3,
1078 "text" => trim(substr($c_text, $s3+9, $n-$s3-12)));
1084 $head.= substr($c_text, 0, $n);
1085 $c_text = substr($c_text, $n);
1091 $n = strpos($c_text,
"<br />", $s2 + 1);
1092 if ($n > ($s2+8) && substr($c_text, $n-2, 8) ==
"==<br />")
1096 if ($s2 > 0 || $head !=
"")
1099 $chunks[] = array(
"level" => 0,
1103 $chunks[] = array(
"level" => 2,
"text" => trim(substr($c_text, $s2+8, $n-$s2-10)));
1109 $head.= substr($c_text, 0, $n);
1110 $c_text = substr($c_text, $n);
1117 $n = strpos($c_text,
"<br />", $s1 + 1);
1118 if ($n > ($s1+7) && substr($c_text, $n-1, 7) ==
"=<br />")
1122 if ($s1 > 0 || $head !=
"")
1125 $chunks[] = array(
"level" => 0,
1129 $chunks[] = array(
"level" => 1,
"text" => trim(substr($c_text, $s1+7, $n-$s1-8)));
1135 $head.= substr($c_text, 0, $n);
1136 $c_text = substr($c_text, $n);
1144 $chunks[] = array(
"level" => 0,
"text" => $head.$c_text);
1149 if (count($chunks) == 0)
1151 $chunks[] = array(
"level" => 0,
"text" =>
"");
1156 if (substr($chunks[0][
"text"], 0, 6) ==
"<br />")
1158 $chunks[0][
"text"] = substr($chunks[0][
"text"], 6);
1162 if (substr($chunks[count($chunks) - 1][
"text"],
1163 strlen($chunks[count($chunks) - 1][
"text"]) - 6, 6) ==
"<br />")
1165 $chunks[count($chunks) - 1][
"text"] =
1166 substr($chunks[count($chunks) - 1][
"text"], 0, strlen($chunks[count($chunks) - 1][
"text"]) - 6);
1167 if ($chunks[count($chunks) - 1][
"text"] ==
"")
1169 unset($chunks[count($chunks) - 1]);
1182 if (substr($a_str, 0, 6) ==
"<br />" && substr($a_str, 6, 1) !=
"=")
1184 $a_str = substr($a_str, 6);
1190 if (substr($a_str, 0, 1) ==
"=")
1192 $a_str =
"<br />".$a_str;
1203 if (substr($a_str, strlen($a_str) - 6) ==
"<br />")
1205 $a_str = substr($a_str, 0, strlen($a_str) - 6);