1 | <?php |
||
6 | class Toolbar_Theme_Switcher { |
||
|
|||
7 | |||
8 | /** @var WP_Theme $theme */ |
||
9 | public static $theme = false; |
||
10 | |||
11 | /** |
||
12 | * Hooks that need to be set up early. |
||
13 | */ |
||
14 | public static function on_load() { |
||
19 | |||
20 | /** |
||
21 | * Loads cookie and sets up theme filters. |
||
22 | */ |
||
23 | public static function setup_theme() { |
||
51 | |||
52 | /** |
||
53 | * If allowed to switch theme. |
||
54 | * |
||
55 | * @return boolean |
||
56 | */ |
||
57 | public static function can_switch_themes() { |
||
63 | |||
64 | /** |
||
65 | * Sets if cookie is defined to non-default theme. |
||
66 | */ |
||
67 | public static function load_cookie() { |
||
85 | |||
86 | /** |
||
87 | * Returns cookie name, based on home URL so it differs for sites in multisite. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public static function get_cookie_name() { |
||
101 | |||
102 | /** |
||
103 | * Retrieves allowed themes. |
||
104 | * |
||
105 | * @return WP_Theme[] |
||
106 | */ |
||
107 | public static function get_allowed_themes() { |
||
128 | |||
129 | /** |
||
130 | * Sets up hooks that doesn't need to happen early. |
||
131 | */ |
||
132 | public static function init() { |
||
141 | |||
142 | /** |
||
143 | * Creates menu in toolbar. |
||
144 | * |
||
145 | * @param WP_Admin_Bar $wp_admin_bar Admin bar instance. |
||
146 | */ |
||
147 | public static function admin_bar_menu( $wp_admin_bar ) { |
||
178 | |||
179 | /** |
||
180 | * Callback to sort theme array with core themes in numerical order by year. |
||
181 | * |
||
182 | * @param string $theme_a First theme name. |
||
183 | * @param string $theme_b Second theme name. |
||
184 | * |
||
185 | * @return int |
||
186 | */ |
||
187 | public static function sort_core_themes( $theme_a, $theme_b ) { |
||
215 | |||
216 | /** |
||
217 | * Saves selected theme in cookie if valid. |
||
218 | */ |
||
219 | public static function set_theme() { |
||
231 | |||
232 | // <editor-fold desc="Deprecated"> |
||
233 | /** |
||
234 | * If theme is in list of allowed to be switched to. |
||
235 | * |
||
236 | * @deprecated :2.0 |
||
237 | * |
||
238 | * @param WP_Theme $theme |
||
239 | * |
||
240 | * @return bool |
||
241 | */ |
||
242 | public static function is_allowed( $theme ) { |
||
246 | |||
247 | /** |
||
248 | * Template slug filter. |
||
249 | * |
||
250 | * @param string $template |
||
251 | * |
||
252 | * @deprecated :2.0 |
||
253 | * |
||
254 | * @return string |
||
255 | */ |
||
256 | public static function template( $template ) { |
||
260 | |||
261 | /** |
||
262 | * Stylesheet slug filter. |
||
263 | * |
||
264 | * @param string $stylesheet |
||
265 | * |
||
266 | * @deprecated :2.0 |
||
267 | * |
||
268 | * @return string |
||
269 | */ |
||
270 | public static function stylesheet( $stylesheet ) { |
||
274 | |||
275 | /** |
||
276 | * Returns field from theme data if cookie is set to valid theme. |
||
277 | * |
||
278 | * @param string $field_name |
||
279 | * @param mixed $default |
||
280 | * |
||
281 | * @deprecated :2.0 |
||
282 | * |
||
283 | * @return mixed |
||
284 | */ |
||
285 | public static function get_theme_field( $field_name, $default = false ) { |
||
293 | // </editor-fold> |
||
294 | } |
||
295 |
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.