Created
November 16, 2014 00:59
-
-
Save quilime/975b1dca8268008c6b0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_patches($dir){ | |
global $c, $inc, $offset_left, $offset_top; | |
$dir_array = []; | |
$inc = 0; | |
$path = realpath($dir); | |
//$dirs = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS); | |
$dirs = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS); | |
$objects = new RecursiveIteratorIterator($dirs, RecursiveIteratorIterator::SELF_FIRST); | |
$section = basename($dir); | |
// script_header($section); | |
// filter unique paths: loop through all objects and store names in dir_array | |
foreach($objects as $name => $object){ | |
if($object->isDir() && $object->getBasename()[0] != '.'){ | |
array_push($dir_array, $name); | |
} | |
} | |
array_push($dir_array, $dir); | |
print_r($dir_array); | |
//check for banner/badges for each folder as a recursive process with filtered array of paths | |
for($i = 0; $i < count($dir_array); $i++){ | |
foreach(new DirectoryIterator($dir_array[$i]) as $file) { | |
$basename = $file->getBasename(); | |
if($file->isFile() && $basename != '.') { | |
echo 'basename: ' . $basename . "\n"; | |
echo 'path: ' . $file->getPath() . "\n"; | |
} | |
} | |
} | |
} | |
$result = get_patches('CNMAT-MMJ-Depot-master/examples/demos/'); | |
print_r($result); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment