Lines Matching refs:opts

23  * @param   array     $opts option array will be given to the Callback
30 function search(&$data, $base, $func, $opts, $dir = '', $lvl = 1, $sort = 'natural')
65 if (call_user_func_array($func, [&$data, $base, $dir, 'd', $lvl, $opts])) {
66 search($data, $base, $func, $opts, $dir, $lvl + 1, $sort);
71 call_user_func_array($func, [&$data, $base, $file, 'f', $lvl, $opts]);
87 * array $opts - option array as given to search()
108 * @param array $opts
112 function search_qsearch(&$data, $base, $file, $type, $lvl, $opts)
114 $opts = [
115 'idmatch' => '(^|:)' . preg_quote($opts['query'], '/') . '/',
119 return search_universal($data, $base, $file, $type, $lvl, $opts);
125 * $opts['ns'] is the currently viewed namespace
134 * @param array $opts
138 function search_index(&$data, $base, $file, $type, $lvl, $opts)
141 $ns = $opts['ns'] ?? '';
142 $opts = [
145 'listfiles' => empty($opts['nofiles']),
151 return search_universal($data, $base, $file, $type, $lvl, $opts);
164 * @param array $opts
168 function search_namespaces(&$data, $base, $file, $type, $lvl, $opts)
170 $opts = ['listdirs' => true];
171 return search_universal($data, $base, $file, $type, $lvl, $opts);
176 * $opts['depth'] recursion level, 0 for all
177 * $opts['showmsg'] shows message if invalid media id is used
178 * $opts['skipacl'] skip acl checking
179 * $opts['pattern'] check given pattern
180 * $opts['hash'] add hashes to result list
189 * @param array $opts
193 function search_media(&$data, $base, $file, $type, $lvl, $opts)
198 if (empty($opts['depth'])) return true; // recurse forever
200 if ($depth >= $opts['depth']) return false; // depth reached
207 if (!empty($opts['showmsg']))
214 if (empty($opts['skipacl']) && $info['perm'] < AUTH_READ) {
219 if (!empty($opts['pattern']) && !@preg_match($opts['pattern'], $info['id'])) {
233 if (!empty($opts['hash'])) {
244 * $opts['depth'] recursion level, 0 for all
245 * $opts['showmsg'] shows message if invalid media id is used
246 * $opts['skipacl'] skip acl checking
247 * $opts['pattern'] check given pattern
248 * $opts['hash'] add hashes to result list
257 * @param array $opts
261 function search_mediafiles(&$data, $base, $file, $type, $lvl, $opts)
266 if (empty($opts['depth'])) return true; // recurse forever
268 if ($depth >= $opts['depth']) return false; // depth reached
274 if ($opts['showmsg'])
281 if (empty($opts['skipacl']) && $info['perm'] < AUTH_READ) {
286 if (!empty($opts['pattern']) && !@preg_match($opts['pattern'], $id)) {
305 * @param array $opts
309 function search_list(&$data, $base, $file, $type, $lvl, $opts)
328 * $opts['query'] is the search query
337 * @param array $opts
341 function search_pagename(&$data, $base, $file, $type, $lvl, $opts)
349 if (!empty($opts['query'])) {
350 if (strpos($file, (string) $opts['query']) !== false) {
365 * $opts['depth'] recursion level, 0 for all
366 * $opts['hash'] do md5 sum of content?
367 * $opts['skipacl'] list everything regardless of ACL
376 * @param array $opts
380 function search_allpages(&$data, $base, $file, $type, $lvl, $opts)
382 if (($opts['depth'] ?? 0) > 0) {
385 ($type == 'd' && count($parts) >= $opts['depth'])
386 || ($type != 'd' && count($parts) > $opts['depth'])
402 if (empty($opts['skipacl']) && auth_quickaclcheck($item['id']) < AUTH_READ) {
409 if (!empty($opts['hash'])) {
469 * How the function behaves, depends on the options passed in the $opts
495 * @param array $opts - option array as given to search()
501 function search_universal(&$data, $base, $file, $type, $lvl, $opts)
507 $item['id'] = pathID($file, ($type == 'd' || !empty($opts['keeptxt'])));
509 if (!empty($opts['showmsg'])) {
518 if (empty($opts['depth'])) {
522 if ($depth >= $opts['depth']) {
530 $match = empty($opts['recmatch']) || preg_match('/' . $opts['recmatch'] . '/', $file);
538 if (empty($opts['skipacl'])) {
550 if (empty($opts['listdirs'])) return $return;
552 if (empty($opts['skipacl']) && !empty($opts['sneakyacl']) && $item['perm'] < AUTH_READ) return false;
553 if (!empty($opts['dirmatch']) && !preg_match('/' . $opts['dirmatch'] . '/', $file)) return $return;
554 if (!empty($opts['nsmatch']) && !preg_match('/' . $opts['nsmatch'] . '/', $item['ns'])) return $return;
556 if (empty($opts['listfiles'])) return $return;
557 if (empty($opts['skipacl']) && $item['perm'] < AUTH_READ) return $return;
558 if (!empty($opts['pagesonly']) && !str_ends_with($file, '.txt')) return $return;
559 if (empty($opts['showhidden']) && isHiddenPage($item['id'])) return $return;
560 if (!empty($opts['filematch']) && !preg_match('/' . $opts['filematch'] . '/', $file)) return $return;
561 if (!empty($opts['idmatch']) && !preg_match('/' . $opts['idmatch'] . '/', $item['id'])) return $return;
569 if (!empty($opts['meta'])) {
579 if (!empty($opts['hash'])) $item['hash'] = md5(io_readFile($base . '/' . $file, false));
580 if (!empty($opts['firsthead'])) $item['title'] = p_get_first_heading($item['id'], METADATA_DONT_RENDER);