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


PHP PathUtility::sanitizeTrailingSeparator方法代码示例

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


在下文中一共展示了PathUtility::sanitizeTrailingSeparator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLocallangPaths

 public static function getLocallangPaths(array $directories = null)
 {
     if ($directories === null) {
         $directories = array('typo3conf/ext/', 'typo3/sysext/');
         $directories = array('typo3conf/ext/');
     }
     $files = array();
     // Traverse extension locations:
     foreach ($directories as $path) {
         $path = static::getAbsolutePath(\TYPO3\CMS\Core\Utility\PathUtility::sanitizeTrailingSeparator($path));
         if (is_dir($path)) {
             $files = array_merge($files, GeneralUtility::getAllFilesAndFoldersInPath(array(), $path, 'xml,xlf', false, 99, 'Tests'));
         }
     }
     // Remove all non-locallang files (looking at the prefix)
     foreach ($files as $key => $value) {
         if (strpos(basename($value), 'locallang') !== 0) {
             unset($files[$key]);
         } else {
             $files[$key] = PathUtility::getTypo3PathTo($value);
         }
     }
     return $files;
 }
开发者ID:r3h6,项目名称:TYPO3.EXT.locallang_tools,代码行数:24,代码来源:PathUtility.php

示例2: 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;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:41,代码来源:FileHandlingUtility.php

示例3: isTrailingSeparatorSanitizedCorrectly

 /**
  * @param string $path
  * @param string $separator
  * @param string $expected
  * @dataProvider isTrailingSeparatorSanitizedCorrectlyDataProvider
  * @test
  */
 public function isTrailingSeparatorSanitizedCorrectly($path, $separator, $expected)
 {
     $sanitizedPath = \TYPO3\CMS\Core\Utility\PathUtility::sanitizeTrailingSeparator($path, $separator);
     $this->assertEquals($expected, $sanitizedPath);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:12,代码来源:PathUtilityTest.php

示例4: scanPackagesInPath

 /**
  * Scans all sub directories of the specified directory and collects the package keys of packages it finds.
  *
  * The return of the array is to make this method usable in array_merge.
  *
  * @param string $startPath
  * @param array $collectedPackagePaths
  * @return array
  */
 protected function scanPackagesInPath($startPath, array $collectedPackagePaths)
 {
     foreach (new \DirectoryIterator($startPath) as $fileInfo) {
         if (!$fileInfo->isDir()) {
             continue;
         }
         $filename = $fileInfo->getFilename();
         if ($filename[0] !== '.') {
             $currentPath = $fileInfo->getPathName();
             $currentPath = PathUtility::sanitizeTrailingSeparator($currentPath);
             if ($this->hasComposerManifestFile($currentPath)) {
                 $collectedPackagePaths[$currentPath] = $currentPath;
             }
         }
     }
     return $collectedPackagePaths;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:26,代码来源:PackageManager.php

示例5: registerPackagesFromConfiguration

 /**
  * Requires and registers all packages which were defined in packageStatesConfiguration
  *
  * @param bool $registerOnlyNewPackages
  * @return void
  */
 protected function registerPackagesFromConfiguration($registerOnlyNewPackages = false)
 {
     $packageStatesHasChanged = false;
     foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $stateConfiguration) {
         if ($registerOnlyNewPackages && $this->isPackageAvailable($packageKey)) {
             continue;
         }
         if (!isset($stateConfiguration['packagePath'])) {
             $this->unregisterPackageByPackageKey($packageKey);
             $packageStatesHasChanged = true;
             continue;
         }
         try {
             $packagePath = PathUtility::sanitizeTrailingSeparator($this->packagesBasePath . $stateConfiguration['packagePath']);
             $package = new Package($this, $packageKey, $packagePath);
         } catch (Exception\InvalidPackagePathException $exception) {
             $this->unregisterPackageByPackageKey($packageKey);
             $packageStatesHasChanged = true;
             continue;
         } catch (Exception\InvalidPackageKeyException $exception) {
             $this->unregisterPackageByPackageKey($packageKey);
             $packageStatesHasChanged = true;
             continue;
         } catch (Exception\InvalidPackageManifestException $exception) {
             $this->unregisterPackageByPackageKey($packageKey);
             $packageStatesHasChanged = true;
             continue;
         }
         $this->registerPackage($package, false);
         if ($stateConfiguration['state'] === 'active') {
             $this->activePackages[$packageKey] = $this->packages[$packageKey];
         }
     }
     if ($packageStatesHasChanged) {
         $this->sortAndSavePackageStates();
     }
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:43,代码来源:PackageManager.php


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