To. 'include_once' => 'include', 'require_once' => 'require', ); // Replace using a regex (still uses the $replace array) $replace_regex = false; // Use
$pre = false;
### STOP EDITING HERE ###
scandir__recursive(dirname(__FILE__));
output();
function output()
{
global $array, $unique, $space_to_tabs, $sort, $display_type;
if ($unique)
$array = array_unique($array);
if ($sort == 'sort')
sort($array);
elseif($sort == 'ksort')
ksort($array);
ob_start();
if ($pre)
echo '';
if ($display_type == 'print_r')
print_r($array);
elseif($display_type == 'var_dump')
echo var_dump($array);
elseif($display_type == 'echo')
echo $array;
if ($pre)
echo '
';
$contents = ob_get_contents();
if ($spaces_to_tabs)
$contents = str_replace(' ', ' ', $contents);
ob_end_clean();
echo $contents;
}
function scandir__recursive($dir)
{
global $array, $do_function, $return;
$array = $return = array();
$opendir = scandir($dir);
foreach ($opendir as $file)
{
$full_path = $dir . '/' . $file;
// Current directory, parent directory, and .htaccess are not useful.
if (substr($file, 0, 1) == '.' || $full_path == __FILE__)
continue;
// This is another directory.
if (is_dir(str_replace('\\', '/', $full_path)))
{
$return[] = scandir__recursive($full_path);
}
else
{
$return[] = $file;
$source = file_get_contents($full_path);
$do_function($full_path, $source);
}
}
}
function loop_matches($matches)
{
global $array, $per_file;
if (!empty($matches[1]))
{
foreach ($matches[1] as $key => $match)
{
if ($per_file)
{
if (!isset($array[$match]))
$array[$match] = array();
if (!$unique || (isset($array[$match]) && !in_array($file, $array[$match])))
$array[$match][] = $file;
}
else
$array[] = $match;
}
}
}
function get_var($full_path, $source)
{
global $match;
//preg_match_all('/\$modSettings\[\'(.+?)\'\]/', $source, $matches);
preg_match_all('/\$' . $match . '\[\'(.+?)\'\]/', $source, $matches);
loop_matches($matches);
}
function get_func($full_path, $source)
{
global $match;
preg_match_all('/' . $match . '\(\'(.+?)\'\)/', $source, $matches);
loop_matches($matches);
}
function replace($full_path, $source)
{
global $replace, $replace_regex;
if ($replace_regex)
file_put_contents($full_path, preg_replace(array_keys($replace), array_values($replace), $source));
else
file_put_contents($full_path, strtr($source, $replace));
}
?>