|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AOE\Languagevisibility; |
|
4
|
|
|
|
|
5
|
|
|
/*************************************************************** |
|
6
|
|
|
* Copyright notice |
|
7
|
|
|
* |
|
8
|
|
|
* (c) 2010 AOE Dev <[email protected]> |
|
9
|
|
|
* All rights reserved |
|
10
|
|
|
* |
|
11
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
|
12
|
|
|
* free software; you can redistribute it and/or modify |
|
13
|
|
|
* it under the terms of the GNU General Public License as published by |
|
14
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
|
15
|
|
|
* (at your option) any later version. |
|
16
|
|
|
* |
|
17
|
|
|
* The GNU General Public License can be found at |
|
18
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
|
19
|
|
|
* |
|
20
|
|
|
* This script is distributed in the hope that it will be useful, |
|
21
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23
|
|
|
* GNU General Public License for more details. |
|
24
|
|
|
* |
|
25
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
|
26
|
|
|
***************************************************************/ |
|
27
|
|
|
|
|
28
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Class tx_languagevisibility_reports_ConfigurationStatus |
|
32
|
|
|
* |
|
33
|
|
|
* @package AOE\Languagevisibility\Reports |
|
34
|
|
|
*/ |
|
35
|
|
|
class ReportsConfigurationStatus implements \TYPO3\CMS\Reports\StatusProviderInterface { |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Determines the Install Tool's status, mainly concerning its protection. |
|
39
|
|
|
* |
|
40
|
|
|
* @return array List of statuses |
|
41
|
|
|
* @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus() |
|
42
|
|
|
*/ |
|
43
|
|
|
public function getStatus() { |
|
44
|
|
|
$statuses = array( |
|
45
|
|
|
'LangMode' => $this->getLangModes(), |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
return $statuses; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Check all "root" sys_templates and try to find the value for config.sys_language_mode |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getLangModes() { |
|
55
|
|
|
$message = ''; |
|
56
|
|
|
$checked = array( |
|
57
|
|
|
'ok' => array(), |
|
58
|
|
|
'fail' => array(), |
|
59
|
|
|
); |
|
60
|
|
|
$value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.ok.value'); |
|
61
|
|
|
$severity = \TYPO3\CMS\Reports\Status::OK; |
|
62
|
|
|
|
|
63
|
|
|
$rootTpls = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('sys_template', 'root', '1', ''); |
|
64
|
|
|
|
|
65
|
|
|
foreach ($rootTpls as $tpl) { |
|
66
|
|
|
/** |
|
67
|
|
|
* @var \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService |
|
68
|
|
|
*/ |
|
69
|
|
|
$tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService'); |
|
70
|
|
|
$tmpl->tt_track = 0; |
|
71
|
|
|
$tmpl->init(); |
|
72
|
|
|
|
|
73
|
|
|
// Gets the rootLine |
|
74
|
|
|
$sys_page = GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Page\PageRepository'); |
|
75
|
|
|
$rootLine = $sys_page->getRootLine($tpl['pid']); |
|
76
|
|
|
$tmpl->runThroughTemplates($rootLine, $tpl['uid']); |
|
77
|
|
|
|
|
78
|
|
|
$tplRow = $tmpl->ext_getFirstTemplate($tpl['pid'], $tpl['uid']); |
|
79
|
|
|
$tmpl->generateConfig(); |
|
80
|
|
|
|
|
81
|
|
|
if (!isset($tmpl->setup['config.']['sys_language_mode']) || $tmpl->setup['config.']['sys_language_mode'] != 'ignore') { |
|
82
|
|
|
$checked['fail'][] = array($tpl['pid'], $tpl['uid'], $tmpl->setup['config.']['sys_language_mode']); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
if (count($checked['fail'])) { |
|
87
|
|
|
$severity = \TYPO3\CMS\Reports\Status::WARNING; |
|
88
|
|
|
$value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.value'); |
|
89
|
|
|
$message .= $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message') . '<br/>'; |
|
90
|
|
|
foreach ($checked['fail'] as $fail) { |
|
91
|
|
|
$message .= vsprintf($GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message.detail'), $fail) . '<br />'; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
return GeneralUtility::makeInstance('TYPO3\CMS\Reports\Status'', |
|
|
|
|
|
|
96
|
|
|
'EXT:languagevisibility config.sys_language_mode', |
|
97
|
|
|
$value, |
|
98
|
|
|
$message, |
|
99
|
|
|
$severity |
|
100
|
|
|
); |
|
101
|
|
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/languagevisibility/classes/class.tx_languagevisibility_reports_ConfigurationStatus.php']) { |
|
105
|
|
|
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/languagevisibility/classes/class.tx_languagevisibility_reports_ConfigurationStatus.php']); |
|
106
|
|
|
} |
|
107
|
|
|
|