Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 define("MAGPIE_DIR", "./Services/Feeds/magpierss/");
00025 define("MAGPIE_CACHE_ON", true);
00026 define("MAGPIE_CACHE_DIR", "./".ILIAS_WEB_DIR."/".CLIENT_ID."/magpie_cache");
00027 define('MAGPIE_OUTPUT_ENCODING', "UTF-8");
00028 define('MAGPIE_CACHE_AGE', 900);
00029 include_once(MAGPIE_DIR."/rss_fetch.inc");
00030
00038 class ilExternalFeedItem
00039 {
00040 function __construct()
00041 {
00042 }
00043
00047 function setMagpieItem($a_item)
00048 {
00049 $this->magpie_item = $a_item;
00050
00051
00052
00053
00054 $this->setTitle(
00055 $this->secureString($a_item["title"]));
00056
00057
00058 if ($a_item["link_"] != "")
00059 {
00060 $this->setLink(
00061 ilUtil::secureLink($this->secureString($a_item["link_"])));
00062 }
00063 else
00064 {
00065 $this->setLink(
00066 ilUtil::secureLink($this->secureString($a_item["link"])));
00067 }
00068
00069
00070 if ($a_item["atom_content"] != "")
00071 {
00072 $this->setSummary(
00073 $this->secureString($a_item["atom_content"]));
00074 }
00075 else if ($a_item["summary"] != "")
00076 {
00077 $this->setSummary(
00078 $this->secureString($a_item["summary"]));
00079 }
00080 else
00081 {
00082 $this->setSummary(
00083 $this->secureString($a_item["description"]));
00084 }
00085
00086
00087 if ($a_item["pubdate"] != "")
00088 {
00089 $this->setDate(
00090 $this->secureString($a_item["pubdate"]));
00091 }
00092 else
00093 {
00094 $this->setDate(
00095 $this->secureString($a_item["updated"]));
00096 }
00097
00098
00099 if ($a_item["dc"]["creator"] != "")
00100 {
00101 $this->setAuthor(
00102 $this->secureString($a_item["dc"]["creator"]));
00103 }
00104
00105
00106 $this->setId(md5($this->getTitle().$this->getSummary()));
00107
00108 }
00109
00110 function secureString($a_str)
00111 {
00112 $a_str = ilUtil::secureString($a_str, true, "<b><i><em><strong><br><ol><li><ul><a><img>");
00113
00114
00115 while($old_str != $a_str)
00116 {
00117 $old_str = $a_str;
00118 $a_str = eregi_replace("<a href=\"([^\"]*)\">",
00119 "<a href=\"\\1\" target=\"_blank\">", $a_str);
00120 }
00121 return $a_str;
00122 }
00123
00129 function getMagpieItem()
00130 {
00131 return $this->magpie_item;
00132 }
00133
00139 function setTitle($a_title)
00140 {
00141 $this->title = $a_title;
00142 }
00143
00149 function getTitle()
00150 {
00151 return $this->title;
00152 }
00153
00159 function setLink($a_link)
00160 {
00161 $this->link = $a_link;
00162 }
00163
00169 function getLink()
00170 {
00171 return $this->link;
00172 }
00173
00179 function setSummary($a_summary)
00180 {
00181 $this->summary = $a_summary;
00182 }
00183
00189 function getSummary()
00190 {
00191 return $this->summary;
00192 }
00193
00199 function setDate($a_date)
00200 {
00201 $this->date = $a_date;
00202 }
00203
00209 function getDate()
00210 {
00211 return $this->date;
00212 }
00213
00219 function setId($a_id)
00220 {
00221 $this->id = $a_id;
00222 }
00223
00229 function getId()
00230 {
00231 return $this->id;
00232 }
00233
00239 function setAuthor($a_author)
00240 {
00241 $this->author = $a_author;
00242 }
00243
00249 function getAuthor()
00250 {
00251 return $this->author;
00252 }
00253 }