1 | <?php |
||
8 | class CPT_Date_Archive_Settings { |
||
|
|||
9 | |||
10 | /** |
||
11 | * A singleton instance |
||
12 | * |
||
13 | * @var CPT_Date_Archive_Settings |
||
14 | * @static |
||
15 | * @access private |
||
16 | * @since 0.2 |
||
17 | */ |
||
18 | private static $instance = null; |
||
19 | |||
20 | /** |
||
21 | * The page object |
||
22 | * |
||
23 | * @var stdClass |
||
24 | * @access private |
||
25 | * @since 0.2 |
||
26 | */ |
||
27 | private $page; |
||
28 | |||
29 | /** |
||
30 | * The class constructor |
||
31 | * |
||
32 | * @access public |
||
33 | * @since 0.2 |
||
34 | */ |
||
35 | protected function __construct() { |
||
43 | |||
44 | /** |
||
45 | * Add the options page, options groups, sections, and fields |
||
46 | * |
||
47 | * Hooked to WP admin_menu action |
||
48 | * |
||
49 | * @access public |
||
50 | * @since 0.2 |
||
51 | */ |
||
52 | public function admin_menu() { |
||
61 | |||
62 | /** |
||
63 | * Render the settings page |
||
64 | * |
||
65 | * @access public |
||
66 | * @since 0.2 |
||
67 | */ |
||
68 | public function render() { |
||
75 | |||
76 | /** |
||
77 | * Render the post types field |
||
78 | * |
||
79 | * @access public |
||
80 | * @since 0.2 |
||
81 | */ |
||
82 | public function render_field_post_types() { |
||
98 | |||
99 | /** |
||
100 | * Sanitize the post types field input |
||
101 | * |
||
102 | * @param array $input |
||
103 | * @access public |
||
104 | * @since 0.2 |
||
105 | */ |
||
106 | public function sanitize_input( $input ) { |
||
117 | |||
118 | /** |
||
119 | * Get the post type objects that are set to support date archives |
||
120 | * |
||
121 | * @return stdClass[] |
||
122 | * @access public |
||
123 | * @since 0.2 |
||
124 | */ |
||
125 | public function get_post_type_objects() { |
||
136 | |||
137 | /** |
||
138 | * Get the post post type names that are set to support date archives |
||
139 | * |
||
140 | * @return string[] |
||
141 | * @access public |
||
142 | * @since 0.2 |
||
143 | */ |
||
144 | public function get_post_types() { |
||
149 | |||
150 | /** |
||
151 | * Does a particular post type have a date archive? |
||
152 | * |
||
153 | * @return bool |
||
154 | * @access public |
||
155 | * @since 0.2 |
||
156 | */ |
||
157 | public function has_date_archive( $post_type ) { |
||
172 | |||
173 | /** |
||
174 | * Delete the rewrite rules when updating the plugin settings |
||
175 | * |
||
176 | * Hooked to WP 'updated_option_cpt_date_archive_post_types' action. |
||
177 | * |
||
178 | * @access public |
||
179 | * @since 0.2 |
||
180 | */ |
||
181 | public function update_option() { |
||
186 | |||
187 | /** |
||
188 | * Prevent cloning of the singleton instance |
||
189 | * |
||
190 | * @access private |
||
191 | * @since 0.2 |
||
192 | */ |
||
193 | private function __clone() {} |
||
194 | |||
195 | /** |
||
196 | * Prevent unserializing of the singleton instance |
||
197 | * |
||
198 | * @access private |
||
199 | * @since 0.2 |
||
200 | */ |
||
201 | private function __wakeup () {} |
||
202 | |||
203 | /** |
||
204 | * Singleton model |
||
205 | * |
||
206 | * @access public |
||
207 | * @since 0.2 |
||
208 | */ |
||
209 | public static function init() { |
||
218 | |||
219 | } |
||
220 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.