本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::filelink方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::filelink方法的具体用法?PHP ContentObjectRenderer::filelink怎么用?PHP ContentObjectRenderer::filelink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::filelink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filelinkCreatesCorrectUrlForFileWithUrlEncodedSpecialChars
/**
* @test
*/
public function filelinkCreatesCorrectUrlForFileWithUrlEncodedSpecialChars()
{
$fileNameAndPath = PATH_site . 'typo3temp/var/tests/phpunitJumpUrlTestFile with spaces & amps.txt';
file_put_contents($fileNameAndPath, 'Some test data');
$relativeFileNameAndPath = substr($fileNameAndPath, strlen(PATH_site));
$fileName = substr($fileNameAndPath, strlen(PATH_site . 'typo3temp/var/tests/'));
$expectedLink = str_replace('%2F', '/', rawurlencode($relativeFileNameAndPath));
$result = $this->subject->filelink($fileName, array('path' => 'typo3temp/var/tests/'));
$this->assertEquals('<a href="' . $expectedLink . '">' . $fileName . '</a>', $result);
\TYPO3\CMS\Core\Utility\GeneralUtility::unlink_tempfile($fileNameAndPath);
}
示例2: filelinkDisablesGlobalJumpUrlWithDeprecatedOptionIfConfigured
/**
* @test
*/
public function filelinkDisablesGlobalJumpUrlWithDeprecatedOptionIfConfigured()
{
$testData = $this->initializeJumpUrlTestEnvironment($this->never());
$fileName = 'phpunitJumpUrlTestFile.txt';
$fileNameAndPath = 'typo3temp/' . $fileName;
file_put_contents(PATH_site . $fileNameAndPath, 'Some test data');
$expectedLink = $testData['absRefPrefix'] . $fileNameAndPath;
$expectedLink = '<a href="' . $expectedLink . '">' . $fileName . '</a>';
// Test with deprecated configuration
$result = $this->subject->filelink($fileName, array('path' => 'typo3temp/', 'jumpurl' => 0));
$this->assertEquals($expectedLink, $result);
GeneralUtility::unlink_tempfile($fileNameAndPath);
}
示例3: getFileLinks
function getFileLinks(&$markerArray, $row)
{
$files_stdWrap = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $this->conf['newsFiles_stdWrap.']['wrap']);
$markerArray['###TEXT_FILES###'] = $files_stdWrap[0] . $this->local_cObj->stdWrap($this->pi_getLL('textFiles'), $this->conf['newsFilesHeader_stdWrap.']);
$fileArr = explode(',', $row['news_files']);
$filelinks = '';
$rss2Enclousres = '';
foreach ($fileArr as $val) {
// fills the marker ###FILE_LINK### with the links to the atached files
$filelinks .= $this->local_cObj->filelink($val, $this->conf['newsFiles.']);
// <enclosure> support for RSS 2.0
if ($this->theCode == 'XML') {
$path = trim($this->conf['newsFiles.']['path']);
$theFile = $path . $val;
if (@is_file($theFile)) {
$fileURL = $this->config['siteUrl'] . $theFile;
$fileSize = filesize($theFile);
$fileMimeType = $this->getMimeTypeByHttpRequest($fileURL);
$rss2Enclousres .= '<enclosure url="' . $fileURL . '" ';
$rss2Enclousres .= 'length ="' . $fileSize . '" ';
$rss2Enclousres .= 'type="' . $fileMimeType . '" />' . "\n\t\t\t";
}
}
}
$markerArray['###FILE_LINK###'] = $filelinks . $files_stdWrap[1];
$markerArray['###NEWS_RSS2_ENCLOSURES###'] = trim($rss2Enclousres);
}