4 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
   38                 $childs = $a_node->child_nodes();
 
   39                 for ($i=0; $i<count($childs); $i++)
 
   41                         if ($childs[$i]->node_name() == 
"Paragraph")
 
   43                                 $this->par_node = $childs[$i];          
 
   57                 $this->par_node =& $this->dom->create_element(
"Paragraph");
 
   58                 $this->par_node =& $this->node->append_child($this->par_node);
 
   59                 $this->par_node->set_attribute(
"Language", 
"");
 
   60                 $node->append_child ($this->node);
 
   71                 $this->par_node =& $this->dom->create_element(
"Paragraph");
 
   72                 $this->par_node =& $this->node->append_child($this->par_node);
 
   73                 $this->par_node->set_attribute(
"Language", 
"");
 
   86                 if($succ_node = 
$node->next_sibling())
 
   88                         $this->node = $succ_node->insert_before($this->node, $succ_node);
 
   92                         $parent_node = 
$node->parent_node();
 
   93                         $this->node = $parent_node->append_child($this->node);
 
   95                 $this->par_node = $this->dom->create_element(
"Paragraph");
 
   96                 $this->par_node = $this->node->append_child($this->par_node);
 
   97                 $this->par_node->set_attribute(
"Language", 
"");
 
  107         function create(&$a_pg_obj, $a_hier_id, $a_pc_id = 
"")
 
  111                 $this->node =& $this->dom->create_element(
"PageContent");
 
  114                 $a_pg_obj->insertContent($this, $a_hier_id, 
IL_INSERT_AFTER, $a_pc_id);
 
  116                 $this->par_node =& $this->dom->create_element(
"Paragraph");
 
  117                 $this->par_node =& $this->node->append_child($this->par_node);
 
  118                 $this->par_node->set_attribute(
"Language", 
"");
 
  127         function setText($a_text, $a_auto_split = 
false)
 
  131                 if (!is_array($a_text))
 
  133                         $text = array(array(
"level" => 0, 
"text" => $a_text));
 
  147                 foreach ($text as 
$t)
 
  149                         $check.= 
"<Paragraph>".$t[
"text"].
"</Paragraph>"; 
 
  153                 $temp_dom = 
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$check.
'</Paragraph>',
 
  160                         $temp_dom = 
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$text[0][
"text"].
'</Paragraph>',
 
  164                         $children = $this->par_node->child_nodes();
 
  165                         for($i=0; $i<count($children); $i++)
 
  167                                 $this->par_node->remove_child($children[$i]);
 
  172                         $path = 
"//Paragraph";
 
  174                         if (count(
$res->nodeset) == 1)
 
  176                                 $new_par_node =& 
$res->nodeset[0];
 
  177                                 $new_childs = $new_par_node->child_nodes();
 
  179                                 for($i=0; $i<count($new_childs); $i++)
 
  181                                         $cloned_child =& $new_childs[$i]->clone_node(
true);
 
  182                                         $this->par_node->append_child($cloned_child);
 
  188                                 if ((count($text) > 1) && (substr($orig_characteristic, 0, 8) == 
"Headline"))
 
  190                                         $orig_characteristic = 
"";
 
  192                                 if ($text[0][
"level"] > 0)
 
  194                                         $this->par_node->set_attribute(
"Characteristic", 
'Headline'.$text[0][
"level"]);
 
  202                         for ($i=1; $i<count($text); $i++)
 
  207                                         $next_par->createAfter($c_node);
 
  209                                         if ($text[$i][
"level"] > 0)
 
  211                                                 $next_par->setCharacteristic(
"Headline".$text[$i][
"level"]);
 
  215                                                 $next_par->setCharacteristic($orig_characteristic);
 
  217                                         $ok = $next_par->setText($text[$i][
"text"], 
false);
 
  218                                         $c_node = $next_par->node;
 
  227                         $text = str_replace(
"<br>", 
"\n", $check);              
 
  228                         $text = str_replace(
"<br/>", 
"\n", $text);
 
  229                         $text = str_replace(
"<br />", 
"\n", $text);
 
  230                         $text = str_replace(
"</SimpleListItem>", 
"</SimpleListItem>\n", $text);
 
  231                         $text = str_replace(
"<SimpleBulletList>", 
"\n<SimpleBulletList>", $text);
 
  232                         $text = str_replace(
"<SimpleNumberedList>", 
"\n<SimpleNumberedList>", $text);
 
  233                         $text = str_replace(
"<Paragraph>\n", 
"<Paragraph>", $text);
 
  234                         $text = str_replace(
"</Paragraph>", 
"</Paragraph>\n", $text);
 
  235                         include_once(
"./Services/Dom/classes/class.ilDomDocument.php");
 
  236                         $doc = 
new ilDOMDocument();
 
  237                         $text = 
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$text.
'</Paragraph>';
 
  239                         $this->success = $doc->loadXML($text);
 
  240                         $error = $doc->errors;
 
  242                         foreach ($error as $e)
 
  244                                 $e = str_replace(
" in Entity", 
"", $e);
 
  258                 if (is_object($this->par_node))
 
  261                         $childs = $this->par_node->child_nodes();
 
  262                         for($i=0; $i<count($childs); $i++)
 
  264                                 $content .= $this->dom->dump_node($childs[$i]);
 
  279                 $childs = $this->par_node->parent_node()->parent_node()->child_nodes();
 
  285                 for($i=0; $i<count($childs); $i++)
 
  287                         $pchilds = $childs[$i]->child_nodes();
 
  288                         if ($pchilds[0]->node_name() == 
"Paragraph" &&
 
  289                                 $pchilds[0]->get_attribute(
"Characteristic") != 
"Code")
 
  291                                 $cur_seq[] = $childs[$i];
 
  294                                 if ($childs[$i]->get_attribute(
"PCID") == $pc_id &&
 
  295                                         $childs[$i]->get_attribute(
"HierId") == 
$hier_id)
 
  317                 foreach ($seq as $p_node)
 
  319                         $ids.= $id_sep.$p_node->get_attribute(
"HierId").
":".$p_node->get_attribute(
"PCID");
 
  320                         $po = $a_pg_obj->getContentObject($p_node->get_attribute(
"HierId"),
 
  321                                 $p_node->get_attribute(
"PCID"));
 
  322                         $s_text = $po->getText();
 
  323                         $s_text = $po->xml2output($s_text, 
true, 
false);
 
  324                         $char = $po->getCharacteristic();
 
  335                 return $ids.$content;
 
  347                         $this->par_node->set_attribute(
"Characteristic", $a_char);
 
  351                         if ($this->par_node->has_attribute(
"Characteristic"))
 
  353                                 $this->par_node->remove_attribute(
"Characteristic");
 
  365                 if (is_object($this->par_node))
 
  367                         return $this->par_node->get_attribute(
"Characteristic");
 
  379                         $this->par_node->set_attribute(
"SubCharacteristic", $a_char);
 
  383                         if ($this->par_node->has_attribute(
"SubCharacteristic"))
 
  385                                 $this->par_node->remove_attribute(
"SubCharacteristic");
 
  397                 return $this->par_node->get_attribute(
"AutoIndent");
 
  404                         $this->par_node->set_attribute(
"AutoIndent", $a_char);
 
  408                         if ($this->par_node->has_attribute(
"AutoIndent"))
 
  410                                 $this->par_node->remove_attribute(
"AutoIndent");
 
  420                 return $this->par_node->get_attribute(
"SubCharacteristic");
 
  431                         $this->par_node->set_attribute(
"DownloadTitle", $a_char);
 
  435                         if ($this->par_node->has_attribute(
"DownloadTitle"))
 
  437                                 $this->par_node->remove_attribute(
"DownloadTitle");
 
  447                 return $this->par_node->get_attribute(
"DownloadTitle");
 
  456                 $a_char = empty($a_char)?
"n":$a_char;
 
  458                 $this->par_node->set_attribute(
"ShowLineNumbers", $a_char);
 
  467                 return $this->par_node->get_attribute(
"ShowLineNumbers");
 
  475                 $this->par_node->set_attribute(
"Language", $a_lang);
 
  483                 return $this->par_node->get_attribute(
"Language");
 
  486         function input2xml($a_text, $a_wysiwyg = 0, $a_handle_lists = 
true)
 
  494         static function _input2xml($a_text, $a_lang, $a_wysiwyg = 0, $a_handle_lists = 
true)
 
  503                         $a_text = str_replace(
"<br />", chr(10), $a_text);
 
  508                 $a_text = trim($a_text);
 
  515                 $a_text = str_replace(
"&",
"&",$a_text);
 
  517                 $a_text = str_replace(
"<",
"<",$a_text);
 
  518                 $a_text = str_replace(
">",
">",$a_text);
 
  521                 $a_text = preg_replace(
'/<([\s\/]*?PageTurn.*?)>/i',
"<$1>",$a_text);
 
  522                 $a_text = preg_replace(
'/<([\s\/]*?BibItemIdentifier.*?)>/i',
"<$1>",$a_text);
 
  533                 $a_text = str_replace(chr(13).chr(10),
"<br />",$a_text);
 
  534                 $a_text = str_replace(chr(13),
"<br />", $a_text);
 
  535                 $a_text = str_replace(chr(10),
"<br />", $a_text);
 
  543                 $atags = array(
"com", 
"emp", 
"str", 
"fn", 
"quot", 
"code", 
"acc", 
"imp", 
"kw");
 
  544                 foreach ($atags as $at)
 
  546                         $a_text = str_replace(
"[".$at.
"][/".$at.
"]", 
"", $a_text);
 
  550                 $a_text = eregi_replace(
"\[com\]",
"<Comment Language=\"".$a_lang.
"\">",$a_text);
 
  551                 $a_text = eregi_replace(
"\[\/com\]",
"</Comment>",$a_text);
 
  552                 $a_text = eregi_replace(
"\[emp\]",
"<Emph>",$a_text);
 
  553                 $a_text = eregi_replace(
"\[\/emp\]",
"</Emph>",$a_text);
 
  554                 $a_text = eregi_replace(
"\[str\]",
"<Strong>",$a_text);
 
  555                 $a_text = eregi_replace(
"\[\/str\]",
"</Strong>",$a_text);
 
  556                 $a_text = eregi_replace(
"\[fn\]",
"<Footnote>",$a_text);
 
  557                 $a_text = eregi_replace(
"\[\/fn\]",
"</Footnote>",$a_text);
 
  558                 $a_text = eregi_replace(
"\[quot\]",
"<Quotation Language=\"".$a_lang.
"\">",$a_text);
 
  559                 $a_text = eregi_replace(
"\[\/quot\]",
"</Quotation>",$a_text);
 
  560                 $a_text = eregi_replace(
"\[code\]",
"<Code>",$a_text);
 
  561                 $a_text = eregi_replace(
"\[\/code\]",
"</Code>",$a_text);
 
  562                 $a_text = eregi_replace(
"\[acc\]",
"<Accent>",$a_text);
 
  563                 $a_text = eregi_replace(
"\[\/acc\]",
"</Accent>",$a_text);
 
  564                 $a_text = eregi_replace(
"\[imp\]",
"<Important>",$a_text);
 
  565                 $a_text = eregi_replace(
"\[\/imp\]",
"</Important>",$a_text);
 
  566                 $a_text = eregi_replace(
"\[kw\]",
"<Keyw>",$a_text);
 
  567                 $a_text = eregi_replace(
"\[\/kw\]",
"</Keyw>",$a_text);
 
  572                 $ws= 
"[ \t\r\f\v\n]*";
 
  574                 while (eregi(
"\[(xln$ws(url$ws=$ws\"([^\"])*\")$ws(target$ws=$ws(\"(Glossary|FAQ|Media)\"))?$ws)\]\[\/xln\]", $a_text, $found))
 
  576                         $a_text = str_replace($found[0], 
"",$a_text);
 
  578                 while (eregi(
"\[(xln$ws(url$ws=$ws(([^]])*)))$ws\]\[\/xln\]", $a_text, $found))
 
  580                         $a_text = str_replace($found[0], 
"",$a_text);
 
  583                 while (eregi(
"\[(xln$ws(url$ws=$ws\"([^\"])*\")$ws(target$ws=$ws(\"(Glossary|FAQ|Media)\"))?$ws)\]", $a_text, $found))
 
  586                         if (isset($attribs[
"url"]))
 
  590                                 if (in_array($a2[
"target"], array(
"FAQ", 
"Glossary", 
"Media")))
 
  592                                         $tstr = 
' TargetFrame="'.$a2[
"target"].
'"';
 
  594                                 $a_text = str_replace(
"[".$found[1].
"]", 
"<ExtLink Href=\"".$attribs[
"url"].
"\"$tstr>", $a_text);
 
  598                                 $a_text = str_replace(
"[".$found[1].
"]", 
"[error: xln".$found[1].
"]",$a_text);
 
  603                 while (eregi(
"\[(xln$ws(url$ws=$ws(([^]])*)))$ws\]", $a_text, $found))
 
  607                                 $a_text = str_replace(
"[".$found[1].
"]", 
"<ExtLink Href=\"".$found[3].
"\">", $a_text);
 
  611                                 $a_text = str_replace(
"[".$found[1].
"]", 
"[error: xln".$found[1].
"]",$a_text);
 
  614                 $a_text = eregi_replace(
"\[\/xln\]",
"</ExtLink>",$a_text);
 
  617                 $ws= 
"[ \t\r\f\v\n]*";
 
  618                 while (eregi(
"\[(anc$ws(name$ws=$ws\"([^\"])*\")$ws)\]", $a_text, $found))
 
  621                         $a_text = str_replace(
"[".$found[1].
"]", 
"<Anchor Name=\"".$attribs[
"name"].
"\">", $a_text);
 
  623                 $a_text = eregi_replace(
"\[\/anc\]",
"</Anchor>",$a_text);
 
  636                 global $objDefinition;
 
  638                 $rtypes = $objDefinition->getAllRepositoryTypes();
 
  642                 $ws= 
"[ \t\r\f\v\n]*";
 
  643                 $ltypes = 
"page|chap|term|media|obj|dfile|sess|wpage|".implode($rtypes, 
"|");
 
  645                 while (eregi(
"\[(iln$ws((inst$ws=$ws([\"0-9])*)?$ws".
 
  646                         "((".$ltypes.
")$ws=$ws([\"0-9])*)$ws".
 
  647                         "(target$ws=$ws(\"(New|FAQ|Media)\"))?$ws(anchor$ws=$ws(\"([^\"])*\"))?$ws))\]\[\/iln\]", $a_text, $found))
 
  649                         $a_text = str_replace($found[0], 
"",$a_text);
 
  652                 while (eregi(
"\[(iln$ws((inst$ws=$ws([\"0-9])*)?$ws".
 
  653                         "((".$ltypes.
")$ws=$ws([\"0-9])*)$ws".
 
  654                         "(target$ws=$ws(\"(New|FAQ|Media)\"))?$ws(anchor$ws=$ws(\"([^\"])*\"))?$ws))\]", $a_text, $found))
 
  657                         $inst_str = $attribs[
"inst"];
 
  659                         if (isset($attribs[
"page"]))
 
  662                                 if (!empty($found[10]))
 
  664                                         $tframestr = 
" TargetFrame=\"".$found[10].
"\" ";
 
  667                                 if ($attribs[
"anchor"] != 
"")
 
  669                                         $ancstr = 
' Anchor="'.$attribs[
"anchor"].
'" ';
 
  671                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  672                                         "<IntLink Target=\"il_".$inst_str.
"_pg_".$attribs[page].
"\" Type=\"PageObject\"".$tframestr.$ancstr.
">", $a_text);
 
  675                         else if (isset($attribs[
"chap"]))
 
  677                                 if (!empty($found[10]))
 
  679                                         $tframestr = 
" TargetFrame=\"".$found[10].
"\" ";
 
  685                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  686                                         "<IntLink Target=\"il_".$inst_str.
"_st_".$attribs[chap].
"\" Type=\"StructureObject\"".$tframestr.
">", $a_text);
 
  689                         else if (isset($attribs[
"term"]))
 
  694                                                 $tframestr = 
" TargetFrame=\"New\" ";
 
  698                                                 $tframestr = 
" TargetFrame=\"Glossary\" ";
 
  701                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  702                                         "<IntLink Target=\"il_".$inst_str.
"_git_".$attribs[term].
"\" Type=\"GlossaryItem\" $tframestr>", $a_text);
 
  705                         else if (isset($attribs[
"wpage"]))
 
  718                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  719                                         "<IntLink Target=\"il_".$inst_str.
"_wpage_".$attribs[wpage].
"\" Type=\"WikiPage\" $tframestr>", $a_text);
 
  722                         else if (isset($attribs[
"media"]))
 
  724                                 if (!empty($found[10]))
 
  726                                         $tframestr = 
" TargetFrame=\"".$found[10].
"\" ";
 
  727                                         $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  728                                                 "<IntLink Target=\"il_".$inst_str.
"_mob_".$attribs[media].
"\" Type=\"MediaObject\"".$tframestr.
">", $a_text);
 
  732                                         $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  733                                                 "<IntLink Target=\"il_".$inst_str.
"_mob_".$attribs[media].
"\" Type=\"MediaObject\"/>", $a_text);
 
  737                         else if (isset($attribs[
"dfile"]))
 
  739                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  740                                         "<IntLink Target=\"il_".$inst_str.
"_dfile_".$attribs[dfile].
"\" Type=\"File\">", $a_text);
 
  746                                 foreach ($objDefinition->getAllRepositoryTypes() as 
$t)
 
  748                                         if (isset($attribs[
$t]))
 
  750                                                 $obj_id = $attribs[
$t];
 
  753                                 if (isset($attribs[
"obj"]))
 
  755                                         $obj_id = $attribs[
"obj"];
 
  762                                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  763                                                         "<IntLink Target=\"il_".$inst_str.
"_obj_".$obj_id.
"\" Type=\"RepositoryItem\">", $a_text);
 
  767                                                 $a_text = eregi_replace(
"\[".$found[1].
"\]",
 
  768                                                         "<IntLink Target=\"il_".$inst_str.
"_".$found[6].
"_".$obj_id.
"\" Type=\"RepositoryItem\">", $a_text);
 
  773                                         $a_text = eregi_replace(
"\[".$found[1].
"\]", 
"[error: iln".$found[1].
"]",$a_text);
 
  777                 while (eregi(
"\[(iln$ws((inst$ws=$ws([\"0-9])*)?".$ws.
"media$ws=$ws([\"0-9])*)$ws)/\]", $a_text, $found))
 
  780                         $inst_str = $attribs[
"inst"];
 
  781                         $a_text = eregi_replace(
"\[".$found[1].
"/\]",
 
  782                                 "<IntLink Target=\"il_".$inst_str.
"_mob_".$attribs[media].
"\" Type=\"MediaObject\"/>", $a_text);
 
  784                 $a_text = eregi_replace(
"\[\/iln\]",
"</IntLink>",$a_text);
 
  798                 $rows = explode(
"<br />", $a_text.
"<br />");
 
  805                 foreach ($rows as 
$row)
 
  808                         if (str_replace(
"#", 
"*", substr($row, 0, 3)) == 
"***")
 
  812                         else if (str_replace(
"#", 
"*", substr($row, 0, 2)) == 
"**")
 
  816                         else if (str_replace(
"#", 
"*", substr($row, 0, 1)) == 
"*")
 
  822                         if ($level < $old_level)
 
  824                                 for ($i = $old_level; $i > $level; $i--)
 
  826                                         $text.= 
"</SimpleListItem></".$clist[$i].
">";
 
  830                                         $text.= 
"</SimpleListItem>";
 
  833                         else if ($old_level > 0 && $level > 0 && ($level == $old_level))
 
  835                                 $text.= 
"</SimpleListItem>";
 
  837                         else if (($level == $old_level) && $text != 
"")
 
  843                         if ($level > $old_level)
 
  845                                 for($i = $old_level + 1; $i <= $level; $i++)
 
  847                                         if (substr($row, $i - 1, 1) == 
"*")
 
  849                                                 $clist[$i] = 
"SimpleBulletList";
 
  853                                                 $clist[$i] = 
"SimpleNumberedList";
 
  855                                         $text.= 
"<".$clist[$i].
"><SimpleListItem>";
 
  858                         else if ($old_level > 0 && $level > 0)
 
  860                                 $text.= 
"<SimpleListItem>";
 
  862                         $text.= substr($row, $level);
 
  868                 if (substr($text, strlen($text) - 6) == 
"<br />")
 
  870                         $text = substr($text, 0, strlen($text) - 6);
 
  886                         "</SimpleListItem>", 
"<SimpleListItem>", 
"<SimpleListItem/>", 
"<SimpleNumberedList>", 
"</SimpleNumberedList>"));
 
  888                 $current_list = array();
 
  890                 for ($i=0; $i<= count($segments); $i++)
 
  892                         if ($segments[$i] == 
"<SimpleBulletList>")
 
  894                                 if (count($current_list) == 0)
 
  898                                 array_push($current_list, 
"*");
 
  901                         else if ($segments[$i] == 
"<SimpleNumberedList>")
 
  903                                 if (count($current_list) == 0)
 
  907                                 array_push($current_list, 
"#");
 
  910                         else if ($segments[$i] == 
"</SimpleBulletList>")
 
  912                                 array_pop($current_list);
 
  915                         else if ($segments[$i] == 
"</SimpleNumberedList>")
 
  917                                 array_pop($current_list);
 
  920                         else if ($segments[$i] == 
"<SimpleListItem>")
 
  924                         else if ($segments[$i] == 
"</SimpleListItem>")
 
  928                         else if ($segments[$i] == 
"<SimpleListItem/>")
 
  935                                 foreach($current_list as $list)
 
  951                                         foreach($current_list as $list)
 
  956                                 $text.= $segments[$i];
 
  966                 if ($segments[count($segments) - 1] == 
"</SimpleBulletList>" ||
 
  967                         $segments[count($segments) - 1] == 
"</SimpleNumberedList>" &&
 
  968                         substr($text, strlen($text) - 6) == 
"<br />")
 
  970                         $text = substr($text, 0, strlen($text) - 6);
 
  983                 $nothing_found = 
false;
 
  984                 while (!$nothing_found)
 
  986                         $nothing_found = 
true;
 
  988                         foreach($a_needles as $needle)
 
  990                                 $pos = stripos($a_haystack, $needle);
 
  991                                 if (is_int($pos) && ($pos < $found || $found == -1))
 
  994                                         $found_needle = $needle;
 
  995                                         $nothing_found = 
false;
 
 1000                                 $segments[] = substr($a_haystack, 0, $found);
 
 1001                                 $a_haystack = substr($a_haystack, $found);
 
 1005                                 $segments[] = substr($a_haystack, 0, strlen($found_needle));
 
 1006                                 $a_haystack = substr($a_haystack, strlen($found_needle));
 
 1009                 if ($a_haystack != 
"")
 
 1011                         $segments[] = $a_haystack;
 
 1024         static function xml2output($a_text, $a_wysiwyg = 
false, $a_replace_lists = 
true)
 
 1031                 $a_text = eregi_replace(
"<Comment[^>]*>",
"[com]",$a_text);
 
 1032                 $a_text = eregi_replace(
"</Comment>",
"[/com]",$a_text);
 
 1033                 $a_text = eregi_replace(
"<Comment/>",
"[com][/com]",$a_text);
 
 1034                 $a_text = eregi_replace(
"<Emph>",
"[emp]",$a_text);
 
 1035                 $a_text = eregi_replace(
"</Emph>",
"[/emp]",$a_text);
 
 1036                 $a_text = eregi_replace(
"<Emph/>",
"[emp][/emp]",$a_text);
 
 1037                 $a_text = eregi_replace(
"<Strong>",
"[str]",$a_text);
 
 1038                 $a_text = eregi_replace(
"</Strong>",
"[/str]",$a_text);
 
 1039                 $a_text = eregi_replace(
"<Strong/>",
"[str][/str]",$a_text);
 
 1040                 $a_text = eregi_replace(
"<Footnote[^>]*>",
"[fn]",$a_text);
 
 1041                 $a_text = eregi_replace(
"</Footnote>",
"[/fn]",$a_text);
 
 1042                 $a_text = eregi_replace(
"<Footnote/>",
"[fn][/fn]",$a_text);
 
 1043                 $a_text = eregi_replace(
"<Quotation[^>]*>",
"[quot]",$a_text);
 
 1044                 $a_text = eregi_replace(
"</Quotation>",
"[/quot]",$a_text);
 
 1045                 $a_text = eregi_replace(
"<Quotation/>",
"[quot][/quot]",$a_text);
 
 1046                 $a_text = eregi_replace(
"<Code[^>]*>",
"[code]",$a_text);
 
 1047                 $a_text = eregi_replace(
"</Code>",
"[/code]",$a_text);
 
 1048                 $a_text = eregi_replace(
"<Code/>",
"[code][/code]",$a_text);
 
 1049                 $a_text = eregi_replace(
"<Accent>",
"[acc]",$a_text);
 
 1050                 $a_text = eregi_replace(
"</Accent>",
"[/acc]",$a_text);
 
 1051                 $a_text = eregi_replace(
"<Important>",
"[imp]",$a_text);
 
 1052                 $a_text = eregi_replace(
"</Important>",
"[/imp]",$a_text);
 
 1053                 $a_text = eregi_replace(
"<Keyw>",
"[kw]",$a_text);
 
 1054                 $a_text = eregi_replace(
"</Keyw>",
"[/kw]",$a_text);
 
 1057                 if ($a_replace_lists)
 
 1065                 while (eregi(
"<IntLink($any)>", $a_text, $found))
 
 1069                         $target = explode(
"_", $attribs[
"Target"]);
 
 1071                         $inst_str = (!is_int(strpos($attribs[
"Target"], 
"__")))
 
 1072                                 ? $inst_str = 
"inst=\"".$target[1].
"\" " 
 1074                         switch($attribs[
"Type"])
 
 1077                                         $tframestr = (!empty($attribs[
"TargetFrame"]))
 
 1078                                                 ? 
" target=\"".$attribs[
"TargetFrame"].
"\"" 
 1080                                         $ancstr = (!empty($attribs[
"Anchor"]))
 
 1081                                                 ? 
' anchor="'.$attribs[
"Anchor"].
'"' 
 1083                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"page=\"".
$target_id.
"\"$tframestr$ancstr]",$a_text);
 
 1086                                 case "StructureObject":
 
 1087                                         $tframestr = (!empty($attribs[
"TargetFrame"]))
 
 1088                                                 ? 
" target=\"".$attribs[
"TargetFrame"].
"\"" 
 1090                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"chap=\"".
$target_id.
"\"$tframestr]",$a_text);
 
 1093                                 case "GlossaryItem":
 
 1094                                         $tframestr = (empty($attribs[
"TargetFrame"]) || $attribs[
"TargetFrame"] == 
"Glossary")
 
 1096                                                 : 
" target=\"".$attribs[
"TargetFrame"].
"\"";
 
 1097                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"term=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
 
 1105                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"wpage=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
 
 1109                                         if (empty($attribs[
"TargetFrame"]))
 
 1111                                                 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"media=\"".
$target_id.
"\"/]",$a_text);
 
 1115                                                 $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln media=\"".
$target_id.
"\"".
 
 1116                                                         " target=\"".$attribs[
"TargetFrame"].
"\"]",$a_text);
 
 1121                                 case "RepositoryItem":
 
 1122                                         if ($inst_str == 
"")
 
 1128                                                 $rtype = $target[count($target) - 2];
 
 1131                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"$target_type=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
 
 1136                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln ".$inst_str.
"dfile=\"".
$target_id.
"\"".$tframestr.
"]",$a_text);
 
 1140                                         $a_text = eregi_replace(
"<IntLink".$found[1].
">",
"[iln]",$a_text);
 
 1144                 $a_text = eregi_replace(
"</IntLink>",
"[/iln]",$a_text);
 
 1147                 while (eregi(
"<ExtLink($any)>", $a_text, $found))
 
 1153                         if (in_array($attribs[
"TargetFrame"], array(
"FAQ", 
"Glossary", 
"Media")))
 
 1155                                 $tstr = 
' target="'.$attribs[
"TargetFrame"].
'"';
 
 1157                         $a_text = str_replace(
"<ExtLink".$found[1].
">",
"[xln url=\"".$attribs[
"Href"].
"\"$tstr]",$a_text);
 
 1159                 $a_text = eregi_replace(
"</ExtLink>",
"[/xln]",$a_text);
 
 1162                 while (eregi(
"<Anchor($any)>", $a_text, $found))
 
 1166                         $a_text = str_replace(
"<Anchor".$found[1].
">",
"[anc name=\"".$attribs[
"Name"].
"\"]",$a_text);
 
 1168                 $a_text = eregi_replace(
"</Anchor>",
"[/anc]",$a_text);
 
 1174                         $a_text = str_replace(
"<br />", 
"\n", $a_text);
 
 1175                         $a_text = str_replace(
"<br/>", 
"\n", $a_text);
 
 1181                 $a_text = str_replace(
"{", 
"{", $a_text);
 
 1182                 $a_text = str_replace(
"}", 
"}", $a_text);
 
 1185                 $a_text = str_replace(
"<", 
"<", $a_text);
 
 1186                 $a_text = str_replace(
">", 
">",$a_text);
 
 1189                 $a_text = str_replace(
""", 
"\"", $a_text);
 
 1193                 $a_text = str_replace(
"&", 
"&", $a_text);
 
 1196                 $a_text = str_replace(
"<", 
"&lt;", $a_text);
 
 1197                 $a_text = str_replace(
">", 
"&gt;", $a_text);
 
 1211                 $a_text = str_replace (
"=<SimpleBulletList>", 
"=<br /><SimpleBulletList>", $a_text);
 
 1212                 $a_text = str_replace (
"=<SimpleNumberedList>", 
"=<br /><SimpleNumberedList>", $a_text);
 
 1213                 $a_text = str_replace (
"</SimpleBulletList>=", 
"</SimpleBulletList><br />=", $a_text);
 
 1214                 $a_text = str_replace (
"</SimpleNumberedList>=", 
"</SimpleNumberedList><br />=", $a_text);
 
 1215                 $a_text = 
"<br />".$a_text.
"<br />";            
 
 1220                 while ($c_text != 
"")
 
 1224                         $s1 = strpos($c_text, 
"<br />=");
 
 1228                                 $s2 = strpos($c_text, 
"<br />==");
 
 1229                                 if (is_int($s2) && $s2 <= $s1)
 
 1232                                         $s3 = strpos($c_text, 
"<br />===");
 
 1233                                         if (is_int($s3) && $s3 <= $s2)          
 
 1236                                                 $n = strpos($c_text, 
"<br />", $s3 + 1);
 
 1237                                                 if (
$n > ($s3+9) && substr($c_text, 
$n-3, 9) == 
"===<br />")
 
 1241                                                         if ($s3 > 0 || $head != 
"")
 
 1244                                                                 $chunks[] = array(
"level" => 0,
 
 1248                                                         $chunks[] = array(
"level" => 3,
 
 1249                                                                 "text" => trim(substr($c_text, $s3+9, 
$n-$s3-12)));
 
 1255                                                         $head.= substr($c_text, 0, 
$n);
 
 1256                                                         $c_text = substr($c_text, 
$n);
 
 1262                                                 $n = strpos($c_text, 
"<br />", $s2 + 1);
 
 1263                                                 if (
$n > ($s2+8) && substr($c_text, 
$n-2, 8) == 
"==<br />")
 
 1267                                                         if ($s2 > 0 || $head != 
"")
 
 1270                                                                 $chunks[] = array(
"level" => 0,
 
 1274                                                         $chunks[] = array(
"level" => 2, 
"text" => trim(substr($c_text, $s2+8, 
$n-$s2-10)));
 
 1280                                                         $head.= substr($c_text, 0, 
$n);
 
 1281                                                         $c_text = substr($c_text, 
$n);
 
 1288                                         $n = strpos($c_text, 
"<br />", $s1 + 1);
 
 1289                                         if (
$n > ($s1+7) && substr($c_text, 
$n-1, 7) == 
"=<br />")
 
 1293                                                 if ($s1 > 0 || $head != 
"")
 
 1296                                                         $chunks[] = array(
"level" => 0,
 
 1300                                                 $chunks[] = array(
"level" => 1, 
"text" => trim(substr($c_text, $s1+7, 
$n-$s1-8)));
 
 1306                                                 $head.= substr($c_text, 0, 
$n);
 
 1307                                                 $c_text = substr($c_text, 
$n);
 
 1315                                 $chunks[] = array(
"level" => 0, 
"text" => $head.$c_text);
 
 1320                 if (count($chunks) == 0)
 
 1322                         $chunks[] = array(
"level" => 0, 
"text" => 
"");
 
 1327                 if (substr($chunks[0][
"text"], 0, 6) == 
"<br />")
 
 1329                         $chunks[0][
"text"] = substr($chunks[0][
"text"], 6);
 
 1333                 if (substr($chunks[count($chunks) - 1][
"text"],
 
 1334                         strlen($chunks[count($chunks) - 1][
"text"]) - 6, 6) == 
"<br />")
 
 1336                         $chunks[count($chunks) - 1][
"text"] =
 
 1337                                 substr($chunks[count($chunks) - 1][
"text"], 0, strlen($chunks[count($chunks) - 1][
"text"]) - 6);
 
 1338                         if ($chunks[count($chunks) - 1][
"text"] == 
"")
 
 1340                                 unset($chunks[count($chunks) - 1]);
 
 1353                 if (substr($a_str, 0, 6) == 
"<br />" && substr($a_str, 6, 1) != 
"=")
 
 1355                         $a_str = substr($a_str, 6);
 
 1361                         if (substr($a_str, 0, 1) == 
"=")
 
 1363                                 $a_str = 
"<br />".$a_str;
 
 1374                 if (substr($a_str, strlen($a_str) - 6) == 
"<br />")
 
 1376                         $a_str = substr($a_str, 0, strlen($a_str) - 6);
 
 1399         function saveJS($a_pg_obj, $a_content, $a_char, $a_pc_id, $a_insert_at = 
"")
 
 1404                 if ($text === 
false)
 
 1409                 $pc_id = explode(
":", $a_pc_id);
 
 1410                 $insert_at = explode(
":", $a_insert_at);
 
 1411                 $t_id = explode(
":", 
$t[
"id"]);
 
 1414                 if ($a_insert_at != 
"")
 
 1417                         $par->create($a_pg_obj, $insert_at[0], $insert_at[1]);
 
 1421                         $par = $a_pg_obj->getContentObject($pc_id[0], $pc_id[1]);
 
 1424                 if ($a_insert_at != 
"")
 
 1426                         $pc_id = $a_pg_obj->generatePCId();
 
 1427                         $par->writePCId($pc_id);
 
 1428                         $this->inserted_pc_id = $pc_id;
 
 1432                         $this->inserted_pc_id = $pc_id[1];
 
 1435                 $par->setLanguage($ilUser->getLanguage());
 
 1436                 $par->setCharacteristic(
$t[
"class"]);
 
 1438                 $t2 = $par->input2xml(
$t[
"text"], 
true, 
false);
 
 1440                 $updated = $par->setText($t2, 
true);
 
 1442                 if ($updated !== 
true)
 
 1444                         echo $updated; 
exit;
 
 1447                 $updated = $par->updatePage($a_pg_obj);
 
 1462                         $a_pg_obj->stripHierIDs();
 
 1463                         $a_pg_obj->addHierIds();
 
 1466                         $combined = $a_pg_obj->getHierIdsForPCIds(
 
 1467                                 array($this->inserted_pc_id));
 
 1468                         foreach ($combined as $pc_id => 
$hier_id)
 
 1471                                 $ids.= $sep.$hier_id.
":".$pc_id;
 
 1478                 return $this->inserted_pc_id;
 
 1487                 $a_content = 
"<dummy>".$a_content.
"</dummy>";
 
 1489                 $doc = 
new DOMDocument();
 
 1496                 $res = $doc->loadXML($content);
 
 1504                 $xpath = 
new DOMXpath($doc);
 
 1506                 $elements = $xpath->query(
"//span");
 
 1507                 include_once(
"./Services/Utilities/classes/class.ilDOM2Util.php");
 
 1508                 while (!is_null($elements) && !is_null($element = $elements->item(0)))
 
 1511                         $class = $element->getAttribute(
"class");
 
 1512                         if (substr($class, 0, 16) == 
"ilc_text_inline_")
 
 1514                                 $class_arr = explode(
" ", $class);
 
 1516                                 for ($i = 1; $i < count($class_arr); $i++)
 
 1526                         $elements = $xpath->query(
"//span");
 
 1530                 $xpath = 
new DOMXpath($doc);
 
 1531                 $elements = $xpath->query(
"/dummy/div");
 
 1534                 if (!is_null($elements))
 
 1536                         foreach ($elements as $element)
 
 1538                                 $id = $element->getAttribute(
"id");
 
 1539                                 $class = $element->getAttribute(
"class");
 
 1540                                 $class = substr($class, 15);
 
 1541                                 if (trim($class) == 
"")
 
 1543                                         $class = 
"Standard";
 
 1546                                 $text = $doc->saveXML($element);
 
 1547                                 $text = str_replace(
"<br/>", 
"\n", $text);
 
 1550                                 $pos = strpos($text, 
">");
 
 1551                                 $text = substr($text, $pos + 1);
 
 1552                                 $pos = strrpos($text, 
"<");
 
 1553                                 $text = substr($text, 0, $pos);
 
 1560                                         if (!in_array($bb, array(
"code", 
"tex", 
"fn", 
"xln")))
 
 1562                                                 $text = str_replace(
"<il".$cl.
">",
 
 1563                                                         "[".$bb.
"]", $text);
 
 1564                                                 $text = str_replace(
"</il".$cl.
">",
 
 1565                                                         "[/".$bb.
"]", $text);
 
 1566                                                 $text = str_replace(
"<il".$cl.
"/>", 
"", $text);
 
 1569                                 $text = str_replace(array(
"<code>", 
"</code>"),
 
 1570                                         array(
"[code]", 
"[/code]"), $text);
 
 1572                                 $text = str_replace(
"<code/>", 
"", $text);
 
 1573                                 $text = str_replace(
'<ul class="ilc_list_u_BulletedList"/>', 
"", $text);
 
 1574                                 $text = str_replace(
'<ul class="ilc_list_o_NumberedList"/>', 
"", $text);
 
 1576                                 $ret[] = array(
"text" => $text, 
"id" => $id, 
"class" => $class);
 
 1589                 $text = str_replace(array(
"<ul>", 
"</ul>"),
 
 1590                         array(
"<SimpleBulletList>", 
"</SimpleBulletList>"), $text);
 
 1591                 $text = str_replace(array(
"<ul class='ilc_list_u_BulletedList'>", 
"</ul>"),
 
 1592                         array(
"<SimpleBulletList>", 
"</SimpleBulletList>"), $text);
 
 1593                 $text = str_replace(array(
"<ul class=\"ilc_list_u_BulletedList\">", 
"</ul>"),
 
 1594                         array(
"<SimpleBulletList>", 
"</SimpleBulletList>"), $text);
 
 1595                 $text = str_replace(array(
"<ol>", 
"</ol>"),
 
 1596                         array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"), $text);
 
 1597                 $text = str_replace(array(
"<ol class='ilc_list_o_NumberedList'>", 
"</ol>"),
 
 1598                         array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"), $text);
 
 1599                 $text = str_replace(array(
"<ol class=\"ilc_list_o_NumberedList\">", 
"</ol>"),
 
 1600                         array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"), $text);
 
 1601                 $text = str_replace(array(
"<li>", 
"</li>"),
 
 1602                         array(
"<SimpleListItem>", 
"</SimpleListItem>"), $text);
 
 1603                 $text = str_replace(array(
"<li class='ilc_list_item_StandardListItem'>", 
"</li>"),
 
 1604                         array(
"<SimpleListItem>", 
"</SimpleListItem>"), $text);
 
 1605                 $text = str_replace(array(
"<li class=\"ilc_list_item_StandardListItem\">", 
"</li>"),
 
 1606                         array(
"<SimpleListItem>", 
"</SimpleListItem>"), $text);
 
 1608                 $text = str_replace(array(
"<li class=\"ilc_list_item_StandardListItem\"/>"),
 
 1609                         array(
"<SimpleListItem></SimpleListItem>"), $text);
 
 1611                 $text = str_replace(
"<SimpleBulletList><br />", 
"<SimpleBulletList>", $text);
 
 1612                 $text = str_replace(
"<SimpleNumberedList><br />", 
"<SimpleNumberedList>", $text);
 
 1613                 $text = str_replace(
"<br /><SimpleBulletList>", 
"<SimpleBulletList>", $text);
 
 1614                 $text = str_replace(
"<br /><SimpleNumberedList>", 
"<SimpleNumberedList>", $text);
 
 1615                 $text = str_replace(
"</SimpleBulletList><br />", 
"</SimpleBulletList>", $text);
 
 1616                 $text = str_replace(
"</SimpleNumberedList><br />", 
"</SimpleNumberedList>", $text);
 
 1617                 $text = str_replace(
"</SimpleListItem><br />", 
"</SimpleListItem>", $text);
 
 1631                 $a_page->beforePageContentUpdate($this);
 
 1633                 $ret = $a_page->update();
 
 1645                 if (is_array($a_glos) && count($a_glos) > 0)
 
 1647                         include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
 1653                         $text = strip_tags($this->
getText());
 
 1654                         $found_terms = array();
 
 1655                         foreach ($a_glos as $glo)
 
 1660                                         foreach ($terms as 
$t)
 
 1662                                                 if (is_int(stripos($text, $t[
"term"])))
 
 1664                                                         $found_terms[$t[
"id"]] = 
$t;
 
 1671                         if (count($found_terms) > 0)
 
 1688                 foreach ($a_terms as $k => 
$t)
 
 1690                         $a_terms[$k][
"termlength"] = strlen(
$t[
"term"]);
 
 1697                         $a_dom = $a_dom->myDOMDocument;
 
 1701                         $a_par_node = $a_par_node->myDOMNode;
 
 1704                 $xpath = 
new DOMXPath($a_dom);
 
 1706                 if ($a_par_node == null)
 
 1708                         $parnodes = $xpath->query(
'//Paragraph');
 
 1712                         $parnodes = $xpath->query(
'//Paragraph', $a_par_node);
 
 1715                 foreach ($parnodes as $parnode)
 
 1717                         $textnodes = $xpath->query(
'//text()', $parnode);
 
 1718                         foreach ($textnodes as 
$node)
 
 1720                                 $p = $node->getNodePath();
 
 1723                                 if (!is_int(strpos($p, 
"/IntLink")) &&
 
 1724                                         !is_int(strpos($p, 
"/ExtLink")))
 
 1726                                         $node_val = $node->nodeValue;
 
 1729                                         foreach ($a_terms as 
$t)
 
 1731                                                 $pos = stripos($node_val, $t[
"term"]);
 
 1734                                                 while (is_int($pos))
 
 1738                                                         $valid_limiters = array(
"", 
" ", 
".", 
",", 
":", 
";", 
"!", 
"?", 
"\"", 
"'", 
"(", 
")");
 
 1739                                                         $b = substr($node_val, $pos - 1, 1);
 
 1740                                                         $a = substr($node_val, $pos + strlen($t[
"term"]), 1);
 
 1741                                                         if (in_array($b, $valid_limiters) && in_array($a, $valid_limiters))
 
 1743                                                                 $mid = 
'[iln term="'.$t[
"id"].
'"]'.
 
 1744                                                                         substr($node_val, $pos, strlen($t[
"term"])).
 
 1747                                                                 $node_val = substr($node_val, 0, $pos).
 
 1749                                                                         substr($node_val, $pos + strlen($t[
"term"]))
 
 1752                                                                 $pos+= strlen($mid);
 
 1756                                                                 $pos+= strlen($t[
"term"]) + 1;
 
 1758                                                         $pos = stripos($node_val, $t[
"term"], $pos);
 
 1764                                         $node->nodeValue = $node_val;
 
 1773                         $text = $a_dom->saveXML($parnode);
 
 1774                         $text = substr($text, 0, strlen($text) - strlen(
"</Paragraph>"));
 
 1775                         $text = substr($text, strpos($text, 
">") + 1);
 
 1781                         $temp_dom = 
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$text.
'</Paragraph>',
 
 1783                         $temp_dom = $temp_dom->myDOMDocument;
 
 1788                                 $children = $parnode->childNodes;
 
 1789                                 while ($parnode->hasChildNodes())
 
 1791                                         $parnode->removeChild($parnode->firstChild);
 
 1795                                 $xpath_temp = 
new DOMXPath($temp_dom);
 
 1796                                 $temp_pars = $xpath_temp->query(
"//Paragraph");
 
 1798                                 foreach ($temp_pars as $new_par_node) 
 
 1800                                         $new_childs = $new_par_node->childNodes;
 
 1802                                         foreach($new_childs as $new_child)
 
 1805                                                 $cloned_child = $a_dom->importNode($new_child, 
true);
 
 1806                                                 $parnode->appendChild($cloned_child);
 
 1822                 $a_page->buildDom();
 
 1823                 $a_dom = $a_page->getDom();
 
 1878                 $xpath = 
new DOMXPath($a_domdoc);
 
 1879                 $nodes = $xpath->query(
'//Anchor');     
 
 1881                 foreach ($nodes as 
$node)
 
 1883                         $name = $node->getAttribute(
"Name");
 
 1884                         if (trim($name) != 
"" && !in_array($name, $saved))
 
 1886                                 self::_saveAnchor($a_page->getParentType(), $a_page->getId(), $a_page->getLanguage(), $name);
 
 1900                 $ilDB->manipulate(
"DELETE FROM page_anchor WHERE ".
 
 1901                         " page_parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 1902                         " AND page_id = ".$ilDB->quote($a_page_id, 
"integer").
 
 1903                         " AND page_lang = ".$ilDB->quote($a_page_lang, 
"text")
 
 1910         static function _saveAnchor($a_parent_type, $a_page_id, $a_page_lang, $a_anchor_name)
 
 1914                 $ilDB->manipulate(
"INSERT INTO page_anchor ".
 
 1915                         "(page_parent_type, page_id, page_lang, anchor_name) VALUES (".
 
 1916                         $ilDB->quote($a_parent_type, 
"text").
",".
 
 1917                         $ilDB->quote($a_page_id, 
"integer").
",".
 
 1918                         $ilDB->quote($a_page_lang, 
"text").
",".
 
 1919                         $ilDB->quote($a_anchor_name, 
"text").
 
 1926         static function _readAnchors($a_parent_type, $a_page_id, $a_page_lang = 
"-")
 
 1930                 $and_lang = ($a_page_lang != 
"")
 
 1931                         ? 
" AND page_lang = ".$ilDB->quote($a_page_lang, 
"text")
 
 1934                 $set = $ilDB->query(
"SELECT * FROM page_anchor ".
 
 1935                         " WHERE page_parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 1936                         " AND page_id = ".$ilDB->quote($a_page_id, 
"integer").
 
 1940                 while ($rec = $ilDB->fetchAssoc($set))
 
 1942                         $anchors[] = $rec[
"anchor_name"];
 
 1956                 if ($a_page->getParentType() == 
"gdf" ||
 
 1957                         $a_page->getParentType() == 
"lm")
 
 1960                         $keywords = array();
 
 1963                         $xpath = 
new DOMXPath($a_domdoc);
 
 1964                         $nodes = $xpath->query(
'//Keyw');
 
 1965                         foreach($nodes as 
$node)
 
 1967                                 $k =  trim(strip_tags($node->nodeValue));
 
 1968                                 if (!in_array($k, $keywords))
 
 1974                         $meta_type = ($a_page->getParentType() == 
"gdf")
 
 1977                         $meta_rep_id = $a_page->getParentId();
 
 1978                         $meta_id = $a_page->getId();
 
 1980                         include_once(
"./Services/MetaData/classes/class.ilMD.php");
 
 1981                         $md_obj = 
new ilMD($meta_rep_id, $meta_id, $meta_type);
 
 1982                         $mkeywords = array();
 
 1984                         if(is_object($md_section = $md_obj->getGeneral()))
 
 1986                                 foreach($ids = $md_section->getKeywordIds() as $id)
 
 1988                                         $md_key = $md_section->getKeyword($id);
 
 1989                                         $mkeywords[] = strtolower($md_key->getKeyword());
 
 1992                                                 $lang = $md_key->getKeywordLanguageCode();
 
 1997                                         foreach($ids = $md_section->getLanguageIds() as $id)
 
 1999                                                 $md_lang = $md_section->getLanguage($id);
 
 2002                                                         $lang = $md_lang->getLanguageCode();
 
 2006                                 foreach ($keywords as $k)
 
 2008                                         if (!in_array(strtolower($k), $mkeywords))
 
 2010                                                 if (trim($k) != 
"" && 
$lang != 
"")
 
 2012                                                         $md_key = $md_section->addKeyword();
 
 2017                                                 $mkeywords[] = strtolower($k);