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 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://au.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. // | Author: Aidan Lister <aidan@php.net>                                 |
  16. // +----------------------------------------------------------------------+
  17. //
  18. // $Id: Compat.php,v 1.7 2004/05/20 13:38:01 aidan Exp $
  19. //
  20.  
  21.  
  22. /**
  23.  * Provides missing functionality in the form of constants and functions
  24.  *   for older versions of PHP
  25.  *
  26.  * The methods in this class should be called statically
  27.  *
  28.  * Optionally, you may simply include the file.
  29.  *   e.g. require_once 'PHP/Compat/Function/scandir.php';
  30.  *
  31.  * @version        0.1
  32.  * @author         Aidan Lister <aidan@php.net>
  33.  */
  34. class PHP_Compat
  35. {
  36.  
  37.     /**
  38.      * Load a function, or array of functions
  39.      *
  40.      * @param string|array$function The function or functions to load.
  41.      * @return void 
  42.      */
  43.     function loadFunction ($function)
  44.     {
  45.         if (is_array($function)) {
  46.             foreach ($function as $singlefunc{
  47.                 PHP_Compat::loadFunction($singlefunc);
  48.             }
  49.         }
  50.  
  51.         else {
  52.             $file sprintf('PHP/Compat/Function/%s.php',
  53.                                 $function);
  54.  
  55.             if ((@include_once $file!== false{
  56.                 return true;
  57.             }
  58.  
  59.             return false;
  60.         }
  61.     }
  62.  
  63.  
  64.     /**
  65.      * Load a constant, or array of constants
  66.      *
  67.      * @param string|array$constant The constant or constants to load.
  68.      * @return void 
  69.      */
  70.     function loadConstant ($constant)
  71.     {
  72.         if (is_array($constant)) {
  73.             foreach ($constant as $singleconst{
  74.                 PHP_Compat::loadConstant($singleconst);
  75.             }
  76.         }
  77.  
  78.         else {
  79.             $file sprintf('PHP/Compat/Constant/%s.php',
  80.                                 $constant);
  81.  
  82.             if ((@include_once $file!== false{
  83.                 return true;
  84.             }
  85.  
  86.             return false;
  87.         }
  88.     }
  89.  
  90. }
  91.  
  92. ?>

Documentation generated on Mon, 11 Mar 2019 10:16:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.