PluginProbe
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager / 1.2
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager v1.2
10.56 1.2.1 10 10.1 10.2 10.3 10.31 10.32 10.33 10.34 10.50 10.51 10.52 10.53 10.55 9.0 9.0.1 9.4 trunk 1.0.0 1.1 1.2
easy-code-manager / framework / settings / page.inc.php

page.inc.php in FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager 1.2, 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.