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


PHP Files::getUnixStylePath方法代码示例

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


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

示例1: render

 /**
  * Include all JavaScript files matching the include regular expression
  * and not matching the exclude regular expression.
  *
  * @param string $include Regular expression of files to include
  * @param string $exclude Regular expression of files to exclude
  * @param string $package The package key of the resources to include or current controller package if NULL
  * @param string $subpackage The subpackage key of the resources to include or current controller subpackage if NULL
  * @param string $directory The directory inside the current subpackage. By default, the "JavaScript" directory will be used.
  * @return string
  */
 public function render($include, $exclude = NULL, $package = NULL, $subpackage = NULL, $directory = 'JavaScript')
 {
     $packageKey = $package === NULL ? $this->controllerContext->getRequest()->getControllerPackageKey() : $package;
     $subpackageKey = $subpackage === NULL ? $this->controllerContext->getRequest()->getControllerSubpackageKey() : $subpackage;
     $baseDirectory = 'resource://' . $packageKey . '/Public/' . ($subpackageKey !== NULL ? $subpackageKey . '/' : '') . $directory . '/';
     $staticJavaScriptWebBaseUri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/' . $packageKey . '/' . ($subpackageKey !== NULL ? $subpackageKey . '/' : '') . $directory . '/';
     $iterator = $this->iterateDirectoryRecursively($baseDirectory);
     if ($iterator === NULL) {
         return '<!-- Warning: Cannot include JavaScript because directory "' . $baseDirectory . '" does not exist. -->';
     }
     $uris = array();
     foreach ($iterator as $file) {
         $relativePath = substr($file->getPathname(), strlen($baseDirectory));
         $relativePath = \TYPO3\Flow\Utility\Files::getUnixStylePath($relativePath);
         if (!$this->patternMatchesPath($exclude, $relativePath) && $this->patternMatchesPath($include, $relativePath)) {
             $uris[] = $staticJavaScriptWebBaseUri . $relativePath;
         }
     }
     // Sadly, the aloha editor needs a predefined inclusion order, which right now matches
     // the sorted URI list. that's why we sort here...
     asort($uris);
     $output = '';
     foreach ($uris as $uri) {
         $output .= '<script src="' . $uri . '"></script>' . chr(10);
     }
     return $output;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:38,代码来源:IncludeJavaScriptViewHelper.php

示例2: getMockResourceByImagePath

 /**
  * Creates an Image object from a file using a mock resource (in order to avoid a database resource pointer entry)
  * @param string $imagePathAndFilename
  * @return \TYPO3\Flow\Resource\Resource
  */
 protected function getMockResourceByImagePath($imagePathAndFilename)
 {
     $imagePathAndFilename = \TYPO3\Flow\Utility\Files::getUnixStylePath($imagePathAndFilename);
     $hash = sha1_file($imagePathAndFilename);
     copy($imagePathAndFilename, 'resource://' . $hash);
     return $mockResource = $this->createMockResourceAndPointerFromHash($hash);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:12,代码来源:AbstractTest.php

示例3: registerAvailableVersions

 /**
  * Loads a list of available versions into an array.
  *
  * @return array
  * @throws \TYPO3\TYPO3CR\Migration\Exception\MigrationException
  */
 protected function registerAvailableVersions()
 {
     $this->availableVersions = array();
     foreach ($this->packageManager->getActivePackages() as $package) {
         $possibleMigrationsPath = \TYPO3\Flow\Utility\Files::concatenatePaths(array($package->getPackagePath(), 'Migrations/TYPO3CR'));
         if (!is_dir($possibleMigrationsPath)) {
             continue;
         }
         $directoryIterator = new \DirectoryIterator($possibleMigrationsPath);
         foreach ($directoryIterator as $fileInfo) {
             $filename = $fileInfo->getFilename();
             if ($fileInfo->isFile() && $filename[0] !== '.' && substr($filename, -5) === '.yaml') {
                 $versionFile = Files::getUnixStylePath($fileInfo->getPathname());
                 $versionNumber = substr(substr($filename, 7), 0, -5);
                 if (array_key_exists($versionNumber, $this->availableVersions)) {
                     throw new \TYPO3\TYPO3CR\Migration\Exception\MigrationException('The migration version ' . $versionNumber . ' exists twice, that is not supported.', 1345823182);
                 }
                 $this->availableVersions[$versionNumber] = array('filePathAndName' => $versionFile, 'package' => $package, 'formattedVersionNumber' => $versionNumber[6] . $versionNumber[7] . '-' . $versionNumber[4] . $versionNumber[5] . '-' . $versionNumber[0] . $versionNumber[1] . $versionNumber[2] . $versionNumber[3] . ' ' . $versionNumber[8] . $versionNumber[9] . ':' . $versionNumber[10] . $versionNumber[11] . ':' . $versionNumber[12] . $versionNumber[13]);
             }
         }
     }
     ksort($this->availableVersions);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:29,代码来源:YamlConfiguration.php

示例4: checkPhpBinary

 /**
  * Checks if the given PHP binary is executable and of the same version as the currently running one.
  *
  * @param string $phpBinaryPathAndFilename
  * @return Message An error or warning message or NULL if the PHP binary was detected successfully
  */
 protected function checkPhpBinary($phpBinaryPathAndFilename)
 {
     $phpVersion = NULL;
     if (file_exists($phpBinaryPathAndFilename) && is_file($phpBinaryPathAndFilename)) {
         if (DIRECTORY_SEPARATOR === '/') {
             $phpCommand = '"' . escapeshellcmd(Files::getUnixStylePath($phpBinaryPathAndFilename)) . '"';
         } else {
             $phpCommand = escapeshellarg(Files::getUnixStylePath($phpBinaryPathAndFilename));
         }
         // If the tested binary is a CGI binary that also runs the current request the SCRIPT_FILENAME would take precedence and create an endless recursion.
         $possibleScriptFilenameValue = getenv('SCRIPT_FILENAME');
         putenv('SCRIPT_FILENAME');
         exec($phpCommand . ' -v', $phpVersionString);
         if ($possibleScriptFilenameValue !== FALSE) {
             putenv('SCRIPT_FILENAME=' . (string) $possibleScriptFilenameValue);
         }
         if (!isset($phpVersionString[0]) || strpos($phpVersionString[0], '(cli)') === FALSE) {
             return new Error('The specified path to your PHP binary (see Configuration/Settings.yaml) is incorrect or not a PHP command line (cli) version.', 1341839376, array(), 'Environment requirements not fulfilled');
         }
         $versionStringParts = explode(' ', $phpVersionString[0]);
         $phpVersion = isset($versionStringParts[1]) ? trim($versionStringParts[1]) : NULL;
         if ($phpVersion === PHP_VERSION) {
             return NULL;
         }
     }
     if ($phpVersion === NULL) {
         return new Error('The specified path to your PHP binary (see Configuration/Settings.yaml) is incorrect.', 1341839376, array(), 'Environment requirements not fulfilled');
     } else {
         $phpMinorVersionMatch = array_slice(explode('.', $phpVersion), 0, 2) === array_slice(explode('.', PHP_VERSION), 0, 2);
         if ($phpMinorVersionMatch) {
             return new \TYPO3\Flow\Error\Warning('The specified path to your PHP binary (see Configuration/Settings.yaml) points to a PHP binary with the version "%s". This is not the exact same version as is currently running ("%s").', 1416913501, array($phpVersion, PHP_VERSION), 'Possible PHP version mismatch');
         } else {
             return new Error('The specified path to your PHP binary (see Configuration/Settings.yaml) points to a PHP binary with the version "%s". This is not compatible to the version that is currently running ("%s").', 1341839377, array($phpVersion, PHP_VERSION), 'Environment requirements not fulfilled');
         }
     }
 }
开发者ID:kdambekalns,项目名称:setup,代码行数:42,代码来源:RequestHandler.php

示例5: buildSubprocessCommand

 /**
  * @param string $commandIdentifier E.g. typo3.flow:cache:flush
  * @param array $settings The TYPO3.Flow settings
  * @param array $commandArguments Command arguments
  *
  * @return string A command line command ready for being exec()uted
  */
 protected static function buildSubprocessCommand($commandIdentifier, $settings, array $commandArguments = array())
 {
     $subRequestEnvironmentVariables = array('FLOW_ROOTPATH' => FLOW_PATH_ROOT, 'FLOW_CONTEXT' => $settings['core']['context']);
     if (isset($settings['core']['subRequestEnvironmentVariables'])) {
         $subRequestEnvironmentVariables = array_merge($subRequestEnvironmentVariables, $settings['core']['subRequestEnvironmentVariables']);
     }
     $command = '';
     foreach ($subRequestEnvironmentVariables as $argumentKey => $argumentValue) {
         if (DIRECTORY_SEPARATOR === '/') {
             $command .= sprintf('%s=%s ', $argumentKey, escapeshellarg($argumentValue));
         } else {
             $command .= sprintf('SET %s=%s&', $argumentKey, escapeshellarg($argumentValue));
         }
     }
     if (DIRECTORY_SEPARATOR === '/') {
         $phpBinaryPathAndFilename = '"' . escapeshellcmd(\TYPO3\Flow\Utility\Files::getUnixStylePath($settings['core']['phpBinaryPathAndFilename'])) . '"';
     } else {
         $phpBinaryPathAndFilename = escapeshellarg(\TYPO3\Flow\Utility\Files::getUnixStylePath($settings['core']['phpBinaryPathAndFilename']));
     }
     $command .= $phpBinaryPathAndFilename;
     if (!isset($settings['core']['subRequestPhpIniPathAndFilename']) || $settings['core']['subRequestPhpIniPathAndFilename'] !== FALSE) {
         if (!isset($settings['core']['subRequestPhpIniPathAndFilename'])) {
             $useIniFile = php_ini_loaded_file();
         } else {
             $useIniFile = $settings['core']['subRequestPhpIniPathAndFilename'];
         }
         $command .= ' -c ' . escapeshellarg($useIniFile);
     }
     $escapedArguments = '';
     if ($commandArguments !== array()) {
         foreach ($commandArguments as $argument => $argumentValue) {
             $escapedArguments .= ' ' . escapeshellarg('--' . trim($argument));
             if (trim($argumentValue) !== '') {
                 $escapedArguments .= ' ' . escapeshellarg(trim($argumentValue));
             }
         }
     }
     $command .= sprintf(' %s %s %s', escapeshellarg(FLOW_PATH_FLOW . 'Scripts/flow.php'), escapeshellarg($commandIdentifier), trim($escapedArguments));
     return trim($command);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:47,代码来源:Scripts.php

示例6: 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 = array())
 {
     foreach (new \DirectoryIterator($startPath) as $fileInfo) {
         if (!$fileInfo->isDir()) {
             continue;
         }
         $filename = $fileInfo->getFilename();
         if ($filename[0] !== '.') {
             $currentPath = Files::getUnixStylePath($fileInfo->getPathName());
             $composerManifestPaths = $this->findComposerManifestPaths($currentPath);
             foreach ($composerManifestPaths as $composerManifestPath) {
                 $targetDirectory = rtrim(self::getComposerManifest($composerManifestPath, 'target-dir'), '/');
                 $packagePath = $targetDirectory ? substr(rtrim($composerManifestPath, '/'), 0, -strlen((string) $targetDirectory)) : $composerManifestPath;
                 $collectedPackagePaths[$packagePath] = $composerManifestPath;
             }
         }
     }
     return $collectedPackagePaths;
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:28,代码来源:PackageManager.php

示例7: expandPatterns

 /**
  * Expands the given $patterns by adding an array element for each $replacement
  * replacing occurrences of $search.
  *
  * @param array $patterns
  * @param string $search
  * @param array $replacements
  * @return void
  */
 protected function expandPatterns(array &$patterns, $search, array $replacements)
 {
     $patternsWithReplacements = array();
     foreach ($patterns as $pattern) {
         foreach ($replacements as $replacement) {
             $patternsWithReplacements[] = Files::getUnixStylePath(str_replace($search, $replacement, $pattern));
         }
     }
     $patterns = $patternsWithReplacements;
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:19,代码来源:TemplateView.php

示例8: setUp

 /**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     $this->unixStylePath = Files::getUnixStylePath(__DIR__);
     $this->unixStylePathAndFilename = Files::getUnixStylePath(__FILE__);
     vfsStream::setup('testDirectory');
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:11,代码来源:FileMonitorTest.php

示例9: phpBinaryExistsAndIsExecutableFile

 /**
  * Checks if PHP binary file exists bypassing open_basedir violation.
  *
  * If PHP binary is not within open_basedir path,
  * it is impossible to access this binary in any other way than exec() or system().
  * So we must check existence of this file with system tools.
  *
  * @param string $phpBinaryPathAndFilename
  * @return boolean
  */
 protected function phpBinaryExistsAndIsExecutableFile($phpBinaryPathAndFilename)
 {
     $phpBinaryPathAndFilename = escapeshellarg(Files::getUnixStylePath($phpBinaryPathAndFilename));
     if (DIRECTORY_SEPARATOR === '/') {
         $command = sprintf('test -f %s && test -x %s', $phpBinaryPathAndFilename, $phpBinaryPathAndFilename);
     } else {
         $command = sprintf('IF EXIST %s (IF NOT EXIST %s\\* (EXIT 0) ELSE (EXIT 1)) ELSE (EXIT 1)', $phpBinaryPathAndFilename, $phpBinaryPathAndFilename);
     }
     exec($command, $outputLines, $exitCode);
     if ($exitCode === 0) {
         return true;
     }
     return false;
 }
开发者ID:RafaelKa,项目名称:setup,代码行数:24,代码来源:RequestHandler.php

示例10: getPartialPathAndFilename

 /**
  * Resolve the partial path and filename based on $this->getPartialRootPath() and request format
  *
  * @param string $partialName The name of the partial
  * @return string the full path which should be used. The path definitely exists.
  * @throws Exception\InvalidTemplateResourceException
  */
 protected function getPartialPathAndFilename($partialName)
 {
     $partialRootPath = $this->getPartialRootPath();
     if (!is_dir($partialRootPath)) {
         throw new Exception\InvalidTemplateResourceException('Partial root path "' . $partialRootPath . '" does not exist.', 1288094648);
     }
     $possiblePartialPaths = array();
     $possiblePartialPaths[] = Files::getUnixStylePath($partialRootPath . '/' . $partialName . '.' . $this->getRequest()->getFormat());
     $possiblePartialPaths[] = Files::getUnixStylePath($partialRootPath . '/' . $partialName);
     foreach ($possiblePartialPaths as $partialPathAndFilename) {
         if (is_file($partialPathAndFilename)) {
             return $partialPathAndFilename;
         }
     }
     throw new Exception\InvalidTemplateResourceException('Could not load partial file. Tried following paths: "' . implode('", "', $possiblePartialPaths) . '".', 1288092555);
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:23,代码来源:StandaloneView.php

示例11: getUnixStylePathWorksForPathWithProtocol

 /**
  * @test
  * @param string $path
  * @param string $expected
  * @dataProvider pathsWithProtocol
  */
 public function getUnixStylePathWorksForPathWithProtocol($path, $expected)
 {
     $this->assertEquals($expected, Files::getUnixStylePath($path));
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:10,代码来源:FilesTest.php

示例12: createPackage

 /**
  * Create a package, given the package key
  *
  * @param string $packageKey The package key of the new package
  * @param \TYPO3\Flow\Package\MetaData $packageMetaData If specified, this package meta object is used for writing the Package.xml file, otherwise a rudimentary Package.xml file is created
  * @param string $packagesPath If specified, the package will be created in this path, otherwise the default "Application" directory is used
  * @param string $packageType
  * @param array $manifest A composer manifest as associative array. This is a preparation for the signature change in Flow 4.0. If you use this argument, then $packageMetaData and $packageType will be ignored.
  * @return PackageInterface The newly created package
  *
  * @throws Exception\InvalidPackageKeyException
  * @throws Exception\PackageKeyAlreadyExistsException
  * @api
  * @deprecated The method signature of this method will change with Flow 4.0, the method itself will stay.
  * @see \TYPO3\Flow\Package\PackageManagerInterface::createPackage
  */
 public function createPackage($packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = null, $packagesPath = null, $packageType = 'neos-package', array $manifest = null)
 {
     if (!$this->isPackageKeyValid($packageKey)) {
         throw new Exception\InvalidPackageKeyException('The package key "' . $packageKey . '" is invalid', 1220722210);
     }
     if ($this->isPackageAvailable($packageKey)) {
         throw new Exception\PackageKeyAlreadyExistsException('The package key "' . $packageKey . '" already exists', 1220722873);
     }
     // TODO: This if and the method used can be removed for Flow 4.0 together with the MetaData classes.
     if ($manifest === null) {
         $manifest = $this->generateManifestFromMetaDataAndType($packageType, $packageMetaData);
     }
     if ($packagesPath === null) {
         $packagesPath = 'Application';
         $packageType = isset($manifest['type']) ? $manifest['type'] : PackageInterface::DEFAULT_COMPOSER_TYPE;
         if (is_array($this->settings['package']['packagesPathByType']) && isset($this->settings['package']['packagesPathByType'][$packageType])) {
             $packagesPath = $this->settings['package']['packagesPathByType'][$packageType];
         }
         $packagesPath = Files::getUnixStylePath(Files::concatenatePaths([$this->packagesBasePath, $packagesPath]));
     }
     $packagePath = Files::concatenatePaths([$packagesPath, $packageKey]) . '/';
     Files::createDirectoryRecursively($packagePath);
     foreach ([PackageInterface::DIRECTORY_CLASSES, PackageInterface::DIRECTORY_CONFIGURATION, PackageInterface::DIRECTORY_DOCUMENTATION, PackageInterface::DIRECTORY_RESOURCES, PackageInterface::DIRECTORY_TESTS_UNIT, PackageInterface::DIRECTORY_TESTS_FUNCTIONAL] as $path) {
         Files::createDirectoryRecursively(Files::concatenatePaths([$packagePath, $path]));
     }
     $manifest = ComposerUtility::writeComposerManifest($packagePath, $packageKey, $manifest);
     $refreshedPackageStatesConfiguration = $this->rescanPackages(false);
     $this->packageStatesConfiguration = $refreshedPackageStatesConfiguration;
     $this->registerPackageFromStateConfiguration($manifest['name'], $this->packageStatesConfiguration['packages'][$manifest['name']]);
     return $this->packages[$packageKey];
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:47,代码来源:PackageManager.php

示例13: monitorDirectory

 /**
  * Adds the specified directory to the list of directories to be monitored.
  * All files in these directories will be monitored too.
  *
  * @param string $path Absolute path of the directory to monitor
  * @param string $filenamePattern A pattern for filenames to consider for file monitoring (regular expression)
  * @return void
  * @throws \InvalidArgumentException
  * @api
  */
 public function monitorDirectory($path, $filenamePattern = NULL)
 {
     if (!is_string($path)) {
         throw new \InvalidArgumentException('String expected, ' . gettype($path), ' given.', 1231171810);
     }
     $path = rtrim(\TYPO3\Flow\Utility\Files::getUnixStylePath($path), '/');
     if (!array_key_exists($path, $this->monitoredDirectories)) {
         $this->monitoredDirectories[$path] = $filenamePattern;
     }
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:20,代码来源:FileMonitor.php

示例14: publishStaticResources

 /**
  * Recursively publishes static resources located in the specified directory.
  * These resources are typically public package resources provided by the active packages.
  *
  * @param string $sourcePath The full path to the source directory which should be published (includes sub directories)
  * @param string $relativeTargetPath Path relative to the target's root where resources should be published to.
  * @return boolean TRUE if publication succeeded or FALSE if the resources could not be published
  */
 public function publishStaticResources($sourcePath, $relativeTargetPath)
 {
     if (!is_dir($sourcePath)) {
         return FALSE;
     }
     $sourcePath = rtrim(\TYPO3\Flow\Utility\Files::getUnixStylePath($this->realpath($sourcePath)), '/');
     $targetPath = rtrim(\TYPO3\Flow\Utility\Files::concatenatePaths(array($this->resourcesPublishingPath, 'Static', $relativeTargetPath)), '/');
     if ($this->settings['resource']['publishing']['fileSystem']['mirrorMode'] === 'link') {
         if (\TYPO3\Flow\Utility\Files::is_link($targetPath) && rtrim(\TYPO3\Flow\Utility\Files::getUnixStylePath($this->realpath($targetPath)), '/') === $sourcePath) {
             return TRUE;
         } elseif (is_dir($targetPath)) {
             \TYPO3\Flow\Utility\Files::removeDirectoryRecursively($targetPath);
         } elseif (is_link($targetPath)) {
             unlink($targetPath);
         } else {
             \TYPO3\Flow\Utility\Files::createDirectoryRecursively(dirname($targetPath));
         }
         symlink($sourcePath, $targetPath);
     } else {
         foreach (\TYPO3\Flow\Utility\Files::readDirectoryRecursively($sourcePath) as $sourcePathAndFilename) {
             if (substr(strtolower($sourcePathAndFilename), -4, 4) === '.php') {
                 continue;
             }
             $targetPathAndFilename = \TYPO3\Flow\Utility\Files::concatenatePaths(array($targetPath, str_replace($sourcePath, '', $sourcePathAndFilename)));
             if (!file_exists($targetPathAndFilename) || filemtime($sourcePathAndFilename) > filemtime($targetPathAndFilename)) {
                 $this->mirrorFile($sourcePathAndFilename, $targetPathAndFilename, TRUE);
             }
         }
     }
     return TRUE;
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:39,代码来源:FileSystemPublishingTarget.php

示例15: setCache

 /**
  * Initializes the identifier prefix when setting the cache.
  *
  * @param \TYPO3\Flow\Cache\Frontend\FrontendInterface $cache
  * @return void
  */
 public function setCache(\TYPO3\Flow\Cache\Frontend\FrontendInterface $cache)
 {
     parent::setCache($cache);
     $this->identifierPrefix = 'Flow_' . md5($cache->getIdentifier() . \TYPO3\Flow\Utility\Files::getUnixStylePath($_SERVER['SCRIPT_FILENAME']) . PHP_SAPI) . '_';
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:11,代码来源:MemcachedBackend.php


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