本文整理汇总了PHP中rglob函数的典型用法代码示例。如果您正苦于以下问题:PHP rglob函数的具体用法?PHP rglob怎么用?PHP rglob使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rglob函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootPackage
function bootPackage($package)
{
$booters = rglob('*.php', 0, base_path('vendor/' . $package . '/src/boot'));
foreach ($booters as $booter) {
include_once $booter;
}
}
示例2: rglob
/**
*
*
* Recursive glob()
*
* @access public
* @package Utils
* @category Files
*
* @uses is_array()
* @param int|string $pattern
* the pattern passed to glob()
* @param int $flags
* the flags passed to glob()
* @param string $path
* the path to scan
* @return mixed
* an array of files in the given path matching the pattern.
*/
function rglob($pattern = '*', $flags = 0, $path = '')
{
if (!$path && ($dir = dirname($pattern)) != '.') {
if ($dir == '\\' || $dir == '/') {
$dir = '';
}
return rglob(basename($pattern), $flags, $dir . DS);
}
$path = normalize_path($path, 1);
$paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($path . $pattern, $flags);
if (is_array($paths)) {
foreach ($paths as $p) {
$temp = rglob($pattern, false, $p . DS);
if (is_array($temp) and is_array($files) and !empty($files)) {
$files = array_merge($files, $temp);
} else {
if (is_array($temp) and !empty($temp)) {
$files = $temp;
}
}
}
}
return $files;
}
示例3: rglob
function rglob($pattern, $files = 1, $dirs = 0, $flags = 0)
{
$dirname = dirname($pattern);
$basename = basename($pattern);
$glob = glob($pattern, $flags);
$files = array();
$dirlist = array();
foreach ($glob as $path) {
if (is_file($path) && !$files) {
continue;
}
if (is_dir($path)) {
$dirlist[] = $path;
if (!$dirs) {
continue;
}
}
$files[] = $path;
}
foreach (glob("{$dirname}/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
$dirfiles = rglob($dir . '/' . $basename, $files, $dirs, $flags);
$files = array_merge($files, $dirfiles);
}
return $files;
}
示例4: larakitRegisterMenuSubpages
static function larakitRegisterMenuSubpages($package, $alias)
{
//автоматическая регистрация дочерних страниц Subpages
$dir = base_path('vendor/' . $package . '/src/config/larakit/subpages/');
$dir = HelperFile::normalizeFilePath($dir);
if (file_exists($dir)) {
$dirs = rglob('*.php', 0, $dir);
foreach ($dirs as $d) {
$d = str_replace($dir, '', $d);
$d = str_replace('.php', '', $d);
$d = trim($d, '/');
$menus_subpages = (array) \Config::get($alias . '::larakit/subpages/' . $d);
if (count($menus_subpages)) {
foreach ($menus_subpages as $page => $items) {
$manager = \Larakit\Widget\WidgetSubpages::factory($page);
foreach ($items as $as => $props) {
$style = Arr::get($props, 'style', 'bg-aqua');
$is_curtain = Arr::get($props, 'is_curtain', false);
$manager->add($as, $style, $is_curtain);
}
}
}
}
}
}
示例5: rglob
function rglob($pattern, $flags = 0)
{
$files = preg_grep('/vendor/', glob($pattern, $flags), PREG_GREP_INVERT);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
$files = array_merge($files, rglob($dir . '/' . basename($pattern), $flags));
}
return $files;
}
示例6: rglob
function rglob($pattern, $flags = 0)
{
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
$files = array_merge($files, rglob($dir . '/' . basename($pattern), $flags));
}
return $files;
}
示例7: rglob
/**
* 递归返回指定目录,指定样式文件
*
* @param string $pattern 文件模板
* @param int $flags 修改标志
* @param string $path 路径
* @return array 文件名路径数组
*/
function rglob($pattern = '*', $flags = 0, $path = '')
{
$paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($path . $pattern, $flags);
foreach ($paths as $path) {
$files = array_merge($files, rglob($pattern, $flags, $path));
}
return $files;
}
示例8: rglob
function rglob($pattern, $flags = 0, $path = '') {
if (!$path && ($dir = dirname($pattern)) != '.') {
if ($dir == '\\' || $dir == '/') $dir = '';
return rglob(basename($pattern), $flags, $dir . '/');
}
$paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($path . $pattern, $flags);
foreach ($paths as $p) $files = array_merge($files, rglob($pattern, $flags, $p . '/'));
return $files;
}
示例9: init_package
static function init_package($package, $dir = 'init')
{
$path = dirname(dirname(dirname(__DIR__))) . '/' . $package . '/src/' . $dir;
if (file_exists($path)) {
$inits = rglob('*.php', 0, $path);
foreach ($inits as $init) {
include_once $init;
}
}
}
示例10: test
public function test()
{
$ret = rglob(ROOT_PATH . '/*.php');
assert(1 < count($ret));
assertEquals('autoload.php', basename($ret[0]));
$ret = rglob(ROOT_PATH . '/*.php', 0, RGLOB_UP);
assert(1 < count($ret));
assertNotEquals('autoload.php', basename($ret[0]));
assertEquals('autoload.php', basename($ret[count($ret) - 1]));
}
示例11: rglob
function rglob($dir, $pattern = '*', $flags = 0)
{
$paths = glob($dir . DIRECTORY_SEPARATOR . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($dir . DIRECTORY_SEPARATOR . $pattern, $flags);
foreach ($paths as $path) {
if ($path != '.' && $path != '..') {
$files = array_merge($files, rglob($path, $pattern, $flags));
}
}
return $files;
}
示例12: rglob
function rglob($pattern, $flags = 0)
{
// Funcion para hacer un glob() recursivo. Tomado de:
// http://stackoverflow.com/a/17161106
$files = glob($pattern, $flags);
//foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
foreach (glob(dirname($pattern) . '/*') as $dir) {
$files = array_merge($files, rglob($dir . '/' . basename($pattern), $flags));
}
return $files;
}
示例13: AllTests
function AllTests()
{
$this->TestSuite('Tutti i tests');
// Considera solamente queste cartelle quando si cerca per i files di test
$paths = array("core", "restful");
foreach ($paths as $path) {
foreach (rglob(ROOT_PATH . "{$path}/*/*Test.php") as $filename) {
$this->addFile($filename);
}
}
}
示例14: rglob
function rglob($pattern, $flags = 0)
{
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
// avoid auto-removing the database
if (strpos($dir, "malicious_code") === false) {
$files = array_merge($files, rglob($dir . '/' . basename($pattern), $flags));
}
}
return $files;
}
示例15: rglob
function rglob($pattern = '*', $flags = 0, $path = false)
{
if (!$path) {
$path = dirname($pattern) . DIRECTORY_SEPARATOR;
}
$pattern = basename($pattern);
$paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
$files = glob($path . $pattern, $flags);
foreach ($paths as $path) {
$files = array_merge($files, rglob($pattern, $flags, $path));
}
return $files;
}