]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/doc.php
change LACONICA to STATUSNET
[quix0rs-gnu-social.git] / actions / doc.php
1 <?php
2
3 /**
4  * Documentation action.
5  *
6  * PHP version 5
7  *
8  * @category Action
9  * @package  StatusNet
10  * @author   Evan Prodromou <evan@status.net>
11  * @author   Robin Millette <millette@status.net>
12  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13  * @link     http://status.net/
14  *
15  * StatusNet - the distributed open-source microblogging tool
16  * Copyright (C) 2008, 2009, StatusNet, Inc.
17  *
18  * This program is free software: you can redistribute it and/or modify
19  * it under the terms of the GNU Affero General Public License as published by
20  * the Free Software Foundation, either version 3 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU Affero General Public License for more details.
27  *
28  * You should have received a copy of the GNU Affero General Public License
29  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
30  */
31
32 if (!defined('STATUSNET')) {
33     exit(1);
34 }
35
36 /**
37  * Documentation class.
38  *
39  * @category Action
40  * @package  StatusNet
41  * @author   Evan Prodromou <evan@status.net>
42  * @author   Robin Millette <millette@status.net>
43  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
44  * @link     http://status.net/
45  */
46 class DocAction extends Action
47 {
48     var $filename;
49     var $title;
50
51     /**
52      * Class handler.
53      *
54      * @param array $args array of arguments
55      *
56      * @return nothing
57      */
58     function handle($args)
59     {
60         parent::handle($args);
61         $this->title    = $this->trimmed('title');
62         $this->filename = INSTALLDIR.'/doc-src/'.$this->title;
63         if (!file_exists($this->filename)) {
64             $this->clientError(_('No such document.'));
65             return;
66         }
67         $this->showPage();
68     }
69
70     // overrrided to add entry-title class
71     function showPageTitle() {
72         $this->element('h1', array('class' => 'entry-title'), $this->title());
73     }
74
75     // overrided to add hentry, and content-inner classes
76     function showContentBlock()
77      {
78          $this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
79          $this->showPageTitle();
80          $this->showPageNoticeBlock();
81          $this->elementStart('div', array('id' => 'content_inner',
82              'class' => 'entry-content'));
83          // show the actual content (forms, lists, whatever)
84          $this->showContent();
85          $this->elementEnd('div');
86          $this->elementEnd('div');
87      }
88
89     /**
90      * Display content.
91      *
92      * @return nothing
93      */
94     function showContent()
95     {
96         $c      = file_get_contents($this->filename);
97         $output = common_markup_to_html($c);
98         $this->raw($output);
99     }
100
101     /**
102      * Page title.
103      *
104      * @return page title
105      */
106     function title()
107     {
108         return ucfirst($this->title);
109     }
110
111     function isReadOnly($args)
112     {
113         return true;
114     }
115 }