forked from cundd/rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext_localconf.php
44 lines (37 loc) · 1.79 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
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
call_user_func(
function () {
// Register eID
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['rest'] = \Cundd\Rest\BootstrapDispatcher::class . '::processRequest';
// Detect and "hijack" REST requests
if (isset($_SERVER['REQUEST_URI'])) {
$restRequestBasePath = (string)getenv('TYPO3_REST_REQUEST_BASE_PATH');
if ($restRequestBasePath) {
$restRequestBasePath = '/' . trim($restRequestBasePath, '/');
}
$restRequestPrefix = $restRequestBasePath . '/rest/';
$restRequestPrefixLength = strlen($restRequestPrefix);
$requestUri = $_SERVER['REQUEST_URI'];
if (substr($requestUri, 0, $restRequestPrefixLength) === $restRequestPrefix) {
$_GET['eID'] = 'rest';
}
}
// Register Cache
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cundd_rest_cache'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cundd_rest_cache'] = [];
}
// Register implementation classes
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\Cundd\Rest\Configuration\ConfigurationProviderInterface::class] = [
'className' => \Cundd\Rest\Configuration\TypoScriptConfigurationProvider::class,
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\Cundd\Rest\Authentication\UserProviderInterface::class] = [
'className' => \Cundd\Rest\Authentication\UserProvider\FeUserProvider::class,
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][Cundd\Rest\Handler\HandlerInterface::class] = [
'className' => \Cundd\Rest\Handler\CrudHandler::class,
];
}
);