33 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ExtDirect']) && is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ExtDirect'])) {
34 $this->settings =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ExtDirect'];
53 $ajaxObj->setContent(array());
63 public function getApiPhp(array $filterNamespaces) {
66 if (count($javascriptNamespaces)) {
68 if (!Ext.isObject(Ext.app.ExtDirectAPI)) { 69 Ext.app.ExtDirectAPI = {}; 71 Ext.apply(Ext.app.ExtDirectAPI, ' . json_encode($javascriptNamespaces) .
'); 75 throw new \InvalidArgumentException($errorMessage, 1297645190);
87 $javascriptNamespaces = array();
88 if (is_array($this->settings)) {
89 foreach ($this->settings as $javascriptName => $configuration) {
90 $splittedJavascriptName = explode(
'.', $javascriptName);
91 $javascriptObjectName = array_pop($splittedJavascriptName);
92 $javascriptNamespace = implode(
'.', $splittedJavascriptName);
94 if (!$this->
findNamespace($javascriptNamespace, $filterNamespaces)) {
97 if (!isset($javascriptNamespaces[$javascriptNamespace])) {
98 $javascriptNamespaces[$javascriptNamespace] = array(
100 'type' =>
'remoting',
101 'actions' => array(),
102 'namespace' => $javascriptNamespace
105 if (is_array($configuration)) {
106 $className = $configuration[
'callbackClass'];
108 $javascriptNamespaces[$javascriptNamespace][
'actions'][$javascriptObjectName] = array();
109 foreach (get_class_methods($serverObject) as $methodName) {
110 $reflectionMethod = new \ReflectionMethod($serverObject, $methodName);
111 $numberOfParameters = $reflectionMethod->getNumberOfParameters();
112 $docHeader = $reflectionMethod->getDocComment();
113 $formHandler = strpos($docHeader,
'@formHandler') !== FALSE;
114 $javascriptNamespaces[$javascriptNamespace][
'actions'][$javascriptObjectName][] = array(
115 'name' => $methodName,
116 'len' => $numberOfParameters,
117 'formHandler' => $formHandler
123 return $javascriptNamespaces;
139 $url .= rawurlencode($namespace);
153 $cacheIdentifier =
'ExtDirectApi';
154 $cacheHash = md5($cacheIdentifier . implode(
',', $filterNamespaces) . \
TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(
'TYPO3_SSL') . serialize($this->settings) .
TYPO3_MODE . \
TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(
'HTTP_HOST'));
157 if ($noCache || !is_array(($javascriptNamespaces = \
TYPO3\CMS\Frontend\Page\PageRepository::getHash($cacheHash)))) {
158 $javascriptNamespaces = $this->
generateAPI($filterNamespaces);
159 if (count($javascriptNamespaces)) {
163 return $javascriptNamespaces;
173 if (count($filterNamespaces)) {
175 $errorMessage = sprintf(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:ExtDirect.namespaceError'), __CLASS__, implode(
',', $filterNamespaces));
178 $errorMessage = sprintf(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:ExtDirect.noNamespace'), __CLASS__);
180 return $errorMessage;
191 if ($filterNamespaces === array(
'TYPO3')) {
195 foreach ($filterNamespaces as $filter) {
196 if (\
TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($filter, $namespace)) {
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
getApiPhp(array $filterNamespaces)
getNamespaceError(array $filterNamespaces)
getExtDirectApi(array $filterNamespaces)
generateAPI(array $filterNamespaces)
findNamespace($namespace, array $filterNamespaces)
static storeHash($hash, $data, $ident, $lifetime=0)
static locationHeaderUrl($path)
getAPI($ajaxParams, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
getRoutingUrl($namespace)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
if($ajaxRegistryEntry !==NULL) $ajaxObj