• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Feeds/classes/class.ilExternalFeedItem.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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);                        // 900 seconds = 15 minutes
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                 //var_dump($a_item);
00052                 
00053                 // title
00054                 $this->setTitle(
00055                         $this->secureString($a_item["title"]));
00056                 
00057                 // link
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                 // summary
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                 // date
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                 // Author
00099                 if ($a_item["dc"]["creator"] != "")
00100                 {
00101                         $this->setAuthor(
00102                                 $this->secureString($a_item["dc"]["creator"]));
00103                 }
00104 
00105                 // id
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                 // set target to blank for all links
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 }

Generated on Fri Dec 13 2013 17:56:57 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1