ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public function __construct()
15 {
16 }
17
21 public 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
32 // link
33 if (isset($a_item["link_"])) {
34 $this->setLink(
35 ilUtil::secureUrl(ilUtil::secureLink($this->secureString($a_item["link_"])))
36 );
37 } else {
38 if (isset($a_item["link"])) {
39 $this->setLink(
40 ilUtil::secureUrl(ilUtil::secureLink($this->secureString($a_item["link"])))
41 );
42 }
43 }
44 // summary
45 if (isset($a_item["atom_content"])) {
46 $this->setSummary(
47 $this->secureString($a_item["atom_content"])
48 );
49 } elseif (isset($a_item["summary"])) {
50 $this->setSummary(
51 $this->secureString($a_item["summary"])
52 );
53 } elseif (isset($a_item["description"])) {
54 $this->setSummary(
55 $this->secureString($a_item["description"])
56 );
57 }
58
59 // date
60 if (isset($a_item["pubdate"])) {
61 $this->setDate(
62 $this->secureString($a_item["pubdate"])
63 );
64 } elseif (isset($a_item["updated"])) {
65 $this->setDate(
66 $this->secureString($a_item["updated"])
67 );
68 }
69
70 // Author
71 if (isset($a_item["dc"]["creator"])) {
72 $this->setAuthor(
73 $this->secureString($a_item["dc"]["creator"])
74 );
75 }
76
77 // id
78 $this->setId(md5($this->getTitle() . $this->getSummary()));
79 }
80
81 public function secureString($a_str)
82 {
83 $a_str = ilUtil::secureString($a_str, true, "<b><i><em><strong><br><ol><li><ul><a><img>");
84
85 // set target to blank for all links
86 $a_str = preg_replace_callback(
87 '/<a[^>]*?href=["\']([^"\']*)["\'][^>]*?>/i',
88 function ($matches) {
89 return sprintf(
90 '<a href="%s" target="_blank" rel="noopener">',
91 \ilUtil::secureUrl($matches[1])
92 );
93 },
94 $a_str
95 );
96
97 return $a_str;
98 }
99
105 public function getMagpieItem()
106 {
107 return $this->magpie_item;
108 }
109
115 public function setTitle($a_title)
116 {
117 $this->title = $a_title;
118 }
119
125 public function getTitle()
126 {
127 return $this->title;
128 }
129
135 public function setLink($a_link)
136 {
137 $this->link = $a_link;
138 }
139
145 public function getLink()
146 {
147 return $this->link;
148 }
149
155 public function setSummary($a_summary)
156 {
157 $this->summary = $a_summary;
158 }
159
165 public function getSummary()
166 {
167 return $this->summary;
168 }
169
175 public function setDate($a_date)
176 {
177 $this->date = $a_date;
178 }
179
185 public function getDate()
186 {
187 return $this->date;
188 }
189
195 public function setId($a_id)
196 {
197 $this->id = $a_id;
198 }
199
205 public function getId()
206 {
207 return $this->id;
208 }
209
215 public function setAuthor($a_author)
216 {
217 $this->author = $a_author;
218 }
219
225 public function getAuthor()
226 {
227 return $this->author;
228 }
229}
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
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)
static secureUrl($url)
Prepare secure href attribute.
if(!array_key_exists('StateId', $_REQUEST)) $id
$summary
Definition: cron.php:24