'action', 'tests' => 'send', ); var $ajax = array('render_layout' => false, // Do you want the layout to be rendered with this service? 'render_alternate_view' => true, // Do you want to render an alternate view? 'alternate_view_path' => 'ajax', // Where is this view in relation to the controller/action view. ); var $rest = array('render_layout' => false, // Do you want the layout to be rendered with this service? 'render_alternate_view' => true, // Do you want to render an alternate view? 'alternate_view_path' => 'rest', // Where is this view in relation to the controller/action view. ); var $rss = array('render_layout' => false, // Do you want the layout to be rendered with this service? 'render_alternate_view' => true, // Do you want to render an alternate view? 'alternate_view_path' => 'rss', // Where is this view in relation to the controller/action view. ); var $soap = array('render_layout' => false, // Do you want the layout to be rendered with this service? 'render_alternate_view' => true, // Do you want to render an alternate view? 'alternate_view_path' => 'soap', // Where is this view in relation to the controller/action view. ); var $xml = array('render_layout' => false, // Do you want the layout to be rendered with this service? 'render_alternate_view' => true, // Do you want to render an alternate view? 'alternate_view_path' => 'xml', // Where is this view in relation to the controller/action view. ); var $xmlrpc = array('render_layout' => false, // Do you want the layout to be rendered with this service? 'render_alternate_view' => true, // Do you want to render an alternate view? 'alternate_view_path' => 'xmlrpc', // Where is this view in relation to the controller/action view. ); function startup (&$controller) { $this->controller = &$controller; // If webservices is not turned on, stop now. if (WEBSERVICES != 'on') return false; // If this is not allowed controller/action then stop. if (isset($this->allowed_controller_actions[strtolower($this->controller->name)]) && $this->allowed_controller_actions[strtolower($this->controller->name)] != strtolower($this->controller->action)) return false; $here = $this->controller->here; if (preg_match('/^\/ajax.*/', $here, $crap)) $webservice = 'ajax'; else if (preg_match('/^\/rest.*/', $here, $crap)) $webservice = 'rest'; else if (preg_match('/^\/rss.*/', $here, $crap)) $webservice = 'rss'; else if (preg_match('/^\/soap.*/', $here, $crap)) $webservice = 'soap'; else if (preg_match('/^\/xml.*/', $here, $crap)) $webservice = 'xml'; else if (preg_match('/^\/xmlrpc.*/', $here, $crap)) $webservice = 'xmlrpc'; else $webservice = null; // Set the webservice variable for the controller so if you $this->controller->webservice = $webservice; // If setOnlyWebserviceVariable is true or a webservice wasn't detected, stop now. if ($this->setOnlyWebserviceVariable === true || $webservice == null) return; if ($this->{$webservice}['render_layout'] === false) $this->controller->layout = false; else $this->controller->layout = $this->{$webservice}['render_layout']; if ($this->{$webservice}['render_alternate_view'] === true) $this->controller->viewPath = $this->controller->viewPath . DS . $this->{$webservice}['alternate_view_path']; } } ?>