forked from kerphi/phpfreechat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[en] Makes compatible csstidy and php without ctype enabled (thanks t…
…o Andreas) [0h40] [fr] Rend compatible la librairie csstidy pour les installations de php n'ayant pas le module ctype (merci à Andreas) [0h40] git-svn-id: https://phpfreechat.svn.sourceforge.net/svnroot/phpfreechat/trunk@977 2772adf2-ac07-0410-9d30-e29d8120292e
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
if (!function_exists('ctype_alpha')) { | ||
function ctype_alpha($string) | ||
{ | ||
return preg_match('/^[a-z]+$/i', $string); | ||
} | ||
} | ||
|
||
if (!function_exists('ctype_xdigit')) { | ||
function ctype_xdigit($string) | ||
{ | ||
return preg_match('/^[0-9a-f]+$/i', $string); | ||
} | ||
} | ||
|
||
if (!function_exists('ctype_space')) { | ||
function ctype_space($string) | ||
{ | ||
return preg_match('/^[\s]$/', $string); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
// | ||
// TO RUN THIS TESTCASE : PREFIX THE FUNCTIONS NAMES BY my_ IN lib/ctype/ctype.php | ||
// | ||
|
||
require_once dirname(__FILE__).'/../lib/ctype/ctype.php'; | ||
|
||
// examples for verifying | ||
$test[] = ""; | ||
$test[] = "\t"; | ||
$test[] = "\r"; | ||
$test[] = "\n"; | ||
$test[] = " "; | ||
$test[] = "\n-"; | ||
$test[] = " x"; | ||
$test[] = "12 3"; | ||
$test[] = ". abc"; | ||
$test[] = "abc"; | ||
$test[] = "AzEdFDe"; | ||
$test[] = "ABC9"; | ||
$test[] = "aBcF4"; | ||
$test[] = "0123456789ABCDEFabcdef"; | ||
$test[] = "034DEFa5612789ABCbcdef"; | ||
$test[] = "012djgfbbku3456789ABCDEFabcdef"; | ||
|
||
|
||
echo "ctype_space()"."<br />"; | ||
foreach ($test as $a) | ||
{ | ||
echo $a . " : " . ((my_ctype_space($a)) ? "true" : "false") ." : " . ((ctype_space($a)) ? "true" : "false") ."<br />"; | ||
} | ||
|
||
|
||
echo "ctype_xdigit()"."<br />"; | ||
foreach ($test as $a) | ||
{ | ||
echo $a . " : " . ((my_ctype_xdigit($a)) ? "true" : "false"). " : " . ((ctype_xdigit($a)) ? "true" : "false") ."<br />"; | ||
} | ||
|
||
echo "ctype_alpha()"."<br />"; | ||
foreach ($test as $a) | ||
{ | ||
echo $a . " : " . ((my_ctype_alpha($a)) ? "true" : "false") ." : " . ((ctype_alpha($a)) ? "true" : "false") ."<br />"; | ||
} | ||
|
||
?> |