ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExternalFeedItem Class Reference

Wraps $item arrays from magpie. More...

+ Collaboration diagram for ilExternalFeedItem:

Public Member Functions

 __construct ()
 
 setMagpieItem ($a_item)
 Set Magpie Item and read it into internal variables. More...
 
 secureString ($a_str)
 
 getMagpieItem ()
 Get Magpie Item. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setLink ($a_link)
 Set Link. More...
 
 getLink ()
 Get Link. More...
 
 setSummary ($a_summary)
 Set Summary. More...
 
 getSummary ()
 Get Summary. More...
 
 setDate ($a_date)
 Set Date. More...
 
 getDate ()
 Get Date. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setAuthor ($a_author)
 Set Author. More...
 
 getAuthor ()
 Get Author. More...
 

Detailed Description

Wraps $item arrays from magpie.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilExternalFeedItem.php.

Constructor & Destructor Documentation

◆ __construct()

ilExternalFeedItem::__construct ( )

Definition at line 14 of file class.ilExternalFeedItem.php.

15  {
16  }

Member Function Documentation

◆ getAuthor()

ilExternalFeedItem::getAuthor ( )

Get Author.

Returns
string Author

Definition at line 225 of file class.ilExternalFeedItem.php.

226  {
227  return $this->author;
228  }

◆ getDate()

ilExternalFeedItem::getDate ( )

Get Date.

Returns
string Date

Definition at line 185 of file class.ilExternalFeedItem.php.

186  {
187  return $this->date;
188  }

◆ getId()

ilExternalFeedItem::getId ( )

Get Id.

Returns
string Id

Definition at line 205 of file class.ilExternalFeedItem.php.

References $id.

206  {
207  return $this->id;
208  }
if(!array_key_exists('StateId', $_REQUEST)) $id

◆ getLink()

ilExternalFeedItem::getLink ( )

Get Link.

Returns
string Link

Definition at line 145 of file class.ilExternalFeedItem.php.

146  {
147  return $this->link;
148  }

◆ getMagpieItem()

ilExternalFeedItem::getMagpieItem ( )

Get Magpie Item.

Returns
object Magpie Item

Definition at line 105 of file class.ilExternalFeedItem.php.

106  {
107  return $this->magpie_item;
108  }

◆ getSummary()

ilExternalFeedItem::getSummary ( )

Get Summary.

Returns
string Summary

Definition at line 165 of file class.ilExternalFeedItem.php.

References $summary.

Referenced by setMagpieItem().

166  {
167  return $this->summary;
168  }
$summary
Definition: cron.php:24
+ Here is the caller graph for this function:

◆ getTitle()

ilExternalFeedItem::getTitle ( )

Get Title.

Returns
string Title

Definition at line 125 of file class.ilExternalFeedItem.php.

References $title.

Referenced by setMagpieItem().

126  {
127  return $this->title;
128  }
+ Here is the caller graph for this function:

◆ secureString()

ilExternalFeedItem::secureString (   $a_str)

Definition at line 81 of file class.ilExternalFeedItem.php.

References ilUtil\secureString(), and ilUtil\secureUrl().

Referenced by setMagpieItem().

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  }
static secureUrl($url)
Prepare secure href attribute.
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAuthor()

ilExternalFeedItem::setAuthor (   $a_author)

Set Author.

Parameters
string$a_authorAuthor

Definition at line 215 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

216  {
217  $this->author = $a_author;
218  }
+ Here is the caller graph for this function:

◆ setDate()

ilExternalFeedItem::setDate (   $a_date)

Set Date.

Parameters
string$a_dateDate

Definition at line 175 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

176  {
177  $this->date = $a_date;
178  }
+ Here is the caller graph for this function:

◆ setId()

ilExternalFeedItem::setId (   $a_id)

Set Id.

Parameters
string$a_idId

Definition at line 195 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

196  {
197  $this->id = $a_id;
198  }
+ Here is the caller graph for this function:

◆ setLink()

ilExternalFeedItem::setLink (   $a_link)

Set Link.

Parameters
string$a_linkLink

Definition at line 135 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

136  {
137  $this->link = $a_link;
138  }
+ Here is the caller graph for this function:

◆ setMagpieItem()

ilExternalFeedItem::setMagpieItem (   $a_item)

Set Magpie Item and read it into internal variables.

Definition at line 21 of file class.ilExternalFeedItem.php.

References getSummary(), getTitle(), ilUtil\secureLink(), secureString(), ilUtil\secureUrl(), setAuthor(), setDate(), setId(), setLink(), setSummary(), and setTitle().

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  }
setAuthor($a_author)
Set Author.
setTitle($a_title)
Set Title.
static secureUrl($url)
Prepare secure href attribute.
static secureLink($a_str)
setSummary($a_summary)
Set Summary.
+ Here is the call graph for this function:

◆ setSummary()

ilExternalFeedItem::setSummary (   $a_summary)

Set Summary.

Parameters
string$a_summarySummary

Definition at line 155 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

156  {
157  $this->summary = $a_summary;
158  }
+ Here is the caller graph for this function:

◆ setTitle()

ilExternalFeedItem::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle

Definition at line 115 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

116  {
117  $this->title = $a_title;
118  }
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: