本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::getAllFilesAndFoldersInPath方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::getAllFilesAndFoldersInPath方法的具体用法?PHP GeneralUtility::getAllFilesAndFoldersInPath怎么用?PHP GeneralUtility::getAllFilesAndFoldersInPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::getAllFilesAndFoldersInPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Calls addJsFile for each file in the given folder on the Instance of TYPO3\CMS\Core\Page\PageRenderer.
*
* @param string $name the file to include
* @param string $extKey the extension, where the file is located
* @param string $pathInsideExt the path to the file relative to the ext-folder
* @param bool $recursive
*/
public function render($name = null, $extKey = null, $pathInsideExt = 'Resources/Public/JavaScript/', $recursive = false)
{
if ($extKey == null) {
$extKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
}
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey);
if (TYPO3_MODE === 'FE') {
$extRelPath = substr($extPath, strlen(PATH_site));
} else {
$extRelPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($extKey);
}
$absFolderPath = $extPath . $pathInsideExt . $name;
// $files will include all files relative to $pathInsideExt
if ($recursive === false) {
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absFolderPath);
foreach ($files as $hash => $filename) {
$files[$hash] = $name . $filename;
}
} else {
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::getAllFilesAndFoldersInPath([], $absFolderPath, '', 0, 99, '\\.svn');
foreach ($files as $hash => $absPath) {
$files[$hash] = str_replace($extPath . $pathInsideExt, '', $absPath);
}
}
foreach ($files as $name) {
$this->pageRenderer->addJsFile($extRelPath . $pathInsideExt . $name);
}
}
示例2: generateExtensionFromVersion3Configuration
/**
* This test creates an extension based on a JSON file, generated
* with version 1.0 of the ExtensionBuilder and compares all
* generated files with the originally created ones
* This test should help, to find compatibility breaking changes
*
* @test
*/
function generateExtensionFromVersion3Configuration()
{
$this->configurationManager = $this->getMock($this->buildAccessibleProxy('EBT\\ExtensionBuilder\\Configuration\\ConfigurationManager'), array('dummy'));
$this->extensionSchemaBuilder = $this->objectManager->get('EBT\\ExtensionBuilder\\Service\\ExtensionSchemaBuilder');
$testExtensionDir = $this->fixturesPath . 'TestExtensions/test_extension_v3/';
$jsonFile = $testExtensionDir . \EBT\ExtensionBuilder\Configuration\ConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE;
if (file_exists($jsonFile)) {
// compatibility adaptions for configurations from older versions
$extensionConfigurationJSON = json_decode(file_get_contents($jsonFile), TRUE);
$extensionConfigurationJSON = $this->configurationManager->fixExtensionBuilderJSON($extensionConfigurationJSON, FALSE);
} else {
$extensionConfigurationJSON = array();
$this->fail('JSON file not found');
}
$this->extension = $this->extensionSchemaBuilder->build($extensionConfigurationJSON);
$this->fileGenerator->setSettings(array('codeTemplateRootPath' => PATH_typo3conf . 'ext/extension_builder/Resources/Private/CodeTemplates/Extbase/', 'extConf' => array('enableRoundtrip' => '0')));
$newExtensionDir = vfsStream::url('testDir') . '/';
$this->extension->setExtensionDir($newExtensionDir . 'test_extension/');
$this->fileGenerator->build($this->extension);
$referenceFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getAllFilesAndFoldersInPath(array(), $testExtensionDir);
foreach ($referenceFiles as $referenceFile) {
$createdFile = str_replace($testExtensionDir, $this->extension->getExtensionDir(), $referenceFile);
if (!in_array(basename($createdFile), array('ExtensionBuilder.json'))) {
$referenceFileContent = str_replace(array('2011-08-11T06:49:00Z', '2011-08-11', '###YEAR###', '2014'), array(date('Y-m-d\\TH:i:00\\Z'), date('Y-m-d'), date('Y'), date('Y')), file_get_contents($referenceFile));
$this->assertFileExists($createdFile, 'File ' . $createdFile . ' was not created!');
// do not compare files that contain a formatted DateTime, as it might have changed between file creation and this comparison
if (strpos($referenceFile, 'xlf') === FALSE && strpos($referenceFile, 'yaml') === FALSE) {
$originalLines = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $referenceFileContent, TRUE);
$generatedLines = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, file_get_contents($createdFile), TRUE);
$this->assertEquals($originalLines, $generatedLines, 'File ' . $createdFile . ' was not equal to original file.');
}
}
}
}
示例3: createZip
/**
* create zip from created font
*
* @param object $currentFont
* @return string
*/
public static function createZip($currentFont)
{
// general vars
$cleanTitle = strtolower(preg_replace(array('/\\s+/', '/[^a-zA-Z0-9]/'), array('-', ''), $currentFont->getTitle()));
$fontPath = PATH_site . 'fileadmin/' . $currentFont->getDestination() . $cleanTitle . '/';
$fileName = $destinationPath = PATH_site . 'fileadmin/' . $currentFont->getDestination() . $cleanTitle . '_' . $currentFont->getVersion() . '_' . date('YmdHi', $GLOBALS['EXEC_TIME']) . '.zip';
$zip = new \ZipArchive();
$zip->open($fileName, \ZipArchive::CREATE);
// Get all the files of the extension, but exclude the ones specified in the excludePattern
$files = GeneralUtility::getAllFilesAndFoldersInPath(array(), $fontPath, '', TRUE, PHP_INT_MAX);
// Make paths relative to extension root directory.
$files = GeneralUtility::removePrefixPathFromList($files, $fontPath);
// Remove the one empty path that is the extension dir itself.
$files = array_filter($files);
foreach ($files as $file) {
$fullPath = $fontPath . $file;
// Distinguish between files and directories, as creation of the archive
// fails on Windows when trying to add a directory with "addFile".
if (is_dir($fullPath)) {
$zip->addEmptyDir($file);
} else {
$zip->addFile($fullPath, $file);
}
}
$zip->close();
return $fileName;
}
示例4: prepareLoader
/**
* Get all the complex data for the loader.
* This return value will be cached and stored in the database
* There is no file monitoring for this cache
*
* @param Loader $loader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $loader, $type)
{
$icons = [];
if (!class_exists('TYPO3\\CMS\\Core\\Imaging\\IconRegistry')) {
return $icons;
}
$iconFolder = 'Resources/Public/Icon/';
$folder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . $iconFolder;
$extensionPath = ExtensionManagementUtility::extPath($loader->getExtensionKey());
$files = GeneralUtility::getAllFilesAndFoldersInPath([], $folder, '', false, true);
if (!sizeof($files)) {
return $icons;
}
foreach ($files as $path) {
$provider = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\BitmapIconProvider';
if (substr(strtolower($path), -3) === 'svg') {
$provider = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\SvgIconProvider';
}
$relativePath = str_replace($extensionPath, '', $path);
$iconPath = str_replace($iconFolder, '', $relativePath);
$pathElements = PathUtility::pathinfo(strtolower(str_replace('/', '-', $iconPath)));
$icons[] = ['provider' => $provider, 'path' => 'EXT:' . $loader->getExtensionKey() . '/' . $relativePath, 'identifier' => str_replace('_', '-', $loader->getExtensionKey()) . '-' . $pathElements['filename']];
}
return $icons;
}
示例5: getClassNamesInExtension
/**
* Get all class names inside this namespace and return them as array.
*
* @param string $combinedExtensionKey Extension Key with (possibly) leading Vendor Prefix
* @return array
*/
protected function getClassNamesInExtension($combinedExtensionKey)
{
$allViewHelperClassNames = array();
list($vendor, $extensionKey) = $this->getRealExtensionKeyAndVendorFromCombinedExtensionKey($combinedExtensionKey);
$path = ExtensionManagementUtility::extPath($extensionKey, 'Classes/ViewHelpers/');
$filesInPath = GeneralUtility::getAllFilesAndFoldersInPath(array(), $path, 'php');
foreach ($filesInPath as $filePathAndFilename) {
$className = $this->getRealClassNameBasedOnExtensionAndFilenameAndExistence($combinedExtensionKey, $filePathAndFilename);
if (class_exists($className)) {
$parent = $className;
while ($parent = get_parent_class($parent)) {
array_push($allViewHelperClassNames, $className);
}
}
}
$affectedViewHelperClassNames = array();
foreach ($allViewHelperClassNames as $viewHelperClassName) {
$classReflection = new \ReflectionClass($viewHelperClassName);
if ($classReflection->isAbstract() === TRUE) {
continue;
}
$affectedViewHelperClassNames[] = $viewHelperClassName;
}
sort($affectedViewHelperClassNames);
return $affectedViewHelperClassNames;
}
示例6: prepareLoader
/**
* Get all the complex data for the loader.
* This return value will be cached and stored in the database
* There is no file monitoring for this cache
*
* @param Loader $autoLoader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $autoLoader, $type)
{
$languageOverride = [];
if ($type === LoaderInterface::EXT_TABLES) {
return $languageOverride;
}
$languageOverridePath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Resources/Private/Language/Overrides/';
if (!is_dir($languageOverridePath)) {
return $languageOverride;
}
$files = GeneralUtility::getAllFilesAndFoldersInPath([], $languageOverridePath, 'xlf,php,xml', false, 99);
foreach ($files as $file) {
$file = str_replace($languageOverridePath, '', $file);
$parts = GeneralUtility::trimExplode('/', $file, true);
$extension = GeneralUtility::camelCaseToLowerCaseUnderscored($parts[0]);
unset($parts[0]);
$parts = array_values($parts);
// language
$language = 'default';
$fileParts = GeneralUtility::trimExplode('.', PathUtility::basename($file), true);
if (strlen($fileParts[0]) === 2) {
$language = $fileParts[0];
unset($fileParts[0]);
$parts[sizeof($parts) - 1] = implode('.', $fileParts);
}
$languageOverride[] = ['language' => $language, 'original' => 'EXT:' . $extension . '/' . implode('/', $parts), 'override' => 'EXT:' . $autoLoader->getExtensionKey() . '/Resources/Private/Language/Overrides/' . $file];
}
return $languageOverride;
}
示例7: getFilesRecursive
/**
* @param string $path
* @param string $extensions
* @return array
*/
public static function getFilesRecursive($path, $extensions)
{
if ('/' !== substr($path, -1)) {
$path .= '/';
}
$files = GeneralUtility::getAllFilesAndFoldersInPath(array(), $path, $extensions);
return array_values($files);
}
示例8: main
/**
* Find lost files in uploads/ folder
* FIX METHOD: Simply delete the file...
*
* TODO: Add parameter to exclude filepath
* TODO: Add parameter to list more file names/patterns to ignore
* TODO: Add parameter to include RTEmagic images
*
* @return array
* @todo Define visibility
*/
public function main()
{
global $TYPO3_DB;
// Initialize result array:
$resultArray = array('message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'], 'headers' => array('managedFiles' => array('Files related to TYPO3 records and managed by TCEmain', 'These files you definitely want to keep.', 0), 'ignoredFiles' => array('Ignored files (index.html, .htaccess etc.)', 'These files are allowed in uploads/ folder', 0), 'RTEmagicFiles' => array('RTE magic images - those found (and ignored)', 'These files are also allowed in some uploads/ folders as RTEmagic images.', 0), 'lostFiles' => array('Lost files - those you can delete', 'You can delete these files!', 3), 'warnings' => array('Warnings picked up', '', 2)), 'managedFiles' => array(), 'ignoredFiles' => array(), 'RTEmagicFiles' => array(), 'lostFiles' => array(), 'warnings' => array());
// Get all files:
$fileArr = array();
$fileArr = \TYPO3\CMS\Core\Utility\GeneralUtility::getAllFilesAndFoldersInPath($fileArr, PATH_site . 'uploads/');
$fileArr = \TYPO3\CMS\Core\Utility\GeneralUtility::removePrefixPathFromList($fileArr, PATH_site);
$excludePaths = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->cli_argValue('--excludePath', 0), TRUE);
// Traverse files and for each, look up if its found in the reference index.
foreach ($fileArr as $key => $value) {
$include = TRUE;
foreach ($excludePaths as $exclPath) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($value, $exclPath)) {
$include = FALSE;
}
}
$shortKey = \TYPO3\CMS\Core\Utility\GeneralUtility::shortmd5($value);
if ($include) {
// First, allow "index.html", ".htaccess" files since they are often used for good reasons
if (substr($value, -11) == '/index.html' || substr($value, -10) == '/.htaccess') {
unset($fileArr[$key]);
$resultArray['ignoredFiles'][$shortKey] = $value;
} else {
// Looking for a reference from a field which is NOT a soft reference (thus, only fields with a proper TCA/Flexform configuration)
$recs = $TYPO3_DB->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table=' . $TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex') . ' AND ref_string=' . $TYPO3_DB->fullQuoteStr($value, 'sys_refindex') . ' AND softref_key=' . $TYPO3_DB->fullQuoteStr('', 'sys_refindex'), '', 'sorting DESC');
// If found, unset entry:
if (count($recs)) {
unset($fileArr[$key]);
$resultArray['managedFiles'][$shortKey] = $value;
if (count($recs) > 1) {
$resultArray['warnings'][$shortKey] = 'Warning: File "' . $value . '" had ' . count($recs) . ' references from group-fields, should have only one!';
}
} else {
// When here it means the file was not found. So we test if it has a RTEmagic-image name and if so, we allow it:
if (preg_match('/^RTEmagic[P|C]_/', basename($value))) {
unset($fileArr[$key]);
$resultArray['RTEmagicFiles'][$shortKey] = $value;
} else {
// We conclude that the file is lost...:
unset($fileArr[$key]);
$resultArray['lostFiles'][$shortKey] = $value;
}
}
}
}
}
asort($resultArray['ignoredFiles']);
asort($resultArray['managedFiles']);
asort($resultArray['RTEmagicFiles']);
asort($resultArray['lostFiles']);
asort($resultArray['warnings']);
// $fileArr variable should now be empty with all contents transferred to the result array keys.
return $resultArray;
}
示例9: getChecksumsForPath
/**
* @param string $path
* @param array $excludePattern
* @return array
*/
public function getChecksumsForPath($path, array $excludePattern = array())
{
// Always ensure trailing slash
// This is needed for relative path calculation
$path = rtrim($path, '/') . '/';
$md5ChecksumArray = array();
$filesArray = GeneralUtility::getAllFilesAndFoldersInPath(array(), $path, '', false, 99, $this->generateExcludeExpression($excludePattern));
foreach ($filesArray as $file) {
$relativeFileName = substr($file, strlen($path));
$fileContent = GeneralUtility::getUrl($file);
$md5ChecksumArray[$relativeFileName] = substr(md5($fileContent), 0, 4);
}
return $md5ChecksumArray;
}
示例10: prepareLoader
/**
* Get all the complex data for the loader.
* This return value will be cached and stored in the database
* There is no file monitoring for this cache
*
* @param Loader $loader
* @param int $type
*
* @return array
*/
public function prepareLoader(Loader $loader, $type)
{
$tsConfiguration = [];
$extPath = ExtensionManagementUtility::extPath($loader->getExtensionKey());
$baseDir = $extPath . 'Configuration/TypoScript/';
if (!is_dir($baseDir)) {
return $tsConfiguration;
}
$typoScriptFolder = GeneralUtility::getAllFilesAndFoldersInPath([], $baseDir, '', true, 99, '(.*)\\.(.*)');
$extensionName = GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey());
foreach ($typoScriptFolder as $folder) {
if (is_file($folder . 'setup.txt') || is_file($folder . 'constants.txt')) {
$setupName = $extensionName . '/' . str_replace($baseDir, '', $folder);
$setupName = implode(' - ', GeneralUtility::trimExplode('/', $setupName, true));
$folder = str_replace($extPath, '', $folder);
$tsConfiguration[] = ['path' => $folder, 'title' => $setupName];
}
}
return $tsConfiguration;
}
示例11: addLayoutOptions
/**
* Renders a Fluid Template Layout select field
*
* @param array $parameters
* @param mixed $pObj
* @return string
*/
public function addLayoutOptions(&$parameters, &$pObj)
{
$referringField = $parameters['config']['arguments']['referring_field'];
$currentValue = $parameters['row'][$referringField];
$configuration = $this->configurationService->getViewConfigurationByFileReference($currentValue);
$layoutRootPath = $configuration['layoutRootPath'];
$layoutRootPath = GeneralUtility::getFileAbsFileName($layoutRootPath);
$files = array();
$files = TRUE === is_dir($layoutRootPath) ? GeneralUtility::getAllFilesAndFoldersInPath($files, $layoutRootPath) : array();
foreach ($files as $file) {
$file = substr($file, strlen($layoutRootPath));
if (0 !== strpos($file, '.')) {
$dir = pathinfo($file, PATHINFO_DIRNAME);
$file = pathinfo($file, PATHINFO_FILENAME);
if ('.' !== $dir) {
$file = $dir . '/' . $file;
}
array_push($parameters['items'], array($file, $file));
}
}
}
示例12: createZipFileFromExtension
/**
* Create a zip file from an extension
*
* @param array $extension
* @return string Name and path of create zip file
*/
public function createZipFileFromExtension($extension)
{
$extensionPath = $this->getAbsoluteExtensionPath($extension);
// Add trailing slash to the extension path, getAllFilesAndFoldersInPath explicitly requires that.
$extensionPath = PathUtility::sanitizeTrailingSeparator($extensionPath);
$version = $this->getExtensionVersion($extension);
if (empty($version)) {
$version = '0.0.0';
}
if (!@is_dir(PATH_site . 'typo3temp/ExtensionManager/')) {
GeneralUtility::mkdir(PATH_site . 'typo3temp/ExtensionManager/');
}
$fileName = $this->getAbsolutePath('typo3temp/ExtensionManager/' . $extension . '_' . $version . '_' . date('YmdHi', $GLOBALS['EXEC_TIME']) . '.zip');
$zip = new \ZipArchive();
$zip->open($fileName, \ZipArchive::CREATE);
$excludePattern = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
// Get all the files of the extension, but exclude the ones specified in the excludePattern
$files = GeneralUtility::getAllFilesAndFoldersInPath(array(), $extensionPath, '', true, PHP_INT_MAX, $excludePattern);
// Make paths relative to extension root directory.
$files = GeneralUtility::removePrefixPathFromList($files, $extensionPath);
// Remove the one empty path that is the extension dir itself.
$files = array_filter($files);
foreach ($files as $file) {
$fullPath = $extensionPath . $file;
// Distinguish between files and directories, as creation of the archive
// fails on Windows when trying to add a directory with "addFile".
if (is_dir($fullPath)) {
$zip->addEmptyDir($file);
} else {
$zip->addFile($fullPath, $file);
}
}
$zip->close();
return $fileName;
}
示例13: crawler_execute_type2
/**
* Indexing files from fileadmin
*
* @param array $cfgRec Indexing Configuration Record
* @param array $session_data Session data for the indexing session spread over multiple instances of the script. Passed by reference so changes hereto will be saved for the next call!
* @param array $params Parameters from the log queue.
* @param object $pObj Parent object (from "crawler" extension!)
* @return void
*/
public function crawler_execute_type2($cfgRec, &$session_data, $params, &$pObj)
{
// Prepare path, making it absolute and checking:
$readpath = $params['url'];
if (!GeneralUtility::isAbsPath($readpath)) {
$readpath = GeneralUtility::getFileAbsFileName($readpath);
}
if (GeneralUtility::isAllowedAbsPath($readpath)) {
if (@is_file($readpath)) {
// If file, index it!
// Get root line (need to provide this when indexing external files)
$rl = $this->getUidRootLineForClosestTemplate($cfgRec['pid']);
// (Re)-Indexing file on page.
$indexerObj = GeneralUtility::makeInstance(\TYPO3\CMS\IndexedSearch\Indexer::class);
$indexerObj->backend_initIndexer($cfgRec['pid'], 0, 0, '', $rl);
$indexerObj->backend_setFreeIndexUid($cfgRec['uid'], $cfgRec['set_id']);
$indexerObj->hash['phash'] = -1;
// EXPERIMENT - but to avoid phash_t3 being written to file sections (otherwise they are removed when page is reindexed!!!)
// Index document:
$indexerObj->indexRegularDocument(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($readpath), TRUE);
} elseif (@is_dir($readpath)) {
// If dir, read content and create new pending items for log:
// Select files and directories in path:
$extList = implode(',', GeneralUtility::trimExplode(',', $cfgRec['extensions'], TRUE));
$fileArr = array();
$files = GeneralUtility::getAllFilesAndFoldersInPath($fileArr, $readpath, $extList, 0, 0);
$directoryList = GeneralUtility::get_dirs($readpath);
if (is_array($directoryList) && $params['depth'] < $cfgRec['depth']) {
foreach ($directoryList as $subdir) {
if ((string) $subdir != '') {
$files[] = $readpath . $subdir . '/';
}
}
}
$files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
// traverse the items and create log entries:
foreach ($files as $path) {
$this->instanceCounter++;
if ($path !== $params['url']) {
// Parameters:
$nparams = array('indexConfigUid' => $cfgRec['uid'], 'url' => $path, 'procInstructions' => array('[Index Cfg UID#' . $cfgRec['uid'] . ']'), 'depth' => $params['depth'] + 1);
$pObj->addQueueEntry_callBack($cfgRec['set_id'], $nparams, $this->callBack, $cfgRec['pid'], $GLOBALS['EXEC_TIME'] + $this->instanceCounter * $this->secondsPerExternalUrl);
}
}
}
}
}
示例14: getAllFilesAndFoldersInPathReturnsArrayWithMd5Keys
/**
* @test
*/
public function getAllFilesAndFoldersInPathReturnsArrayWithMd5Keys()
{
$directory = PATH_site . 'typo3temp/' . $this->getUniqueId('directory_');
mkdir($directory);
$filesAndDirectories = GeneralUtility::getAllFilesAndFoldersInPath(array(), $directory, '', true);
$check = true;
foreach ($filesAndDirectories as $md5 => $path) {
if (!preg_match('/^[a-f0-9]{32}$/', $md5)) {
$check = false;
}
}
GeneralUtility::rmdir($directory);
$this->assertTrue($check);
}
示例15: syntaxAction
/**
* @validate $syntax NotEmpty
* @validate $extensions NotEmpty
* @validate $formats NotEmpty
* @ignorevalidation $filteredFiles
* @param array $syntax
* @param array $extensions
* @param array $formats
* @param array $filteredFiles
*/
public function syntaxAction(array $syntax, array $extensions, array $formats, array $filteredFiles = [])
{
/** @var DocumentTemplate $document */
$document =& $GLOBALS['TBE_TEMPLATE'];
$resourcePath = $document->backPath . ExtensionManagementUtility::extRelPath('builder') . 'Resources/Public/';
$pageRenderer = new PageRenderer();
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.canvasTextRenderer.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.canvasAxisTickRenderer.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.cursor.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.categoryAxisRenderer.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.barRenderer.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/jqplot.pointLabels.min.js');
$pageRenderer->addJsFile($resourcePath . 'Javascript/plotter.js');
$reports = [];
$csvFormats = trim(implode(',', $formats), ',');
foreach ($extensions as $extensionKey) {
if (true === empty($extensionKey)) {
continue;
}
$extensionFolder = ExtensionManagementUtility::extPath($extensionKey);
$reports[$extensionKey] = [];
foreach ($syntax as $syntaxName) {
if (true === empty($syntaxName)) {
continue;
}
$reportsForSyntaxName = [];
if ('php' === $syntaxName) {
$reportsForSyntaxName = $this->syntaxService->syntaxCheckPhpFilesInPath($extensionFolder . '/Classes');
} elseif ('fluid' === $syntaxName) {
$reportsForSyntaxName = $this->syntaxService->syntaxCheckFluidTemplateFilesInPath($extensionFolder . '/Resources', $csvFormats);
} elseif ('profile' === $syntaxName) {
$files = GeneralUtility::getAllFilesAndFoldersInPath([], $extensionFolder, $csvFormats);
if (0 === count($filteredFiles)) {
$filteredFiles = $files;
}
$this->view->assign('files', $files);
$this->view->assign('basePathLength', strlen($extensionFolder . '/Resources/Private'));
foreach ($files as $file) {
if (0 < count($filteredFiles) && false === in_array($file, $filteredFiles)) {
continue;
}
$shortFilename = substr($file, strlen($extensionFolder . '/Resources/Private'));
/** @var TemplateAnalyzer $templateAnalyzer */
$templateAnalyzer = $this->objectManager->get(TemplateAnalyzer::class);
$reportsForSyntaxName[$shortFilename] = $templateAnalyzer->analyzePathAndFilename($file);
}
$reports[$extensionKey][$syntaxName]['json'] = $this->encodeMetricsToJson($reportsForSyntaxName);
}
$reports[$extensionKey][$syntaxName]['reports'] = $reportsForSyntaxName;
$reports[$extensionKey][$syntaxName]['errors'] = $this->syntaxService->countErrorsInResultCollection($reportsForSyntaxName);
}
}
$this->view->assign('filteredFiles', $filteredFiles);
$this->view->assign('reports', $reports);
$this->view->assign('extensions', $extensions);
$this->view->assign('formats', $formats);
$this->view->assign('syntax', $syntax);
$this->view->assign('view', 'Index');
}