ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilExternalFeedItem.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
14 function __construct()
15 {
16 }
17
21 function setMagpieItem($a_item)
22 {
23 $this->magpie_item = $a_item;
24
25 //var_dump($a_item);
26
27 // title
28 $this->setTitle(
29 $this->secureString($a_item["title"]));
30
31 // link
32 if (isset($a_item["link_"]))
33 {
34 $this->setLink(
35 ilUtil::secureLink($this->secureString($a_item["link_"])));
36 }
37 else
38 {
39 if (isset($a_item["link"]))
40 {
41 $this->setLink(
42 ilUtil::secureLink($this->secureString($a_item["link"])));
43 }
44 }
45
46 // summary
47 if (isset($a_item["atom_content"]))
48 {
49 $this->setSummary(
50 $this->secureString($a_item["atom_content"]));
51 }
52 else if (isset($a_item["summary"]))
53 {
54 $this->setSummary(
55 $this->secureString($a_item["summary"]));
56 }
57 else if (isset($a_item["description"]))
58 {
59 $this->setSummary(
60 $this->secureString($a_item["description"]));
61 }
62
63 // date
64 if (isset($a_item["pubdate"]))
65 {
66 $this->setDate(
67 $this->secureString($a_item["pubdate"]));
68 }
69 else if (isset($a_item["updated"]))
70 {
71 $this->setDate(
72 $this->secureString($a_item["updated"]));
73 }
74
75 // Author
76 if (isset($a_item["dc"]["creator"]))
77 {
78 $this->setAuthor(
79 $this->secureString($a_item["dc"]["creator"]));
80 }
81
82 // id
83 $this->setId(md5($this->getTitle().$this->getSummary()));
84
85 }
86
87 function secureString($a_str)
88 {
89 $a_str = ilUtil::secureString($a_str, true, "<b><i><em><strong><br><ol><li><ul><a><img>");
90 $old_str = "";
91
92 // set target to blank for all links
93 while($old_str != $a_str)
94 {
95 $old_str = $a_str;
96 $a_str = preg_replace("/<a href=\"([^\"]*)\">/i",
97 "/<a href=\"\\1\" target=\"_blank\">/", $a_str);
98 }
99 return $a_str;
100 }
101
107 function getMagpieItem()
108 {
109 return $this->magpie_item;
110 }
111
117 function setTitle($a_title)
118 {
119 $this->title = $a_title;
120 }
121
127 function getTitle()
128 {
129 return $this->title;
130 }
131
137 function setLink($a_link)
138 {
139 $this->link = $a_link;
140 }
141
147 function getLink()
148 {
149 return $this->link;
150 }
151
157 function setSummary($a_summary)
158 {
159 $this->summary = $a_summary;
160 }
161
167 function getSummary()
168 {
169 return $this->summary;
170 }
171
177 function setDate($a_date)
178 {
179 $this->date = $a_date;
180 }
181
187 function getDate()
188 {
189 return $this->date;
190 }
191
197 function setId($a_id)
198 {
199 $this->id = $a_id;
200 }
201
207 function getId()
208 {
209 return $this->id;
210 }
211
217 function setAuthor($a_author)
218 {
219 $this->author = $a_author;
220 }
221
227 function getAuthor()
228 {
229 return $this->author;
230 }
231}
Wraps $item arrays from magpie.
setSummary($a_summary)
Set Summary.
setAuthor($a_author)
Set Author.
setMagpieItem($a_item)
Set Magpie Item and read it into internal variables.
getMagpieItem()
Get Magpie Item.
setTitle($a_title)
Set Title.
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
static secureLink($a_str)