blob: 56ebbf45de56d285ab7fbd16153b1c66f64b3762 [file] [log] [blame]
Derek Allard3d879d52008-01-18 19:41:32 +00001<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2/**
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 */
39if ( ! defined('E_STRICT'))
40{
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 */
54if (! function_exists('ctype_digit'))
55{
56 function ctype_digit($str)
57 {
58 if (! is_string($str) OR $str == '')
59 {
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 */
79if (! function_exists('ctype_alnum'))
80{
81 function ctype_alnum($str)
82 {
83 if (! is_string($str) OR $str == '')
84 {
85 return FALSE;
86 }
87
88 return ! preg_match('/[^0-9a-z]/i', $str);
89 }
90}
91
92// --------------------------------------------------------------------
93
Derek Jones98844492008-01-16 22:26:37 +000094?>