blob: 6478f086e74d033b37665f1717d800a07e951ccb [file] [log] [blame]
Derek Jones0b59f272008-05-13 04:22:33 +00001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard3d879d52008-01-18 19:41:32 +00002/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2006, EllisLab, Inc.
Derek Jones7a9193a2008-01-21 18:39:20 +000010 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
Derek Allard3d879d52008-01-18 19:41:32 +000012 * @since Version 1.0
13 * @filesource
14 */
15
16// ------------------------------------------------------------------------
17
18/**
19 * Compatibility Functions
20 *
21 * Function overrides for older versions of PHP or PHP environments missing
22 * certain extensions / libraries
23 *
24 * @package CodeIgniter
25 * @subpackage codeigniter
26 * @category Compatibility Functions
Derek Allardb2bbd612008-01-18 19:59:29 +000027 * @author ExpressionEngine Development Team
Derek Jones7a9193a2008-01-21 18:39:20 +000028 * @link http://codeigniter.com/user_guide/
Derek Allard3d879d52008-01-18 19:41:32 +000029 */
30
31// ------------------------------------------------------------------------
32
33/*
34 * PHP versions prior to 5.0 don't support the E_STRICT constant
35 * so we need to explicitly define it otherwise the Exception class
36 * will generate errors when running under PHP 4
37 *
38 */
Derek Jones0b59f272008-05-13 04:22:33 +000039if ( ! defined('E_STRICT'))
Derek Allard3d879d52008-01-18 19:41:32 +000040{
41 define('E_STRICT', 2048);
42}
43
44/**
45 * ctype_digit()
46 *
47 * Determines if a string is comprised only of digits
48 * http://us.php.net/manual/en/function.ctype_digit.php
49 *
50 * @access public
51 * @param string
52 * @return bool
53 */
Derek Jones0b59f272008-05-13 04:22:33 +000054if ( ! function_exists('ctype_digit'))
Derek Allard3d879d52008-01-18 19:41:32 +000055{
56 function ctype_digit($str)
57 {
Derek Jones0b59f272008-05-13 04:22:33 +000058 if ( ! is_string($str) OR $str == '')
Derek Allard3d879d52008-01-18 19:41:32 +000059 {
60 return FALSE;
61 }
62
63 return ! preg_match('/[^0-9]/', $str);
64 }
65}
66
67// --------------------------------------------------------------------
68
69/**
70 * ctype_alnum()
71 *
72 * Determines if a string is comprised of only alphanumeric characters
73 * http://us.php.net/manual/en/function.ctype-alnum.php
74 *
75 * @access public
76 * @param string
77 * @return bool
78 */
Derek Jones0b59f272008-05-13 04:22:33 +000079if ( ! function_exists('ctype_alnum'))
Derek Allard3d879d52008-01-18 19:41:32 +000080{
81 function ctype_alnum($str)
82 {
Derek Jones0b59f272008-05-13 04:22:33 +000083 if ( ! is_string($str) OR $str == '')
Derek Allard3d879d52008-01-18 19:41:32 +000084 {
85 return FALSE;
86 }
87
88 return ! preg_match('/[^0-9a-z]/i', $str);
89 }
90}
91
92// --------------------------------------------------------------------
93
Derek Jones0b59f272008-05-13 04:22:33 +000094
95/* End of file Compat.php */
Derek Jonesa3ffbbb2008-05-11 18:18:29 +000096/* Location: ./system/codeigniter/Compat.php */