]> git.mxchange.org Git - mailer.git/blobdiff - inc/classes/rdf.class.php
Some fixes:
[mailer.git] / inc / classes / rdf.class.php
index 8233aba8cc9b01a2402b36c4eb6b4fa321af1e7b..fd0ff99b1b672f075f4adfc7ee64580270945e90 100644 (file)
@@ -1,35 +1,36 @@
 <?php
 /* $Id$ */
 
-//
-// +----------------------------------------------------------------------+
-// | rss Parser                                                           |
-// | Copyright (c) 2001 Stefan Saasen                                     |
-// +----------------------------------------------------------------------+
-// | The contents of this file are subject to the Mozilla Public License  |
-// | Version 1.1 (the "License"); you may not use this file except in     |
-// | compliance with the License. You may obtain a copy of the License at |
-// | http://www.mozilla.org/MPL/                                          |
-// |                                                                      |
-// | Software distributed under the License is distributed on an "AS IS"  |
-// | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See  |
-// | the License for the specific language governing rights and           |
-// | limitations under the License.                                       |
-// +----------------------------------------------------------------------+
-// |                                                                      |
-// | Maintainer and initial developer:                                    |
-// | Stefan Saasen <s@fase4.com>                                          |
-// |                                                                      |
-// | Proxy and authentication methods added by:                           |
-// | Marco Kraus <marco.kraus@siemens.com>                                |
-// |                                                                      |
-// | Decoding of data by htmlentities or utf8_decode added by:            |
-// | Roland Haeder <webmaster@mxchange.org>                               |
-// |                                                                      |
-// +----------------------------------------------------------------------+
-// | Ref:                                                                 |
-// |   @link http://www.fase4.com/rdf/                   Latest release   |
-// +----------------------------------------------------------------------+
+/*
+ * +----------------------------------------------------------------------+
+ * | rss Parser                                                           |
+ * | Copyright (c) 2001 Stefan Saasen                                     |
+ * +----------------------------------------------------------------------+
+ * | The contents of this file are subject to the Mozilla Public License  |
+ * | Version 1.1 (the "License"); you may not use this file except in     |
+ * | compliance with the License. You may obtain a copy of the License at |
+ * | http: *www.mozilla.org/MPL/                                          |
+ * |                                                                      |
+ * | Software distributed under the License is distributed on an "AS IS"  |
+ * | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See  |
+ * | the License for the specific language governing rights and           |
+ * | limitations under the License.                                       |
+ * +----------------------------------------------------------------------+
+ * |                                                                      |
+ * | Maintainer and initial developer:                                    |
+ * | Stefan Saasen <s@fase4.com>                                          |
+ * |                                                                      |
+ * | Proxy and authentication methods added by:                           |
+ * | Marco Kraus <marco.kraus@siemens.com>                                |
+ * |                                                                      |
+ * | Decoding of data by htmlentities or utf8_decode added by:            |
+ * | Roland Haeder <webmaster@mxchange.org>                               |
+ * |                                                                      |
+ * +----------------------------------------------------------------------+
+ * | Ref:                                                                 |
+ * |   @link http://www.fase4.com/rdf/                   Latest release   |
+ * +----------------------------------------------------------------------+
+ */
 
 /**
  * Class RSS Parser
@@ -61,18 +62,19 @@ class fase4_rdf {
         * @access private
         * @var    boolean
         */
-       var $_use_nl2br = true;
+       var $_use_nl2br = TRUE;
 
        /**
         * Sets the decoding mode of the read data (UTF8 scrambles some german umlauts here!)
         *
         * "htmlentities" - Use the function htmlentities()
         * "utf8_decode"  - Use the function ut8_decode() when you have UTF8 encoded text
+        * <empty>        - Use none of both
         *
         * @access private
         * @var    string
         */
-       var $_decoding_mode = 'utf8_decode';
+       var $_decoding_mode = '';
 
        /**
         * If $_link_target is set a target='xxx' attribute in each <a /> and <form accept-charset="utf-8" /> html tag will be added
@@ -124,7 +126,7 @@ class fase4_rdf {
         * @see      set_proxy()
         * @var      bool
         */
-       var $_use_proxy = false;
+       var $_use_proxy = FALSE;
 
        /**
         * just a flag for checking if proxy-support with authentication
@@ -135,7 +137,7 @@ class fase4_rdf {
         * @see      set_proxy()
         * @var      boolean
         */
-       var $_use_proxy_auth = false;
+       var $_use_proxy_auth = FALSE;
 
        /**
         * The time the Files will be cached (in seconds).
@@ -159,10 +161,10 @@ class fase4_rdf {
         * @access private
         * @var    boolean
         */
-       var $_use_cached_file = true;
+       var $_use_cached_file = TRUE;
 
        /**
-        * (fast|normal) depends on _use_dynamic_display(). _use_dynamic_display( TRUE ) -> 'normal', otherwise 'fast'
+        * (fast|normal) depends on _use_dynamic_display(). _use_dynamic_display(TRUE) -> 'normal', otherwise 'fast'
         *
         * @access private
         * @var    string
@@ -191,7 +193,7 @@ class fase4_rdf {
         * @access private
         * @var    boolean
         */
-       var $_cache_dir_ok = false;
+       var $_cache_dir_ok = FALSE;
 
        /**
         * Type of the file to be parsed (RSS or RDF).
@@ -238,7 +240,7 @@ class fase4_rdf {
         * @access private
         * @var    array
         */
-       var $_use_dynamic_display = false;
+       var $_use_dynamic_display = FALSE;
 
        /**
         * <item> count
@@ -254,7 +256,7 @@ class fase4_rdf {
         * @access private
         * @var    boolean
         */
-       var $_max_count = false;
+       var $_max_count = FALSE;
 
        /**
         * Array containing the content of <channel />
@@ -310,7 +312,7 @@ class fase4_rdf {
         * @access private
         * @var    array
         */
-       var $_ctags = array( 'x' );
+       var $_ctags = array('x');
 
        /**
         * Array containing the Channel content. Just For internal XML Parser Purposes.
@@ -334,7 +336,7 @@ class fase4_rdf {
         * @access private
         * @var    array
         */
-       var $_tags = array( 'x' );  // Array
+       var $_tags = array('x');  // Array
 
        /**
         * Garbage collection: probability in percent
@@ -353,16 +355,25 @@ class fase4_rdf {
        var $_output = '';
 
        /**
-        * @var  string
+        * @var      string
         */
        var $_parse_mode = '';
 
-       // Output variable
+       /**
+        * Output variable
+        */
        var $out = '';
 
-       // Salt for hashing
+       /**
+        * Salt for hashing
+        */
        var $salt = '';
 
+       /**
+        * Callback function for processing content in finish() method.
+        */
+       var $_finishCallback = NULL;
+
        /**
         * Constructor of our Class
         *
@@ -371,10 +382,9 @@ class fase4_rdf {
         *
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
-        * @see          _refresh
+        * @see       _refresh
         */
-       function fase4_rdf()
-       {
+       function fase4_rdf () {
                // default Value, to be overwritten in set_refresh()
                $this->_refresh = (time() - 1200);
                $this->_clear_cItems();
@@ -387,11 +397,10 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @return    string Displays RDF Content ( using _display() )
-        * @see          _remote_file, cache()
+        * @return    string Displays RDF Content (using _display())
+        * @see       _remote_file, cache()
         */
-       function parse_RDF( $rdf )
-       {
+       function parse_RDF ($rdf) {
                unset($this->_array_item);
                $this->_remote_file = $rdf;
                $this->out .= "<!-- http://www.fase4.com/rdf/ -->";
@@ -400,7 +409,7 @@ class fase4_rdf {
                $this->out .= "</table>";
                $this->_output = '';
                $this->_item_count = '0';
-               return true;
+               return TRUE;
        }
 
        /**
@@ -409,17 +418,28 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @return    string Displays RDF Content ( using _display() )
-        * @see          _remote_file, cache()
+        * @return    string Displays RDF Content (using _display())
+        * @see       _remote_file, cache()
         */
-       function finish($return = false)
-       {
-               if (!$return) {
-                       echo $this->out;
+       function finish ($return = FALSE) {
+               // Replace dollar chars as they may cause problems
+               $this->out = str_replace('$', '&#36;', $this->out);
+
+               // Is the call-back enabled?
+               if ((!empty($this->out)) && (!is_null($this->_finishCallback)) && (is_callable($this->_finishCallback))) {
+                       // Then call it
+                       $this->out = call_user_func($this->_finishCallback, $this->out);
+               } // END - if
+
+               // Do garbage collection
+               $this->_garbage_collection();
+
+               // Return or output?
+               if ($return === FALSE) {
+                       print($this->out);
                } else {
                        return $this->out;
                }
-               $this->_garbage_collection();
        }
 
        /**
@@ -427,20 +447,19 @@ class fase4_rdf {
         *
         * In the first case the rdf/rss File will be stored locally, in the second case the html output of the specified source will be stored.
         * In this case you can not modify the display settings.
-        * processing time: ( 1.4792) --> remote file
-        * processing time: ( 0.0313) --> using 'normal cache' with display Modification turned on.
-        * processing time: ( 0.0019) --> using 'fast cache'
+        * processing time: (1.4792) --> remote file
+        * processing time: (0.0313) --> using 'normal cache' with display Modification turned on.
+        * processing time: (0.0019) --> using 'fast cache'
         *
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @return    string Displays RDF Content ( using _display() )
-        * @see          _remote_file, cache()
+        * @return    string Displays RDF Content (using _display())
+        * @see       _remote_file, cache()
         */
-       function use_dynamic_display( $bool )
-       {
+       function use_dynamic_display ($bool) {
                $this->_use_dynamic_display = $bool;
-               return true;
+               return TRUE;
        }
 
        /**
@@ -451,8 +470,7 @@ class fase4_rdf {
         * @param     string $data    RDF File XML Data
         * @see       _clear_Items()
         */
-       function _parse_xRDF( $data )
-       {
+       function _parse_xRDF($data) {
                $this->_clear_Items();
                $xml_parser = xml_parser_create();
                xml_set_object($xml_parser,$this);
@@ -463,7 +481,7 @@ class fase4_rdf {
                        $this->_throw_exception(sprintf("XML error: %s at line %d",
                        xml_error_string(xml_get_error_code($xml_parser)),
                        xml_get_current_line_number($xml_parser)).'<br /><br />Exception in function parse_RDF().');
-               }
+               } // END - if
                xml_parser_free($xml_parser);
        }
 
@@ -474,19 +492,17 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     int $seconds time files will be cached (in seconds).
-        * @return       boolean
-        * @see          _refresh
+        * @return    boolean
+        * @see       _refresh
         */
-       function set_refresh( $seconds )
-       {
+       function set_refresh($seconds) {
                $this->_refresh = (time() - $seconds);
-               return true;
+               return TRUE;
        }
 
-       function set_salt( $saltPara )
-       {
+       function set_salt ($saltPara) {
                $this->salt = $saltPara;
-               return true;
+               return TRUE;
        }
 
        /**
@@ -495,13 +511,12 @@ class fase4_rdf {
         * @access    public
         * @param     int $int No of max <item>s
         * @author    Stefan Saasen <s@fase4.com>
-        * @return       boolean
-        * @see          _max_count, _endElement()
+        * @return    boolean
+        * @see       _max_count, _endElement()
         */
-       function set_max_item( $int )
-       {
+       function set_max_item ($int) {
                $this->_max_count = $int;
-               return true;
+               return TRUE;
        }
 
        /**
@@ -510,12 +525,11 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $dir Path to Directory.
-        * @return       boolean
-        * @see          _cache_dir
+        * @return    boolean
+        * @see       _cache_dir
         */
-       function set_CacheDir( $dir )
-       {
-               if(substr($dir, -1) != '/') {
+       function set_CacheDir ($dir) {
+               if (substr($dir, -1) != '/') {
                        $dir = $dir.'/';
                }
                $this->_cache_dir = $dir;
@@ -528,10 +542,9 @@ class fase4_rdf {
         * @param     string $msg Message to display on failure
         * @author    Stefan Saasen <s@fase4.com>
         */
-       function _throw_exception( $msg )
-       {
+       function _throw_exception ($msg) {
                $this->out .= "<div style=\"font-family: verdana, helvetica, arial, sans-serif;font-size:11px; color: #6699cc;margin-top:10px;margin-bottom:10px;\" align=\"center\">fase4 RDF Error: ".$msg."</div>";
-               return true;
+               return TRUE;
        }
 
        /**
@@ -541,7 +554,7 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @see       _item
         */
-       function _clear_Items( ) {
+       function _clear_Items() {
                $this->_item = array(
                        'title'         => '',
                        'link'          => '',
@@ -561,7 +574,7 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @see       _item
         */
-       function _clear_cItems( ) {
+       function _clear_cItems() {
                $this->_citem = array(
                        'title'          => '',
                        'link'           => '',
@@ -596,36 +609,36 @@ class fase4_rdf {
         * @param     mixed  $parser a reference to the XML parser calling the handler.
         * @param     string $name contains the name of the element for which this handler is called.
         * @param     string $attrs contains an associative array with the element's attributes (if any).
-        * @see          _get_ChannelData(), _clear_Items(), _type, _parse_mode, _depth, _tags, _cdepth, _ctags
+        * @see       _get_ChannelData(), _clear_Items(), _type, _parse_mode, _depth, _tags, _cdepth, _ctags
         */
-       function _startElement($parser, $name, $attrs) {
+       function _startElement ($parser, $name, $attrs) {
                // We have to determine, which type of xml data we have to parse
-               if($name == 'rss') {
+               if ($name == 'rss') {
                        $this->_type = 'rss';
-               } elseif($name == 'rdf:RDF' OR $name == 'rdf') {
+               } elseif ($name == 'rdf:RDF' || $name == 'rdf') {
                        $this->_type = 'rdf';
                }
 
 
-               if ( $name == 'channel' AND $this->_type != 'rdf' ) {
+               if ($name == 'channel' && $this->_type != 'rdf') {
                        $this->_parse_mode = 'channel';
-               } elseif ( ($name=='item')
-               ||($name=='image')
-               ||($name=='textinput')
-               ||(($name=='channel') && ($this->_type != 'rss')) ) {
-                       if($this->_parse_mode=='channel') {
-                               $this->_get_ChannelData( $parser );
+               } elseif (($name == 'item')
+               || ($name == 'image')
+               || ($name == 'textinput')
+               || (($name == 'channel') && ($this->_type != 'rss'))) {
+                       if ($this->_parse_mode == 'channel') {
+                               $this->_get_ChannelData($parser);
                        }
                        $this->_parse_mode = 'all';
                }
 
-               if( !isset( $this->_depth[$this->get_parser_id($parser)] ) ) {
+               if (!isset($this->_depth[$this->get_parser_id($parser)])) {
                        $this->_depth[$this->get_parser_id($parser)] = '0';
                }
                $this->_depth[$this->get_parser_id($parser)]++;
                array_push($this->_tags, $name);
 
-               if( !isset( $this->_cdepth[$this->get_parser_id($parser)] ) ) {
+               if (!isset($this->_cdepth[$this->get_parser_id($parser)])) {
                        $this->_cdepth[$this->get_parser_id($parser)] = '0';
                }
                $this->_cdepth[$this->get_parser_id($parser)]++;
@@ -638,17 +651,16 @@ class fase4_rdf {
         * @access    private
         * @author    Stefan Saasen <s@fase4.com>
         * @param     mixed  $parser a reference to the XML parser calling the handler.
-        * @see          _output, _display_opt, _citem
+        * @see       _output, _display_opt, _citem
         */
-       function _get_ChannelData( $parser )
-       {
+       function _get_ChannelData ($parser) {
                $this->_citem['link'] = trim($this->_citem['link']);
                if (($this->_display_opt['sitelink'] == $this->_citem['link']) && (!empty($this->_display_opt['reflink'])) && (!empty($this->_display_opt['refid'])))
                {
                        $this->_citem['link'] .= $this->_display_opt['reflink'].$this->_display_opt['refid'];
                }
 
-               if( empty($this->_display_opt['channel']) OR
+               if (empty($this->_display_opt['channel']) ||
                $this->_display_opt['channel'] != 'hidden') {
                        $this->_output .= "<tr><td>\n";
                        $this->_output .= "<table border=\"0\" width=\"100%\" class=\"fase4_rdf_meta\" cellspacing=\"5\" cellpadding=\"2\">\n";
@@ -656,14 +668,14 @@ class fase4_rdf {
                        $this->_output .= "<tr><td class=\"fase4_rdf\">".strip_tags($this->_citem['description'], '<a>, <img>')."</td></tr>\n";
                        $this->_output .= "<tr><td>&nbsp;</td></tr>\n";
                        $this->_output .= "<tr><td class=\"fase4_rdf\">\n";
-                       if(isset($this->_display_opt['build']) && $this->_display_opt['build'] != 'hidden') {
-                               if($this->_citem['lastBuildDate']){$this->_output .= 'build: '. $this->_citem['lastBuildDate'].'<br />';}
+                       if (isset($this->_display_opt['build']) && $this->_display_opt['build'] != 'hidden') {
+                               if ($this->_citem['lastBuildDate']) { $this->_output .= 'build: '. $this->_citem['lastBuildDate'].'<br />';}
                        }
-                       if(isset($this->_display_opt['cache_update']) && $this->_display_opt['cache_update'] != 'hidden' && ( $_update = $this->get_cache_update_time()) ) {
+                       if (isset($this->_display_opt['cache_update']) && $this->_display_opt['cache_update'] != 'hidden' && ($_update = $this->get_cache_update_time())) {
                                $this->_output .= 'cache update: '.$_update."<br />\n";
                        }
                        $this->_output .= "<a href=\"".$this->_citem['link']."\" ";
-                       if(isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
+                       if (isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
                        $this->_output .= ">".$this->_cut_string($this->_citem['link']) . '</a>';
                        $this->_output .= "</td></tr>\n";
                        $this->_output .= "<tr><td><hr noshade width=\"100%\" size=\"1\"></td></tr>\n";
@@ -683,9 +695,9 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @param     mixed  $parser a reference to the XML parser calling the handler.
         * @param     string $name contains the name of the element for which this handler is called.
-        * @see          _clear_Items(), _type, _parse_mode, _depth, _tags, _cdepth, _ctags, _item, _output, _display_opt
+        * @see       _clear_Items(), _type, _parse_mode, _depth, _tags, _cdepth, _ctags, _item, _output, _display_opt
         */
-       function _endElement($parser, $name) {
+       function _endElement ($parser, $name) {
                array_pop($this->_tags);
                $this->_depth[$this->get_parser_id($parser)]--;
                array_pop($this->_ctags);
@@ -693,19 +705,19 @@ class fase4_rdf {
                $this->_item['link'] = trim($this->_item['link']);
                if ((!empty($this->_display_opt['refid'])) && (!empty($this->_item['link'])))
                {
-                       if (!ereg('refid=', $this->_item['link'])) $this->_item['link'] .= '?refid=' . $this->_display_opt['refid'];
+                       if (!isInString('refid=', $this->_item['link'])) $this->_item['link'] .= '?refid=' . $this->_display_opt['refid'];
                }
                switch ($name) {
                        case 'item':
-                               if(empty($this->_max_count) OR $this->_item_count < $this->_max_count) {
-                                       if($this->_item['title'] != $this->_item['description']
-                                       AND $this->_item['description']) {
+                               if (empty($this->_max_count) || $this->_item_count < $this->_max_count) {
+                                       if ($this->_item['title'] != $this->_item['description']
+                                       && $this->_item['description']) {
 
                                                // word-wrapping added by Roland Haeder <webmaster@mxchange.org>
                                                if (($this->_word_wrap > 0) && (strlen($this->_item['description']) > $this->_word_wrap))
                                                {
                                                        // Switch off _use_nl2br
-                                                       $this->_use_nl2br = false;
+                                                       $this->_use_nl2br = FALSE;
                                                        // First remove all \n
                                                        $this->_item['description'] = str_replace('\n', ' ', $this->_item['description']);
                                                        // Wrap with <br />\n
@@ -721,7 +733,7 @@ class fase4_rdf {
                                                if ($this->_use_nl2br) $this->_item['description'] = nl2br($this->_item['description']);
 
                                                $this->_output .= "<tr><td class=\"fase4_rdf_title\"><div class=\"fase4_rdf_title\"><a class=\"fase4_rdf_title\" href=\"".$this->_item['link']."\" ";
-                                               if(isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
+                                               if (isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
                                                $this->_output .= ">".strip_tags($this->_item['title'], '<a>, <img>').'</a> ('.$this->_item['pubDate'].")</div></td></tr>\n";
                                                $this->_output .= "<tr><td class=\"fase4_rdf\">".$this->_item['description']."</td></tr>\n";
                                                // we just display the <hr> if there is a description
@@ -729,7 +741,7 @@ class fase4_rdf {
                                        } else {
                                                $this->_output .= "<tr><td class=\"fase4_rdf\">\n";
                                                $this->_output .= "<a href=\"".$this->_item["link"]."\" ";
-                                               if(isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
+                                               if (isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
                                                $this->_output .= ">".$this->_item["title"]."</a></td></tr>\n";
                                        }
 
@@ -745,12 +757,12 @@ class fase4_rdf {
                                break;
 
                        case 'image':
-                               if(isset($this->_display_opt['image']) && ($this->_display_opt['image'] != 'hidden') && $this->_item['url']) {
+                               if (isset($this->_display_opt['image']) && ($this->_display_opt['image'] != 'hidden') && $this->_item['url']) {
                                        $this->_output .= "<tr><td class=\"fase4_rdf\">\n";
                                        $this->_output .= "<a href=\"".$this->_item['link']."\" ";
-                                       if(isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
+                                       if (isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
                                        $this->_output .= "><img src=\"".$this->_item['url']."\"";
-                                       if(isset($this->_item['width']) && isset($this->_item['height'])) {
+                                       if (isset($this->_item['width']) && isset($this->_item['height'])) {
                                                $this->_output .= " width=\"".$this->_item['width']."\" height=\"".$this->_item['height']."\"";
                                        }
                                        $this->_output .= " alt=\"".$this->_item['title']."\" border=\"0\" /></a></td></tr>\n";
@@ -762,28 +774,28 @@ class fase4_rdf {
                                                'height' => $this->_item['height']
                                        );
                                        $this->_clear_Items();
-                               } elseif( isset($this->_display_opt['image'] ) && ($this->_display_opt['image'] == 'hidden') ) {
+                               } elseif (isset($this->_display_opt['image']) && ($this->_display_opt['image'] == 'hidden')) {
                                        $this->_clear_Items();
                                }
 
                                break;
 
                        case 'channel':
-                               if(isset($this->_display_opt['channel']) AND $this->_display_opt['channel'] != 'hidden' AND $this->_item['title'] != '') {
+                               if (isset($this->_display_opt['channel']) && $this->_display_opt['channel'] != 'hidden' && $this->_item['title'] != '') {
                                        $this->_output .= "<tr><td>\n";
                                        $this->_output .= "<table border=\"0\" width=\"100%\" class=\"fase4_rdf_meta\" cellspacing=\"5\" cellpadding=\"2\">\n";
                                        $this->_output .= "<tr><td class=\"fase4_rdf\"><div class=\"fase4_rdf_title\">".htmlspecialchars($this->_item['title'])."</div></td></tr>\n";
                                        $this->_output .= "<tr><td class=\"fase4_rdf\">".strip_tags($this->_item['description'], '<a>, <img>')."</td></tr>\n";
                                        $this->_output .= "<tr><td>&nbsp;</td></tr>\n";
                                        $this->_output .= "<tr><td class=\"fase4_rdf\">\n";
-                                       if($this->_display_opt['build'] != 'hidden') {
-                                               if($this->_item['lastBuildDate']){$this->_output .= 'build: '. $this->_item['lastBuildDate'].'<br />';}
+                                       if ($this->_display_opt['build'] != 'hidden') {
+                                               if ($this->_item['lastBuildDate']) { $this->_output .= 'build: '. $this->_item['lastBuildDate'].'<br />';}
                                        }
-                                       if($this->_display_opt['cache_update'] != 'hidden' && ( $_update = $this->get_cache_update_time()) ) {
+                                       if ($this->_display_opt['cache_update'] != 'hidden' && ($_update = $this->get_cache_update_time())) {
                                                $this->_output .= 'cache update: '.$_update."<br />\n";
                                        }
                                        $this->_output .= "<a href=\"".$this->_item['link']."\" ";
-                                       if(isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
+                                       if (isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
                                        $this->_output .= ">".$this->_cut_string($this->_item['link'])."</a>\n";
                                        $this->_output .= "</td></tr>\n";
                                        $this->_output .= "</table></td></tr>\n";
@@ -799,10 +811,10 @@ class fase4_rdf {
                                break;
 
                        case 'textinput':
-                               if(isset($this->_display_opt['textinput']) && ($this->_display_opt['textinput'] != 'hidden') && $this->_item['name'] && $this->_item['link']) {
+                               if (isset($this->_display_opt['textinput']) && ($this->_display_opt['textinput'] != 'hidden') && $this->_item['name'] && $this->_item['link']) {
                                        $this->_output .= "<tr><td class=\"fase4_rdf\">\n";
-                                       $this->_output .= "<form accept-charset=\"utf-8\" action=\"".$this->_item['link']."\" ";
-                                       if(isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
+                                       $this->_output .= "<form accept-charset=\"UTF-8\" action=\"".$this->_item['link']."\" ";
+                                       if (isset($this->_link_target)) { $this->_output .= "target=\"".$this->_link_target."\" "; }
                                        $this->_output .= "method=\"get\">\n";
                                        $this->_output .= "<div class=\"fase4_rdf_title\">".$this->_item['title']."</div>";
                                        $this->_output .= strip_tags($this->_item['description'], '<a>, <img>')."<br /><br />\n";
@@ -817,7 +829,7 @@ class fase4_rdf {
                                                'description' => $this->_item['description']
                                        );
                                        $this->_clear_Items();
-                               } elseif( isset($this->_display_opt['textinput']) && ($this->_display_opt['textinput'] == 'hidden') ) {
+                               } elseif (isset($this->_display_opt['textinput']) && ($this->_display_opt['textinput'] == 'hidden')) {
                                        $this->_clear_Items();
                                }
 
@@ -833,8 +845,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_channel
         */
-       function get_array_channel( )
-       {
+       function get_array_channel () {
                return $this->_array_channel;
        }
 
@@ -846,8 +857,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_item
         */
-       function get_array_item( )
-       {
+       function get_array_item () {
                return $this->_array_item;
        }
 
@@ -859,8 +869,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_textinput
         */
-       function get_array_textinput( )
-       {
+       function get_array_textinput () {
                return $this->_array_textinput;
        }
 
@@ -893,8 +902,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_image
         */
-       function get_array_image( )
-       {
+       function get_array_image() {
                return $this->_array_image;
        }
 
@@ -905,13 +913,11 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @param     mixed  $parser a reference to the XML parser calling the handler.
         * @param     string $text contains the character data as a string.
-        * @see          _parse_mode, _item, _tags, _depth, _citem, _ctags, _cdepth
+        * @see       _parse_mode, _item, _tags, _depth, _citem, _ctags, _cdepth
         */
-       function _parseData($parser, $text)
-       {
+       function _parseData($parser, $text) {
                // Deocing mode added by Roland Haeder <webmaster@mxchange.org>
-               switch ($this->_decoding_mode)
-               {
+               switch ($this->_decoding_mode) {
                        case 'utf8_decode':
                                $text = utf8_decode($text);
                                break;
@@ -921,18 +927,18 @@ class fase4_rdf {
                                break;
                }
 
-               $clean = preg_replace("/\s/", "", $text);
+               $clean = preg_replace("/\s/", '', $text);
                if ($clean) {
-                       $text = preg_replace("/^\s+/", "", $text)."\n";
-                       if($this->_parse_mode == 'all') {
-                               if ( isset($this->_item[$this->_tags[$this->_depth[$this->get_parser_id($parser)]]]) &&
-                               $this->_item[$this->_tags[$this->_depth[$this->get_parser_id($parser)]]] ) {
+                       $text = preg_replace("/^\s+/", '', $text)."\n";
+                       if ($this->_parse_mode == 'all') {
+                               if (isset($this->_item[$this->_tags[$this->_depth[$this->get_parser_id($parser)]]]) &&
+                               $this->_item[$this->_tags[$this->_depth[$this->get_parser_id($parser)]]]) {
                                        $this->_item[$this->_tags[$this->_depth[$this->get_parser_id($parser)]]] .= $text;
                                } else {
                                        $this->_item[$this->_tags[$this->_depth[$this->get_parser_id($parser)]]] = $text;
                                }
                        } elseif (isset($this->_parse_mode) && $this->_parse_mode == 'channel') {
-                               if ( isset($this->_citem[$this->_ctags[$this->_cdepth[$this->get_parser_id($parser)]]]) ) {
+                               if (isset($this->_citem[$this->_ctags[$this->_cdepth[$this->get_parser_id($parser)]]])) {
                                        $this->_citem[$this->_ctags[$this->_cdepth[$this->get_parser_id($parser)]]] .= $text;
                                } else {
                                        $this->_citem[$this->_ctags[$this->_cdepth[$this->get_parser_id($parser)]]] = $text;
@@ -948,16 +954,15 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     array  $options
-        * @see          _display_opt
+        * @see       _display_opt
         */
-       function set_Options( $options = '' )
-       {
-               if(is_array( $options )) {
+       function set_Options ($options = NULL) {
+               if (is_array($options)) {
                        $this->_display_opt = $options;
-                       return true;
+                       return TRUE;
                } else {
                        unset($this->_display_opt);
-                       return false;
+                       return FALSE;
                }
        }
 
@@ -967,12 +972,11 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     int  $width  attribute width in tag <table>
-        * @see          _table_width
+        * @see       _table_width
         */
-       function set_table_width( $width = 400 )
-       {
+       function set_table_width ($width = 400) {
                $this->_table_width = $width;
-               return true;
+               return TRUE;
        }
 
        /**
@@ -984,15 +988,15 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @return    array  $options
-        * @see          _display_opt
+        * @see       _display_opt
         */
-       function get_Options() {
+       function get_Options () {
                $options = array(
-                       'image'        => "If 'image' is set to \"hidden\" no image provided by the RDF Publisher will be displayed.",
-                       'channel'      => "If 'channel' is set to \"hidden\" the Channel Meta Data (i.e the Title and the short description regarding the RDF Publisher will not be displayed",
-                       'textinput'    => "If set to \"hidden\" no Input Form will be displayed",
-                       'build'        => "If set to \"hidden\" the Build Date (if provided) of the RDF File will not be displayed",
-                       'cache_update' => "If set to \"hidden\" the Update Date/Time of the cached Rdf File will not be displayed"
+                       'image'        => "If &#39;image&#39; is set to &quot;hidden&quot; no image provided by the RDF Publisher will be displayed.",
+                       'channel'      => "If &#39;channel&#39; is set to &quot;hidden&quot; the Channel Meta Data (i.e the Title and the short description regarding the RDF Publisher will not be displayed",
+                       'textinput'    => "If set to &quot;hidden&quot; no Input Form will be displayed",
+                       'build'        => "If set to &quot;hidden&quot; the Build Date (if provided) of the RDF File will not be displayed",
+                       'cache_update' => "If set to &quot;hidden&quot; the Update Date/Time of the cached Rdf File will not be displayed"
                );
                return $options;
        }
@@ -1004,58 +1008,69 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
         * @return    string XML Presentation of parsed RDF File
-        * @see          _cached_file, _remote_file, _cache_dir, _refresh, _update_cache()
+        * @see       _cached_file, _remote_file, _cache_dir, _refresh, _update_cache()
         */
-       function cache()
-       {
+       function cache () {
                // checks if the cache directory already exists
                // if not, the cache directory will be created
-               if(!$this->_cache_dir_ok) {
+               if (!$this->_cache_dir_ok) {
                        $this->_create_cache_dir();
                }
-               if($this->_use_dynamic_display == true) {
-                       $this->_cached_file = md5('dynamic'.$this->salt.$this->_remote_file) . '.cache';
+
+               if ($this->_use_dynamic_display == TRUE) {
+                       $this->_cached_file = md5('dynamic' . $this->salt.$this->_remote_file) . '.rss';
                        $this->_cache_type = 'normal';
                } else {
-                       $this->_cached_file = md5($this->salt.$this->_remote_file) . '.cache';
+                       $this->_cached_file = md5($this->salt . $this->_remote_file) . '.rss';
                        $this->_cache_type = 'fast';
                }
 
                $_cache_f = $this->_cache_dir.$this->_cached_file;
 
-               if ( (!file_exists($_cache_f)) || (filemtime($_cache_f) < $this->_refresh) || (filesize($_cache_f) == '0')) {
+               if ((!file_exists($_cache_f)) || (filemtime($_cache_f) < $this->_refresh) || (filesize($_cache_f) == 0)) {
                        // We have to parse the remote file
-                       $this->_use_cached_file = false;
+                       $this->_use_cached_file = FALSE;
                        // --> we want to provide proper Information for Use in
                        // get_cache_update_time()
                        clearstatcache();
-                       if($this->_use_dynamic_display == true) {
-                               $_rdf = @implode(' ', $this->_rdf_data()); // -> proxy
-                               if(!$_rdf) {
-                                       $this->_throw_exception( $this->_remote_file.' is not available' );
+                       if ($this->_use_dynamic_display == TRUE) {
+                               $_rdf = implode(' ', $this->_rdf_data()); // -> proxy
+                               if (!$_rdf) {
+                                       $this->_throw_exception($this->_remote_file.' is not available');
                                }
-                               $this->_parse_xRDF( $_rdf );
-                               $this->_update_cache( $_rdf );
+                               $this->_parse_xRDF($_rdf);
+                               $this->_update_cache($_rdf);
                                $data = $this->_output;
                        } else {
-                               $_rdf = @implode(' ', $this->_rdf_data()); // -> proxy
-                               if(!$_rdf) {
-                                       $this->_throw_exception( $this->_remote_file.' is not available' );
+                               $_rdf = implode(' ', $this->_rdf_data()); // -> proxy
+                               if (!$_rdf) {
+                                       $this->_throw_exception($this->_remote_file.' is not available');
                                }
-                               $this->_parse_xRDF( $_rdf );
-                               $this->_update_cache( $this->_output );
+                               $this->_parse_xRDF($_rdf);
+                               $this->_update_cache($this->_output);
                                $data = $this->_output;
                        }
+               } elseif (defined('__SECURITY') && function_exists('readFromFile')) {
+                       // Use readFromFile() from mailer project
+                       $this->_use_cached_file = TRUE;
+                       if ($this->_use_dynamic_display == TRUE) {
+                               $this->_parse_xRDF(readFromFile($_cache_f));
+                               $data = $this->_output;
+                       } else {
+                               $data = readFromFile($_cache_f);
+                       }
                } else {
                        // we can use the cached file
-                       $this->_use_cached_file = true;
-                       if($this->_use_dynamic_display == true) {
-                               $this->_parse_xRDF( implode(' ', file($_cache_f)) );
+                       $this->_use_cached_file = TRUE;
+                       if ($this->_use_dynamic_display == TRUE) {
+                               $this->_parse_xRDF(implode(' ', file($_cache_f)));
                                $data = $this->_output;
                        } else {
-                               $data = @implode(' ', file($_cache_f));
+                               $data = implode(' ', file($_cache_f));
                        }
                }
+
+               // Return trimmed data
                return trim($data);
        }   // END cache()
 
@@ -1065,35 +1080,34 @@ class fase4_rdf {
         * @access    private
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $dir Path to Directory.
-        * @return       boolean
-        * @see          _cache_dir, _cache_dir_ok
+        * @return    boolean
+        * @see       _cache_dir, _cache_dir_ok
         */
        function _create_cache_dir()
        {
                $path = '';
-               if(!@is_dir($this->_cache_dir)) {
+               if (!is_dir($this->_cache_dir)) {
                        $arr = explode('/', $this->_cache_dir);
                        $c = count($arr);
-                       if($arr[0]=='') {
+                       if ($arr[0] == '') {
                                $path = '/';
                        }
-                       for($i = '0';$i<$c;$i++)
-                       {
-                               if($arr[$i]!='') {
+                       for($i = '0';$i<$c;$i++) {
+                               if ($arr[$i]!='') {
                                        $path .= $arr[$i].'/';
-                                       if(!@is_dir($path)) {
-                                               if(!@mkdir($path, 0777)) {
+                                       if (!is_dir($path)) {
+                                               if (!mkdir($path, 0777)) {
                                                        $this->_throw_exception("failed to create directory:<b>".$this->_cache_dir."</b>.<br /><br />Exception on Line: ".__LINE__);
-                                                       return false;
+                                                       return FALSE;
                                                }
                                        }
                                }
                        }
-                       $this->_cache_dir_ok = true;
-                       return true;
+                       $this->_cache_dir_ok = TRUE;
+                       return TRUE;
                } else {
-                       $this->_cache_dir_ok = true;
-                       return true;
+                       $this->_cache_dir_ok = TRUE;
+                       return TRUE;
                }
        }   // END _create_cache_dir()
 
@@ -1103,22 +1117,28 @@ class fase4_rdf {
         * @access    private
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @see          _cache_dir, _cached_file, _throw_exception()
+        * @see       _cache_dir, _cached_file, _throw_exception()
         */
-       function _update_cache( $content = '' )
-       {
-               $_local = @fopen( $this->_cache_dir.$this->_cached_file, 'w' );
-               if(!$_local) {
-                       $this->_throw_exception( 'Cannot open '.$this->_cached_file.'<br /><br />Exception at Line: '.__LINE__ );
-                       return false;
+       function _update_cache ($content = '') {
+               if (defined('__SECURITY') && function_exists('writeToFile')) {
+                       // Use mailer-project function
+                       return writeToFile($this->_cache_dir.$this->_cached_file, $content);
                }
-               if (fwrite( $_local, $content) === false) {
-                       $this->_throw_exception( 'Cannot write to '.$this->_cached_file.'<br /<br />Exeception at Line: '.__LINE__);
-                       return false;
+
+               $_local = @fopen($this->_cache_dir.$this->_cached_file, 'w');
+               if (!$_local) {
+                       $this->_throw_exception('Cannot open '.$this->_cached_file.'<br /><br />Exception at Line: '.__LINE__);
+                       return FALSE;
                }
-               fclose( $_local );
-               @chmod( $this->_cache_dir.$this->_cached_file, 0666);
-               return true;
+
+               if (fwrite($_local, $content) === FALSE) {
+                       $this->_throw_exception('Cannot write to '.$this->_cached_file.'<br /<br />Exeception at Line: '.__LINE__);
+                       return FALSE;
+               }
+
+               fclose($_local);
+               @chmod($this->_cache_dir.$this->_cached_file, 0666);
+               return TRUE;
        }   // END _update_cache()
 
        /**
@@ -1126,11 +1146,10 @@ class fase4_rdf {
         *
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
-        * @return       string Date/Time of last Update
-        * @see          _cache_dir, _cached_file
+        * @return    string Date/Time of last Update
+        * @see       _cache_dir, _cached_file
         */
-       function get_cache_update_time()
-       {
+       function get_cache_update_time () {
                return (file_exists($this->_cache_dir.$this->_cached_file))?date('d.m.Y H:i:s', filemtime($this->_cache_dir.$this->_cached_file)):'Cachemiss';
        }   // END get_cache_update_time()
 
@@ -1140,11 +1159,10 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @return    string Displays RDF Content ( using _display() )
-        * @see          _remote_file, cache()
+        * @return    string Displays RDF Content (using _display())
+        * @see       _remote_file, cache()
         */
-       function get_CacheType()
-       {
+       function get_CacheType() {
                return $this->_cache_type;
        }
 
@@ -1154,10 +1172,9 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @return    array  $options
-        * @see          _use_cached_file
+        * @see       _use_cached_file
         */
-       function is_cachedFile()
-       {
+       function is_cachedFile () {
                return $this->_use_cached_file;
        }
 
@@ -1170,22 +1187,24 @@ class fase4_rdf {
         *
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
-        * @see          _cache_dir
+        * @see       _cache_dir
         */
-       function clear_cache()
-       {
+       function clear_cache () {
                $dir = dir($this->_cache_dir);
-               while($file=$dir->read()) {
+               while($file = $dir->read()) {
                        // Exclude directories
-                       if (is_file($dir->path.$file) && substr($file, -6, 6) != '.cache' && substr($file, -4, 4) != '.log')  {
-                               if(!@unlink($dir->path.$file)) {
-                                       $this->_throw_exception("Unable to unlink ".$dir->path.$file."<br />\n<br />\nException at Line: ".__LINE__ );
-                                       return false;
+                       if (is_file($dir->path . $file) && substr($file, -4, 4) == '.rss')  {
+                               if ((defined('__SECURITY') && function_exists('removeFile')) && (!removeFile($dir->path . $file))) {
+                                       $this->_throw_exception("removeFile() was unable to unlink ".$dir->path . $file."<br />\n<br />\nException at Line: ".__LINE__);
+                                       return FALSE;
+                               } elseif (!unlink($dir->path . $file)) {
+                                       $this->_throw_exception("Unable to unlink ".$dir->path . $file."<br />\n<br />\nException at Line: ".__LINE__);
+                                       return FALSE;
                                } // END - if
                        } // END - if
                } // END - while
                $dir->close();
-               return true;
+               return TRUE;
        }   // END clear_cache()
 
        /**
@@ -1196,10 +1215,10 @@ class fase4_rdf {
         * @param    int     $str_len length of the returned String (overall length including '... ')
         * @return   string  Cut String
         */
-       function _cut_string( $string, $str_len = '30' )
+       function _cut_string($string, $str_len = '30')
        {
-               if(strlen(trim($string))>$str_len) {
-                       $string = substr( trim($string) , 0, $str_len - 4);
+               if (strlen(trim($string))>$str_len) {
+                       $string = substr(trim($string) , 0, $str_len - 4);
                        $string .= ' ...';
                }
                return $string;
@@ -1210,16 +1229,22 @@ class fase4_rdf {
         *
         * @access    private
         * @author    Stefan Saasen <s@fase4.com>
-        * @see          _cache_dir, gc_probability, gc_maxlifetime
+        * @see       _cache_dir, gc_probability, gc_maxlifetime
         */
        function _garbage_collection()
        {
                srand((double) microtime() * 1000000);
                if (mt_rand(1, 100) <= $this->gc_probability) {
                        $dir = dir($this->_cache_dir);
-                       while($file=$dir->read()) {
-                               if (is_file($dir->path.$file) && substr($file, -6, 6) != '.cache' && substr($file, -4, 4) != '.log' && filemtime($dir->path.$file) <= time() - $this->_refresh )  {
-                                       @unlink($dir->path.$file);
+                       while($file = $dir->read()) {
+                               if ((is_file($dir->path . $file)) && (substr($file, -4, 4) == '.rss') && (filemtime($dir->path . $file) <= time() - $this->_refresh))  {
+                                       if (defined('__SECURITY') && function_exists('removeFile')) {
+                                               // Use mailer-project's function
+                                               removeFile($dir->path . $file);
+                                       } else {
+                                               // Use PHP's function
+                                               unlink($dir->path . $file);
+                                       }
                                } // END - if
                        }
                        $dir->close();
@@ -1238,7 +1263,7 @@ class fase4_rdf {
         */
        function set_proxy($phost, $pport)
        {
-               $this->_use_proxy = true;
+               $this->_use_proxy = TRUE;
 
                if ($phost != '')
                $this->_phost = $phost;
@@ -1255,9 +1280,9 @@ class fase4_rdf {
         * @param     string $ppaswd Password
         * @author    Marco Kraus <marco.kraus@siemens.com>
         */
-       function set_proxy_auth( $pname, $ppasswd )
+       function set_proxy_auth($pname, $ppasswd)
        {
-               $this->_use_proxy_auth = true;
+               $this->_use_proxy_auth = TRUE;
 
                if ($pname != '')
                $this->_pname = $pname;
@@ -1275,20 +1300,25 @@ class fase4_rdf {
         *
         * @access    private
         * @author    Marco Kraus <Marco.Kraus@siemens.com>
-        * @return array
-        * @see _use_proxy, cache()
-        */
-       function _rdf_data()
-       {
-               if ( $this->_use_proxy == true )
-               {
+        * @return     array
+        * @see       _use_proxy, cache()
+        */
+       function _rdf_data () {
+               // Init output
+               $output = array();
+
+               // Use mailer-project's function or own code?
+               if (defined('__SECURITY') && function_exists('sendHttpGetRequest')) {
+                       // Use mailer-project instead (see http://mxchange.org)
+                       $output = sendHttpGetRequest($this->_remote_file, array(), TRUE);
+               } elseif ($this->_use_proxy == TRUE) {
                        // we need a raw socket here to connect to proxy
                        $fp = fsockopen($this->_phost,$this->_pport);
 
                        if (!$fp) {
-                               $this->_throw_exception( $this->_remote_file.' is not available with proxy' );
+                               $this->_throw_exception($this->_remote_file.' is not available with proxy');
                        } else {
-                               if ( $this->_use_proxy_auth == true ) {
+                               if ($this->_use_proxy_auth == TRUE) {
                                        fputs($fp, "GET ".$this->_remote_file." HTTP/1.0\r\nUser-Agent: Fase4 RDF-Reader/1.40 modified by Quix0r\r\n\r\n");
                                } else {
                                        fputs($fp, "GET ".$this->_remote_file." HTTP/1.0\r\nUser-Agent: Fase4 RDF-Reader/1.40 modified by Quix0r\r\nProxy-Authorization: Basic ".base64_encode("$this->_pname:$this->_ppasswd") ."\r\n\r\n");
@@ -1296,37 +1326,37 @@ class fase4_rdf {
                        }
 
 
-                       for ( $i = '0'; !feof ($fp) ; $i++)
+                       for ($i = '0'; !feof ($fp) ; $i++)
                        {
-                               $usable_data[$i] = "";
+                               $usable_data[$i] = '';
                                $usable_data[$i] = fgets($fp,4096);
 
                                // PARSE HEADER ---- first line has to be <?xml, second rdf or rss, and third is blank
 
                                // strstr did not fit (ask Rasmus why), so we compare each character
-                               if ( ($usable_data[$i][0] == '<' ) &&
-                               ($usable_data[$i][1] == '?' ) &&
-                               ($usable_data[$i][2] == 'x' ) &&
-                               ($usable_data[$i][3] == 'm' ) &&
-                               ($usable_data[$i][4] == 'l' ) ) {
+                               if (($usable_data[$i][0] == '<') &&
+                               ($usable_data[$i][1] == '?') &&
+                               ($usable_data[$i][2] == 'x') &&
+                               ($usable_data[$i][3] == 'm') &&
+                               ($usable_data[$i][4] == 'l')) {
                                        $usable_data[0] = $usable_data[$i]; // save current field
                                        $i = 1; // just reset array to start
                                }
 
                                // there seems to be proxystuff after the <?xml....we delete this
-                               if ( (
-                               ($usable_data[$i][0] == '<' ) &&
-                               ($usable_data[$i][1] == 'r' ) &&
-                               ($usable_data[$i][2] == 'd' ) &&
-                               ($usable_data[$i][3] == 'f' ) &&
-                               ($usable_data[$i][4] == ':' )
+                               if ((
+                               ($usable_data[$i][0] == '<') &&
+                               ($usable_data[$i][1] == 'r') &&
+                               ($usable_data[$i][2] == 'd') &&
+                               ($usable_data[$i][3] == 'f') &&
+                               ($usable_data[$i][4] == ':')
                                )
                                ||
                                (
-                               ($usable_data[$i][0] == '<' ) &&
-                               ($usable_data[$i][1] == 'r' ) &&
-                               ($usable_data[$i][2] == 's' ) &&
-                               ($usable_data[$i][3] == 's' )
+                               ($usable_data[$i][0] == '<') &&
+                               ($usable_data[$i][1] == 'r') &&
+                               ($usable_data[$i][2] == 's') &&
+                               ($usable_data[$i][3] == 's')
                                )
                                ) {
 
@@ -1337,61 +1367,74 @@ class fase4_rdf {
                        }
 
                        fclose($fp);
-                       return $usable_data;
+                       $output = $usable_data;
                } else {
                        if (substr($this->_remote_file, 0, 7) != 'http://') {
-                               $this->_throw_exception( 'Cannot find http:// in '.$this->_remote_file.'!' );
-                               return '';
+                               $this->_throw_exception('Cannot find http:// in '.$this->_remote_file.'!');
+                               return array();
                        } else {
                                // Extract host information
                                $host = substr($this->_remote_file, 7);
+
                                // Extract the GET part
                                $get = '/';
                                if (strpos($host, '/') > 0) {
                                        $get = substr($host, strpos($host, '/'));
                                        $host = substr($host, 0, strpos($host, '/'));
-                               }
+                               } // END - if
+
                                // Extract port
                                $port = '80';
                                if (strpos($host, ':') > 0) {
                                        $port = substr($host, (strpos($host, ':') + 1));
                                        $host = substr($host, 0, (strpos($host, ':') - 1));
-                               }
+                               } // END - if
 
                                // Start connection to server
                                $fp = fsockopen($host, $port);
                                if (!$fp) {
-                                       $this->_throw_exception( $this->_remote_file.' is maybe not available.' );
-                         return '';
-                               }
+                                       $this->_throw_exception($this->_remote_file.' is maybe not available.');
+                                       return array();
+                               } // END - if
+
                                // Repare request line
                                $request = sprintf("GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: Fase4 RDF-Reader/1.40 modified by Quix0r\r\n\r\n", $get, $host);
+
                                // Send request out
                                fputs($fp, $request);
-                               $reply = ''; $isContent = false; $dummy = '';
+                               $reply = ''; $isContent = FALSE; $dummy = '';
+
                                // Read reply
                                $i=0;
-                               while ( !feof($fp) ) {
+                               while (!feof($fp)) {
                                        $read = trim(fgets($fp, 4096));
                                        if (substr($read, 0, 5) == '<?xml' || $isContent) {
                                                // Add content
                                                $reply[] = $read;
-                                               $isContent = true;
+                                               $isContent = TRUE;
                                        } else {
                                                // Put in dummy
                                                $dummy[] = $read;
                                        }
+
                                        $i++;
-                               }
-                               if ((count($dummy) > 0) && (count($reply) == '0') && (!$isContent)) {
+                               } // END - while
+
+                               if ((count($dummy) > 0) && (count($reply) == 0) && (!$isContent)) {
                                        // Transfer content from dummy
                                        $reply = $content;
-                               }
+                               } // END - if
+
                                fclose($fp);
                                //die(htmlentities($reply));
-                               return $reply;
+                               $output = $reply;
                        }
                }
-       }    // END _rdf_data()
-}   // END class
+
+               // Exit here
+               return $output;
+       } // END _rdf_data()
+} // END class
+
+// [EOF]
 ?>