forked from GNUsocial/gnu-social
		
	add hooks to allow loading custom help documentation
This commit is contained in:
		@@ -227,3 +227,11 @@ StartNewQueueManager: before trying to start a new queue manager; good for plugi
 | 
				
			|||||||
RedirectToLogin: event when we force a redirect to login (like when going to a settings page on a remembered login)
 | 
					RedirectToLogin: event when we force a redirect to login (like when going to a settings page on a remembered login)
 | 
				
			||||||
- $action: action object being shown
 | 
					- $action: action object being shown
 | 
				
			||||||
- $user: current user
 | 
					- $user: current user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					StartLoadDoc: before loading a help doc (hook this to show your own documentation)
 | 
				
			||||||
 | 
					- $title: title of the document
 | 
				
			||||||
 | 
					- $output: HTML output to show
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EndLoadDoc: after loading a help doc (hook this to modify other documentation)
 | 
				
			||||||
 | 
					- $title: title of the document
 | 
				
			||||||
 | 
					- $output: HTML output to show
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,12 +58,24 @@ class DocAction extends Action
 | 
				
			|||||||
    function handle($args)
 | 
					    function handle($args)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        parent::handle($args);
 | 
					        parent::handle($args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->title  = $this->trimmed('title');
 | 
					        $this->title  = $this->trimmed('title');
 | 
				
			||||||
 | 
					        $this->output = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (Event::handle('StartLoadDoc', &$this->title, &$this->output)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $this->filename = INSTALLDIR.'/doc-src/'.$this->title;
 | 
					            $this->filename = INSTALLDIR.'/doc-src/'.$this->title;
 | 
				
			||||||
            if (!file_exists($this->filename)) {
 | 
					            if (!file_exists($this->filename)) {
 | 
				
			||||||
                $this->clientError(_('No such document.'));
 | 
					                $this->clientError(_('No such document.'));
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $c = file_get_contents($this->filename);
 | 
				
			||||||
 | 
					            $this->output = common_markup_to_html($c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Event::handle('EndLoadDoc', $this->title, &$this->output);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->showPage();
 | 
					        $this->showPage();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -93,9 +105,7 @@ class DocAction extends Action
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    function showContent()
 | 
					    function showContent()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $c      = file_get_contents($this->filename);
 | 
					        $this->raw($this->output);
 | 
				
			||||||
        $output = common_markup_to_html($c);
 | 
					 | 
				
			||||||
        $this->raw($output);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user