Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter by path? #4

Open
Moelf opened this issue Jun 22, 2022 · 1 comment
Open

filter by path? #4

Moelf opened this issue Jun 22, 2022 · 1 comment

Comments

@Moelf
Copy link

Moelf commented Jun 22, 2022

I like putting the index.php in a folder with other folders. Is it possible for a patter like fold1/blah* to only match blah* inside fold1?

@aminnj
Copy link
Owner

aminnj commented Jun 22, 2022

Possible, but because my webdev experience doesn't go beyond stack overflow copy-paste, there's 3 places to make modifications to suppress subdirectory stuff

--- ../index.php	2022-06-22 17:03:19.000000000 -0500
+++ index.php	2022-06-22 17:22:55.000000000 -0500
@@ -162,6 +162,8 @@
     foreach ( $dir as $node ) {
         if (strpos($node->getFilename(), '.php') !== false) continue;
         if( $node->isDot() ) continue;
+        if ( $theParent != "#" ) continue;
+        if ( $node->isDir() ) continue;
         if ( $node->isDir()) fillArrayWithFileNodes( new DirectoryIterator( $node->getPathname() ), $node->getPathname() );

         $tmp = array(
@@ -182,12 +184,16 @@
     RecursiveIteratorIterator::CATCH_GET_CHILD
 );
 $paths = array('.');
-foreach ($iter as $path => $dir) $paths[] = $path;
+foreach ($iter as $path => $dir) {
+    if ( substr_count($path, '/') > 1 ) continue;
+    $paths[] = $path;
+}

 // get number of directories
 $num_directories = 0;
 foreach ( (new DirectoryIterator('.')) as $node ) {
     if( $node->isDot() ) continue;
+    if ( $node->isDir()) continue;
     if ( $node->isDir()) $num_directories += 1;
 }
 ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants