application/modules/g/controllers/ExtController.php
public function preDispatch() {
        if ($this->getRequest()->isPost()) {
            $post = $this->_getJsonRpcRequest();
            $requests = Zend_Json::decode($post, Zend_Json::TYPE_ARRAY);
            $modifiedRequests = array();
            /**
             * Check if this was a batch request. In that case the array is a plain array of
             * arrays. If not, there will be a 'jsonrpc' key in the root of the array.
             */
            $batch = !array_key_exists('jsonrpc', $requests);
            if (!$batch) {
                $requests = array($requests);
            }
            foreach ($requests as $i => $request) {
                $this->_saveRequestForModification($request, $i);
                if (array_key_exists('method', $request)) {
                    $methodParts = explode('.', $request['method']);
                    $method = array_pop($methodParts);
                    if (in_array($method, array('create', 'update', 'destroy'))) {
                        $modifyMethod = '_modifyBefore' . ucfirst($method);
                        $request = $this->{$modifyMethod}($request);
                    }
                }
                $modifiedRequests[] = $request;
            }
            if ($batch) {
                $this->getRequest()->setPost('request', Zend_Json::encode($modifiedRequests));
            } else {
                $this->getRequest()->setPost('request', Zend_Json::encode($modifiedRequests[0]));
            }
        }
        parent::preDispatch();
        $this->_toggleCache(false);
    }
public function preDispatch() {
        if ($this->getRequest()->isPost()) {
            $post = $this->_getJsonRpcRequest();
            $requests = Zend_Json::decode($post, Zend_Json::TYPE_ARRAY);
            $modifiedRequests = array();
            /**
             * Check if this was a batch request. In that case the array is a plain array of
             * arrays. If not, there will be a 'jsonrpc' key in the root of the array.
             */
            $batch = !array_key_exists('jsonrpc', $requests);
            if (!$batch) {
                $requests = array($requests);
            }
            foreach ($requests as $i => $request) {
                $this->_saveRequestForModification($request, $i);
                if (array_key_exists('method', $request)) {
                    $methodParts = explode('.', $request['method']);
                    $method = array_pop($methodParts);
                    if (in_array($method, array('create', 'update', 'destroy'))) {
                        $modifyMethod = '_modifyBefore' . ucfirst($method);
                        $request = $this->{$modifyMethod}($request);
                    }
                }
                $modifiedRequests[] = $request;
            }
            if ($batch) {
                $this->getRequest()->setPost('request', Zend_Json::encode($modifiedRequests));
            } else {
                $this->getRequest()->setPost('request', Zend_Json::encode($modifiedRequests[0]));
            }
        }
        parent::preDispatch();
        $this->_toggleCache(false);
    }
public function preDispatch ( ) { if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ post = $ this -> _getJsonRpcRequest ( ) ; $ requests = Zend_Json :: decode ( $ post , Zend_Json :: TYPE_ARRAY ) ; $ modifiedRequests = array ( ) ; /**
             * Check if this was a batch request. In that case the array is a plain array of
             * arrays. If not, there will be a 'jsonrpc' key in the root of the array.
             */ $ batch = ! array_key_exists ( 'jsonrpc' , $ requests ) ; if ( ! $ batch ) { $ requests = array ( $ requests ) ; } foreach ( $ requests as $ i => $ request ) { $ this -> _saveRequestForModification ( $ request , $ i ) ; if ( array_key_exists ( 'method' , $ request ) ) { $ methodParts = explode ( '.' , $ request [ 'method' ] ) ; $ method = array_pop ( $ methodParts ) ; if ( in_array ( $ method , array ( 'create' , 'update' , 'destroy' ) ) ) { $ modifyMethod = '_modifyBefore' . ucfirst ( $ method ) ; $ request = $ this -> { $ modifyMethod } ( $ request ) ; } } $ modifiedRequests [ ] = $ request ; } if ( $ batch ) { $ this -> getRequest ( ) -> setPost ( 'request' , Zend_Json :: encode ( $ modifiedRequests ) ) ; } else { $ this -> getRequest ( ) -> setPost ( 'request' , Zend_Json :: encode ( $ modifiedRequests [ 0 ] ) ) ; } } parent :: preDispatch ( ) ; $ this -> _toggleCache ( false ) ; }
Callback called before executing action.
Transforms requests to a format ExtJs accepts.
Also turns off caching, since the CMS always receives live data.

@return Void
Callback called before executing action . Transforms requests to a format ExtJs accepts . Also turns off caching since the CMS always receives live data .