steffen: server/kolab-horde-framework/kolab-horde-framework/Compress Compress.php, NONE, 1.1 package.xml, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Fri Oct 14 16:33:06 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Compress

Added Files:
	Compress.php package.xml 
Log Message:
Separated Horde Framework from kolab-resource-handlers

--- NEW FILE: Compress.php ---
<?php
/**
 * The Horde_Compress:: class provides an API for various compression
 * techniques that can be used by Horde applications.
 *
 * $Horde: framework/Compress/Compress.php,v 1.7 2004/01/01 15:14:12 jan Exp $
 *
 * Copyright 2003-2004 Michael Slusarz <slusarz at bigworm.colorado.edu>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Michael Slusarz <slusarz at bigworm.colorado.edu>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Compress
 */
class Horde_Compress {

    /**
     * Attempts to return a concrete Horde_Compress instance based on
     * $driver.
     *
     * @access public
     *
     * @param mixed $driver           The type of concrete Horde_Compress
     *                                subclass to return. This is based on
     *                                the storage driver ($driver). The code
     *                                is dynamically included. If $driver is
     *                                an array, then we will look in
     *                                $driver[0]/lib/Compress/ for the
     *                                subclass implementation named
     *                                $driver[1].php.
     * @param optional array $params  A hash containing any additional
     *                                configuration or parameters a subclass
     *                                might need.
     *
     * @return object Horde_Compress  The newly created concrete
     *                                Horde_Compress instance, or false on an
     *                                error.
     */
    function &factory($driver, $params = array())
    {
        if (is_array($driver)) {
            list($app, $driver) = $driver;
        }

        $driver = basename($driver);

        if (!empty($app)) {
            require_once $app . '/lib/Compress/' . $driver . '.php';
        } elseif (@file_exists(dirname(__FILE__) . '/Compress/' . $driver . '.php')) {
            require_once dirname(__FILE__) . '/Compress/' . $driver . '.php';
        } else {
            @include_once 'Horde/Compress/' . $driver . '.php';
        }

        $class = 'Horde_Compress_' . $driver;
        if (class_exists($class)) {
            return $ret = &new $class($params);
        } else {
            return false;
        }
    }

    /**
     * Attempts to return a reference to a concrete Horde_Compress instance
     * based on $driver. It will only create a new instance if no
     * Horde_Compress instance with the same parameters currently exists.
     *
     * This method must be invoked as:
     *   $var = &Horde_Compress::singleton();
     *
     * @access public
     *
     * @param mixed $driver           See Horde_Compress::factory().
     * @param optional array $params  See Horde_Compress::factory().
     *
     * @return object Horde_Compress  The concrete Horde_Compress reference,
     *                                or false on an error.
     */
    function &singleton($driver, $params = array())
    {
        static $instances;

        if (!isset($instances)) {
            $instances = array();
        }

        $signature = serialize(array($driver, $params));
        if (!array_key_exists($signature, $instances)) {
            $instances[$signature] = &Horde_Compress::factory($driver, $params);
        }

        return $instances[$signature];
    }

    /**
     * Constructor.
     *
     * @access public
     *
     * @param optional array $params  Parameter array.
     */
    function Horde_Compress($params = array())
    {
    }

    /**
     * Compress the data.
     *
     * @access public
     *
     * @param string $data            The data to compress.
     * @param optional array $params  An array of arguments needed to
     *                                compress the data.
     *
     * @return mixed  The compressed data.
     *                Returns PEAR_Error object on error.
     */
    function &compress($data, $params = array())
    {
        return PEAR::raiseError('Unsupported');
    }

    /**
     * Decompress the data.
     *
     * @access public
     *
     * @param string $data            The data to decompress.
     * @param optional array $params  An array of arguments needed to
     *                                decompress the data.
     *
     * @return array  The decompressed data.
     *                Returns PEAR_Error object on error.
     */
    function &decompress($data, $params = array())
    {
        return PEAR::raiseError('Unsupported');
    }

}

--- NEW FILE: package.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $Horde: framework/Compress/package.xml,v 1.7 2003/10/29 19:35:01 chuck Exp $ -->
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1">
<package version="1.0">
  <name>Horde_Compress</name>
  <summary>Horde Compression API</summary>
  <description>
    The Horde_Compress:: class provides an API for various compression techniques.
  </description>
  <license>LGPL</license>

  <maintainers>
    <maintainer>
      <user>chuck</user>
      <role>lead</role>
      <name>Chuck Hagenbuch</name>
      <email>chuck at horde.org</email>
    </maintainer>
    <maintainer>
      <user>jon</user>
      <role>lead</role>
      <name>Jon Parise</name>
      <email>jon at horde.org</email>
    </maintainer>
    <maintainer>
      <user>yunosh</user>
      <role>lead</role>
      <name>Jan Schneider</name>
      <email>jan at horde.org</email>
    </maintainer>
    <maintainer>
      <user>slusarz</user>
      <role>lead</role>
      <name>Michael Slusarz</name>
      <email>slusarz at bigworm.colorado.edu</email>
    </maintainer>
    <maintainer>
      <user>mac</user>
      <role>lead</role>
      <name>Mike Cochrane</name>
      <email>mike at graftonhall.co.nz</email>
    </maintainer>
  </maintainers>

  <release>
    <version>0.0.1</version>
    <state>alpha</state>
    <date>2003-07-03</date>
    <notes>Initial Release.</notes>

    <filelist>
      <file role="php" baseinstalldir="/Horde" name="Compress.php" />
      <dir baseinstalldir="/Horde" name="Compress" role="php">
        <file name="dbx.php" />
        <file name="gzip.php" />
        <file name="tar.php" />
        <file name="tnef.php" />
        <file name="zip.php" />
      </dir>
    </filelist>

    <deps>
      <dep type="ext" rel="has" optional="yes">gettext</dep>
      <dep type="ext" rel="has" optional="yes">zlib</dep>
      <dep type="pkg" rel="has">Horde_Util</dep>
    </deps>
  </release>

  <changelog>
    <release>
      <version>0.0.1</version>
      <state>alpha</state>
      <date>2003-07-03</date>
      <notes>Initial release as a PEAR package</notes>
    </release>
  </changelog>
</package>





More information about the commits mailing list