-//
-// +----------------------------------------------------------------------+
-// | 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 |
+ * +----------------------------------------------------------------------+
+ */
* @copyright Copyright (c) 2001 fase4.com. All rights reserved.
* @author Stefan Saasen <s@fase4.com>
* @author Roland Haeder <webmaster@mxchange.org>
* @copyright Copyright (c) 2001 fase4.com. All rights reserved.
* @author Stefan Saasen <s@fase4.com>
* @author Roland Haeder <webmaster@mxchange.org>
- if (!$return) {
- echo $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);
* @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).
* @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
* @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.
* @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
* @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.
* @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
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)]]]) {
- '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 '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"
// checks if the cache directory already exists
// if not, the cache directory will be created
if (!$this->_cache_dir_ok) {
$this->_create_cache_dir();
}
// checks if the cache directory already exists
// if not, the cache directory will be created
if (!$this->_cache_dir_ok) {
$this->_create_cache_dir();
}
if (defined('__SECURITY') && function_exists('writeToFile')) {
// Use mailer-project function
return writeToFile($this->_cache_dir.$this->_cached_file, $content);
}
if (defined('__SECURITY') && function_exists('writeToFile')) {
// Use mailer-project function
return writeToFile($this->_cache_dir.$this->_cached_file, $content);
}
- if (is_file($dir->path.$file) && substr($file, -6, 6) != '.cache' && substr($file, -4, 4) != '.log') {
- 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__);
+ 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__);
*/
function _garbage_collection()
{
srand((double) microtime() * 1000000);
if (mt_rand(1, 100) <= $this->gc_probability) {
$dir = dir($this->_cache_dir);
*/
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);
+ }
} elseif ($this->_use_proxy == TRUE) {
// we need a raw socket here to connect to proxy
$fp = fsockopen($this->_phost,$this->_pport);
} elseif ($this->_use_proxy == TRUE) {
// we need a raw socket here to connect to proxy
$fp = fsockopen($this->_phost,$this->_pport);
$usable_data[$i] = fgets($fp,4096);
// PARSE HEADER ---- first line has to be <?xml, second rdf or rss, and third is blank
$usable_data[$i] = fgets($fp,4096);
// PARSE HEADER ---- first line has to be <?xml, second rdf or rss, and third is blank
// Extract the GET part
$get = '/';
if (strpos($host, '/') > 0) {
$get = substr($host, strpos($host, '/'));
$host = substr($host, 0, strpos($host, '/'));
// Extract the GET part
$get = '/';
if (strpos($host, '/') > 0) {
$get = substr($host, strpos($host, '/'));
$host = substr($host, 0, strpos($host, '/'));
// Extract port
$port = '80';
if (strpos($host, ':') > 0) {
$port = substr($host, (strpos($host, ':') + 1));
$host = substr($host, 0, (strpos($host, ':') - 1));
// Extract port
$port = '80';
if (strpos($host, ':') > 0) {
$port = substr($host, (strpos($host, ':') + 1));
$host = substr($host, 0, (strpos($host, ':') - 1));
// Start connection to server
$fp = fsockopen($host, $port);
if (!$fp) {
$this->_throw_exception($this->_remote_file.' is maybe not available.');
// Start connection to server
$fp = fsockopen($host, $port);
if (!$fp) {
$this->_throw_exception($this->_remote_file.' is maybe not available.');