[Phpfreechat-svn] SF.net SVN: phpfreechat: [977] trunk
Status: Beta
Brought to you by:
kerphi
|
From: <ke...@us...> - 2007-02-20 17:54:01
|
Revision: 977
http://svn.sourceforge.net/phpfreechat/?rev=977&view=rev
Author: kerphi
Date: 2007-02-20 09:53:57 -0800 (Tue, 20 Feb 2007)
Log Message:
-----------
[en] Makes compatible csstidy and php without ctype enabled (thanks to Andreas) [0h40]
[fr] Rend compatible la librairie csstidy pour les installations de php n'ayant pas le module ctype (merci ?\195?\160 Andreas) [0h40]
Modified Paths:
--------------
trunk/src/phpfreechat.class.php
Added Paths:
-----------
trunk/lib/ctype/
trunk/lib/ctype/ctype.php
trunk/testcase/ctype.php
Added: trunk/lib/ctype/ctype.php
===================================================================
--- trunk/lib/ctype/ctype.php (rev 0)
+++ trunk/lib/ctype/ctype.php 2007-02-20 17:53:57 UTC (rev 977)
@@ -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);
+ }
+}
+
+?>
\ No newline at end of file
Modified: trunk/src/phpfreechat.class.php
===================================================================
--- trunk/src/phpfreechat.class.php 2007-02-20 17:19:29 UTC (rev 976)
+++ trunk/src/phpfreechat.class.php 2007-02-20 17:53:57 UTC (rev 977)
@@ -381,6 +381,7 @@
$js = '';//file_get_contents(dirname(__FILE__).'/client/createstylerule.js');
$js .= 'var c = $H();';
$path = $c->getFilePathFromTheme('style.css.php');
+ require_once dirname(__FILE__).'/../lib/ctype/ctype.php'; // to keep compatibility for php without ctype support
require_once dirname(__FILE__).'/../lib/csstidy-1.2/class.csstidy.php';
$css = new csstidy();
$css->set_cfg('preserve_css',false);
Added: trunk/testcase/ctype.php
===================================================================
--- trunk/testcase/ctype.php (rev 0)
+++ trunk/testcase/ctype.php 2007-02-20 17:53:57 UTC (rev 977)
@@ -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 />";
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|