Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/scan.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/scan.php,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/scan.php 2 Nov 2005 08:56:26 -0000 1.1 +++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Linker/scan.php 2 Feb 2007 21:05:02 -0000 1.2 @@ -1,12 +1,23 @@ $v) - { - $i = ""; - if($useObject) { - if(preg_match('#[a-zA-Z]+[a-zA-Z0-9]*#', $k)) { - $i .= "$k: "; - } else { - $i .= "'$k': "; - } - } - $i .= to_js($v, $tabs + 1); - $js[] = $i; - } - if($useObject) { - $ret = "{\n" . tabify(implode(",\n", $js), $tabs) . "\n}"; - } else { - $ret = "[\n" . tabify(implode(",\n", $js), $tabs) . "\n]"; - } - return $ret; - } - - return 'null'; - } - - function tabify($text, $tabs) - { - if($text) - { - return str_repeat(" ", $tabs) . preg_replace('/\n(.)/', "\n" . str_repeat(" ", $tabs) . "\$1", $text); - } - } - - function js_encode($string) - { - static $strings = "\\,\",',%,&,<,>,{,},@,\n,\r"; - - if(!is_array($strings)) - { - $tr = array(); - foreach(explode(',', $strings) as $chr) - { - $tr[$chr] = sprintf('\x%02X', ord($chr)); - } - $strings = $tr; - } - - return strtr($string, $strings); - } - - - echo to_js(scan($dir)); + + echo xinha_to_js(scan($dir)); ?>