4require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
   37            "quot" => 
"Quotation",
 
   47        $this->
user = $DIC->user();
 
   68        return array_flip(self::$bb_tags);
 
   80        parent::setNode($a_node);               
 
   82        $childs = $a_node->child_nodes();
 
   83        for (
$i=0; 
$i<count($childs); 
$i++) {
 
   84            if ($childs[
$i]->node_name() == 
"Paragraph") {
 
   85                $this->par_node = $childs[
$i];          
 
   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", 
"");
 
  102        $node->append_child($this->node);
 
  113        $this->par_node = $this->dom->create_element(
"Paragraph");
 
  114        $this->par_node = $this->node->append_child($this->par_node);
 
  115        $this->par_node->set_attribute(
"Language", 
"");
 
  128        if ($succ_node = 
$node->next_sibling()) {
 
  129            $this->node = $succ_node->insert_before($this->node, $succ_node);
 
  131            $parent_node = 
$node->parent_node();
 
  132            $this->node = $parent_node->append_child($this->node);
 
  134        $this->par_node = $this->dom->create_element(
"Paragraph");
 
  135        $this->par_node = $this->node->append_child($this->par_node);
 
  136        $this->par_node->set_attribute(
"Language", 
"");
 
  146    public function create(&$a_pg_obj, $a_hier_id, $a_pc_id = 
"")
 
  150        $this->node = $this->dom->create_element(
"PageContent");
 
  153        $a_pg_obj->insertContent($this, $a_hier_id, 
IL_INSERT_AFTER, $a_pc_id);
 
  155        $this->par_node = $this->dom->create_element(
"Paragraph");
 
  156        $this->par_node = $this->node->append_child($this->par_node);
 
  157        $this->par_node->set_attribute(
"Language", 
"");
 
  166    public function setText($a_text, $a_auto_split = 
false)
 
  168        if (!is_array($a_text)) {
 
  169            $text = array(array(
"level" => 0, 
"text" => $a_text));
 
  181            $check.= 
"<Paragraph>" . 
$t[
"text"] . 
"</Paragraph>";
 
  186            '<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . $check . 
'</Paragraph>',
 
  195                '<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . 
$text[0][
"text"] . 
'</Paragraph>',
 
  201            $children = $this->par_node->child_nodes();
 
  202            for (
$i=0; 
$i<count($children); 
$i++) {
 
  203                $this->par_node->remove_child($children[
$i]);
 
  208            $path = 
"//Paragraph";
 
  210            if (count(
$res->nodeset) == 1) {
 
  211                $new_par_node = 
$res->nodeset[0];
 
  212                $new_childs = $new_par_node->child_nodes();
 
  214                for (
$i=0; 
$i<count($new_childs); 
$i++) {
 
  215                    $cloned_child = $new_childs[
$i]->clone_node(
true);
 
  216                    $this->par_node->append_child($cloned_child);
 
  222                if ((count(
$text) > 1) && (substr($orig_characteristic, 0, 8) == 
"Headline")) {
 
  223                    $orig_characteristic = 
"";
 
  225                if (
$text[0][
"level"] > 0) {
 
  226                    $this->par_node->set_attribute(
"Characteristic", 
'Headline' . 
$text[0][
"level"]);
 
  237                    $next_par->createAfter($c_node);
 
  240                        $next_par->setCharacteristic(
"Headline" . 
$text[
$i][
"level"]);
 
  242                        $next_par->setCharacteristic($orig_characteristic);
 
  244                    $ok = $next_par->setText(
$text[
$i][
"text"], 
false);
 
  245                    $c_node = $next_par->node;
 
  252            $text = str_replace(
"<br>", 
"\n", $check);          
 
  255            $text = str_replace(
"</SimpleListItem>", 
"</SimpleListItem>\n", 
$text);
 
  256            $text = str_replace(
"<SimpleBulletList>", 
"\n<SimpleBulletList>", 
$text);
 
  257            $text = str_replace(
"<SimpleNumberedList>", 
"\n<SimpleNumberedList>", 
$text);
 
  258            $text = str_replace(
"<Paragraph>\n", 
"<Paragraph>", 
$text);
 
  259            $text = str_replace(
"</Paragraph>", 
"</Paragraph>\n", 
$text);
 
  260            include_once(
"./Services/Dom/classes/class.ilDomDocument.php");
 
  261            $doc = 
new ilDOMDocument();
 
  262            $text = 
'<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . 
$text . 
'</Paragraph>';
 
  264            $this->success = $doc->loadXML(
$text);
 
  268                $e = str_replace(
" in Entity", 
"", $e);
 
  269                $estr.= $e . 
"<br />";
 
  272                $estr.= 
"<br />" . 
$text;
 
  284    public function getText($a_short_mode = 
false)
 
  286        if (is_object($this->par_node)) {
 
  288            $childs = $this->par_node->child_nodes();
 
  289            for (
$i=0; 
$i<count($childs); 
$i++) {
 
  290                $content .= $this->dom->dump_node($childs[
$i]);
 
  303        $childs = $this->par_node->parent_node()->parent_node()->child_nodes();
 
  309        for (
$i=0; 
$i<count($childs); 
$i++) {
 
  310            $pchilds = $childs[
$i]->child_nodes();
 
  311            if ($pchilds[0]->node_name() == 
"Paragraph" &&
 
  312                $pchilds[0]->get_attribute(
"Characteristic") != 
"Code") {
 
  313                $cur_seq[] = $childs[
$i];
 
  316                if ($childs[
$i]->get_attribute(
"PCID") == $pc_id &&
 
  317                    $childs[
$i]->get_attribute(
"HierId") == 
$hier_id) {
 
  335        foreach ($seq as $p_node) {
 
  336            $ids.= $id_sep . $p_node->get_attribute(
"HierId") . 
":" . $p_node->get_attribute(
"PCID");
 
  337            $po = $a_pg_obj->getContentObject(
 
  338                $p_node->get_attribute(
"HierId"),
 
  339                $p_node->get_attribute(
"PCID")
 
  341            $s_text = $po->getText();
 
  342            $s_text = $po->xml2output($s_text, 
true, 
false);
 
  343            $char = $po->getCharacteristic();
 
  353        return $ids . $content;
 
  363        if (!empty($a_char)) {
 
  364            $this->par_node->set_attribute(
"Characteristic", $a_char);
 
  366            if ($this->par_node->has_attribute(
"Characteristic")) {
 
  367                $this->par_node->remove_attribute(
"Characteristic");
 
  379        if (is_object($this->par_node)) {
 
  380            return $this->par_node->get_attribute(
"Characteristic");
 
  390        if (!empty($a_char)) {
 
  391            $this->par_node->set_attribute(
"SubCharacteristic", $a_char);
 
  393            if ($this->par_node->has_attribute(
"SubCharacteristic")) {
 
  394                $this->par_node->remove_attribute(
"SubCharacteristic");
 
  406        return $this->par_node->get_attribute(
"AutoIndent");
 
  411        if (!empty($a_char)) {
 
  412            $this->par_node->set_attribute(
"AutoIndent", $a_char);
 
  414            if ($this->par_node->has_attribute(
"AutoIndent")) {
 
  415                $this->par_node->remove_attribute(
"AutoIndent");
 
  425        return $this->par_node->get_attribute(
"SubCharacteristic");
 
  434        if (!empty($a_char)) {
 
  435            $this->par_node->set_attribute(
"DownloadTitle", $a_char);
 
  437            if ($this->par_node->has_attribute(
"DownloadTitle")) {
 
  438                $this->par_node->remove_attribute(
"DownloadTitle");
 
  448        return $this->par_node->get_attribute(
"DownloadTitle");
 
  457        $a_char = empty($a_char)?
"n":$a_char;
 
  459        $this->par_node->set_attribute(
"ShowLineNumbers", $a_char);
 
  468        return $this->par_node->get_attribute(
"ShowLineNumbers");
 
  476        $this->par_node->set_attribute(
"Language", $a_lang);
 
  484        return $this->par_node->get_attribute(
"Language");
 
  487    public function input2xml($a_text, $a_wysiwyg = 0, $a_handle_lists = 
true)
 
  502        $a_text = preg_replace(
'/\[' . $a_bb . 
'\]/i', 
"<" . $a_tag . 
">", $a_text);
 
  503        $a_text = preg_replace(
'/\[\/' . $a_bb . 
'\]/i', 
"</" . $a_tag . 
">", $a_text);
 
  511    public static function _input2xml($a_text, $a_lang, $a_wysiwyg = 0, $a_handle_lists = 
true)
 
  518            $a_text = str_replace(
"<br />", chr(10), $a_text);
 
  523        $a_text = trim($a_text);
 
  529            $a_text = str_replace(
"&", 
"&", $a_text);
 
  531        $a_text = str_replace(
"<", 
"<", $a_text);
 
  532        $a_text = str_replace(
">", 
">", $a_text);
 
  535        $a_text = preg_replace(
'/<([\s\/]*?PageTurn.*?)>/i', 
"<$1>", $a_text);
 
  536        $a_text = preg_replace(
'/<([\s\/]*?BibItemIdentifier.*?)>/i', 
"<$1>", $a_text);
 
  547        $a_text = str_replace(chr(13) . chr(10), 
"<br />", $a_text);
 
  548        $a_text = str_replace(chr(13), 
"<br />", $a_text);
 
  549        $a_text = str_replace(chr(10), 
"<br />", $a_text);
 
  551        if ($a_handle_lists) {
 
  555        foreach (self::getBBMap() as $bb => 
$tag) {
 
  557            $a_text = str_replace(
"[" . $bb . 
"][/" . $bb . 
"]", 
"", $a_text);
 
  566        $ws= 
"[ \t\r\f\v\n]*";
 
  568        while (preg_match(
"~\[(xln$ws(url$ws=$ws\"([^\"])*\")$ws(target$ws=$ws(\"(Glossary|FAQ|Media)\"))?$ws)\]\[\/xln\]~i", $a_text, $found)) {
 
  569            $a_text = str_replace($found[0], 
"", $a_text);
 
  571        while (preg_match(
'~\[(xln$ws(url$ws=$ws(([^]])*)))$ws\]\[\/xln\]~i', $a_text, $found)) {
 
  572            $a_text = str_replace($found[0], 
"", $a_text);
 
  575        while (preg_match(
"~\[(xln$ws(url$ws=$ws\"([^\"])*\")$ws(target$ws=$ws(\"(Glossary|FAQ|Media)\"))?$ws)\]~i", $a_text, $found)) {
 
  577            if (isset($attribs[
"url"])) {
 
  580                if (in_array($a2[
"target"], array(
"FAQ", 
"Glossary", 
"Media"))) {
 
  581                    $tstr = 
' TargetFrame="' . $a2[
"target"] . 
'"';
 
  583                $a_text = str_replace(
"[" . $found[1] . 
"]", 
"<ExtLink Href=\"" . $attribs[
"url"] . 
"\"$tstr>", $a_text);
 
  585                $a_text = str_replace(
"[" . $found[1] . 
"]", 
"[error: xln" . $found[1] . 
"]", $a_text);
 
  590        while (preg_match(
'~\[(xln$ws(url$ws=$ws(([^]])*)))$ws\]~i', $a_text, $found)) {
 
  591            if ($found[3] != 
"") {
 
  592                $a_text = str_replace(
"[" . $found[1] . 
"]", 
"<ExtLink Href=\"" . $found[3] . 
"\">", $a_text);
 
  594                $a_text = str_replace(
"[" . $found[1] . 
"]", 
"[error: xln" . $found[1] . 
"]", $a_text);
 
  597        $a_text = preg_replace(
'~\[\/xln\]~i', 
"</ExtLink>", $a_text);
 
  600        $ws= 
"[ \t\r\f\v\n]*";
 
  601        while (preg_match(
"~\[(anc$ws(name$ws=$ws\"([^\"])*\")$ws)\]~i", $a_text, $found)) {
 
  603            $a_text = str_replace(
"[" . $found[1] . 
"]", 
"<Anchor Name=\"" . $attribs[
"name"] . 
"\">", $a_text);
 
  605        $a_text = preg_replace(
"~\[\/anc\]~i", 
"</Anchor>", $a_text);
 
  608        while (preg_match(
"~\[(marked$ws(class$ws=$ws\"([^\"])*\")$ws)\]~i", $a_text, $found)) {
 
  610            if (isset($attribs[
"class"])) {
 
  611                $a_text = str_replace(
"[" . $found[1] . 
"]", 
"<Marked Class=\"" . $attribs[
"class"] . 
"\">", $a_text);
 
  613                $a_text = str_replace(
"[" . $found[1] . 
"]", 
"[error:marked" . $found[1] . 
"]", $a_text);
 
  616        $a_text = preg_replace(
'~\[\/marked\]~i', 
"</Marked>", $a_text);
 
  633        $objDefinition = 
$DIC[
"objDefinition"];
 
  635        $rtypes = $objDefinition->getAllRepositoryTypes();
 
  639        $ws= 
"[ \t\r\f\v\n]*";
 
  640        $ltypes = 
"page|chap|term|media|obj|dfile|sess|wpage|ppage|" . implode($rtypes, 
"|");
 
  642        while (preg_match(
'~\[(iln' . $ws . 
'((inst' . $ws . 
'=' . $ws . 
'([\"0-9])*)?' . $ws .
 
  643            "((" . $ltypes . 
")$ws=$ws([\"0-9])*)$ws" .
 
  644            "(target$ws=$ws(\"(New|FAQ|Media)\"))?$ws(anchor$ws=$ws(\"([^\"])*\"))?$ws))\]\[\/iln\]~i", $a_text, $found)) {
 
  645            $a_text = str_replace($found[0], 
"", $a_text);
 
  647        while (preg_match(
'~\[(iln' . $ws . 
'((inst' . $ws . 
'=' . $ws . 
'([\"0-9])*)?' . $ws .
 
  648            "((" . $ltypes . 
")$ws=$ws([\"0-9])*)$ws" .
 
  649            "(target$ws=$ws(\"(New|FAQ|Media)\"))?$ws(anchor$ws=$ws(\"([^\"])*\"))?$ws))\]~i", $a_text, $found)) {
 
  651            $inst_str = $attribs[
"inst"];
 
  653            if (isset($attribs[
"page"])) {
 
  655                if (!empty($found[10])) {
 
  656                    $tframestr = 
" TargetFrame=\"" . $found[10] . 
"\" ";
 
  659                if ($attribs[
"anchor"] != 
"") {
 
  660                    $ancstr = 
' Anchor="' . $attribs[
"anchor"] . 
'" ';
 
  662                $a_text = preg_replace(
 
  663                    '/\[' . $found[1] . 
'\]/i',
 
  664                    "<IntLink Target=\"il_" . $inst_str . 
"_pg_" . $attribs[
'page'] . 
"\" Type=\"PageObject\"" . $tframestr . $ancstr . 
">",
 
  669            elseif (isset($attribs[
"chap"])) {
 
  670                if (!empty($found[10])) {
 
  671                    $tframestr = 
" TargetFrame=\"" . $found[10] . 
"\" ";
 
  675                $a_text = preg_replace(
 
  676                    '/\[' . $found[1] . 
'\]/i',
 
  677                    "<IntLink Target=\"il_" . $inst_str . 
"_st_" . $attribs[
'chap'] . 
"\" Type=\"StructureObject\"" . $tframestr . 
">",
 
  682            elseif (isset($attribs[
"term"])) {
 
  683                switch ($found[10]) {
 
  685                        $tframestr = 
" TargetFrame=\"New\" ";
 
  689                        $tframestr = 
" TargetFrame=\"Glossary\" ";
 
  692                $a_text = preg_replace(
 
  693                    '/\[' . $found[1] . 
'\]/i',
 
  694                    "<IntLink Target=\"il_" . $inst_str . 
"_git_" . $attribs[
'term'] . 
"\" Type=\"GlossaryItem\" $tframestr>",
 
  699            elseif (isset($attribs[
"wpage"])) {
 
  701                $a_text = preg_replace(
 
  702                    '/\[' . $found[1] . 
'\]/i',
 
  703                    "<IntLink Target=\"il_" . $inst_str . 
"_wpage_" . $attribs[
'wpage'] . 
"\" Type=\"WikiPage\" $tframestr>",
 
  708            elseif (isset($attribs[
"ppage"])) {
 
  710                $a_text = preg_replace(
 
  711                    '/\[' . $found[1] . 
'\]/i',
 
  712                    "<IntLink Target=\"il_" . $inst_str . 
"_ppage_" . $attribs[
'ppage'] . 
"\" Type=\"PortfolioPage\" $tframestr>",
 
  717            elseif (isset($attribs[
"media"])) {
 
  718                if (!empty($found[10])) {
 
  719                    $tframestr = 
" TargetFrame=\"" . $found[10] . 
"\" ";
 
  720                    $a_text = preg_replace(
 
  721                        '/\[' . $found[1] . 
'\]/i',
 
  722                        "<IntLink Target=\"il_" . $inst_str . 
"_mob_" . $attribs[
'media'] . 
"\" Type=\"MediaObject\"" . $tframestr . 
">",
 
  726                    $a_text = preg_replace(
 
  727                        '/\[' . $found[1] . 
'\]/i',
 
  728                        "<IntLink Target=\"il_" . $inst_str . 
"_mob_" . $attribs[
'media'] . 
"\" Type=\"MediaObject\"/>",
 
  734            elseif (isset($attribs[
"dfile"])) {
 
  735                $a_text = preg_replace(
 
  736                    '/\[' . $found[1] . 
'\]/i',
 
  737                    "<IntLink Target=\"il_" . $inst_str . 
"_dfile_" . $attribs[
'dfile'] . 
"\" Type=\"File\">",
 
  744                foreach ($objDefinition->getAllRepositoryTypes() as 
$t) {
 
  745                    if (isset($attribs[
$t])) {
 
  746                        $obj_id = $attribs[
$t];
 
  749                if (isset($attribs[
"obj"])) {
 
  750                    $obj_id = $attribs[
"obj"];
 
  754                    if ($inst_str == 
"") {
 
  755                        $a_text = preg_replace(
 
  756                            '/\[' . $found[1] . 
'\]/i',
 
  757                            "<IntLink Target=\"il_" . $inst_str . 
"_obj_" . $obj_id . 
"\" Type=\"RepositoryItem\">",
 
  761                        $a_text = preg_replace(
 
  762                            '/\[' . $found[1] . 
'\]/i',
 
  763                            "<IntLink Target=\"il_" . $inst_str . 
"_" . $found[6] . 
"_" . $obj_id . 
"\" Type=\"RepositoryItem\">",
 
  768                    $a_text = preg_replace(
'/\[' . $found[1] . 
'\]/i', 
"[error: iln" . $found[1] . 
"]", $a_text);
 
  773        while (preg_match(
"~\[(iln$ws((inst$ws=$ws([\"0-9])*)?" . $ws . 
"media$ws=$ws([\"0-9])*)$ws)/\]~i", $a_text, $found)) {
 
  775            $inst_str = $attribs[
"inst"];
 
  776            $a_text = preg_replace(
 
  777                '~\[' . $found[1] . 
'/\]~i',
 
  778                "<IntLink Target=\"il_" . $inst_str . 
"_mob_" . $attribs[
'media'] . 
"\" Type=\"MediaObject\"/>",
 
  784        while (preg_match(
"~\[(iln$ws((inst$ws=$ws([\"0-9])*)?" . $ws . 
"user$ws=$ws(\"([^\"])*)\")$ws)/\]~i", $a_text, $found)) {
 
  786            $inst_str = $attribs[
"inst"];
 
  787            include_once(
"./Services/User/classes/class.ilObjUser.php");
 
  789            $a_text = preg_replace(
 
  790                '~\[' . $found[1] . 
'/\]~i',
 
  791                "<IntLink Target=\"il_" . $inst_str . 
"_user_" . $user_id . 
"\" Type=\"User\"/>",
 
  796        $a_text = preg_replace(
'~\[\/iln\]~i', 
"</IntLink>", $a_text);
 
  810        $rows = explode(
"<br />", $a_text . 
"<br />");
 
  819            if (str_replace(
"#", 
"*", substr(
$row, 0, 3)) == 
"***") {
 
  821            } elseif (str_replace(
"#", 
"*", substr(
$row, 0, 2)) == 
"**") {
 
  823            } elseif (str_replace(
"#", 
"*", substr(
$row, 0, 1)) == 
"*") {
 
  828            if ($level < $old_level) {
 
  829                for (
$i = $old_level; 
$i > $level; 
$i--) {
 
  830                    $text.= 
"</SimpleListItem></" . $clist[
$i] . 
">";
 
  833                    $text.= 
"</SimpleListItem>";
 
  835            } elseif ($old_level > 0 && $level > 0 && ($level == $old_level)) {
 
  836                $text.= 
"</SimpleListItem>";
 
  837            } elseif (($level == $old_level) && 
$text != 
"") {
 
  842            if ($level > $old_level) {
 
  843                for (
$i = $old_level + 1; 
$i <= $level; 
$i++) {
 
  844                    if (substr(
$row, 
$i - 1, 1) == 
"*") {
 
  845                        $clist[
$i] = 
"SimpleBulletList";
 
  847                        $clist[
$i] = 
"SimpleNumberedList";
 
  849                    $text.= 
"<" . $clist[
$i] . 
"><SimpleListItem>";
 
  851            } elseif ($old_level > 0 && $level > 0) {
 
  852                $text.= 
"<SimpleListItem>";
 
  860        if (substr(
$text, strlen(
$text) - 6) == 
"<br />") {
 
  877            "</SimpleListItem>", 
"<SimpleListItem>", 
"<SimpleListItem/>", 
"<SimpleNumberedList>", 
"</SimpleNumberedList>"));
 
  879        $current_list = array();
 
  881        for (
$i=0; 
$i<= count($segments); 
$i++) {
 
  882            if ($segments[
$i] == 
"<SimpleBulletList>") {
 
  883                if (count($current_list) == 0) {
 
  886                array_push($current_list, 
"*");
 
  888            } elseif ($segments[
$i] == 
"<SimpleNumberedList>") {
 
  889                if (count($current_list) == 0) {
 
  892                array_push($current_list, 
"#");
 
  894            } elseif ($segments[
$i] == 
"</SimpleBulletList>") {
 
  895                array_pop($current_list);
 
  897            } elseif ($segments[
$i] == 
"</SimpleNumberedList>") {
 
  898                array_pop($current_list);
 
  900            } elseif ($segments[
$i] == 
"<SimpleListItem>") {
 
  902            } elseif ($segments[
$i] == 
"</SimpleListItem>") {
 
  904            } elseif ($segments[
$i] == 
"<SimpleListItem/>") {
 
  909                foreach ($current_list as 
$list) {
 
  920                    foreach ($current_list as 
$list) {
 
  933        if ($segments[count($segments) - 1] == 
"</SimpleBulletList>" ||
 
  934            $segments[count($segments) - 1] == 
"</SimpleNumberedList>" &&
 
  935            substr(
$text, strlen(
$text) - 6) == 
"<br />") {
 
  949        $nothing_found = 
false;
 
  950        while (!$nothing_found) {
 
  951            $nothing_found = 
true;
 
  953            foreach ($a_needles as $needle) {
 
  954                $pos = stripos($a_haystack, $needle);
 
  955                if (is_int($pos) && ($pos < $found || $found == -1)) {
 
  957                    $found_needle = $needle;
 
  958                    $nothing_found = 
false;
 
  962                $segments[] = substr($a_haystack, 0, $found);
 
  963                $a_haystack = substr($a_haystack, $found);
 
  966                $segments[] = substr($a_haystack, 0, strlen($found_needle));
 
  967                $a_haystack = substr($a_haystack, strlen($found_needle));
 
  970        if ($a_haystack != 
"") {
 
  971            $segments[] = $a_haystack;
 
  984    public static function xml2output($a_text, $a_wysiwyg = 
false, $a_replace_lists = 
true, $unmask = 
true)
 
  992        foreach (self::getBBMap() as $bb => 
$tag) {
 
  993            $a_text = preg_replace(
'~<' . 
$tag . 
'[^>]*>~i', 
"[" . $bb . 
"]", $a_text);
 
  994            $a_text = preg_replace(
'~</' . 
$tag . 
'>~i', 
"[/" . $bb . 
"]", $a_text);
 
  995            $a_text = preg_replace(
'~<' . 
$tag . 
'/>~i', 
"[" . $bb . 
"][/" . $bb . 
"]", $a_text);
 
  999        if ($a_replace_lists) {
 
 1006        while (preg_match(
'~<IntLink(' . $any . 
')>~i', $a_text, $found)) {
 
 1009            $target = explode(
"_", $attribs[
"Target"]);
 
 1011            $inst_str = (!is_int(strpos($attribs[
"Target"], 
"__")))
 
 1012                ? $inst_str = 
"inst=\"" . 
$target[1] . 
"\" " 
 1014            switch ($attribs[
"Type"]) {
 
 1016                    $tframestr = (!empty($attribs[
"TargetFrame"]))
 
 1017                        ? 
" target=\"" . $attribs[
"TargetFrame"] . 
"\"" 
 1019                    $ancstr = (!empty($attribs[
"Anchor"]))
 
 1020                        ? 
' anchor="' . $attribs[
"Anchor"] . 
'"' 
 1022                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"page=\"" . 
$target_id . 
"\"$tframestr$ancstr]", $a_text);
 
 1025                case "StructureObject":
 
 1026                    $tframestr = (!empty($attribs[
"TargetFrame"]))
 
 1027                        ? 
" target=\"" . $attribs[
"TargetFrame"] . 
"\"" 
 1029                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"chap=\"" . 
$target_id . 
"\"$tframestr]", $a_text);
 
 1032                case "GlossaryItem":
 
 1033                    $tframestr = (empty($attribs[
"TargetFrame"]) || $attribs[
"TargetFrame"] == 
"Glossary")
 
 1035                        : 
" target=\"" . $attribs[
"TargetFrame"] . 
"\"";
 
 1036                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"term=\"" . 
$target_id . 
"\"" . $tframestr . 
"]", $a_text);
 
 1041                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"wpage=\"" . 
$target_id . 
"\"" . $tframestr . 
"]", $a_text);
 
 1044                case "PortfolioPage":
 
 1046                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"ppage=\"" . 
$target_id . 
"\"" . $tframestr . 
"]", $a_text);
 
 1050                    if (empty($attribs[
"TargetFrame"])) {
 
 1051                        $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"media=\"" . 
$target_id . 
"\"/]", $a_text);
 
 1053                        $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln media=\"" . 
$target_id . 
"\"" .
 
 1054                            " target=\"" . $attribs[
"TargetFrame"] . 
"\"]", $a_text);
 
 1059                case "RepositoryItem":
 
 1060                    if ($inst_str == 
"") {
 
 1066                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"$target_type=\"" . 
$target_id . 
"\"" . $tframestr . 
"]", $a_text);
 
 1071                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln " . $inst_str . 
"dfile=\"" . 
$target_id . 
"\"" . $tframestr . 
"]", $a_text);
 
 1076                    include_once(
"./Services/User/classes/class.ilObjUser.php");
 
 1081                    $a_text = preg_replace(
'~<IntLink' . $found[1] . 
'>~i', 
"[iln]", $a_text);
 
 1085        $a_text = str_replace(
"</IntLink>", 
"[/iln]", $a_text);
 
 1088        while (preg_match(
'~<ExtLink(' . $any . 
')>~i', $a_text, $found)) {
 
 1093            if (in_array($attribs[
"TargetFrame"], array(
"FAQ", 
"Glossary", 
"Media"))) {
 
 1094                $tstr = 
' target="' . $attribs[
"TargetFrame"] . 
'"';
 
 1096            $a_text = str_replace(
"<ExtLink" . $found[1] . 
">", 
"[xln url=\"" . $attribs[
"Href"] . 
"\"$tstr]", $a_text);
 
 1098        $a_text = str_replace(
"</ExtLink>", 
"[/xln]", $a_text);
 
 1101        while (preg_match(
'~<Anchor(' . $any . 
'/)>~i', $a_text, $found)) {
 
 1104            $a_text = str_replace(
"<Anchor" . $found[1] . 
">", 
"[anc name=\"" . $attribs[
"Name"] . 
"\"][/anc]", $a_text);
 
 1106        while (preg_match(
'~<Anchor(' . $any . 
')>~i', $a_text, $found)) {
 
 1109            $a_text = str_replace(
"<Anchor" . $found[1] . 
">", 
"[anc name=\"" . $attribs[
"Name"] . 
"\"]", $a_text);
 
 1111        $a_text = str_replace(
"</Anchor>", 
"[/anc]", $a_text);
 
 1114        while (preg_match(
'~<Marked(' . $any . 
')>~i', $a_text, $found)) {
 
 1117            $a_text = str_replace(
"<Marked" . $found[1] . 
">", 
"[marked class=\"" . $attribs[
"Class"] . 
"\"]", $a_text);
 
 1119        $a_text = str_replace(
"</Marked>", 
"[/marked]", $a_text);
 
 1123            $a_text = str_replace(
"<br />", 
"\n", $a_text);
 
 1124            $a_text = str_replace(
"<br/>", 
"\n", $a_text);
 
 1129            $a_text = str_replace(
"{", 
"{", $a_text);
 
 1130            $a_text = str_replace(
"}", 
"}", $a_text);
 
 1134                $a_text = str_replace(
"<", 
"<", $a_text);
 
 1135                $a_text = str_replace(
">", 
">", $a_text);
 
 1139            $a_text = str_replace(
""", 
"\"", $a_text);
 
 1143            $a_text = str_replace(
"&", 
"&", $a_text);
 
 1147                $a_text = str_replace(
"<", 
"&lt;", $a_text);
 
 1148                $a_text = str_replace(
">", 
"&gt;", $a_text);
 
 1163        $a_text = str_replace(
"=<SimpleBulletList>", 
"=<br /><SimpleBulletList>", $a_text);
 
 1164        $a_text = str_replace(
"=<SimpleNumberedList>", 
"=<br /><SimpleNumberedList>", $a_text);
 
 1165        $a_text = str_replace(
"</SimpleBulletList>=", 
"</SimpleBulletList><br />=", $a_text);
 
 1166        $a_text = str_replace(
"</SimpleNumberedList>=", 
"</SimpleNumberedList><br />=", $a_text);
 
 1167        $a_text = 
"<br />" . $a_text . 
"<br />";                
 
 1172        while ($c_text != 
"") {
 
 1175            $s1 = strpos($c_text, 
"<br />=");
 
 1178                $s2 = strpos($c_text, 
"<br />==");
 
 1179                if (is_int($s2) && $s2 <= $s1) {
 
 1181                    $s3 = strpos($c_text, 
"<br />===");
 
 1182                    if (is_int($s3) && $s3 <= $s2) {            
 
 1184                        $n = strpos($c_text, 
"<br />", $s3 + 1);
 
 1185                        if (
$n > ($s3+9) && substr($c_text, 
$n-3, 9) == 
"===<br />") {
 
 1188                            if ($s3 > 0 || $head != 
"") {
 
 1190                                $chunks[] = array(
"level" => 0,
 
 1194                            $chunks[] = array(
"level" => 3,
 
 1195                                "text" => trim(substr($c_text, $s3+9, 
$n-$s3-12)));
 
 1199                            $head.= substr($c_text, 0, 
$n);
 
 1200                            $c_text = substr($c_text, 
$n);
 
 1204                        $n = strpos($c_text, 
"<br />", $s2 + 1);
 
 1205                        if (
$n > ($s2+8) && substr($c_text, 
$n-2, 8) == 
"==<br />") {
 
 1208                            if ($s2 > 0 || $head != 
"") {
 
 1210                                $chunks[] = array(
"level" => 0,
 
 1214                            $chunks[] = array(
"level" => 2, 
"text" => trim(substr($c_text, $s2+8, 
$n-$s2-10)));
 
 1218                            $head.= substr($c_text, 0, 
$n);
 
 1219                            $c_text = substr($c_text, 
$n);
 
 1224                    $n = strpos($c_text, 
"<br />", $s1 + 1);
 
 1225                    if (
$n > ($s1+7) && substr($c_text, 
$n-1, 7) == 
"=<br />") {
 
 1228                        if ($s1 > 0 || $head != 
"") {
 
 1230                            $chunks[] = array(
"level" => 0,
 
 1234                        $chunks[] = array(
"level" => 1, 
"text" => trim(substr($c_text, $s1+7, 
$n-$s1-8)));
 
 1238                        $head.= substr($c_text, 0, 
$n);
 
 1239                        $c_text = substr($c_text, 
$n);
 
 1245                $chunks[] = array(
"level" => 0, 
"text" => $head . $c_text);
 
 1250        if (count($chunks) == 0) {
 
 1251            $chunks[] = array(
"level" => 0, 
"text" => 
"");
 
 1256        if (substr($chunks[0][
"text"], 0, 6) == 
"<br />") {
 
 1257            $chunks[0][
"text"] = substr($chunks[0][
"text"], 6);
 
 1262            $chunks[count($chunks) - 1][
"text"],
 
 1263            strlen($chunks[count($chunks) - 1][
"text"]) - 6,
 
 1266            $chunks[count($chunks) - 1][
"text"] =
 
 1267                substr($chunks[count($chunks) - 1][
"text"], 0, strlen($chunks[count($chunks) - 1][
"text"]) - 6);
 
 1268            if ($chunks[count($chunks) - 1][
"text"] == 
"") {
 
 1269                unset($chunks[count($chunks) - 1]);
 
 1282        if (substr($a_str, 0, 6) == 
"<br />" && substr($a_str, 6, 1) != 
"=") {
 
 1283            $a_str = substr($a_str, 6);
 
 1287            if (substr($a_str, 0, 1) == 
"=") {
 
 1288                $a_str = 
"<br />" . $a_str;
 
 1299        if (substr($a_str, strlen($a_str) - 6) == 
"<br />") {
 
 1300            $a_str = substr($a_str, 0, strlen($a_str) - 6);
 
 1327        $this->log->debug(
"step 1: " . substr(
$a_content, 0, 1000));
 
 1329        $this->log->debug(
"step 2: " . substr(
$t[
"text"], 0, 1000));
 
 1334        $pc_id = explode(
":", $a_pc_id);
 
 1335        $insert_at = explode(
":", $a_insert_at);
 
 1336        $t_id = explode(
":", 
$t[
"id"]);
 
 1339        if ($a_insert_at != 
"") {
 
 1341            $par->create($a_pg_obj, $insert_at[0], $insert_at[1]);
 
 1343            $par = $a_pg_obj->getContentObject($pc_id[0], $pc_id[1]);
 
 1346        if ($a_insert_at != 
"") {
 
 1347            $pc_id = $a_pg_obj->generatePCId();
 
 1348            $par->writePCId($pc_id);
 
 1349            $this->inserted_pc_id = $pc_id;
 
 1351            $this->inserted_pc_id = $pc_id[1];
 
 1354        $par->setLanguage(
$ilUser->getLanguage());
 
 1355        $par->setCharacteristic(
$t[
"class"]);
 
 1357        $t2 = $par->input2xml(
$t[
"text"], 
true, 
false);
 
 1358        $this->log->debug(
"step 3: " . substr($t2, 0, 1000));
 
 1361        $this->log->debug(
"step 4: " . substr($t2, 0, 1000));
 
 1363        $updated = $par->setText($t2, 
true);
 
 1365        if ($updated !== 
true) {
 
 1370        $updated = $par->updatePage($a_pg_obj);
 
 1383        if ($a_as_ajax_str) {
 
 1384            $a_pg_obj->stripHierIDs();
 
 1385            $a_pg_obj->addHierIds();
 
 1388            $combined = $a_pg_obj->getHierIdsForPCIds(
 
 1389                array($this->inserted_pc_id)
 
 1391            foreach ($combined as $pc_id => 
$hier_id) {
 
 1393                $ids.= $sep . 
$hier_id . 
":" . $pc_id;
 
 1400        return $this->inserted_pc_id;
 
 1411        $doc = 
new DOMDocument();
 
 1418        $res = $doc->loadXML($content);
 
 1425        $xpath = 
new DOMXpath($doc);
 
 1429        $elements = $xpath->query(
"//span");
 
 1430        include_once(
"./Services/Utilities/classes/class.ilDOM2Util.php");
 
 1431        while (!is_null($elements) && !is_null($element = $elements->item(0))) {
 
 1433            $class = $element->getAttribute(
"class");
 
 1434            if (substr($class, 0, 16) == 
"ilc_text_inline_") {
 
 1435                $class_arr = explode(
" ", $class);
 
 1436                $tag = substr($class_arr[0], 16);
 
 1441                    $cnode->setAttribute(
"Class", substr($class_arr[0], 16));
 
 1443                for (
$i = 1; 
$i < count($class_arr); 
$i++) {
 
 1444                    $tag = substr($class_arr[
$i], 16);
 
 1449                        $cnode->setAttribute(
"Class", substr($class_arr[
$i], 16));
 
 1456            $elements = $xpath->query(
"//span");
 
 1460        $xpath = 
new DOMXpath($doc);
 
 1461        $elements = $xpath->query(
"/dummy/div");
 
 1464        if (!is_null($elements)) {
 
 1465            foreach ($elements as $element) {
 
 1466                $id = $element->getAttribute(
"id");
 
 1467                $class = $element->getAttribute(
"class");
 
 1468                $class = substr($class, 15);
 
 1469                if (trim($class) == 
"") {
 
 1470                    $class = 
"Standard";
 
 1473                $text = $doc->saveXML($element);
 
 1477                $pos = strpos(
$text, 
">");
 
 1479                $pos = strrpos(
$text, 
"<");
 
 1486                    if (!in_array($bb, array(
"code", 
"tex", 
"fn", 
"xln"))) {
 
 1487                        $text = str_replace(
 
 1492                        $text = str_replace(
 
 1497                        $text = str_replace(
"<il" . $cl . 
"/>", 
"", 
$text);
 
 1500                $text = str_replace(
 
 1501                    array(
"<code>", 
"</code>"),
 
 1502                    array(
"[code]", 
"[/code]"),
 
 1505                $text = str_replace(
 
 1506                    array(
'<sup class="ilc_sup_Sup">', 
"</sup>"),
 
 1507                    array(
"[sup]", 
"[/sup]"),
 
 1510                $text = str_replace(
 
 1511                    array(
'<sub class="ilc_sub_Sub">', 
"</sub>"),
 
 1512                    array(
"[sub]", 
"[/sub]"),
 
 1517                $text = str_replace(
'<ul class="ilc_list_u_BulletedList"/>', 
"", 
$text);
 
 1518                $text = str_replace(
'<ul class="ilc_list_o_NumberedList"/>', 
"", 
$text);
 
 1523                while (preg_match(
'~<ilMarked(' . $any . 
')>~i', 
$text, $found)) {
 
 1526                    $text = str_replace(
"<ilMarked" . $found[1] . 
">", 
"[marked class=\"" . $attribs[
"Class"] . 
"\"]", 
$text);
 
 1528                $text = str_replace(
"</ilMarked>", 
"[/marked]", 
$text);
 
 1531                $ret[] = array(
"text" => 
$text, 
"id" => 
$id, 
"class" => $class);
 
 1544        $text = str_replace(
 
 1545            array(
"<ul>", 
"</ul>"),
 
 1546            array(
"<SimpleBulletList>", 
"</SimpleBulletList>"),
 
 1549        $text = str_replace(
 
 1550            array(
"<ul class='ilc_list_u_BulletedList'>", 
"</ul>"),
 
 1551            array(
"<SimpleBulletList>", 
"</SimpleBulletList>"),
 
 1554        $text = str_replace(
 
 1555            array(
"<ul class=\"ilc_list_u_BulletedList\">", 
"</ul>"),
 
 1556            array(
"<SimpleBulletList>", 
"</SimpleBulletList>"),
 
 1559        $text = str_replace(
 
 1560            array(
"<ol>", 
"</ol>"),
 
 1561            array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"),
 
 1564        $text = str_replace(
 
 1565            array(
"<ol class='ilc_list_o_NumberedList'>", 
"</ol>"),
 
 1566            array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"),
 
 1569        $text = str_replace(
 
 1570            array(
"<ol class=\"ilc_list_o_NumberedList\">", 
"</ol>"),
 
 1571            array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"),
 
 1574        $text = str_replace(
 
 1575            array(
"<li>", 
"</li>"),
 
 1576            array(
"<SimpleListItem>", 
"</SimpleListItem>"),
 
 1579        $text = str_replace(
 
 1580            array(
"<li class='ilc_list_item_StandardListItem'>", 
"</li>"),
 
 1581            array(
"<SimpleListItem>", 
"</SimpleListItem>"),
 
 1584        $text = str_replace(
 
 1585            array(
"<li class=\"ilc_list_item_StandardListItem\">", 
"</li>"),
 
 1586            array(
"<SimpleListItem>", 
"</SimpleListItem>"),
 
 1590        $text = str_replace(
 
 1591            array(
"<li class=\"ilc_list_item_StandardListItem\"/>"),
 
 1592            array(
"<SimpleListItem></SimpleListItem>"),
 
 1596        $text = str_replace(
"<SimpleBulletList><br />", 
"<SimpleBulletList>", 
$text);
 
 1597        $text = str_replace(
"<SimpleNumberedList><br />", 
"<SimpleNumberedList>", 
$text);
 
 1598        $text = str_replace(
"<br /><SimpleBulletList>", 
"<SimpleBulletList>", 
$text);
 
 1599        $text = str_replace(
"<br /><SimpleNumberedList>", 
"<SimpleNumberedList>", 
$text);
 
 1600        $text = str_replace(
"</SimpleBulletList><br />", 
"</SimpleBulletList>", 
$text);
 
 1601        $text = str_replace(
"</SimpleNumberedList><br />", 
"</SimpleNumberedList>", 
$text);
 
 1602        $text = str_replace(
"</SimpleListItem><br />", 
"</SimpleListItem>", 
$text);
 
 1616        $a_page->beforePageContentUpdate($this);
 
 1618        $ret = $a_page->update();
 
 1630        if (is_array($a_glos) && count($a_glos) > 0) {
 
 1631            include_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
 1638            $found_terms = array();
 
 1639            foreach ($a_glos as $glo) {
 
 1642                    foreach ($terms as 
$t) {
 
 1643                        if (is_int(stripos(
$text, 
$t[
"term"]))) {
 
 1644                            $found_terms[
$t[
"id"]] = 
$t;
 
 1651            if (count($found_terms) > 0) {
 
 1667        foreach ($a_terms as $k => 
$t) {
 
 1668            $a_terms[$k][
"termlength"] = strlen(
$t[
"term"]);
 
 1674            $a_dom = $a_dom->myDOMDocument;
 
 1677            $a_par_node = $a_par_node->myDOMNode;
 
 1680        $xpath = 
new DOMXPath($a_dom);
 
 1682        if ($a_par_node == 
null) {
 
 1683            $parnodes = $xpath->query(
"//Paragraph[@Characteristic != 'Code']");
 
 1685            $parnodes = $xpath->query(
".//Paragraph[@Characteristic != 'Code']", $a_par_node->parentNode);
 
 1688        include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 1690        foreach ($parnodes as $parnode) {
 
 1691            $textnodes = $xpath->query(
'.//text()', $parnode);
 
 1692            foreach ($textnodes as 
$node) {
 
 1693                $p = 
$node->getNodePath();
 
 1696                if (!is_int(strpos($p, 
"/IntLink")) &&
 
 1697                    !is_int(strpos($p, 
"/ExtLink"))) {
 
 1698                    $node_val = 
$node->nodeValue;
 
 1701                    foreach ($a_terms as 
$t) {
 
 1705                        while (is_int($pos)) {
 
 1709                            if ($tex_bpos > 0 && $tex_epos > 0 && $tex_bpos < $pos && $tex_epos > $pos) {
 
 1715                                $valid_limiters = array(
"", 
" ", 
" ", 
".", 
",", 
":", 
";", 
"!", 
"?", 
"\"", 
"'", 
"(", 
")");
 
 1720                                if ((in_array($b, $valid_limiters) || htmlentities($b, 
null, 
'utf-8') == 
" ") && in_array($a, $valid_limiters)) {
 
 1721                                    $mid = 
'[iln term="' . 
$t[
"id"] . 
'"]' .
 
 1740                    $node->nodeValue = $node_val;
 
 1749            $text = $a_dom->saveXML($parnode);
 
 1758                '<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . 
$text . 
'</Paragraph>',
 
 1762            $temp_dom = $temp_dom->myDOMDocument;
 
 1766                $children = $parnode->childNodes;
 
 1767                while ($parnode->hasChildNodes()) {
 
 1768                    $parnode->removeChild($parnode->firstChild);
 
 1772                $xpath_temp = 
new DOMXPath($temp_dom);
 
 1773                $temp_pars = $xpath_temp->query(
"//Paragraph");
 
 1775                foreach ($temp_pars as $new_par_node) {
 
 1776                    $new_childs = $new_par_node->childNodes;
 
 1778                    foreach ($new_childs as $new_child) {
 
 1780                        $cloned_child = $a_dom->importNode($new_child, 
true);
 
 1781                        $parnode->appendChild($cloned_child);
 
 1798        $a_page->buildDom();
 
 1799        $a_dom = $a_page->getDom();
 
 1814    public static function afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 
 1854        $xpath = 
new DOMXPath($a_domdoc);
 
 1855        $nodes = $xpath->query(
'//Anchor');
 
 1857        foreach ($nodes as 
$node) {
 
 1859            if (trim(
$name) != 
"" && !in_array(
$name, $saved)) {
 
 1876            "DELETE FROM page_anchor WHERE " .
 
 1877            " page_parent_type = " . 
$ilDB->quote($a_parent_type, 
"text") .
 
 1878            " AND page_id = " . 
$ilDB->quote($a_page_id, 
"integer") .
 
 1879            " AND page_lang = " . 
$ilDB->quote($a_page_lang, 
"text")
 
 1886    public static function _saveAnchor($a_parent_type, $a_page_id, $a_page_lang, $a_anchor_name)
 
 1892        $ilDB->manipulate(
"INSERT INTO page_anchor " .
 
 1893            "(page_parent_type, page_id, page_lang, anchor_name) VALUES (" .
 
 1894            $ilDB->quote($a_parent_type, 
"text") . 
"," .
 
 1895            $ilDB->quote($a_page_id, 
"integer") . 
"," .
 
 1896            $ilDB->quote($a_page_lang, 
"text") . 
"," .
 
 1897            $ilDB->quote($a_anchor_name, 
"text") .
 
 1904    public static function _readAnchors($a_parent_type, $a_page_id, $a_page_lang = 
"-")
 
 1910        $and_lang = ($a_page_lang != 
"")
 
 1911            ? 
" AND page_lang = " . 
$ilDB->quote($a_page_lang, 
"text")
 
 1914        $set = 
$ilDB->query(
 
 1915            "SELECT * FROM page_anchor " .
 
 1916            " WHERE page_parent_type = " . 
$ilDB->quote($a_parent_type, 
"text") .
 
 1917            " AND page_id = " . 
$ilDB->quote($a_page_id, 
"integer") .
 
 1921        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1922            $anchors[] = $rec[
"anchor_name"];
 
 1936        if ($a_page->getParentType() == 
"gdf" ||
 
 1937            $a_page->getParentType() == 
"lm") {
 
 1939            $keywords = array();
 
 1942            $xpath = 
new DOMXPath($a_domdoc);
 
 1943            $nodes = $xpath->query(
'//Keyw');
 
 1944            foreach ($nodes as 
$node) {
 
 1945                $k =  trim(strip_tags(
$node->nodeValue));
 
 1946                if (!in_array($k, $keywords)) {
 
 1951            $meta_type = ($a_page->getParentType() == 
"gdf")
 
 1954            $meta_rep_id = $a_page->getParentId();
 
 1955            $meta_id = $a_page->getId();
 
 1957            include_once(
"./Services/MetaData/classes/class.ilMD.php");
 
 1958            $md_obj = 
new ilMD($meta_rep_id, $meta_id, $meta_type);
 
 1959            $mkeywords = array();
 
 1961            if (is_object($md_section = $md_obj->getGeneral())) {
 
 1962                foreach ($ids = $md_section->getKeywordIds() as 
$id) {
 
 1963                    $md_key = $md_section->getKeyword(
$id);
 
 1964                    $mkeywords[] = strtolower($md_key->getKeyword());
 
 1966                        $lang = $md_key->getKeywordLanguageCode();
 
 1970                    foreach ($ids = $md_section->getLanguageIds() as 
$id) {
 
 1971                        $md_lang = $md_section->getLanguage(
$id);
 
 1973                            $lang = $md_lang->getLanguageCode();
 
 1977                foreach ($keywords as $k) {
 
 1978                    if (!in_array(strtolower($k), $mkeywords)) {
 
 1979                        if (trim($k) != 
"" && 
$lang != 
"") {
 
 1980                            $md_key = $md_section->addKeyword();
 
 1985                        $mkeywords[] = strtolower($k);
 
 1999        if ($a_mode != 
"edit" && $adve_settings->get(
"auto_url_linking")) {
 
 2000            include_once(
"./Services/Link/classes/class.ilLinkifyUtil.php");
 
 2017        if ($a_mode != 
"edit" && $adve_settings->get(
"auto_url_linking")) {
 
 2018            return array(
"il.ExtLink.autolink('.ilc_Paragraph, .ilc_page_fn_Footnote','ilc_link_ExtLink');");
 
An exception for terminatinating execution or to throw for unit testing.
static addParent($node, $name)
Add parent.
static replaceByChilds($node)
Replace a node by its child.
static changeName($node, $name, $keep_attributes=true)
Change name of a node.
static getTermList( $a_glo_ref_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null, $a_include_references=false)
Get all terms for given set of glossary ids.
static getLocalJsPaths()
Get paths of necessary js files.
static _lookupLogin($a_user_id)
lookup login
static _lookupId($a_user_str)
Lookup id by login.
static _lookupType($a_id, $a_reference=false)
lookup object type
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
getText($a_short_mode=false)
Get (xml) content of paragraph.
handleNextBr($a_str)
Remove preceding
static getXMLTagMap()
Get tag to bb map.
static intLinks2xml($a_text)
internal links to xml
removeTrailingBr($a_str)
Remove trailing
static _saveAnchor($a_parent_type, $a_page_id, $a_page_lang, $a_anchor_name)
Save an anchor.
getLastSavedPCId($a_pg_obj, $a_as_ajax_str=false)
Get last inserted pc ids.
static _readAnchors($a_parent_type, $a_page_id, $a_page_lang="-")
Read anchors of a page.
getType()
Need to override getType from ilPageContent to distinguish between Pararagraph and Source.
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
static autoLinkGlossariesPage($a_page, $a_terms)
Auto link glossary of whole page.
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
static linkTermsInDom($a_dom, $a_terms, $a_par_node=null)
Link terms in a dom page object in bb style.
setNode($a_node)
Set Page Content Node.
getShowLineNumbers()
get attribute showlinenumbers
autoLinkGlossaries($a_glos)
Auto link glossaries.
static saveAnchors($a_page, $a_domdoc)
Save anchors.
static handleAjaxContent($a_content)
Handle ajax content.
init()
Init page content component.
setSubCharacteristic($a_char)
set attribute subcharacteristic
createAtNode(&$node)
Create new page content (incl.
input2xml($a_text, $a_wysiwyg=0, $a_handle_lists=true)
createAfter($node)
Create paragraph node (incl.
static input2xmlReplaceLists($a_text)
Converts xml from DB to output in edit textarea.
static beforePageDelete($a_page)
Before page is being deleted.
setDownloadTitle($a_char)
set attribute download title
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create paragraph node (incl.
static xml2outputReplaceLists($a_text)
Replaces with *.
getAutoIndent()
Get AutoIndent (Code Paragraphs)
getDownloadTitle()
get attribute download title
static afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
After page has been updated (or created)
setText($a_text, $a_auto_split=false)
Set (xml) content of text paragraph.
static replaceBBCode($a_text, $a_bb, $a_tag)
Replace bb code.
getOnloadCode($a_mode)
Get onload code.
static getBBMap()
Get bb to xml tag map.
setShowLineNumbers($a_char)
set attribute showlinenumbers
setLanguage($a_lang)
set language
static afterPageHistoryEntry($a_page, DOMDocument $a_old_domdoc, $a_old_xml, $a_old_nr)
After page history entry has been created.
setCharacteristic($a_char)
Set Characteristic of paragraph.
static handleAjaxContentPost($text)
Post input2xml handling of ajax content.
static saveMetaKeywords($a_page, $a_domdoc)
save all keywords
static segmentString($a_haystack, $a_needles)
Segments a string into an array at each position of a substring.
saveJS($a_pg_obj, $a_content, $a_char, $a_pc_id, $a_insert_at="")
Save input coming from ajax.
getLanguage()
get language
createBeforeNode(&$node)
Create new page content (incl.
autoSplit($a_text)
This function splits a paragraph text that has been already processed with input2xml at each header p...
getParagraphSequenceContent($a_pg_obj)
Get paragraph sequenc of current paragraph.
updatePage($a_page)
Update page object (it would be better to have this centralized and to change the constructors and pa...
getSubCharacteristic()
get attribute subcharacteristic
static _deleteAnchors($a_parent_type, $a_page_id, $a_page_lang)
Delete anchors of a page.
getCharacteristic()
Get characteristic of paragraph.
getJavascriptFiles($a_mode)
Get Javascript files.
static _getCommonBBButtons()
Get common bb buttons.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType($a_type)
Set Type.
static strPos($a_haystack, $a_needle, $a_offset=null)
static strrPos($a_haystack, $a_needle, $a_offset=null)
static strIPos($a_haystack, $a_needle, $a_offset=null)
static subStr($a_str, $a_start, $a_length=null)
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static attribsToArray($a_str)
converts a string of format var1 = "val1" var2 = "val2" ... into an array
if(!array_key_exists('StateId', $_REQUEST)) $id
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=null)
xpath_new_context($dom_document)
const DOMXML_LOAD_PARSING
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
if(isset($_REQUEST['delete'])) $list
foreach($_POST as $key=> $value) $res