-
Notifications
You must be signed in to change notification settings - Fork 126
/
ext_localconf.php
132 lines (110 loc) · 6.22 KB
/
ext_localconf.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
if (!defined('TX_REALURL_AUTOCONF_FILE')) {
define('TX_REALURL_AUTOCONF_FILE', 'typo3conf/realurl_autoconf.php');
}
if (!function_exists('includeRealurlConfiguration')) {
/**
* Includes RealURL configuration.
*
* @return void
*/
function includeRealurlConfiguration() {
$configuration = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl'];
if (is_string($configuration)) {
$configuration = @unserialize($configuration);
}
if (!is_array($configuration)) {
$configuration = array(
'configFile' => 'typo3conf/realurl_conf.php',
'enableAutoConf' => true,
);
}
$existingConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'];
$realurlConfigurationFile = trim($configuration['configFile']);
if ($realurlConfigurationFile && @file_exists(PATH_site . $realurlConfigurationFile)) {
/** @noinspection PhpIncludeInspection */
\TYPO3\CMS\Core\Utility\GeneralUtility::requireOnce(PATH_site . $realurlConfigurationFile);
}
elseif ($configuration['enableAutoConf'] && file_exists(PATH_site . TX_REALURL_AUTOCONF_FILE)) {
/** @noinspection PhpIncludeInspection */
\TYPO3\CMS\Core\Utility\GeneralUtility::requireOnce(PATH_site . TX_REALURL_AUTOCONF_FILE);
}
if (is_array($existingConfiguration)) {
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
$existingConfiguration,
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']
);
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = $existingConfiguration;
}
}
}
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc']['realurl'] = 'DmitryDulepov\\Realurl\\Encoder\\UrlEncoder->encodeUrl';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_PostProc']['realurl'] = 'DmitryDulepov\\Realurl\\Encoder\\UrlEncoder->postProcessEncodedUrl';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkAlternativeIdMethods-PostProc']['realurl'] = 'DmitryDulepov\\Realurl\\Decoder\\UrlDecoder->decodeUrl';
includeRealurlConfiguration();
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['realurl'] = 'DmitryDulepov\\Realurl\\Hooks\\DataHandler';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['realurl'] = 'DmitryDulepov\\Realurl\\Hooks\\DataHandler';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['realurl']['cacheImplementation'] = 'DmitryDulepov\\Realurl\\Cache\\DatabaseCache';
if (!empty($GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= ',';
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'] .= 'tx_realurl_pathsegment,tx_realurl_exclude,tx_realurl_pathoverride';
if (isset($GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'])) {
if (!empty($GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] .= ',';
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] .= 'tx_realurl_pathsegment';
}
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals']['DmitryDulepov\\Realurl\\Evaluator\\SegmentFieldCleaner'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('realurl', 'Classes/Evaluator/SegmentFieldCleaner.php');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:realurl/Configuration/TSConfig.txt">');
// Scheduler clean up of expired tables
if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_realurl_urldata'])) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_realurl_urldata'] = array(
'expireField' => 'expire',
);
}
if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_realurl_pathdata'])) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_realurl_pathdata'] = array(
'expireField' => 'expire',
);
}
if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_realurl_uniqalias'])) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']['tx_realurl_uniqalias'] = array(
'expireField' => 'expire',
);
}
// Exclude gclid from cHash because TYPO3 does not do that
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] = array();
}
if (!in_array('gclid', $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'gclid';
if (!isset($GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'] = '';
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'] .= ', gclid';
}
// Exclude fbclid from cHash
if (!in_array('fbclid', $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'fbclid';
if (!isset($GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'] = '';
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters'] .= ', fbclid';
}
// Turn logging off by default
$logConfiguration = array(
'writerConfiguration' => array(
\TYPO3\CMS\Core\Log\LogLevel::DEBUG => array(
'TYPO3\\CMS\\Core\\Log\Writer\\NullWriter' => array(
)
)
)
);
if (isset($GLOBALS['TYPO3_CONF_VARS']['LOG']['DmitryDulepov']['Realurl'])) {
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
$logConfiguration,
$GLOBALS['TYPO3_CONF_VARS']['LOG']['DmitryDulepov']['Realurl']
);
}
$GLOBALS['TYPO3_CONF_VARS']['LOG']['DmitryDulepov']['Realurl'] = $logConfiguration;