From 9aa39c757396e66ad959adc9fda63bfd0a869e8b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 21 Aug 2009 16:54:35 -0400 Subject: add hooks to allow loading custom help documentation --- actions/doc.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'actions/doc.php') diff --git a/actions/doc.php b/actions/doc.php index 54ae13803..7387c1620 100644 --- a/actions/doc.php +++ b/actions/doc.php @@ -58,12 +58,24 @@ class DocAction extends Action function handle($args) { parent::handle($args); - $this->title = $this->trimmed('title'); - $this->filename = INSTALLDIR.'/doc-src/'.$this->title; - if (!file_exists($this->filename)) { - $this->clientError(_('No such document.')); - return; + + $this->title = $this->trimmed('title'); + $this->output = null; + + if (Event::handle('StartLoadDoc', &$this->title, &$this->output)) { + + $this->filename = INSTALLDIR.'/doc-src/'.$this->title; + if (!file_exists($this->filename)) { + $this->clientError(_('No such document.')); + return; + } + + $c = file_get_contents($this->filename); + $this->output = common_markup_to_html($c); + + Event::handle('EndLoadDoc', $this->title, &$this->output); } + $this->showPage(); } @@ -93,9 +105,7 @@ class DocAction extends Action */ function showContent() { - $c = file_get_contents($this->filename); - $output = common_markup_to_html($c); - $this->raw($output); + $this->raw($this->output); } /** -- cgit v1.2.3-54-g00ecf