File: Platform/Pear/proc.php

Recommend this page to a friend!
  Classes of Asher Wolfstein  >  Platform_pear  >  Platform/Pear/proc.php  >  Download  
File: Platform/Pear/proc.php
Role: Auxiliary script
Content type: text/plain
Description: Procedural PHP File
Class: Platform_pear
Check whether a given PEAR package is installed
Author: By
Last change:
Date: 14 years ago
Size: 3,903 bytes
 

Contents

Class file image Download
<?php
/*------------------------------------------------------------------------------
// File: [Platform/Pear/]proc.php
// Description: PHP 3, 4, 5 Pear Package Check
// Purpose: Use these functions to check for installed PEAR packages in an
// auto-detect like fashion.
// Version: 1.0
// Application: PHCL-WTK
// Author: Asher Kadar Wolfstein
// Email: asher@asherwolf.com
// Homepage: http://www.asherwolf.com/projects/php/platform/pear/index.html
//------------------------------------------------------------------------------
//
// ALL CODE AND (GENERATED) DOCUMENTATION
// IS COPYRIGHT 2007 WOLFSTEIN CONSULTING (COLORADO)
//
// LICENSE INFORMATION
//
// http://www.asherwolf.com/code_license_1.php?p=Platform_pear&l=lgpl&l2=c30
//
// THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY INCLUDING THE IMPLIED
// WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.
//
// THIS FILE IS PART OF 'Platform_pear'.
//
// 'Platform_pear' IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
// IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE AS PUBLISHED BY
// THE FREE SOFTWARE FOUNDATION;
//
// 'Platform_pear' IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
// BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
// MERCHANTIBILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE
// GNU LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
//
// YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
// ALONG WITH 'Filecloak'; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION, INC.,
// 51 FRANKLIN ST, FIFTH FLOOR, BOSTON, MA 02110-1301 USA
//
// http://www.opensource.org/licenses/lgpl-license.php
//
// FURTHER LICENSED UNDER THE CREATIVE COMMONS ATTRIBUTION 3.0 LICENSE
//
// http://creativecommons.org/licenses/by/3.0/
//
//------------------------------------------------------------------------------
// Revision History
//------------------------------------------------------------------------------
// Format: strftime - %D
// 07/01/2007 Created - Asher Wolfstein
//
//----------------------------------------------------------------------------*/

/**
 * PHP 3, 4, 5 Pear Package Check
 *
 * Use these functions to check for installed PEAR packages in an
 * auto-detect like fashion.
 *
 * @author Asher Wolfstein <asher@asherwolf.com>
 * @copyright Copyright &copy; 2007, Wolfstein Consulting (Colorado).
 * @license http://www.asherwolf.com/code_license_1.php?p=Platform_pear&l=lgpl&l2=c30 License Information
 * @package platform
 * @version 1.0
 * @subpackage pear
 * @category compatibility
 */

require_once( '../config.php' );

/**
 * Retrieves pear installation include path
 *
 * Retrieves the pear installation include path to test for pear modules.
 * Will only work with ONE pear include path.
 *
 * To detect pear, it's best if you don't have in your include path the word
 * pear if it's not actually a PEAR installation.
 *
 * @return string|boolean Directory of PEAR installation or false otherwise
 */
function platform_pear_get_path() {
    if (
strpos( strtolower( ini_get( 'include_path' ) ), 'pear' ) !== false ) {
       
$dirs = explode( PLATFORM_PATH_SEPARATOR, ini_get( 'include_path' ) );
        foreach (
$dirs as $dir ) {
            if (
strpos( strtolower( $dir ), 'pear' ) !== false ) {
                return
$dir . PLATFORM_DIR_SEP;
            }
        }
    }
   
    return
false;
}

/**
 * Checks to see if PEAR filepath exists
 *
 * Tests to see if the include filepath exist in the PEAR include directory
 *
 * @param string $inc_path Filepath to include
 * @return boolean True if PEAR filepath exists, false otherwise
 */
function platform_pear_check_module( $inc_path ) {
   
$p = platform_pear_get_path();
    if (
$p && file_exists( $p . $inc_path ) ) {
        return
true;
    }
   
    return
false;
}

/**
 * True if filecloak.pear_check.php has been required/included
 *
 * @name PLATFORM_PEAR_PROC_CONF
 */
define( 'PLATFORM_PEAR_PROC_CONF', true );

?>

For more information send a message to info at phpclasses dot org.