本文整理汇总了PHP中ezcBaseFile类的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFile类的具体用法?PHP ezcBaseFile怎么用?PHP ezcBaseFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcBaseFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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);
}
开发者ID:corcre,项目名称:elabftw,代码行数:7,代码来源:file_find_recursive_test.php
示例2: 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;
}
开发者ID:AaronLuo3296,项目名称:livehelperchat,代码行数:28,代码来源:lhmodules.php
示例3: appendRecursive
function appendRecursive($archive, $sourceDir, $prefix)
{
$context = new ArchiveContext();
$context->archive = $archive;
$context->prefix = $prefix;
ezcBaseFile::walkRecursive($sourceDir, array(), array(), 'findRecursiveCallback', $context);
}
开发者ID:alex-fang,项目名称:Archive,代码行数:7,代码来源:tutorial_recursive.php
示例4: 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();
}
}
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:28,代码来源:lhcacheconfig.php
示例5: 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);
}
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:7,代码来源:file_find_recursive_test.php
示例6: 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]));
}
}
开发者ID:fobiaweb,项目名称:api,代码行数:25,代码来源:ApiSearchCommand.php
示例7: 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());
}
}
开发者ID:mediasadc,项目名称:alba,代码行数:9,代码来源:file_find_recursive_test.php
示例8: process
/**
* Processes the template with the variables added by the send() method.
* The result of this action should be retrievable through the getResult() method.
*
* The $last parameter is set if the view handler is the last one in the
* list of zones for a specific view.
*
* @param bool $last
*/
public function process($last)
{
if (!file_exists($this->templateLocation)) {
$fileName = ezcBaseFile::isAbsolutePath($this->templateLocation) ? $this->templateLocation : getcwd() . DIRECTORY_SEPARATOR . $this->templateLocation;
throw new ezcBaseFileNotFoundException($fileName, 'php template');
}
ob_start();
include $this->templateLocation;
$this->result = ob_get_contents();
ob_end_clean();
}
开发者ID:bmdevel,项目名称:ezc,代码行数:20,代码来源:php.php
示例9: testRelative3
public function testRelative3()
{
$result = ezcBaseFile::calculateRelativePath('/foo/1/2/php.php', '/foo/bar');
self::assertEquals('..' . DIRECTORY_SEPARATOR . '1' . DIRECTORY_SEPARATOR . '2' . DIRECTORY_SEPARATOR . 'php.php', $result);
$result = ezcBaseFile::calculateRelativePath('/foo/bar/php.php', '/foo/bar');
self::assertEquals('php.php', $result);
$result = ezcBaseFile::calculateRelativePath('/php.php', '/foo/bar/1/2');
self::assertEquals('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'php.php', $result);
$result = ezcBaseFile::calculateRelativePath('/bar/php.php', '/foo/bar/1/2');
self::assertEquals('..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR . 'php.php', $result);
}
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:11,代码来源:file_calculate_relative_path_test.php
示例10: findRecursive
public static function findRecursive($sourceDir, array $includeFilters = array(), array $excludeFilters = array())
{
// create the context, and then start walking over the array
$context = new ezcBaseFileFindContext();
ezcBaseFile::walkRecursive($sourceDir, $includeFilters, $excludeFilters, array('myProgressFinder', 'findRecursiveCallback'), $context);
// collect the statistics (which we don't do anything with in this example)
$statistics['size'] = $context->size;
$statistics['count'] = $context->count;
// return the found and pattern-matched files
sort($context->elements);
return $context->elements;
}
开发者ID:corcre,项目名称:elabftw,代码行数:12,代码来源:tutorial_example_04.php
示例11: setUp
public function setUp()
{
try {
if (file_exists('/tmp/lucene')) {
ezcBaseFile::removeRecursive('/tmp/lucene');
}
mkdir('/tmp/lucene');
$this->backend = new ezcSearchZendLuceneHandler("/tmp/lucene");
} catch (ezcSearchCanNotConnectException $e) {
self::markTestSkipped('Couldn\'t open Zend Lucene.');
}
$this->testFilesDir = dirname(__FILE__) . '/../testfiles/';
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:13,代码来源:zend_lucene_test.php
示例12: getFile
/**
* Check and return file
*
* Check for the files location, and return the absolute path to the file,
* or thorw an exception, if the file could not be found.
*
* @param string $file
* @return string
*/
protected function getFile($file)
{
if (!ezcBaseFile::isAbsolutePath($file)) {
// If path to file is not an absolute path, use the given relative
// path relative to the currently processed document location.
$file = $this->path . $file;
}
// @TODO: docutils performs automatic checks, that no system files
// (like /etc/passwd) are included - do we want to do similar stuff
// here?
// Throw an exception, if we cannot find the referenced file
if (!is_file($file) || !is_readable($file)) {
throw new ezcBaseFileNotFoundException($file);
}
return $file;
}
开发者ID:jackalope,项目名称:jr_cr_demo,代码行数:25,代码来源:include.php
示例13: setUp
protected function setUp()
{
// truncates the ezsi_file table
$db = eZDB::instance();
$sql = 'TRUNCATE TABLE ' . self::SI_BLOCK_TABLE_NAME;
if (!$db->query($sql)) {
return false;
}
// removes files in the si-block directory
if (is_dir(realpath(self::SI_BLOCK_STORAGE_DIR))) {
try {
ezcBaseFile::removeRecursive(self::SI_BLOCK_STORAGE_DIR);
} catch (Exception $e) {
echo 'Got Exception message : ' . $e->getMessage() . "\n";
return false;
}
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:18,代码来源:ezsiblockfunction_test.php
示例14: clearStaticCache
/**
* Clears all static cache for a site
* Removers all static cache, but not the static cache directory itself.
*
* Currently, this function only supports 'combined_host_url'
*
*/
static function clearStaticCache()
{
$ini = eZINI::instance('staticcache.ini');
$storageDir = $ini->variable('CacheSettings', 'StaticStorageDir');
// Check that we have combined_host_url hostmatching
$siteIni = eZINI::instance();
$matchType = $siteIni->variable('SiteAccessSettings', 'MatchOrder');
if ($matchType !== 'combined_host_url') {
throw new Exception('combined_host_url required for this workflow');
}
global $eZCurrentAccess;
$siteAccess = $eZCurrentAccess['name'];
//Get hostname part from siteaccess name (exclude for instance _eng or _admin)
if (strpos($siteAccess, '_') === false) {
$hostName = $siteAccess;
} else {
$hostName = substr($siteAccess, 0, strpos($siteAccess, '_'));
}
$staticCacheDir = eZDir::path(array($storageDir, $hostName));
// Sanity checking, make sure we don't remove everyones static cache.
if ($staticCacheDir == $storageDir) {
throw new Exception("Failed to find correct static cache directory : {$staticCacheDir} \n");
}
$dirs = scandir($staticCacheDir);
foreach ($dirs as $dir) {
if ($dir !== '.' && $dir !== '..') {
$fullPath = eZDir::path(array($staticCacheDir, $dir));
if (is_dir($fullPath)) {
ezcBaseFile::removeRecursive($fullPath);
} else {
if (!unlink($fullPath)) {
throw new ezsfFileCouldNotRemoveException($fullPath);
}
}
}
}
}
开发者ID:netbliss,项目名称:ezstyleeditor,代码行数:44,代码来源:ezstaticcacheoperations.php
示例15: testAbsoluteStreamWrapper
public static function testAbsoluteStreamWrapper()
{
self::assertEquals(true, ezcBaseFile::isAbsolutePath('phar://test.phar/foo'));
self::assertEquals(true, ezcBaseFile::isAbsolutePath('http://example.com/file'));
}
开发者ID:broschb,项目名称:cyclebrain,代码行数:5,代码来源:file_is_absolute_path.php
示例16: testRecursiveCopyFailureNotWriteable
public function testRecursiveCopyFailureNotWriteable()
{
try {
ezcBaseFile::copyRecursive($this->tempDir . '/dir2', $this->tempDir . '/dir4');
} catch (ezcBaseFilePermissionException $e) {
return;
}
$this->fail('Expected ezcBaseFilePermissionException.');
}
开发者ID:humansky,项目名称:qframe,代码行数:9,代码来源:file_copy_recursive_test.php
示例17: getClassFileList
/**
* Extracts class information from PHP sourcecode.
* @return array (className=>filename)
*/
protected function getClassFileList($fileList, $mode)
{
$retArray = array();
$this->log("Searching for classes (tokenizing).");
$statArray = array('nFiles' => count($fileList), 'classCount' => 0, 'classAdded' => 0);
$this->setStatArray(self::OUTPUT_PROGRESS_PHASE2, $statArray);
if (count($fileList)) {
$this->startProgressOutput(self::OUTPUT_PROGRESS_PHASE2);
// Compatibility with PHP 5.2 where T_NAMESPACE constant is not available
// Assigning the constant value to $tNamespace
// 377 is the value for T_NAMESPACE in PHP 5.3.x
$tNamespace = defined('T_NAMESPACE') ? T_NAMESPACE : self::UNDEFINED_TOKEN;
// Traits support, see http://issues.ez.no/19028
$tTrait = defined('T_TRAIT') ? T_TRAIT : self::UNDEFINED_TOKEN;
foreach ($fileList as $file) {
$this->updateProgressOutput(self::OUTPUT_PROGRESS_PHASE2);
if ($mode === self::MODE_SINGLE_EXTENSION) {
$file = getcwd() . DIRECTORY_SEPARATOR . $this->options->basePath . DIRECTORY_SEPARATOR . $file;
}
$tokens = @token_get_all(file_get_contents($file));
$namespace = null;
foreach ($tokens as $key => $token) {
if (is_array($token)) {
switch ($token[0]) {
case self::UNDEFINED_TOKEN:
// Unsupported token, do nothing
break;
// Store namespace name, if applicable, to concatenate with class name
// Store namespace name, if applicable, to concatenate with class name
case $tNamespace:
// NAMESPACE_TOKEN - WHITESPACE_TOKEN - TEXT_TOKENS (containing namespace name)
$offset = $key + 2;
$namespace = "";
while ($tokens[$offset] !== ";" && $tokens[$offset] !== "{") {
if (is_array($tokens[$offset])) {
$namespace .= $tokens[$offset][1];
}
$offset++;
}
$namespace = trim(addcslashes($namespace, '\\'));
break;
case T_CLASS:
case T_INTERFACE:
case $tTrait:
// Increment stat for found class.
$this->incrementProgressStat(self::OUTPUT_PROGRESS_PHASE2, 'classCount');
// CLASS_TOKEN - WHITESPACE_TOKEN - TEXT_TOKEN (containing class name)
$className = $tokens[$key + 2][1];
if ($namespace !== null) {
$className = "{$namespace}\\\\{$className}";
}
$filePath = $file;
if ($mode === self::MODE_SINGLE_EXTENSION) {
$filePath = ezcBaseFile::calculateRelativePath($filePath, getcwd() . DIRECTORY_SEPARATOR . $this->options->basePath);
}
// make sure we store cross-platform file system paths,
// using a forward slash as directory separator
if (DIRECTORY_SEPARATOR != '/') {
$filePath = str_replace(DIRECTORY_SEPARATOR, '/', $filePath);
}
// Here there are two code paths.
// MODE_KERNEL_OVERRIDE will only add a class if
// it exists in the MODE_KERNEL autoload array.
// All other modes will only add a class if the
// class name is unique.
$addClass = $this->classCanBeAdded($className, $filePath, $mode, $retArray);
if ($addClass) {
// increment stat for actually added number of classes.
$this->incrementProgressStat(self::OUTPUT_PROGRESS_PHASE2, 'classAdded');
$retArray[$className] = $filePath;
}
break;
}
}
}
}
$this->stopProgressOutput(self::OUTPUT_PROGRESS_PHASE2);
ksort($retArray);
}
if ($this->output !== null) {
extract($this->getStatArray(self::OUTPUT_PROGRESS_PHASE2));
$this->log("Found {$classCount} classes, added {$classAdded} of them to the autoload array.");
}
return $retArray;
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:89,代码来源:ezautoloadgenerator.php
示例18: process
/**
* Processes the specified template source and returns the output string.
*
* Note: The first time a template is accessed it needs to be compiled so the
* execution time will be higher than subsequent calls.
*
* @param string $location The path to the template file to process, can be a PHP stream.
* @param ezcTemplateConfiguration $config Optional configuration object which overrides
* the default one defined in this object ($configuration).
* @return string
*
* @apichange Remove the test for ezcTemplateLocationInterface as it's deprecated.
*
* @throws ezcTemplateParserException
* If the template could not be compiled.
* @throws ezcTemplateFileNotWriteableException
* If the directory could not be created.
*/
public function process($location, ezcTemplateConfiguration $config = null)
{
if ($config === null) {
$config = $this->configuration;
}
$this->properties["usedConfiguration"] = $config;
$this->properties["tstTree"] = false;
$this->properties["astTree"] = false;
$this->properties["stream"] = $location;
if ($location instanceof ezcTemplateLocation || $location instanceof ezcTemplateLocationInterface) {
$this->properties["file"] = $location;
$this->properties["stream"] = $location->getPath();
} elseif ($config->locator) {
$this->properties["stream"] = $config->locator->translatePath($this->properties["stream"]);
}
if (strlen($this->properties["stream"]) > 0 && !ezcBaseFile::isAbsolutepath($this->properties["stream"])) {
$this->properties["stream"] = $config->templatePath . DIRECTORY_SEPARATOR . $this->properties["stream"];
}
$this->properties["streamStack"][] = $this->properties["stream"];
// lookup compiled code here
$compiled = ezcTemplateCompiledCode::findCompiled($this->properties["stream"], $config->context, $this);
$this->properties["compiledTemplatePath"] = $compiled->path;
$counter = 0;
while (true) {
++$counter;
if ($counter > 3) {
// @todo fix exception
throw new ezcTemplateCompilationFailedException("Failed to create and execute compiled code after " . ($counter - 1) . " tries.");
}
if (file_exists($compiled->path) && (!$config->checkModifiedTemplates || filemtime($this->properties["stream"]) <= filemtime($compiled->path))) {
if (!$config->executeTemplate) {
$this->properties["output"] = "";
return "";
}
try {
// execute compiled code here
$this->properties["output"] = $compiled->execute();
return $this->properties["output"];
} catch (ezcTemplateOutdatedCompilationException $e) {
// The compiled file cannot be used so we need to recompile it
}
}
$this->createDirectory(dirname($compiled->path));
// get the compiled path.
// use parser here
$source = new ezcTemplateSourceCode($this->properties["stream"], $this->properties["stream"]);
$source->load();
$parser = new ezcTemplateParser($source, $this);
$this->properties["tstTree"] = $parser->parseIntoNodeTree();
if ($parser->hasCacheBlocks && !$config->disableCache) {
$fetchCacheInfo = new ezcTemplateFetchCacheInformation();
$this->properties["tstTree"]->accept($fetchCacheInfo);
$tstToAst = new ezcTemplateTstToAstCachedTransformer($parser, $fetchCacheInfo->cacheTst);
} else {
$tstToAst = new ezcTemplateTstToAstTransformer($parser);
}
$this->properties["tstTree"]->accept($tstToAst);
$this->properties["astTree"] = $tstToAst->programNode;
$astToAst = new ezcTemplateAstToAstContextAppender($config->context);
$tstToAst->programNode->accept($astToAst);
// Extra optimization.
$astToAst = new ezcTemplateAstToAstAssignmentOptimizer();
$tstToAst->programNode->accept($astToAst);
$g = new ezcTemplateAstToPhpGenerator($compiled->path, $config);
// Write to the file.
$tstToAst->programNode->accept($g);
// Add to the cache system.
if ($config->cacheManager) {
$config->cacheManager->includeTemplate($this, $this->properties["stream"]);
}
}
// execute compiled code here
throw new ezcTemplateInternalException("Compilation or execution failed");
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:92,代码来源:template.php
示例19: array
<?php
require 'tutorial_autoload.php';
$data = ezcBaseFile::findRecursive(dirname(__DIR__), array('@repos/.*_autoload.php$@'), array('@/my_.*@'));
var_dump($data);
开发者ID:fobiaweb,项目名称:ezc-base,代码行数:5,代码来源:tutorial_example_02.php
示例20: testRecursiveCopyDirCalled0
public function testRecursiveCopyDirCalled0()
{
ezcBaseFile::copyRecursive($this->tempDir . '/dir7', $this->tempDir . '/dest');
$this->assertEquals(count(ezcBaseFile::findRecursive($this->tempDir . '/dir7')), count(ezcBaseFile::findRecursive($this->tempDir . '/dest')));
$this->assertTrue(is_dir($this->tempDir . '/dest/0'));
}
开发者ID:BGCX261,项目名称:zphp-svn-to-git,代码行数:6,代码来源:file_copy_recursive_test.php
注:本文中的ezcBaseFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论