本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::getFileAbsFileName方法的具体用法?PHP GeneralUtility::getFileAbsFileName怎么用?PHP GeneralUtility::getFileAbsFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::getFileAbsFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildJavascriptConfiguration
/**
* Return JS configuration of the htmlArea plugins registered by the extension
*
* @return string JS configuration for registered plugins
*/
public function buildJavascriptConfiguration()
{
$registerRTEinJavascriptString = '';
if (!file_exists(PATH_site . $this->jsonFileName)) {
$schema = array('types' => array(), 'properties' => array());
$fileName = 'EXT:rte_schema/Resources/Public/RDF/schema.rdfa';
$fileName = GeneralUtility::getFileAbsFileName($fileName);
$rdf = GeneralUtility::getUrl($fileName);
if ($rdf) {
$this->parseSchema($rdf, $schema);
}
uasort($schema['types'], array($this, 'compareLabels'));
uasort($schema['properties'], array($this, 'compareLabels'));
// Insert no type and no property entries
if ($this->isFrontend()) {
$noSchema = $GLOBALS['TSFE']->getLLL('No type', $this->LOCAL_LANG);
$noProperty = $GLOBALS['TSFE']->getLLL('No property', $this->LOCAL_LANG);
} else {
$noSchema = $GLOBALS['LANG']->getLL('No type');
$noProperty = $GLOBALS['LANG']->getLL('No property');
}
array_unshift($schema['types'], array('name' => 'none', 'domain' => $noSchema, 'comment' => ''));
array_unshift($schema['properties'], array('name' => 'none', 'domain' => $noProperty, 'comment' => ''));
GeneralUtility::writeFileToTypo3tempDir(PATH_site . $this->jsonFileName, json_encode($schema));
}
$output = ($this->isFrontend() && $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '../') . $this->jsonFileName;
$registerRTEinJavascriptString = 'RTEarea[editornumber].schemaUrl = "' . ($this->isFrontend() && $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . $output . '";';
return $registerRTEinJavascriptString;
}
示例2: encrypt
/**
* Public Key Encryption Used by Encrypted Website Payments
*
* Encrypted Website Payments uses public key encryption, or asymmetric cryptography, which provides security and convenience
* by allowing senders and receivers of encrypted communication to exchange public keys to unlock each others messages.
* The fundamental aspects of public key encryption are:
*
* Public keys
* They are created by receivers and are given to senders before they encrypt and send information. Public certificates
* comprise a public key and identity information, such as the originator of the key and an expiry date.
* Public certificates can be signed by certificate authorities, who guarantee that public certificates and their
* public keys belong to the named entities. You and PayPal exchange each others' public certificates.
*
* Private keys
* They are created by receivers are kept to themselves. You create a private key and keep it in your system.
* PayPal keeps its private key on its system.
*
* The encryption process
* Senders use their private keys and receivers' public keys to encrypt information before sending it.
* Receivers use their private keys and senders' public keys to decrypt information after receiving it.
* This encryption process also uses digital signatures in public certificates to verify the sender of the information.
* You use your private key and PayPal's public key to encrypt your HTML button code.
* PayPal uses its private key and your public key to decrypt button code after people click your payment buttons.
*
* @param array $data
* @return string
* @throws \Exception
*/
public function encrypt(array $data)
{
$extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['paypal']);
$openSSL = $extensionConfiguration['opensslPath'];
$certificationDir = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->settings['certification']['dir']);
if ($this->settings['context']['sandbox']) {
$certificationDir .= 'Sandbox/';
}
$files = array();
foreach ($this->settings['certification']['file'] as $type => $file) {
$files[$type] = $certificationDir . $file;
if (!file_exists($files[$type])) {
throw new \Exception('Certification "' . $files[$type] . '" does not exist!', 1392135405);
}
}
$data['cert_id'] = $this->settings['seller']['cert_id'];
$data['bn'] = 'ShoppingCart_WPS';
$hash = '';
foreach ($data as $key => $value) {
if ($value != '') {
$hash .= $key . '=' . $value . "\n";
}
}
$openssl_cmd = "({$openSSL} smime -sign -signer " . $files['public'] . " -inkey " . $files['private'] . " " . "-outform der -nodetach -binary <<_EOF_\n{$hash}\n_EOF_\n) | " . "{$openSSL} smime -encrypt -des3 -binary -outform pem " . $files['public_paypal'] . "";
exec($openssl_cmd, $output, $error);
if (!$error) {
return implode("\n", $output);
} else {
throw new \Exception('Paypal Request Encryption failed!', 1392135967);
}
}
示例3: render
/**
* Render method
*
* @throws Exception
* @return string
*/
public function render()
{
$sources = $this->getSourcesFromArgument();
if (0 === count($sources)) {
throw new Exception('No audio sources provided.', 1359382189);
}
foreach ($sources as $source) {
if (TRUE === is_string($source)) {
if (FALSE !== strpos($source, '//')) {
$src = $source;
$type = substr($source, strrpos($source, '.') + 1);
} else {
$src = substr(GeneralUtility::getFileAbsFileName($source), strlen(PATH_site));
$type = pathinfo($src, PATHINFO_EXTENSION);
}
} elseif (TRUE === is_array($source)) {
if (FALSE === isset($source['src'])) {
throw new Exception('Missing value for "src" in sources array.', 1359381250);
}
$src = $source['src'];
if (FALSE === isset($source['type'])) {
throw new Exception('Missing value for "type" in sources array.', 1359381255);
}
$type = $source['type'];
} else {
// skip invalid source
continue;
}
if (FALSE === in_array(strtolower($type), $this->validTypes)) {
throw new Exception('Invalid audio type "' . $type . '".', 1359381260);
}
$type = $this->mimeTypesMap[$type];
$src = $this->preprocessSourceUri($src);
$this->renderChildTag('source', array('src' => $src, 'type' => $type), FALSE, 'append');
}
$tagAttributes = array('width' => $this->arguments['width'], 'height' => $this->arguments['height'], 'preload' => 'auto');
if (TRUE === (bool) $this->arguments['autoplay']) {
$tagAttributes['autoplay'] = 'autoplay';
}
if (TRUE === (bool) $this->arguments['controls']) {
$tagAttributes['controls'] = 'controls';
}
if (TRUE === (bool) $this->arguments['loop']) {
$tagAttributes['loop'] = 'loop';
}
if (TRUE === (bool) $this->arguments['muted']) {
$tagAttributes['muted'] = 'muted';
}
if (TRUE === in_array($this->validPreloadModes, $this->arguments['preload'])) {
$tagAttributes['preload'] = 'preload';
}
if (NULL !== $this->arguments['poster']) {
$tagAttributes['poster'] = $this->arguments['poster'];
}
$this->tag->addAttributes($tagAttributes);
if (NULL !== $this->arguments['unsupported']) {
$this->tag->setContent($this->tag->getContent() . LF . $this->arguments['unsupported']);
}
return $this->tag->render();
}
示例4: canCreateAssetInstanceFromStaticFileFactoryWithRelativeFileAndTranslatesRelativeToAbsolutePath
/**
* @test
*/
public function canCreateAssetInstanceFromStaticFileFactoryWithRelativeFileAndTranslatesRelativeToAbsolutePath()
{
$file = $this->getRelativeAssetFixturePath();
$asset = Asset::createFromFile($file);
$this->assertInstanceOf('FluidTYPO3\\Vhs\\Asset', $asset);
$this->assertEquals(GeneralUtility::getFileAbsFileName($file), $asset->getPath());
}
示例5: cleanupRecycledFiles
/**
* Gets a list of all files in a directory recursively and removes
* old ones.
*
* @throws \RuntimeException If folders are not found or files can not be deleted
* @param string $directory Path to the directory
* @param int $timestamp Timestamp of the last file modification
* @return bool TRUE if success
*/
protected function cleanupRecycledFiles($directory, $timestamp)
{
$directory = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($directory);
$timestamp = (int) $timestamp;
// Check if given directory exists
if (!@is_dir($directory)) {
throw new \RuntimeException('Given directory "' . $directory . '" does not exist', 1301614535);
}
// Find all _recycler_ directories
$directoryContent = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory));
foreach ($directoryContent as $fileName => $file) {
// Skip directories and files without recycler directory in absolute path
$filePath = $file->getPath();
if (substr($filePath, strrpos($filePath, '/') + 1) !== $this->recyclerDirectory) {
continue;
}
// Remove files from _recycler_ that where moved to this folder for more than 'number of days'
if ($file->isFile() && $timestamp > $file->getCTime()) {
if (!@unlink($fileName)) {
throw new \RuntimeException('Could not remove file "' . $fileName . '"', 1301614537);
}
}
}
return true;
}
示例6: resolvePath
/**
* Resolve path
*
* @param string $resourcePath
* @return NULL|string
*/
protected function resolvePath($resourcePath)
{
$absoluteFilePath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($resourcePath);
$absolutePath = dirname($absoluteFilePath);
$fileName = basename($absoluteFilePath);
return \TYPO3\CMS\Core\Utility\PathUtility::getRelativePathTo($absolutePath) . $fileName;
}
示例7: getCompiledFile
/**
* @param string $file
* @return bool|string
* @throws \Exception
*/
public static function getCompiledFile($file)
{
$file = GeneralUtility::getFileAbsFileName($file);
$pathParts = pathinfo($file);
if ($pathParts['extension'] === 'less') {
try {
$options = array('cache_dir' => GeneralUtility::getFileAbsFileName('typo3temp/mooxcore'));
$settings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_mooxcore.']['settings.'] ?: array();
if ($settings['cssSourceMapping']) {
// enable source mapping
$optionsForSourceMap = array('sourceMap' => true, 'sourceMapWriteTo' => GeneralUtility::getFileAbsFileName('typo3temp/mooxcore') . '/mooxcore.map', 'sourceMapURL' => '/typo3temp/mooxcore/mooxcore.map', 'sourceMapBasepath' => PATH_site, 'sourceMapRootpath' => '/');
$options += $optionsForSourceMap;
// disable CSS compression
/** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
$pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
$pageRenderer->disableCompressCss();
}
if ($settings['overrideLessVariables']) {
$variables = self::getVariablesFromConstants();
} else {
$variables = array();
}
$files = array();
$files[$file] = '../../' . str_replace(PATH_site, '', dirname($file)) . '/';
$compiledFile = \Less_Cache::Get($files, $options, $variables);
$file = "typo3temp/mooxcore/" . $compiledFile;
return $file;
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
return false;
}
示例8: addItemToWizard
/**
* Add as content_designer item to the element wizard
*
* @param $newElementKey
* @param $newElementConfig
* @return void
*/
public static function addItemToWizard(&$newElementKey, &$newElementConfig)
{
// Get the icon if its an file register new icon
if (strlen($newElementConfig['icon']) > 0) {
$icon = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($newElementConfig['icon']);
if (file_exists($icon)) {
if (self::$iconRegistry == NULL) {
self::$iconRegistry = GeneralUtility::makeInstance(\KERN23\ContentDesigner\Helper\IconRegistryHelper::class);
}
self::$iconRegistry->registerNewIcon($newElementKey . '-icon', $icon);
$newElementConfig['icon'] = $newElementKey . '-icon';
}
} else {
$newElementConfig['icon'] = 'contentdesigner-default';
}
// Generate the tsconfig
ExtensionManagementUtility::addPageTsConfig('
mod.wizards.newContentElement.wizardItems.' . self::$sheetName . '.show := addToList(' . $newElementKey . ')
mod.wizards.newContentElement.wizardItems.' . self::$sheetName . '.elements {
' . $newElementKey . ' {
iconIdentifier = ' . $newElementConfig['icon'] . '
title = ' . $newElementConfig['title'] . '
description = ' . $newElementConfig['description'] . '
tt_content_defValues.CType = ' . $newElementKey . '
}
}
');
}
示例9: parseResource
/**
*
*/
public function parseResource()
{
$configuration = $this->getConfiguration();
if (!ExtensionManagementUtility::isLoaded('phpexcel_library')) {
throw new \Exception('phpexcel_library is not loaded', 12367812368);
}
$filename = GeneralUtility::getFileAbsFileName($this->filepath);
GeneralUtility::makeInstanceService('phpexcel');
$objReader = \PHPExcel_IOFactory::createReaderForFile($filename);
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($filename);
if ($configuration['sheet'] >= 0) {
$objWorksheet = $objPHPExcel->getSheet($configuration['sheet']);
} else {
$objWorksheet = $objPHPExcel->getActiveSheet();
}
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = \PHPExcel_Cell::columnIndexFromString($highestColumn);
for ($row = 1 + $configuration['skipRows']; $row <= $highestRow; ++$row) {
$rowRecord = [];
for ($col = 0; $col <= $highestColumnIndex; ++$col) {
$rowRecord[] = trim($objWorksheet->getCellByColumnAndRow($col, $row)->getValue());
}
$this->content[] = $rowRecord;
}
}
示例10: render
/**
* Get Upload Path
*
* @param string $fileName like picture.jpg
* @param string $path like fileadmin/powermail/uploads/
* @return string
*/
public function render($fileName, $path)
{
if (file_exists(GeneralUtility::getFileAbsFileName($path . $fileName))) {
return $path . $fileName;
}
return $this->uploadPathFallback . $fileName;
}
示例11: reBuild
/**
* Rebuild the class cache
*
* @param array $parameters
*
* @throws \Evoweb\Extender\Exception\FileNotFoundException
* @throws \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
* @return void
*/
public function reBuild(array $parameters = array())
{
if (empty($parameters) || !empty($parameters['cacheCmd']) && GeneralUtility::inList('all,system', $parameters['cacheCmd']) && isset($GLOBALS['BE_USER'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'] as $extensionKey => $extensionConfiguration) {
if (!isset($extensionConfiguration['extender']) || !is_array($extensionConfiguration['extender'])) {
continue;
}
foreach ($extensionConfiguration['extender'] as $entity => $entityConfiguration) {
$key = 'Domain/Model/' . $entity;
// Get the file to extend, this needs to be loaded as first
$path = ExtensionManagementUtility::extPath($extensionKey) . 'Classes/' . $key . '.php';
if (!is_file($path)) {
throw new \Evoweb\Extender\Exception\FileNotFoundException('given file "' . $path . '" does not exist');
}
$code = $this->parseSingleFile($path, false);
// Get the files from all other extensions that are extending this domain model
if (is_array($entityConfiguration)) {
foreach ($entityConfiguration as $extendingExtension => $extendingFilepath) {
$path = GeneralUtility::getFileAbsFileName($extendingFilepath, false);
if (!is_file($path) && !is_numeric($extendingExtension)) {
$path = ExtensionManagementUtility::extPath($extendingExtension) . 'Classes/' . $key . '.php';
}
$code .= $this->parseSingleFile($path);
}
}
// Close the class definition
$code = $this->closeClassDefinition($code);
// Add the new file to the class cache
$cacheEntryIdentifier = GeneralUtility::underscoredToLowerCamelCase($extensionKey) . '_' . str_replace('/', '', $key);
$this->cacheInstance->set($cacheEntryIdentifier, $code);
}
}
}
}
示例12: getColorForCaptchaReturnInt
/**
* getColorForCaptcha Test
*
* @param string $hexColorString
* @param string $expectedResult
* @dataProvider getColorForCaptchaReturnIntDataProvider
* @return void
* @test
*/
public function getColorForCaptchaReturnInt($hexColorString, $expectedResult)
{
$imageResource = ImageCreateFromPNG(GeneralUtility::getFileAbsFileName('typo3conf/ext/powermail/Resources/Private/Image/captcha_bg.png'));
$this->generalValidatorMock->_set('configuration', array('captcha.' => array('default.' => array('textColor' => $hexColorString))));
$result = $this->generalValidatorMock->_call('getColorForCaptcha', $imageResource);
$this->assertSame($expectedResult, $result);
}
示例13: initialize
/**
* Initializes the DrawItem
*
* @return void
*/
public function initialize()
{
parent::initialize();
$this->view = $this->objectManager->get(StandaloneView::class);
$this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:vantomas/Resources/Private/Templates/DrawItem/SiteLastUpdatedPages.html'));
$this->pageRepository = $this->objectManager->get(PageRepository::class);
}
示例14: render
/**
* @return string
* @throws \TYPO3\CMS\Core\Exception
*/
public function render()
{
$out = '';
$filePath = GeneralUtility::getFileAbsFileName($this->arguments['includeFile'], TRUE);
if (!$filePath || !file_exists($filePath)) {
throw new \Exception('Could not get include file for js inclusion');
}
try {
$fileContents = file_get_contents($filePath);
} catch (\Exception $e) {
throw new \Exception('Could not read include file for js inclusion');
}
$lines = array();
$pathInfo = pathinfo($filePath);
$basePath = $this->getRelativeFromAbsolutePath($pathInfo['dirname']);
foreach (GeneralUtility::trimExplode(chr(10), $fileContents) as $line) {
$file = "{$basePath}/{$line}";
if (file_exists($file)) {
$lines[] = "<script src=\"{$file}\"></script>";
}
}
if (count($lines)) {
$out = implode("\n", $lines);
}
return $out;
}
示例15: preProcess
/**
* Preprocesses the preview rendering of a content element.
*
* @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object
* @param boolean $drawItem Whether to draw the item using the default functionalities
* @param string $headerContent Header content
* @param string $itemContent Item content
* @param array $row Record row of tt_content
* @return void
*/
public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
{
// only render special backend preview if it is a mask element
if (substr($row['CType'], 0, 4) === "mask") {
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mask']);
$elementKey = substr($row['CType'], 5);
$templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extConf["backend"]);
$templatePathAndFilename = $templateRootPath . $elementKey . '.html';
if (file_exists($templatePathAndFilename)) {
// initialize some things we need
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$this->utility = $this->objectManager->get("MASK\\Mask\\Utility\\MaskUtility");
$this->storageRepository = $this->objectManager->get("MASK\\Mask\\Domain\\Repository\\StorageRepository");
$view = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
// Load the backend template
$view->setTemplatePathAndFilename($templatePathAndFilename);
// Fetch and assign some useful variables
$data = $this->getContentObject($row["uid"]);
$element = $this->storageRepository->loadElement("tt_content", $elementKey);
$view->assign("row", $row);
$view->assign("data", $data);
// Render everything
$content = $view->render();
$headerContent = '<strong>' . $element["label"] . '</strong><br>';
$itemContent .= '<div style="display:block; padding: 10px 0 4px 0px;border-top: 1px solid #CACACA;margin-top: 6px;" class="content_preview_' . $elementKey . '">';
$itemContent .= $content;
$itemContent .= '</div>';
$drawItem = FALSE;
}
}
}