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


PHP ContentObjectRenderer::filelink方法代码示例

本文整理汇总了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);
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:14,代码来源:ContentObjectRendererTest.php

示例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);
 }
开发者ID:hlop,项目名称:TYPO3.CMS,代码行数:16,代码来源:ContentObjectRendererTest.php

示例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);
 }
开发者ID:mrmoree,项目名称:vkmh_typo3,代码行数:27,代码来源:class.tx_ttnews.php


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