PluginProbe
CSS & JavaScript Toolbox / 11.7
CSS & JavaScript Toolbox v11.7
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / framework / settings / page.inc.php

page.inc.php in CSS & JavaScript Toolbox 11.7, at framework/settings/page.inc.php

121 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 abstract class CJTSettingsPage {
10
11 /**
12 *
13 */
14 const PREFIX = 'cjt-settings';
15
16 /**
17 * put your comment there...
18 *
19 * @var mixed
20 */
21 protected $fullName = '';
22
23 /**
24 * put your comment there...
25 *
26 * @var mixed
27 */
28 protected $page = '';
29
30 /**
31 * put your comment there...
32 *
33 * @var mixed
34 */
35 protected $prefix = '';
36
37 /**
38 * put your comment there...
39 *
40 * @var mixed
41 */
42 protected $settings;
43
44 /**
45 * put your comment there...
46 *
47 * @param mixed $prefix
48 * @return CJTSettingsModel
49 */
50 public function __construct($page, $prefix = self::PREFIX) {
51 $this->page = $page;
52 $this->prefix = $prefix;
53 // Build full name.
54 $this->fullName = "{$prefix}.{$page}";
55 }
56
57 /**
58 * put your comment there...
59 *
60 * @param mixed $property
61 */
62 public function __get($property) {
63 return isset($this->settings->{$property}) ? $this->settings->{$property} : null;
64 }
65
66 /**
67 * put your comment there...
68 *
69 * @param mixed $property
70 * @param mixed $value
71 */
72 public function __set($property, $value) {
73 $this->settings->{$property} = $value;
74 }
75
76 /**
77 * put your comment there...
78 *
79 */
80 protected function load() {
81 $settings = get_option($this->fullName);
82 if (!$settings) {
83 $settings = array();
84 }
85 $this->settings = (object) $settings;
86 }
87
88 /**
89 * put your comment there...
90 *
91 */
92 public function clear() {
93 $this->settings = (object) array();
94 }
95
96 /**
97 * put your comment there...
98 *
99 */
100 public function getName() {
101 return $this->page;
102 }
103
104 /**
105 * put your comment there...
106 *
107 * @param mixed $data
108 */
109 public function set($data) {
110 $this->settings = (object) $data;
111 }
112
113 /**
114 * put your comment there...
115 *
116 */
117 public function update() {
118 update_option($this->fullName, $this->settings);
119 }
120
121 } // End class.