16589c60cSAndreas Gohr<?php 26589c60cSAndreas Gohr/** 36589c60cSAndreas Gohr * compatibility functions 46589c60cSAndreas Gohr * 56589c60cSAndreas Gohr * This file contains a few functions that might be missing from the PHP build 66589c60cSAndreas Gohr */ 76589c60cSAndreas Gohr 86589c60cSAndreas Gohrif(!function_exists('ctype_space')) { 96589c60cSAndreas Gohr /** 106589c60cSAndreas Gohr * Check for whitespace character(s) 116589c60cSAndreas Gohr * 126589c60cSAndreas Gohr * @see ctype_space 136589c60cSAndreas Gohr * @param string $text 146589c60cSAndreas Gohr * @return bool 156589c60cSAndreas Gohr */ 166589c60cSAndreas Gohr function ctype_space($text) { 176589c60cSAndreas Gohr if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars 186589c60cSAndreas Gohr if(trim($text) === '') return true; 196589c60cSAndreas Gohr return false; 206589c60cSAndreas Gohr } 216589c60cSAndreas Gohr} 226589c60cSAndreas Gohr 236589c60cSAndreas Gohrif(!function_exists('ctype_digit')) { 246589c60cSAndreas Gohr /** 256589c60cSAndreas Gohr * Check for numeric character(s) 266589c60cSAndreas Gohr * 276589c60cSAndreas Gohr * @see ctype_digit 286589c60cSAndreas Gohr * @param string $text 296589c60cSAndreas Gohr * @return bool 306589c60cSAndreas Gohr */ 316589c60cSAndreas Gohr function ctype_digit($text) { 326589c60cSAndreas Gohr if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars 336589c60cSAndreas Gohr if(preg_match('/^\d+$/', $text)) return true; 346589c60cSAndreas Gohr return false; 356589c60cSAndreas Gohr } 366589c60cSAndreas Gohr} 37*92b9f196SAndreas Gohr 38*92b9f196SAndreas Gohrif(!function_exists('gzopen') && function_exists('gzopen64')) { 39*92b9f196SAndreas Gohr /** 40*92b9f196SAndreas Gohr * work around for PHP compiled against certain zlib versions #865 41*92b9f196SAndreas Gohr * 42*92b9f196SAndreas Gohr * @link http://stackoverflow.com/questions/23417519/php-zlib-gzopen-not-exists 43*92b9f196SAndreas Gohr * 44*92b9f196SAndreas Gohr * @param string $filename 45*92b9f196SAndreas Gohr * @param string $mode 46*92b9f196SAndreas Gohr * @param int $use_include_path 47*92b9f196SAndreas Gohr * @return mixed 48*92b9f196SAndreas Gohr */ 49*92b9f196SAndreas Gohr function gzopen($filename, $mode, $use_include_path = 0) { 50*92b9f196SAndreas Gohr return gzopen64($filename, $mode, $use_include_path); 51*92b9f196SAndreas Gohr } 52*92b9f196SAndreas Gohr}