4 chdir(dirname(__FILE__));
5 require_once
'common.php';
6 require_once
'../library/HTMLPurifier.auto.php';
9 if (version_compare(PHP_VERSION,
'5.2.2',
'<')) {
10 echo "This script requires PHP 5.2.2 or later, for tokenizer line numbers.";
24 chdir(dirname(__FILE__) .
'/../library/');
28 $file = substr($file, 2);
29 if (strncmp(
'standalone/', $file, 11) === 0)
continue;
30 if (substr_count($file,
'.') > 1)
continue;
39 do {$i++;}
while (is_array($tokens[$i]) && $tokens[$i][0] === T_WHITESPACE);
49 function testToken($token, $value_or_token, $value = null)
51 if (is_null($value)) {
52 if (is_int($value_or_token))
return is_array($token) && $token[0] === $value_or_token;
53 else return $token === $value_or_token;
55 return is_array($token) && $token[0] === $value_or_token && $token[1] === $value;
64 $tokens = token_get_all(file_get_contents($file));
65 $file = str_replace(
'\\',
'/', $file);
66 for ($i = 0, $c = count($tokens); $i < $c; $i++) {
71 while (!
$ok &&
testToken($tokens[$i], T_VARIABLE,
'$this')) {
73 if (!
testToken($tokens[$i], T_OBJECT_OPERATOR))
break;
75 if (
testToken($tokens[$i], T_STRING,
'config'))
$ok =
true;
81 for($i++; $i < $c; $i++) {
82 if ($tokens[$i] ===
',' || $tokens[$i] ===
')' || $tokens[$i] ===
';') {
85 if (is_string($tokens[$i]))
continue;
86 if ($tokens[$i][0] === T_OBJECT_OPERATOR) {
93 $line = $tokens[$i][2];
96 if (!
testToken($tokens[$i], T_STRING,
'get'))
continue;
99 if (!
testToken($tokens[$i],
'('))
continue;
112 if (!
testToken($tokens[$i], T_CONSTANT_ENCAPSED_STRING))
continue;
113 $id = substr($tokens[$i][1], 1, -1);
128 echo "\n$counter/$full_counter instances of \$config or \$this->config found in source code.\n";
130 echo "Generating XML... ";
133 $xw->openURI(
'../configdoc/usage.xml');
134 $xw->setIndent(
true);
135 $xw->startDocument(
'1.0',
'UTF-8');
136 $xw->startElement(
'usage');
138 $xw->startElement(
'directive');
139 $xw->writeAttribute(
'id', $id);
140 foreach (
$files as $file => $lines) {
141 $xw->startElement(
'file');
142 $xw->writeAttribute(
'name', $file);
143 foreach ($lines as $line) {
144 $xw->writeElement(
'line', $line);
Create styles array
The data for the language used.
foreach($raw_files as $file) consumeWhitespace($tokens, &$i)
Moves the $i cursor to the next non-whitespace token.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
testToken($token, $value_or_token, $value=null)
Tests whether or not a token is a particular type.