-
Notifications
You must be signed in to change notification settings - Fork 638
/
CacheModule.php
87 lines (80 loc) · 3.62 KB
/
CacheModule.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Frontend\AdminPanel;
class CacheModule extends AbstractModule implements AdminPanelModuleInterface
{
/**
* Creates the content for the "cache" section ("module") of the Admin Panel
*
* @return string HTML content for the section. Consists of a string with table-rows with four columns.
*/
public function getContent(): string
{
$output = [];
if ($this->getBackendUser()->uc['TSFE_adminConfig']['display_cache']) {
$output[] = '<div class="typo3-adminPanel-form-group">';
$output[] = ' <div class="typo3-adminPanel-form-group-checkbox">';
$output[] = ' <input type="hidden" name="TSFE_ADMIN_PANEL[cache_noCache]" value="0" />';
$output[] = ' <label for="cache_noCache">';
$output[] = ' <input type="checkbox" id="cache_noCache" name="TSFE_ADMIN_PANEL[cache_noCache]" value="1"' .
($this->getBackendUser()->uc['TSFE_adminConfig']['cache_noCache'] ? ' checked="checked"' : '') .
' />';
$output[] = ' ' . $this->extGetLL('cache_noCache');
$output[] = ' </label>';
$output[] = ' </div>';
$output[] = '</div>';
$levels = $this->getBackendUser()->uc['TSFE_adminConfig']['cache_clearCacheLevels'];
$output[] = '<div class="typo3-adminPanel-form-group">';
$output[] = ' <label for="cache_clearCacheLevels">';
$output[] = ' ' . $this->extGetLL('cache_clearLevels');
$output[] = ' </label>';
$output[] = ' <select id="cache_clearCacheLevels" name="TSFE_ADMIN_PANEL[cache_clearCacheLevels]">';
$output[] = ' <option value="0"' . ((int)$levels === 0 ? ' selected="selected"' : '') . '>';
$output[] = ' ' . $this->extGetLL('div_Levels_0');
$output[] = ' </option>';
$output[] = ' <option value="1"' . ($levels == 1 ? ' selected="selected"' : '') . '>';
$output[] = ' ' . $this->extGetLL('div_Levels_1');
$output[] = ' </option>';
$output[] = ' <option value="2"' . ($levels == 2 ? ' selected="selected"' : '') . '>';
$output[] = ' ' . $this->extGetLL('div_Levels_2');
$output[] = ' </option>';
$output[] = ' </select>';
$output[] = '</div>';
$output[] = '<div class="typo3-adminPanel-form-group">';
$output[] = ' <input type="hidden" name="TSFE_ADMIN_PANEL[cache_clearCacheId]" value="' .
$GLOBALS['TSFE']->id .
'" />';
$output[] = ' <input class="typo3-adminPanel-btn typo3-adminPanel-btn-default" type="submit" value="' .
$this->extGetLL('update') .
'" />';
$output[] = '</div>';
$output[] = '<div class="typo3-adminPanel-form-group">';
$output[] = ' <input class="typo3-adminPanel-btn typo3-adminPanel-btn-default" type="submit" name="TSFE_ADMIN_PANEL[action][clearCache]" value="' .
$this->extGetLL('cache_doit') .
'" />';
$output[] = '</div>';
}
return implode('', $output);
}
/**
* @inheritdoc
*/
public function getIdentifier(): string
{
return 'cache';
}
/**
* @inheritdoc
*/
public function getLabel(): string
{
return $this->extGetLL('cache');
}
/**
* @inheritdoc
*/
public function showFormSubmitButton(): bool
{
return true;
}
}