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


PHP PathUtility::isAbsolutePath方法代码示例

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


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

示例1: setLogFile

 /**
  * Sets the path to the log file.
  *
  * @param string $relativeLogFile path to the log file, relative to PATH_site
  * @return WriterInterface
  * @throws \InvalidArgumentException
  */
 public function setLogFile($relativeLogFile)
 {
     $logFile = $relativeLogFile;
     // Skip handling if logFile is a stream resource. This is used by unit tests with vfs:// directories
     if (FALSE === strpos($logFile, '://') && !PathUtility::isAbsolutePath($logFile)) {
         $logFile = GeneralUtility::getFileAbsFileName($logFile);
         if ($logFile === NULL) {
             throw new \InvalidArgumentException('Log file path "' . $relativeLogFile . '" is not valid!', 1326411176);
         }
     }
     $this->logFile = $logFile;
     $this->openLogFile();
     return $this;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:21,代码来源:FileWriter.php

示例2: getAbsolutePath

 public static function getAbsolutePath($path)
 {
     if (\TYPO3\CMS\Core\Utility\PathUtility::isAbsolutePath($path)) {
         return $path;
     }
     if (strpos($path, self::EXT_PREFIX) === 0) {
         $relativePath = substr($path, strlen(self::EXT_PREFIX));
         if (file_exists(PATH_site . self::RELATIVE_EXT_PATH . $relativePath)) {
             return PATH_site . self::RELATIVE_EXT_PATH . $relativePath;
         } elseif (file_exists(PATH_site . self::RELATIVE_SYSEXT_PATH . $relativePath)) {
             return PATH_site . self::RELATIVE_SYSEXT_PATH . $relativePath;
         }
     }
     if (file_exists(PATH_site . $path)) {
         return PATH_site . $path;
     }
     throw new \InvalidArgumentException("Path '{$path}' can not be converted to an absolute path!", 1456179408);
 }
开发者ID:r3h6,项目名称:TYPO3.EXT.locallang_tools,代码行数:18,代码来源:PathUtility.php

示例3: setLinkToPhpFile

 /**
  * Set a class loader cache content
  *
  * @TODO: Rename method
  * @param string $entryIdentifier
  * @param string $filePath
  * @throws \InvalidArgumentException
  * @internal This is not an API method
  */
 public function setLinkToPhpFile($entryIdentifier, $filePath)
 {
     if ($entryIdentifier === '') {
         throw new \InvalidArgumentException('The specified entry identifier must not be empty.', 1364205170);
     }
     if (!PathUtility::isAbsolutePath($filePath)) {
         throw new \InvalidArgumentException('Only absolute paths are allowed for the class loader, given path was: ' . $filePath, 1381923089);
     }
     if (!@file_exists($filePath)) {
         throw new \InvalidArgumentException('The specified file path (' . $filePath . ') must exist.', 1364205235);
     }
     if (strtolower(substr($filePath, -4)) !== '.php') {
         throw new \InvalidArgumentException('The specified file (' . $filePath . ') must be a php file.', 1364205377);
     }
     if ($entryIdentifier !== basename($entryIdentifier)) {
         throw new \InvalidArgumentException('The specified entry identifier (' . $entryIdentifier . ') must not contain a path segment.', 1364205166);
     }
     $this->set($entryIdentifier, sprintf($this->requireFileTemplate, $filePath));
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:28,代码来源:ClassLoaderBackend.php

示例4: activateVersion

 /**
  * Activate a core version
  *
  * @param string $version A version to activate
  * @return bool TRUE on success
  */
 public function activateVersion($version)
 {
     $newCoreLocation = @realPath($this->symlinkToCoreFiles . '/../') . '/typo3_src-' . $version;
     $messages = array();
     $success = true;
     if (!is_dir($newCoreLocation)) {
         $success = false;
         /** @var $message StatusInterface */
         $message = $this->objectManager->get(ErrorStatus::class);
         $message->setTitle('New TYPO3 CMS core not found');
         $messages[] = $message;
     } elseif (!is_link($this->symlinkToCoreFiles)) {
         $success = false;
         /** @var $message StatusInterface */
         $message = $this->objectManager->get(ErrorStatus::class);
         $message->setTitle('TYPO3 CMS core source directory (typo3_src) is not a link');
         $messages[] = $message;
     } else {
         $isCurrentCoreSymlinkAbsolute = PathUtility::isAbsolutePath(readlink($this->symlinkToCoreFiles));
         $unlinkResult = unlink($this->symlinkToCoreFiles);
         if (!$unlinkResult) {
             $success = false;
             /** @var $message StatusInterface */
             $message = $this->objectManager->get(ErrorStatus::class);
             $message->setTitle('Removing old symlink failed');
             $messages[] = $message;
         } else {
             if (!$isCurrentCoreSymlinkAbsolute) {
                 $newCoreLocation = $this->getRelativePath($newCoreLocation);
             }
             $symlinkResult = symlink($newCoreLocation, $this->symlinkToCoreFiles);
             if ($symlinkResult) {
                 GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive();
             } else {
                 $success = false;
                 /** @var $message StatusInterface */
                 $message = $this->objectManager->get(ErrorStatus::class);
                 $message->setTitle('Linking new TYPO3 CMS core failed');
                 $messages[] = $message;
             }
         }
     }
     $this->messages = $messages;
     return $success;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:51,代码来源:CoreUpdateService.php

示例5: getRelativeFolder

 /**
  * Get relative path from absolute path, but don't touch if it's already a relative path
  *
  * @param string $path
  * @return string
  */
 public static function getRelativeFolder($path)
 {
     if (PathUtility::isAbsolutePath($path)) {
         $path = PathUtility::getRelativePathTo($path);
     }
     return $path;
 }
开发者ID:VladStawizki,项目名称:ipl-logistik.de,代码行数:13,代码来源:BasicFileUtility.php

示例6: ensureAbsolutePath

 /**
  * Guarantees that $reference is turned into a
  * correct, absolute path. The input can be a
  * relative path or a FILE: or EXT: reference
  * but cannot be a FAL resource identifier.
  *
  * @param mixed $reference
  * @return string
  */
 protected function ensureAbsolutePath($reference)
 {
     if (false === is_array($reference)) {
         $filename = PathUtility::isAbsolutePath($reference) ? $reference : GeneralUtility::getFileAbsFileName($reference);
     } else {
         foreach ($reference as &$subValue) {
             $subValue = $this->ensureAbsolutePath($subValue);
         }
         return $reference;
     }
     return $filename;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:21,代码来源:TemplatePaths.php


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