Compat.php

Go to the documentation of this file.
00001 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
00002 /**
00003  * CodeIgniter
00004  *
00005  * An open source application development framework for PHP 4.3.2 or newer
00006  *
00007  * @package             CodeIgniter
00008  * @author              ExpressionEngine Dev Team
00009  * @copyright   Copyright (c) 2008, EllisLab, Inc.
00010  * @license             http://codeigniter.com/user_guide/license.html
00011  * @link                http://codeigniter.com
00012  * @since               Version 1.0
00013  * @filesource
00014  */
00015 
00016 // ------------------------------------------------------------------------
00017 
00018 /**
00019  * Compatibility Functions
00020  *
00021  * Function overrides for older versions of PHP or PHP environments missing
00022  * certain extensions / libraries
00023  *
00024  * @package             CodeIgniter
00025  * @subpackage  codeigniter
00026  * @category    Compatibility Functions
00027  * @author              ExpressionEngine Development Team
00028  * @link                http://codeigniter.com/user_guide/
00029  */
00030 
00031 // ------------------------------------------------------------------------
00032 
00033 /*
00034  * PHP versions prior to 5.0 don't support the E_STRICT constant
00035  * so we need to explicitly define it otherwise the Exception class 
00036  * will generate errors when running under PHP 4
00037  *
00038  */
00039 if ( ! defined('E_STRICT'))
00040 {
00041         define('E_STRICT', 2048);
00042 }
00043 
00044 /**
00045  * ctype_digit()
00046  *
00047  * Determines if a string is comprised only of digits
00048  * http://us.php.net/manual/en/function.ctype_digit.php
00049  *
00050  * @access      public
00051  * @param       string
00052  * @return      bool
00053  */
00054 if ( ! function_exists('ctype_digit'))
00055 {
00056         function ctype_digit($str)
00057         {
00058                 if ( ! is_string($str) OR $str == '')
00059                 {
00060                         return FALSE;
00061                 }
00062                 
00063                 return ! preg_match('/[^0-9]/', $str);
00064         }       
00065 }
00066 
00067 // --------------------------------------------------------------------
00068 
00069 /**
00070  * ctype_alnum()
00071  *
00072  * Determines if a string is comprised of only alphanumeric characters
00073  * http://us.php.net/manual/en/function.ctype-alnum.php
00074  *
00075  * @access      public
00076  * @param       string
00077  * @return      bool
00078  */
00079 if ( ! function_exists('ctype_alnum'))
00080 {
00081         function ctype_alnum($str)
00082         {
00083                 if ( ! is_string($str) OR $str == '')
00084                 {
00085                         return FALSE;
00086                 }
00087                 
00088                 return ! preg_match('/[^0-9a-z]/i', $str);
00089         }       
00090 }
00091 
00092 /* End of file Compat.php */
00093 /* Location: ./system/codeigniter/Compat.php */