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


PHP GeneralUtility::getFilesInDir方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::getFilesInDir方法的具体用法?PHP GeneralUtility::getFilesInDir怎么用?PHP GeneralUtility::getFilesInDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\GeneralUtility的用法示例。


在下文中一共展示了GeneralUtility::getFilesInDir方法的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);
     }
 }
开发者ID:ecodev,项目名称:newsletter,代码行数:36,代码来源:IncludeJsFolderViewHelper.php

示例2: clearTempFiles

 /**
  * Deletes all files older than a specific time in a temporary upload folder.
  * Settings for the threshold time and the folder are made in TypoScript.
  *
  * @param integer $olderThanValue Delete files older than this value.
  * @param string $olderThanUnit The unit for $olderThan. May be seconds|minutes|hours|days
  * @return void
  * @author	Reinhard Führicht <rf@typoheads.at>
  */
 protected function clearTempFiles($olderThanValue, $olderThanUnit)
 {
     if (!$olderThanValue) {
         return;
     }
     $uploadFolders = $this->utilityFuncs->getAllTempUploadFolders();
     foreach ($uploadFolders as $uploadFolder) {
         //build absolute path to upload folder
         $path = $this->utilityFuncs->getDocumentRoot() . $uploadFolder;
         $path = $this->utilityFuncs->sanitizePath($path);
         //read files in directory
         $tmpFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($path);
         $this->utilityFuncs->debugMessage('cleaning_temp_files', array($path));
         //calculate threshold timestamp
         $threshold = $this->utilityFuncs->getTimestamp($olderThanValue, $olderThanUnit);
         //for all files in temp upload folder
         foreach ($tmpFiles as $idx => $file) {
             //if creation timestamp is lower than threshold timestamp
             //delete the file
             $creationTime = filemtime($path . $file);
             //fix for different timezones
             $creationTime += date('O') / 100 * 60;
             if ($creationTime < $threshold) {
                 unlink($path . $file);
                 $this->utilityFuncs->debugMessage('deleting_file', array($file));
             }
         }
     }
 }
开发者ID:woehrlag,项目名称:new.woehrl.de,代码行数:38,代码来源:Tx_Formhandler_PreProcessor_ClearTempFiles.php

示例3: flexFormAutoLoader

 /**
  * Call this function at the end of your ext_tables.php to autoregister the flexforms
  * of the extension to the given plugins.
  *
  * @return void
  */
 public static function flexFormAutoLoader()
 {
     global $TCA, $_EXTKEY;
     $_extConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['nn_address']);
     $FlexFormPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/FlexForms/';
     $extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
     $FlexForms = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($FlexFormPath, 'xml');
     foreach ($FlexForms as $FlexForm) {
         if (preg_match("/^Model_(.*)\$/", $FlexForm)) {
             continue;
         }
         $fileKey = str_replace('.xml', '', $FlexForm);
         $pluginSignature = strtolower($extensionName . '_' . $fileKey);
         #$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,recursive';
         $TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'select_key,recursive';
         $TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
         $fileFlexForm = 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/' . $fileKey . '.xml';
         // Any flexform dir in extension config set?
         if ($_extConfig['flexFormPlugin'] != '') {
             if (is_dir(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($_extConfig['flexFormPlugin']))) {
                 // modify the relative path
                 $path = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($_extConfig['flexFormPlugin']);
                 $path = preg_match('/^(.*)\\/$/', $path) ? $path : $path . '/';
                 $fileFlexForm = 'FILE:' . $path . $fileKey . '.xml';
             }
         }
         \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, $fileFlexForm);
     }
 }
开发者ID:Tricept,项目名称:nn_address,代码行数:35,代码来源:Flexform.php

示例4: loadRegisteredSprites

 /**
  * Loads all stylesheet files registered through
  * \TYPO3\CMS\Backend\Sprite\SpriteManager::addIconSprite
  *
  * In fact the stylesheet-files are copied to \TYPO3\CMS\Backend\Sprite\SpriteManager::tempPath
  * where they automatically will be included from via
  * \TYPO3\CMS\Backend\Template\DocumentTemplate and
  * \TYPO3\CMS\Core\Resource\ResourceCompressor
  *
  * @return void
  */
 protected function loadRegisteredSprites()
 {
     // Saves which CSS Files are currently "allowed to be in place"
     $allowedCssFilesinTempDir = array(basename($this->cssTcaFile));
     // Process every registeres file
     foreach ((array) $GLOBALS['TBE_STYLES']['spritemanager']['cssFiles'] as $file) {
         $fileName = basename($file);
         // File should be present
         $allowedCssFilesinTempDir[] = $fileName;
         // get-Cache Filename
         $fileStatus = stat(PATH_site . $file);
         $unique = md5($fileName . $fileStatus['mtime'] . $fileStatus['size']);
         $cacheFile = PATH_site . SpriteManager::$tempPath . $fileName . $unique . '.css';
         if (!file_exists($cacheFile)) {
             copy(PATH_site . $file, $cacheFile);
         }
     }
     // Get all .css files in dir
     $cssFilesPresentInTempDir = GeneralUtility::getFilesInDir(PATH_site . SpriteManager::$tempPath, '.css', 0);
     // and delete old ones which are not needed anymore
     $filesToDelete = array_diff($cssFilesPresentInTempDir, $allowedCssFilesinTempDir);
     foreach ($filesToDelete as $file) {
         unlink(PATH_site . SpriteManager::$tempPath . $file);
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:36,代码来源:AbstractSpriteHandler.php

示例5: getBackendLayoutFiles

 /**
  * Retrieves backend layout files
  *
  * @return array Available backend layout files
  */
 protected function getBackendLayoutFiles()
 {
     $directory = GeneralUtility::getFileAbsFileName('EXT:bdp_template/Resources/Private/BackendLayouts');
     $filesInDirectory = GeneralUtility::getFilesInDir($directory, 'ts', TRUE);
     if (!is_array($filesInDirectory)) {
         $filesInDirectory = array();
     }
     return $filesInDirectory;
 }
开发者ID:pfadfinden,项目名称:bdp_template,代码行数:14,代码来源:FileProvider.php

示例6: getLayoutFiles

 /**
  * Get all files
  *
  * @return array
  * @throws \UnexpectedValueException
  */
 protected function getLayoutFiles()
 {
     $fileCollection = array();
     $path = ExtensionManagementUtility::extPath('theme') . self::LAYOUT_PATH;
     $filesOfDirectory = GeneralUtility::getFilesInDir($path, self::FILE_TYPES_LAYOUT, TRUE, 1);
     foreach ($filesOfDirectory as $file) {
         $this->addFileToCollection($file, $fileCollection);
     }
     return $fileCollection;
 }
开发者ID:jousch,项目名称:TYPO3.base,代码行数:16,代码来源:FileProvider.php

示例7: getFileInformationInDir

 /**
  * Get file information in the given folder
  *
  * @param string $dirPath
  * @param string $fileExtension
  * @param int $informationType
  *
  * @return array
  */
 protected static function getFileInformationInDir($dirPath, $fileExtension, $informationType)
 {
     if (!is_dir($dirPath)) {
         return [];
     }
     $files = GeneralUtility::getFilesInDir($dirPath, $fileExtension);
     foreach ($files as $key => $file) {
         $files[$key] = PathUtility::pathinfo($file, $informationType);
     }
     return array_values($files);
 }
开发者ID:sirdiego,项目名称:autoloader,代码行数:20,代码来源:FileUtility.php

示例8: getLayoutFiles

 /**
  * GetLayoutFiles
  *
  * @return LayoutFileInfo[] Empty array if an error occurred
  */
 private function getLayoutFiles()
 {
     $absolutePath = ExtensionManagementUtility::extPath(self::EXTENSION_KEY, self::LAYOUT_PATH);
     $files = GeneralUtility::getFilesInDir($absolutePath, LayoutFileInfo::EXTENSION, true);
     if (!is_array($files)) {
         return [];
     }
     array_walk($files, function (&$file) {
         $absoluteFilePath = $file;
         $file = new LayoutFileInfo($absoluteFilePath);
     });
     return $files;
 }
开发者ID:svenhartmann,项目名称:vantomas,代码行数:18,代码来源:LayoutDataProvider.php

示例9: main

    /**
     * Main Task center module
     *
     * @return string HTML content.
     * @todo Define visibility
     */
    public function main()
    {
        if ($id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display')) {
            return $this->urlInIframe($this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id, 1);
        } else {
            // Thumbnail folder and files:
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1);
            }
            $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            $opt = array();
            $opt[] = '
			<tr class="bgColor5 tableheader">
				<td>Icon:</td>
				<td>Preset Title:</td>
				<td>Public</td>
				<td>Owner:</td>
				<td>Page:</td>
				<td>Path:</td>
				<td>Meta data:</td>
			</tr>';
            if (is_array($presets)) {
                foreach ($presets as $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $opt[] = '
					<tr class="bgColor4">
						<td>' . ($thumbnailFile ? '<img src="' . $this->backPath . '../' . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile) . '" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br />' : '&nbsp;') . '</td>
						<td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display=' . $presetCfg['uid'] . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, 30)) . '</a>&nbsp;</td>
						<td>' . ($presetCfg['public'] ? 'Yes' : '&nbsp;') . '</td>
						<td>' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? 'Own' : '[' . $usernames[$presetCfg['user_uid']]['username'] . ']') . '</td>
						<td>' . ($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : '&nbsp;') . '</td>
						<td>' . htmlspecialchars($configuration['pagetree']['id'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20) : '[Single Records]') . '</td>
						<td>
							<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . htmlspecialchars($configuration['meta']['description']) . ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . '
						</td>
					</tr>';
                }
                $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">' . implode('', $opt) . '</table>';
            }
        }
        // Output:
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section('Export presets', $content, 0, 1);
        return $theOutput;
    }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:57,代码来源:ModuleFunctionController.php

示例10: clearCacheCmd

 /**
  * Disconnects from Doodle by removing all stored cookies whenever
  * TYPO3 administrator flushes all "general" caches.
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj
  * @return void
  */
 public function clearCacheCmd(array $parameters, \TYPO3\CMS\Core\DataHandling\DataHandler $pObj)
 {
     if ($parameters['cacheCmd'] !== 'all') {
         return;
     }
     $cookiePath = PATH_site . 'typo3temp/tx_doodle/';
     if (is_dir($cookiePath)) {
         $cookies = GeneralUtility::getFilesInDir($cookiePath);
         foreach ($cookies as $cookie) {
             if (preg_match('/^[0-9a-f]{40}$/', $cookie)) {
                 @unlink($cookiePath . $cookie);
             }
         }
     }
 }
开发者ID:xperseguers,项目名称:t3ext-doodle,代码行数:23,代码来源:DataHandler.php

示例11: render

 /**
  * @return array
  */
 public function render()
 {
     $path = $this->arguments['path'];
     if (NULL === $path) {
         $path = $this->renderChildren();
         if (NULL === $path) {
             return array();
         }
     }
     $extensionList = $this->arguments['extensionList'];
     $prependPath = $this->arguments['prependPath'];
     $order = $this->arguments['order'];
     $excludePattern = $this->arguments['excludePattern'];
     $files = GeneralUtility::getFilesInDir($path, $extensionList, $prependPath, $order, $excludePattern);
     return $files;
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:19,代码来源:FilesViewHelper.php

示例12: main

 /**
  * Manipulating the input array, $params, adding new selectorbox items.
  *
  * @param	array	$params array of select field options (reference)
  * @param	object	$pObj parent object (reference)
  * @return	void
  */
 function main(&$params, &$pObj)
 {
     // get the current page ID
     $thePageId = $params['row']['pid'];
     /** @var TemplateService $template */
     $template = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService');
     // do not log time-performance information
     $template->tt_track = 0;
     $template->init();
     /** @var PageRepository $sys_page */
     $sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $rootLine = $sys_page->getRootLine($thePageId);
     // generate the constants/config + hierarchy info for the template.
     $template->runThroughTemplates($rootLine);
     $template->generateConfig();
     // get value for the path containing the template files
     $readPath = GeneralUtility::getFileAbsFileName($template->setup['plugin.']['tx_ttaddress_pi1.']['templatePath']);
     // if that direcotry is valid and is a directory then select files in it
     if (@is_dir($readPath)) {
         $template_files = GeneralUtility::getFilesInDir($readPath, 'tmpl,html,htm', 1, 1);
         /** @var HtmlParser $parseHTML */
         $parseHTML = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\HtmlParser');
         foreach ($template_files as $htmlFilePath) {
             // reset vars
             $selectorBoxItem_title = '';
             $selectorBoxItem_icon = '';
             // read template content
             $content = GeneralUtility::getUrl($htmlFilePath);
             // ... and extract content of the title-tags
             $parts = $parseHTML->splitIntoBlock('title', $content);
             $titleTagContent = $parseHTML->removeFirstAndLastTag($parts[1]);
             // set the item label
             $selectorBoxItem_title = trim($titleTagContent . ' (' . basename($htmlFilePath) . ')');
             // try to look up an image icon for the template
             $fI = GeneralUtility::split_fileref($htmlFilePath);
             $testImageFilename = $readPath . $fI['filebody'] . '.gif';
             if (@is_file($testImageFilename)) {
                 $selectorBoxItem_icon = '../' . substr($testImageFilename, strlen(PATH_site));
             }
             // finally add the new item
             $params['items'][] = array($selectorBoxItem_title, basename($htmlFilePath), $selectorBoxItem_icon);
         }
     }
 }
开发者ID:scheibome,项目名称:tt_address,代码行数:51,代码来源:AddFilesToSelector.php

示例13: resolveClassNamesInPackageSubNamespace

 /**
  * Resolves a list (array) of class names (not instances) of
  * all classes in files in the specified sub-namespace of the
  * specified package name. Does not attempt to load the class.
  * Does not work recursively.
  *
  * @param string $packageName
  * @param string $subNamespace
  * @param string|NULL $requiredSuffix If specified, class name must use this suffix
  * @return array
  */
 public function resolveClassNamesInPackageSubNamespace($packageName, $subNamespace, $requiredSuffix = NULL)
 {
     $classNames = array();
     $extensionKey = ExtensionNamingUtility::getExtensionKey($packageName);
     $prefix = str_replace('.', '\\', $packageName);
     $suffix = TRUE === empty($subNamespace) ? '' : str_replace('/', '\\', $subNamespace) . '\\';
     $folder = ExtensionManagementUtility::extPath($extensionKey, 'Classes/' . $subNamespace);
     $files = GeneralUtility::getFilesInDir($folder, 'php');
     if (TRUE === is_array($files)) {
         foreach ($files as $file) {
             $filename = pathinfo($file, PATHINFO_FILENAME);
             // include if no required suffix is given or string ends with suffix
             if (NULL === $requiredSuffix || 1 === preg_match('/' . $requiredSuffix . '$/', $filename)) {
                 $classNames[] = $prefix . '\\' . $suffix . $filename;
             }
         }
     }
     return $classNames;
 }
开发者ID:busynoggin,项目名称:flux,代码行数:30,代码来源:Resolver.php

示例14: addStyleSheetDirectory

 /**
  * Add all *.css files of the directory $path to the stylesheets
  *
  * @param string $path directory to add
  * @return void
  */
 public function addStyleSheetDirectory($path)
 {
     // Calculation needed, when TYPO3 source is used via a symlink
     // absolute path to the stylesheets
     $filePath = GeneralUtility::getFileAbsFileName($path, false, true);
     // Clean the path
     $resolvedPath = GeneralUtility::resolveBackPath($filePath);
     // Read all files in directory and sort them alphabetically
     $files = GeneralUtility::getFilesInDir($resolvedPath, 'css', false, 1);
     foreach ($files as $file) {
         $this->pageRenderer->addCssFile($path . $file, 'stylesheet', 'all');
     }
 }
开发者ID:amazingh,项目名称:TYPO3.CMS,代码行数:19,代码来源:DocumentTemplate.php

示例15: findFile

 /**
  * Searching for filename pattern recursively in the specified dir.
  *
  * @param string $basedir Base directory
  * @param string $pattern Match pattern
  * @param array $matching_files Array of matching files, passed by reference
  * @param integer $depth Depth to recurse
  * @return array Array with various information about the search result
  * @see func_filesearch()
  * @todo Define visibility
  */
 public function findFile($basedir, $pattern, &$matching_files, $depth)
 {
     $files_searched = 0;
     $dirs_searched = 0;
     $dirs_error = 0;
     // Traverse files:
     $files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($basedir, '', 1);
     if (is_array($files)) {
         $files_searched += count($files);
         // Escape the regexp. Note: we cannot use preg_quote here because it will escape more than we need!
         $regExpPattern = str_replace('/', '\\/', $pattern);
         foreach ($files as $value) {
             if (preg_match('/' . $regExpPattern . '/i', basename($value))) {
                 $matching_files[] = substr($value, strlen(PATH_site));
             }
         }
     }
     // Traverse subdirs
     if ($depth > 0) {
         $dirs = \TYPO3\CMS\Core\Utility\GeneralUtility::get_dirs($basedir);
         if (is_array($dirs)) {
             $dirs_searched += count($dirs);
             foreach ($dirs as $value) {
                 $inf = $this->findFile($basedir . $value . '/', $pattern, $matching_files, $depth - 1);
                 $dirs_searched += $inf[0];
                 $files_searched += $inf[1];
                 $dirs_error = $inf[2];
             }
         }
     } else {
         $dirs = \TYPO3\CMS\Core\Utility\GeneralUtility::get_dirs($basedir);
         if (is_array($dirs) && count($dirs)) {
             // Means error - there were further subdirs!
             $dirs_error = 1;
         }
     }
     return array($dirs_searched, $files_searched, $dirs_error);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:49,代码来源:DatabaseIntegrityView.php


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