本文整理汇总了PHP中CRM_Utils_File::findFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_File::findFiles方法的具体用法?PHP CRM_Utils_File::findFiles怎么用?PHP CRM_Utils_File::findFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_File
的用法示例。
在下文中一共展示了CRM_Utils_File::findFiles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findManyFiles
/**
* Find files in several directories using several filename patterns
*
* @param array $pairs each item is an array(0 => $searchBaseDir, 1 => $filePattern)
* @return array of file paths
*/
static function findManyFiles($pairs)
{
$files = array();
foreach ($pairs as $pair) {
list($dir, $pattern) = $pair;
$files = array_merge($files, CRM_Utils_File::findFiles($dir, $pattern));
}
return $files;
}
示例2: _api4_civix_find_files
/**
* Search directory tree for files which match a glob pattern
*
* Note: Dot-directories (like "..", ".git", or ".svn") will be ignored.
* Note: In Civi 4.3+, delegate to CRM_Utils_File::findFiles()
*
* @param $dir string, base dir
* @param $pattern string, glob pattern, eg "*.txt"
* @return array(string)
*/
function _api4_civix_find_files($dir, $pattern)
{
if (is_callable(array('CRM_Utils_File', 'findFiles'))) {
return CRM_Utils_File::findFiles($dir, $pattern);
}
$todos = array($dir);
$result = array();
while (!empty($todos)) {
$subdir = array_shift($todos);
foreach (_api4_civix_glob("{$subdir}/{$pattern}") as $match) {
if (!is_dir($match)) {
$result[] = $match;
}
}
if ($dh = opendir($subdir)) {
while (FALSE !== ($entry = readdir($dh))) {
$path = $subdir . DIRECTORY_SEPARATOR . $entry;
if ($entry[0] == '.') {
} elseif (is_dir($path)) {
$todos[] = $path;
}
}
closedir($dh);
}
}
return $result;
}
示例3: getRelPaths
/**
* Scan $basedir for a list of extension-keys
*
* @return array
* ($key => $relPath)
*/
protected function getRelPaths()
{
if (!is_array($this->relPaths)) {
if ($this->cache) {
$this->relPaths = $this->cache->get($this->cacheKey);
}
if (!is_array($this->relPaths)) {
$this->relPaths = array();
$infoPaths = CRM_Utils_File::findFiles($this->baseDir, 'info.xml');
foreach ($infoPaths as $infoPath) {
$relPath = CRM_Utils_File::relativize(dirname($infoPath), $this->baseDir);
try {
$info = CRM_Extension_Info::loadFromFile($infoPath);
} catch (CRM_Extension_Exception_ParseException $e) {
CRM_Core_Session::setStatus(ts('Parse error in extension: %1', array(1 => $e->getMessage())), '', 'error');
CRM_Core_Error::debug_log_message("Parse error in extension: " . $e->getMessage());
continue;
}
$this->relPaths[$info->key] = $relPath;
}
if ($this->cache) {
$this->cache->set($this->cacheKey, $this->relPaths);
}
}
}
return $this->relPaths;
}
示例4: loadSettingsMetadata
/**
* Load up settings metadata from files.
*/
public static function loadSettingsMetadata($metaDataFolder)
{
$settingMetaData = array();
$settingsFiles = CRM_Utils_File::findFiles($metaDataFolder, '*.setting.php');
foreach ($settingsFiles as $file) {
$settings = (include $file);
$settingMetaData = array_merge($settingMetaData, $settings);
}
CRM_Core_BAO_Cache::setItem($settingMetaData, 'CiviCRM setting Spec', 'All');
return $settingMetaData;
}
示例5: getStrings
/**
* Get list of translatable strings for a module.
*
* @param string $name
* Angular module name.
* @return array
* Translatable strings.
*/
public function getStrings($name)
{
$module = $this->getModule($name);
$result = array();
if (isset($module['js'])) {
foreach ($module['js'] as $file) {
$strings = $this->res->getStrings()->get($module['ext'], $this->res->getPath($module['ext'], $file), 'text/javascript');
$result = array_unique(array_merge($result, $strings));
}
}
if (isset($module['partials'])) {
foreach ($module['partials'] as $partialDir) {
$partialDir = $this->res->getPath($module['ext']) . '/' . $partialDir;
$files = \CRM_Utils_File::findFiles($partialDir, '*.html');
foreach ($files as $file) {
$strings = $this->res->getStrings()->get($module['ext'], $file, 'text/html');
$result = array_unique(array_merge($result, $strings));
}
}
}
return $result;
}
示例6: loadSettingsMetadata
/**
* Load up settings metadata from files.
*/
protected static function loadSettingsMetadata($metaDataFolder)
{
$settingMetaData = array();
$settingsFiles = \CRM_Utils_File::findFiles($metaDataFolder, '*.setting.php');
foreach ($settingsFiles as $file) {
$settings = (include $file);
$settingMetaData = array_merge($settingMetaData, $settings);
}
return $settingMetaData;
}