⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rdf.class.php

📁 基于Fase 4 RDF/RSS语法分析器
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php/* $Id: rdf.class.php,v 1.43 2002/02/06 19:44:58 sts Exp $ *///// +----------------------------------------------------------------------+// | 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>                                |// +----------------------------------------------------------------------+// | Ref:                                                                 |// |   @link http://www.fase4.com/rdf/                   Latest release   |// +----------------------------------------------------------------------+/*** Class RSS Parser** This class offers methods to parse RSS Files** @link      http://www.fase4.com/rdf/ Latest release of this class* @package   rss* @copyright Copyright (c) 2001 fase4.com. All rights reserved.* @author    Stefan Saasen <s@fase4.com>* @version   1.6 ($Date: 2002/02/06 19:44:58 $) $Revision: 1.43 $* @access    public*/class fase4_rdf {    /**    * If $_link_target is set a target='xxx' attribute in each <a /> and <form /> html tag will be added    *    * Possible values are "_blank", "_content", "_parent", "_self", "_top"    *    * @access private    * @var    string    */	    var $_link_target = "_blank";    /**    * vars for proxy settings - Prox Host    *    * @access private    * @var      string    */    var $_phost = "";        /**    * vars for proxy settings - Prox Port    *    * @access private    * @var      string    */        var $_pport = "";        /**    * vars for proxy settings - Prox Username    *    * @access private    * @var      string    */        var $_pname = "";        /**    * vars for proxy settings - Prox Password    *    * @access private    * @var      string    */        var $_ppasswd = "";    /**    * just a flag for checking if proxy-support should be enabled    * set default to false (will be enabled if set_proxy is called)    *    * @access   private    * @see      set_proxy()    * @var      bool    */    var $_use_proxy = false;        /**    * just a flag for checking if proxy-support with authentication    * should be enabled    * set default to false (will be enabled if set_proxy is called)    *    * @access   private    * @see      set_proxy()    * @var      boolean    */        var $_use_proxy_auth = false;    /**    * The time the Files will be cached (in seconds).    *    * @access private    * @var    int    */	    var $_refresh = 0;   // int        /**    * The Name of the cached File.    *    * @access private    * @var    string    */	        var $_cached_file = "";   // String        /**    * Indicates whether the cached or the remote file was used.    *    * @access private    * @var    boolean    */	        var $_use_cached_file = false;        /**    * (fast|normal) depends on _use_dynamic_display(). _use_dynamic_display( TRUE ) -> 'normal', otherwise 'fast'    *    * @access private    * @var    string    */	            var $_cache_type = "";        /**    * The Name of the Remote File.    *    * @access private    * @var    string    */	            var $_remote_file = "";        /**    * Path to the Cache Directory.    *    * @access private    * @var    string    */    var $_cache_dir = "cache/";  // String        /**    * Indicates whether the Creating of the Cache Directory needs to be done or not.    *    * @access private    * @var    boolean    */    var $_cache_dir_ok = false;        /**    * Type of the file to be parsed (RSS or RDF).    *    * The Type depends on the root node    *    * @access private    * @var    string    */    var $_type = ""; // string (rss or rdf)        /**    * Array of Display Settings.    *    * Specific Parameters can be set to hidden. These are:     * image, channel and textinput. If set to "hidden" those elements won't be displayed.    *    * @access private    * @var    array    */    var $_display_opt = array();  // Array    /**    * Defines the width attribute in the table that holds the rdf/rss representation    *    * @access private    * @var    int    * @see    see_table_width()    */        var $_table_width = 400;        /**    * Indicates whether or not to use dynamic Display Settings    *    * @access private    * @var    array    */    var $_use_dynamic_display = false;        /**    * <item> count    *    * @access private    * @var    int    */    var $_item_count = 0;        /**    * No of max <item>s    *    * @access private    * @var    boolean    */    var $_max_count = false;        /**    * Array containing the content of <channel />    *    * @access private    * @var    array    */        var $_array_channel = array();        /**    * Array containing the content of each <item />    *    * @access private    * @var    array    */    var $_array_item = array();        /**    * Array containing the content of <textinput />    *    * @access private    * @var    array    */        var $_array_textinput = array();        /**    * Array containing the content of <image />    *    * @access private    * @var    array    */            var $_array_image = array();        /**    * Array containing the Channel content. Just For internal XML Parser Purposes.    *    * @access private    * @var    array    */        var $_citem = array();        /**    * Array containing the Channel Parser Depth. Just For internal XML Parser Purposes.    *    * @access private    * @var    array    */            var $_cdepth = array();        /**    * Array containing the Channel tags. Just For internal XML Parser Purposes.    *    * @access private    * @var    array    */            var $_ctags = array( "x" );         /**    * Array containing the Channel content. Just For internal XML Parser Purposes.    *    * @access private    * @var    array    */    var $_item = array();   // Array        /**    * Array containing the Channel Parser Depth. Just For internal XML Parser Purposes.    *    * @access private    * @var    array    */                var $_depth = array();  // Array        /**    * Array containing the tags. Just For internal XML Parser Purposes.    *    * @access private    * @var    array    */                var $_tags = array( "x" );  // Array    /**    * Garbage collection: probability in percent    *    * @var      integer     0 => never    * @access   public    */    var $gc_probability = 1;    /**    * HTML Output    *    * @var      string    * @access   private    */    var $_output = "";            /**    * Constructor of our Class    *    * This Method checks if the Cache Directory can be found. Otherwise it tries to creat the Cache Directory at the specified Path.    * Additionally the Refresh Time is set to a default Value of 1200s (20 min).	*    * @access    public	* @author    Stefan Saasen <s@fase4.com>	* @see		 _refresh    */    function fase4_rdf()    {        // default Value, to be overwritten in set_refresh()        $this->_refresh = (time() - 1200);    }    /**    * This Method starts the parsing of the specified RDF File. The File can be a local or a remote File.    *    * @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()    */    function parse_RDF( $rdf )     {         unset($this->_array_item);        $this->_remote_file = $rdf;        echo "<!-- http://www.fase4.com/rdf/ -->\n";        echo "<table width=\"".$this->_table_width."\">\n";                echo $this->cache();        echo "</table>\n";        unset($this->_output);        $this->_item_count = 0;        return true;    }    /**    * This Method is called when all parsing is finished to use the garbage collection    *    * @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()    */    function finish()     {         flush();        $this->_garbage_collection();    }            /**    * With this method you can decide whether to use the normal cache and dynamic display Options or to use a static cache.    *    * 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'    *    * @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()    */    function use_dynamic_display( $bool )    {        $this->_use_dynamic_display = $bool;        return true;    }    /**    * This Method avtually parses the XML data.    *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -