‪TYPO3CMS  9.5
ExternalPageUrlHandler.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use Psr\Http\Message\ResponseInterface;
21 
27 {
31  protected ‪$externalUrl = '';
32 
33  public function ‪__construct()
34  {
35  trigger_error('ExternalPageUrlHandler has been moved into a PSR-15 middleware and will be removed in TYPO3 v10.0. In order to modify the external page redirection, use a PSR-15 middleware as well.', E_USER_DEPRECATED);
36  }
37 
43  public function ‪canHandleCurrentUrl(): bool
44  {
45  $tsfe = $this->‪getTypoScriptFrontendController();
46 
47  if (!empty($tsfe->config['config']['disablePageExternalUrl'])) {
48  return false;
49  }
50 
51  $this->externalUrl = $tsfe->sys_page->getExtURL($tsfe->page);
52  if (empty($this->externalUrl)) {
53  return false;
54  }
55  return true;
56  }
57 
61  public function ‪handle(): ResponseInterface
62  {
63  return new RedirectResponse($this->externalUrl, 303);
64  }
65 
69  protected function ‪getTypoScriptFrontendController(): TypoScriptFrontendController
70  {
71  return ‪$GLOBALS['TSFE'];
72  }
73 }
‪TYPO3\CMS\Frontend\Page\ExternalPageUrlHandler\$externalUrl
‪string $externalUrl
Definition: ExternalPageUrlHandler.php:30
‪TYPO3\CMS\Frontend\Http\UrlHandlerInterface
Definition: UrlHandlerInterface.php:25
‪TYPO3\CMS\Frontend\Page\ExternalPageUrlHandler\handle
‪handle()
Definition: ExternalPageUrlHandler.php:60
‪TYPO3\CMS\Frontend\Page\ExternalPageUrlHandler\__construct
‪__construct()
Definition: ExternalPageUrlHandler.php:32
‪TYPO3\CMS\Frontend\Page\ExternalPageUrlHandler\canHandleCurrentUrl
‪bool canHandleCurrentUrl()
Definition: ExternalPageUrlHandler.php:42
‪TYPO3\CMS\Frontend\Page
Definition: CacheHashCalculator.php:2
‪TYPO3\CMS\Core\Http\RedirectResponse
Definition: RedirectResponse.php:27
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:97
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Frontend\Page\ExternalPageUrlHandler
Definition: ExternalPageUrlHandler.php:27
‪TYPO3\CMS\Frontend\Page\ExternalPageUrlHandler\getTypoScriptFrontendController
‪TypoScriptFrontendController getTypoScriptFrontendController()
Definition: ExternalPageUrlHandler.php:68