本文整理汇总了PHP中ezcBaseFile::findRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFile::findRecursive方法的具体用法?PHP ezcBaseFile::findRecursive怎么用?PHP ezcBaseFile::findRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBaseFile
的用法示例。
在下文中一共展示了ezcBaseFile::findRecursive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStatsEmptyArray
public function testStatsEmptyArray()
{
$expected = array(0 => 'File/design/class_diagram.png', 1 => 'File/design/design.txt', 2 => 'File/design/file.xml', 3 => 'File/design/file_operations.png', 4 => 'File/design/md5.png', 5 => 'File/design/requirements.txt');
$stats = array();
self::assertEquals($expected, ezcBaseFile::findRecursive("File", array('@/design/@'), array('@\\.svn@'), $stats));
self::assertEquals(array('size' => 114282, 'count' => 6), $stats);
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$arr = \ezcBaseFile::findRecursive(SYSPATH . "/app/Api", array('@.*.php$@'));
$apiHandler = new \Api\ApiHandler();
$result = array();
foreach ($arr as $file) {
$method = basename($file, ".php");
$class = $apiHandler->getClass($method);
$rc = new \ReflectionClass($class);
$txt = $rc->getDocComment();
preg_match("|/\\*\\*\\s*( \\* [^-][^\n]+\n)+|i", $txt, $m);
$txt = preg_replace(array("|/\\*\\*\n \\* |", "#\n ?\\* #"), array("", " "), $m[0]);
$txt = trim($txt);
$result[$method] = array($class, $txt);
}
$output->writeln("<comment>Список методов:</comment>");
foreach ($result as $k => $v) {
list($base) = explode(".", $k);
if ($_base != $base) {
$output->writeln("<comment>{$base}</comment>");
}
$_base = $base;
$output->writeln(sprintf(" <info>%-24s</info> %s", $k, $v[1]));
}
}
示例3: expireCache
public function expireCache()
{
if (isset($_SESSION['lhc_chat_config'])) {
unset($_SESSION['lhc_chat_config']);
}
if ($this->expiredInRuntime == false) {
$this->expiredInRuntime = true;
foreach ($this->expireOptions as $option) {
$this->setSetting('cachetimestamps', $option, 0);
}
foreach ($this->sessionExpireOptions as $option) {
if (isset($_SESSION[$option])) {
unset($_SESSION[$option]);
}
}
$compiledModules = ezcBaseFile::findRecursive('cache/cacheconfig', array('@\\.cache\\.php@'));
foreach ($compiledModules as $compiledClass) {
unlink($compiledClass);
}
$compiledTemplates = ezcBaseFile::findRecursive('cache/compiledtemplates', array('@(\\.php|\\.js|\\.css)@'));
foreach ($compiledTemplates as $compiledTemplate) {
unlink($compiledTemplate);
}
$instance = CSCacheAPC::getMem();
$instance->increaseImageManipulationCache();
$this->save();
}
}
示例4: testStatsEmptyArray
public function testStatsEmptyArray()
{
$expected = array(0 => 'vendor/zetacomponents/unit-test/design/class_diagram.png');
$stats = array();
self::assertEquals($expected, ezcBaseFile::findRecursive("vendor/zetacomponents/unit-test", array('@/design/@'), array('@\\.svn@'), $stats));
self::assertEquals(array('size' => 166066, 'count' => 1), $stats);
}
示例5: getModuleList
public static function getModuleList()
{
$ModulesDir = 'modules';
$ModuleList = array();
$dirSeparator = DIRECTORY_SEPARATOR;
$Modules = ezcBaseFile::findRecursive($ModulesDir, array('@module.php@'));
foreach ($Modules as $ModuleInclude) {
include $ModuleInclude;
$ModuleList[str_replace("modules{$dirSeparator}", '', dirname($ModuleInclude))] = array('name' => erTranslationClassLhTranslation::getInstance()->getTranslation('permission/editrole', $Module['name']));
}
// Add extensions modules
$cfg = erConfigClassLhConfig::getInstance();
$extensions = $cfg->getSetting('site', 'extensions');
foreach ($extensions as $extension) {
if (is_dir("extension/{$extension}/{$ModulesDir}")) {
$Modules = ezcBaseFile::findRecursive("extension/{$extension}/{$ModulesDir}", array('@module.php@'));
foreach ($Modules as $ModuleInclude) {
include $ModuleInclude;
if (isset($ModuleList[str_replace("extension/{$extension}/{$ModulesDir}{$dirSeparator}", '', dirname($ModuleInclude))]['name'])) {
$ModuleList[str_replace("extension/{$extension}/{$ModulesDir}{$dirSeparator}", '', dirname($ModuleInclude))]['name'] .= ', EX - ' . erTranslationClassLhTranslation::getInstance()->getTranslation('permission/editrole', $Module['name']);
} else {
$ModuleList[str_replace("extension/{$extension}/{$ModulesDir}{$dirSeparator}", '', dirname($ModuleInclude))] = array('name' => erTranslationClassLhTranslation::getInstance()->getTranslation('permission/editrole', $Module['name']));
}
}
}
}
return $ModuleList;
}
示例6: testNonExistingDirectory
public function testNonExistingDirectory()
{
$expected = array();
try {
ezcBaseFile::findRecursive("NotHere", array('@xxx@'));
} catch (ezcBaseFileNotFoundException $e) {
self::assertEquals("The directory file 'NotHere' could not be found.", $e->getMessage());
}
}
示例7: array
<?php
require 'tutorial_autoload.php';
$data = ezcBaseFile::findRecursive(dirname(__DIR__), array('@repos/.*_autoload.php$@'), array('@/my_.*@'));
var_dump($data);
示例8: getSiteIniFiles
function getSiteIniFiles()
{
$siteIniList = ezcBaseFile::findRecursive($this->getNewDistroPathName() . "settings", array('@site\\.ini@'));
$result = array();
foreach ($siteIniList as $siteIniFilePath) {
$parts = explode($this->getNewDistroPathName(), $siteIniFilePath);
// ignore the default site.ini and any temp INI files
if ($parts[1] != 'settings/site.ini' and $parts[1] != '/settings/site.ini' and !strstr($siteIniFilePath, '~') and !strstr($siteIniFilePath, '.LCK')) {
$result[] = $parts[1];
}
}
return $result;
}
示例9: testRecursiveNotWritableParent
public function testRecursiveNotWritableParent()
{
self::assertEquals(15, count(ezcBaseFile::findRecursive($this->tempDir)));
try {
ezcBaseFile::removeRecursive($this->tempDir . '/dir7/dir1');
} catch (ezcBaseFilePermissionException $e) {
self::assertEquals("The file '{$this->tempDir}/dir7' can not be opened for writing.", $e->getMessage());
}
self::assertEquals(15, count(ezcBaseFile::findRecursive($this->tempDir)));
}
示例10: array
<?php
// php cron.php -s site_admin -c cron/util/generate_translation_file
$arrayTranslationsProcess = array();
$items = erLhcoreClassModelChatConfig::getItems(array('limit' => 500, 'filter' => array('hidden' => 0)));
foreach ($items as $item) {
$arrayTranslationsProcess['listchatconfig'][] = $item->explain;
}
$filesToCheck = ezcBaseFile::findRecursive('.', array('@\\.php$@'), array('@/./albums|./ezcomponents|./doc|./translations|./var|./extension|./cache|./bin|./Zend|./setttings|./pos/@'));
$locale = 'en_EN';
foreach ($filesToCheck as $filePath) {
$contentFile = file_get_contents($filePath);
$Matches = array();
preg_match_all('/<\\?php echo erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $section) {
if (!isset($arrayTranslationsProcess[$section])) {
$arrayTranslationsProcess[$section] = array();
}
if (!in_array($Matches[2][$key], $arrayTranslationsProcess[$section])) {
$arrayTranslationsProcess[$section][] = $Matches[2][$key];
}
$contentFile = str_replace($Matches[0][$key], '', $contentFile);
}
$Matches = array();
preg_match_all('/erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $section) {
if (!isset($arrayTranslationsProcess[$section])) {
$arrayTranslationsProcess[$section] = array();
}
if (!in_array($Matches[2][$key], $arrayTranslationsProcess[$section])) {
$arrayTranslationsProcess[$section][] = $Matches[2][$key];
示例11: convertPDFToPNG
public static function convertPDFToPNG(erLhcoreClassModelDocShare &$fileObject)
{
$pdfFile = $fileObject->pdf_file_path_server;
if ($fileObject->pdf_file != '' && file_exists($pdfFile)) {
try {
$config = erConfigClassLhConfig::getInstance();
$objectData = erLhcoreClassModelChatConfig::fetch('doc_sharer');
$dataDocSharer = (array) $objectData->data;
erLhcoreClassFileUpload::mkdirRecursive($fileObject->pdftoimg_path, true, $dataDocSharer['http_user_name'], $dataDocSharer['http_user_group_name']);
$ocrParsed = true;
// Prepare to run ImageMagick command
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
$appendCommand = '';
if ($dataDocSharer['pdftoppm_limit'] > 0) {
$appendCommand .= ' -l ' . $dataDocSharer['pdftoppm_limit'];
}
$command = $dataDocSharer['pdftoppm_path'] . $appendCommand . ' -png -r 200 ' . escapeshellarg($pdfFile) . ' ' . $fileObject->pdftoimg_path . $fileObject->id;
// Open color_indexer process
$imageProcess = proc_open($command, $descriptors, $pipes);
// Close STDIN pipe
fclose($pipes[0]);
$errorString = '';
$outputString = '';
// Read STDERR
do {
$errorString .= rtrim(fgets($pipes[2], 1024), "\n");
} while (!feof($pipes[2]));
// Wait for process to terminate and store return value
$status = proc_get_status($imageProcess);
while ($status['running'] !== false) {
// Sleep 1/100 second to wait for convert to exit
usleep(10000);
$status = proc_get_status($imageProcess);
}
$return = proc_close($imageProcess);
$data = ezcBaseFile::findRecursive($fileObject->pdftoimg_path, array("@{$fileObject->id}-.*\\.png@"), array());
$contentPages = array();
$pagesCount = 0;
foreach ($data as $key => $file) {
$pagesCount++;
$parts = explode('-', $file);
array_pop($parts);
$parts[] = '-' . $pagesCount . '.png';
$newName = implode('', $parts);
rename($file, $newName);
$file = $newName;
chown($file, $dataDocSharer['http_user_name']);
chgrp($file, $dataDocSharer['http_user_group_name']);
chmod($file, 0664);
}
$fileObject->pdf_to_img_converted = 1;
$fileObject->pages_pdf_count = $pagesCount;
$fileObject->saveThis();
} catch (Exception $e) {
throw $e;
}
}
}
示例12: run
/**
* Run the generator.
* Process the given options and generates translation files.
*/
public function run()
{
try {
$this->input->process();
} catch (ezcConsoleException $e) {
$this->raiseError("Error while processing your options: {$e->getMessage()}", true);
}
if ($this->input->getOption('h')->value === true) {
$this->output->outputText($this->input->getHelpText(self::PROGRAM_DESCRIPTION, 80, true), "help");
exit(0);
}
$translationDir = $this->input->argumentDefinition["translation dir"]->value;
$templatePath = realpath($this->input->getOption("templates")->value);
// setup the backend to write to and/or read from
$options = array('format' => $this->input->getOption("format")->value, 'keepObsolete' => true);
$this->backend = new ezcTranslationTsBackend($translationDir);
$this->backend->setOptions($options);
$locale = $this->input->getOption("locale")->value;
// remove the translation file if option overwrite is set
$translationFile = $this->backend->buildTranslationFileName($locale);
if ($this->input->getOption("overwrite")->value === true && file_exists($translationFile)) {
unlink($translationFile);
}
// init the writer
$this->backend->initWriter($locale);
// keep track of which contexts are in use
$usedContexts = array();
// find the .ezt files and loop over them.
$it = ezcBaseFile::findRecursive($templatePath, array('@\\.ezt$@'));
foreach ($it as $item) {
$pathname = $this->unifyFilepath(realpath($item), $templatePath);
$this->output->outputLine('Processing file ' . $pathname . ' ...');
// get translation contexts from template
$contexts = $this->getTranslationsFromTemplate($item);
foreach ($contexts as $contextName => $translationMapNew) {
// record that this context is in use
$usedContexts[] = $contextName;
// get existing translation strings from file
if ($this->input->getOption("overwrite")->value === false) {
$translationMapOriginal = $this->getTranslationsFromTsFile($contextName);
} else {
$translationMapOriginal = array();
}
// create empty context
$context = array();
// insert new translations
foreach ($translationMapNew as $original => $translationElement) {
// insert new strings
if (!isset($translationMapOriginal[$original])) {
// edit filename to unify accross platforms and strip template path
$translationElement->filename = $this->unifyFilepath($translationElement->filename, $templatePath);
$context[] = $translationElement;
}
}
// update translations
if ($this->input->getOption("overwrite")->value === false) {
foreach ($translationMapOriginal as $original => $translationElement) {
// update data
if (isset($translationMapNew[$original])) {
$new = $translationMapNew[$original];
$translationElement->comment = $new->comment;
$translationElement->filename = $this->unifyFilepath($new->filename, $templatePath);
$translationElement->line = $new->line;
$translationElement->column = $new->column;
// change status of previously obsolete strings
if ($translationElement->status == ezcTranslationData::OBSOLETE) {
if (!empty($translationElement->translation)) {
$translationElement->status = ezcTranslationData::TRANSLATED;
} else {
$translationElement->status = ezcTranslationData::UNFINISHED;
}
}
$context[] = $translationElement;
} elseif ($translationElement->filename == $pathname) {
$translationElement->status = ezcTranslationData::OBSOLETE;
$context[] = $translationElement;
}
}
}
$this->backend->storeContext($contextName, $context);
}
}
// write translation data to file
$this->backend->deinitWriter();
$contextNames = $this->backend->getContextNames($locale);
// init the writer
$this->backend->initWriter($locale);
// check which contexts are now totally gone
foreach ($contextNames as $contextName) {
if (!in_array($contextName, $usedContexts)) {
echo "{$contextName} is all obsolete\n";
$context = $this->backend->getContext($locale, $contextName);
foreach ($context as &$translationElement) {
$translationElement->status = ezcTranslationData::OBSOLETE;
}
$this->backend->storeContext($contextName, $context);
//.........这里部分代码省略.........
示例13: testRecursive5
public function testRecursive5()
{
self::assertEquals(12, count(ezcBaseFile::findRecursive($this->tempDir)));
try {
ezcBaseFile::removeRecursive($this->tempDir . '/dir6');
} catch (ezcBaseFilePermissionException $e) {
self::assertEquals("The file '{$this->tempDir}/dir6/file1.txt' can not be removed.", $e->getMessage());
}
self::assertEquals(12, count(ezcBaseFile::findRecursive($this->tempDir)));
}
示例14: array
<?php
require 'tutorial_autoload.php';
$data = ezcBaseFile::findRecursive("/dat/dev/ezcomponents", array('@src/.*_autoload.php$@'), array('@/autoload/@'));
var_dump($data);
示例15: testRecursiveCopyFullDirLimitedDepth
public function testRecursiveCopyFullDirLimitedDepth()
{
ezcBaseFile::copyRecursive($this->tempDir . '/dir2', $this->tempDir . '/dest', 2);
$this->assertEquals(3, count(ezcBaseFile::findRecursive($this->tempDir . '/dest')));
}