summaryrefslogtreecommitdiffstats
path: root/system/codeigniter/Compat.php
blob: 108b0a1aa1b862464405a41ed59d37bba64182e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 4.3.2 or newer
 *
 * @package		CodeIgniter
 * @author		Rick Ellis
 * @copyright	Copyright (c) 2006, EllisLab, Inc.
 * @license		http://www.codeigniter.com/user_guide/license.html
 * @link		http://www.codeigniter.com
 * @since		Version 1.0
 * @filesource
 */

// ------------------------------------------------------------------------

/**
 * Compatibility Functions
 *
 * Function overrides for older versions of PHP or PHP environments missing
 * certain extensions / libraries
 *
 * @package		CodeIgniter
 * @subpackage	codeigniter
 * @category	Compatibility Functions
 * @author		EllisLab Development Team
 * @link		http://www.codeigniter.com/user_guide/
 */

// ------------------------------------------------------------------------

/*
 * PHP versions prior to 5.0 don't support the E_STRICT constant
 * so we need to explicitly define it otherwise the Exception class 
 * will generate errors when running under PHP 4
 *
 */
if ( ! defined('E_STRICT'))
{
	define('E_STRICT', 2048);
}

/**
 * ctype_digit()
 *
 * Determines if a string is comprised only of digits
 * http://us.php.net/manual/en/function.ctype_digit.php
 *
 * @access	public
 * @param	string
 * @return	bool
 */
if (! function_exists('ctype_digit'))
{
	function ctype_digit($str)
	{
		if (! is_string($str) OR $str == '')
		{
			return FALSE;
		}
		
		return ! preg_match('/[^0-9]/', $str);
	}	
}

// --------------------------------------------------------------------

/**
 * ctype_alnum()
 *
 * Determines if a string is comprised of only alphanumeric characters
 * http://us.php.net/manual/en/function.ctype-alnum.php
 *
 * @access	public
 * @param	string
 * @return	bool
 */
if (! function_exists('ctype_alnum'))
{
	function ctype_alnum($str)
	{
		if (! is_string($str) OR $str == '')
		{
			return FALSE;
		}
		
		return ! preg_match('/[^0-9a-z]/i', $str);
	}	
}

// --------------------------------------------------------------------

?>