• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/COPage/classes/class.ilPCParagraph.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once("./Services/COPage/classes/class.ilPageContent.php");
00025 require_once("./Services/COPage/classes/class.ilWysiwygUtil.php");
00026 
00037 class ilPCParagraph extends ilPageContent
00038 {
00039         var $dom;
00040         var $par_node;                  // node of Paragraph element
00041 
00046         function ilPCParagraph(&$a_dom)
00047         {
00048                 parent::ilPageContent();
00049                 $this->setType("par");
00050 
00051                 $this->dom =& $a_dom;
00052         }
00053 
00054         function setNode(&$a_node)
00055         {
00056                 parent::setNode($a_node);               // this is the PageContent node
00057                 $this->par_node =& $a_node->first_child();              //... and this the Paragraph node
00058         }
00059 
00060 
00061         function createAtNode (&$node) {
00062                 $this->node =& $this->dom->create_element("PageContent");
00063                 $this->par_node =& $this->dom->create_element("Paragraph");
00064                 $this->par_node =& $this->node->append_child($this->par_node);
00065                 $this->par_node->set_attribute("Language", "");
00066                 $node->append_child ($this->node);
00067         }
00068         
00069         
00070         function create(&$a_pg_obj, $a_hier_id)
00071         {               
00072                 $this->node =& $this->dom->create_element("PageContent");
00073                 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER);
00074                 $this->par_node =& $this->dom->create_element("Paragraph");
00075                 $this->par_node =& $this->node->append_child($this->par_node);
00076                 $this->par_node->set_attribute("Language", "");
00077         }
00078 
00079 
00083         function setText($a_text)
00084         {
00085                 // DOMXML_LOAD_PARSING, DOMXML_LOAD_VALIDATING, DOMXML_LOAD_RECOVERING
00086                 $temp_dom = @domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$a_text.'</Paragraph>',
00087                         DOMXML_LOAD_PARSING, $error);
00088 
00089                 //$this->text = $a_text;
00090                 // remove all childs
00091                 if(empty($error))
00092                 {
00093                         // delete children of paragraph node
00094                         $children = $this->par_node->child_nodes();
00095                         for($i=0; $i<count($children); $i++)
00096                         {
00097                                 $this->par_node->remove_child($children[$i]);
00098                         }
00099 
00100 
00101                         // copy new content children in paragraph node
00102                         $xpc = xpath_new_context($temp_dom);
00103                         $path = "//Paragraph";
00104                         $res =& xpath_eval($xpc, $path);
00105                         if (count($res->nodeset) == 1)
00106                         {
00107                                 $new_par_node =& $res->nodeset[0];
00108                                 $new_childs = $new_par_node->child_nodes();
00109                                 for($i=0; $i<count($new_childs); $i++)
00110                                 {
00111                                         $cloned_child =& $new_childs[$i]->clone_node(true);
00112                                         $this->par_node->append_child($cloned_child);
00113                                 }
00114                         }
00115                         return true;
00116                 }
00117                 else
00118                 {
00119                         return $error;
00120                 }
00121         }
00122 
00126         function getText($a_short_mode = false)
00127         {
00128                 if (is_object($this->par_node))
00129                 {
00130                         $content = "";
00131                         $childs = $this->par_node->child_nodes();
00132                         for($i=0; $i<count($childs); $i++)
00133                         {
00134                                 $content .= $this->dom->dump_node($childs[$i]);
00135                         }
00136                         //return $this->par_node->get_content();
00137                         return $content;
00138                 }
00139                 else
00140                 {
00141                         return "";
00142                 }
00143         }
00144 
00148         function setCharacteristic($a_char)
00149         {
00150                 if (!empty($a_char))
00151                 {
00152                         $this->par_node->set_attribute("Characteristic", $a_char);
00153                 }
00154                 else
00155                 {
00156                         if ($this->par_node->has_attribute("Characteristic"))
00157                         {
00158                                 $this->par_node->remove_attribute("Characteristic");
00159                         }
00160                 }
00161         }
00162 
00166         function getCharacteristic()
00167         {
00168                 return $this->par_node->get_attribute("Characteristic");
00169         }
00170 
00171 
00176         function setSubCharacteristic($a_char)
00177         {
00178                 if (!empty($a_char))
00179                 {
00180                         $this->par_node->set_attribute("SubCharacteristic", $a_char);
00181                 }
00182                 else
00183                 {
00184                         if ($this->par_node->has_attribute("SubCharacteristic"))
00185                         {
00186                                 $this->par_node->remove_attribute("SubCharacteristic");
00187                         }
00188                 }
00189         }
00190 
00194         function getAutoIndent()
00195         {
00196                 return $this->par_node->get_attribute("AutoIndent");
00197         }
00198         
00199         function setAutoIndent($a_char)
00200         {
00201                 if (!empty($a_char))
00202                 {
00203                         $this->par_node->set_attribute("AutoIndent", $a_char);
00204                 }
00205                 else
00206                 {
00207                         if ($this->par_node->has_attribute("AutoIndent"))
00208                         {
00209                                 $this->par_node->remove_attribute("AutoIndent");
00210                         }
00211                 }
00212         }
00213 
00217         function getSubCharacteristic()
00218         {
00219                 return $this->par_node->get_attribute("SubCharacteristic");
00220         }
00221 
00226         function setDownloadTitle($a_char)
00227         {
00228                 if (!empty($a_char))
00229                 {
00230                         $this->par_node->set_attribute("DownloadTitle", $a_char);
00231                 }
00232                 else
00233                 {
00234                         if ($this->par_node->has_attribute("DownloadTitle"))
00235                         {
00236                                 $this->par_node->remove_attribute("DownloadTitle");
00237                         }
00238                 }
00239         }
00240 
00244         function getDownloadTitle()
00245         {
00246                 return $this->par_node->get_attribute("DownloadTitle");
00247         }
00248         
00253         function setShowLineNumbers($a_char)
00254         {
00255                 $a_char = empty($a_char)?"n":$a_char;
00256                 
00257                 $this->par_node->set_attribute("ShowLineNumbers", $a_char);
00258         }
00259 
00264         function getShowLineNumbers()
00265         {
00266                 return $this->par_node->get_attribute("ShowLineNumbers");
00267         }
00268         
00272         function setLanguage($a_lang)
00273         {
00274                 $this->par_node->set_attribute("Language", $a_lang);
00275         }
00276 
00280         function getLanguage()
00281         {
00282                 return $this->par_node->get_attribute("Language");
00283         }
00284 
00288         function input2xml($a_text, $a_wysiwyg = 0)
00289         {
00290                 $a_text = ilUtil::stripSlashes($a_text, false);
00291 
00292                 // note: the order of the processing steps is crucial
00293                 // and should be the same as in xml2output() in REVERSE order!
00294                 $a_text = trim($a_text);
00295 
00296 //echo "<br>first:".htmlentities($a_text);
00297 
00298                 if ($a_wysiwyg == 1)
00299                 {
00300                         //$a_text = str_replace("&","&amp;",$a_text);
00301                         //$a_text = str_replace("<","&lt;",$a_text);
00302                         //$a_text = str_replace(">","&gt;",$a_text);
00303 
00304                         $wysiwygUtil = new ilWysiwygUtil();
00305                         $a_text = $wysiwygUtil->convertFromPost($a_text);
00306                         //$a_text = addslashes($a_text);
00307                 }
00308 
00309 //echo "<br>between:".htmlentities($a_text);
00310 
00311                 // mask html
00312                 $a_text = str_replace("&","&amp;",$a_text);
00313                 $a_text = str_replace("<","&lt;",$a_text);
00314                 $a_text = str_replace(">","&gt;",$a_text);
00315 
00316                 // Reconvert PageTurn and BibItemIdentifier
00317                 $a_text = preg_replace('/&lt;([\s\/]*?PageTurn.*?)&gt;/i',"<$1>",$a_text);
00318                 $a_text = preg_replace('/&lt;([\s\/]*?BibItemIdentifier.*?)&gt;/i',"<$1>",$a_text);
00319 
00320 //echo "<br>second:".htmlentities($a_text);
00321 
00322                 // mask curly brackets
00323 /*
00324 echo htmlentities($a_text);
00325                 $a_text = str_replace("{", "&#123;", $a_text);
00326                 $a_text = str_replace("}", "&#125;", $a_text);
00327 echo htmlentities($a_text);*/
00328                 // linefeed to br
00329                 $a_text = str_replace(chr(13).chr(10),"<br />",$a_text);
00330                 $a_text = str_replace(chr(13),"<br />", $a_text);
00331                 $a_text = str_replace(chr(10),"<br />", $a_text);
00332 
00333                 // bb code to xml
00334                 $a_text = eregi_replace("\[com\]","<Comment Language=\"".$this->getLanguage()."\">",$a_text);
00335                 $a_text = eregi_replace("\[\/com\]","</Comment>",$a_text);
00336                 $a_text = eregi_replace("\[emp\]","<Emph>",$a_text);
00337                 $a_text = eregi_replace("\[\/emp\]","</Emph>",$a_text);
00338                 $a_text = eregi_replace("\[str\]","<Strong>",$a_text);
00339                 $a_text = eregi_replace("\[\/str\]","</Strong>",$a_text);
00340                 $a_text = eregi_replace("\[fn\]","<Footnote>",$a_text);
00341                 $a_text = eregi_replace("\[\/fn\]","</Footnote>",$a_text);
00342                 $a_text = eregi_replace("\[quot\]","<Quotation Language=\"".$this->getLanguage()."\">",$a_text);
00343                 $a_text = eregi_replace("\[\/quot\]","</Quotation>",$a_text);
00344                 $a_text = eregi_replace("\[code\]","<Code>",$a_text);
00345                 $a_text = eregi_replace("\[\/code\]","</Code>",$a_text);
00346 
00347                 // internal links
00348                 //$any = "[^\]]*";      // this doesn't work :-(
00349                 $ws= "[ \t\r\f\v\n]*";
00350 
00351                 while (eregi("\[(iln$ws((inst$ws=$ws([\"0-9])*)?$ws".
00352                         "((page|chap|term|media|htlm|lm|dbk|glo|frm|exc|tst|svy|webr|chat|cat|crs|grp|file|fold|sahs|mcst|obj)$ws=$ws([\"0-9])*)$ws".
00353                         "(target$ws=$ws(\"(New|FAQ|Media)\"))?$ws))\]", $a_text, $found))
00354                 {
00355                         $attribs = ilUtil::attribsToArray($found[2]);
00356                         $inst_str = $attribs["inst"];
00357                         // pages
00358                         if (isset($attribs["page"]))
00359                         {
00360                                 if (!empty($found[10]))
00361                                 {
00362                                         $tframestr = " TargetFrame=\"".$found[10]."\" ";
00363                                 }
00364                                 else
00365                                 {
00366                                         $tframestr = "";
00367                                 }
00368                                 $a_text = eregi_replace("\[".$found[1]."\]",
00369                                         "<IntLink Target=\"il_".$inst_str."_pg_".$attribs[page]."\" Type=\"PageObject\"".$tframestr.">", $a_text);
00370                         }
00371                         // chapters
00372                         else if (isset($attribs["chap"]))
00373                         {
00374                                 if (!empty($found[10]))
00375                                 {
00376                                         $tframestr = " TargetFrame=\"".$found[10]."\" ";
00377                                 }
00378                                 else
00379                                 {
00380                                         $tframestr = "";
00381                                 }
00382                                 $a_text = eregi_replace("\[".$found[1]."\]",
00383                                         "<IntLink Target=\"il_".$inst_str."_st_".$attribs[chap]."\" Type=\"StructureObject\"".$tframestr.">", $a_text);
00384                         }
00385                         // glossary terms
00386                         else if (isset($attribs["term"]))
00387                         {
00388                                 switch ($found[10])
00389                                 {
00390                                         case "New":
00391                                                 $tframestr = " TargetFrame=\"New\" ";
00392                                                 break;
00393 
00394                                         default:
00395                                                 $tframestr = " TargetFrame=\"Glossary\" ";
00396                                                 break;
00397                                 }
00398                                 $a_text = eregi_replace("\[".$found[1]."\]",
00399                                         "<IntLink Target=\"il_".$inst_str."_git_".$attribs[term]."\" Type=\"GlossaryItem\" $tframestr>", $a_text);
00400                         }
00401                         // media object
00402                         else if (isset($attribs["media"]))
00403                         {
00404                                 if (!empty($found[10]))
00405                                 {
00406                                         $tframestr = " TargetFrame=\"".$found[10]."\" ";
00407                                         $a_text = eregi_replace("\[".$found[1]."\]",
00408                                                 "<IntLink Target=\"il_".$inst_str."_mob_".$attribs[media]."\" Type=\"MediaObject\"".$tframestr.">", $a_text);
00409                                 }
00410                                 else
00411                                 {
00412                                         $a_text = eregi_replace("\[".$found[1]."\]",
00413                                                 "<IntLink Target=\"il_".$inst_str."_mob_".$attribs[media]."\" Type=\"MediaObject\"/>", $a_text);
00414                                 }
00415                         }
00416                         // repository items (id is ref_id (will be used internally but will
00417                         // be replaced by object id for export purposes)
00418                         else if (isset($attribs["lm"]) || isset($attribs["dbk"]) || isset($attribs["glo"])
00419                                          || isset($attribs["frm"]) || isset($attribs["exc"]) || isset($attribs["tst"])
00420                                          || isset($attribs["svy"]) || isset($attribs["obj"]) || isset($attribs['webr'])
00421                                          || isset($attribs["htlm"]) || isset($attribs["chat"]) || isset($attribs["grp"])
00422                                          || isset($attribs["fold"]) || isset($attribs["sahs"]) || isset($attribs["mcst"])
00423                                          || isset($attribs["cat"]) || isset($attribs["crs"]) || isset($attribs["file"]))
00424                         {
00425                                 $obj_id = (isset($attribs["lm"])) ? $attribs["lm"] : $obj_id;
00426                                 $obj_id = (isset($attribs["dbk"])) ? $attribs["dbk"] : $obj_id;
00427                                 $obj_id = (isset($attribs["chat"])) ? $attribs["chat"] : $obj_id;
00428                                 $obj_id = (isset($attribs["glo"])) ? $attribs["glo"] : $obj_id;
00429                                 $obj_id = (isset($attribs["frm"])) ? $attribs["frm"] : $obj_id;
00430                                 $obj_id = (isset($attribs["exc"])) ? $attribs["exc"] : $obj_id;
00431                                 $obj_id = (isset($attribs["htlm"])) ? $attribs["htlm"] : $obj_id;
00432                                 $obj_id = (isset($attribs["tst"])) ? $attribs["tst"] : $obj_id;
00433                                 $obj_id = (isset($attribs["svy"])) ? $attribs["svy"] : $obj_id;
00434                                 $obj_id = (isset($attribs["obj"])) ? $attribs["obj"] : $obj_id;
00435                                 $obj_id = (isset($attribs["webr"])) ? $attribs["webr"] : $obj_id;
00436                                 $obj_id = (isset($attribs["fold"])) ? $attribs["fold"] : $obj_id;
00437                                 $obj_id = (isset($attribs["cat"])) ? $attribs["cat"] : $obj_id;
00438                                 $obj_id = (isset($attribs["crs"])) ? $attribs["crs"] : $obj_id;
00439                                 $obj_id = (isset($attribs["grp"])) ? $attribs["grp"] : $obj_id;
00440                                 $obj_id = (isset($attribs["file"])) ? $attribs["file"] : $obj_id;
00441                                 $obj_id = (isset($attribs["sahs"])) ? $attribs["sahs"] : $obj_id;
00442                                 $obj_id = (isset($attribs["mcst"])) ? $attribs["mcst"] : $obj_id;
00443                                 //$obj_id = (isset($attribs["obj"])) ? $attribs["obj"] : $obj_id;
00444 
00445                                 if ($inst_str == "")
00446                                 {
00447                                         $a_text = eregi_replace("\[".$found[1]."\]",
00448                                                 "<IntLink Target=\"il_".$inst_str."_obj_".$obj_id."\" Type=\"RepositoryItem\">", $a_text);
00449                                 }
00450                                 else
00451                                 {
00452                                         $a_text = eregi_replace("\[".$found[1]."\]",
00453                                                 "<IntLink Target=\"il_".$inst_str."_".$found[6]."_".$obj_id."\" Type=\"RepositoryItem\">", $a_text);
00454                                 }
00455                         }                       
00456                         else
00457                         {
00458                                 $a_text = eregi_replace("\[".$found[1]."\]", "[error: iln".$found[1]."]",$a_text);
00459                         }
00460                 }
00461                 while (eregi("\[(iln$ws((inst$ws=$ws([\"0-9])*)?".$ws."media$ws=$ws([\"0-9])*)$ws)/\]", $a_text, $found))
00462                 {
00463                         $attribs = ilUtil::attribsToArray($found[2]);
00464                         $inst_str = $attribs["inst"];
00465                         $a_text = eregi_replace("\[".$found[1]."/\]",
00466                                 "<IntLink Target=\"il_".$inst_str."_mob_".$attribs[media]."\" Type=\"MediaObject\"/>", $a_text);
00467                 }
00468                 $a_text = eregi_replace("\[\/iln\]","</IntLink>",$a_text);
00469 
00470                 // external link
00471                 $ws= "[ \t\r\f\v\n]*";
00472 
00473                 //while (eregi("\[(xln$ws(url$ws=$ws([\"0-9])*)$ws)\]", $a_text, $found))
00474                 while (eregi("\[(xln$ws(url$ws=$ws\"([^\"])*\")$ws)\]", $a_text, $found))
00475                 {
00476 //echo "found2:".addslashes($found[2])."<br>"; flush();;
00477                         $attribs = ilUtil::attribsToArray($found[2]);
00478 //echo "url:".$attribs["url"]."<br>";
00479                         //$found[1] = str_replace("?", "\?", $found[1]);
00480                         if (isset($attribs["url"]))
00481                         {
00482 //echo "3";
00483                                 $a_text = str_replace("[".$found[1]."]", "<ExtLink Href=\"".$attribs["url"]."\">", $a_text);
00484                         }
00485                         else
00486                         {
00487                                 $a_text = str_replace("[".$found[1]."]", "[error: xln".$found[1]."]",$a_text);
00488                         }
00489                 }
00490                 $a_text = eregi_replace("\[\/xln\]","</ExtLink>",$a_text);
00491                 /*$blob = ereg_replace("<NR><NR>","<P>",$blob);
00492                 $blob = ereg_replace("<NR>"," ",$blob);*/
00493 //echo "<br>-".htmlentities($a_text)."-";
00494                 //$a_text = nl2br($a_text);
00495                 //$a_text = addslashes($a_text);
00496                 return $a_text;
00497         }
00498 
00499         function xml2output($a_text)
00500         {
00501                 // note: the order of the processing steps is crucial
00502                 // and should be the same as in input2xml() in REVERSE order!
00503 
00504                 // xml to bb code
00505                 $any = "[^>]*";
00506                 $a_text = eregi_replace("<Comment[^>]*>","[com]",$a_text);
00507                 $a_text = eregi_replace("</Comment>","[/com]",$a_text);
00508                 $a_text = eregi_replace("<Comment/>","[com][/com]",$a_text);
00509                 $a_text = eregi_replace("<Emph>","[emp]",$a_text);
00510                 $a_text = eregi_replace("</Emph>","[/emp]",$a_text);
00511                 $a_text = eregi_replace("<Emph/>","[emp][/emp]",$a_text);
00512                 $a_text = eregi_replace("<Strong>","[str]",$a_text);
00513                 $a_text = eregi_replace("</Strong>","[/str]",$a_text);
00514                 $a_text = eregi_replace("<Strong/>","[str][/str]",$a_text);
00515                 $a_text = eregi_replace("<Footnote[^>]*>","[fn]",$a_text);
00516                 $a_text = eregi_replace("</Footnote>","[/fn]",$a_text);
00517                 $a_text = eregi_replace("<Footnote/>","[fn][/fn]",$a_text);
00518                 $a_text = eregi_replace("<Quotation[^>]*>","[quot]",$a_text);
00519                 $a_text = eregi_replace("</Quotation>","[/quot]",$a_text);
00520                 $a_text = eregi_replace("<Quotation/>","[quot][/quot]",$a_text);
00521                 $a_text = eregi_replace("<Code[^>]*>","[code]",$a_text);
00522                 $a_text = eregi_replace("</Code>","[/code]",$a_text);
00523                 $a_text = eregi_replace("<Code/>","[code][/code]",$a_text);
00524 
00525                 // internal links
00526                 while (eregi("<IntLink($any)>", $a_text, $found))
00527                 {
00528                         $found[0];
00529                         $attribs = ilUtil::attribsToArray($found[1]);
00530                         $target = explode("_", $attribs["Target"]);
00531                         $target_id = $target[count($target) - 1];
00532                         $inst_str = (!is_int(strpos($attribs["Target"], "__")))
00533                                 ? $inst_str = "inst=\"".$target[1]."\" "
00534                                 : $inst_str = "";
00535                         switch($attribs["Type"])
00536                         {
00537                                 case "PageObject":
00538                                         $tframestr = (!empty($attribs["TargetFrame"]))
00539                                                 ? " target=\"".$attribs["TargetFrame"]."\""
00540                                                 : "";
00541                                         $a_text = eregi_replace("<IntLink".$found[1].">","[iln ".$inst_str."page=\"".$target_id."\"$tframestr]",$a_text);
00542                                         break;
00543 
00544                                 case "StructureObject":
00545                                         $tframestr = (!empty($attribs["TargetFrame"]))
00546                                                 ? " target=\"".$attribs["TargetFrame"]."\""
00547                                                 : "";
00548                                         $a_text = eregi_replace("<IntLink".$found[1].">","[iln ".$inst_str."chap=\"".$target_id."\"$tframestr]",$a_text);
00549                                         break;
00550 
00551                                 case "GlossaryItem":
00552                                         $tframestr = (empty($attribs["TargetFrame"]) || $attribs["TargetFrame"] == "Glossary")
00553                                                 ? ""
00554                                                 : " target=\"".$attribs["TargetFrame"]."\"";
00555                                         $a_text = eregi_replace("<IntLink".$found[1].">","[iln ".$inst_str."term=\"".$target_id."\"".$tframestr."]",$a_text);
00556                                         break;
00557 
00558                                 case "MediaObject":
00559                                         if (empty($attribs["TargetFrame"]))
00560                                         {
00561                                                 $a_text = eregi_replace("<IntLink".$found[1].">","[iln ".$inst_str."media=\"".$target_id."\"/]",$a_text);
00562                                         }
00563                                         else
00564                                         {
00565                                                 $a_text = eregi_replace("<IntLink".$found[1].">","[iln media=\"".$target_id."\"".
00566                                                         " target=\"".$attribs["TargetFrame"]."\"]",$a_text);
00567                                         }
00568                                         break;
00569 
00570                                 case "RepositoryItem":
00571                                         if ($inst_str == "")
00572                                         {
00573                                                 $target_type = ilObject::_lookupType($target_id, true);
00574                                         }
00575                                         else
00576                                         {
00577                                                 $rtype = $target[count($target) - 2];
00578                                                 $target_type = $rtype;
00579                                         }
00580                                         $a_text = eregi_replace("<IntLink".$found[1].">","[iln ".$inst_str."$target_type=\"".$target_id."\"".$tframestr."]",$a_text);
00581                                         break;
00582 
00583                                 default:
00584                                         $a_text = eregi_replace("<IntLink".$found[1].">","[iln]",$a_text);
00585                                         break;
00586                         }
00587                 }
00588                 $a_text = eregi_replace("</IntLink>","[/iln]",$a_text);
00589 
00590                 // external links
00591                 while (eregi("<ExtLink($any)>", $a_text, $found))
00592                 {
00593                         $found[0];
00594                         $attribs = ilUtil::attribsToArray($found[1]);
00595                         //$found[1] = str_replace("?", "\?", $found[1]);
00596                         $a_text = str_replace("<ExtLink".$found[1].">","[xln url=\"".$attribs["Href"]."\"]",$a_text);
00597                 }
00598                 $a_text = eregi_replace("</ExtLink>","[/xln]",$a_text);
00599 
00600 
00601                 // br to linefeed
00602                 $a_text = str_replace("<br />", "\n", $a_text);
00603                 $a_text = str_replace("<br/>", "\n", $a_text);
00604 
00605                 // prevent curly brackets from being swallowed up by template engine
00606                 $a_text = str_replace("{", "&#123;", $a_text);
00607                 $a_text = str_replace("}", "&#125;", $a_text);
00608 
00609                 // unmask html
00610                 $a_text = str_replace("&lt;", "<", $a_text);
00611                 $a_text = str_replace("&gt;", ">",$a_text);
00612 
00613                 // this is needed to allow html like <tag attribute="value">... in paragraphs
00614                 $a_text = str_replace("&quot;", "\"", $a_text);
00615 
00616                 // make ampersands in (enabled) html attributes work
00617                 // e.g. <a href="foo.php?n=4&t=5">hhh</a>
00618                 $a_text = str_replace("&amp;", "&", $a_text);
00619 
00620                 // make &gt; and $lt; work to allow (disabled) html descriptions
00621                 $a_text = str_replace("&lt;", "&amp;lt;", $a_text);
00622                 $a_text = str_replace("&gt;", "&amp;gt;", $a_text);
00623 
00624                 return $a_text;
00625                 //return str_replace("<br />", chr(13).chr(10), $a_text);
00626         }
00627 
00632         function getType()
00633         {
00634                 return ($this->getCharacteristic() == "Code")?"src":parent::getType();
00635         }
00636 
00637 }
00638 ?>

Generated on Fri Dec 13 2013 17:56:56 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1