Skip to content

Commit

Permalink
compatibility functions for missing ctype extension FS#2873
Browse files Browse the repository at this point in the history
  • Loading branch information
splitbrain committed Oct 30, 2013
1 parent 9269d0b commit 6589c60
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions inc/compatibility.php
@@ -0,0 +1,36 @@
<?php
/**
* compatibility functions
*
* This file contains a few functions that might be missing from the PHP build
*/

if(!function_exists('ctype_space')) {
/**
* Check for whitespace character(s)
*
* @see ctype_space
* @param string $text
* @return bool
*/
function ctype_space($text) {
if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars
if(trim($text) === '') return true;
return false;
}
}

if(!function_exists('ctype_digit')) {
/**
* Check for numeric character(s)
*
* @see ctype_digit
* @param string $text
* @return bool
*/
function ctype_digit($text) {
if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars
if(preg_match('/^\d+$/', $text)) return true;
return false;
}
}
1 change: 1 addition & 0 deletions inc/load.php
Expand Up @@ -35,6 +35,7 @@
require_once(DOKU_INC.'inc/toolbar.php');
require_once(DOKU_INC.'inc/utf8.php');
require_once(DOKU_INC.'inc/auth.php');
require_once(DOKU_INC.'inc/compatibility.php');

/**
* spl_autoload_register callback
Expand Down

0 comments on commit 6589c60

Please sign in to comment.