]> git.mxchange.org Git - mailer.git/commitdiff
Cleanups + optional binding to mailer functions
authorRoland Häder <roland@mxchange.org>
Thu, 3 Jan 2013 04:23:02 +0000 (04:23 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 3 Jan 2013 04:23:02 +0000 (04:23 +0000)
inc/classes/rdf.class.php

index 296e7d592e5338cc39349c6b3dcb51fd9c88896c..d3d0f4529507feb6b63b9276709bf5c8a3ffb309 100644 (file)
@@ -163,7 +163,7 @@ class fase4_rdf {
        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
@@ -311,7 +311,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.
@@ -335,7 +335,7 @@ class fase4_rdf {
         * @access private
         * @var    array
         */
-       var $_tags = array( 'x' );  // Array
+       var $_tags = array('x');  // Array
 
        /**
         * Garbage collection: probability in percent
@@ -388,10 +388,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() )
+        * @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;
@@ -410,7 +410,7 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @return    string Displays RDF Content ( using _display() )
+        * @return    string Displays RDF Content (using _display())
         * @see          _remote_file, cache()
         */
        function finish($return = FALSE) {
@@ -429,17 +429,17 @@ 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() )
+        * @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;
        }
@@ -452,7 +452,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);
@@ -477,12 +477,12 @@ class fase4_rdf {
         * @return    boolean
         * @see       _refresh
         */
-       function set_refresh( $seconds ) {
+       function set_refresh($seconds) {
                $this->_refresh = (time() - $seconds);
                return TRUE;
        }
 
-       function set_salt( $saltPara ) {
+       function set_salt($saltPara) {
                $this->salt = $saltPara;
                return TRUE;
        }
@@ -496,7 +496,7 @@ class fase4_rdf {
         * @return       boolean
         * @see          _max_count, _endElement()
         */
-       function set_max_item( $int )
+       function set_max_item($int)
        {
                $this->_max_count = $int;
                return TRUE;
@@ -511,9 +511,9 @@ class fase4_rdf {
         * @return       boolean
         * @see          _cache_dir
         */
-       function set_CacheDir( $dir )
+       function set_CacheDir($dir)
        {
-               if(substr($dir, -1) != '/') {
+               if (substr($dir, -1) != '/') {
                        $dir = $dir.'/';
                }
                $this->_cache_dir = $dir;
@@ -526,7 +526,7 @@ 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;
@@ -539,7 +539,7 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @see       _item
         */
-       function _clear_Items( ) {
+       function _clear_Items() {
                $this->_item = array(
                        'title'         => '',
                        'link'          => '',
@@ -559,7 +559,7 @@ class fase4_rdf {
         * @author    Stefan Saasen <s@fase4.com>
         * @see       _item
         */
-       function _clear_cItems( ) {
+       function _clear_cItems() {
                $this->_citem = array(
                        'title'          => '',
                        'link'           => '',
@@ -598,32 +598,32 @@ class fase4_rdf {
         */
        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,7 +638,7 @@ class fase4_rdf {
         * @param     mixed  $parser a reference to the XML parser calling the handler.
         * @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'])))
@@ -646,7 +646,7 @@ class fase4_rdf {
                        $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";
@@ -654,14 +654,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";
@@ -695,9 +695,9 @@ class fase4_rdf {
                }
                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))
@@ -719,7 +719,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
@@ -727,7 +727,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";
                                        }
 
@@ -743,12 +743,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";
@@ -760,28 +760,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";
@@ -797,10 +797,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."\" "; }
+                                       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";
@@ -815,7 +815,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();
                                }
 
@@ -831,7 +831,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_channel
         */
-       function get_array_channel( )
+       function get_array_channel()
        {
                return $this->_array_channel;
        }
@@ -844,7 +844,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_item
         */
-       function get_array_item( )
+       function get_array_item()
        {
                return $this->_array_item;
        }
@@ -857,7 +857,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_textinput
         */
-       function get_array_textinput( )
+       function get_array_textinput()
        {
                return $this->_array_textinput;
        }
@@ -891,7 +891,7 @@ class fase4_rdf {
         * @return    array
         * @see       _array_image
         */
-       function get_array_image( )
+       function get_array_image()
        {
                return $this->_array_image;
        }
@@ -922,15 +922,15 @@ class fase4_rdf {
                $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)]]] ) {
+                       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,9 +948,9 @@ class fase4_rdf {
         * @param     array  $options
         * @see          _display_opt
         */
-       function set_Options( $options = '' )
+       function set_Options($options = '')
        {
-               if(is_array( $options )) {
+               if (is_array($options)) {
                        $this->_display_opt = $options;
                        return TRUE;
                } else {
@@ -967,7 +967,7 @@ class fase4_rdf {
         * @param     int  $width  attribute width in tag <table>
         * @see          _table_width
         */
-       function set_table_width( $width = 400 )
+       function set_table_width($width = 400)
        {
                $this->_table_width = $width;
                return TRUE;
@@ -1008,10 +1008,10 @@ class fase4_rdf {
        {
                // 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) {
+               if ($this->_use_dynamic_display == TRUE) {
                        $this->_cached_file = md5('dynamic'.$this->salt.$this->_remote_file) . '.cache';
                        $this->_cache_type = 'normal';
                } else {
@@ -1021,34 +1021,43 @@ class fase4_rdf {
 
                $_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;
                        // --> we want to provide proper Information for Use in
                        // get_cache_update_time()
                        clearstatcache();
-                       if($this->_use_dynamic_display == TRUE) {
+                       if ($this->_use_dynamic_display == TRUE) {
                                $_rdf = implode(' ', $this->_rdf_data()); // -> proxy
-                               if(!$_rdf) {
-                                       $this->_throw_exception( $this->_remote_file.' is not available' );
+                               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' );
+                               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)) );
+                       if ($this->_use_dynamic_display == TRUE) {
+                               $this->_parse_xRDF(implode(' ', file($_cache_f)));
                                $data = $this->_output;
                        } else {
                                $data = implode(' ', file($_cache_f));
@@ -1069,17 +1078,17 @@ class fase4_rdf {
        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]!='') {
+                               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;
                                                }
@@ -1102,19 +1111,23 @@ class fase4_rdf {
         * @param     string $rdf    RDF File (Location)
         * @see          _cache_dir, _cached_file, _throw_exception()
         */
-       function _update_cache( $content = '' )
+       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__ );
+               if (defined('__SECURITY') && function_exists('writeToFile')) {
+                       // Use mailer-project function
+                       return writeToFile($this->_cache_dir.$this->_cached_file, $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;
                }
-               if (fwrite( $_local, $content) === FALSE) {
-                       $this->_throw_exception( 'Cannot write to '.$this->_cached_file.'<br /<br />Exeception at Line: '.__LINE__);
+               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);
+               fclose($_local);
+               @chmod($this->_cache_dir.$this->_cached_file, 0666);
                return TRUE;
        }   // END _update_cache()
 
@@ -1137,7 +1150,7 @@ class fase4_rdf {
         * @access    public
         * @author    Stefan Saasen <s@fase4.com>
         * @param     string $rdf    RDF File (Location)
-        * @return    string Displays RDF Content ( using _display() )
+        * @return    string Displays RDF Content (using _display())
         * @see          _remote_file, cache()
         */
        function get_CacheType()
@@ -1175,8 +1188,11 @@ class fase4_rdf {
                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__ );
+                               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
@@ -1193,10 +1209,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;
@@ -1215,7 +1231,7 @@ class fase4_rdf {
                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 )  {
+                               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);
                                } // END - if
                        }
@@ -1252,7 +1268,7 @@ 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;
 
@@ -1277,15 +1293,17 @@ class fase4_rdf {
         */
        function _rdf_data()
        {
-               if ( $this->_use_proxy == TRUE )
-               {
+               if (defined('__SECURITY') && function_exists('sendGetRequest')) {
+                       // Use mailer-project instead (see http://mxchange.org)
+                       $useable_data = sendGetRequest($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");
@@ -1293,7 +1311,7 @@ class fase4_rdf {
                        }
 
 
-                       for ( $i = '0'; !feof ($fp) ; $i++)
+                       for ($i = '0'; !feof ($fp) ; $i++)
                        {
                                $usable_data[$i] = "";
                                $usable_data[$i] = fgets($fp,4096);
@@ -1301,29 +1319,29 @@ class fase4_rdf {
                                // 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,7 +1355,7 @@ class fase4_rdf {
                        return $usable_data;
                } else {
                        if (substr($this->_remote_file, 0, 7) != 'http://') {
-                               $this->_throw_exception( 'Cannot find http:// in '.$this->_remote_file.'!' );
+                               $this->_throw_exception('Cannot find http:// in '.$this->_remote_file.'!');
                                return '';
                        } else {
                                // Extract host information
@@ -1358,8 +1376,8 @@ class fase4_rdf {
                                // 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 '';
                                }
                                // 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);
@@ -1368,7 +1386,7 @@ class fase4_rdf {
                                $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