1<?php 2/** 3 * compatibility functions 4 * 5 * This file contains a few functions that might be missing from the PHP build 6 */ 7 8if(!function_exists('ctype_space')) { 9 /** 10 * Check for whitespace character(s) 11 * 12 * @see ctype_space 13 * @param string $text 14 * @return bool 15 */ 16 function ctype_space($text) { 17 if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars 18 if(trim($text) === '') return true; 19 return false; 20 } 21} 22 23if(!function_exists('ctype_digit')) { 24 /** 25 * Check for numeric character(s) 26 * 27 * @see ctype_digit 28 * @param string $text 29 * @return bool 30 */ 31 function ctype_digit($text) { 32 if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars 33 if(preg_match('/^\d+$/', $text)) return true; 34 return false; 35 } 36} 37 38if(!function_exists('gzopen') && function_exists('gzopen64')) { 39 /** 40 * work around for PHP compiled against certain zlib versions #865 41 * 42 * @link http://stackoverflow.com/questions/23417519/php-zlib-gzopen-not-exists 43 * 44 * @param string $filename 45 * @param string $mode 46 * @param int $use_include_path 47 * @return mixed 48 */ 49 function gzopen($filename, $mode, $use_include_path = 0) { 50 return gzopen64($filename, $mode, $use_include_path); 51 } 52}