[2044] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
| 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | if (!defined('DC_RC_PATH')) { return; } |
---|
| 13 | |
---|
| 14 | /** |
---|
| 15 | @ingroup PLUGIN_MAINTENANCE |
---|
| 16 | @nosubgrouping |
---|
| 17 | @brief Simple descriptor for tabs, groups and more |
---|
| 18 | |
---|
| 19 | At this time this class is used in same way an arrayObject |
---|
| 20 | but in futur it could be completed with advance methods. |
---|
| 21 | */ |
---|
| 22 | class dcMaintenanceDescriptor |
---|
| 23 | { |
---|
| 24 | protected $id; |
---|
| 25 | protected $name; |
---|
| 26 | protected $options; |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * Constructor (really ?!). |
---|
| 30 | * |
---|
| 31 | * @param id <b>string<b> Tab ID |
---|
| 32 | * @param name <b>string<b> Tab name |
---|
| 33 | * @param options <b>string<b> Options |
---|
| 34 | */ |
---|
| 35 | public function __construct($id, $name, $options=array()) |
---|
| 36 | { |
---|
| 37 | $this->id = (string) $id; |
---|
| 38 | $this->name = (string) $name; |
---|
| 39 | $this->options = (array) $options; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | * Get ID. |
---|
| 44 | * |
---|
| 45 | * @return <b>string</b> ID |
---|
| 46 | */ |
---|
| 47 | public function id() |
---|
| 48 | { |
---|
| 49 | return $this->id; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Get name. |
---|
| 54 | * |
---|
| 55 | * @return <b>string</b> Name |
---|
| 56 | */ |
---|
| 57 | public function name() |
---|
| 58 | { |
---|
| 59 | return $this->name; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | /** |
---|
| 63 | * Get option. |
---|
| 64 | * |
---|
| 65 | * Option called "summary" and "description" are used. |
---|
| 66 | * |
---|
| 67 | * @param key <b>string<b> Option key |
---|
| 68 | * @return <b>string</b> Option value |
---|
| 69 | */ |
---|
| 70 | public function option($key) |
---|
| 71 | { |
---|
| 72 | return isset($this->options[$key]) ? $this->options[$key] : null; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | /* @ignore */ |
---|
| 76 | public function __get($key) |
---|
| 77 | { |
---|
| 78 | return $this->option($key); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | /* @ignore */ |
---|
| 82 | public function __isset($key) |
---|
| 83 | { |
---|
| 84 | return isset($this->options[$key]); |
---|
| 85 | } |
---|
| 86 | } |
---|