summaryrefslogtreecommitdiff
path: root/lib/plugins/config
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2013-02-18 14:49:42 +0000
committerChristopher Smith <chris@jalakai.co.uk>2013-02-18 14:49:42 +0000
commitc89ab3e93dc9b6fadb29518a47e4b32a49666729 (patch)
treee83f3baa6971eb90b4abcb713ab4f575a9ef500a /lib/plugins/config
parent51de8ca123f3789b5a6a98852fd9a8c4b938873b (diff)
downloadrpg-c89ab3e93dc9b6fadb29518a47e4b32a49666729.tar.gz
rpg-c89ab3e93dc9b6fadb29518a47e4b32a49666729.tar.bz2
remove php_strip_whitespace() alternate, no longer required as php min req't ensures its always present
Diffstat (limited to 'lib/plugins/config')
-rw-r--r--lib/plugins/config/settings/config.class.php94
1 files changed, 0 insertions, 94 deletions
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index e5e09d8f8..427178c40 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -1083,97 +1083,3 @@ if (!class_exists('setting_multicheckbox')) {
}
}
}
-
-/**
- * Provide php_strip_whitespace (php5 function) functionality
- *
- * @author Chris Smith <chris@jalakai.co.uk>
- */
-if (!function_exists('php_strip_whitespace')) {
-
- if (function_exists('token_get_all')) {
-
- if (!defined('T_ML_COMMENT')) {
- define('T_ML_COMMENT', T_COMMENT);
- } else {
- define('T_DOC_COMMENT', T_ML_COMMENT);
- }
-
- /**
- * modified from original
- * source Google Groups, php.general, by David Otton
- */
- function php_strip_whitespace($file) {
- if (!@is_readable($file)) return '';
-
- $in = join('',@file($file));
- $out = '';
-
- $tokens = token_get_all($in);
-
- foreach ($tokens as $token) {
- if (is_string ($token)) {
- $out .= $token;
- } else {
- list ($id, $text) = $token;
- switch ($id) {
- case T_COMMENT : // fall thru
- case T_ML_COMMENT : // fall thru
- case T_DOC_COMMENT : // fall thru
- case T_WHITESPACE :
- break;
- default : $out .= $text; break;
- }
- }
- }
- return ($out);
- }
-
- } else {
-
- function is_whitespace($c) { return (strpos("\t\n\r ",$c) !== false); }
- function is_quote($c) { return (strpos("\"'",$c) !== false); }
- function is_escaped($s,$i) {
- $idx = $i-1;
- while(($idx>=0) && ($s{$idx} == '\\')) $idx--;
- return (($i - $idx + 1) % 2);
- }
-
- function is_commentopen($str, $i) {
- if ($str{$i} == '#') return "\n";
- if ($str{$i} == '/') {
- if ($str{$i+1} == '/') return "\n";
- if ($str{$i+1} == '*') return "*/";
- }
-
- return false;
- }
-
- function php_strip_whitespace($file) {
-
- if (!@is_readable($file)) return '';
-
- $contents = join('',@file($file));
- $out = '';
-
- $state = 0;
- for ($i=0; $i<strlen($contents); $i++) {
- if (!$state && is_whitespace($contents{$i})) continue;
-
- if (!$state && ($c_close = is_commentopen($contents, $i))) {
- $c_open_len = ($contents{$i} == '/') ? 2 : 1;
- $i = strpos($contents, $c_close, $i+$c_open_len)+strlen($c_close)-1;
- continue;
- }
-
- $out .= $contents{$i};
- if (is_quote($contents{$i})) {
- if (($state == $contents{$i}) && !is_escaped($contents, $i)) { $state = 0; continue; }
- if (!$state) {$state = $contents{$i}; continue; }
- }
- }
-
- return $out;
- }
- }
-}