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


PHP eZDir::recursiveFind方法代码示例

本文整理汇总了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;
}
开发者ID:nottavi,项目名称:ezpublish,代码行数:26,代码来源:about.php

示例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);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezfilepackagehandler.php

示例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;
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:29,代码来源:ezdir.php


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