4require_once 
'./Services/Http/classes/class.ilProxySettings.php';
 
    6define(
"MAGPIE_DIR", 
"./Services/Feeds/magpierss/");
 
    7define(
"MAGPIE_CACHE_ON", 
true);
 
    8define(
"MAGPIE_CACHE_DIR", ILIAS_DATA_DIR . 
"/" . CLIENT_ID . 
"/magpie_cache");
 
    9define(
'MAGPIE_OUTPUT_ENCODING', 
"UTF-8");
 
   10define(
'MAGPIE_CACHE_AGE', 900);                        
 
   11define(
'MAGPIE_DEBUG', 
false);
 
   14include_once(
"./Services/Feeds/classes/class.ilExternalFeedItem.php");
 
   40            define(
'IL_FEED_PROXY_HOST', 
"");
 
   41            define(
'IL_FEED_PROXY_PORT', 
"");
 
   72        $this->
error = $a_error;
 
  103        if (!
defined(
'IL_FEED_PROXY_HOST')) {
 
  110                define(
'IL_FEED_PROXY_HOST', 
"");
 
  111                define(
'IL_FEED_PROXY_PORT', 
"");
 
  115        $feed = @fetch_rss($a_url);
 
  122                return "Unknown Error.";
 
  134        if ($this->
getUrl() != 
"") {
 
  135            $this->feed = @fetch_rss($this->
getUrl());
 
  148        if (is_array($this->feed->items)) {
 
  149            foreach ($this->feed->items as $item) {
 
  151                $item_obj->setMagpieItem($item);
 
  152                $this->items[] = $item_obj;
 
  167        $request_headers = array(); 
 
  173        if (!$cache->ERROR) {
 
  175            $cache_status = $cache->check_cache($cache_key);
 
  179        if ($cache_status == 
'HIT') {
 
  191        return $this->feed->channel[
"title"];
 
  199        return $this->feed->channel[
"description"];
 
  217        if (!
defined(
'IL_FEED_PROXY_HOST')) {
 
  222                define(
'IL_FEED_PROXY_HOST', 
"");
 
  223                define(
'IL_FEED_PROXY_PORT', 
"");
 
  227        $res = @fopen($a_url, 
"r");
 
  234        while (!feof(
$res)) {
 
  251            #search through the HTML, save all <link> tags 
  252            # and store each link's attributes in an associative array 
  253            preg_match_all(
'/<link\s+(.*?)\s*\/?>/si', 
$html, $matches);
 
  255            $final_links = array();
 
  256            $link_count = count(
$links);
 
  257            for (
$n=0; 
$n<$link_count; 
$n++) {
 
  260                    $att = preg_split(
'/\s*=\s*/s', $attribute, 2);
 
  261                    if (isset($att[1])) {
 
  262                        $att[1] = preg_replace(
'/([\'"]?)(.*)\1/', 
'$2', $att[1]);
 
  263                        $final_link[strtolower($att[0])] = $att[1];
 
  266                $final_links[
$n] = $final_link;
 
  268            #now figure out which one points to the RSS file 
  269            for (
$n=0; 
$n<$link_count; 
$n++) {
 
  270                if (strtolower($final_links[
$n][
'rel']) == 
'alternate') {
 
  271                    if (strtolower($final_links[
$n][
'type']) == 
'application/rss+xml') {
 
  272                        $href = $final_links[
$n][
'href'];
 
  274                    if (!$href and strtolower($final_links[
$n][
'type']) == 
'text/xml') {
 
  275                        #kludge to make the first version of this still work 
  276                        $href = $final_links[
$n][
'href'];
 
  279                        if (strstr($href, 
"http://") !== 
false) { #
if it
's absolute 
  281                        } else { #otherwise, 'absolutize
' it 
  282                            $url_parts = parse_url($location); 
  283                            #only made it work for http:// links. Any problem with this? 
  284                            $full_url = "http://$url_parts[host]"; 
  285                            if (isset($url_parts['port
'])) { 
  286                                $full_url .= ":$url_parts[port]"; 
  288                            if ($href{0} != '/
') { #it's a relative link on the domain
 
  289                                $full_url .= dirname($url_parts[
'path']);
 
  290                                if (substr($full_url, -1) != 
'/') {
 
  291                                    #if the last character isn't a '/', add it 
An exception for terminatinating execution or to throw for unit testing.
const MAGPIE_OUTPUT_ENCODING
error($a_errmsg)
set error message @access public
Wraps $item arrays from magpie.
Handles external Feeds via Magpie library.
setError($a_error)
Set Error.
getChannelTitle()
Get Channel.
getChannelDescription()
Get Description.
static _getRSSLocation($html, $location)
This one is by Keith Devens , see http://keithdevens.com/weblog/archive/2002/Jun/03/RSSAuto-Discovery...
checkCacheHit()
Check cache hit.
__construct()
Constructor.
static _checkUrl($a_url)
Check Url.
static _createCacheDirectory()
Create magpie cache directorry (if not existing)
static _determineFeedUrl($a_url)
Determine Feed Url.
static _getInstance()
Getter for unique instance.
static getDataDir()
get data directory (outside webspace)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
foreach($_POST as $key=> $value) $res