@@ -38,7 +38,7 @@ |
||
38 | 38 | * @since 2.1.0 |
39 | 39 | */ |
40 | 40 | public function get_title() { |
41 | - return __( 'Author', 'wordpoints' ); |
|
41 | + return __('Author', 'wordpoints'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * |
61 | 61 | * @return bool Whether the value was set successfully. |
62 | 62 | */ |
63 | - public function set_the_value( $value ); |
|
63 | + public function set_the_value($value); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // EOF |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @since 2.1.0 |
30 | 30 | */ |
31 | - public function __construct( $slug ) { |
|
31 | + public function __construct($slug) { |
|
32 | 32 | |
33 | 33 | $this->registry = new WordPoints_Class_Registry(); |
34 | 34 | |
35 | - parent::__construct( $slug ); |
|
35 | + parent::__construct($slug); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @since 2.1.0 |
40 | 40 | */ |
41 | - public function get_all( array $args = array() ) { |
|
42 | - return $this->registry->get_all( $args ); |
|
41 | + public function get_all(array $args = array()) { |
|
42 | + return $this->registry->get_all($args); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -52,29 +52,29 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @since 2.1.0 |
54 | 54 | */ |
55 | - public function get( $slug, array $args = array() ) { |
|
56 | - return $this->registry->get( $slug, $args ); |
|
55 | + public function get($slug, array $args = array()) { |
|
56 | + return $this->registry->get($slug, $args); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @since 2.1.0 |
61 | 61 | */ |
62 | - public function register( $slug, $class, array $args = array() ) { |
|
63 | - return $this->registry->register( $slug, $class, $args ); |
|
62 | + public function register($slug, $class, array $args = array()) { |
|
63 | + return $this->registry->register($slug, $class, $args); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @since 2.1.0 |
68 | 68 | */ |
69 | - public function deregister( $slug ) { |
|
70 | - $this->registry->deregister( $slug ); |
|
69 | + public function deregister($slug) { |
|
70 | + $this->registry->deregister($slug); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @since 2.1.0 |
75 | 75 | */ |
76 | - public function is_registered( $slug ) { |
|
77 | - return $this->registry->is_registered( $slug ); |
|
76 | + public function is_registered($slug) { |
|
77 | + return $this->registry->is_registered($slug); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @since 1.2.0 |
52 | 52 | */ |
53 | -include_once dirname( __FILE__ ) . '/includes/constants.php'; |
|
53 | +include_once dirname(__FILE__) . '/includes/constants.php'; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Core functions. |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @since 2.1.0 |
108 | 108 | */ |
109 | -require_once( WORDPOINTS_DIR . 'classes/class/autoloader.php' ); |
|
109 | +require_once(WORDPOINTS_DIR . 'classes/class/autoloader.php'); |
|
110 | 110 | |
111 | 111 | // Register the classes to autoload. |
112 | -WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'includes' ); |
|
113 | -WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'classes' ); |
|
112 | +WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'includes'); |
|
113 | +WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'classes'); |
|
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Action and filter hooks. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | include_once WORDPOINTS_DIR . 'includes/deprecated.php'; |
128 | 128 | |
129 | -if ( is_admin() ) { |
|
129 | +if (is_admin()) { |
|
130 | 130 | |
131 | 131 | // We are on the administration side of the site. |
132 | 132 |
@@ -7,56 +7,56 @@ |
||
7 | 7 | * @since 2.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -register_activation_hook( WORDPOINTS_DIR . 'wordpoints.php', 'wordpoints_activate' ); |
|
10 | +register_activation_hook(WORDPOINTS_DIR . 'wordpoints.php', 'wordpoints_activate'); |
|
11 | 11 | |
12 | -add_action( 'plugins_loaded', 'wordpoints_register_installer' ); |
|
13 | -add_action( 'plugins_loaded', 'wordpoints_breaking_update' ); |
|
14 | -add_action( 'plugins_loaded', 'wordpoints_load_textdomain' ); |
|
15 | -add_action( 'plugins_loaded', 'wordpoints_load_modules', 15 ); |
|
12 | +add_action('plugins_loaded', 'wordpoints_register_installer'); |
|
13 | +add_action('plugins_loaded', 'wordpoints_breaking_update'); |
|
14 | +add_action('plugins_loaded', 'wordpoints_load_textdomain'); |
|
15 | +add_action('plugins_loaded', 'wordpoints_load_modules', 15); |
|
16 | 16 | |
17 | -add_filter( 'map_meta_cap', 'wordpoints_map_custom_meta_caps', 10, 3 ); |
|
17 | +add_filter('map_meta_cap', 'wordpoints_map_custom_meta_caps', 10, 3); |
|
18 | 18 | |
19 | -add_action( 'wordpoints_components_register', 'wordpoints_points_component_register' ); |
|
20 | -add_action( 'wordpoints_components_register', 'wordpoints_ranks_component_register' ); |
|
19 | +add_action('wordpoints_components_register', 'wordpoints_points_component_register'); |
|
20 | +add_action('wordpoints_components_register', 'wordpoints_ranks_component_register'); |
|
21 | 21 | |
22 | -add_action( 'init', 'wordpoints_init_cache_groups', 5 ); |
|
22 | +add_action('init', 'wordpoints_init_cache_groups', 5); |
|
23 | 23 | |
24 | -add_action( 'wp_enqueue_scripts', 'wordpoints_register_scripts', 5 ); |
|
25 | -add_action( 'admin_enqueue_scripts', 'wordpoints_register_scripts', 5 ); |
|
24 | +add_action('wp_enqueue_scripts', 'wordpoints_register_scripts', 5); |
|
25 | +add_action('admin_enqueue_scripts', 'wordpoints_register_scripts', 5); |
|
26 | 26 | |
27 | -add_action( 'wordpoints_modules_loaded', 'WordPoints_Installables::maybe_do_updates', 5 ); |
|
28 | -add_action( 'admin_notices', 'WordPoints_Installables::admin_notices' ); |
|
29 | -add_action( 'wpmu_new_blog', 'WordPoints_Installables::wpmu_new_blog' ); |
|
27 | +add_action('wordpoints_modules_loaded', 'WordPoints_Installables::maybe_do_updates', 5); |
|
28 | +add_action('admin_notices', 'WordPoints_Installables::admin_notices'); |
|
29 | +add_action('wpmu_new_blog', 'WordPoints_Installables::wpmu_new_blog'); |
|
30 | 30 | |
31 | -if ( isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { |
|
31 | +if (isset($_GET['wordpoints_module_check'], $_GET['check_module'])) { |
|
32 | 32 | |
33 | - add_action( 'shutdown', 'wordpoints_maintenance_shutdown_print_rand_str' ); |
|
33 | + add_action('shutdown', 'wordpoints_maintenance_shutdown_print_rand_str'); |
|
34 | 34 | |
35 | - if ( is_network_admin() ) { |
|
35 | + if (is_network_admin()) { |
|
36 | 36 | $filter = 'pre_site_option_wordpoints_sitewide_active_modules'; |
37 | 37 | } else { |
38 | 38 | $filter = 'pre_option_wordpoints_active_modules'; |
39 | 39 | } |
40 | 40 | |
41 | - add_filter( $filter, 'wordpoints_maintenance_filter_modules' ); |
|
41 | + add_filter($filter, 'wordpoints_maintenance_filter_modules'); |
|
42 | 42 | } |
43 | 43 | |
44 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_apps_init' ); |
|
45 | -add_action( 'wordpoints_init_app-entities', 'wordpoints_entities_app_init' ); |
|
46 | -add_action( 'wordpoints_init_app-entities-restrictions', 'wordpoints_entities_restrictions_app_init' ); |
|
44 | +add_action('wordpoints_init_app-apps', 'wordpoints_apps_init'); |
|
45 | +add_action('wordpoints_init_app-entities', 'wordpoints_entities_app_init'); |
|
46 | +add_action('wordpoints_init_app-entities-restrictions', 'wordpoints_entities_restrictions_app_init'); |
|
47 | 47 | |
48 | -add_action( 'wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init' ); |
|
49 | -add_action( 'wordpoints_init_app_registry-entities-contexts', 'wordpoints_entity_contexts_init' ); |
|
50 | -add_action( 'wordpoints_init_app_registry-entities-restrictions-know', 'wordpoints_entity_restrictions_know_init' ); |
|
51 | -add_action( 'wordpoints_init_app_registry-entities-restrictions-view', 'wordpoints_entity_restrictions_view_init' ); |
|
48 | +add_action('wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init'); |
|
49 | +add_action('wordpoints_init_app_registry-entities-contexts', 'wordpoints_entity_contexts_init'); |
|
50 | +add_action('wordpoints_init_app_registry-entities-restrictions-know', 'wordpoints_entity_restrictions_know_init'); |
|
51 | +add_action('wordpoints_init_app_registry-entities-restrictions-view', 'wordpoints_entity_restrictions_view_init'); |
|
52 | 52 | |
53 | -add_action( 'wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init' ); |
|
53 | +add_action('wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init'); |
|
54 | 54 | |
55 | -add_action( 'wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extensions_init' ); |
|
56 | -add_action( 'wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init' ); |
|
57 | -add_action( 'wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init' ); |
|
58 | -add_action( 'wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init' ); |
|
55 | +add_action('wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extensions_init'); |
|
56 | +add_action('wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init'); |
|
57 | +add_action('wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init'); |
|
58 | +add_action('wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init'); |
|
59 | 59 | |
60 | -add_action( 'wordpoints_modules_loaded', 'wordpoints_init_hooks' ); |
|
60 | +add_action('wordpoints_modules_loaded', 'wordpoints_init_hooks'); |
|
61 | 61 | |
62 | 62 | // EOF |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool Whether the table exists. |
24 | 24 | */ |
25 | -function wordpoints_db_table_exists( $table ) { |
|
25 | +function wordpoints_db_table_exists($table) { |
|
26 | 26 | |
27 | - _deprecated_function( __FUNCTION__, '1.7.0' ); |
|
27 | + _deprecated_function(__FUNCTION__, '1.7.0'); |
|
28 | 28 | |
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - $_table = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table ) ) ); // Cache pass, WPCS. |
|
31 | + $_table = $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($table))); // Cache pass, WPCS. |
|
32 | 32 | |
33 | - return ( $_table === $table ) ? true : false; |
|
33 | + return ($_table === $table) ? true : false; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | function wordpoints_update() { |
43 | 43 | |
44 | - _deprecated_function( __FUNCTION__, '2.0.0' ); |
|
44 | + _deprecated_function(__FUNCTION__, '2.0.0'); |
|
45 | 45 | |
46 | 46 | WordPoints_Installables::maybe_do_updates(); |
47 | 47 | } |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $blog_id The ID of the new site. |
55 | 55 | */ |
56 | -function wordpoints_add_custom_caps_to_new_sites( $blog_id ) { |
|
56 | +function wordpoints_add_custom_caps_to_new_sites($blog_id) { |
|
57 | 57 | |
58 | - _deprecated_function( __FUNCTION__, '2.0.0' ); |
|
58 | + _deprecated_function(__FUNCTION__, '2.0.0'); |
|
59 | 59 | |
60 | - if ( ! is_wordpoints_network_active() ) { |
|
60 | + if ( ! is_wordpoints_network_active()) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | - switch_to_blog( $blog_id ); |
|
65 | - wordpoints_add_custom_caps( wordpoints_get_custom_caps() ); |
|
64 | + switch_to_blog($blog_id); |
|
65 | + wordpoints_add_custom_caps(wordpoints_get_custom_caps()); |
|
66 | 66 | restore_current_blog(); |
67 | 67 | } |
68 | 68 |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return bool True, or false if the installable has already been registered. |
86 | 86 | */ |
87 | - public static function register( $type, $slug, $data ) { |
|
87 | + public static function register($type, $slug, $data) { |
|
88 | 88 | |
89 | - if ( isset( self::$registered[ $type ][ $slug ] ) ) { |
|
89 | + if (isset(self::$registered[$type][$slug])) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
93 | - self::$registered[ $type ][ $slug ] = $data; |
|
93 | + self::$registered[$type][$slug] = $data; |
|
94 | 94 | |
95 | 95 | return true; |
96 | 96 | } |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return WordPoints_Un_Installer_Base|false Whether the module was installed. |
108 | 108 | */ |
109 | - public static function install( $type, $slug, $network_wide = false ) { |
|
109 | + public static function install($type, $slug, $network_wide = false) { |
|
110 | 110 | |
111 | - if ( ! isset( self::$registered[ $type ][ $slug ] ) ) { |
|
111 | + if ( ! isset(self::$registered[$type][$slug])) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | |
115 | - $installer = self::get_installer( $type, $slug ); |
|
115 | + $installer = self::get_installer($type, $slug); |
|
116 | 116 | |
117 | - if ( ! $installer ) { |
|
117 | + if ( ! $installer) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | - $installer->install( $network_wide ); |
|
121 | + $installer->install($network_wide); |
|
122 | 122 | |
123 | 123 | return $installer; |
124 | 124 | } |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return WordPoints_Un_Installer_Base|false Whether the module was uninstalled. |
135 | 135 | */ |
136 | - public static function uninstall( $type, $slug ) { |
|
136 | + public static function uninstall($type, $slug) { |
|
137 | 137 | |
138 | - if ( ! isset( self::$registered[ $type ][ $slug ] ) ) { |
|
138 | + if ( ! isset(self::$registered[$type][$slug])) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | - $installer = self::get_installer( $type, $slug ); |
|
142 | + $installer = self::get_installer($type, $slug); |
|
143 | 143 | |
144 | - if ( ! $installer ) { |
|
144 | + if ( ! $installer) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
@@ -159,31 +159,31 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public static function maybe_do_updates() { |
161 | 161 | |
162 | - $wordpoints_data = get_option( 'wordpoints_data' ); |
|
162 | + $wordpoints_data = get_option('wordpoints_data'); |
|
163 | 163 | |
164 | - if ( is_wordpoints_network_active() ) { |
|
165 | - $network_wide_data = get_site_option( 'wordpoints_data' ); |
|
164 | + if (is_wordpoints_network_active()) { |
|
165 | + $network_wide_data = get_site_option('wordpoints_data'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $updated = false; |
169 | 169 | |
170 | - foreach ( self::$registered as $type => $installables ) { |
|
170 | + foreach (self::$registered as $type => $installables) { |
|
171 | 171 | |
172 | - foreach ( $installables as $slug => $installable ) { |
|
172 | + foreach ($installables as $slug => $installable) { |
|
173 | 173 | |
174 | - if ( isset( $network_wide_data ) && $installable['network_wide'] ) { |
|
175 | - $data =& $network_wide_data; |
|
174 | + if (isset($network_wide_data) && $installable['network_wide']) { |
|
175 | + $data = & $network_wide_data; |
|
176 | 176 | } else { |
177 | - $data =& $wordpoints_data; |
|
177 | + $data = & $wordpoints_data; |
|
178 | 178 | } |
179 | 179 | |
180 | - if ( 'wordpoints' === $slug ) { |
|
180 | + if ('wordpoints' === $slug) { |
|
181 | 181 | |
182 | - if ( ! isset( $data['version'] ) ) { |
|
182 | + if ( ! isset($data['version'])) { |
|
183 | 183 | // WordPoints should always be installed at this point. If it |
184 | 184 | // isn't, the install script didn't run for some reason. See |
185 | 185 | // https://github.com/WordPoints/wordpoints/issues/349 |
186 | - self::install( $type, $slug, is_wordpoints_network_active() ); |
|
186 | + self::install($type, $slug, is_wordpoints_network_active()); |
|
187 | 187 | continue; |
188 | 188 | } |
189 | 189 | |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | } else { |
193 | 193 | |
194 | 194 | // This installable hasn't been installed yet, so we don't update. |
195 | - if ( ! isset( $data[ "{$type}s" ][ $slug ]['version'] ) ) { |
|
195 | + if ( ! isset($data["{$type}s"][$slug]['version'])) { |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - $db_version = $data[ "{$type}s" ][ $slug ]['version']; |
|
199 | + $db_version = $data["{$type}s"][$slug]['version']; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | $code_version = $installable['version']; |
203 | 203 | |
204 | 204 | // If the DB version isn't less than the code version, we don't need to upgrade. |
205 | - if ( version_compare( $db_version, $code_version ) !== -1 ) { |
|
205 | + if (version_compare($db_version, $code_version) !== -1) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | - $installer = self::get_installer( $type, $slug ); |
|
209 | + $installer = self::get_installer($type, $slug); |
|
210 | 210 | |
211 | - if ( ! $installer ) { |
|
211 | + if ( ! $installer) { |
|
212 | 212 | continue; |
213 | 213 | } |
214 | 214 | |
215 | - $installer->update( $db_version, $code_version ); |
|
215 | + $installer->update($db_version, $code_version); |
|
216 | 216 | |
217 | - if ( 'wordpoints' === $slug ) { |
|
217 | + if ('wordpoints' === $slug) { |
|
218 | 218 | $data['version'] = $code_version; |
219 | 219 | } else { |
220 | - $data[ "{$type}s" ][ $slug ]['version'] = $code_version; |
|
220 | + $data["{$type}s"][$slug]['version'] = $code_version; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | $updated = true; |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | |
227 | 227 | } // End foreach ( installable types ). |
228 | 228 | |
229 | - if ( $updated ) { |
|
230 | - update_option( 'wordpoints_data', $wordpoints_data ); |
|
229 | + if ($updated) { |
|
230 | + update_option('wordpoints_data', $wordpoints_data); |
|
231 | 231 | |
232 | - if ( isset( $network_wide_data ) ) { |
|
233 | - update_site_option( 'wordpoints_data', $network_wide_data ); |
|
232 | + if (isset($network_wide_data)) { |
|
233 | + update_site_option('wordpoints_data', $network_wide_data); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | } |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public static function admin_notices() { |
246 | 246 | |
247 | - if ( ! is_wordpoints_network_active() ) { |
|
247 | + if ( ! is_wordpoints_network_active()) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | - self::show_admin_notices( 'install' ); |
|
252 | - self::show_admin_notices( 'update' ); |
|
251 | + self::show_admin_notices('install'); |
|
252 | + self::show_admin_notices('update'); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -259,49 +259,49 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param string $notice_type The type of notices to display, 'update', or 'install'. |
261 | 261 | */ |
262 | - protected static function show_admin_notices( $notice_type ) { |
|
262 | + protected static function show_admin_notices($notice_type) { |
|
263 | 263 | |
264 | 264 | $all_skipped = array_filter( |
265 | - wordpoints_get_array_option( "wordpoints_network_{$notice_type}_skipped", 'site' ) |
|
265 | + wordpoints_get_array_option("wordpoints_network_{$notice_type}_skipped", 'site') |
|
266 | 266 | ); |
267 | 267 | |
268 | - if ( empty( $all_skipped ) ) { |
|
268 | + if (empty($all_skipped)) { |
|
269 | 269 | return; |
270 | 270 | } |
271 | 271 | |
272 | 272 | $messages = array(); |
273 | 273 | |
274 | - if ( 'install' === $notice_type ) { |
|
274 | + if ('install' === $notice_type) { |
|
275 | 275 | /* translators: 1 module/plugin name, 2 "module", "plugin", or "component". */ |
276 | - $message_template = __( 'WordPoints detected a large network and has skipped part of the installation process for the “%1$s” %2$s.', 'wordpoints' ); |
|
276 | + $message_template = __('WordPoints detected a large network and has skipped part of the installation process for the “%1$s” %2$s.', 'wordpoints'); |
|
277 | 277 | } else { |
278 | 278 | /* translators: 1 module/plugin name, 2 "module", "plugin", or "component", 3 version number. */ |
279 | - $message_template = __( 'WordPoints detected a large network and has skipped part of the update process for the “%1$s” %2$s for version %3$s (and possibly later versions).', 'wordpoints' ); |
|
279 | + $message_template = __('WordPoints detected a large network and has skipped part of the update process for the “%1$s” %2$s for version %3$s (and possibly later versions).', 'wordpoints'); |
|
280 | 280 | } |
281 | 281 | |
282 | - foreach ( $all_skipped as $type => $skipped ) { |
|
282 | + foreach ($all_skipped as $type => $skipped) { |
|
283 | 283 | |
284 | - if ( ! self::can_show_admin_notices( $type ) ) { |
|
284 | + if ( ! self::can_show_admin_notices($type)) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | - switch ( $type ) { |
|
288 | + switch ($type) { |
|
289 | 289 | |
290 | 290 | case 'module': |
291 | - $type_name = __( 'module', 'wordpoints' ); |
|
291 | + $type_name = __('module', 'wordpoints'); |
|
292 | 292 | break; |
293 | 293 | |
294 | 294 | case 'component': |
295 | - $type_name = __( 'component', 'wordpoints' ); |
|
295 | + $type_name = __('component', 'wordpoints'); |
|
296 | 296 | break; |
297 | 297 | |
298 | 298 | default: |
299 | - $type_name = __( 'plugin', 'wordpoints' ); |
|
299 | + $type_name = __('plugin', 'wordpoints'); |
|
300 | 300 | } |
301 | 301 | |
302 | - foreach ( $skipped as $slug => $version ) { |
|
302 | + foreach ($skipped as $slug => $version) { |
|
303 | 303 | |
304 | - if ( empty( self::$registered[ $type ][ $slug ]['network_wide'] ) ) { |
|
304 | + if (empty(self::$registered[$type][$slug]['network_wide'])) { |
|
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | |
@@ -321,18 +321,18 @@ discard block |
||
321 | 321 | |
322 | 322 | } // End foreach ( $all_skipped ). |
323 | 323 | |
324 | - if ( ! empty( $messages ) ) { |
|
324 | + if ( ! empty($messages)) { |
|
325 | 325 | |
326 | - $message = '<p>' . implode( '</p><p>', $messages ) . '</p>'; |
|
327 | - $message .= '<p>' . esc_html__( 'The rest of the process needs to be completed manually. If this has not been done already, some parts of the component may not function properly.', 'wordpoints' ); |
|
328 | - $message .= ' <a href="https://wordpoints.org/user-guide/multisite/">' . esc_html__( 'Learn more.', 'wordpoints' ) . '</a></p>'; |
|
326 | + $message = '<p>' . implode('</p><p>', $messages) . '</p>'; |
|
327 | + $message .= '<p>' . esc_html__('The rest of the process needs to be completed manually. If this has not been done already, some parts of the component may not function properly.', 'wordpoints'); |
|
328 | + $message .= ' <a href="https://wordpoints.org/user-guide/multisite/">' . esc_html__('Learn more.', 'wordpoints') . '</a></p>'; |
|
329 | 329 | |
330 | 330 | $args = array( |
331 | 331 | 'dismissible' => true, |
332 | 332 | 'option' => "wordpoints_network_{$notice_type}_skipped", |
333 | 333 | ); |
334 | 334 | |
335 | - wordpoints_show_admin_error( $message, $args ); |
|
335 | + wordpoints_show_admin_error($message, $args); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -345,15 +345,15 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @return bool Whether to display the admin notices. |
347 | 347 | */ |
348 | - protected static function can_show_admin_notices( $type ) { |
|
348 | + protected static function can_show_admin_notices($type) { |
|
349 | 349 | |
350 | - switch ( $type ) { |
|
350 | + switch ($type) { |
|
351 | 351 | |
352 | 352 | case 'module': |
353 | - return current_user_can( 'wordpoints_manage_network_modules' ); |
|
353 | + return current_user_can('wordpoints_manage_network_modules'); |
|
354 | 354 | |
355 | 355 | default: |
356 | - return current_user_can( 'manage_network_plugins' ); |
|
356 | + return current_user_can('manage_network_plugins'); |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
@@ -367,26 +367,26 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return WordPoints_Un_Installer_Base|false The installer. |
369 | 369 | */ |
370 | - public static function get_installer( $type, $slug ) { |
|
370 | + public static function get_installer($type, $slug) { |
|
371 | 371 | |
372 | - if ( ! isset( self::$registered[ $type ][ $slug ] ) ) { |
|
372 | + if ( ! isset(self::$registered[$type][$slug])) { |
|
373 | 373 | return false; |
374 | 374 | } |
375 | 375 | |
376 | - if ( ! isset( self::$installers[ $type ][ $slug ] ) ) { |
|
376 | + if ( ! isset(self::$installers[$type][$slug])) { |
|
377 | 377 | |
378 | - if ( ! file_exists( self::$registered[ $type ][ $slug ]['un_installer'] ) ) { |
|
378 | + if ( ! file_exists(self::$registered[$type][$slug]['un_installer'])) { |
|
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | |
382 | - self::$installers[ $type ][ $slug ] = require( |
|
383 | - self::$registered[ $type ][ $slug ]['un_installer'] |
|
382 | + self::$installers[$type][$slug] = require( |
|
383 | + self::$registered[$type][$slug]['un_installer'] |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | |
387 | - return new self::$installers[ $type ][ $slug ]( |
|
387 | + return new self::$installers[$type][$slug]( |
|
388 | 388 | $slug |
389 | - , self::$registered[ $type ][ $slug ]['version'] |
|
389 | + , self::$registered[$type][$slug]['version'] |
|
390 | 390 | ); |
391 | 391 | } |
392 | 392 | |
@@ -399,28 +399,28 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @param int $blog_id The ID of the new blog. |
401 | 401 | */ |
402 | - public static function wpmu_new_blog( $blog_id ) { |
|
402 | + public static function wpmu_new_blog($blog_id) { |
|
403 | 403 | |
404 | - foreach ( self::$registered as $type => $installables ) { |
|
404 | + foreach (self::$registered as $type => $installables) { |
|
405 | 405 | |
406 | 406 | $network_installables = wp_list_filter( |
407 | 407 | $installables |
408 | - , array( 'network_wide' => true ) |
|
408 | + , array('network_wide' => true) |
|
409 | 409 | ); |
410 | 410 | |
411 | - if ( empty( $network_installables ) ) { |
|
411 | + if (empty($network_installables)) { |
|
412 | 412 | continue; |
413 | 413 | } |
414 | 414 | |
415 | - foreach ( $network_installables as $slug => $installable ) { |
|
415 | + foreach ($network_installables as $slug => $installable) { |
|
416 | 416 | |
417 | - $installer = self::get_installer( $type, $slug ); |
|
417 | + $installer = self::get_installer($type, $slug); |
|
418 | 418 | |
419 | - if ( ! $installer ) { |
|
419 | + if ( ! $installer) { |
|
420 | 420 | continue; |
421 | 421 | } |
422 | 422 | |
423 | - $installer->install_on_site( $blog_id ); |
|
423 | + $installer->install_on_site($blog_id); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | } |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function wordpoints_hooks() { |
18 | 18 | |
19 | - if ( ! isset( WordPoints_App::$main ) ) { |
|
19 | + if ( ! isset(WordPoints_App::$main)) { |
|
20 | 20 | wordpoints_apps(); |
21 | 21 | } |
22 | 22 | |
23 | - return WordPoints_App::$main->get_sub_app( 'hooks' ); |
|
23 | + return WordPoints_App::$main->get_sub_app('hooks'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // Just accessing this causes it to be initialized. We need to do that so |
38 | 38 | // the actions will be registered and hooked up. The rest of the API can be |
39 | 39 | // lazy-loaded as it is needed. |
40 | - $hooks->get_sub_app( 'actions' ); |
|
40 | + $hooks->get_sub_app('actions'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @param WordPoints_Class_Registry_Persistent $extensions The extension registry. |
51 | 51 | */ |
52 | -function wordpoints_hook_extensions_init( $extensions ) { |
|
52 | +function wordpoints_hook_extensions_init($extensions) { |
|
53 | 53 | |
54 | - $extensions->register( 'blocker', 'WordPoints_Hook_Extension_Blocker' ); |
|
55 | - $extensions->register( 'repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker' ); |
|
56 | - $extensions->register( 'reversals', 'WordPoints_Hook_Extension_Reversals' ); |
|
57 | - $extensions->register( 'conditions', 'WordPoints_Hook_Extension_Conditions' ); |
|
58 | - $extensions->register( 'periods', 'WordPoints_Hook_Extension_Periods' ); |
|
54 | + $extensions->register('blocker', 'WordPoints_Hook_Extension_Blocker'); |
|
55 | + $extensions->register('repeat_blocker', 'WordPoints_Hook_Extension_Repeat_Blocker'); |
|
56 | + $extensions->register('reversals', 'WordPoints_Hook_Extension_Reversals'); |
|
57 | + $extensions->register('conditions', 'WordPoints_Hook_Extension_Conditions'); |
|
58 | + $extensions->register('periods', 'WordPoints_Hook_Extension_Periods'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @param WordPoints_Class_Registry_Children $conditions The conditions registry. |
69 | 69 | */ |
70 | -function wordpoints_hook_conditions_init( $conditions ) { |
|
70 | +function wordpoints_hook_conditions_init($conditions) { |
|
71 | 71 | |
72 | 72 | $conditions->register( |
73 | 73 | 'text' |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param WordPoints_Hook_Actions $actions The action registry. |
105 | 105 | */ |
106 | -function wordpoints_hook_actions_init( $actions ) { |
|
106 | +function wordpoints_hook_actions_init($actions) { |
|
107 | 107 | |
108 | 108 | $actions->register( |
109 | 109 | 'user_register' |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | , array( |
112 | 112 | 'action' => 'user_register', |
113 | 113 | 'data' => array( |
114 | - 'arg_index' => array( 'user' => 0 ), |
|
114 | + 'arg_index' => array('user' => 0), |
|
115 | 115 | ), |
116 | 116 | ) |
117 | 117 | ); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | , array( |
123 | 123 | 'action' => is_multisite() ? 'wpmu_delete_user' : 'delete_user', |
124 | 124 | 'data' => array( |
125 | - 'arg_index' => array( 'user' => 0 ), |
|
125 | + 'arg_index' => array('user' => 0), |
|
126 | 126 | ), |
127 | 127 | ) |
128 | 128 | ); |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | */ |
149 | 149 | $post_types = apply_filters_deprecated( |
150 | 150 | 'wordpoints_register_hook_actions_for_post_types' |
151 | - , array( $post_types ) |
|
151 | + , array($post_types) |
|
152 | 152 | , '2.2.0' |
153 | 153 | , 'wordpoints_register_hook_events_for_post_types' |
154 | 154 | ); |
155 | 155 | |
156 | - foreach ( $post_types as $slug ) { |
|
157 | - wordpoints_register_post_type_hook_actions( $slug ); |
|
156 | + foreach ($post_types as $slug) { |
|
157 | + wordpoints_register_post_type_hook_actions($slug); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @param string $slug The slug of the post type. |
167 | 167 | */ |
168 | -function wordpoints_register_post_type_hook_actions( $slug ) { |
|
168 | +function wordpoints_register_post_type_hook_actions($slug) { |
|
169 | 169 | |
170 | - $actions = wordpoints_hooks()->get_sub_app( 'actions' ); |
|
170 | + $actions = wordpoints_hooks()->get_sub_app('actions'); |
|
171 | 171 | |
172 | - if ( post_type_supports( $slug, 'comments' ) ) { |
|
172 | + if (post_type_supports($slug, 'comments')) { |
|
173 | 173 | |
174 | 174 | $actions->register( |
175 | 175 | "comment_approve\\{$slug}" |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | , array( |
178 | 178 | 'action' => 'transition_comment_status', |
179 | 179 | 'data' => array( |
180 | - 'arg_index' => array( "comment\\{$slug}" => 2 ), |
|
181 | - 'requirements' => array( 0 => 'approved' ), |
|
180 | + 'arg_index' => array("comment\\{$slug}" => 2), |
|
181 | + 'requirements' => array(0 => 'approved'), |
|
182 | 182 | ), |
183 | 183 | ) |
184 | 184 | ); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | , array( |
190 | 190 | 'action' => 'wp_insert_comment', |
191 | 191 | 'data' => array( |
192 | - 'arg_index' => array( "comment\\{$slug}" => 1 ), |
|
192 | + 'arg_index' => array("comment\\{$slug}" => 1), |
|
193 | 193 | ), |
194 | 194 | ) |
195 | 195 | ); |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | , array( |
201 | 201 | 'action' => 'transition_comment_status', |
202 | 202 | 'data' => array( |
203 | - 'arg_index' => array( "comment\\{$slug}" => 2 ), |
|
204 | - 'requirements' => array( 1 => 'approved' ), |
|
203 | + 'arg_index' => array("comment\\{$slug}" => 2), |
|
204 | + 'requirements' => array(1 => 'approved'), |
|
205 | 205 | ), |
206 | 206 | ) |
207 | 207 | ); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } // End if ( post type supports comments ). |
210 | 210 | |
211 | 211 | // This works for all post types except attachments. |
212 | - if ( 'attachment' !== $slug ) { |
|
212 | + if ('attachment' !== $slug) { |
|
213 | 213 | |
214 | 214 | $actions->register( |
215 | 215 | "post_publish\\{$slug}" |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | , array( |
218 | 218 | 'action' => 'transition_post_status', |
219 | 219 | 'data' => array( |
220 | - 'arg_index' => array( "post\\{$slug}" => 2 ), |
|
220 | + 'arg_index' => array("post\\{$slug}" => 2), |
|
221 | 221 | 'requirements' => array( |
222 | 222 | 0 => 'publish', |
223 | - 1 => array( 'comparator' => '!=', 'value' => 'publish' ), |
|
223 | + 1 => array('comparator' => '!=', 'value' => 'publish'), |
|
224 | 224 | ), |
225 | 225 | ), |
226 | 226 | ) |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | , array( |
233 | 233 | 'action' => 'transition_post_status', |
234 | 234 | 'data' => array( |
235 | - 'arg_index' => array( "post\\{$slug}" => 2 ), |
|
235 | + 'arg_index' => array("post\\{$slug}" => 2), |
|
236 | 236 | 'requirements' => array( |
237 | - 0 => array( 'comparator' => '!=', 'value' => 'publish' ), |
|
237 | + 0 => array('comparator' => '!=', 'value' => 'publish'), |
|
238 | 238 | 1 => 'publish', |
239 | 239 | ), |
240 | 240 | ), |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | , array( |
248 | 248 | 'action' => 'delete_post', |
249 | 249 | 'data' => array( |
250 | - 'arg_index' => array( "post\\{$slug}" => 0 ), |
|
250 | + 'arg_index' => array("post\\{$slug}" => 0), |
|
251 | 251 | ), |
252 | 252 | ) |
253 | 253 | ); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | , array( |
261 | 261 | 'action' => 'add_attachment', |
262 | 262 | 'data' => array( |
263 | - 'arg_index' => array( 'post\attachment' => 0 ), |
|
263 | + 'arg_index' => array('post\attachment' => 0), |
|
264 | 264 | ), |
265 | 265 | ) |
266 | 266 | ); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | , array( |
274 | 274 | 'action' => 'delete_post', |
275 | 275 | 'data' => array( |
276 | - 'arg_index' => array( "post\\{$slug}" => 0 ), |
|
276 | + 'arg_index' => array("post\\{$slug}" => 0), |
|
277 | 277 | ), |
278 | 278 | ) |
279 | 279 | ); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @param string $slug The slug ("name") of the post type. |
287 | 287 | */ |
288 | - do_action( 'wordpoints_register_post_type_hook_actions', $slug ); |
|
288 | + do_action('wordpoints_register_post_type_hook_actions', $slug); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @param WordPoints_Hook_Events $events The event registry. |
299 | 299 | */ |
300 | -function wordpoints_hook_events_init( $events ) { |
|
300 | +function wordpoints_hook_events_init($events) { |
|
301 | 301 | |
302 | 302 | $events->register( |
303 | 303 | 'user_register' |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | ) |
327 | 327 | ); |
328 | 328 | |
329 | - foreach ( wordpoints_get_post_types_for_hook_events() as $slug ) { |
|
330 | - wordpoints_register_post_type_hook_events( $slug ); |
|
329 | + foreach (wordpoints_get_post_types_for_hook_events() as $slug) { |
|
330 | + wordpoints_register_post_type_hook_events($slug); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @param string $slug The slug of the post type. |
362 | 362 | */ |
363 | -function wordpoints_register_post_type_hook_events( $slug ) { |
|
363 | +function wordpoints_register_post_type_hook_events($slug) { |
|
364 | 364 | |
365 | - $events = wordpoints_hooks()->get_sub_app( 'events' ); |
|
365 | + $events = wordpoints_hooks()->get_sub_app('events'); |
|
366 | 366 | |
367 | - if ( 'attachment' === $slug ) { |
|
367 | + if ('attachment' === $slug) { |
|
368 | 368 | |
369 | 369 | $events->register( |
370 | 370 | 'media_upload' |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | ); |
401 | 401 | } |
402 | 402 | |
403 | - if ( post_type_supports( $slug, 'comments' ) ) { |
|
403 | + if (post_type_supports($slug, 'comments')) { |
|
404 | 404 | |
405 | 405 | $events->register( |
406 | 406 | "comment_leave\\{$slug}" |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @param string $slug The slug ("name") of the post type. |
429 | 429 | */ |
430 | - do_action( 'wordpoints_register_post_type_hook_events', $slug ); |
|
430 | + do_action('wordpoints_register_post_type_hook_events', $slug); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -441,36 +441,36 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @return string The signature arg(s)'s GUID(s), JSON encoded. |
443 | 443 | */ |
444 | -function wordpoints_hooks_get_event_signature_arg_guids_json( WordPoints_Hook_Event_Args $event_args ) { |
|
444 | +function wordpoints_hooks_get_event_signature_arg_guids_json(WordPoints_Hook_Event_Args $event_args) { |
|
445 | 445 | |
446 | 446 | $entities = $event_args->get_signature_args(); |
447 | 447 | |
448 | - if ( ! $entities ) { |
|
448 | + if ( ! $entities) { |
|
449 | 449 | return ''; |
450 | 450 | } |
451 | 451 | |
452 | 452 | $the_guids = array(); |
453 | 453 | |
454 | - foreach ( $entities as $arg_slug => $entity ) { |
|
454 | + foreach ($entities as $arg_slug => $entity) { |
|
455 | 455 | |
456 | 456 | $the_guid = $entity->get_the_guid(); |
457 | 457 | |
458 | - if ( $the_guid ) { |
|
459 | - $the_guids[ $arg_slug ] = $the_guid; |
|
458 | + if ($the_guid) { |
|
459 | + $the_guids[$arg_slug] = $the_guid; |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
463 | - if ( ! $the_guids ) { |
|
463 | + if ( ! $the_guids) { |
|
464 | 464 | return ''; |
465 | 465 | } |
466 | 466 | |
467 | - if ( 1 === count( $the_guids ) ) { |
|
468 | - $the_guids = reset( $the_guids ); |
|
467 | + if (1 === count($the_guids)) { |
|
468 | + $the_guids = reset($the_guids); |
|
469 | 469 | } else { |
470 | - ksort( $the_guids ); |
|
470 | + ksort($the_guids); |
|
471 | 471 | } |
472 | 472 | |
473 | - return wp_json_encode( $the_guids ); |
|
473 | + return wp_json_encode($the_guids); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * |
486 | 486 | * @return string The primary arg's GUID, JSON encoded. |
487 | 487 | */ |
488 | -function wordpoints_hooks_get_event_primary_arg_guid_json( WordPoints_Hook_Event_Args $event_args ) { |
|
488 | +function wordpoints_hooks_get_event_primary_arg_guid_json(WordPoints_Hook_Event_Args $event_args) { |
|
489 | 489 | |
490 | 490 | _deprecated_function( |
491 | 491 | __FUNCTION__ |
@@ -495,17 +495,17 @@ discard block |
||
495 | 495 | |
496 | 496 | $entity = $event_args->get_primary_arg(); |
497 | 497 | |
498 | - if ( ! $entity ) { |
|
498 | + if ( ! $entity) { |
|
499 | 499 | return ''; |
500 | 500 | } |
501 | 501 | |
502 | 502 | $the_guid = $entity->get_the_guid(); |
503 | 503 | |
504 | - if ( ! $the_guid ) { |
|
504 | + if ( ! $the_guid) { |
|
505 | 505 | return ''; |
506 | 506 | } |
507 | 507 | |
508 | - return wp_json_encode( $the_guid ); |
|
508 | + return wp_json_encode($the_guid); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | // EOF |
@@ -75,8 +75,8 @@ |
||
75 | 75 | 'options' => array( |
76 | 76 | 'wordpoints_sitewide_active_modules', |
77 | 77 | 'wordpoints_network_install_skipped', |
78 | - 'wordpoints_network_installed', |
|
79 | - 'wordpoints_network_update_skipped', |
|
78 | + 'wordpoints_network_installed', |
|
79 | + 'wordpoints_network_update_skipped', |
|
80 | 80 | 'wordpoints_breaking_deactivated_modules', |
81 | 81 | ), |
82 | 82 | ), |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | * @since 1.8.0 |
24 | 24 | */ |
25 | 25 | protected $updates = array( |
26 | - '1.3.0' => array( 'single' => true, /* - */ /* - */ ), |
|
26 | + '1.3.0' => array('single' => true, /* - */ /* - */), |
|
27 | 27 | '1.5.0' => array( /* - */ 'site' => true, /* - */ ), |
28 | 28 | '1.8.0' => array( /* - */ 'site' => true, /* - */ ), |
29 | - '1.10.3' => array( 'single' => true, /* - */ 'network' => true ), |
|
30 | - '2.1.0-alpha-3' => array( 'single' => true, /* - */ 'network' => true ), |
|
31 | - '2.3.0-alpha-2' => array( 'single' => true, /* - */ 'network' => true ), |
|
29 | + '1.10.3' => array('single' => true, /* - */ 'network' => true), |
|
30 | + '2.1.0-alpha-3' => array('single' => true, /* - */ 'network' => true), |
|
31 | + '2.3.0-alpha-2' => array('single' => true, /* - */ 'network' => true), |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | /** |
@@ -112,24 +112,24 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * @since 1.8.0 |
114 | 114 | */ |
115 | - public function install( $network ) { |
|
115 | + public function install($network) { |
|
116 | 116 | |
117 | - $filter_func = ( $network ) ? '__return_true' : '__return_false'; |
|
118 | - add_filter( 'is_wordpoints_network_active', $filter_func ); |
|
117 | + $filter_func = ($network) ? '__return_true' : '__return_false'; |
|
118 | + add_filter('is_wordpoints_network_active', $filter_func); |
|
119 | 119 | |
120 | 120 | // Check if the plugin has been activated/installed before. |
121 | - $installed = (bool) wordpoints_get_maybe_network_option( 'wordpoints_data' ); |
|
121 | + $installed = (bool) wordpoints_get_maybe_network_option('wordpoints_data'); |
|
122 | 122 | |
123 | - parent::install( $network ); |
|
123 | + parent::install($network); |
|
124 | 124 | |
125 | 125 | // Activate the Points component, if this is the first activation. |
126 | - if ( false === $installed ) { |
|
126 | + if (false === $installed) { |
|
127 | 127 | $wordpoints_components = WordPoints_Components::instance(); |
128 | 128 | $wordpoints_components->load(); |
129 | - $wordpoints_components->activate( 'points' ); |
|
129 | + $wordpoints_components->activate('points'); |
|
130 | 130 | } |
131 | 131 | |
132 | - remove_filter( 'is_wordpoints_network_active', $filter_func ); |
|
132 | + remove_filter('is_wordpoints_network_active', $filter_func); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | parent::before_update(); |
141 | 141 | |
142 | - if ( $this->network_wide ) { |
|
143 | - unset( $this->updates['1_8_0'] ); |
|
142 | + if ($this->network_wide) { |
|
143 | + unset($this->updates['1_8_0']); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function install_network() { |
151 | 151 | |
152 | - $data = wordpoints_get_maybe_network_option( 'wordpoints_data' ); |
|
152 | + $data = wordpoints_get_maybe_network_option('wordpoints_data'); |
|
153 | 153 | |
154 | 154 | // Add plugin data. |
155 | - if ( ! is_array( $data ) ) { |
|
155 | + if ( ! is_array($data)) { |
|
156 | 156 | |
157 | 157 | wordpoints_update_maybe_network_option( |
158 | 158 | 'wordpoints_data', |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // corrupted somehow. |
171 | 171 | $data['version'] = WORDPOINTS_VERSION; |
172 | 172 | |
173 | - wordpoints_update_maybe_network_option( 'wordpoints_data', $data ); |
|
173 | + wordpoints_update_maybe_network_option('wordpoints_data', $data); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $this->install_db_schema(); |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | protected function uninstall_modules() { |
221 | 221 | |
222 | 222 | wordpoints_deactivate_modules( |
223 | - wordpoints_get_array_option( 'wordpoints_active_modules', 'site' ) |
|
223 | + wordpoints_get_array_option('wordpoints_active_modules', 'site') |
|
224 | 224 | ); |
225 | 225 | |
226 | - foreach ( array_keys( wordpoints_get_modules() ) as $module ) { |
|
227 | - wordpoints_uninstall_module( $module ); |
|
226 | + foreach (array_keys(wordpoints_get_modules()) as $module) { |
|
227 | + wordpoints_uninstall_module($module); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | $this->delete_modules_dir(); |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | |
240 | 240 | global $wp_filesystem; |
241 | 241 | |
242 | - if ( $wp_filesystem instanceof WP_Filesystem_Base ) { |
|
243 | - $wp_filesystem->delete( wordpoints_modules_dir(), true ); |
|
242 | + if ($wp_filesystem instanceof WP_Filesystem_Base) { |
|
243 | + $wp_filesystem->delete(wordpoints_modules_dir(), true); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | protected function uninstall_components() { |
253 | 253 | |
254 | 254 | /** This filter is documented in includes/class-wordpoints-components.php */ |
255 | - do_action( 'wordpoints_components_register' ); |
|
255 | + do_action('wordpoints_components_register'); |
|
256 | 256 | |
257 | 257 | $components = WordPoints_Components::instance(); |
258 | 258 | |
259 | 259 | // Uninstall the components. |
260 | - foreach ( $components->get() as $component => $data ) { |
|
261 | - WordPoints_Installables::uninstall( 'component', $component ); |
|
260 | + foreach ($components->get() as $component => $data) { |
|
261 | + WordPoints_Installables::uninstall('component', $component); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @since 1.8.0 |
269 | 269 | */ |
270 | 270 | protected function update_single_to_1_3_0() { |
271 | - wordpoints_add_custom_caps( $this->custom_caps ); |
|
271 | + wordpoints_add_custom_caps($this->custom_caps); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @since 1.8.0 |
278 | 278 | */ |
279 | 279 | protected function update_site_to_1_5_0() { |
280 | - wordpoints_add_custom_caps( $this->custom_caps ); |
|
280 | + wordpoints_add_custom_caps($this->custom_caps); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -309,14 +309,14 @@ discard block |
||
309 | 309 | |
310 | 310 | $modules_dir = wordpoints_modules_dir(); |
311 | 311 | |
312 | - if ( ! WP_Filesystem( false, $modules_dir ) ) { |
|
312 | + if ( ! WP_Filesystem(false, $modules_dir)) { |
|
313 | 313 | return; |
314 | 314 | } |
315 | 315 | |
316 | 316 | $index_file = $modules_dir . '/index.php'; |
317 | 317 | |
318 | - if ( ! $wp_filesystem->exists( $index_file ) ) { |
|
319 | - $wp_filesystem->put_contents( $index_file, '<?php // Gold is silent.' ); |
|
318 | + if ( ! $wp_filesystem->exists($index_file)) { |
|
319 | + $wp_filesystem->put_contents($index_file, '<?php // Gold is silent.'); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @since 2.1.0 |
327 | 327 | */ |
328 | 328 | protected function update_network_to_2_1_0_alpha_3() { |
329 | - $this->map_shortcuts( 'schema' ); |
|
329 | + $this->map_shortcuts('schema'); |
|
330 | 330 | $this->install_db_schema(); |
331 | 331 | } |
332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * @since 2.1.0 |
337 | 337 | */ |
338 | 338 | protected function update_single_to_2_1_0_alpha_3() { |
339 | - $this->map_shortcuts( 'schema' ); |
|
339 | + $this->map_shortcuts('schema'); |
|
340 | 340 | $this->install_db_schema(); |
341 | 341 | } |
342 | 342 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | |
350 | 350 | // We don't need to update the table if the new schema has just been used to |
351 | 351 | // install it. |
352 | - if ( version_compare( $this->get_db_version(), '2.1.0-alpha-3', '<' ) ) { |
|
352 | + if (version_compare($this->get_db_version(), '2.1.0-alpha-3', '<')) { |
|
353 | 353 | return; |
354 | 354 | } |
355 | 355 |