本文整理汇总了PHP中eZDir::recursiveFind方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDir::recursiveFind方法的具体用法?PHP eZDir::recursiveFind怎么用?PHP eZDir::recursiveFind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDir
的用法示例。
在下文中一共展示了eZDir::recursiveFind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContributors
function getContributors( $pathToDir )
{
$contribFiles = eZDir::recursiveFind( $pathToDir, "php" );
$contributors = array();
if ( count( $contribFiles ) )
{
foreach ( $contribFiles as $contribFile )
{
include_once( $contribFile );
if ( !isset( $contributorSettings ) )
continue;
$tmpFiles = explode( ',', $contributorSettings['files'] );
$updatedFiles = array();
foreach ( $tmpFiles as $file )
{
if ( trim( $file ) )
$updatedFiles[] = trim( $file,"\n\r" );
}
$files = implode( ', ', $updatedFiles );
$contributorSettings['files'] = $files;
$contributors[] = $contributorSettings;
}
}
return $contributors;
}
示例2: handleParameters
//.........这里部分代码省略.........
$data = $arguments[$i + 1];
++$i;
}
if ($flag == 't') {
if (!in_array($data, array('design', 'ini', 'file', 'thumbnail'))) {
$cli->error("Unknown file type {$data}, allowed values are design, ini, thumbnail and file");
return false;
}
$currentType = $data;
$currentRole = false;
$currentDesign = false;
if ($currentType == 'design') {
$currentRole = 'template';
$currentDesign = 'standard';
}
} else {
if ($flag == 'r') {
if ($currentType != 'design' and $currentType != 'ini') {
$cli->error("The current file type is not 'design' or 'ini' ({$currentType}), cannot set specific roles for files");
return false;
}
if (!$this->roleExists($currentType, $data)) {
$cli->error("Unknown file role {$data} for file type {$currentType}");
return false;
}
$currentRole = $data;
} else {
if ($flag == 'v') {
$currentRoleValue = $data;
} else {
if ($flag == 'n') {
$currentVariableName = $data;
} else {
if ($flag == 'p') {
$packagePath = $data;
} else {
if ($flag == 'd') {
if ($currentType != 'design') {
$cli->error("The current file type is not 'design' ({$currentType}), cannot set specific designs for files");
return false;
}
if (!$this->designExists($data)) {
$cli->error("The design {$data} does not exist");
return false;
}
$currentDesign = $data;
} else {
if ($flag == 'c') {
$currentCollection = $data;
}
}
}
}
}
}
}
}
}
} else {
$file = $argument;
$type = $currentType;
$role = $currentRole;
$roleValue = $currentRoleValue;
$design = $currentDesign;
$realFilePath = $this->fileExists($file, $type, $role, $roleValue, $design, $triedFiles);
if (!$realFilePath) {
$error = "File " . $cli->stylize('file', $file) . " does not exist\n" . "The following files were searched for:\n";
$files = array();
foreach ($triedFiles as $triedFile) {
$files[] = $cli->stylize('file', $triedFile);
}
$cli->output($error . implode("\n", $files));
return false;
}
$fileFileType = false;
if (is_dir($realFilePath)) {
$fileFileType = 'dir';
}
if ($currentType == 'ini' and $fileFileType == 'dir') {
$iniFiles = eZDir::recursiveFind($realFilePath, "");
$fileFileType = 'file';
foreach ($iniFiles as $iniFile) {
$iniFile = $this->iniMatch($iniFile, $role, $roleValue, $file, $triedFiles);
if (!$iniFile) {
continue;
}
$fileList[] = array('file' => $file, 'package-path' => $packagePath, 'type' => $type, 'role' => $role, 'role-value' => $roleValue, 'variable-name' => $currentVariableName, 'file-type' => $fileFileType, 'design' => $design, 'collection' => $currentCollection, 'path' => $iniFile);
}
} else {
$fileList[] = array('file' => $file, 'package-path' => $packagePath, 'type' => $type, 'role' => $role, 'role-value' => $roleValue, 'variable-name' => $currentVariableName, 'file-type' => $fileFileType, 'design' => $design, 'collection' => $currentCollection, 'path' => $realFilePath);
}
$realPath = false;
}
}
if (count($fileList) == 0) {
$cli->error("No files were added");
return false;
}
return array('file-list' => $fileList);
}
示例3: recursiveFind
static function recursiveFind( $dir, $suffix )
{
$returnFiles = array();
if ( $handle = @opendir( $dir ) )
{
while ( ( $file = readdir( $handle ) ) !== false )
{
if ( ( $file == "." ) || ( $file == ".." ) )
{
continue;
}
if ( is_dir( $dir . '/' . $file ) )
{
if ( $file[0] != "." )
{
$files = eZDir::recursiveFind( $dir . '/' . $file, $suffix );
$returnFiles = array_merge( $files, $returnFiles );
}
}
else
{
if ( preg_match( "/$suffix$/", $file ) )
$returnFiles[] = $dir . '/' . $file;
}
}
@closedir( $handle );
}
return $returnFiles;
}