当前位置: 首页>>代码示例>>PHP>>正文


PHP rscandir函数代码示例

本文整理汇总了PHP中rscandir函数的典型用法代码示例。如果您正苦于以下问题:PHP rscandir函数的具体用法?PHP rscandir怎么用?PHP rscandir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rscandir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createClassMappings

 /**
  * @static
  * @return array
  */
 public static function createClassMappings()
 {
     $modelsDir = PIMCORE_PATH . "/models/";
     $files = rscandir($modelsDir);
     $includePatterns = array("/Webservice\\/Data/");
     foreach ($files as $file) {
         if (is_file($file)) {
             $file = str_replace($modelsDir, "", $file);
             $file = str_replace(".php", "", $file);
             $class = str_replace(DIRECTORY_SEPARATOR, "_", $file);
             if (\Pimcore\Tool::classExists($class)) {
                 $match = false;
                 foreach ($includePatterns as $pattern) {
                     if (preg_match($pattern, $file)) {
                         $match = true;
                         break;
                     }
                 }
                 if (strpos($file, "Webservice" . DIRECTORY_SEPARATOR . "Data") !== false) {
                     $match = true;
                 }
                 if (!$match) {
                     continue;
                 }
                 $classMap[str_replace("\\Pimcore\\Model\\Webservice\\Data\\", "", $class)] = $class;
             }
         }
     }
     return $classMap;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:34,代码来源:Tool.php

示例2: rscandir

/**
 * recursive scandir extension
 * 
 * @param string $directory
 * @param mixed $filters - regex or array for filter patterns
 * @param array $excludes - exluded files or directories
 * @return array - array of founded files
 */
function rscandir($directory = '.', $filters = [], $excludes = [])
{
    $excludes = array_merge($excludes, ['.', '..']);
    if ($filters && is_array($filters)) {
        foreach ($filters as &$filter) {
            $filter = str_replace(['.', '*'], ['\\.', '(.*)'], $filter);
        }
        $filters = '/^(' . implode('|', $filters) . ')$/';
    }
    $files = scandir($directory);
    for ($i = 0; $i < count($files); $i++) {
        if (is_dir($directory . DIRECTORY_SEPARATOR . $files[$i]) && !in_array($files[$i], $excludes)) {
            $subfiles = rscandir($directory . DIRECTORY_SEPARATOR . $files[$i], $filters, $excludes);
            foreach ($subfiles as $subfile) {
                $addfile = $files[$i] . DIRECTORY_SEPARATOR . $subfile;
                if (!in_array($addfile, $files)) {
                    $files[] = $addfile;
                }
            }
        }
    }
    $ret = [];
    foreach ($files as $file) {
        if (!in_array($file, $excludes) && (is_dir($file) || !$filters || preg_match($filters, $file))) {
            $ret[] = $file;
        }
    }
    return $ret;
}
开发者ID:gymadarasz,项目名称:functions,代码行数:37,代码来源:rscandir.php

示例3: getHierarchy

	function getHierarchy ($titleSort=false) {
		
		$this->CI->load->helper(array('url', 'glib_directory', 'inflector'));
		
		$pathBase = realpath(APPPATH.'controllers'); 
		$pathThis = __FILE__;

		foreach (rscandir($pathBase) as $pathController) {
			if (
				($pathController != $pathThis) 
				&& (!strpos($pathController, 'index.html')) 
			) { 
				// Make Path Relative to Web Root
				$controller = rtrim(substr($pathController, strlen($pathBase) + 1 , -4 ), '/');
				
				// Clean The Default Controllers From The List
				$defaultController = $GLOBALS["CI"]->router->routes["default_controller"];
				if (strpos($controller,$defaultController)) $controller = 
					preg_replace("/\/$defaultController/i", "", $controller);
				elseif ($controller == $defaultController) $controller = '/';
				
				// Send As Output If Not a Private Controller
				if (substr($controller, 0, 1) != '_') {
					
					// Set The Title
					if ($controller == '/') {
						$title = 'Home';
					} else {
						$title = humanize(ltrim(substr($controller, strrpos($controller, '/')), '/'));
					}
					
					// Add The Directory
					$data["$controller"] = $title;
					
					// Get The Methods When Necessary
					if (!strpos($pathController, $defaultController.'.php')) {
						
						require_once $pathController;
						if (!strpos($controller, '/')) $className = $controller;
						else $className = substr($controller, strripos($controller, '/') + 1);

						$methods = $this->getMethods(ucfirst($className));
						foreach ($methods as $method) if ($method != 'index') {
							$data["$controller"] = $title;
						}
					}
					
				}
					 
			}
		}
		
		if ($titleSort) asort($data);
		else ksort($data);
		
		return $data;
		
	}	
开发者ID:G-LAB,项目名称:g-lib,代码行数:58,代码来源:Sitemap.php

示例4: OnScanDirectory

 public function OnScanDirectory($pData = null)
 {
     $Directory = $pData['Directory'];
     $Recursive = $pData['Recursive'];
     if ($Recursive == true) {
         $return = rscandir($Directory);
     } else {
         $return = scandir($Directory);
     }
     return $return;
 }
开发者ID:nguyennamtien,项目名称:appleseed,代码行数:11,代码来源:filesystem.php

示例5: indexAction

 public function indexAction()
 {
     $errors = [];
     // check permissions
     $files = rscandir(PIMCORE_WEBSITE_VAR . "/");
     foreach ($files as $file) {
         if (is_dir($file) && !is_writable($file)) {
             $errors[] = "Please ensure that the entire /" . PIMCORE_WEBSITE_VAR . " directory is recursively writeable.";
             break;
         }
     }
     $this->view->errors = $errors;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:13,代码来源:IndexController.php

示例6: indexAction

 public function indexAction()
 {
     $errors = array();
     // check permissions
     $files = rscandir(PIMCORE_WEBSITE_VAR . "/");
     foreach ($files as $file) {
         if (is_dir($file) && !is_writable($file)) {
             $errors[] = "Please ensure that the whole /" . PIMCORE_WEBSITE_VAR . " folder is writeable (recursivly)";
             break;
         }
     }
     $this->view->errors = $errors;
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:13,代码来源:IndexController.php

示例7: isWriteable

 /**
  * @return bool
  */
 public static function isWriteable()
 {
     if (self::$dryRun) {
         return true;
     }
     // check permissions
     $files = rscandir(PIMCORE_PATH . "/");
     foreach ($files as $file) {
         if (!is_writable($file)) {
             return false;
         }
     }
     return true;
 }
开发者ID:siite,项目名称:choose-sa-cloud,代码行数:17,代码来源:Update.php

示例8: rscandir

function rscandir($base='', &$data=array()) {
    $array = array_diff(scandir($base), array('.', '..', '.svn')); # remove ' and .. from the array */
    foreach($array as $value) { /* loop through the array at the level of the supplied $base */
        if (is_dir($base.$value)) { /* if this is a directory */
            $data[] = $base.$value.'/'; /* add it to the $data array */
            $data = rscandir($base.$value.'/', $data); /* then make a recursive call with the
            current $value as the $base supplying the $data array to carry into the recursion */

        } else if (is_file($base.$value)) { /* else if the current $value is a file */
            $data[] = $base.$value; /* just add the current $value to the $data array */
        }
    }
    return $data; // return the $data array
}
开发者ID:nicolasconnault,项目名称:streamliner,代码行数:14,代码来源:minify.php

示例9: rscandir

function rscandir($base = '', &$data = array())
{
    $array = array_diff(scandir($base), array('.', '..'));
    foreach ($array as $value) {
        if (is_dir($base . $value)) {
            $data = rscandir($base . $value . '/', $data);
        } elseif (is_file($base . $value)) {
            if (preg_match('/\\.lng\\.php$/i', $value) && $value != 'custom.lng.php') {
                $data[] = $base . $value;
            }
        }
    }
    return $data;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:14,代码来源:lang_diff.php

示例10: getApps

function getApps($mounts)
{
    global $defaultFocusedIcon, $defaultUnfocusedIcon, $base;
    $appfolders = array();
    foreach ($mounts as $mount) {
        $appdir = $mount . "scripts/";
        if (is_dir($appdir)) {
            $appfolders = rscandir($appdir);
        }
    }
    foreach ($appfolders as $appfolder) {
        $appconfig = $appfolder . "version.xml";
        #print_r( $appconfig );
        if (is_dir($appfolder) && is_file($appconfig)) {
            $appxml = @simplexml_load_file($appconfig);
            if ($appxml) {
                $app["name"] = (string) $appxml->name;
                if (empty($app["name"])) {
                    $app["name"] = basename($appfolder);
                }
                $app["link"] = (string) $appxml->link;
                if ("index.php" == $app["link"] || !is_file($app["link"])) {
                    $testfile = $appfolder . (string) $appxml->link;
                    if (is_file($testfile)) {
                        $app["link"] = str_replace($base, "http://127.0.0.1/media/", $testfile);
                    } else {
                        $testfile = $appfolder . "index.php";
                        if (is_file($testfile)) {
                            $app["link"] = str_replace($base, "http://127.0.0.1/media/", $testfile);
                        }
                    }
                }
                $app["version"] = (string) $appxml->version;
                $app["update"] = (string) $appxml->updatelink;
                $app["focusedIcon"] = $appfolder . trim((string) $appxml->focusedIcon);
                $app["unfocusedIcon"] = $appfolder . trim((string) $appxml->unfocusedIcon);
                if ($appfolder == $app["focusedIcon"]) {
                    $app["focusedIcon"] = $defaultFocusedIcon;
                }
                if ($appfolder == $app["unfocusedIcon"]) {
                    $app["unfocusedIcon"] = $defaultUnfocusedIcon;
                }
                $apps[] = $app;
            }
        }
    }
    return $apps;
}
开发者ID:anboto,项目名称:xtreamer-web-sdk,代码行数:48,代码来源:index.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $files = rscandir(PIMCORE_TEMPORARY_DIRECTORY . "/image-thumbnails/");
     $savedBytesTotal = 0;
     foreach ($files as $file) {
         if (file_exists($file)) {
             $originalFilesize = filesize($file);
             \Pimcore\Image\Optimizer::optimize($file);
             $savedBytes = $originalFilesize - filesize($file);
             $savedBytesTotal += $savedBytes;
             $this->output->writeln("Optimized image: " . $file . " saved " . formatBytes($savedBytes));
         }
     }
     $this->output->writeln("Finished!");
     $this->output->writeln("Saved " . formatBytes($savedBytesTotal) . " in total");
 }
开发者ID:solverat,项目名称:pimcore,代码行数:16,代码来源:ThumbnailsOptimizeImagesCommand.php

示例12: rscandir

function rscandir($rootDir, $ext=array(), $allData=array()) {
    // set filenames invisible if you want
    $invisibleFileNames = array(".", "..", ".htaccess", ".htpasswd");
    // run through content of root directory
    $dirContent = scandir($rootDir);
    foreach($dirContent as $key => $content) {
        // filter all files not accessible
        $path = $rootDir.'/'.$content;
        if(!in_array($content, $invisibleFileNames)) {
            // if content is file & readable, add to array
            if(is_file($path) && is_readable($path)) {
                // save file name with path
                $allData[] = realpath($path);
            // if content is a directory and readable, add path and name
            }elseif(is_dir($path) && is_readable($path)) {
                // recursive callback to open new directory
                $allData = rscandir($path, $ext, $allData);
            }
        }
    }
    return $allData;
}
开发者ID:G-LAB,项目名称:g-lib,代码行数:22,代码来源:glib_directory_helper.php

示例13: rscandir

<?php

$folderScan = "anim/perso-1/run/";
$web = WEB_RESSOURCES . $folderScan;
$list = rscandir(DIR_RESSOURCES . $folderScan);
?>
<ul class="no-padh ressources-preview">
    <li><strong>img</strong>
    	<ul>
    		<li>
    			<img src="<?php 
echo WEB_ROOT;
?>
/ressources/ressources/img/dot-grid-isometric-460.jpg">
        		<span class="filename small">dot-grid-isometric-460.jpg</span>
    		</li>
    	</ul>
    </li>
    <li><strong>Anim/run</strong>
        <ul>
            <?php 
foreach ($list as $key => $value) {
    ?>
                <li>
                    <img src="<?php 
    echo $web . $value;
    ?>
">
                    <span class="filename small"><?php 
    echo $value;
    ?>
开发者ID:rodbox,项目名称:rodbox3,代码行数:31,代码来源:ressources-list.php

示例14: csp_po_get_theme_capabilities

function csp_po_get_theme_capabilities($theme, $values, $active) {
	$data = array();
	$data['locale'] = get_locale();
	$data['type'] = 'themes';
	$data['img_type'] = 'themes';	
	$data['type-desc'] = __('Theme',CSP_PO_TEXTDOMAIN);	
	$data['name'] = $values['Name'];
	$data['author'] = $values['Author'];
	$data['version'] = $values['Version'];
	$data['description'] = $values['Description'];
	$data['status'] = $theme == $active->name ? __("activated",CSP_PO_TEXTDOMAIN) : __("deactivated",CSP_PO_TEXTDOMAIN);
	$data['base_path'] = str_replace("\\","/", WP_CONTENT_DIR.str_replace('wp-content', '', dirname($values['Template Files'][0])).'/');
	if (file_exists($values['Template Files'][0])){
		$data['base_path'] = dirname(str_replace("\\","/",$values['Template Files'][0])).'/';
	}

	$data['special-path'] = '';
	foreach($values['Template Files'] as $themefile) {
		$main = '';
		if (!file_exists($themefile)) {
			$main = file_get_contents(WP_CONTENT_DIR.str_replace('wp-content', '', $themefile));
		}else {
			$main = file_get_contents($themefile);
		}
		if (preg_match("/load_theme_textdomain\s*\(\s*(\'|\"|)([\w\-_]+|[A-Z\-_]+)(\'|\"|)\s*(,|\))/", $main, $hits)) break;
	}
	$data['is-path-unclear'] = false;
	$data['gettext_ready'] = empty($hits) === false;
	if ($data['gettext_ready']) {
		$data['textdomain'] = array('identifier' => $hits[2], 'is_const' => empty($hits[1]) );
		$data['languages'] = array();
	
		$const_list = array();
		if (!($data['gettext_ready'] && !$data['textdomain']['is_const'])) {
			if (preg_match_all("/define\s*\(([^\)]+)\)/" , $main, $hits)) {
				$const_list = array_merge($const_list, $hits[1]);
			}
		}
		if ($data['gettext_ready']) {			
			if ($data['textdomain']['is_const']) {
				foreach($const_list as $e) {
					$a = split(',', $e);
					$c = trim($a[0], "\"' \t");
					if ($c == $data['textdomain']['identifier']) {
						$data['textdomain']['is_const'] = $data['textdomain']['identifier'];
						$data['textdomain']['identifier'] = trim($a[1], "\"' \t");
					}
				}
			}		
		}		
	
		$tmp = array();
		$dn = dirname(str_replace("\\","/",WP_CONTENT_DIR).str_replace('wp-content', '', $values['Template Files'][0]));
		if (file_exists($values['Template Files'][0])){
			$dn = dirname(str_replace("\\","/",$values['Template Files'][0]));
		}
		$files = rscandir($dn.'/', "/(.\mo|\.po|\.pot)$/", $tmp);
		$sub_dirs = array();
		foreach($files as $filename) {
			preg_match("/\/([a-z][a-z]_[A-Z][A-Z]).(mo|po)$/", $filename, $hits);
			if (empty($hits[1]) === false) {
				$data['languages'][$hits[1]][$hits[2]] = array(
					'class' => "-".(is_readable($filename) ? 'r' : '').(is_writable($filename) ? 'w' : ''),
					'stamp' => date(__('m/d/Y H:i:s',CSP_PO_TEXTDOMAIN), filemtime($filename))." ".file_permissions($filename)
				);
				$data['filename'] = '';
				$sd = dirname(str_replace($dn.'/', '', $filename));
				if ($sd == '.') $sd = '';
				if (!in_array($sd, $sub_dirs)) $sub_dirs[] = $sd;
			}
		}
		//completely other directories can be defined WP if >= 2.7.0
		global $wp_version;
		if (version_compare($wp_version, '2.7', '>=')) {
			if (count($data['languages']) == 0) {
				$data['is-path-unclear'] = has_subdirs($dn.'/');
				if ($data['is-path-unclear'] && (count($files) > 0)) {
					foreach($files as $file) {
						$f = str_replace($dn.'/', '', $file);
						if (preg_match("/^([a-z][a-z]_[A-Z][A-Z]).(mo|po|pot)$/", basename($f))) {
							$data['special_path'] = (dirname($f) == '.' ? '' : dirname($f));
							$data['is-path-unclear'] = false;
							break;
						}
					}
				}
			}
			else{
				if ($sub_dirs[0] != '') {
					$data['special_path'] = ltrim($sub_dirs[0], "/");
				}
			}
		}
	}
	
	$data['base_file'] = (empty($data['special_path']) ? '' : $data['special_path']."/");

	return $data;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:99,代码来源:codestyling-localization.php

示例15: rscandir

<?php

include "../../include.php";
$folder = "anim/" . $_POST["select-perso"] . "/" . $_POST["select-anim"];
$dir = DIR_RESSOURCES . $folder;
$list = rscandir($dir);
$d = ["list" => $list, "url" => WEB_RESSOURCES . $folder . "/"];
$r = array('infotype' => "success", 'msg' => "ok", 'data' => $d);
echo json_encode($r);
开发者ID:rodbox,项目名称:rodbox3,代码行数:9,代码来源:list.php


注:本文中的rscandir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。