lib/ezutils/classes/ezsys.php
protected static function simulateGlobBrace( $filenames )
    {
       $result = array();

       foreach ( $filenames as $filename )
       {
           if ( strpos( $filename, '{' ) === false )
           {
               $result[] = $filename;
               continue;
           }

           if ( preg_match( '/^(.*)\{(.*?)(?<!\\\\)\}(.*)$/', $filename, $match ) )
           {
               $variants = preg_split( '/(?<!\\\\),/', $match[2] );

               $newFilenames = array();
               foreach ( $variants as $variant )
               {
                   $newFilenames[] = $match[1] . $variant . $match[3];
               }

               $newFilenames = self::simulateGlobBrace( $newFilenames );
               $result = array_merge( $result, $newFilenames );
           }
           else
           {
               $result[] = $filename;
           }
       }

       return $result;
    }
protected static function simulateGlobBrace( $filenames )
    {
       $result = array();

       foreach ( $filenames as $filename )
       {
           if ( strpos( $filename, '{' ) === false )
           {
               $result[] = $filename;
               continue;
           }

           if ( preg_match( '/^(.*)\{(.*?)(?<!\\\\)\}(.*)$/', $filename, $match ) )
           {
               $variants = preg_split( '/(?<!\\\\),/', $match[2] );

               $newFilenames = array();
               foreach ( $variants as $variant )
               {
                   $newFilenames[] = $match[1] . $variant . $match[3];
               }

               $newFilenames = self::simulateGlobBrace( $newFilenames );
               $result = array_merge( $result, $newFilenames );
           }
           else
           {
               $result[] = $filename;
           }
       }

       return $result;
    }
protected static function simulateGlobBrace ( $ filenames ) { $ result = array ( ) ; foreach ( $ filenames as $ filename ) { if ( strpos ( $ filename , '{' ) === false ) { $ result [ ] = $ filename ; continue ; } if ( preg_match ( '/^(.*)\{(.*?)(?<!\\\\)\}(.*)$/' , $ filename , $ match ) ) { $ variants = preg_split ( '/(?<!\\\\),/' , $ match [ 2 ] ) ; $ newFilenames = array ( ) ; foreach ( $ variants as $ variant ) { $ newFilenames [ ] = $ match [ 1 ] . $ variant . $ match [ 3 ] ; } $ newFilenames = self :: simulateGlobBrace ( $ newFilenames ) ; $ result = array_merge ( $ result , $ newFilenames ) ; } else { $ result [ ] = $ filename ; } } return $ result ; }
Expands a list of filenames like GLOB_BRACE does.

GLOB_BRACE is non POSIX and only available in GNU glibc. This is needed to
support operating systems like Solars.

@param $filenames
@return array
Expands a list of filenames like GLOB_BRACE does .