ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 230 of file class.ilExternalFeedItem.php.

231  {
232  return $this->author;
233  }

◆ getDate()

ilExternalFeedItem::getDate ( )

Get Date.

Returns
string Date

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

191  {
192  return $this->date;
193  }

◆ getId()

ilExternalFeedItem::getId ( )

Get Id.

Returns
string Id

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

211  {
212  return $this->id;
213  }

◆ getLink()

ilExternalFeedItem::getLink ( )

Get Link.

Returns
string Link

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

151  {
152  return $this->link;
153  }

◆ getMagpieItem()

ilExternalFeedItem::getMagpieItem ( )

Get Magpie Item.

Returns
object Magpie Item

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

111  {
112  return $this->magpie_item;
113  }

◆ getSummary()

ilExternalFeedItem::getSummary ( )

Get Summary.

Returns
string Summary

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

Referenced by setMagpieItem().

171  {
172  return $this->summary;
173  }
+ Here is the caller graph for this function:

◆ getTitle()

ilExternalFeedItem::getTitle ( )

Get Title.

Returns
string Title

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

References $title.

Referenced by setMagpieItem().

131  {
132  return $this->title;
133  }
+ Here is the caller graph for this function:

◆ secureString()

ilExternalFeedItem::secureString (   $a_str)

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

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

Referenced by setMagpieItem().

87  {
88  $a_str = ilUtil::secureString($a_str, true, "<b><i><em><strong><br><ol><li><ul><a><img>");
89 
90  // set target to blank for all links
91  $a_str = preg_replace_callback(
92  '/<a[^>]*?href=["\']([^"\']*)["\'][^>]*?>/i',
93  function($matches) {
94  return sprintf(
95  '<a href="%s" target="_blank" rel="noopener">',
96  \ilUtil::secureUrl($matches[1])
97  );
98  },
99  $a_str
100  );
101 
102  return $a_str;
103  }
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 220 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

221  {
222  $this->author = $a_author;
223  }
+ Here is the caller graph for this function:

◆ setDate()

ilExternalFeedItem::setDate (   $a_date)

Set Date.

Parameters
string$a_dateDate

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

References date.

Referenced by setMagpieItem().

181  {
182  $this->date = $a_date;
183  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
+ Here is the caller graph for this function:

◆ setId()

ilExternalFeedItem::setId (   $a_id)

Set Id.

Parameters
string$a_idId

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

Referenced by setMagpieItem().

201  {
202  $this->id = $a_id;
203  }
+ Here is the caller graph for this function:

◆ setLink()

ilExternalFeedItem::setLink (   $a_link)

Set Link.

Parameters
string$a_linkLink

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

Referenced by setMagpieItem().

141  {
142  $this->link = $a_link;
143  }
+ 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  // link
32  if (isset($a_item["link_"]))
33  {
34  $this->setLink(
35  ilUtil::secureUrl(ilUtil::secureLink($this->secureString($a_item["link_"]))));
36  }
37  else
38  {
39  if (isset($a_item["link"]))
40  {
41  $this->setLink(
42  ilUtil::secureUrl(ilUtil::secureLink($this->secureString($a_item["link"]))));
43  }
44  }
45  // summary
46  if (isset($a_item["atom_content"]))
47  {
48  $this->setSummary(
49  $this->secureString($a_item["atom_content"]));
50  }
51  else if (isset($a_item["summary"]))
52  {
53  $this->setSummary(
54  $this->secureString($a_item["summary"]));
55  }
56  else if (isset($a_item["description"]))
57  {
58  $this->setSummary(
59  $this->secureString($a_item["description"]));
60  }
61 
62  // date
63  if (isset($a_item["pubdate"]))
64  {
65  $this->setDate(
66  $this->secureString($a_item["pubdate"]));
67  }
68  else if (isset($a_item["updated"]))
69  {
70  $this->setDate(
71  $this->secureString($a_item["updated"]));
72  }
73 
74  // Author
75  if (isset($a_item["dc"]["creator"]))
76  {
77  $this->setAuthor(
78  $this->secureString($a_item["dc"]["creator"]));
79  }
80 
81  // id
82  $this->setId(md5($this->getTitle().$this->getSummary()));
83 
84  }
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 160 of file class.ilExternalFeedItem.php.

Referenced by setMagpieItem().

161  {
162  $this->summary = $a_summary;
163  }
+ Here is the caller graph for this function:

◆ setTitle()

ilExternalFeedItem::setTitle (   $a_title)

Set Title.

Parameters
string$a_titleTitle

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

Referenced by setMagpieItem().

121  {
122  $this->title = $a_title;
123  }
+ Here is the caller graph for this function:

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