Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 1 | <?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 Jones | 7f3719f | 2010-01-05 13:35:37 +0000 | [diff] [blame] | 9 | * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 10 | * @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 Jones | 7ec1310 | 2010-03-02 13:18:39 -0600 | [diff] [blame] | 27 | * @author ExpressionEngine Dev Team |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 28 | * @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 Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 35 | * so we need to explicitly define it otherwise the Exception class |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 36 | * will generate errors when running under PHP 4 |
Derek Jones | ac2b247 | 2010-03-02 13:29:14 -0600 | [diff] [blame] | 37 | * @PHP4 |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 38 | * |
| 39 | */ |
| 40 | if ( ! 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 Jones | ac2b247 | 2010-03-02 13:29:14 -0600 | [diff] [blame] | 50 | * @PHP4 |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 51 | * |
| 52 | * @access public |
| 53 | * @param string |
| 54 | * @return bool |
| 55 | */ |
| 56 | if ( ! function_exists('ctype_digit')) |
| 57 | { |
| 58 | function ctype_digit($str) |
| 59 | { |
| 60 | if ( ! is_string($str) OR $str == '') |
| 61 | { |
| 62 | return FALSE; |
| 63 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 64 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 65 | return ! preg_match('/[^0-9]/', $str); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 66 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 67 | } |
| 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 Jones | ac2b247 | 2010-03-02 13:29:14 -0600 | [diff] [blame] | 76 | * @PHP4 |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 77 | * |
| 78 | * @access public |
| 79 | * @param string |
| 80 | * @return bool |
| 81 | */ |
| 82 | if ( ! function_exists('ctype_alnum')) |
| 83 | { |
| 84 | function ctype_alnum($str) |
| 85 | { |
| 86 | if ( ! is_string($str) OR $str == '') |
| 87 | { |
| 88 | return FALSE; |
| 89 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 90 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 91 | return ! preg_match('/[^0-9a-z]/i', $str); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 92 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Derek Jones | 7ec1310 | 2010-03-02 13:18:39 -0600 | [diff] [blame] | 95 | // -------------------------------------------------------------------- |
| 96 | |
| 97 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 98 | /* End of file Compat.php */ |
Derek Jones | c68dfbf | 2010-03-02 12:59:23 -0600 | [diff] [blame] | 99 | /* Location: ./system/core/Compat.php */ |