當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。