Пример #1
0
 /**
  * @test
  */
 public function buildFrontendUriDoesNotStripLeadingSlashesFromRelativeUris()
 {
     $this->mockContentObject->expects($this->once())->method('typoLink_URL')->will($this->returnValue('/relative/uri'));
     $expectedResult = '/relative/uri';
     $actualResult = $this->uriBuilder->buildFrontendUri();
     $this->assertSame($expectedResult, $actualResult);
 }
Пример #2
0
 /**
  * @test
  */
 public function frontendUriBuilderParametersArePassedOnIfConfigured()
 {
     $this->typoScriptFrontendController->tmpl->setup['plugin.']['tx_linkhandler.']['tx_news_news.']['overrideParentTypolinkConfiguration'] = 1;
     $this->typoScriptFrontendController->tmpl->setup['plugin.']['tx_linkhandler.']['tx_news_news.']['typolink.']['useCacheHash'] = 0;
     $this->uriBuilder->reset()->setTargetPageUid('record:tx_news_news:tx_news_domain_model_news:1')->setNoCache(TRUE);
     $generatedUrl = $this->uriBuilder->buildFrontendUri();
     $this->assertEquals('index.php?id=1&no_cache=1&tx_news_pi1%5Bnews%5D=1&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail', $generatedUrl);
 }
Пример #3
0
 /**
  * Returns a frontend URI independently of current context, with or without extbase, and with or without TSFE
  * @param string $actionName
  * @param array $controllerArguments
  * @param string $controllerName
  * @param string $extensionName
  * @param string $pluginName
  * @return string absolute URI
  */
 public static function buildFrontendUri($actionName, array $controllerArguments, $controllerName, $extensionName = 'newsletter', $pluginName = 'p')
 {
     if (!self::$uriBuilder) {
         self::$uriBuilder = self::buildUriBuilder($extensionName, $pluginName);
     }
     $controllerArguments['action'] = $actionName;
     $controllerArguments['controller'] = $controllerName;
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $extensionService = $objectManager->get('TYPO3\\CMS\\Extbase\\Service\\ExtensionService');
     $pluginNamespace = $extensionService->getPluginNamespace($extensionName, $pluginName);
     $arguments = array($pluginNamespace => $controllerArguments);
     self::$uriBuilder->reset()->setUseCacheHash(false)->setCreateAbsoluteUri(true)->setArguments($arguments);
     return self::$uriBuilder->buildFrontendUri() . '&type=1342671779';
 }
Пример #4
0
 /**
  * Page not found handling
  *
  * @param array $params
  * @param TypoScriptFrontendController $ref
  * @throws PageNotFoundException
  * @return void
  */
 public function pageNotFound(array $params, TypoScriptFrontendController $ref = NULL)
 {
     $domain = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $domainInformation = parse_url($domain);
     $errorPageUid = (int) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['theme']['errorPages']['_DEFAULT'];
     if (!empty($domainInformation['host'])) {
         $tmpErrorPageUid = (int) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['theme']['errorPages'][$domainInformation['host']];
         if ($tmpErrorPageUid > 0) {
             $errorPageUid = $tmpErrorPageUid;
         }
     }
     if ($errorPageUid > 0) {
         $sysLanguageUid = $this->getSysLanguage($ref);
         $this->uriBuilder->reset()->setTargetPageUid($errorPageUid)->setCreateAbsoluteUri(TRUE);
         if ($sysLanguageUid > 0) {
             $this->uriBuilder->setArguments(array('L' => $sysLanguageUid));
         }
         HttpUtility::redirect($this->uriBuilder->buildFrontendUri(), HttpUtility::HTTP_STATUS_404);
     }
     $message = 'The page not found handling could not handle the request. The original message was: "' . $params['reasonText'] . '" with URL "' . $params['currentUrl'] . '"';
     throw new PageNotFoundException($message, 1301648780);
 }