|
| | $opts = getopt('fhnosv', ['filenames', 'help', 'non-recursive', 'occurences', 'matches', 'verbose']) |
| |
| if(isset($opts['h'])||isset($opts['help'])) | $args = $_SERVER['argv'] |
| |
| | $arg_stop = array_search('--', $args) |
| |
| if( $arg_stop !==false) elseif(count($opts)) | else |
| |
| | $verbose = isset($opts['v']) || isset($opts['verbose']) |
| |
| | $only_filenames = isset($opts['f']) || isset($opts['filenames']) |
| |
| | $show_occurences = $verbose || isset($opts['o']) || isset($opts['occurences']) |
| |
| | $show_matches = $show_occurences || isset($opts['m']) || isset($opts['matches']) |
| |
| | $recursive = !(isset($opts['n']) || isset($opts['recursive'])) |
| |
| | $folders = $args ?: [$GLOBALS['STUDIP_BASE_PATH']] |
| |
| | $log |
| |
| | $log_if |
| |
| | $highlight |
| |
| | $config = Config::get()->getFields('global') |
| |
| | $quoted = array_map(function ($item) { return preg_quote($item, '/'); }, $config) |
| |
| | $regexp = '/\$(?:GLOBALS\[["\']?)?(' . implode('|', $quoted) . ')\b/S' |
| |