public function dispatch() { $method = strtoupper($this->_request->getMethod()); if ($method === 'POST' && null !== ($extraMethod = $this->_request->getParam('_method', null))) { $extraMethod = strtoupper(filter_var($extraMethod, FILTER_SANITIZE_STRING)); if (in_array($extraMethod, array('PUT', 'DELETE'))) { $method = $extraMethod; } } $action = strtolower($method) . 'Action'; $aclResource = strtolower(get_called_class() . '_' . $method); if (method_exists($this, $action)) { if (Tools_Security_Acl::isAllowed($aclResource)) { return $this->_jsonHelper->direct($this->{$action}()); } else { $this->_error(null, self::REST_STATUS_FORBIDDEN); } } else { throw new Exceptions_SeotoasterPluginException(get_called_class() . ' doesn\'t have ' . $method . ' implemented'); } }
/** * getResponse * * <p>convert the $_response array to json and set the application mine type json</p> */ public function getResponse() { if (Zend_Registry::get('config')->kebab->logging->enable && Zend_Registry::get('config')->kebab->logging->firebug->enable) { Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush(); } //KBBTODO We should write an adapter for array, xml in future $jsonHelper = new Zend_Controller_Action_Helper_Json(); $jsonHelper->direct($this->_response); }