PHP Classes

File: safox/safox.cls.php

Recommend this page to a friend!
  Classes of Christian Hansel   SAFOX   safox/safox.cls.php   Download  
File: safox/safox.cls.php
Role: Class source
Content type: text/plain
Description: Wrapper Class for all SAFOX operations
Class: SAFOX
Parse, edit and generate XML documents
Author: By
Last change: latest version now includes RSS functionality and as of version 0.5 the SAFOX wrapper is the starting point for all SAFOX operations. It is an extreme light weight class that allows to create any of the SAFOX objects (XMLDoc, XMLParser, RSSDoc, RSSParser) without further include or require commands.
All necessary libraries of the SAFOX API will be loaded only when/if the file is required, thus making scripts lighter and faster.
Date: 18 years ago
Size: 6,806 bytes
 

Contents

Class file image Download
<?
/**
 * This is the SAFOX API Project Wrapper. The SAFOX package is a collection of light-weight API for object-oriented PHP to handle XML files.
 * As of version 0.5 the SAFOX wrapper is the starting point for all SAFOX operations. It is an extreme light weight class
 * that allows to create any of the SAFOX objects (XMLDoc, XMLParser, RSSDoc, RSSParser) without further include or require commands.
 * All necessary libraries of the SAFOX API will be loaded only when/if the file is required, thus making scripts lighter and faster.
 *
 * Providing three base classes, XMLDoc, XMLNode, XMLParser, and extended RSSDoc and RSSParser Classes for RSS 2.0 Handling,
 * the SAFOX package allows an easy and clean way to handle all kind of XML files. The SAFOX package is currently developed in PHP4.X
 * and copyright by Christian Hansel, cpi service, Leipzig. The code is provided under the GNU Public License Version 2 and may freely be used,
 * modified, and distributed with original copyright notices to be maintained.
 *
 * If no copy of the license is provided check {@link http://www.gnu.org/licenses/gpl2.txt}
 *
 * The SAFOX Package consists of five files:
 * <ul>
 * <li>safox.cls.php -- A OOP wrapper for all SAFOX objects which loads one or more of the following files only when required</li>
 * </ul>
 * <ul>
 * <li>safox_g.cls.php -- Provides the XMLDOc & XMLNODE Classes</li>
 * <li>safox_p.cls.php -- Provides a simple, light-weight, but strong Parser for XML Documents that returns a XMLDOC Object</li>
 * </ul>
 * The SAFOX_RSS sub package consists of two files but requires the SAFOX Base classes:
 * <ul>
 * <li>safox_g_rss.cls.php -- Provides the RSSDOc & RSSNODE Classes</li>
 * <li>safox_p_rss.cls.php -- Provides a simple, light-weight, but strong Parser for XML Documents that returns a XMLDOC Object</li>
 * </ul>
 *
 * This is the wrapper/main SAFOX library providing access to all SAFOX objects
 *
 * Changes History :
 * version 0.5
 * + The SAFOX library has been reorganised and now requires only one wrapper file (safox.cls.php)
 * + added subpackage SAFOX_RSS provides two classes RSSDoc and RSSParser for the generation and parsing of RSS 2.0
 * + added Feature: setEntityConversion is a function that specifies whether or not special characters in CDATA
 * should be converted into HT/XML-Entities (e.g. & into &amp;, ' into &apos; ...)
 * (true) or enclosed into CDATA tags (false)
 *
 * version 0.42
 * + BUGFIX 20051130-2 fixes a problem where comments containing tags caused the the parser to break
 *
 * version 0.41 of SAFOX package includes changes
 * + BUGFIX 20051130 Code Cleanup provided by Cristiano Degiorgis [cri@webprofessor.it]
 *
 * Changes History :
 * version 0.4 of SAFOX package includes changes
 * + BUGFIX 20051128 that fixes problems with removing nodes from the document
 * + remove, and delete methods added as aliases to destroy in XMLNode class
 * + method cleanUP added to XMLDoc class
 * + method cleanUP added to XMLNode class - see destription
 *
 * Changes History :
 * version 0.3 of SAFOX package includes changes
 * + BUGFIX 20051123 corrects a problem that was caused when a repeated call to setId of child Nodes was made
 * + addNodeAfter Method added to XMLDoc Class
 * + addNodeAfter Method added to XMLNode Class
 * + addNodeBefore Method added to XMLDoc Class
 * + addNodeBefore Method added to XMLNode Class
 *
 * version 0.2 of SAFOX package includes changes
 * + getchildNodeByTagName() Method added to XMLDOC
 * + writeToFile Method added to XMLDOC
 * + BUGFIX 20051117 in xmlParser - corrects a mishandling of <![CDATA[ .. ]]> enclosed tag content that
 * caused the parser to break when dealing with tags within the CDATA
 *
 * @author CVH, cpi-service ; cvh@cpi-service.com
 * @link http://www.cpi-service.com
 * @license GPL2 GNU General Public License (GPL) version 2
 * @package SAFOX
 * @version 0.5
 * @date 2006-02-07
 * @copyright (c) 2003-2006 CVH, cpi-service
 * @file safox.cls.php
 */
define('SAFOXVERSION',0.5);
/**
 * SAFOX a wrapper class for the SAFOX API
 * The SAFOX Wrapper allows to create all SAFOX objects but only binds/loads source file when considered necessary.
 * A single require / include line of code (include "safox.cls.php";) gives access to all source files and classes
 * @package SAFOX
 * @version 0.5
 * @author CVH
 */
class SAFOX {
   
/**
     * SAFOX constructor
     */
   
function SAFOX() {
           
// This is just a wrapper -- nothing to do here
   
}
   
/**
     * creates a XMLDoc Generation object and returns a reference to this.
     * automatically loads necessary files
     * @return XMLDoc
     */
   
function &createXMLDoc() {
        if (!
defined("SAFOX_G")) {
                require_once(
dirname(__FILE__)."/safox_g.cls.php");
        }
        if (!
defined("SAFOX_G")) {
                die (
" SAFOX Generation Class not found in directory:".dirname(__FILE__));
        }
       
$xmlDoc = & new xmlDoc();
        return
$xmlDoc;
    }
   
/**
     * creates a XMLParser object and returns a reference to this.
     * automatically loads necessary files
     * @return @XMLParser
     */
   
function &createXMLParser() {
        if (!
defined("SAFOX_P")) {
                require_once(
dirname(__FILE__)."/safox_p.cls.php");
        }
        if (!
defined("SAFOX_P")) {
                die (
" SAFOX Parser Class not found in directory:".dirname(__FILE__));
        }
       
$parser = & new xmlParser();
        return
$parser;
    }
   
/**
     * creates a RSSDoc (RSS 2.0) Generation object and returns a reference to this.
     * automatically loads necessary files
     * @return RSSDoc
     */
   
function &createRSSDoc($title="",$link="",$description="") {
        if (!
defined("SAFOX_G_RSS")) {
                require_once(
dirname(__FILE__)."/safox_g_rss.cls.php");
        }
        if (!
defined("SAFOX_G_RSS")) {
                die (
" SAFOX RSS Generation Class not found in directory:".dirname(__FILE__));
        }
       
$rssDoc = & new RSSDoc($title,$link,$description);
        return
$rssDoc;
    }
   
/**
     * creates a RSSParser (RSS 2.0) object and returns a reference to this.
     * automatically loads necessary files
     * @return RSSParser
     */
   
function &createRSSParser() {
        if (!
defined("SAFOX_P_RSS")) {
                require_once(
dirname(__FILE__)."/safox_p_rss.cls.php");
        }
        if (!
defined("SAFOX_P_RSS")) {
                die (
" SAFOX RSS Parser Class not found in directory:".dirname(__FILE__));
        }
       
$rssp = & new RSSParser();
        return
$rssp;
    }
   
/**
     * returns the current version of the SAFOX API
     * @return float
     */
   
function getVersion() {
        return
SAFOXVERSION;
    }
   
/**
     * alias to getVersion() - returns the current version of the SAFOX API
     * @return float
     */
   
function ver() {
        return
SAFOXVERSION;
    }
}




 
?>