1 | <?php |
||
15 | class Help extends Common |
||
16 | { |
||
17 | /** |
||
18 | * Holds the supported format definitions. |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $format_defs = array( |
||
22 | 'post' => array( |
||
23 | 'url' => 'http://en.wikipedia.org/wiki/POST_%28HTTP%29', |
||
24 | 'mime' => 'application/x-www-form-urlencoded', |
||
25 | 'ext' => null, |
||
26 | 'input' => 'encoded key-value pairs.', |
||
27 | ), |
||
28 | 'html' => array( |
||
29 | 'url' => 'http://en.wikipedia.org/wiki/HTML', |
||
30 | 'name' => 'HyperText Markup Language', |
||
31 | 'mime' => 'text/html', // application/xhtml+xml |
||
32 | 'ext' => '.html' |
||
33 | ), |
||
34 | 'json' => array( |
||
35 | 'url' => 'http://en.wikipedia.org/wiki/Json', |
||
36 | 'name' => 'JavaScript Object Notation', |
||
37 | 'mime' => 'application/json', |
||
38 | 'ext' => '.json', |
||
39 | ), |
||
40 | 'jsonp' => array( |
||
41 | 'url' => 'http://en.wikipedia.org/wiki/JSONP', |
||
42 | 'name' => 'JSON with padding', |
||
43 | 'mime' => 'application/javascript', // one day: application/json-p |
||
44 | 'ext' => '.jsonp' |
||
45 | ), |
||
46 | 'php' => array( |
||
47 | 'url' => 'http://php.net/manual/en/function.serialize.php', |
||
48 | 'name' => 'Byte-stream representation', |
||
49 | 'mime' => 'text/plain', |
||
50 | 'ext' => '.php' |
||
51 | ), |
||
52 | 'xml' => array( |
||
53 | 'url' => 'http://en.wikipedia.org/wiki/XML', |
||
54 | 'name' => 'Extensible Markup Language', |
||
55 | 'mime' => 'text/xml', // application/xhtml+xml |
||
56 | 'ext' => '.xml', |
||
57 | ), |
||
58 | 'csv' => array( |
||
59 | 'url' => 'http://en.wikipedia.org/wiki/Comma-separated_values', |
||
60 | 'name' => 'Comma-separated values', |
||
61 | 'mime' => 'text/xml', // application/xhtml+xml |
||
62 | 'ext' => '.csv' |
||
63 | ) |
||
64 | ); |
||
65 | |||
66 | /** |
||
67 | * Holds the usage string. |
||
68 | * @var string |
||
69 | */ |
||
70 | protected $usage = null; |
||
71 | |||
72 | /** |
||
73 | * Gets the view layout. |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getLayout() |
||
81 | |||
82 | /** |
||
83 | * Returns the Usage field formatted |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getFormatedUsage() |
||
119 | |||
120 | /** |
||
121 | * Checks wether the plugin signature is enable. |
||
122 | * |
||
123 | * @return boolean |
||
124 | */ |
||
125 | public function hasPluginSignature() |
||
129 | |||
130 | /** |
||
131 | * Checks wether many output format are available. |
||
132 | * |
||
133 | * @return boolean |
||
134 | */ |
||
135 | public function hasManyOutputFormats() |
||
139 | |||
140 | /** |
||
141 | * Returns the formatted Output formats. |
||
142 | * |
||
143 | * @return array |
||
144 | */ |
||
145 | public function getOutputFormats() |
||
160 | |||
161 | // public function getOutputExtensionExamples() |
||
162 | // { |
||
163 | // $formats = &$this->format_defs; |
||
164 | // $formatted = array(); |
||
165 | // sort($this->config['routing']['formats']); |
||
166 | // foreach ($this->config['routing']['formats'] as $k) { |
||
167 | // $ext = $formats[$k]['ext']; |
||
168 | // $formatted[] = sprintf( |
||
169 | // '<a href="/help/:path%s">/help<b>%s</b></a>', $ext, $ext |
||
170 | // ); |
||
171 | // } |
||
172 | |||
173 | // return $formatted; |
||
174 | // } |
||
175 | |||
176 | /** |
||
177 | * Returns formatted Input formats |
||
178 | * |
||
179 | * @return array |
||
180 | */ |
||
181 | public function getInputFormats() |
||
197 | |||
198 | /** |
||
199 | * Deals with the resource parameters definitions. |
||
200 | * |
||
201 | * @return array |
||
202 | */ |
||
203 | public function getPathParams() |
||
212 | |||
213 | /** |
||
214 | * Deals with the request params/filters definitions. |
||
215 | * |
||
216 | * @return array |
||
217 | */ |
||
218 | public function getQueryParams() |
||
227 | |||
228 | /** |
||
229 | * Returns the response entries. |
||
230 | * |
||
231 | * @return array |
||
232 | */ |
||
233 | public function getReturns() |
||
241 | |||
242 | /** |
||
243 | * Deals with the request params/filters definitions. |
||
244 | * |
||
245 | * @return array |
||
246 | */ |
||
247 | public function getVersion() |
||
259 | |||
260 | } |
||
261 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: