PHP_Compat
[ class tree: PHP_Compat ] [ index: PHP_Compat ] [ all elements ]

Source for file Compat.php

Documentation is available at Compat.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP Version 4                                                        |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2004 The PHP Group                                |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 3.0 of the PHP license,       |
  8. // | that is bundled with this package in the file LICENSE, and is        |
  9. // | available at through the world-wide-web at                           |
  10. // | http://www.php.net/license/3_0.txt.                                  |
  11. // | If you did not receive a copy of the PHP license and are unable to   |
  12. // | obtain it through the world-wide-web, please send a note to          |
  13. // | license@php.net so we can mail you a copy immediately.               |
  14. // +----------------------------------------------------------------------+
  15. // | Authors: Aidan Lister <aidan@php.net>                                |
  16. // +----------------------------------------------------------------------+
  17. //
  18. // $Id: Compat.php,v 1.15 2004/09/12 13:17:19 aidan Exp $
  19.  
  20.  
  21. /**
  22.  * Provides missing functionality in the form of constants and functions
  23.  *   for older versions of PHP
  24.  *
  25.  * Optionally, you may simply include the file.
  26.  *   e.g. require_once 'PHP/Compat/Function/scandir.php';
  27.  *
  28.  * @category    PHP
  29.  * @package     PHP_Compat
  30.  * @version     1.1.0
  31.  * @author      Aidan Lister <aidan@php.net>
  32.  * @static
  33.  */
  34. class PHP_Compat
  35. {
  36.     /**
  37.      * Load a function, or array of functions
  38.      *
  39.      * @param   string|array   $function The function or functions to load.
  40.      * @return  bool|array     true if loaded, false if not
  41.      */
  42.     function loadFunction ($function)
  43.     {
  44.         if (is_array($function)) {
  45.  
  46.             $res = array ();
  47.             foreach ($function as $singlefunc{
  48.                 $res[PHP_Compat::loadFunction($singlefunc);
  49.             }
  50.             return $res;
  51.  
  52.         else {
  53.  
  54.             if (!function_exists($function)) {
  55.                 $file sprintf('PHP/Compat/Function/%s.php'$function);
  56.                 if ((@include_once $file!== false{
  57.                     return true;
  58.                 }
  59.             }
  60.             return false;
  61.         }
  62.     }
  63.  
  64.  
  65.     /**
  66.      * Load a constant, or array of constants
  67.      *
  68.      * @param   string|array   $constant The constant or constants to load.
  69.      * @return  bool|array     true if loaded, false if not
  70.      */
  71.     function loadConstant ($constant)
  72.     {
  73.         if (is_array($constant)) {
  74.  
  75.             $res = array ();
  76.             foreach ($constant as $singleconst{
  77.                 $res[PHP_Compat::loadConstant($singleconst);
  78.             }
  79.             return $res;
  80.  
  81.         else {
  82.  
  83.             $file sprintf('PHP/Compat/Constant/%s.php'$constant);
  84.             if ((@include_once $file!== false{
  85.                 return true;
  86.             }
  87.             return false;
  88.         }
  89.     }
  90. }
  91.  
  92. ?>

Documentation generated on Mon, 11 Mar 2019 13:55:17 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.