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() { |
||
45 | |||
46 | /** |
||
47 | * Clear theme choice if reset variable is present in request. |
||
48 | */ |
||
49 | public static function check_reset() { |
||
58 | |||
59 | /** |
||
60 | * If allowed to switch theme. |
||
61 | * |
||
62 | * @return boolean |
||
63 | */ |
||
64 | public static function can_switch_themes() { |
||
70 | |||
71 | /** |
||
72 | * Sets if cookie is defined to non-default theme. |
||
73 | */ |
||
74 | public static function load_cookie() { |
||
92 | |||
93 | /** |
||
94 | * Returns cookie name, based on home URL so it differs for sites in multisite. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public static function get_cookie_name() { |
||
108 | |||
109 | /** |
||
110 | * Retrieves allowed themes. |
||
111 | * |
||
112 | * @return WP_Theme[] |
||
113 | */ |
||
114 | public static function get_allowed_themes() { |
||
135 | |||
136 | /** |
||
137 | * Sets up hooks that doesn't need to happen early. |
||
138 | */ |
||
139 | public static function init() { |
||
148 | |||
149 | /** |
||
150 | * Creates menu in toolbar. |
||
151 | * |
||
152 | * @param WP_Admin_Bar $wp_admin_bar Admin bar instance. |
||
153 | */ |
||
154 | public static function admin_bar_menu( $wp_admin_bar ) { |
||
185 | |||
186 | /** |
||
187 | * Callback to sort theme array with core themes in numerical order by year. |
||
188 | * |
||
189 | * @param string $theme_a First theme name. |
||
190 | * @param string $theme_b Second theme name. |
||
191 | * |
||
192 | * @return int |
||
193 | */ |
||
194 | public static function sort_core_themes( $theme_a, $theme_b ) { |
||
222 | |||
223 | /** |
||
224 | * Saves selected theme in cookie if valid. |
||
225 | */ |
||
226 | public static function set_theme() { |
||
238 | |||
239 | // <editor-fold desc="Deprecated"> |
||
240 | /** |
||
241 | * If theme is in list of allowed to be switched to. |
||
242 | * |
||
243 | * @deprecated :2.0 |
||
244 | * |
||
245 | * @param WP_Theme $theme |
||
246 | * |
||
247 | * @return bool |
||
248 | */ |
||
249 | public static function is_allowed( $theme ) { |
||
253 | |||
254 | /** |
||
255 | * Template slug filter. |
||
256 | * |
||
257 | * @param string $template |
||
258 | * |
||
259 | * @deprecated :2.0 |
||
260 | * |
||
261 | * @return string |
||
262 | */ |
||
263 | public static function template( $template ) { |
||
267 | |||
268 | /** |
||
269 | * Stylesheet slug filter. |
||
270 | * |
||
271 | * @param string $stylesheet |
||
272 | * |
||
273 | * @deprecated :2.0 |
||
274 | * |
||
275 | * @return string |
||
276 | */ |
||
277 | public static function stylesheet( $stylesheet ) { |
||
281 | |||
282 | /** |
||
283 | * Returns field from theme data if cookie is set to valid theme. |
||
284 | * |
||
285 | * @param string $field_name |
||
286 | * @param mixed $default |
||
287 | * |
||
288 | * @deprecated :2.0 |
||
289 | * |
||
290 | * @return mixed |
||
291 | */ |
||
292 | public static function get_theme_field( $field_name, $default = false ) { |
||
300 | // </editor-fold> |
||
301 | } |
||
302 |
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.