1 | <?php |
||
5 | class HMBKP_Setup { |
||
|
|||
6 | |||
7 | /** |
||
8 | * Defines the minimum version of WordPress required by BWP. |
||
9 | */ |
||
10 | const MIN_WP_VERSION = '3.9'; |
||
11 | |||
12 | /** |
||
13 | * Defines the minimum version of PHP required by BWP. |
||
14 | */ |
||
15 | const MIN_PHP_VERSION = '5.3.2'; |
||
16 | |||
17 | /** |
||
18 | * Setup the plugin defaults on activation |
||
19 | */ |
||
20 | public static function activate() { |
||
39 | |||
40 | /** |
||
41 | * Cleanup on plugin deactivation |
||
42 | * |
||
43 | * Removes options and clears all cron schedules |
||
44 | */ |
||
45 | public static function deactivate() { |
||
56 | |||
57 | /** |
||
58 | * Deletes the backup schedule database entries and WP Cron entries. |
||
59 | */ |
||
60 | public static function delete_schedules() { |
||
61 | |||
62 | // Delete Cron schedules. |
||
63 | global $wpdb; |
||
64 | |||
65 | $schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) ); |
||
66 | |||
67 | foreach ( array_map( array( 'self', 'trim_prefix' ), $schedules ) as $item ) { |
||
68 | wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $item ) ); |
||
69 | } |
||
70 | } |
||
71 | |||
72 | public static function trim_prefix( $item ) { |
||
73 | return ltrim( $item, 'hmbkp_schedule_' ); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Deletes the plugin's transients from the database. |
||
78 | */ |
||
79 | public static function delete_transients() { |
||
92 | |||
93 | /** |
||
94 | * Deactivate BackUpWordPress. |
||
95 | */ |
||
96 | public static function self_deactivate() { |
||
113 | |||
114 | /** |
||
115 | * Determine if this WordPress install meets the minimum requirements for BWP to run. |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | public static function meets_requirements() { |
||
131 | |||
132 | /** |
||
133 | * Checks the current PHP version against the required version. |
||
134 | * |
||
135 | * @return bool 'Operator' parameter specified, returns a boolean. |
||
136 | */ |
||
137 | protected static function is_supported_php_version() { |
||
141 | |||
142 | /** |
||
143 | * Checks the current WordPress version against the required version. |
||
144 | * |
||
145 | * @return bool 'Operator' parameter specified, returns a boolean. |
||
146 | */ |
||
147 | protected static function is_supported_wp_version() { |
||
151 | |||
152 | /** |
||
153 | * Displays a user friendly message in the WordPress admin. |
||
154 | */ |
||
155 | public static function display_admin_notices() { |
||
160 | |||
161 | /** |
||
162 | * Returns a localized user friendly error message. |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public static function get_notice_message() { |
||
178 | } |
||
179 |
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.