blob: bd11b983679e67573320e5390221eae2ef519cef [file] [log] [blame]
Derek Allard2067d1a2008-11-13 22:59:24 +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
Derek Jones7f3719f2010-01-05 13:35:37 +00009 * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
Derek Allard2067d1a2008-11-13 22:59:24 +000010 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
12 * @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 Jones7ec13102010-03-02 13:18:39 -060027 * @author ExpressionEngine Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000028 * @link http://codeigniter.com/user_guide/
29 */
30
31// ------------------------------------------------------------------------
32
33/*
34 * PHP versions prior to 5.0 don't support the E_STRICT constant
Barry Mienydd671972010-10-04 16:33:58 +020035 * so we need to explicitly define it otherwise the Exception class
Derek Allard2067d1a2008-11-13 22:59:24 +000036 * will generate errors when running under PHP 4
Derek Jonesac2b2472010-03-02 13:29:14 -060037 * @PHP4
Derek Allard2067d1a2008-11-13 22:59:24 +000038 *
39 */
40if ( ! defined('E_STRICT'))
41{
42 define('E_STRICT', 2048);
43}
44
45/**
46 * ctype_digit()
47 *
48 * Determines if a string is comprised only of digits
49 * http://us.php.net/manual/en/function.ctype_digit.php
Derek Jonesac2b2472010-03-02 13:29:14 -060050 * @PHP4
Derek Allard2067d1a2008-11-13 22:59:24 +000051 *
52 * @access public
53 * @param string
54 * @return bool
55 */
56if ( ! function_exists('ctype_digit'))
57{
58 function ctype_digit($str)
59 {
60 if ( ! is_string($str) OR $str == '')
61 {
62 return FALSE;
63 }
Barry Mienydd671972010-10-04 16:33:58 +020064
Derek Allard2067d1a2008-11-13 22:59:24 +000065 return ! preg_match('/[^0-9]/', $str);
Barry Mienydd671972010-10-04 16:33:58 +020066 }
Derek Allard2067d1a2008-11-13 22:59:24 +000067}
68
69// --------------------------------------------------------------------
70
71/**
72 * ctype_alnum()
73 *
74 * Determines if a string is comprised of only alphanumeric characters
75 * http://us.php.net/manual/en/function.ctype-alnum.php
Derek Jonesac2b2472010-03-02 13:29:14 -060076 * @PHP4
Derek Allard2067d1a2008-11-13 22:59:24 +000077 *
78 * @access public
79 * @param string
80 * @return bool
81 */
82if ( ! function_exists('ctype_alnum'))
83{
84 function ctype_alnum($str)
85 {
86 if ( ! is_string($str) OR $str == '')
87 {
88 return FALSE;
89 }
Barry Mienydd671972010-10-04 16:33:58 +020090
Derek Allard2067d1a2008-11-13 22:59:24 +000091 return ! preg_match('/[^0-9a-z]/i', $str);
Barry Mienydd671972010-10-04 16:33:58 +020092 }
Derek Allard2067d1a2008-11-13 22:59:24 +000093}
94
Derek Jones7ec13102010-03-02 13:18:39 -060095// --------------------------------------------------------------------
96
97
Derek Allard2067d1a2008-11-13 22:59:24 +000098/* End of file Compat.php */
Derek Jonesc68dfbf2010-03-02 12:59:23 -060099/* Location: ./system/core/Compat.php */