‪TYPO3CMS  10.4
RedirectStatus.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
26 
31 {
37  public function ‪getStatus(): array
38  {
39  return [
40  'Conflicts' => $this->‪getConflictingRedirects(),
41  ];
42  }
43 
44  protected function ‪getConflictingRedirects(): ‪Status
45  {
46  $value = $this->‪getLanguageService()->‪sL('LLL:EXT:redirects/Resources/Private/Language/locallang_reports.xlf:status.conflictingRedirects.none');
47  $severity = ‪Status::OK;
48 
49  $registry = GeneralUtility::makeInstance(Registry::class);
50  $reportedConflicts = $registry->get('tx_redirects', 'conflicting_redirects', []);
51  $count = count($reportedConflicts);
52 
53  $view = GeneralUtility::makeInstance(StandaloneView::class);
54  $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:redirects/Resources/Private/Templates/Report/RedirectStatus.html'));
55 
56  if ($count > 0) {
57  $value = sprintf($this->‪getLanguageService()->sL('LLL:EXT:redirects/Resources/Private/Language/locallang_reports.xlf:status.conflictingRedirects.count'), $count);
58  $severity = ‪Status::WARNING;
59  }
60 
61  $view->assignMultiple([
62  'count' => $count,
63  'reportedConflicts' => $reportedConflicts,
64  ]);
65 
66  return GeneralUtility::makeInstance(
67  Status::class,
68  $this->‪getLanguageService()->sL('LLL:EXT:redirects/Resources/Private/Language/locallang_reports.xlf:status.conflictingRedirects'),
69  $value,
70  $view->render(),
71  $severity
72  );
73  }
74 
79  {
80  return ‪$GLOBALS['LANG'];
81  }
82 }
‪TYPO3\CMS\Reports\StatusProviderInterface
Definition: StatusProviderInterface.php:22
‪TYPO3\CMS\Redirects\Report\Status\RedirectStatus
Definition: RedirectStatus.php:31
‪TYPO3\CMS\Redirects\Report\Status\RedirectStatus\getStatus
‪array getStatus()
Definition: RedirectStatus.php:37
‪TYPO3\CMS\Redirects\Report\Status\RedirectStatus\getLanguageService
‪LanguageService getLanguageService()
Definition: RedirectStatus.php:78
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:33
‪TYPO3\CMS\Redirects\Report\Status\RedirectStatus\getConflictingRedirects
‪getConflictingRedirects()
Definition: RedirectStatus.php:44
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Reports\Status\OK
‪const OK
Definition: Status.php:27
‪TYPO3\CMS\Reports\Status
Definition: Status.php:24
‪TYPO3\CMS\Redirects\Report\Status
Definition: RedirectStatus.php:18
‪TYPO3\CMS\Reports\Status\WARNING
‪const WARNING
Definition: Status.php:28
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:34
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46