public function distribute($return = false) { $this->processSessionValues(); $routing = $this->request->parseDocBookRequest()->getDocBookRouting(); $this->processQueryArguments(); $input_file = $this->getInputFile(); if (empty($input_file)) { $input_path = $this->getInputPath(); if (!empty($input_path)) { $input_file = DirectoryHelper::slashDirname($this->getPath('base_dir_http')) . trim($input_path, '/'); } } $result = null; if (!empty($routing)) { $ctrl_cls = $routing['controller_classname']; $ctrl_obj = new $ctrl_cls(); $this->setController($ctrl_obj); $result = Helper::fetchArguments($this->getController(), $routing['action'], array('path' => $input_file)); } if (empty($result) || !is_array($result) || count($result) != 2 && count($result) != 3) { $str = gettype($result); if (is_array($result)) { $str .= ' length ' . count($result); } throw new DocBookRuntimeException(sprintf('A controller action must return a two or three entries array like [ template file , content (, params) ]! Received %s from class "%s::%s()".', $str, $routing['controller_classname'], $routing['action'])); } else { $template = $result[0]; $content = $result[1]; $params = isset($result[2]) ? $result[2] : array(); } // for dev if (!empty($_GET) && isset($_GET['dbg'])) { $this->debug(); } $this->display($content, $template, $params, true); }