|
Revision 21, 0.8 kB
(checked in by admin, 18 years ago)
|
|
|
| Rev | Line | |
|---|
| [21] | 1 | <?php |
|---|
| 2 | class RCCWP_Options |
|---|
| 3 | { |
|---|
| 4 | function Delete() |
|---|
| 5 | { |
|---|
| 6 | delete_option(RC_CWP_OPTION_KEY); |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | //function Update($hideWritePost, $hideWritePage, $promptEditingPost, $assignToRole, $useSnipshot, $enableEditnplace, $defaultCustomWritePanel, $enableHTMLPurifier,$tidyLevel) |
|---|
| 10 | function Update($options) |
|---|
| 11 | { |
|---|
| 12 | $options = serialize($options); |
|---|
| 13 | update_option(RC_CWP_OPTION_KEY, $options); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | function Get($key = null) |
|---|
| 17 | { |
|---|
| 18 | if (get_option(RC_CWP_OPTION_KEY) == "") return ""; |
|---|
| 19 | if (is_array(get_option(RC_CWP_OPTION_KEY))) |
|---|
| 20 | $options = get_option(RC_CWP_OPTION_KEY); |
|---|
| 21 | else |
|---|
| 22 | $options = unserialize(get_option(RC_CWP_OPTION_KEY)); |
|---|
| 23 | |
|---|
| 24 | if (!empty($key)) |
|---|
| 25 | return $options[$key]; |
|---|
| 26 | else |
|---|
| 27 | return $options; |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | function Set($key, $val) |
|---|
| 31 | { |
|---|
| 32 | $options = RCCWP_Options::Get(); |
|---|
| 33 | $options[$key] = $val; |
|---|
| 34 | RCCWP_Options::Update($options); |
|---|
| 35 | } |
|---|
| 36 | } |
|---|
| 37 | ?> |
|---|