本文整理汇总了PHP中glob_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP glob_recursive函数的具体用法?PHP glob_recursive怎么用?PHP glob_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了glob_recursive函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pestle_cli
/**
*
* @command check_class_and_namespace
*/
function pestle_cli($argv)
{
$path = inputOrIndex('Which folder?', '/path/to/magento/app/code/Pulsestorm', $argv, 0);
$files = glob_recursive($path . '/*');
foreach ($files as $file) {
$file = realpath($file);
if (strpos($file, '.php') === false) {
output("NOT .php: Skipping {$file}");
continue;
}
$contents = file_get_contents($file);
$namespace = parseNamespace($contents);
if (!$namespace) {
output("No Namspace: Skipping {$file}");
continue;
}
$class = parseClass($contents);
if (!$class) {
output("No Class: Skipping {$class}");
continue;
}
$full_class = $namespace . '\\' . $class;
$path = str_replace('\\', '/', $full_class) . '.php';
if (strpos($file, $path) === false) {
output("ERROR: Path `{$path}` not in");
output($file);
} else {
output('.');
}
}
}
示例2: glob_recursive
function glob_recursive($directory, &$directories = array())
{
foreach (glob($directory, GLOB_ONLYDIR | GLOB_NOSORT) as $folder) {
$directories[] = $folder;
glob_recursive("{$folder}/*", $directories);
}
}
示例3: glob_recursive
function glob_recursive($pattern, $flags = 0)
{
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
$files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags));
}
return $files;
}
示例4: glob_recursive
function glob_recursive($pattern, $flags = 0)
{
//http://www.php.net/manual/en/function.glob.php#106595
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
$files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags));
}
return $files;
}
示例5: getMenuXmlFiles
function getMenuXmlFiles()
{
$base = getBaseMagentoDir();
// $results = `find $base/vendor -name menu.xml`;
// $results = explode("\n", $results);
$results = glob_recursive("{$base}/vendor/menu.xml");
$results = array_filter($results);
return $results;
}
示例6: getAllControllerFiles
function getAllControllerFiles($base)
{
$files = glob($base . '/*');
$controllers = array_filter($files, function ($item) {
return is_dir($item . '/Controller/');
});
$controllers = array_map(function ($item) {
return glob_recursive($item . '/Controller/*.php');
}, $files);
return $controllers;
}
示例7: getFiles
function getFiles($folder, $extension_string)
{
if (file_exists($folder) && !is_dir($folder)) {
return [$folder];
}
$extensions = array_filter(explode(',', $extension_string));
$files = [];
foreach ($extensions as $extension) {
$files = array_merge($files, glob_recursive($folder . '/*.' . $extension));
}
return $files;
}
示例8: theme_manifest
public function theme_manifest()
{
$this->line("");
$this->comment("Theme Manifest");
$theme_folder = get_theme_root() . "/" . get_stylesheet();
$asset_folder = "/public";
$uri_path = $theme_folder . $asset_folder;
$files_array = glob_recursive($uri_path . "/*.*", GLOB_ERR);
$files_array = array_map(array($this, 'root_to_relative_url'), $files_array);
foreach ($files_array as $file) {
$this->line($file);
}
}
示例9: glob_recursive
function glob_recursive($pattern, $flags = 0, $prefix_remove = false, $prefix_add = "")
{
//http://www.php.net/manual/en/function.glob.php#106595
$files = glob($pattern, $flags);
$prefix_remove_len = $prefix_remove ? strlen($prefix_remove) : 0;
foreach ($files as $k => $file) {
$files[$k] = $prefix_add . substr($file, $prefix_remove_len);
}
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
$files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags, $prefix_remove, $prefix_add));
}
return $files;
}
示例10: get_theme_files
function get_theme_files($extension = 'php', $directory = '/')
{
$theme_dir = CMS_ROOT . 'themes/' . $this->settings->theme . '/';
$pattern = $theme_dir . trim($directory, '/') . '/*.' . $extension;
$file_array = array();
$files = glob_recursive($pattern, GLOB_BRACE);
foreach ($files as $file) {
$relative_path = str_replace(dirname($pattern) . '/', '', $file);
$theme_path = str_replace($theme_dir, '', $file);
$file_array[$relative_path] = array('hash' => url_base64_encode($theme_path), 'theme_path' => $theme_path, 'relative_path' => $relative_path, 'title' => ucwords(str_replace(array('_', '-'), ' ', basename($file, '.' . $extension))));
}
return $file_array;
}
示例11: getUsedAclRuleIdsFromControllerFiles
function getUsedAclRuleIdsFromControllerFiles($dir)
{
$files = glob_recursive($dir . '/*/Controller/*.php');
$code = array_map(function ($file) {
$function = getFunctionFromCode(file_get_contents($file), '_isAllowed');
if (strpos($function, '_isAllowed')) {
return getAclRulesFromIsAllowedFunction($function);
}
return false;
}, $files);
$code = array_filter($code);
return $code;
}
示例12: testLintErrors
function testLintErrors() {
$exit = 0;
$root = get_osticket_root_path();
foreach (glob_recursive("$root/*.js") as $s) {
ob_start();
system("jsl -process $s", $exit);
$line = ob_get_contents();
ob_end_clean();
if ($exit == 3)
$this->fail($s, 0, $line);
else
$this->pass();
}
}
示例13: glob_recursive
function glob_recursive($pattern, $flags = 0)
{
$files = glob($pattern, $flags);
$dirs = glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT);
if (is_array($files) && !empty($dirs)) {
foreach ($dirs as $dir) {
$_files = glob_recursive($dir . '/' . basename($pattern), $flags);
if (is_array($_files)) {
$files = array_merge($files, $_files);
}
}
}
return $files;
}
示例14: glob_recursive
function glob_recursive($pattern, $int_flags = 0)
{
$files = glob($pattern, $int_flags);
if (!$files) {
$files = array();
}
foreach ($files as $k => $filename) {
if (is_dir($filename)) {
unset($files[$k]);
$subfiles = glob_recursive($filename . '/*', $int_flags);
$files = array_merge($files, $subfiles);
}
}
return $files;
}
示例15: get_tpl_contents
function get_tpl_contents($theme = 'default')
{
require DATA_PATH . 'themes/' . $theme . '/info.php';
$pfiles = array();
if (isset($info['parent_theme'])) {
$pfiles = glob_recursive(DATA_PATH . 'themes/' . $info['parent_theme'] . '/*.tpl');
}
$cfiles = glob_recursive(DATA_PATH . 'themes/' . $theme . '/*.tpl');
$files = array_merge($pfiles, $cfiles);
$tcontent = "";
foreach ($files as $file) {
$tcontent .= file_get_contents($file);
}
return $tcontent;
}