Completed
Push — master ( e9e0b4...cbda97 )
by J.D.
03:49
created
src/classes/entity.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -430,7 +430,7 @@
 block discarded – undo
430 430
 	 *
431 431
 	 * @since 2.1.0
432 432
 	 *
433
-	 * @return mixed The ID of the entity.
433
+	 * @return integer The ID of the entity.
434 434
 	 */
435 435
 	public function get_the_id() {
436 436
 		return $this->get_the_value();
Please login to merge, or discard this patch.
src/includes/class-shortcode.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
 	 *
281 281
 	 * @since 1.8.0
282 282
 	 *
283
-	 * @return string|WP_Error|null An error message or object on failure.
283
+	 * @return string|null An error message or object on failure.
284 284
 	 */
285 285
 	protected function verify_atts() {
286 286
 
Please login to merge, or discard this patch.
src/includes/class-un-installer.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/includes/modules.php 1 patch
Spacing   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return bool Whether the module is active.
20 20
  */
21
-function is_wordpoints_module_active( $module ) {
21
+function is_wordpoints_module_active($module) {
22 22
 
23 23
 	return (
24
-		in_array( $module, wordpoints_get_array_option( 'wordpoints_active_modules' ) )
25
-		|| is_wordpoints_module_active_for_network( $module )
24
+		in_array($module, wordpoints_get_array_option('wordpoints_active_modules'))
25
+		|| is_wordpoints_module_active_for_network($module)
26 26
 	);
27 27
 }
28 28
 
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return bool Whether the module is network active.
37 37
  */
38
-function is_wordpoints_module_active_for_network( $module ) {
38
+function is_wordpoints_module_active_for_network($module) {
39 39
 
40
-	if ( ! is_wordpoints_network_active() ) {
40
+	if ( ! is_wordpoints_network_active()) {
41 41
 		return false;
42 42
 	}
43 43
 
44
-	$modules = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
44
+	$modules = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
45 45
 
46
-	if ( isset( $modules[ $module ] ) ) {
46
+	if (isset($modules[$module])) {
47 47
 		return true;
48 48
 	}
49 49
 
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return bool True if the module is network only, false otherwise.
67 67
  */
68
-function is_network_only_wordpoints_module( $module ) {
68
+function is_network_only_wordpoints_module($module) {
69 69
 
70
-	$module_data = wordpoints_get_module_data( wordpoints_modules_dir() . '/' . $module );
70
+	$module_data = wordpoints_get_module_data(wordpoints_modules_dir() . '/' . $module);
71 71
 
72 72
 	return $module_data['network'];
73 73
 }
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
  *
82 82
  * @return bool True if the module has an uninstall script, false otherwise.
83 83
  */
84
-function is_uninstallable_wordpoints_module( $module ) {
84
+function is_uninstallable_wordpoints_module($module) {
85 85
 
86
-	return ( file_exists( wordpoints_modules_dir() . '/' . dirname( wordpoints_module_basename( $module ) ) . '/uninstall.php' ) );
86
+	return (file_exists(wordpoints_modules_dir() . '/' . dirname(wordpoints_module_basename($module)) . '/uninstall.php'));
87 87
 }
88 88
 
89 89
 /**
@@ -143,30 +143,30 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @return bool Whether the path was able to be registered.
145 145
 	 */
146
-	public static function register( $file ) {
146
+	public static function register($file) {
147 147
 
148
-		$file = wp_normalize_path( $file );
148
+		$file = wp_normalize_path($file);
149 149
 
150 150
 		// We store this so that we don't have to keep normalizing a constant value.
151
-		if ( ! isset( self::$modules_dir ) ) {
152
-			self::$modules_dir = wp_normalize_path( wordpoints_modules_dir() );
151
+		if ( ! isset(self::$modules_dir)) {
152
+			self::$modules_dir = wp_normalize_path(wordpoints_modules_dir());
153 153
 		}
154 154
 
155
-		$module_path = wp_normalize_path( dirname( $file ) );
155
+		$module_path = wp_normalize_path(dirname($file));
156 156
 
157 157
 		// It was a single-file module.
158
-		if ( $module_path . '/' === self::$modules_dir ) {
158
+		if ($module_path . '/' === self::$modules_dir) {
159 159
 			return false;
160 160
 		}
161 161
 
162
-		$module_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
162
+		$module_realpath = wp_normalize_path(dirname(realpath($file)));
163 163
 
164
-		if ( $module_path !== $module_realpath ) {
164
+		if ($module_path !== $module_realpath) {
165 165
 
166
-			$realpath_length = strlen( $module_realpath );
166
+			$realpath_length = strlen($module_realpath);
167 167
 
168 168
 			// Use unique keys, but still easy to sort by realpath length.
169
-			self::$paths[ $realpath_length . '-' . $module_path ] = array(
169
+			self::$paths[$realpath_length . '-' . $module_path] = array(
170 170
 				'module_path'     => $module_path,
171 171
 				'module_realpath' => $module_realpath,
172 172
 				'realpath_length' => $realpath_length,
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return string The path to the symlink in the modules directory.
189 189
 	 */
190
-	public static function resolve( $file ) {
190
+	public static function resolve($file) {
191 191
 
192
-		$file = wp_normalize_path( $file );
192
+		$file = wp_normalize_path($file);
193 193
 
194 194
 		// Sort the paths by the realpath length, see https://core.trac.wordpress.org/ticket/28441.
195
-		if ( ! self::$paths_sorted ) {
196
-			krsort( self::$paths );
195
+		if ( ! self::$paths_sorted) {
196
+			krsort(self::$paths);
197 197
 			self::$paths_sorted = true;
198 198
 		}
199 199
 
200
-		foreach ( self::$paths as $path ) {
201
-			if ( 0 === strpos( $file, $path['module_realpath'] ) ) {
202
-				$file = $path['module_path'] . substr( $file, $path['realpath_length'] );
200
+		foreach (self::$paths as $path) {
201
+			if (0 === strpos($file, $path['module_realpath'])) {
202
+				$file = $path['module_path'] . substr($file, $path['realpath_length']);
203 203
 			}
204 204
 		}
205 205
 
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 
229 229
 	static $modules_dir;
230 230
 
231
-	if ( ! $modules_dir ) {
231
+	if ( ! $modules_dir) {
232 232
 
233
-		if ( defined( 'WORDPOINTS_MODULES_DIR' ) ) {
233
+		if (defined('WORDPOINTS_MODULES_DIR')) {
234 234
 
235
-			$modules_dir = trailingslashit( WORDPOINTS_MODULES_DIR );
235
+			$modules_dir = trailingslashit(WORDPOINTS_MODULES_DIR);
236 236
 
237 237
 		} else {
238 238
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @param string $module_dir The full path to the modules folder.
250 250
 	 */
251
-	return apply_filters( 'wordpoints_modules_dir', $modules_dir );
251
+	return apply_filters('wordpoints_modules_dir', $modules_dir);
252 252
 }
253 253
 
254 254
 /**
@@ -261,30 +261,30 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return string The URL for the path passed.
263 263
  */
264
-function wordpoints_modules_url( $path = '', $module = '' ) {
264
+function wordpoints_modules_url($path = '', $module = '') {
265 265
 
266
-	$path   = wp_normalize_path( $path );
267
-	$module = wp_normalize_path( $module );
266
+	$path   = wp_normalize_path($path);
267
+	$module = wp_normalize_path($module);
268 268
 
269
-	if ( defined( 'WORDPOINTS_MODULES_URL' ) ) {
269
+	if (defined('WORDPOINTS_MODULES_URL')) {
270 270
 		$url = WORDPOINTS_MODULES_URL;
271 271
 	} else {
272 272
 		$url = WP_CONTENT_URL . '/wordpoints-modules';
273 273
 	}
274 274
 
275
-	$url = set_url_scheme( $url );
275
+	$url = set_url_scheme($url);
276 276
 
277
-	if ( ! empty( $module ) && is_string( $module ) ) {
277
+	if ( ! empty($module) && is_string($module)) {
278 278
 
279
-		$folder = dirname( wordpoints_module_basename( $module ) );
279
+		$folder = dirname(wordpoints_module_basename($module));
280 280
 
281
-		if ( '.' !== $folder ) {
282
-			$url .= '/' . ltrim( $folder, '/' );
281
+		if ('.' !== $folder) {
282
+			$url .= '/' . ltrim($folder, '/');
283 283
 		}
284 284
 	}
285 285
 
286
-	if ( $path && is_string( $path ) ) {
287
-		$url .= '/' . ltrim( $path, '/' );
286
+	if ($path && is_string($path)) {
287
+		$url .= '/' . ltrim($path, '/');
288 288
 	}
289 289
 
290 290
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * @param string $path   A relative path to a file or folder.
297 297
 	 * @param string $module A module file that the $path should be relative to.
298 298
 	 */
299
-	return apply_filters( 'wordpoints_modules_url', $url, $path, $module );
299
+	return apply_filters('wordpoints_modules_url', $url, $path, $module);
300 300
 }
301 301
 
302 302
 /**
@@ -308,17 +308,17 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return string The name of the module file.
310 310
  */
311
-function wordpoints_module_basename( $file ) {
311
+function wordpoints_module_basename($file) {
312 312
 
313 313
 	// Sanitize, and resolve possible symlink path from what is likely a real path.
314
-	$file = WordPoints_Module_Paths::resolve( $file );
314
+	$file = WordPoints_Module_Paths::resolve($file);
315 315
 
316 316
 	// Sanitize for Win32 installs and remove any duplicate slashes.
317
-	$modules_dir = wp_normalize_path( wordpoints_modules_dir() );
317
+	$modules_dir = wp_normalize_path(wordpoints_modules_dir());
318 318
 
319 319
 	// Get the relative path from the modules directory, and trim off the slashes.
320
-	$file = preg_replace( '#^' . preg_quote( $modules_dir, '#' ) . '#', '', $file );
321
-	$file = trim( $file, '/' );
320
+	$file = preg_replace('#^' . preg_quote($modules_dir, '#') . '#', '', $file);
321
+	$file = trim($file, '/');
322 322
 
323 323
 	return $file;
324 324
 }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
  *         @type string $namespace   The namespace for this module. Should be Title_Case, and omit "WordPoints" prefix.
359 359
  * }
360 360
  */
361
-function wordpoints_get_module_data( $module_file, $markup = true, $translate = true ) {
361
+function wordpoints_get_module_data($module_file, $markup = true, $translate = true) {
362 362
 
363 363
 	$default_headers = array(
364 364
 		'name'        => 'Module Name',
@@ -376,94 +376,94 @@  discard block
 block discarded – undo
376 376
 		'namespace'   => 'Namespace',
377 377
 	);
378 378
 
379
-	$module_data = WordPoints_Modules::get_data( $module_file );
379
+	$module_data = WordPoints_Modules::get_data($module_file);
380 380
 
381
-	if ( $module_data && wp_normalize_path( $module_file ) === $module_data['raw_file'] ) {
382
-		unset( $module_data['raw'], $module_data['raw_file'] );
381
+	if ($module_data && wp_normalize_path($module_file) === $module_data['raw_file']) {
382
+		unset($module_data['raw'], $module_data['raw_file']);
383 383
 	} else {
384
-		$module_data = get_file_data( $module_file, $default_headers, 'wordpoints_module' );
384
+		$module_data = get_file_data($module_file, $default_headers, 'wordpoints_module');
385 385
 	}
386 386
 
387
-	if ( ! empty( $module_data['update_api'] ) ) {
388
-		_deprecated_argument( __FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Channel".' );
387
+	if ( ! empty($module_data['update_api'])) {
388
+		_deprecated_argument(__FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Channel".');
389 389
 	}
390 390
 
391
-	$module_data['network'] = ( 'true' === strtolower( $module_data['network'] ) );
391
+	$module_data['network'] = ('true' === strtolower($module_data['network']));
392 392
 
393
-	if ( $markup || $translate ) {
393
+	if ($markup || $translate) {
394 394
 
395 395
 		// Sanitize the plugin filename to a WP_module_DIR relative path
396
-		$module_file = wordpoints_module_basename( $module_file );
396
+		$module_file = wordpoints_module_basename($module_file);
397 397
 
398 398
 		// Translate fields
399
-		if ( $translate ) {
399
+		if ($translate) {
400 400
 
401 401
 			$textdomain = $module_data['text_domain'];
402 402
 
403
-			if ( $textdomain ) {
403
+			if ($textdomain) {
404 404
 
405
-				if ( ! is_textdomain_loaded( $textdomain ) ) {
405
+				if ( ! is_textdomain_loaded($textdomain)) {
406 406
 
407
-					$domain_path = dirname( $module_file );
407
+					$domain_path = dirname($module_file);
408 408
 
409
-					if ( $module_data['domain_path'] ) {
409
+					if ($module_data['domain_path']) {
410 410
 						$domain_path .= $module_data['domain_path'];
411 411
 					}
412 412
 
413
-					wordpoints_load_module_textdomain( $textdomain, $domain_path );
413
+					wordpoints_load_module_textdomain($textdomain, $domain_path);
414 414
 				}
415 415
 
416
-				foreach ( array( 'name', 'module_uri', 'description', 'author', 'author_uri', 'version' ) as $field ) {
416
+				foreach (array('name', 'module_uri', 'description', 'author', 'author_uri', 'version') as $field) {
417 417
 
418
-					$module_data[ $field ] = translate( $module_data[ $field ], $textdomain ); // @codingStandardsIgnoreLine
418
+					$module_data[$field] = translate($module_data[$field], $textdomain); // @codingStandardsIgnoreLine
419 419
 				}
420 420
 			}
421 421
 		}
422 422
 
423 423
 		// Sanitize fields.
424 424
 		$allowed_tags_in_links = array(
425
-			'abbr'    => array( 'title' => true ),
426
-			'acronym' => array( 'title' => true ),
425
+			'abbr'    => array('title' => true),
426
+			'acronym' => array('title' => true),
427 427
 			'code'    => true,
428 428
 			'em'      => true,
429 429
 			'strong'  => true,
430 430
 		);
431 431
 
432 432
 		$allowed_tags = $allowed_tags_in_links;
433
-		$allowed_tags['a'] = array( 'href' => true, 'title' => true );
433
+		$allowed_tags['a'] = array('href' => true, 'title' => true);
434 434
 
435 435
 		// Name and author ar marked up inside <a> tags. Don't allow these.
436
-		$module_data['name']   = wp_kses( $module_data['name'],   $allowed_tags_in_links );
437
-		$module_data['author'] = wp_kses( $module_data['author'], $allowed_tags_in_links );
436
+		$module_data['name']   = wp_kses($module_data['name'], $allowed_tags_in_links);
437
+		$module_data['author'] = wp_kses($module_data['author'], $allowed_tags_in_links);
438 438
 
439
-		$module_data['description'] = wp_kses( $module_data['description'], $allowed_tags );
440
-		$module_data['version']     = wp_kses( $module_data['version'],     $allowed_tags );
439
+		$module_data['description'] = wp_kses($module_data['description'], $allowed_tags);
440
+		$module_data['version']     = wp_kses($module_data['version'], $allowed_tags);
441 441
 
442
-		$module_data['module_uri'] = esc_url( $module_data['module_uri'] );
443
-		$module_data['author_uri'] = esc_url( $module_data['author_uri'] );
442
+		$module_data['module_uri'] = esc_url($module_data['module_uri']);
443
+		$module_data['author_uri'] = esc_url($module_data['author_uri']);
444 444
 
445 445
 		$module_data['title']       = $module_data['name'];
446 446
 		$module_data['author_name'] = $module_data['author'];
447 447
 
448 448
 		// Apply markup.
449
-		if ( $markup ) {
449
+		if ($markup) {
450 450
 
451
-			if ( $module_data['module_uri'] && $module_data['name'] ) {
451
+			if ($module_data['module_uri'] && $module_data['name']) {
452 452
 				$module_data['title'] = '<a href="' . $module_data['module_uri']
453 453
 					. '">' . $module_data['name'] . '</a>';
454 454
 			}
455 455
 
456
-			if ( $module_data['author_uri'] && $module_data['author'] ) {
456
+			if ($module_data['author_uri'] && $module_data['author']) {
457 457
 				$module_data['author'] = '<a href="' . $module_data['author_uri']
458 458
 					. '">' . $module_data['author'] . '</a>';
459 459
 			}
460 460
 
461
-			$module_data['description'] = wptexturize( $module_data['description'] );
461
+			$module_data['description'] = wptexturize($module_data['description']);
462 462
 
463
-			if ( $module_data['author'] ) {
463
+			if ($module_data['author']) {
464 464
 				$module_data['description'] .= ' <cite>'
465 465
 					// translators: Author name.
466
-					. sprintf( __( 'By %s.', 'wordpoints' ), $module_data['author'] )
466
+					. sprintf(__('By %s.', 'wordpoints'), $module_data['author'])
467 467
 					. '</cite>';
468 468
 			}
469 469
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @return bool Whether the textdoamin was loaded successfully.
491 491
  */
492
-function wordpoints_load_module_textdomain( $domain, $module_rel_path = false ) {
492
+function wordpoints_load_module_textdomain($domain, $module_rel_path = false) {
493 493
 
494 494
 	$locale = get_locale();
495 495
 
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 	 * @param string $locale The module's current locale.
502 502
 	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
503 503
 	 */
504
-	$locale = apply_filters( 'wordpoints_module_locale', $locale, $domain );
504
+	$locale = apply_filters('wordpoints_module_locale', $locale, $domain);
505 505
 
506
-	if ( false !== $module_rel_path	) {
506
+	if (false !== $module_rel_path) {
507 507
 
508
-		$path = wordpoints_modules_dir() . '/' . trim( $module_rel_path, '/' );
508
+		$path = wordpoints_modules_dir() . '/' . trim($module_rel_path, '/');
509 509
 
510 510
 	} else {
511 511
 
@@ -515,14 +515,14 @@  discard block
 block discarded – undo
515 515
 	// Load the textdomain according to the module first.
516 516
 	$mofile = $domain . '-' . $locale . '.mo';
517 517
 
518
-	if ( load_textdomain( $domain, $path . '/' . $mofile ) ) {
518
+	if (load_textdomain($domain, $path . '/' . $mofile)) {
519 519
 		return true;
520 520
 	}
521 521
 
522 522
 	// Otherwise, load from the languages directory.
523 523
 	$mofile = WP_LANG_DIR . '/wordpoints-modules/' . $mofile;
524 524
 
525
-	return load_textdomain( $domain, $mofile );
525
+	return load_textdomain($domain, $mofile);
526 526
 }
527 527
 
528 528
 /**
@@ -542,76 +542,76 @@  discard block
 block discarded – undo
542 542
  *
543 543
  * @return array A list of the module files found (files with module headers).
544 544
  */
545
-function wordpoints_get_modules( $module_folder = '', $markup = false, $translate = false ) {
545
+function wordpoints_get_modules($module_folder = '', $markup = false, $translate = false) {
546 546
 
547
-	$cache_modules = wp_cache_get( 'wordpoints_modules', 'wordpoints_modules' );
547
+	$cache_modules = wp_cache_get('wordpoints_modules', 'wordpoints_modules');
548 548
 
549
-	if ( ! $cache_modules ) {
549
+	if ( ! $cache_modules) {
550 550
 		$cache_modules = array();
551 551
 	}
552 552
 
553
-	if ( isset( $cache_modules[ $module_folder ] ) ) {
554
-		return $cache_modules[ $module_folder ];
553
+	if (isset($cache_modules[$module_folder])) {
554
+		return $cache_modules[$module_folder];
555 555
 	}
556 556
 
557 557
 	$modules     = array();
558 558
 	$module_root = wordpoints_modules_dir();
559 559
 
560
-	if ( ! empty( $module_folder ) ) {
560
+	if ( ! empty($module_folder)) {
561 561
 		$module_root .= $module_folder;
562 562
 	}
563 563
 
564 564
 	// Escape pattern-matching characters in the path.
565
-	$module_escape_root = str_replace( array( '*', '?', '[' ), array( '[*]', '[?]', '[[]' ), $module_root );
565
+	$module_escape_root = str_replace(array('*', '?', '['), array('[*]', '[?]', '[[]'), $module_root);
566 566
 
567 567
 	// Get the top level files.
568
-	$module_files = glob( "{$module_escape_root}/*.php" );
568
+	$module_files = glob("{$module_escape_root}/*.php");
569 569
 
570
-	if ( false === $module_files ) {
570
+	if (false === $module_files) {
571 571
 		return $modules;
572 572
 	}
573 573
 
574 574
 	// Get the files of subfolders, if not already searching in a subfolder.
575
-	if ( empty( $module_folder ) ) {
575
+	if (empty($module_folder)) {
576 576
 
577
-		$subfolder_files = glob( "{$module_escape_root}/*/*.php" );
577
+		$subfolder_files = glob("{$module_escape_root}/*/*.php");
578 578
 
579
-		if ( false === $subfolder_files ) {
579
+		if (false === $subfolder_files) {
580 580
 			return $modules;
581 581
 		}
582 582
 
583
-		$module_files = array_merge( $module_files, $subfolder_files );
583
+		$module_files = array_merge($module_files, $subfolder_files);
584 584
 	}
585 585
 
586
-	if ( empty( $module_files ) ) {
586
+	if (empty($module_files)) {
587 587
 		return $modules;
588 588
 	}
589 589
 
590
-	foreach ( $module_files as $module_file ) {
590
+	foreach ($module_files as $module_file) {
591 591
 
592
-		if ( ! is_readable( $module_file ) ) {
592
+		if ( ! is_readable($module_file)) {
593 593
 			continue;
594 594
 		}
595 595
 
596
-		$module_data = wordpoints_get_module_data( $module_file, $markup, $translate );
596
+		$module_data = wordpoints_get_module_data($module_file, $markup, $translate);
597 597
 
598
-		if ( empty( $module_data['name'] ) ) {
598
+		if (empty($module_data['name'])) {
599 599
 			continue;
600 600
 		}
601 601
 
602
-		$module_file = wordpoints_module_basename( $module_file );
602
+		$module_file = wordpoints_module_basename($module_file);
603 603
 
604
-		if ( $module_folder ) {
605
-			$module_file = basename( $module_file );
604
+		if ($module_folder) {
605
+			$module_file = basename($module_file);
606 606
 		}
607 607
 
608
-		$modules[ $module_file ] = $module_data;
608
+		$modules[$module_file] = $module_data;
609 609
 	}
610 610
 
611
-	uasort( $modules, '_wordpoints_sort_uname_callback' );
611
+	uasort($modules, '_wordpoints_sort_uname_callback');
612 612
 
613
-	$cache_modules[ $module_folder ] = $modules;
614
-	wp_cache_set( 'wordpoints_modules', $cache_modules, 'wordpoints_modules' );
613
+	$cache_modules[$module_folder] = $modules;
614
+	wp_cache_set('wordpoints_modules', $cache_modules, 'wordpoints_modules');
615 615
 
616 616
 	return $modules;
617 617
 }
@@ -625,20 +625,20 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return true|WP_Error True on success, a WP_Error on failure.
627 627
  */
628
-function wordpoints_validate_module( $module ) {
628
+function wordpoints_validate_module($module) {
629 629
 
630
-	if ( validate_file( $module ) ) {
631
-		return new WP_Error( 'module_invalid', __( 'Invalid module path.', 'wordpoints' ) );
630
+	if (validate_file($module)) {
631
+		return new WP_Error('module_invalid', __('Invalid module path.', 'wordpoints'));
632 632
 	}
633 633
 
634
-	if ( ! file_exists( wordpoints_modules_dir() . '/' . $module ) ) {
635
-		return new WP_Error( 'module_not_found', __( 'Module file does not exist.', 'wordpoints' ) );
634
+	if ( ! file_exists(wordpoints_modules_dir() . '/' . $module)) {
635
+		return new WP_Error('module_not_found', __('Module file does not exist.', 'wordpoints'));
636 636
 	}
637 637
 
638 638
 	$installed_modules = wordpoints_get_modules();
639 639
 
640
-	if ( ! isset( $installed_modules[ $module ] ) ) {
641
-		return new WP_Error( 'no_module_header', __( 'The module does not have a valid header.', 'wordpoints' ) );
640
+	if ( ! isset($installed_modules[$module])) {
641
+		return new WP_Error('no_module_header', __('The module does not have a valid header.', 'wordpoints'));
642 642
 	}
643 643
 
644 644
 	return true;
@@ -655,27 +655,27 @@  discard block
 block discarded – undo
655 655
  */
656 656
 function wordpoints_validate_active_modules() {
657 657
 
658
-	$modules = wordpoints_get_array_option( 'wordpoints_active_modules' );
658
+	$modules = wordpoints_get_array_option('wordpoints_active_modules');
659 659
 
660
-	if ( is_multisite() && current_user_can( 'manage_network_wordpoints_modules' ) ) {
660
+	if (is_multisite() && current_user_can('manage_network_wordpoints_modules')) {
661 661
 
662
-		$network_modules = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
663
-		$modules = array_merge( $modules, array_keys( $network_modules ) );
662
+		$network_modules = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
663
+		$modules = array_merge($modules, array_keys($network_modules));
664 664
 	}
665 665
 
666
-	if ( empty( $modules ) ) {
666
+	if (empty($modules)) {
667 667
 		return null;
668 668
 	}
669 669
 
670 670
 	$invalid = array();
671 671
 
672
-	foreach ( $modules as $module ) {
672
+	foreach ($modules as $module) {
673 673
 
674
-		$result = wordpoints_validate_module( $module );
674
+		$result = wordpoints_validate_module($module);
675 675
 
676
-		if ( is_wp_error( $result ) ) {
677
-			$invalid[ $module ] = $result;
678
-			wordpoints_deactivate_modules( $module, true );
676
+		if (is_wp_error($result)) {
677
+			$invalid[$module] = $result;
678
+			wordpoints_deactivate_modules($module, true);
679 679
 		}
680 680
 	}
681 681
 
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
  *
693 693
  * @return int {@see strnatcasecmp()}.
694 694
  */
695
-function _wordpoints_sort_uname_callback( $a, $b ) {
695
+function _wordpoints_sort_uname_callback($a, $b) {
696 696
 
697
-	return strnatcasecmp( $a['name'], $b['name'] );
697
+	return strnatcasecmp($a['name'], $b['name']);
698 698
 }
699 699
 
700 700
 /**
@@ -725,33 +725,33 @@  discard block
 block discarded – undo
725 725
  *
726 726
  * @return WP_Error|null An error object on failure, or null on success.
727 727
  */
728
-function wordpoints_activate_module( $module, $redirect = '', $network_wide = false, $silent = false ) {
728
+function wordpoints_activate_module($module, $redirect = '', $network_wide = false, $silent = false) {
729 729
 
730
-	$module = wordpoints_module_basename( $module );
730
+	$module = wordpoints_module_basename($module);
731 731
 
732
-	$valid = wordpoints_validate_module( $module );
732
+	$valid = wordpoints_validate_module($module);
733 733
 
734
-	if ( is_wp_error( $valid ) ) {
734
+	if (is_wp_error($valid)) {
735 735
 		return $valid;
736 736
 	}
737 737
 
738
-	if ( is_multisite() && ( $network_wide || is_network_only_wordpoints_module( $module ) ) ) {
738
+	if (is_multisite() && ($network_wide || is_network_only_wordpoints_module($module))) {
739 739
 
740 740
 		$network_wide = true;
741
-		$network_current = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
742
-		$current = array_keys( $network_current );
741
+		$network_current = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
742
+		$current = array_keys($network_current);
743 743
 
744 744
 	} else {
745 745
 
746
-		$current = wordpoints_get_array_option( 'wordpoints_active_modules' );
746
+		$current = wordpoints_get_array_option('wordpoints_active_modules');
747 747
 	}
748 748
 
749 749
 	// If the module is already active, return.
750
-	if ( in_array( $module, $current ) ) {
750
+	if (in_array($module, $current)) {
751 751
 		return null;
752 752
 	}
753 753
 
754
-	if ( ! empty( $redirect ) ) {
754
+	if ( ! empty($redirect)) {
755 755
 
756 756
 		/*
757 757
 		 * Redirect. We'll override this later if the module can be included
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		wp_safe_redirect(
761 761
 			add_query_arg(
762 762
 				'_error_nonce'
763
-				, wp_create_nonce( 'module-activation-error_' . $module )
763
+				, wp_create_nonce('module-activation-error_' . $module)
764 764
 				, $redirect
765 765
 			)
766 766
 		);
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
 	ob_start();
770 770
 
771 771
 	$module_file = wordpoints_modules_dir() . '/' . $module;
772
-	WordPoints_Module_Paths::register( $module_file );
772
+	WordPoints_Module_Paths::register($module_file);
773 773
 
774 774
 	include_once $module_file;
775 775
 
776
-	if ( ! $silent ) {
776
+	if ( ! $silent) {
777 777
 
778 778
 		/**
779 779
 		 * Fires before a module is activated.
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 		 *                             all sites in the network or just the
786 786
 		 *                             current site.
787 787
 		 */
788
-		do_action( 'wordpoints_module_activate', $module, $network_wide );
788
+		do_action('wordpoints_module_activate', $module, $network_wide);
789 789
 
790 790
 		/**
791 791
 		 * Fires before a module is activated.
@@ -796,28 +796,28 @@  discard block
 block discarded – undo
796 796
 		 *                           all sites in the network or just the current
797 797
 		 *                           site.
798 798
 		 */
799
-		do_action( "wordpoints_module_activate-{$module}", $network_wide );
799
+		do_action("wordpoints_module_activate-{$module}", $network_wide);
800 800
 
801 801
 		WordPoints_Installables::install(
802 802
 			'module'
803
-			, WordPoints_Modules::get_slug( $module )
803
+			, WordPoints_Modules::get_slug($module)
804 804
 			, $network_wide
805 805
 		);
806 806
 	}
807 807
 
808
-	if ( $network_wide ) {
808
+	if ($network_wide) {
809 809
 
810
-		$network_current[ $module ] = time();
811
-		update_site_option( 'wordpoints_sitewide_active_modules', $network_current );
810
+		$network_current[$module] = time();
811
+		update_site_option('wordpoints_sitewide_active_modules', $network_current);
812 812
 
813 813
 	} else {
814 814
 
815 815
 		$current[] = $module;
816
-		sort( $current );
817
-		update_option( 'wordpoints_active_modules', $current );
816
+		sort($current);
817
+		update_option('wordpoints_active_modules', $current);
818 818
 	}
819 819
 
820
-	if ( ! $silent ) {
820
+	if ( ! $silent) {
821 821
 		/**
822 822
 		 * Fires after a module has been activated in activate_plugin() when the $silent parameter is false.
823 823
 		 *
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
 		 *                             all sites in the network or just the
829 829
 		 *                             current site.
830 830
 		 */
831
-		do_action( 'wordpoints_activated_module', $module, $network_wide );
831
+		do_action('wordpoints_activated_module', $module, $network_wide);
832 832
 	}
833 833
 
834
-	if ( ob_get_length() > 0 ) {
834
+	if (ob_get_length() > 0) {
835 835
 
836 836
 		return new WP_Error(
837 837
 			'unexpected_output'
838
-			, __( 'The module generated unexpected output.', 'wordpoints' )
838
+			, __('The module generated unexpected output.', 'wordpoints')
839 839
 			, ob_get_contents()
840 840
 		);
841 841
 	}
@@ -855,29 +855,29 @@  discard block
 block discarded – undo
855 855
  *                                   Default is false.
856 856
  * @param bool         $network_wide Whether to apply the change network wide.
857 857
  */
858
-function wordpoints_deactivate_modules( $modules, $silent = false, $network_wide = null ) {
858
+function wordpoints_deactivate_modules($modules, $silent = false, $network_wide = null) {
859 859
 
860 860
 	$network_current = array();
861
-	if ( is_wordpoints_network_active() ) {
862
-		$network_current = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
861
+	if (is_wordpoints_network_active()) {
862
+		$network_current = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
863 863
 	}
864 864
 
865
-	$current = wordpoints_get_array_option( 'wordpoints_active_modules' );
865
+	$current = wordpoints_get_array_option('wordpoints_active_modules');
866 866
 
867 867
 	$do_network = false;
868 868
 	$do_blog = false;
869 869
 
870
-	foreach ( (array) $modules as $module ) {
870
+	foreach ((array) $modules as $module) {
871 871
 
872
-		$module = wordpoints_module_basename( $module );
872
+		$module = wordpoints_module_basename($module);
873 873
 
874
-		if ( ! is_wordpoints_module_active( $module ) ) {
874
+		if ( ! is_wordpoints_module_active($module)) {
875 875
 			continue;
876 876
 		}
877 877
 
878
-		$network_deactivating = ( false !== $network_wide && is_wordpoints_module_active_for_network( $module ) );
878
+		$network_deactivating = (false !== $network_wide && is_wordpoints_module_active_for_network($module));
879 879
 
880
-		if ( ! $silent ) {
880
+		if ( ! $silent) {
881 881
 			/**
882 882
 			 * Fires for each module being deactivated in wordpoints_deactivate_modules(), before deactivation
883 883
 			 * and when the $silent parameter is false.
@@ -888,34 +888,34 @@  discard block
 block discarded – undo
888 888
 			 * @param bool   $network_deactivating Whether the module is deactivated for all sites in the network
889 889
 			 *                                     or just the current site. Multisite only. Default is false.
890 890
 			 */
891
-			do_action( 'wordpoints_deactivate_module', $module, $network_deactivating );
891
+			do_action('wordpoints_deactivate_module', $module, $network_deactivating);
892 892
 		}
893 893
 
894
-		if ( false !== $network_wide ) {
894
+		if (false !== $network_wide) {
895 895
 
896
-			if ( is_wordpoints_module_active_for_network( $module ) ) {
896
+			if (is_wordpoints_module_active_for_network($module)) {
897 897
 
898 898
 				$do_network = true;
899
-				unset( $network_current[ $module ] );
899
+				unset($network_current[$module]);
900 900
 
901
-			} elseif ( $network_wide ) {
901
+			} elseif ($network_wide) {
902 902
 
903 903
 				continue;
904 904
 			}
905 905
 		}
906 906
 
907
-		if ( true !== $network_wide ) {
907
+		if (true !== $network_wide) {
908 908
 
909
-			$key = array_search( $module, $current );
909
+			$key = array_search($module, $current);
910 910
 
911
-			if ( false !== $key ) {
911
+			if (false !== $key) {
912 912
 
913 913
 				$do_blog = true;
914
-				unset( $current[ $key ] );
914
+				unset($current[$key]);
915 915
 			}
916 916
 		}
917 917
 
918
-		if ( ! $silent ) {
918
+		if ( ! $silent) {
919 919
 			/**
920 920
 			 * Fires for each module being deactivated in wordpoints_deactivate_module(), after deactivation
921 921
 			 * and when the $silent parameter is false.
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 			 * @param bool $network_deactivating Whether the module is deactivated for all sites in the network
929 929
 			 *                                   or just the current site. Multisite only. Default is false.
930 930
 			 */
931
-			do_action( 'wordpoints_deactivate_module-' . $module, $network_deactivating );
931
+			do_action('wordpoints_deactivate_module-' . $module, $network_deactivating);
932 932
 
933 933
 			/**
934 934
 			 * Fires for each module being deactivated in deactivate_plugins(), after deactivation
@@ -940,17 +940,17 @@  discard block
 block discarded – undo
940 940
 			 * @param bool   $network_deactivating Whether the module is deactivated for all sites in the network
941 941
 			 *                                     or just the current site. Multisite only. Default is false.
942 942
 			 */
943
-			do_action( 'wordpoints_deactivated_module', $module, $network_deactivating );
943
+			do_action('wordpoints_deactivated_module', $module, $network_deactivating);
944 944
 		}
945 945
 
946 946
 	} // End foreach ( $modules ).
947 947
 
948
-	if ( $do_blog ) {
949
-		update_option( 'wordpoints_active_modules', $current );
948
+	if ($do_blog) {
949
+		update_option('wordpoints_active_modules', $current);
950 950
 	}
951 951
 
952
-	if ( $do_network ) {
953
-		update_site_option( 'wordpoints_sitewide_active_modules', $network_current );
952
+	if ($do_network) {
953
+		update_site_option('wordpoints_sitewide_active_modules', $network_current);
954 954
 	}
955 955
 }
956 956
 
@@ -967,31 +967,31 @@  discard block
 block discarded – undo
967 967
  * @return bool|WP_Error True if all modules deleted successfully, false or WP_Error
968 968
  *                       on failure.
969 969
  */
970
-function wordpoints_delete_modules( $modules ) {
970
+function wordpoints_delete_modules($modules) {
971 971
 
972 972
 	global $wp_filesystem;
973 973
 
974
-	if ( empty( $modules ) ) {
974
+	if (empty($modules)) {
975 975
 		return false;
976 976
 	}
977 977
 
978 978
 	$checked = array();
979 979
 
980
-	foreach ( $modules as $module ) {
980
+	foreach ($modules as $module) {
981 981
 		$checked[] = 'checked[]=' . $module;
982 982
 	}
983 983
 
984 984
 	ob_start();
985 985
 
986
-	$url = wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&verify-delete=1&' . implode( '&', $checked ) ), 'bulk-modules' );
986
+	$url = wp_nonce_url(self_admin_url('admin.php?page=wordpoints_modules&action=delete-selected&verify-delete=1&' . implode('&', $checked)), 'bulk-modules');
987 987
 
988
-	$credentials = request_filesystem_credentials( $url );
988
+	$credentials = request_filesystem_credentials($url);
989 989
 
990
-	if ( false === $credentials ) {
990
+	if (false === $credentials) {
991 991
 
992 992
 		$data = ob_get_clean();
993 993
 
994
-		if ( ! empty( $data ) ) {
994
+		if ( ! empty($data)) {
995 995
 
996 996
 			include_once ABSPATH . 'wp-admin/admin-header.php';
997 997
 			echo $data; // XSS OK here, WPCS.
@@ -1002,14 +1002,14 @@  discard block
 block discarded – undo
1002 1002
 		return false;
1003 1003
 	}
1004 1004
 
1005
-	if ( ! WP_Filesystem( $credentials ) ) {
1005
+	if ( ! WP_Filesystem($credentials)) {
1006 1006
 
1007 1007
 		// Failed to connect, Error and request again
1008
-		request_filesystem_credentials( $url, '', true );
1008
+		request_filesystem_credentials($url, '', true);
1009 1009
 
1010 1010
 		$data = ob_get_clean();
1011 1011
 
1012
-		if ( ! empty( $data ) ) {
1012
+		if ( ! empty($data)) {
1013 1013
 
1014 1014
 			include_once ABSPATH . 'wp-admin/admin-header.php';
1015 1015
 			echo $data; // XSS OK here too, WPCS.
@@ -1020,41 +1020,41 @@  discard block
 block discarded – undo
1020 1020
 		return false;
1021 1021
 	}
1022 1022
 
1023
-	if ( ! is_object( $wp_filesystem ) ) {
1024
-		return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.', 'wordpoints' ) );
1023
+	if ( ! is_object($wp_filesystem)) {
1024
+		return new WP_Error('fs_unavailable', __('Could not access filesystem.', 'wordpoints'));
1025 1025
 	}
1026 1026
 
1027
-	if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
1028
-		return new WP_Error( 'fs_error', __( 'Filesystem error.', 'wordpoints' ), $wp_filesystem->errors );
1027
+	if (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
1028
+		return new WP_Error('fs_error', __('Filesystem error.', 'wordpoints'), $wp_filesystem->errors);
1029 1029
 	}
1030 1030
 
1031 1031
 	// Get the base module folder.
1032
-	$modules_dir = $wp_filesystem->find_folder( wordpoints_modules_dir() );
1032
+	$modules_dir = $wp_filesystem->find_folder(wordpoints_modules_dir());
1033 1033
 
1034
-	if ( empty( $modules_dir ) ) {
1035
-		return new WP_Error( 'fs_no_modules_dir', __( 'Unable to locate WordPoints Module directory.', 'wordpoints' ) );
1034
+	if (empty($modules_dir)) {
1035
+		return new WP_Error('fs_no_modules_dir', __('Unable to locate WordPoints Module directory.', 'wordpoints'));
1036 1036
 	}
1037 1037
 
1038
-	$modules_dir = trailingslashit( $modules_dir );
1038
+	$modules_dir = trailingslashit($modules_dir);
1039 1039
 	$errors = array();
1040 1040
 
1041
-	foreach ( $modules as $module_file ) {
1041
+	foreach ($modules as $module_file) {
1042 1042
 
1043 1043
 		// Run uninstall hook.
1044
-		if ( is_uninstallable_wordpoints_module( $module_file ) ) {
1045
-			wordpoints_uninstall_module( $module_file );
1044
+		if (is_uninstallable_wordpoints_module($module_file)) {
1045
+			wordpoints_uninstall_module($module_file);
1046 1046
 		}
1047 1047
 
1048
-		$this_module_dir = trailingslashit( dirname( $modules_dir . $module_file ) );
1048
+		$this_module_dir = trailingslashit(dirname($modules_dir . $module_file));
1049 1049
 
1050 1050
 		// If module is in its own directory, recursively delete the directory.
1051
-		if ( strpos( $module_file, '/' ) && $this_module_dir !== $modules_dir ) {
1052
-			$deleted = $wp_filesystem->delete( $this_module_dir, true );
1051
+		if (strpos($module_file, '/') && $this_module_dir !== $modules_dir) {
1052
+			$deleted = $wp_filesystem->delete($this_module_dir, true);
1053 1053
 		} else {
1054
-			$deleted = $wp_filesystem->delete( $modules_dir . $module_file );
1054
+			$deleted = $wp_filesystem->delete($modules_dir . $module_file);
1055 1055
 		}
1056 1056
 
1057
-		if ( ! $deleted ) {
1057
+		if ( ! $deleted) {
1058 1058
 			$errors[] = $module_file;
1059 1059
 		}
1060 1060
 	}
@@ -1071,9 +1071,9 @@  discard block
 block discarded – undo
1071 1071
 	 * @param array $modules The modules that were to be deleted.
1072 1072
 	 * @param array $errors  The modules that failed to delete.
1073 1073
 	 */
1074
-	do_action( 'wordpoints_deleted_modules', $modules, $errors );
1074
+	do_action('wordpoints_deleted_modules', $modules, $errors);
1075 1075
 
1076
-	if ( ! empty( $errors ) ) {
1076
+	if ( ! empty($errors)) {
1077 1077
 		return new WP_Error(
1078 1078
 			'could_not_remove_module'
1079 1079
 			, sprintf(
@@ -1081,10 +1081,10 @@  discard block
 block discarded – undo
1081 1081
 				_n(
1082 1082
 					'Could not fully remove the module %s.'
1083 1083
 					, 'Could not fully remove the modules %s.'
1084
-					, count( $errors )
1084
+					, count($errors)
1085 1085
 					, 'wordpoints'
1086 1086
 				)
1087
-				, implode( ', ', $errors )
1087
+				, implode(', ', $errors)
1088 1088
 			)
1089 1089
 		);
1090 1090
 	}
@@ -1103,16 +1103,16 @@  discard block
 block discarded – undo
1103 1103
  *
1104 1104
  * @return bool Whether the module had an uninstall process.
1105 1105
  */
1106
-function wordpoints_uninstall_module( $module ) {
1106
+function wordpoints_uninstall_module($module) {
1107 1107
 
1108
-	$file              = wordpoints_module_basename( $module );
1109
-	$module_dir        = wordpoints_modules_dir() . '/' . dirname( $file );
1108
+	$file              = wordpoints_module_basename($module);
1109
+	$module_dir        = wordpoints_modules_dir() . '/' . dirname($file);
1110 1110
 	$uninstall_file    = $module_dir . '/uninstall.php';
1111 1111
 	$un_installer_file = $module_dir . '/includes/class-un-installer.php';
1112 1112
 
1113
-	if ( file_exists( $uninstall_file ) ) {
1113
+	if (file_exists($uninstall_file)) {
1114 1114
 
1115
-		if ( ! defined( 'WORDPOINTS_UNINSTALL_MODULE' ) ) {
1115
+		if ( ! defined('WORDPOINTS_UNINSTALL_MODULE')) {
1116 1116
 			/**
1117 1117
 			 * Uninstalling a module.
1118 1118
 			 *
@@ -1126,17 +1126,17 @@  discard block
 block discarded – undo
1126 1126
 			 *
1127 1127
 			 * @const WORDPOINTS_UNINSTALL_MODULE
1128 1128
 			 */
1129
-			define( 'WORDPOINTS_UNINSTALL_MODULE', true );
1129
+			define('WORDPOINTS_UNINSTALL_MODULE', true);
1130 1130
 		}
1131 1131
 
1132
-		WordPoints_Module_Paths::register( $uninstall_file );
1132
+		WordPoints_Module_Paths::register($uninstall_file);
1133 1133
 		include $uninstall_file;
1134 1134
 
1135 1135
 		return true;
1136 1136
 
1137
-	} elseif ( file_exists( $un_installer_file ) ) {
1137
+	} elseif (file_exists($un_installer_file)) {
1138 1138
 
1139
-		$slug = WordPoints_Modules::get_slug( $module );
1139
+		$slug = WordPoints_Modules::get_slug($module);
1140 1140
 
1141 1141
 		WordPoints_Installables::register(
1142 1142
 			'module'
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 			)
1149 1149
 		);
1150 1150
 
1151
-		return WordPoints_Installables::uninstall( 'module', $slug );
1151
+		return WordPoints_Installables::uninstall('module', $slug);
1152 1152
 
1153 1153
 	} else {
1154 1154
 
@@ -1174,34 +1174,34 @@  discard block
 block discarded – undo
1174 1174
  */
1175 1175
 function wordpoints_load_modules() {
1176 1176
 
1177
-	$active_modules = wordpoints_get_array_option( 'wordpoints_active_modules' );
1177
+	$active_modules = wordpoints_get_array_option('wordpoints_active_modules');
1178 1178
 
1179
-	if ( is_wordpoints_network_active() ) {
1179
+	if (is_wordpoints_network_active()) {
1180 1180
 
1181 1181
 		$network_active_modules = array_keys(
1182
-			wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' )
1182
+			wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site')
1183 1183
 		);
1184 1184
 
1185 1185
 		// On the network admin screens we only load the network active modules.
1186
-		if ( is_network_admin() ) {
1186
+		if (is_network_admin()) {
1187 1187
 			$active_modules = $network_active_modules;
1188 1188
 		} else {
1189
-			$active_modules = array_merge( $active_modules, $network_active_modules );
1189
+			$active_modules = array_merge($active_modules, $network_active_modules);
1190 1190
 		}
1191 1191
 	}
1192 1192
 
1193
-	if ( ! empty( $active_modules ) ) {
1193
+	if ( ! empty($active_modules)) {
1194 1194
 
1195 1195
 		$modules_dir = wordpoints_modules_dir();
1196 1196
 
1197
-		foreach ( $active_modules as $module ) {
1197
+		foreach ($active_modules as $module) {
1198 1198
 
1199 1199
 			if (
1200
-				0 === validate_file( $module )
1201
-				&& '.php' === substr( $module, -4 )
1202
-				&& file_exists( $modules_dir . '/' . $module )
1200
+				0 === validate_file($module)
1201
+				&& '.php' === substr($module, -4)
1202
+				&& file_exists($modules_dir . '/' . $module)
1203 1203
 			) {
1204
-				WordPoints_Module_Paths::register( $modules_dir . '/' . $module );
1204
+				WordPoints_Module_Paths::register($modules_dir . '/' . $module);
1205 1205
 				include $modules_dir . '/' . $module;
1206 1206
 			}
1207 1207
 		}
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	 *
1215 1215
 	 * @since 1.0.0
1216 1216
 	 */
1217
-	do_action( 'wordpoints_modules_loaded' );
1217
+	do_action('wordpoints_modules_loaded');
1218 1218
 }
1219 1219
 
1220 1220
 /**
@@ -1225,11 +1225,11 @@  discard block
 block discarded – undo
1225 1225
  * @param string $file     The main file of the module the hook is for.
1226 1226
  * @param string $function The callback function.
1227 1227
  */
1228
-function wordpoints_register_module_activation_hook( $file, $function ) {
1228
+function wordpoints_register_module_activation_hook($file, $function) {
1229 1229
 
1230
-	$module_file = wordpoints_module_basename( $file );
1230
+	$module_file = wordpoints_module_basename($file);
1231 1231
 
1232
-	add_action( "wordpoints_module_activate-{$module_file}", $function );
1232
+	add_action("wordpoints_module_activate-{$module_file}", $function);
1233 1233
 }
1234 1234
 
1235 1235
 /**
@@ -1240,11 +1240,11 @@  discard block
 block discarded – undo
1240 1240
  * @param string $file     The main file of the module the hook is for.
1241 1241
  * @param string $function The callback function.
1242 1242
  */
1243
-function wordpoints_register_module_deactivation_hook( $file, $function ) {
1243
+function wordpoints_register_module_deactivation_hook($file, $function) {
1244 1244
 
1245
-	$module_file = wordpoints_module_basename( $file );
1245
+	$module_file = wordpoints_module_basename($file);
1246 1246
 
1247
-	add_action( "wordpoints_deactivate_module-{$module_file}", $function );
1247
+	add_action("wordpoints_deactivate_module-{$module_file}", $function);
1248 1248
 }
1249 1249
 
1250 1250
 // EOF
Please login to merge, or discard this patch.
src/includes/class-un-installer-base.php 1 patch
Spacing   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 	 * @param string $slug    The slug of the entity.
286 286
 	 * @param string $version The current code version of the entity.
287 287
 	 */
288
-	public function __construct( $slug = null, $version = null ) {
288
+	public function __construct($slug = null, $version = null) {
289 289
 
290
-		if ( ! isset( $slug ) ) {
291
-			_doing_it_wrong( __METHOD__, 'The $slug parameter is required.', '2.0.0' );
290
+		if ( ! isset($slug)) {
291
+			_doing_it_wrong(__METHOD__, 'The $slug parameter is required.', '2.0.0');
292 292
 		}
293 293
 
294
-		if ( ! isset( $version ) ) {
295
-			_doing_it_wrong( __METHOD__, 'The $version parameter is required.', '2.0.0' );
294
+		if ( ! isset($version)) {
295
+			_doing_it_wrong(__METHOD__, 'The $version parameter is required.', '2.0.0');
296 296
 		}
297 297
 
298 298
 		$this->slug = $slug;
299 299
 		$this->version = $version;
300 300
 
301
-		if ( isset( $this->option_prefix ) ) {
302
-			_deprecated_argument( __METHOD__, '2.0.0', 'The $option_prefix property is deprecated.' );
301
+		if (isset($this->option_prefix)) {
302
+			_deprecated_argument(__METHOD__, '2.0.0', 'The $option_prefix property is deprecated.');
303 303
 		}
304 304
 	}
305 305
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @param bool $network Whether the install should be network-wide on multisite.
312 312
 	 */
313
-	public function install( $network ) {
313
+	public function install($network) {
314 314
 
315 315
 		$this->action = 'install';
316 316
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		$hooks = wordpoints_hooks();
322 322
 		$hooks_mode = $hooks->get_current_mode();
323
-		$hooks->set_current_mode( 'standard' );
323
+		$hooks->set_current_mode('standard');
324 324
 
325 325
 		$this->before_install();
326 326
 
@@ -329,38 +329,38 @@  discard block
 block discarded – undo
329 329
 		 *
330 330
 		 * @since 1.8.0
331 331
 		 */
332
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
332
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
333 333
 
334
-		if ( is_multisite() ) {
334
+		if (is_multisite()) {
335 335
 
336 336
 			$this->context = 'network';
337
-			$hooks->set_current_mode( 'network' );
337
+			$hooks->set_current_mode('network');
338 338
 
339 339
 			$this->install_network();
340 340
 
341 341
 			$this->context = 'site';
342
-			$hooks->set_current_mode( 'standard' );
342
+			$hooks->set_current_mode('standard');
343 343
 
344
-			if ( $network ) {
344
+			if ($network) {
345 345
 
346 346
 				$this->set_network_installed();
347 347
 
348 348
 				$skip_per_site_install = $this->skip_per_site_install();
349 349
 
350
-				if ( ! ( $skip_per_site_install & self::SKIP_INSTALL ) ) {
350
+				if ( ! ($skip_per_site_install & self::SKIP_INSTALL)) {
351 351
 
352 352
 					$ms_switched_state = new WordPoints_Multisite_Switched_State();
353 353
 					$ms_switched_state->backup();
354 354
 
355
-					foreach ( $this->get_all_site_ids() as $blog_id ) {
356
-						switch_to_blog( $blog_id );
355
+					foreach ($this->get_all_site_ids() as $blog_id) {
356
+						switch_to_blog($blog_id);
357 357
 						$this->install_site();
358 358
 					}
359 359
 
360 360
 					$ms_switched_state->restore();
361 361
 				}
362 362
 
363
-				if ( $skip_per_site_install & self::REQUIRES_MANUAL_INSTALL ) {
363
+				if ($skip_per_site_install & self::REQUIRES_MANUAL_INSTALL) {
364 364
 
365 365
 					// We'll check this later and let the user know that per-site
366 366
 					// install was skipped.
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 
381 381
 		} // End if ( is_multisite() ) else.
382 382
 
383
-		$hooks->set_current_mode( $hooks_mode );
383
+		$hooks->set_current_mode($hooks_mode);
384 384
 	}
385 385
 
386 386
 	/**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @param int $site_id The ID of the site to install on.
392 392
 	 */
393
-	public function install_on_site( $site_id ) {
393
+	public function install_on_site($site_id) {
394 394
 
395 395
 		$this->action = 'install';
396 396
 		$this->network_wide = true;
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
 		$hooks = wordpoints_hooks();
401 401
 		$hooks_mode = $hooks->get_current_mode();
402
-		$hooks->set_current_mode( 'standard' );
402
+		$hooks->set_current_mode('standard');
403 403
 
404 404
 		$this->before_install();
405 405
 
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		 *
409 409
 		 * @since 1.8.0
410 410
 		 */
411
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
411
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
412 412
 
413 413
 		$this->context = 'site';
414 414
 
415
-		switch_to_blog( $site_id );
415
+		switch_to_blog($site_id);
416 416
 		$this->install_site();
417 417
 		restore_current_blog();
418 418
 
419
-		$hooks->set_current_mode( $hooks_mode );
419
+		$hooks->set_current_mode($hooks_mode);
420 420
 	}
421 421
 
422 422
 	/**
@@ -435,13 +435,13 @@  discard block
 block discarded – undo
435 435
 
436 436
 		$hooks = wordpoints_hooks();
437 437
 		$hooks_mode = $hooks->get_current_mode();
438
-		$hooks->set_current_mode( 'standard' );
438
+		$hooks->set_current_mode('standard');
439 439
 
440 440
 		$this->before_uninstall();
441 441
 
442
-		if ( is_multisite() ) {
442
+		if (is_multisite()) {
443 443
 
444
-			if ( $this->do_per_site_uninstall() ) {
444
+			if ($this->do_per_site_uninstall()) {
445 445
 
446 446
 				$this->context = 'site';
447 447
 
@@ -450,22 +450,22 @@  discard block
 block discarded – undo
450 450
 
451 451
 				$site_ids = $this->get_installed_site_ids();
452 452
 
453
-				if ( ! $this->is_network_installed() ) {
454
-					$site_ids = $this->validate_site_ids( $site_ids );
453
+				if ( ! $this->is_network_installed()) {
454
+					$site_ids = $this->validate_site_ids($site_ids);
455 455
 				}
456 456
 
457
-				foreach ( $site_ids as $blog_id ) {
458
-					switch_to_blog( $blog_id );
457
+				foreach ($site_ids as $blog_id) {
458
+					switch_to_blog($blog_id);
459 459
 					$this->uninstall_site();
460 460
 				}
461 461
 
462 462
 				$ms_switched_state->restore();
463 463
 
464
-				unset( $ms_switched_state, $site_ids );
464
+				unset($ms_switched_state, $site_ids);
465 465
 			}
466 466
 
467 467
 			$this->context = 'network';
468
-			$hooks->set_current_mode( 'network' );
468
+			$hooks->set_current_mode('network');
469 469
 
470 470
 			$this->uninstall_network();
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 			// If WordPoints is being uninstalled, the options will already have been
475 475
 			// deleted, and calling these methods will actually create them again.
476
-			if ( 'wordpoints' !== $this->slug ) {
476
+			if ('wordpoints' !== $this->slug) {
477 477
 				$this->unset_network_installed();
478 478
 				$this->unset_network_install_skipped();
479 479
 				$this->unset_network_update_skipped();
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
 		} // End if ( is_multisite() ) else.
488 488
 
489
-		$hooks->set_current_mode( $hooks_mode );
489
+		$hooks->set_current_mode($hooks_mode);
490 490
 	}
491 491
 
492 492
 	/**
@@ -499,24 +499,24 @@  discard block
 block discarded – undo
499 499
 	 * @param bool   $network Whether the entity is network active. Defaults to the
500 500
 	 *                        state of WordPoints itself.
501 501
 	 */
502
-	protected function prepare_to_update( $from, $to, $network ) {
502
+	protected function prepare_to_update($from, $to, $network) {
503 503
 
504 504
 		$this->action = 'update';
505 505
 
506
-		if ( null === $network ) {
506
+		if (null === $network) {
507 507
 			$network = is_wordpoints_network_active();
508 508
 		}
509 509
 
510 510
 		$this->network_wide = $network;
511
-		$this->updating_from = ( null === $from ) ? $this->get_db_version() : $from;
512
-		$this->updating_to   = ( null === $to ) ? $this->version : $to;
511
+		$this->updating_from = (null === $from) ? $this->get_db_version() : $from;
512
+		$this->updating_to   = (null === $to) ? $this->version : $to;
513 513
 
514 514
 		$updates = array();
515 515
 
516
-		foreach ( $this->updates as $version => $types ) {
516
+		foreach ($this->updates as $version => $types) {
517 517
 
518
-			if ( version_compare( $from, $version, '<' ) ) {
519
-				$updates[ str_replace( array( '.', '-' ), '_', $version ) ] = $types;
518
+			if (version_compare($from, $version, '<')) {
519
+				$updates[str_replace(array('.', '-'), '_', $version)] = $types;
520 520
 			}
521 521
 		}
522 522
 
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	 * @param bool   $network Whether the entity is network active. Defaults to the
534 534
 	 *                        state of WordPoints itself.
535 535
 	 */
536
-	public function update( $from = null, $to = null, $network = null ) {
536
+	public function update($from = null, $to = null, $network = null) {
537 537
 
538
-		$this->prepare_to_update( $from, $to, $network );
538
+		$this->prepare_to_update($from, $to, $network);
539 539
 
540
-		if ( empty( $this->updates ) ) {
540
+		if (empty($this->updates)) {
541 541
 			return;
542 542
 		}
543 543
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
 		$hooks = wordpoints_hooks();
547 547
 		$hooks_mode = $hooks->get_current_mode();
548
-		$hooks->set_current_mode( 'standard' );
548
+		$hooks->set_current_mode('standard');
549 549
 
550 550
 		$this->before_update();
551 551
 
@@ -554,32 +554,32 @@  discard block
 block discarded – undo
554 554
 		 *
555 555
 		 * @since 1.8.0
556 556
 		 */
557
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
557
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
558 558
 
559
-		if ( is_multisite() ) {
559
+		if (is_multisite()) {
560 560
 
561 561
 			$this->context = 'network';
562
-			$hooks->set_current_mode( 'network' );
562
+			$hooks->set_current_mode('network');
563 563
 
564
-			$this->update_( 'network', $this->get_updates_for( 'network' ) );
564
+			$this->update_('network', $this->get_updates_for('network'));
565 565
 
566 566
 			$this->context = 'site';
567
-			$hooks->set_current_mode( 'standard' );
567
+			$hooks->set_current_mode('standard');
568 568
 
569
-			if ( $this->network_wide ) {
569
+			if ($this->network_wide) {
570 570
 
571
-				$updates = $this->get_updates_for( 'site' );
571
+				$updates = $this->get_updates_for('site');
572 572
 
573
-				if ( $updates ) {
573
+				if ($updates) {
574 574
 
575
-					if ( $this->do_per_site_update() ) {
575
+					if ($this->do_per_site_update()) {
576 576
 
577 577
 						$ms_switched_state = new WordPoints_Multisite_Switched_State();
578 578
 						$ms_switched_state->backup();
579 579
 
580
-						foreach ( $this->get_installed_site_ids() as $blog_id ) {
581
-							switch_to_blog( $blog_id );
582
-							$this->update_( 'site', $updates );
580
+						foreach ($this->get_installed_site_ids() as $blog_id) {
581
+							switch_to_blog($blog_id);
582
+							$this->update_('site', $updates);
583 583
 						}
584 584
 
585 585
 						$ms_switched_state->restore();
@@ -594,19 +594,19 @@  discard block
 block discarded – undo
594 594
 
595 595
 			} else {
596 596
 
597
-				$this->update_( 'site', $this->get_updates_for( 'site' ) );
597
+				$this->update_('site', $this->get_updates_for('site'));
598 598
 			}
599 599
 
600 600
 		} else {
601 601
 
602 602
 			$this->context = 'single';
603
-			$this->update_( 'single', $this->get_updates_for( 'single' ) );
603
+			$this->update_('single', $this->get_updates_for('single'));
604 604
 
605 605
 		} // End if ( is_multisite() ) else.
606 606
 
607 607
 		$this->after_update();
608 608
 
609
-		$hooks->set_current_mode( $hooks_mode );
609
+		$hooks->set_current_mode($hooks_mode);
610 610
 	}
611 611
 
612 612
 	//
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	protected function no_interruptions() {
622 622
 
623
-		ignore_user_abort( true );
623
+		ignore_user_abort(true);
624 624
 
625
-		if ( ! wordpoints_is_function_disabled( 'set_time_limit' ) ) {
626
-			set_time_limit( 0 );
625
+		if ( ! wordpoints_is_function_disabled('set_time_limit')) {
626
+			set_time_limit(0);
627 627
 		}
628 628
 	}
629 629
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 	 */
639 639
 	protected function skip_per_site_install() {
640 640
 
641
-		return ( wp_is_large_network() )
641
+		return (wp_is_large_network())
642 642
 			? self::SKIP_INSTALL | self::REQUIRES_MANUAL_INSTALL
643 643
 			: self::DO_INSTALL;
644 644
 	}
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 	 */
674 674
 	protected function get_all_site_ids() {
675 675
 
676
-		$site_ids = get_site_transient( 'wordpoints_all_site_ids' );
676
+		$site_ids = get_site_transient('wordpoints_all_site_ids');
677 677
 
678
-		if ( ! $site_ids ) {
678
+		if ( ! $site_ids) {
679 679
 
680 680
 			$site_ids = get_sites(
681 681
 				array(
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 				)
686 686
 			);
687 687
 
688
-			set_site_transient( 'wordpoints_all_site_ids', $site_ids, 2 * MINUTE_IN_SECONDS );
688
+			set_site_transient('wordpoints_all_site_ids', $site_ids, 2 * MINUTE_IN_SECONDS);
689 689
 		}
690 690
 
691 691
 		return $site_ids;
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
 	 * @param string $option The name of the option to set.
700 700
 	 * @param mixed  $value  The value of the option.
701 701
 	 */
702
-	private function _set_option( $option, $value = true ) {
702
+	private function _set_option($option, $value = true) {
703 703
 
704
-		if ( isset( $this->option_prefix ) ) {
704
+		if (isset($this->option_prefix)) {
705 705
 
706
-			update_site_option( "{$this->option_prefix}{$option}", $value );
706
+			update_site_option("{$this->option_prefix}{$option}", $value);
707 707
 
708 708
 		} else {
709 709
 
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 				, 'site'
713 713
 			);
714 714
 
715
-			$data[ $this->type ][ $this->slug ] = $value;
715
+			$data[$this->type][$this->slug] = $value;
716 716
 
717
-			update_site_option( "wordpoints_{$option}", $data );
717
+			update_site_option("wordpoints_{$option}", $data);
718 718
 		}
719 719
 	}
720 720
 
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @param string $option The name of the option to delete.
727 727
 	 */
728
-	private function _unset_option( $option ) {
728
+	private function _unset_option($option) {
729 729
 
730
-		if ( isset( $this->option_prefix ) ) {
730
+		if (isset($this->option_prefix)) {
731 731
 
732
-			delete_site_option( "{$this->option_prefix}{$option}" );
732
+			delete_site_option("{$this->option_prefix}{$option}");
733 733
 
734 734
 		} else {
735 735
 
@@ -738,9 +738,9 @@  discard block
 block discarded – undo
738 738
 				, 'site'
739 739
 			);
740 740
 
741
-			unset( $data[ $this->type ][ $this->slug ] );
741
+			unset($data[$this->type][$this->slug]);
742 742
 
743
-			update_site_option( "wordpoints_{$option}", $data );
743
+			update_site_option("wordpoints_{$option}", $data);
744 744
 		}
745 745
 	}
746 746
 
@@ -753,9 +753,9 @@  discard block
 block discarded – undo
753 753
 	 */
754 754
 	protected function is_network_installed() {
755 755
 
756
-		if ( isset( $this->option_prefix ) ) {
756
+		if (isset($this->option_prefix)) {
757 757
 
758
-			return (bool) get_site_option( "{$this->option_prefix}network_installed" );
758
+			return (bool) get_site_option("{$this->option_prefix}network_installed");
759 759
 
760 760
 		} else {
761 761
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 				, 'site'
765 765
 			);
766 766
 
767
-			return isset( $network_installed[ $this->type ][ $this->slug ] );
767
+			return isset($network_installed[$this->type][$this->slug]);
768 768
 		}
769 769
 	}
770 770
 
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 * @since 2.0.0
775 775
 	 */
776 776
 	protected function set_network_installed() {
777
-		$this->_set_option( 'network_installed' );
777
+		$this->_set_option('network_installed');
778 778
 	}
779 779
 
780 780
 	/**
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 	 * @since 2.0.0
784 784
 	 */
785 785
 	protected function unset_network_installed() {
786
-		$this->_unset_option( 'network_installed' );
786
+		$this->_unset_option('network_installed');
787 787
 	}
788 788
 
789 789
 	/**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	 * @since 2.0.0
793 793
 	 */
794 794
 	protected function set_network_install_skipped() {
795
-		$this->_set_option( 'network_install_skipped' );
795
+		$this->_set_option('network_install_skipped');
796 796
 	}
797 797
 
798 798
 	/**
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 * @since 2.0.0
802 802
 	 */
803 803
 	protected function unset_network_install_skipped() {
804
-		$this->_unset_option( 'network_install_skipped' );
804
+		$this->_unset_option('network_install_skipped');
805 805
 	}
806 806
 
807 807
 	/**
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 * @since 2.0.0
811 811
 	 */
812 812
 	protected function set_network_update_skipped() {
813
-		$this->_set_option( 'network_update_skipped', $this->updating_from );
813
+		$this->_set_option('network_update_skipped', $this->updating_from);
814 814
 	}
815 815
 
816 816
 	/**
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 	 * @since 2.0.0
820 820
 	 */
821 821
 	protected function unset_network_update_skipped() {
822
-		$this->_unset_option( 'network_update_skipped' );
822
+		$this->_unset_option('network_update_skipped');
823 823
 	}
824 824
 
825 825
 	/**
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
 	 */
834 834
 	protected function do_per_site_uninstall() {
835 835
 
836
-		if ( wp_is_large_network() ) {
836
+		if (wp_is_large_network()) {
837 837
 
838
-			if ( $this->is_network_installed() ) {
838
+			if ($this->is_network_installed()) {
839 839
 				return false;
840
-			} elseif ( count( $this->get_installed_site_ids() ) > 10000 ) {
840
+			} elseif (count($this->get_installed_site_ids()) > 10000) {
841 841
 				return false;
842 842
 			}
843 843
 		}
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	 */
857 857
 	protected function do_per_site_update() {
858 858
 
859
-		if ( $this->is_network_installed() && wp_is_large_network() ) {
859
+		if ($this->is_network_installed() && wp_is_large_network()) {
860 860
 			return false;
861 861
 		}
862 862
 
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 	 */
873 873
 	private function _get_installed_site_ids_option_name() {
874 874
 
875
-		if ( isset( $this->option_prefix ) ) {
875
+		if (isset($this->option_prefix)) {
876 876
 			$option_prefix = $this->option_prefix;
877
-		} elseif ( 'wordpoints' === $this->slug ) {
877
+		} elseif ('wordpoints' === $this->slug) {
878 878
 			$option_prefix = 'wordpoints_';
879
-		} elseif ( 'component' === $this->type ) {
879
+		} elseif ('component' === $this->type) {
880 880
 			$option_prefix = "wordpoints_{$this->slug}_";
881 881
 		} else {
882 882
 			$option_prefix = "wordpoints_{$this->type}_{$this->slug}_";
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 	 */
895 895
 	protected function get_installed_site_ids() {
896 896
 
897
-		if ( $this->is_network_installed() ) {
897
+		if ($this->is_network_installed()) {
898 898
 			$sites = $this->get_all_site_ids();
899 899
 		} else {
900 900
 			$sites = wordpoints_get_array_option(
@@ -913,18 +913,18 @@  discard block
 block discarded – undo
913 913
 	 *
914 914
 	 * @param int $id The ID of the site to add. Defaults to the current site's ID.
915 915
 	 */
916
-	protected function add_installed_site_id( $id = null ) {
916
+	protected function add_installed_site_id($id = null) {
917 917
 
918
-		if ( empty( $id ) ) {
918
+		if (empty($id)) {
919 919
 			$id = get_current_blog_id();
920 920
 		}
921 921
 
922 922
 		$option_name = $this->_get_installed_site_ids_option_name();
923 923
 
924
-		$sites = wordpoints_get_array_option( $option_name, 'site' );
924
+		$sites = wordpoints_get_array_option($option_name, 'site');
925 925
 		$sites[] = $id;
926 926
 
927
-		update_site_option( $option_name, $sites );
927
+		update_site_option($option_name, $sites);
928 928
 	}
929 929
 
930 930
 	/**
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	 * @since 2.0.0
934 934
 	 */
935 935
 	protected function delete_installed_site_ids() {
936
-		delete_site_option( $this->_get_installed_site_ids_option_name() );
936
+		delete_site_option($this->_get_installed_site_ids_option_name());
937 937
 	}
938 938
 
939 939
 	/**
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return array The validated site IDs.
947 947
 	 */
948
-	protected function validate_site_ids( $site_ids ) {
948
+	protected function validate_site_ids($site_ids) {
949 949
 
950
-		if ( empty( $site_ids ) || ! is_array( $site_ids ) ) {
950
+		if (empty($site_ids) || ! is_array($site_ids)) {
951 951
 			return array();
952 952
 		}
953 953
 
@@ -976,20 +976,20 @@  discard block
 block discarded – undo
976 976
 	 */
977 977
 	protected function get_db_version() {
978 978
 
979
-		if ( $this->network_wide ) {
980
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' );
979
+		if ($this->network_wide) {
980
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site');
981 981
 		} else {
982
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' );
982
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data');
983 983
 		}
984 984
 
985
-		if ( 'wordpoints' === $this->slug ) {
985
+		if ('wordpoints' === $this->slug) {
986 986
 
987
-			if ( isset( $wordpoints_data['version'] ) ) {
987
+			if (isset($wordpoints_data['version'])) {
988 988
 				return $wordpoints_data['version'];
989 989
 			}
990 990
 
991
-		} elseif ( isset( $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'] ) ) {
992
-			return $wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'];
991
+		} elseif (isset($wordpoints_data["{$this->type}s"][$this->slug]['version'])) {
992
+			return $wordpoints_data["{$this->type}s"][$this->slug]['version'];
993 993
 		}
994 994
 
995 995
 		return false;
@@ -1003,28 +1003,28 @@  discard block
 block discarded – undo
1003 1003
 	 *
1004 1004
 	 * @param string $version The version of the entity.
1005 1005
 	 */
1006
-	protected function set_db_version( $version = null ) {
1006
+	protected function set_db_version($version = null) {
1007 1007
 
1008
-		if ( null === $version ) {
1008
+		if (null === $version) {
1009 1009
 			$version = $this->version;
1010 1010
 		}
1011 1011
 
1012
-		if ( $this->network_wide ) {
1013
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' );
1012
+		if ($this->network_wide) {
1013
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site');
1014 1014
 		} else {
1015
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' );
1015
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data');
1016 1016
 		}
1017 1017
 
1018
-		if ( 'wordpoints' === $this->slug ) {
1018
+		if ('wordpoints' === $this->slug) {
1019 1019
 			$wordpoints_data['version'] = $version;
1020 1020
 		} else {
1021
-			$wordpoints_data[ "{$this->type}s" ][ $this->slug ]['version'] = $version;
1021
+			$wordpoints_data["{$this->type}s"][$this->slug]['version'] = $version;
1022 1022
 		}
1023 1023
 
1024
-		if ( $this->network_wide ) {
1025
-			update_site_option( 'wordpoints_data', $wordpoints_data );
1024
+		if ($this->network_wide) {
1025
+			update_site_option('wordpoints_data', $wordpoints_data);
1026 1026
 		} else {
1027
-			update_option( 'wordpoints_data', $wordpoints_data );
1027
+			update_option('wordpoints_data', $wordpoints_data);
1028 1028
 		}
1029 1029
 	}
1030 1030
 
@@ -1036,22 +1036,22 @@  discard block
 block discarded – undo
1036 1036
 	protected function unset_db_version() {
1037 1037
 
1038 1038
 		// The whole option will be deleted when WordPoints is uninstalled.
1039
-		if ( 'wordpoints' === $this->slug ) {
1039
+		if ('wordpoints' === $this->slug) {
1040 1040
 			return;
1041 1041
 		}
1042 1042
 
1043
-		if ( 'network' === $this->context ) {
1044
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data', 'site' );
1043
+		if ('network' === $this->context) {
1044
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data', 'site');
1045 1045
 		} else {
1046
-			$wordpoints_data = wordpoints_get_array_option( 'wordpoints_data' );
1046
+			$wordpoints_data = wordpoints_get_array_option('wordpoints_data');
1047 1047
 		}
1048 1048
 
1049
-		unset( $wordpoints_data[ "{$this->type}s" ][ $this->slug ] );
1049
+		unset($wordpoints_data["{$this->type}s"][$this->slug]);
1050 1050
 
1051
-		if ( 'network' === $this->context ) {
1052
-			update_site_option( 'wordpoints_data', $wordpoints_data );
1051
+		if ('network' === $this->context) {
1052
+			update_site_option('wordpoints_data', $wordpoints_data);
1053 1053
 		} else {
1054
-			update_option( 'wordpoints_data', $wordpoints_data );
1054
+			update_option('wordpoints_data', $wordpoints_data);
1055 1055
 		}
1056 1056
 	}
1057 1057
 
@@ -1066,19 +1066,19 @@  discard block
 block discarded – undo
1066 1066
 	 * @param string $component The component's slug.
1067 1067
 	 * @param string $version   The installed component version.
1068 1068
 	 */
1069
-	protected function set_component_version( $component, $version ) {
1069
+	protected function set_component_version($component, $version) {
1070 1070
 
1071
-		_deprecated_function( __METHOD__, '2.0.0', '::set_db_version()' );
1071
+		_deprecated_function(__METHOD__, '2.0.0', '::set_db_version()');
1072 1072
 
1073 1073
 		$wordpoints_data = wordpoints_get_maybe_network_array_option(
1074 1074
 			'wordpoints_data'
1075 1075
 		);
1076 1076
 
1077
-		if ( empty( $wordpoints_data['components'][ $component ]['version'] ) ) {
1078
-			$wordpoints_data['components'][ $component ]['version'] = $version;
1077
+		if (empty($wordpoints_data['components'][$component]['version'])) {
1078
+			$wordpoints_data['components'][$component]['version'] = $version;
1079 1079
 		}
1080 1080
 
1081
-		wordpoints_update_maybe_network_option( 'wordpoints_data', $wordpoints_data );
1081
+		wordpoints_update_maybe_network_option('wordpoints_data', $wordpoints_data);
1082 1082
 	}
1083 1083
 
1084 1084
 	/**
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
 	 */
1089 1089
 	protected function maybe_load_custom_caps() {
1090 1090
 
1091
-		if ( empty( $this->custom_caps_getter ) ) {
1091
+		if (empty($this->custom_caps_getter)) {
1092 1092
 			return;
1093 1093
 		}
1094 1094
 
1095
-		$this->custom_caps = call_user_func( $this->custom_caps_getter );
1096
-		$this->custom_caps_keys = array_keys( $this->custom_caps );
1095
+		$this->custom_caps = call_user_func($this->custom_caps_getter);
1096
+		$this->custom_caps_keys = array_keys($this->custom_caps);
1097 1097
 
1098
-		if ( 'uninstall' === $this->action ) {
1098
+		if ('uninstall' === $this->action) {
1099 1099
 			$this->uninstall['local']['custom_caps'] = true;
1100 1100
 		}
1101 1101
 	}
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 	 * @since 1.8.0
1107 1107
 	 */
1108 1108
 	protected function before_install() {
1109
-		$this->map_shortcuts( 'schema' );
1109
+		$this->map_shortcuts('schema');
1110 1110
 		$this->maybe_load_custom_caps();
1111 1111
 	}
1112 1112
 
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	protected function install_custom_caps() {
1119 1119
 
1120
-		if ( ! empty( $this->custom_caps ) ) {
1121
-			wordpoints_add_custom_caps( $this->custom_caps );
1120
+		if ( ! empty($this->custom_caps)) {
1121
+			wordpoints_add_custom_caps($this->custom_caps);
1122 1122
 		}
1123 1123
 	}
1124 1124
 
@@ -1131,8 +1131,8 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
 		$schema = $this->get_db_schema();
1133 1133
 
1134
-		if ( ! empty( $schema ) ) {
1135
-			dbDelta( $schema );
1134
+		if ( ! empty($schema)) {
1135
+			dbDelta($schema);
1136 1136
 		}
1137 1137
 	}
1138 1138
 
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 	 */
1146 1146
 	public function get_db_schema() {
1147 1147
 
1148
-		if ( ! isset( $this->schema[ $this->context ]['tables'] ) ) {
1148
+		if ( ! isset($this->schema[$this->context]['tables'])) {
1149 1149
 			return '';
1150 1150
 		}
1151 1151
 
@@ -1155,16 +1155,16 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		$charset_collate = $wpdb->get_charset_collate();
1157 1157
 
1158
-		if ( 'site' === $this->context ) {
1158
+		if ('site' === $this->context) {
1159 1159
 			$prefix = $wpdb->prefix;
1160 1160
 		} else {
1161 1161
 			$prefix = $wpdb->base_prefix;
1162 1162
 		}
1163 1163
 
1164
-		foreach ( $this->schema[ $this->context ]['tables'] as $table_name => $table_schema ) {
1164
+		foreach ($this->schema[$this->context]['tables'] as $table_name => $table_schema) {
1165 1165
 
1166
-			$table_name   = str_replace( '`', '``', $table_name );
1167
-			$table_schema = trim( $table_schema );
1166
+			$table_name   = str_replace('`', '``', $table_name);
1167
+			$table_schema = trim($table_schema);
1168 1168
 
1169 1169
 			$schema .= "CREATE TABLE {$prefix}{$table_name} (
1170 1170
 				{$table_schema}
@@ -1184,31 +1184,31 @@  discard block
 block discarded – undo
1184 1184
 		$this->maybe_load_custom_caps();
1185 1185
 
1186 1186
 		$this->prepare_uninstall_list_tables();
1187
-		$this->prepare_uninstall_non_per_site_items( 'meta_boxes' );
1188
-		$this->map_uninstall_shortcut( 'widgets', 'options', array( 'prefix' => 'widget_' ) );
1189
-		$this->map_uninstall_shortcut( 'points_hooks', 'options', array( 'prefix' => 'wordpoints_hook-' ) );
1187
+		$this->prepare_uninstall_non_per_site_items('meta_boxes');
1188
+		$this->map_uninstall_shortcut('widgets', 'options', array('prefix' => 'widget_'));
1189
+		$this->map_uninstall_shortcut('points_hooks', 'options', array('prefix' => 'wordpoints_hook-'));
1190 1190
 
1191 1191
 		// Add any tables to uninstall based on the db schema.
1192
-		foreach ( $this->schema as $context => $schema ) {
1192
+		foreach ($this->schema as $context => $schema) {
1193 1193
 
1194
-			if ( ! isset( $schema['tables'] ) ) {
1194
+			if ( ! isset($schema['tables'])) {
1195 1195
 				continue;
1196 1196
 			}
1197 1197
 
1198
-			if ( ! isset( $this->uninstall[ $context ]['tables'] ) ) {
1199
-				$this->uninstall[ $context ]['tables'] = array();
1198
+			if ( ! isset($this->uninstall[$context]['tables'])) {
1199
+				$this->uninstall[$context]['tables'] = array();
1200 1200
 			}
1201 1201
 
1202
-			$this->uninstall[ $context ]['tables'] = array_unique(
1202
+			$this->uninstall[$context]['tables'] = array_unique(
1203 1203
 				array_merge(
1204
-					$this->uninstall[ $context ]['tables']
1205
-					, array_keys( $schema['tables'] )
1204
+					$this->uninstall[$context]['tables']
1205
+					, array_keys($schema['tables'])
1206 1206
 				)
1207 1207
 			);
1208 1208
 		}
1209 1209
 
1210 1210
 		// This *must* happen *after* the schema and list tables args are parsed.
1211
-		$this->map_shortcuts( 'uninstall' );
1211
+		$this->map_shortcuts('uninstall');
1212 1212
 	}
1213 1213
 
1214 1214
 	/**
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 	 */
1243 1243
 	protected function prepare_uninstall_list_tables() {
1244 1244
 
1245
-		if ( ! isset( $this->uninstall['list_tables'] ) ) {
1245
+		if ( ! isset($this->uninstall['list_tables'])) {
1246 1246
 			return;
1247 1247
 		}
1248 1248
 
@@ -1253,17 +1253,17 @@  discard block
 block discarded – undo
1253 1253
 		);
1254 1254
 
1255 1255
 		// Loop through all of the list table screens.
1256
-		foreach ( $this->uninstall['list_tables'] as $screen_id => $args ) {
1256
+		foreach ($this->uninstall['list_tables'] as $screen_id => $args) {
1257 1257
 
1258 1258
 			// Back-compat for pre-2.1.0.
1259
-			if ( isset( $args['parent'] ) && '_page' === substr( $args['parent'], -5 /* _page */ ) ) {
1260
-				$args['parent'] = substr( $args['parent'], 0, -5 );
1259
+			if (isset($args['parent']) && '_page' === substr($args['parent'], -5 /* _page */)) {
1260
+				$args['parent'] = substr($args['parent'], 0, -5);
1261 1261
 			}
1262 1262
 
1263
-			$this->uninstall['universal']['list_tables'][ $screen_id ] = $args;
1263
+			$this->uninstall['universal']['list_tables'][$screen_id] = $args;
1264 1264
 		}
1265 1265
 
1266
-		$this->prepare_uninstall_non_per_site_items( 'list_tables' );
1266
+		$this->prepare_uninstall_non_per_site_items('list_tables');
1267 1267
 	}
1268 1268
 
1269 1269
 	/**
@@ -1281,22 +1281,22 @@  discard block
 block discarded – undo
1281 1281
 	 *
1282 1282
 	 * @param string $items_key The key name of the items in the uninstall[*] arrays.
1283 1283
 	 */
1284
-	protected function prepare_uninstall_non_per_site_items( $items_key ) {
1284
+	protected function prepare_uninstall_non_per_site_items($items_key) {
1285 1285
 
1286
-		if ( isset( $this->uninstall['universal'][ $items_key ] ) ) {
1286
+		if (isset($this->uninstall['universal'][$items_key])) {
1287 1287
 
1288
-			$this->uninstall['global'][ $items_key ]
1289
-				= $this->uninstall['universal'][ $items_key ];
1288
+			$this->uninstall['global'][$items_key]
1289
+				= $this->uninstall['universal'][$items_key];
1290 1290
 
1291
-			unset( $this->uninstall['universal'][ $items_key ] );
1291
+			unset($this->uninstall['universal'][$items_key]);
1292 1292
 		}
1293 1293
 
1294
-		if ( isset( $this->uninstall['site'][ $items_key ] ) ) {
1294
+		if (isset($this->uninstall['site'][$items_key])) {
1295 1295
 
1296
-			$this->uninstall['network'][ $items_key ]
1297
-				= $this->uninstall['site'][ $items_key ];
1296
+			$this->uninstall['network'][$items_key]
1297
+				= $this->uninstall['site'][$items_key];
1298 1298
 
1299
-			unset( $this->uninstall['site'][ $items_key ] );
1299
+			unset($this->uninstall['site'][$items_key]);
1300 1300
 		}
1301 1301
 	}
1302 1302
 
@@ -1333,20 +1333,20 @@  discard block
 block discarded – undo
1333 1333
 	 *                             adding to them to the canonical array.
1334 1334
 	 * }
1335 1335
 	 */
1336
-	protected function map_uninstall_shortcut( $shortcut, $canonical, $args ) {
1336
+	protected function map_uninstall_shortcut($shortcut, $canonical, $args) {
1337 1337
 
1338
-		$args = array_merge( array( 'prefix' => '' ), $args );
1338
+		$args = array_merge(array('prefix' => ''), $args);
1339 1339
 
1340
-		$types = array( 'single', 'site', 'network', 'local', 'global', 'universal' );
1340
+		$types = array('single', 'site', 'network', 'local', 'global', 'universal');
1341 1341
 
1342
-		foreach ( $types as $type ) {
1342
+		foreach ($types as $type) {
1343 1343
 
1344
-			if ( ! isset( $this->uninstall[ $type ][ $shortcut ] ) ) {
1344
+			if ( ! isset($this->uninstall[$type][$shortcut])) {
1345 1345
 				continue;
1346 1346
 			}
1347 1347
 
1348
-			foreach ( $this->uninstall[ $type ][ $shortcut ] as $slug ) {
1349
-				$this->uninstall[ $type ][ $canonical ][] = $args['prefix'] . $slug;
1348
+			foreach ($this->uninstall[$type][$shortcut] as $slug) {
1349
+				$this->uninstall[$type][$canonical][] = $args['prefix'] . $slug;
1350 1350
 			}
1351 1351
 		}
1352 1352
 	}
@@ -1366,28 +1366,28 @@  discard block
 block discarded – undo
1366 1366
 	 *
1367 1367
 	 * @param string $type The type of shortcuts to map. Corresponds to a member var.
1368 1368
 	 */
1369
-	protected function map_shortcuts( $type ) {
1369
+	protected function map_shortcuts($type) {
1370 1370
 
1371 1371
 		// shortcut => canonicals
1372 1372
 		$map = array(
1373
-			'local'     => array( 'single', 'site', /*  -  */ ),
1374
-			'global'    => array( 'single', /* - */ 'network' ),
1375
-			'universal' => array( 'single', 'site', 'network' ),
1373
+			'local'     => array('single', 'site', /*  -  */),
1374
+			'global'    => array('single', /* - */ 'network'),
1375
+			'universal' => array('single', 'site', 'network'),
1376 1376
 		);
1377 1377
 
1378 1378
 		$this->$type = array_merge(
1379 1379
 			array_fill_keys(
1380
-				array( 'single', 'site', 'network', 'local', 'global', 'universal' )
1380
+				array('single', 'site', 'network', 'local', 'global', 'universal')
1381 1381
 				, array()
1382 1382
 			)
1383 1383
 			, $this->$type
1384 1384
 		);
1385 1385
 
1386
-		foreach ( $map as $shortcut => $canonicals ) {
1387
-			foreach ( $canonicals as $canonical ) {
1388
-				$this->{$type}[ $canonical ] = array_merge_recursive(
1389
-					$this->{$type}[ $canonical ]
1390
-					, $this->{$type}[ $shortcut ]
1386
+		foreach ($map as $shortcut => $canonicals) {
1387
+			foreach ($canonicals as $canonical) {
1388
+				$this->{$type}[$canonical] = array_merge_recursive(
1389
+					$this->{$type}[$canonical]
1390
+					, $this->{$type}[$shortcut]
1391 1391
 				);
1392 1392
 			}
1393 1393
 		}
@@ -1418,9 +1418,9 @@  discard block
 block discarded – undo
1418 1418
 	 *
1419 1419
 	 * @return array The versions that request this type of update.
1420 1420
 	 */
1421
-	protected function get_updates_for( $type ) {
1421
+	protected function get_updates_for($type) {
1422 1422
 
1423
-		return array_keys( wp_list_filter( $this->updates, array( $type => true ) ) );
1423
+		return array_keys(wp_list_filter($this->updates, array($type => true)));
1424 1424
 	}
1425 1425
 
1426 1426
 	/**
@@ -1431,9 +1431,9 @@  discard block
 block discarded – undo
1431 1431
 	 * @param string $type     The type of update to run.
1432 1432
 	 * @param array  $versions The versions to run this type of update for.
1433 1433
 	 */
1434
-	protected function update_( $type, $versions ) {
1434
+	protected function update_($type, $versions) {
1435 1435
 
1436
-		foreach ( $versions as $version ) {
1436
+		foreach ($versions as $version) {
1437 1437
 			$this->{"update_{$type}_to_{$version}"}();
1438 1438
 		}
1439 1439
 	}
@@ -1445,22 +1445,22 @@  discard block
 block discarded – undo
1445 1445
 	 *
1446 1446
 	 * @param string $type The type of tables to update.
1447 1447
 	 */
1448
-	protected function maybe_update_tables_to_utf8mb4( $type ) {
1448
+	protected function maybe_update_tables_to_utf8mb4($type) {
1449 1449
 
1450 1450
 		global $wpdb;
1451 1451
 
1452
-		if ( 'utf8mb4' !== $wpdb->charset ) {
1452
+		if ('utf8mb4' !== $wpdb->charset) {
1453 1453
 			return;
1454 1454
 		}
1455 1455
 
1456
-		if ( 'global' === $type || 'network' === $type ) {
1456
+		if ('global' === $type || 'network' === $type) {
1457 1457
 			$prefix = $wpdb->base_prefix;
1458 1458
 		} else {
1459 1459
 			$prefix = $wpdb->prefix;
1460 1460
 		}
1461 1461
 
1462
-		foreach ( $this->schema[ $type ]['tables'] as $table_name => $schema ) {
1463
-			maybe_convert_table_to_utf8mb4( $prefix . $table_name );
1462
+		foreach ($this->schema[$type]['tables'] as $table_name => $schema) {
1463
+			maybe_convert_table_to_utf8mb4($prefix . $table_name);
1464 1464
 		}
1465 1465
 	}
1466 1466
 
@@ -1471,9 +1471,9 @@  discard block
 block discarded – undo
1471 1471
 	 *
1472 1472
 	 * @param string $type The type of uninstallation to perform.
1473 1473
 	 */
1474
-	protected function uninstall_( $type ) {
1474
+	protected function uninstall_($type) {
1475 1475
 
1476
-		if ( empty( $this->uninstall[ $type ] ) ) {
1476
+		if (empty($this->uninstall[$type])) {
1477 1477
 			return;
1478 1478
 		}
1479 1479
 
@@ -1486,35 +1486,35 @@  discard block
 block discarded – undo
1486 1486
 				'meta_boxes'   => array(),
1487 1487
 				'list_tables'  => array(),
1488 1488
 			)
1489
-			, $this->uninstall[ $type ]
1489
+			, $this->uninstall[$type]
1490 1490
 		);
1491 1491
 
1492
-		if ( ! empty( $uninstall['custom_caps'] ) ) {
1493
-			$this->uninstall_custom_caps( $this->custom_caps_keys );
1492
+		if ( ! empty($uninstall['custom_caps'])) {
1493
+			$this->uninstall_custom_caps($this->custom_caps_keys);
1494 1494
 		}
1495 1495
 
1496
-		foreach ( $uninstall['user_meta'] as $meta_key ) {
1497
-			$this->uninstall_metadata( 'user', $meta_key );
1496
+		foreach ($uninstall['user_meta'] as $meta_key) {
1497
+			$this->uninstall_metadata('user', $meta_key);
1498 1498
 		}
1499 1499
 
1500
-		foreach ( $uninstall['options'] as $option ) {
1501
-			$this->uninstall_option( $option );
1500
+		foreach ($uninstall['options'] as $option) {
1501
+			$this->uninstall_option($option);
1502 1502
 		}
1503 1503
 
1504
-		foreach ( $uninstall['tables'] as $table ) {
1505
-			$this->uninstall_table( $table );
1504
+		foreach ($uninstall['tables'] as $table) {
1505
+			$this->uninstall_table($table);
1506 1506
 		}
1507 1507
 
1508
-		foreach ( $uninstall['comment_meta'] as $meta_key ) {
1509
-			$this->uninstall_metadata( 'comment', $meta_key );
1508
+		foreach ($uninstall['comment_meta'] as $meta_key) {
1509
+			$this->uninstall_metadata('comment', $meta_key);
1510 1510
 		}
1511 1511
 
1512
-		foreach ( $uninstall['meta_boxes'] as $screen_id => $args ) {
1513
-			$this->uninstall_meta_boxes( $screen_id, $args );
1512
+		foreach ($uninstall['meta_boxes'] as $screen_id => $args) {
1513
+			$this->uninstall_meta_boxes($screen_id, $args);
1514 1514
 		}
1515 1515
 
1516
-		foreach ( $uninstall['list_tables'] as $screen_id => $args ) {
1517
-			$this->uninstall_list_table( $screen_id, $args );
1516
+		foreach ($uninstall['list_tables'] as $screen_id => $args) {
1517
+			$this->uninstall_list_table($screen_id, $args);
1518 1518
 		}
1519 1519
 	}
1520 1520
 
@@ -1525,9 +1525,9 @@  discard block
 block discarded – undo
1525 1525
 	 *
1526 1526
 	 * @param string[] $caps The capabilities to uninstall.
1527 1527
 	 */
1528
-	protected function uninstall_custom_caps( $caps ) {
1528
+	protected function uninstall_custom_caps($caps) {
1529 1529
 
1530
-		wordpoints_remove_custom_caps( $caps );
1530
+		wordpoints_remove_custom_caps($caps);
1531 1531
 	}
1532 1532
 
1533 1533
 	/**
@@ -1538,17 +1538,17 @@  discard block
 block discarded – undo
1538 1538
 	 * @param string $type The type of metadata to uninstall, e.g., 'user', 'post'.
1539 1539
 	 * @param string $key  The metadata key to delete.
1540 1540
 	 */
1541
-	protected function uninstall_metadata( $type, $key ) {
1541
+	protected function uninstall_metadata($type, $key) {
1542 1542
 
1543
-		if ( 'user' === $type && 'site' === $this->context ) {
1543
+		if ('user' === $type && 'site' === $this->context) {
1544 1544
 			$key = $GLOBALS['wpdb']->get_blog_prefix() . $key;
1545 1545
 		}
1546 1546
 
1547
-		if ( false !== strpos( $key, '%' ) ) {
1547
+		if (false !== strpos($key, '%')) {
1548 1548
 
1549 1549
 			global $wpdb;
1550 1550
 
1551
-			$table = wordpoints_escape_mysql_identifier( _get_meta_table( $type ) );
1551
+			$table = wordpoints_escape_mysql_identifier(_get_meta_table($type));
1552 1552
 
1553 1553
 			$keys = $wpdb->get_col( // WPCS: unprepared SQL OK.
1554 1554
 				$wpdb->prepare( // WPCS: unprepared SQL OK.
@@ -1562,11 +1562,11 @@  discard block
 block discarded – undo
1562 1562
 			); // WPCS: cache pass.
1563 1563
 
1564 1564
 		} else {
1565
-			$keys = array( $key );
1565
+			$keys = array($key);
1566 1566
 		}
1567 1567
 
1568
-		foreach ( $keys as $key ) {
1569
-			delete_metadata( $type, 0, wp_slash( $key ), '', true );
1568
+		foreach ($keys as $key) {
1569
+			delete_metadata($type, 0, wp_slash($key), '', true);
1570 1570
 		}
1571 1571
 	}
1572 1572
 
@@ -1600,25 +1600,25 @@  discard block
 block discarded – undo
1600 1600
 	 *                                'meta-box-order'.
1601 1601
 	 * }
1602 1602
 	 */
1603
-	protected function uninstall_meta_boxes( $screen_id, $args ) {
1603
+	protected function uninstall_meta_boxes($screen_id, $args) {
1604 1604
 
1605 1605
 		$defaults = array(
1606 1606
 			'parent' => 'wordpoints',
1607
-			'options' => array( 'closedpostboxes', 'metaboxhidden', 'meta-box-order' ),
1607
+			'options' => array('closedpostboxes', 'metaboxhidden', 'meta-box-order'),
1608 1608
 		);
1609 1609
 
1610
-		$args = array_merge( $defaults, $args );
1611
-		$args['options'] = array_merge( $defaults['options'], $args['options'] );
1610
+		$args = array_merge($defaults, $args);
1611
+		$args['options'] = array_merge($defaults['options'], $args['options']);
1612 1612
 
1613 1613
 		// Each user gets to set the options to their liking.
1614
-		foreach ( $args['options'] as $option ) {
1614
+		foreach ($args['options'] as $option) {
1615 1615
 
1616 1616
 			$this->uninstall_metadata(
1617 1617
 				'user'
1618 1618
 				, "{$option}_{$args['parent']}_page_{$screen_id}"
1619 1619
 			);
1620 1620
 
1621
-			if ( 'network' === $this->context ) {
1621
+			if ('network' === $this->context) {
1622 1622
 				$this->uninstall_metadata(
1623 1623
 					'user'
1624 1624
 					, "{$option}_{$args['parent']}_page_{$screen_id}-network"
@@ -1659,21 +1659,21 @@  discard block
 block discarded – undo
1659 1659
 	 *                                'per_page'.
1660 1660
 	 * }
1661 1661
 	 */
1662
-	protected function uninstall_list_table( $screen_id, $args ) {
1662
+	protected function uninstall_list_table($screen_id, $args) {
1663 1663
 
1664 1664
 		$defaults = array(
1665 1665
 			'parent' => 'wordpoints',
1666
-			'options' => array( 'per_page' ),
1666
+			'options' => array('per_page'),
1667 1667
 		);
1668 1668
 
1669
-		$args = array_merge( $defaults, $args );
1669
+		$args = array_merge($defaults, $args);
1670 1670
 
1671 1671
 		$network_parent = $args['parent'];
1672 1672
 		$parent = $network_parent;
1673 1673
 
1674 1674
 		// The parent page is usually the same on a multisite site, but we need to
1675 1675
 		// handle the special case of the modules screen.
1676
-		if ( 'wordpoints_modules' === $screen_id && is_multisite() ) {
1676
+		if ('wordpoints_modules' === $screen_id && is_multisite()) {
1677 1677
 			$parent = 'toplevel';
1678 1678
 		}
1679 1679
 
@@ -1682,23 +1682,23 @@  discard block
 block discarded – undo
1682 1682
 		// Each user can hide specific columns of the table.
1683 1683
 		$meta_keys[] = "manage{$parent}_page_{$screen_id}columnshidden";
1684 1684
 
1685
-		if ( 'network' === $this->context ) {
1685
+		if ('network' === $this->context) {
1686 1686
 			$meta_keys[] = "manage{$network_parent}_page_{$screen_id}-networkcolumnshidden";
1687 1687
 		}
1688 1688
 
1689 1689
 		// Loop through each of the other options provided by this list table.
1690
-		foreach ( $args['options'] as $option ) {
1690
+		foreach ($args['options'] as $option) {
1691 1691
 
1692 1692
 			// Each user gets to set the options to their liking.
1693 1693
 			$meta_keys[]  = "{$parent}_page_{$screen_id}_{$option}";
1694 1694
 
1695
-			if ( 'network' === $this->context ) {
1695
+			if ('network' === $this->context) {
1696 1696
 				$meta_keys[] = "{$network_parent}_page_{$screen_id}_network_{$option}";
1697 1697
 			}
1698 1698
 		}
1699 1699
 
1700
-		foreach ( $meta_keys as $meta_key ) {
1701
-			$this->uninstall_metadata( 'user', $meta_key );
1700
+		foreach ($meta_keys as $meta_key) {
1701
+			$this->uninstall_metadata('user', $meta_key);
1702 1702
 		}
1703 1703
 	}
1704 1704
 
@@ -1713,14 +1713,14 @@  discard block
 block discarded – undo
1713 1713
 	 *
1714 1714
 	 * @param string $option The option to uninstall.
1715 1715
 	 */
1716
-	protected function uninstall_option( $option ) {
1716
+	protected function uninstall_option($option) {
1717 1717
 
1718
-		if ( 'network' === $this->context ) {
1719
-			$this->uninstall_network_option( $option );
1718
+		if ('network' === $this->context) {
1719
+			$this->uninstall_network_option($option);
1720 1720
 			return;
1721 1721
 		}
1722 1722
 
1723
-		if ( false !== strpos( $option, '%' ) ) {
1723
+		if (false !== strpos($option, '%')) {
1724 1724
 
1725 1725
 			global $wpdb;
1726 1726
 
@@ -1736,10 +1736,10 @@  discard block
 block discarded – undo
1736 1736
 			); // WPCS: cache pass.
1737 1737
 
1738 1738
 		} else {
1739
-			$options = array( $option );
1739
+			$options = array($option);
1740 1740
 		}
1741 1741
 
1742
-		array_map( 'delete_option', $options );
1742
+		array_map('delete_option', $options);
1743 1743
 	}
1744 1744
 
1745 1745
 	/**
@@ -1751,9 +1751,9 @@  discard block
 block discarded – undo
1751 1751
 	 *
1752 1752
 	 * @param string $option The network option to uninstall.
1753 1753
 	 */
1754
-	protected function uninstall_network_option( $option ) {
1754
+	protected function uninstall_network_option($option) {
1755 1755
 
1756
-		if ( false !== strpos( $option, '%' ) ) {
1756
+		if (false !== strpos($option, '%')) {
1757 1757
 
1758 1758
 			global $wpdb;
1759 1759
 
@@ -1771,10 +1771,10 @@  discard block
 block discarded – undo
1771 1771
 			); // WPCS: cache pass.
1772 1772
 
1773 1773
 		} else {
1774
-			$options = array( $option );
1774
+			$options = array($option);
1775 1775
 		}
1776 1776
 
1777
-		array_map( 'delete_site_option', $options );
1777
+		array_map('delete_site_option', $options);
1778 1778
 	}
1779 1779
 
1780 1780
 	/**
@@ -1784,9 +1784,9 @@  discard block
 block discarded – undo
1784 1784
 	 *
1785 1785
 	 * @param string $id_base The base ID of the widget to uninstall (class name).
1786 1786
 	 */
1787
-	protected function uninstall_widget( $id_base ) {
1787
+	protected function uninstall_widget($id_base) {
1788 1788
 
1789
-		$this->uninstall_option( "widget_{$id_base}" );
1789
+		$this->uninstall_option("widget_{$id_base}");
1790 1790
 	}
1791 1791
 
1792 1792
 	/**
@@ -1796,9 +1796,9 @@  discard block
 block discarded – undo
1796 1796
 	 *
1797 1797
 	 * @param string $id_base The base ID (class) of the points hook to uninstall.
1798 1798
 	 */
1799
-	protected function uninstall_points_hook( $id_base ) {
1799
+	protected function uninstall_points_hook($id_base) {
1800 1800
 
1801
-		$this->uninstall_option( "wordpoints_hook-{$id_base}" );
1801
+		$this->uninstall_option("wordpoints_hook-{$id_base}");
1802 1802
 	}
1803 1803
 
1804 1804
 	/**
@@ -1808,20 +1808,20 @@  discard block
 block discarded – undo
1808 1808
 	 *
1809 1809
 	 * @param string $table The name of the table to uninstall, sans DB prefix.
1810 1810
 	 */
1811
-	protected function uninstall_table( $table ) {
1811
+	protected function uninstall_table($table) {
1812 1812
 
1813 1813
 		global $wpdb;
1814 1814
 
1815 1815
 		// Null will use the current blog's prefix, 0 the base prefix.
1816
-		if ( 'site' === $this->context ) {
1816
+		if ('site' === $this->context) {
1817 1817
 			$site_id = null;
1818 1818
 		} else {
1819 1819
 			$site_id = 0;
1820 1820
 		}
1821 1821
 
1822
-		$table = str_replace( '`', '``', $table );
1822
+		$table = str_replace('`', '``', $table);
1823 1823
 
1824
-		$wpdb->query( 'DROP TABLE IF EXISTS `' . $wpdb->get_blog_prefix( $site_id ) . $table . '`' ); // WPCS: unprepared SQL, cache pass.
1824
+		$wpdb->query('DROP TABLE IF EXISTS `' . $wpdb->get_blog_prefix($site_id) . $table . '`'); // WPCS: unprepared SQL, cache pass.
1825 1825
 	}
1826 1826
 
1827 1827
 	//
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
 
1842 1842
 		$this->install_db_schema();
1843 1843
 
1844
-		if ( $this->network_wide ) {
1844
+		if ($this->network_wide) {
1845 1845
 			$this->set_db_version();
1846 1846
 		}
1847 1847
 	}
@@ -1857,11 +1857,11 @@  discard block
 block discarded – undo
1857 1857
 	 */
1858 1858
 	protected function install_site() {
1859 1859
 
1860
-		if ( isset( $this->schema['site'] ) ) {
1860
+		if (isset($this->schema['site'])) {
1861 1861
 			$this->install_db_schema();
1862 1862
 		}
1863 1863
 
1864
-		if ( ! $this->network_wide ) {
1864
+		if ( ! $this->network_wide) {
1865 1865
 			$this->set_db_version();
1866 1866
 		}
1867 1867
 
@@ -1891,10 +1891,10 @@  discard block
 block discarded – undo
1891 1891
 	 */
1892 1892
 	protected function load_base_dependencies() {
1893 1893
 
1894
-		require_once dirname( __FILE__ ) . '/constants.php';
1894
+		require_once dirname(__FILE__) . '/constants.php';
1895 1895
 		require_once WORDPOINTS_DIR . '/classes/class/autoloader.php';
1896 1896
 
1897
-		WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . '/classes' );
1897
+		WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . '/classes');
1898 1898
 
1899 1899
 		require_once WORDPOINTS_DIR . '/includes/functions.php';
1900 1900
 		require_once WORDPOINTS_DIR . '/includes/apps.php';
@@ -1921,8 +1921,8 @@  discard block
 block discarded – undo
1921 1921
 	 */
1922 1922
 	protected function uninstall_network() {
1923 1923
 
1924
-		if ( ! empty( $this->uninstall['network'] ) ) {
1925
-			$this->uninstall_( 'network' );
1924
+		if ( ! empty($this->uninstall['network'])) {
1925
+			$this->uninstall_('network');
1926 1926
 		}
1927 1927
 
1928 1928
 		$this->unset_db_version();
@@ -1939,8 +1939,8 @@  discard block
 block discarded – undo
1939 1939
 	 */
1940 1940
 	protected function uninstall_site() {
1941 1941
 
1942
-		if ( ! empty( $this->uninstall['site'] ) ) {
1943
-			$this->uninstall_( 'site' );
1942
+		if ( ! empty($this->uninstall['site'])) {
1943
+			$this->uninstall_('site');
1944 1944
 		}
1945 1945
 
1946 1946
 		$this->unset_db_version();
@@ -1957,8 +1957,8 @@  discard block
 block discarded – undo
1957 1957
 	 */
1958 1958
 	protected function uninstall_single() {
1959 1959
 
1960
-		if ( ! empty( $this->uninstall['single'] ) ) {
1961
-			$this->uninstall_( 'single' );
1960
+		if ( ! empty($this->uninstall['single'])) {
1961
+			$this->uninstall_('single');
1962 1962
 		}
1963 1963
 
1964 1964
 		$this->unset_db_version();
Please login to merge, or discard this patch.
src/classes/hook/hit/query.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 	 * @since 2.1.0
19 19
 	 */
20 20
 	protected $columns = array(
21
-		'id' => array( 'format' => '%d', 'unsigned' => true ),
22
-		'action_type' => array( 'format' => '%s' ),
23
-		'signature_arg_guids' => array( 'format' => '%s' ),
24
-		'event' => array( 'format' => '%s' ),
25
-		'reactor' => array( 'format' => '%s' ),
26
-		'reaction_mode' => array( 'format' => '%s' ),
27
-		'reaction_store' => array( 'format' => '%s' ),
28
-		'reaction_context_id' => array( 'format' => '%s' ),
29
-		'reaction_id' => array( 'format' => '%d', 'unsigned' => true ),
30
-		'date' => array( 'format' => '%s', 'is_date' => true ),
21
+		'id' => array('format' => '%d', 'unsigned' => true),
22
+		'action_type' => array('format' => '%s'),
23
+		'signature_arg_guids' => array('format' => '%s'),
24
+		'event' => array('format' => '%s'),
25
+		'reactor' => array('format' => '%s'),
26
+		'reaction_mode' => array('format' => '%s'),
27
+		'reaction_store' => array('format' => '%s'),
28
+		'reaction_context_id' => array('format' => '%s'),
29
+		'reaction_id' => array('format' => '%d', 'unsigned' => true),
30
+		'date' => array('format' => '%s', 'is_date' => true),
31 31
 	);
32 32
 
33 33
 	/**
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	 * @since 2.3.0
40 40
 	 */
41 41
 	protected $deprecated_args = array(
42
-		'primary_arg_guid'          => array( 'replacement' => 'signature_arg_guids', 'version' => '2.3.0', 'class' => __CLASS__ ),
43
-		'primary_arg_guid__compare' => array( 'replacement' => 'signature_arg_guids__compare', 'version' => '2.3.0', 'class' => __CLASS__ ),
44
-		'primary_arg_guid__in'      => array( 'replacement' => 'signature_arg_guids__in', 'version' => '2.3.0', 'class' => __CLASS__ ),
45
-		'primary_arg_guid__not_in'  => array( 'replacement' => 'signature_arg_guids__not_in', 'version' => '2.3.0', 'class' => __CLASS__ ),
42
+		'primary_arg_guid'          => array('replacement' => 'signature_arg_guids', 'version' => '2.3.0', 'class' => __CLASS__),
43
+		'primary_arg_guid__compare' => array('replacement' => 'signature_arg_guids__compare', 'version' => '2.3.0', 'class' => __CLASS__),
44
+		'primary_arg_guid__in'      => array('replacement' => 'signature_arg_guids__in', 'version' => '2.3.0', 'class' => __CLASS__),
45
+		'primary_arg_guid__not_in'  => array('replacement' => 'signature_arg_guids__not_in', 'version' => '2.3.0', 'class' => __CLASS__),
46 46
 	);
47 47
 
48 48
 	//
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *        @type array        $meta_query                   See WP_Meta_Query.
122 122
 	 * }
123 123
 	 */
124
-	public function __construct( $args = array() ) {
124
+	public function __construct($args = array()) {
125 125
 
126 126
 		global $wpdb;
127 127
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
 		$this->defaults['order_by'] = 'date';
131 131
 
132
-		parent::__construct( $args );
132
+		parent::__construct($args);
133 133
 	}
134 134
 }
135 135
 
Please login to merge, or discard this patch.
src/classes/db/query.php 1 patch
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -231,24 +231,24 @@  discard block
 block discarded – undo
231 231
 	 *        @type array        $meta_query          See WP_Meta_Query.
232 232
 	 * }
233 233
 	 */
234
-	public function __construct( $args = array() ) {
234
+	public function __construct($args = array()) {
235 235
 
236
-		foreach ( $this->deprecated_args as $arg => $data ) {
237
-			if ( isset( $args[ $arg ] ) ) {
236
+		foreach ($this->deprecated_args as $arg => $data) {
237
+			if (isset($args[$arg])) {
238 238
 
239 239
 				_deprecated_argument(
240
-					esc_html( "{$data['class']}::__construct" )
241
-					, esc_html( $data['version'] )
242
-					, esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" )
240
+					esc_html("{$data['class']}::__construct")
241
+					, esc_html($data['version'])
242
+					, esc_html("{$arg} is deprecated, use {$data['replacement']} instead")
243 243
 				);
244 244
 
245
-				$args[ $data['replacement'] ] = $args[ $arg ];
245
+				$args[$data['replacement']] = $args[$arg];
246 246
 
247
-				unset( $args[ $arg ] );
247
+				unset($args[$arg]);
248 248
 			}
249 249
 		}
250 250
 
251
-		$this->args = array_merge( $this->defaults, $args );
251
+		$this->args = array_merge($this->defaults, $args);
252 252
 	}
253 253
 
254 254
 	/**
@@ -260,21 +260,21 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return mixed|null The query arg's value, or null if it isn't set.
262 262
 	 */
263
-	public function get_arg( $arg ) {
263
+	public function get_arg($arg) {
264 264
 
265
-		if ( isset( $this->deprecated_args[ $arg ] ) ) {
265
+		if (isset($this->deprecated_args[$arg])) {
266 266
 
267 267
 			_deprecated_argument(
268
-				esc_html( "{$this->deprecated_args[ $arg ]['class']}::get_arg" )
269
-				, esc_html( $this->deprecated_args[ $arg ]['version'] )
270
-				, esc_html( "{$arg} is deprecated, use {$this->deprecated_args[ $arg ]['replacement']} instead" )
268
+				esc_html("{$this->deprecated_args[$arg]['class']}::get_arg")
269
+				, esc_html($this->deprecated_args[$arg]['version'])
270
+				, esc_html("{$arg} is deprecated, use {$this->deprecated_args[$arg]['replacement']} instead")
271 271
 			);
272 272
 
273
-			$arg = $this->deprecated_args[ $arg ]['replacement'];
273
+			$arg = $this->deprecated_args[$arg]['replacement'];
274 274
 		}
275 275
 
276
-		if ( isset( $this->args[ $arg ] ) ) {
277
-			return $this->args[ $arg ];
276
+		if (isset($this->args[$arg])) {
277
+			return $this->args[$arg];
278 278
 		} else {
279 279
 			return null;
280 280
 		}
@@ -292,24 +292,24 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @return WordPoints_DB_Query To allow for method chaining.
294 294
 	 */
295
-	public function set_args( array $args ) {
295
+	public function set_args(array $args) {
296 296
 
297
-		foreach ( $this->deprecated_args as $arg => $data ) {
298
-			if ( isset( $args[ $arg ] ) ) {
297
+		foreach ($this->deprecated_args as $arg => $data) {
298
+			if (isset($args[$arg])) {
299 299
 
300 300
 				_deprecated_argument(
301
-					esc_html( "{$data['class']}::set_args" )
302
-					, esc_html( $data['version'] )
303
-					, esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" )
301
+					esc_html("{$data['class']}::set_args")
302
+					, esc_html($data['version'])
303
+					, esc_html("{$arg} is deprecated, use {$data['replacement']} instead")
304 304
 				);
305 305
 
306
-				$args[ $data['replacement'] ] = $args[ $arg ];
306
+				$args[$data['replacement']] = $args[$arg];
307 307
 
308
-				unset( $args[ $arg ] );
308
+				unset($args[$arg]);
309 309
 			}
310 310
 		}
311 311
 
312
-		$this->args = array_merge( $this->args, $args );
312
+		$this->args = array_merge($this->args, $args);
313 313
 
314 314
 		$this->is_query_ready = false;
315 315
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
 		global $wpdb;
334 334
 
335
-		$count = (int) $wpdb->get_var( $this->get_sql( 'SELECT COUNT' ) ); // WPCS: unprepared SQL, cache OK
335
+		$count = (int) $wpdb->get_var($this->get_sql('SELECT COUNT')); // WPCS: unprepared SQL, cache OK
336 336
 
337 337
 		return $count;
338 338
 	}
@@ -347,20 +347,20 @@  discard block
 block discarded – undo
347 347
 	 *
348 348
 	 * @return mixed The results of the query, or false on failure.
349 349
 	 */
350
-	public function get( $method = 'results' ) {
350
+	public function get($method = 'results') {
351 351
 
352 352
 		global $wpdb;
353 353
 
354
-		$methods = array( 'results', 'row', 'col', 'var' );
354
+		$methods = array('results', 'row', 'col', 'var');
355 355
 
356
-		if ( ! in_array( $method, $methods ) ) {
356
+		if ( ! in_array($method, $methods)) {
357 357
 
358
-			_doing_it_wrong( __METHOD__, esc_html( sprintf( 'WordPoints Debug Error: invalid get method %s, possible values are %s', $method, implode( ', ', $methods ) ) ), '1.0.0' );
358
+			_doing_it_wrong(__METHOD__, esc_html(sprintf('WordPoints Debug Error: invalid get method %s, possible values are %s', $method, implode(', ', $methods))), '1.0.0');
359 359
 
360 360
 			return false;
361 361
 		}
362 362
 
363
-		$result = $wpdb->{"get_{$method}"}( $this->get_sql() );
363
+		$result = $wpdb->{"get_{$method}"}($this->get_sql());
364 364
 
365 365
 		return $result;
366 366
 	}
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @return string The SQL for the query.
382 382
 	 */
383
-	public function get_sql( $select_type = 'SELECT' ) {
383
+	public function get_sql($select_type = 'SELECT') {
384 384
 
385 385
 		$this->prepare_query();
386 386
 
387
-		$select = ( 'SELECT COUNT' === $select_type )
387
+		$select = ('SELECT COUNT' === $select_type)
388 388
 			? $this->select_count
389 389
 			: $this->select;
390 390
 
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @return string[] The valid columns.
414 414
 	 */
415
-	public function date_query_valid_columns_filter( $valid_columns ) {
415
+	public function date_query_valid_columns_filter($valid_columns) {
416 416
 
417 417
 		$valid_columns = array_merge(
418 418
 			$valid_columns
419 419
 			, array_keys(
420
-				wp_list_filter( $this->columns, array( 'is_date' => true ) )
420
+				wp_list_filter($this->columns, array('is_date' => true))
421 421
 			)
422 422
 		);
423 423
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	protected function prepare_query() {
437 437
 
438
-		if ( ! $this->is_query_ready ) {
438
+		if ( ! $this->is_query_ready) {
439 439
 
440 440
 			$this->prepare_select();
441 441
 			$this->prepare_where();
@@ -453,26 +453,26 @@  discard block
 block discarded – undo
453 453
 	 */
454 454
 	protected function prepare_select() {
455 455
 
456
-		$all_fields = array_keys( $this->columns );
456
+		$all_fields = array_keys($this->columns);
457 457
 		$fields = array();
458 458
 
459
-		if ( ! empty( $this->args['fields'] ) ) {
459
+		if ( ! empty($this->args['fields'])) {
460 460
 
461 461
 			$fields = (array) $this->args['fields'];
462
-			$diff   = array_diff( $fields, $all_fields );
463
-			$fields = array_intersect( $all_fields, $fields );
462
+			$diff   = array_diff($fields, $all_fields);
463
+			$fields = array_intersect($all_fields, $fields);
464 464
 
465
-			if ( ! empty( $diff ) ) {
466
-				_doing_it_wrong( __METHOD__, esc_html( 'WordPoints Debug Error: invalid field(s) "' . implode( '", "', $diff ) . '" given' ), '1.0.0' );
465
+			if ( ! empty($diff)) {
466
+				_doing_it_wrong(__METHOD__, esc_html('WordPoints Debug Error: invalid field(s) "' . implode('", "', $diff) . '" given'), '1.0.0');
467 467
 			}
468 468
 		}
469 469
 
470 470
 		// Pull all fields by default.
471
-		if ( empty( $fields ) ) {
471
+		if (empty($fields)) {
472 472
 			$fields = $all_fields;
473 473
 		}
474 474
 
475
-		$fields = implode( ', ', array_map( 'wordpoints_escape_mysql_identifier', $fields ) );
475
+		$fields = implode(', ', array_map('wordpoints_escape_mysql_identifier', $fields));
476 476
 
477 477
 		$this->select = "SELECT {$fields}";
478 478
 	}
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @return mixed The validated value, or false if invalid.
489 489
 	 */
490
-	protected function validate_value( $value, $validators ) {
490
+	protected function validate_value($value, $validators) {
491 491
 
492
-		foreach ( $validators as $validator ) {
492
+		foreach ($validators as $validator) {
493 493
 
494
-			$value = call_user_func_array( $validator, array( &$value ) );
494
+			$value = call_user_func_array($validator, array(&$value));
495 495
 
496
-			if ( false === $value ) {
496
+			if (false === $value) {
497 497
 				break;
498 498
 			}
499 499
 		}
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return array The validated values, with any invalid ones removed.
513 513
 	 */
514
-	protected function validate_values( $values, $validators ) {
514
+	protected function validate_values($values, $validators) {
515 515
 
516
-		foreach ( $values as $index => $value ) {
516
+		foreach ($values as $index => $value) {
517 517
 
518
-			$value = $this->validate_value( $value, $validators );
518
+			$value = $this->validate_value($value, $validators);
519 519
 
520
-			if ( false === $value ) {
521
-				unset( $values[ $index ] );
520
+			if (false === $value) {
521
+				unset($values[$index]);
522 522
 			}
523 523
 		}
524 524
 
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 	 *
538 538
 	 * @return int|false The validated value or false.
539 539
 	 */
540
-	protected function validate_unsigned_column( $value ) {
540
+	protected function validate_unsigned_column($value) {
541 541
 
542
-		if ( false !== wordpoints_int( $value ) && $value >= 0 ) {
542
+		if (false !== wordpoints_int($value) && $value >= 0) {
543 543
 			return $value;
544 544
 		}
545 545
 
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 	 *
556 556
 	 * @return callable[] The validation functions.
557 557
 	 */
558
-	protected function get_validators_for_column( $data ) {
558
+	protected function get_validators_for_column($data) {
559 559
 
560 560
 		$validators = array();
561 561
 
562 562
 		// Default validators for integer columns.
563
-		if ( '%d' === $data['format'] ) {
564
-			if ( ! empty( $data['unsigned'] ) ) {
565
-				$validators[] = array( $this, 'validate_unsigned_column' );
563
+		if ('%d' === $data['format']) {
564
+			if ( ! empty($data['unsigned'])) {
565
+				$validators[] = array($this, 'validate_unsigned_column');
566 566
 			} else {
567 567
 				$validators[] = 'wordpoints_int';
568 568
 			}
@@ -579,15 +579,15 @@  discard block
 block discarded – undo
579 579
 	 * @param string $column The column name.
580 580
 	 * @param array  $data   The column data.
581 581
 	 */
582
-	protected function prepare_column_where( $column, $data ) {
582
+	protected function prepare_column_where($column, $data) {
583 583
 
584 584
 		// If a single value has been supplied for the column, it takes precedence.
585
-		if ( isset( $this->args[ $column ] ) ) {
586
-			$this->prepare_column( $column, $data );
587
-		} elseif ( isset( $this->args[ "{$column}__in" ] ) ) {
588
-			$this->prepare_column__in( $column, $data );
589
-		} elseif ( isset( $this->args[ "{$column}__not_in" ] ) ) {
590
-			$this->prepare_column__in( $column, $data, 'NOT IN' );
585
+		if (isset($this->args[$column])) {
586
+			$this->prepare_column($column, $data);
587
+		} elseif (isset($this->args["{$column}__in"])) {
588
+			$this->prepare_column__in($column, $data);
589
+		} elseif (isset($this->args["{$column}__not_in"])) {
590
+			$this->prepare_column__in($column, $data, 'NOT IN');
591 591
 		}
592 592
 	}
593 593
 
@@ -599,29 +599,29 @@  discard block
 block discarded – undo
599 599
 	 * @param string $column The name of the column
600 600
 	 * @param array  $data   The column data.
601 601
 	 */
602
-	protected function prepare_column( $column, $data ) {
602
+	protected function prepare_column($column, $data) {
603 603
 
604 604
 		global $wpdb;
605 605
 
606 606
 		if (
607
-			isset( $data['values'] )
608
-			&& ! in_array( $this->args[ $column ], $data['values'], true )
607
+			isset($data['values'])
608
+			&& ! in_array($this->args[$column], $data['values'], true)
609 609
 		) {
610 610
 			return;
611 611
 		}
612 612
 
613 613
 		$value = $this->validate_value(
614
-			$this->args[ $column ]
615
-			, $this->get_validators_for_column( $data )
614
+			$this->args[$column]
615
+			, $this->get_validators_for_column($data)
616 616
 		);
617 617
 
618
-		if ( false === $value ) {
618
+		if (false === $value) {
619 619
 			return;
620 620
 		}
621 621
 
622
-		$compare = $this->get_comparator_for_column( $column, $data );
622
+		$compare = $this->get_comparator_for_column($column, $data);
623 623
 
624
-		$column = wordpoints_escape_mysql_identifier( $column );
624
+		$column = wordpoints_escape_mysql_identifier($column);
625 625
 
626 626
 		$this->wheres[] = $wpdb->prepare( // WPCS: unprepared SQL OK.
627 627
 			"{$column} {$compare} {$data['format']}"
@@ -639,23 +639,23 @@  discard block
 block discarded – undo
639 639
 	 *
640 640
 	 * @return string The comparator for the column.
641 641
 	 */
642
-	protected function get_comparator_for_column( $column, $data ) {
642
+	protected function get_comparator_for_column($column, $data) {
643 643
 
644
-		$comparisons = array( '=', '<', '>', '<>', '!=', '<=', '>=' );
644
+		$comparisons = array('=', '<', '>', '<>', '!=', '<=', '>=');
645 645
 
646 646
 		// MySQL doesn't support LIKE and NOT LIKE for int columns.
647 647
 		// See https://stackoverflow.com/q/8422455/1924128
648
-		if ( '%s' === $data['format'] ) {
649
-			$comparisons = array_merge( $comparisons, array( 'LIKE', 'NOT LIKE' ) );
648
+		if ('%s' === $data['format']) {
649
+			$comparisons = array_merge($comparisons, array('LIKE', 'NOT LIKE'));
650 650
 		}
651 651
 
652 652
 		$comparator = '=';
653 653
 
654 654
 		if (
655
-			isset( $this->args[ "{$column}__compare" ] )
656
-			&& in_array( $this->args[ "{$column}__compare" ], $comparisons, true )
655
+			isset($this->args["{$column}__compare"])
656
+			&& in_array($this->args["{$column}__compare"], $comparisons, true)
657 657
 		) {
658
-			$comparator = $this->args[ "{$column}__compare" ];
658
+			$comparator = $this->args["{$column}__compare"];
659 659
 		}
660 660
 
661 661
 		return $comparator;
@@ -670,36 +670,36 @@  discard block
 block discarded – undo
670 670
 	 * @param array  $data   The column data.
671 671
 	 * @param string $type   The type of IN clause, IN or NOT IN.
672 672
 	 */
673
-	protected function prepare_column__in( $column, $data, $type = 'IN' ) {
673
+	protected function prepare_column__in($column, $data, $type = 'IN') {
674 674
 
675
-		$key = "{$column}__" . strtolower( str_replace( ' ', '_', $type ) );
675
+		$key = "{$column}__" . strtolower(str_replace(' ', '_', $type));
676 676
 
677
-		if ( empty( $this->args[ $key ] ) || ! is_array( $this->args[ $key ] ) ) {
677
+		if (empty($this->args[$key]) || ! is_array($this->args[$key])) {
678 678
 			return;
679 679
 		}
680 680
 
681
-		$values = $this->args[ $key ];
681
+		$values = $this->args[$key];
682 682
 
683
-		if ( isset( $data['values'] ) ) {
684
-			$values = array_intersect( $values, $data['values'] );
683
+		if (isset($data['values'])) {
684
+			$values = array_intersect($values, $data['values']);
685 685
 		} else {
686 686
 			$values = $this->validate_values(
687 687
 				$values
688
-				, $this->get_validators_for_column( $data )
688
+				, $this->get_validators_for_column($data)
689 689
 			);
690 690
 		}
691 691
 
692
-		if ( empty( $values ) ) {
692
+		if (empty($values)) {
693 693
 			return;
694 694
 		}
695 695
 
696
-		$in = wordpoints_prepare__in( $values, $data['format'] );
696
+		$in = wordpoints_prepare__in($values, $data['format']);
697 697
 
698
-		if ( false === $in ) {
698
+		if (false === $in) {
699 699
 			return;
700 700
 		}
701 701
 
702
-		$column = wordpoints_escape_mysql_identifier( $column );
702
+		$column = wordpoints_escape_mysql_identifier($column);
703 703
 
704 704
 		$this->wheres[] = "{$column} {$type} ({$in})";
705 705
 	}
@@ -713,19 +713,19 @@  discard block
 block discarded – undo
713 713
 
714 714
 		$this->wheres = array();
715 715
 
716
-		foreach ( $this->columns as $column => $data ) {
716
+		foreach ($this->columns as $column => $data) {
717 717
 
718
-			if ( ! empty( $data['is_date'] ) ) {
719
-				$this->prepare_date_where( $column );
718
+			if ( ! empty($data['is_date'])) {
719
+				$this->prepare_date_where($column);
720 720
 			} else {
721
-				$this->prepare_column_where( $column, $data );
721
+				$this->prepare_column_where($column, $data);
722 722
 			}
723 723
 		}
724 724
 
725 725
 		$this->prepare_meta_where();
726 726
 
727
-		if ( ! empty( $this->wheres ) ) {
728
-			$this->where = 'WHERE ' . implode( ' AND ', $this->wheres ) . "\n";
727
+		if ( ! empty($this->wheres)) {
728
+			$this->where = 'WHERE ' . implode(' AND ', $this->wheres) . "\n";
729 729
 		}
730 730
 	}
731 731
 
@@ -738,32 +738,32 @@  discard block
 block discarded – undo
738 738
 
739 739
 		// MySQL doesn't allow for the offset without a limit, so if no limit is set
740 740
 		// we can ignore the start arg. See https://stackoverflow.com/a/271650/1924128
741
-		if ( ! isset( $this->args['limit'] ) ) {
741
+		if ( ! isset($this->args['limit'])) {
742 742
 			return;
743 743
 		}
744 744
 
745
-		foreach ( array( 'limit', 'start' ) as $key ) {
745
+		foreach (array('limit', 'start') as $key) {
746 746
 
747 747
 			// Save a backup of the arg value since wordpoints_int() is by reference.
748
-			$arg = $this->args[ $key ];
748
+			$arg = $this->args[$key];
749 749
 
750
-			if ( false === wordpoints_int( $this->args[ $key ] ) ) {
750
+			if (false === wordpoints_int($this->args[$key])) {
751 751
 
752 752
 				_doing_it_wrong(
753 753
 					__METHOD__
754 754
 					, sprintf(
755 755
 						"WordPoints Debug Error: '%s' must be a positive integer, %s given"
756
-						, esc_html( $key )
757
-						, esc_html( strval( $arg ) ? $arg : gettype( $arg ) )
756
+						, esc_html($key)
757
+						, esc_html(strval($arg) ? $arg : gettype($arg))
758 758
 					)
759 759
 					, '1.0.0'
760 760
 				);
761 761
 
762
-				$this->args[ $key ] = 0;
762
+				$this->args[$key] = 0;
763 763
 			}
764 764
 		}
765 765
 
766
-		if ( $this->args['limit'] > 0 && $this->args['start'] >= 0 ) {
766
+		if ($this->args['limit'] > 0 && $this->args['start'] >= 0) {
767 767
 			$this->limit = "LIMIT {$this->args['start']}, {$this->args['limit']}";
768 768
 		}
769 769
 	}
@@ -775,20 +775,20 @@  discard block
 block discarded – undo
775 775
 	 */
776 776
 	protected function prepare_order_by() {
777 777
 
778
-		if ( empty( $this->args['order_by'] ) ) {
778
+		if (empty($this->args['order_by'])) {
779 779
 			return;
780 780
 		}
781 781
 
782 782
 		$order    = $this->args['order'];
783 783
 		$order_by = $this->args['order_by'];
784 784
 
785
-		if ( ! in_array( $order, array( 'DESC', 'ASC' ) ) ) {
785
+		if ( ! in_array($order, array('DESC', 'ASC'))) {
786 786
 
787
-			_doing_it_wrong( __METHOD__, esc_html( "WordPoints Debug Error: invalid 'order' \"{$order}\", possible values are DESC and ASC" ), '1.0.0' );
787
+			_doing_it_wrong(__METHOD__, esc_html("WordPoints Debug Error: invalid 'order' \"{$order}\", possible values are DESC and ASC"), '1.0.0');
788 788
 			$order = 'DESC';
789 789
 		}
790 790
 
791
-		if ( 'meta_value' === $order_by ) {
791
+		if ('meta_value' === $order_by) {
792 792
 
793 793
 			global $wpdb;
794 794
 
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
 				$wpdb->{"{$this->meta_type}meta"}
797 797
 			);
798 798
 
799
-			if ( isset( $this->args['meta_type'] ) ) {
799
+			if (isset($this->args['meta_type'])) {
800 800
 
801
-				$meta_type = $this->meta_query->get_cast_for_type( $this->args['meta_type'] );
801
+				$meta_type = $this->meta_query->get_cast_for_type($this->args['meta_type']);
802 802
 				$order_by  = "CAST({$meta_table_name}.meta_value AS {$meta_type})";
803 803
 
804 804
 			} else {
@@ -806,13 +806,13 @@  discard block
 block discarded – undo
806 806
 				$order_by = "{$meta_table_name}.meta_value";
807 807
 			}
808 808
 
809
-		} elseif ( isset( $this->columns[ $order_by ] ) ) {
809
+		} elseif (isset($this->columns[$order_by])) {
810 810
 
811
-			$order_by = wordpoints_escape_mysql_identifier( $order_by );
811
+			$order_by = wordpoints_escape_mysql_identifier($order_by);
812 812
 
813 813
 		} else {
814 814
 
815
-			_doing_it_wrong( __METHOD__, esc_html( "WordPoints Debug Error: invalid 'order_by' \"{$order_by}\", possible values are " . implode( ', ', array_keys( $this->columns ) ) ), '1.0.0' );
815
+			_doing_it_wrong(__METHOD__, esc_html("WordPoints Debug Error: invalid 'order_by' \"{$order_by}\", possible values are " . implode(', ', array_keys($this->columns))), '1.0.0');
816 816
 			return;
817 817
 		}
818 818
 
@@ -826,25 +826,25 @@  discard block
 block discarded – undo
826 826
 	 *
827 827
 	 * @param string $column The name of the column.
828 828
 	 */
829
-	protected function prepare_date_where( $column ) {
829
+	protected function prepare_date_where($column) {
830 830
 
831 831
 		if (
832
-			empty( $this->args[ "{$column}_query" ] )
833
-			|| ! is_array( $this->args[ "{$column}_query" ] )
832
+			empty($this->args["{$column}_query"])
833
+			|| ! is_array($this->args["{$column}_query"])
834 834
 		) {
835 835
 			return;
836 836
 		}
837 837
 
838
-		add_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_filter' ) );
838
+		add_filter('date_query_valid_columns', array($this, 'date_query_valid_columns_filter'));
839 839
 
840
-		$date_query = new WP_Date_Query( $this->args[ "{$column}_query" ], $column );
840
+		$date_query = new WP_Date_Query($this->args["{$column}_query"], $column);
841 841
 		$date_query = $date_query->get_sql();
842 842
 
843
-		if ( ! empty( $date_query ) ) {
844
-			$this->wheres[] = ltrim( $date_query, ' AND' );
843
+		if ( ! empty($date_query)) {
844
+			$this->wheres[] = ltrim($date_query, ' AND');
845 845
 		}
846 846
 
847
-		remove_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_filter' ) );
847
+		remove_filter('date_query_valid_columns', array($this, 'date_query_valid_columns_filter'));
848 848
 	}
849 849
 
850 850
 	/**
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 */
855 855
 	protected function prepare_meta_where() {
856 856
 
857
-		if ( empty( $this->meta_type ) ) {
857
+		if (empty($this->meta_type)) {
858 858
 			return;
859 859
 		}
860 860
 
@@ -869,12 +869,12 @@  discard block
 block discarded – undo
869 869
 			)
870 870
 		);
871 871
 
872
-		if ( empty( $meta_args ) ) {
872
+		if (empty($meta_args)) {
873 873
 			return;
874 874
 		}
875 875
 
876 876
 		$this->meta_query = new WP_Meta_Query();
877
-		$this->meta_query->parse_query_vars( $meta_args );
877
+		$this->meta_query->parse_query_vars($meta_args);
878 878
 
879 879
 		$meta_query = $this->meta_query->get_sql(
880 880
 			$this->meta_type
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
 			, $this
884 884
 		);
885 885
 
886
-		if ( ! empty( $meta_query['where'] ) ) {
887
-			$this->wheres[] = ltrim( $meta_query['where'], ' AND' );
886
+		if ( ! empty($meta_query['where'])) {
887
+			$this->wheres[] = ltrim($meta_query['where'], ' AND');
888 888
 		}
889 889
 
890 890
 		$this->meta_join = $meta_query['join'] . "\n";
Please login to merge, or discard this patch.
src/admin/screens/configure-components.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 // Show messages and errors.
18 18
 //
19 19
 
20
-if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) {
20
+if (isset($_GET['wordpoints_component'], $_GET['_wpnonce']) && $wordpoints_components->is_registered(sanitize_key($_GET['wordpoints_component']))) {
21 21
 
22
-	$component = sanitize_key( $_GET['wordpoints_component'] );
22
+	$component = sanitize_key($_GET['wordpoints_component']);
23 23
 
24
-	if ( isset( $_GET['message'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) {
24
+	if (isset($_GET['message']) && wordpoints_verify_nonce('_wpnonce', "wordpoints_component_message-{$component}")) {
25 25
 
26
-		switch ( (int) $_GET['message'] ) {
26
+		switch ((int) $_GET['message']) {
27 27
 
28 28
 			case 1:
29
-				if ( $wordpoints_components->is_active( $component ) ) {
29
+				if ($wordpoints_components->is_active($component)) {
30 30
 					// translators: Component name.
31
-					$message = __( 'Component &#8220;%s&#8221; activated!', 'wordpoints' );
31
+					$message = __('Component &#8220;%s&#8221; activated!', 'wordpoints');
32 32
 				}
33 33
 			break;
34 34
 
35 35
 			case 2:
36
-				if ( ! $wordpoints_components->is_active( $component ) ) {
36
+				if ( ! $wordpoints_components->is_active($component)) {
37 37
 					// translators: Component name.
38
-					$message = __( 'Component &#8220;%s&#8221; deactivated!', 'wordpoints' );
38
+					$message = __('Component &#8220;%s&#8221; deactivated!', 'wordpoints');
39 39
 				}
40 40
 			break;
41 41
 		}
42 42
 
43
-		if ( isset( $message ) ) {
43
+		if (isset($message)) {
44 44
 
45 45
 			wordpoints_show_admin_message(
46
-				esc_html( sprintf( $message, $components[ $component ]['name'] ) )
46
+				esc_html(sprintf($message, $components[$component]['name']))
47 47
 				, 'success'
48
-				, array( 'dismissible' => true )
48
+				, array('dismissible' => true)
49 49
 			);
50 50
 		}
51 51
 
52
-	} elseif ( isset( $_GET['error'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) {
52
+	} elseif (isset($_GET['error']) && wordpoints_verify_nonce('_wpnonce', "wordpoints_component_error-{$component}")) {
53 53
 
54
-		switch ( (int) $_GET['error'] ) {
54
+		switch ((int) $_GET['error']) {
55 55
 
56 56
 			case 1:
57
-				if ( ! $wordpoints_components->is_active( $component ) ) {
57
+				if ( ! $wordpoints_components->is_active($component)) {
58 58
 					// translators: Component name.
59
-					$error = __( 'The component &#8220;%s&#8221; could not be activated. Please try again.', 'wordpoints' );
59
+					$error = __('The component &#8220;%s&#8221; could not be activated. Please try again.', 'wordpoints');
60 60
 				}
61 61
 			break;
62 62
 
63 63
 			case 2:
64
-				if ( $wordpoints_components->is_active( $component ) ) {
64
+				if ($wordpoints_components->is_active($component)) {
65 65
 					// translators: Component name.
66
-					$error = __( 'The component &#8220;%s&#8221; could not be deactivated. Please try again.', 'wordpoints' );
66
+					$error = __('The component &#8220;%s&#8221; could not be deactivated. Please try again.', 'wordpoints');
67 67
 				}
68 68
 			break;
69 69
 		}
70 70
 
71
-		if ( isset( $error ) ) {
71
+		if (isset($error)) {
72 72
 
73 73
 			wordpoints_show_admin_error(
74
-				esc_html( sprintf( $error, $components[ $component ]['name'] ) )
75
-				, array( 'dismissible' => true )
74
+				esc_html(sprintf($error, $components[$component]['name']))
75
+				, array('dismissible' => true)
76 76
 			);
77 77
 		}
78 78
 	} // End if ( message ) elseif ( error ).
@@ -88,74 +88,74 @@  discard block
 block discarded – undo
88 88
  *
89 89
  * @since 1.0.0
90 90
  */
91
-do_action( 'wordpoints_admin_components_top' );
91
+do_action('wordpoints_admin_components_top');
92 92
 
93 93
 ?>
94 94
 
95 95
 <br />
96 96
 <table id="wordpoints_components_table" class="widefat">
97
-	<caption><?php esc_html_e( 'Installed WordPoints components.', 'wordpoints' ); ?></caption>
97
+	<caption><?php esc_html_e('Installed WordPoints components.', 'wordpoints'); ?></caption>
98 98
 	<thead>
99 99
 		<tr>
100
-			<th scope="col"><?php echo esc_html_x( 'Component', 'components table heading', 'wordpoints' ); ?></th>
101
-			<th scope="col"><?php echo esc_html_x( 'Description', 'components table heading', 'wordpoints' ); ?></th>
102
-			<th scope="col"><?php echo esc_html_x( 'Version', 'components table heading', 'wordpoints' ); ?></th>
103
-			<th scope="col"><?php echo esc_html_x( 'Action', 'components table heading', 'wordpoints' ); ?></th>
100
+			<th scope="col"><?php echo esc_html_x('Component', 'components table heading', 'wordpoints'); ?></th>
101
+			<th scope="col"><?php echo esc_html_x('Description', 'components table heading', 'wordpoints'); ?></th>
102
+			<th scope="col"><?php echo esc_html_x('Version', 'components table heading', 'wordpoints'); ?></th>
103
+			<th scope="col"><?php echo esc_html_x('Action', 'components table heading', 'wordpoints'); ?></th>
104 104
 		</tr>
105 105
 	</thead>
106 106
 
107 107
 	<tbody>
108
-		<?php foreach ( $components as $component ) : ?>
108
+		<?php foreach ($components as $component) : ?>
109 109
 
110 110
 		<?php
111 111
 
112
-		if ( $wordpoints_components->is_active( $component['slug'] ) ) {
112
+		if ($wordpoints_components->is_active($component['slug'])) {
113 113
 
114 114
 			$action = 'deactivate';
115
-			$button = __( 'Deactivate', 'wordpoints' );
115
+			$button = __('Deactivate', 'wordpoints');
116 116
 
117 117
 		} else {
118 118
 
119 119
 			$action = 'activate';
120
-			$button = __( 'Activate', 'wordpoints' );
120
+			$button = __('Activate', 'wordpoints');
121 121
 		}
122 122
 
123 123
 		?>
124 124
 
125 125
 		<tr>
126 126
 			<td>
127
-				<?php if ( '' !== $component['component_uri'] ) : ?>
128
-					<a href="<?php echo esc_url( $component['component_uri'] ); ?>">
127
+				<?php if ('' !== $component['component_uri']) : ?>
128
+					<a href="<?php echo esc_url($component['component_uri']); ?>">
129 129
 				<?php endif; ?>
130
-					<?php echo esc_html( $component['name'] ); ?>
131
-				<?php if ( '' !== $component['component_uri'] ) : ?>
130
+					<?php echo esc_html($component['name']); ?>
131
+				<?php if ('' !== $component['component_uri']) : ?>
132 132
 					</a>
133 133
 				<?php endif; ?>
134 134
 			</td>
135 135
 			<td>
136
-				<?php echo wp_kses( $component['description'], 'wordpoints_component_description' ); ?>
137
-				<?php if ( '' !== $component['author'] ) : ?>
136
+				<?php echo wp_kses($component['description'], 'wordpoints_component_description'); ?>
137
+				<?php if ('' !== $component['author']) : ?>
138 138
 					&nbsp;|&nbsp;
139 139
 					<?php
140 140
 					// translators: Author name.
141
-					echo esc_html( sprintf( __( 'By %s', 'wordpoints' ), '' /* This space intentionally left blank */ ) );
141
+					echo esc_html(sprintf(__('By %s', 'wordpoints'), '' /* This space intentionally left blank */));
142 142
 					?>
143
-					<?php if ( '' !== $component['author_uri'] ) : ?>
144
-						<a href="<?php echo esc_url( $component['author_uri'] ); ?>">
143
+					<?php if ('' !== $component['author_uri']) : ?>
144
+						<a href="<?php echo esc_url($component['author_uri']); ?>">
145 145
 					<?php endif; ?>
146
-						<?php echo esc_html( $component['author'] ); ?>
147
-					<?php if ( '' !== $component['author_uri'] ) : ?>
146
+						<?php echo esc_html($component['author']); ?>
147
+					<?php if ('' !== $component['author_uri']) : ?>
148 148
 						</a>
149 149
 					<?php endif; ?>
150 150
 				<?php endif; ?>
151 151
 			</td>
152
-			<td><?php echo esc_html( $component['version'] ); ?></td>
152
+			<td><?php echo esc_html($component['version']); ?></td>
153 153
 			<td>
154
-				<form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component['slug'] ); ?>">
155
-					<input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr( $action ); ?>" />
156
-					<input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component['slug'] ); ?>" />
157
-					<?php wp_nonce_field( "wordpoints_{$action}_component-{$component['slug']}" ); ?>
158
-					<?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false ); ?>
154
+				<form method="post" name="wordpoints_components_form_<?php echo esc_attr($component['slug']); ?>">
155
+					<input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr($action); ?>" />
156
+					<input type="hidden" name="wordpoints_component" value="<?php echo esc_attr($component['slug']); ?>" />
157
+					<?php wp_nonce_field("wordpoints_{$action}_component-{$component['slug']}"); ?>
158
+					<?php submit_button($button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false); ?>
159 159
 				</form>
160 160
 			</td>
161 161
 		</tr>
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 
166 166
 	<tfoot>
167 167
 	<tr>
168
-		<th scope="col"><?php echo esc_html_x( 'Component', 'components table heading', 'wordpoints' ); ?></th>
169
-		<th scope="col"><?php echo esc_html_x( 'Description', 'components table heading', 'wordpoints' ); ?></th>
170
-		<th scope="col"><?php echo esc_html_x( 'Version', 'components table heading', 'wordpoints' ); ?></th>
171
-		<th scope="col"><?php echo esc_html_x( 'Action', 'components table heading', 'wordpoints' ); ?></th>
168
+		<th scope="col"><?php echo esc_html_x('Component', 'components table heading', 'wordpoints'); ?></th>
169
+		<th scope="col"><?php echo esc_html_x('Description', 'components table heading', 'wordpoints'); ?></th>
170
+		<th scope="col"><?php echo esc_html_x('Version', 'components table heading', 'wordpoints'); ?></th>
171
+		<th scope="col"><?php echo esc_html_x('Action', 'components table heading', 'wordpoints'); ?></th>
172 172
 	</tr>
173 173
 	</tfoot>
174 174
 </table>
@@ -180,6 +180,6 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @since 1.0.0
182 182
  */
183
-do_action( 'wordpoints_admin_components_bottom' );
183
+do_action('wordpoints_admin_components_bottom');
184 184
 
185 185
 // EOF
Please login to merge, or discard this patch.
src/admin/screens/modules-load.php 1 patch
Spacing   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -9,56 +9,56 @@  discard block
 block discarded – undo
9 9
 
10 10
 global $status, $wp_version;
11 11
 
12
-if ( isset( $_POST['clear-recent-list'] ) ) {
12
+if (isset($_POST['clear-recent-list'])) {
13 13
 	$action = 'clear-recent-list';
14
-} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) {
15
-	$action = sanitize_key( $_REQUEST['action'] );
16
-} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) {
17
-	$action = sanitize_key( $_REQUEST['action2'] );
14
+} elseif (isset($_REQUEST['action']) && -1 !== (int) $_REQUEST['action']) {
15
+	$action = sanitize_key($_REQUEST['action']);
16
+} elseif (isset($_REQUEST['action2']) && -1 !== (int) $_REQUEST['action2']) {
17
+	$action = sanitize_key($_REQUEST['action2']);
18 18
 } else {
19 19
 	$action = '';
20 20
 }
21 21
 
22
-$page   = ( isset( $_REQUEST['paged'] ) ) ? max( 1, absint( $_REQUEST['paged'] ) ) : 1;
23
-$module = ( isset( $_REQUEST['module'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) ) : '';
24
-$s      = ( isset( $_REQUEST['s'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : '';
22
+$page   = (isset($_REQUEST['paged'])) ? max(1, absint($_REQUEST['paged'])) : 1;
23
+$module = (isset($_REQUEST['module'])) ? sanitize_text_field(wp_unslash($_REQUEST['module'])) : '';
24
+$s      = (isset($_REQUEST['s'])) ? sanitize_text_field(wp_unslash($_REQUEST['s'])) : '';
25 25
 
26 26
 // Clean up request URI from temporary args for screen options/paging URI's to work as expected.
27
-$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) );
27
+$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'));
28 28
 
29
-$redirect_url = self_admin_url( "admin.php?page=wordpoints_modules&module_status={$status}&paged={$page}&s={$s}" );
29
+$redirect_url = self_admin_url("admin.php?page=wordpoints_modules&module_status={$status}&paged={$page}&s={$s}");
30 30
 
31
-switch ( $action ) {
31
+switch ($action) {
32 32
 
33 33
 	case '': break;
34 34
 
35 35
 	// Activate a single module.
36 36
 	case 'activate':
37
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
38
-			wp_die( esc_html__( 'Sorry, you are not allowed to activate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
37
+		if ( ! current_user_can('activate_wordpoints_modules')) {
38
+			wp_die(esc_html__('Sorry, you are not allowed to activate modules for this site.', 'wordpoints'), '', array('response' => 403));
39 39
 		}
40 40
 
41
-		if ( is_multisite() && ! is_network_admin() && is_network_only_wordpoints_module( $module ) ) {
41
+		if (is_multisite() && ! is_network_admin() && is_network_only_wordpoints_module($module)) {
42 42
 
43
-			wp_safe_redirect( $redirect_url );
43
+			wp_safe_redirect($redirect_url);
44 44
 			exit;
45 45
 		}
46 46
 
47
-		check_admin_referer( 'activate-module_' . $module );
47
+		check_admin_referer('activate-module_' . $module);
48 48
 
49
-		$result = wordpoints_activate_module( $module, self_admin_url( 'admin.php?page=wordpoints_modules&error=true&module=' . $module ), is_network_admin() );
49
+		$result = wordpoints_activate_module($module, self_admin_url('admin.php?page=wordpoints_modules&error=true&module=' . $module), is_network_admin());
50 50
 
51
-		if ( is_wp_error( $result ) ) {
51
+		if (is_wp_error($result)) {
52 52
 
53
-			if ( 'unexpected_output' === $result->get_error_code() ) {
53
+			if ('unexpected_output' === $result->get_error_code()) {
54 54
 
55 55
 				wp_safe_redirect(
56 56
 					add_query_arg(
57 57
 						array(
58
-							'_error_nonce' => wp_create_nonce( 'module-activation-error_' . $module ),
58
+							'_error_nonce' => wp_create_nonce('module-activation-error_' . $module),
59 59
 							'module' => $module,
60 60
 							'error' => true,
61
-							'charsout' => strlen( $result->get_error_data() ),
61
+							'charsout' => strlen($result->get_error_data()),
62 62
 						)
63 63
 						, $redirect_url
64 64
 					)
@@ -68,96 +68,96 @@  discard block
 block discarded – undo
68 68
 
69 69
 			} else {
70 70
 
71
-				wp_die( wordpoints_sanitize_wp_error( $result ) );
71
+				wp_die(wordpoints_sanitize_wp_error($result));
72 72
 			}
73 73
 		}
74 74
 
75
-		if ( ! is_network_admin() ) {
75
+		if ( ! is_network_admin()) {
76 76
 
77
-			$recent = wordpoints_get_array_option( 'wordpoints_recently_activated_modules' );
78
-			unset( $recent[ $module ] );
79
-			update_option( 'wordpoints_recently_activated_modules', $recent );
77
+			$recent = wordpoints_get_array_option('wordpoints_recently_activated_modules');
78
+			unset($recent[$module]);
79
+			update_option('wordpoints_recently_activated_modules', $recent);
80 80
 		}
81 81
 
82
-		wp_safe_redirect( add_query_arg( 'activate', 'true', $redirect_url ) );
82
+		wp_safe_redirect(add_query_arg('activate', 'true', $redirect_url));
83 83
 	exit;
84 84
 
85 85
 	// Activate multiple modules.
86 86
 	case 'activate-selected':
87
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
88
-			wp_die( esc_html__( 'Sorry, you are not allowed to activate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
87
+		if ( ! current_user_can('activate_wordpoints_modules')) {
88
+			wp_die(esc_html__('Sorry, you are not allowed to activate modules for this site.', 'wordpoints'), '', array('response' => 403));
89 89
 		}
90 90
 
91
-		check_admin_referer( 'bulk-modules' );
91
+		check_admin_referer('bulk-modules');
92 92
 
93
-		$modules = isset( $_POST['checked'] )
94
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) )
93
+		$modules = isset($_POST['checked'])
94
+			? array_map('sanitize_text_field', (array) wp_unslash($_POST['checked']))
95 95
 			: array();
96 96
 
97 97
 		// Only activate modules which are not already active.
98
-		if ( is_network_admin() ) {
98
+		if (is_network_admin()) {
99 99
 
100
-			foreach ( $modules as $i => $module ) {
101
-				if ( is_wordpoints_module_active_for_network( $module ) ) {
102
-					unset( $modules[ $i ] );
100
+			foreach ($modules as $i => $module) {
101
+				if (is_wordpoints_module_active_for_network($module)) {
102
+					unset($modules[$i]);
103 103
 				}
104 104
 			}
105 105
 
106 106
 		} else {
107 107
 
108
-			foreach ( $modules as $i => $module ) {
109
-				if ( is_wordpoints_module_active( $module ) || is_network_only_wordpoints_module( $module ) ) {
110
-					unset( $modules[ $i ] );
108
+			foreach ($modules as $i => $module) {
109
+				if (is_wordpoints_module_active($module) || is_network_only_wordpoints_module($module)) {
110
+					unset($modules[$i]);
111 111
 				}
112 112
 			}
113 113
 		}
114 114
 
115
-		if ( empty( $modules ) ) {
116
-			wp_safe_redirect( $redirect_url );
115
+		if (empty($modules)) {
116
+			wp_safe_redirect($redirect_url);
117 117
 			exit;
118 118
 		}
119 119
 
120
-		$redirect = self_admin_url( 'admin.php?page=wordpoints_modules&error=true' );
120
+		$redirect = self_admin_url('admin.php?page=wordpoints_modules&error=true');
121 121
 
122
-		foreach ( $modules as $module ) {
122
+		foreach ($modules as $module) {
123 123
 
124
-			wordpoints_activate_module( $module, add_query_arg( 'module', $module, $redirect ), is_network_admin() );
124
+			wordpoints_activate_module($module, add_query_arg('module', $module, $redirect), is_network_admin());
125 125
 		}
126 126
 
127
-		if ( ! is_network_admin() ) {
127
+		if ( ! is_network_admin()) {
128 128
 
129
-			$recent = wordpoints_get_array_option( 'wordpoints_recently_activated_modules' );
129
+			$recent = wordpoints_get_array_option('wordpoints_recently_activated_modules');
130 130
 
131
-			foreach ( $modules as $module ) {
132
-				unset( $recent[ $module ] );
131
+			foreach ($modules as $module) {
132
+				unset($recent[$module]);
133 133
 			}
134 134
 
135
-			update_option( 'wordpoints_recently_activated_modules', $recent );
135
+			update_option('wordpoints_recently_activated_modules', $recent);
136 136
 		}
137 137
 
138
-		wp_safe_redirect( add_query_arg( 'activate-multi', 'true', $redirect_url ) );
138
+		wp_safe_redirect(add_query_arg('activate-multi', 'true', $redirect_url));
139 139
 	exit;
140 140
 
141 141
 	// Get the fatal error from a module.
142 142
 	case 'error_scrape':
143
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
144
-			wp_die( esc_html__( 'Sorry, you are not allowed to activate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
143
+		if ( ! current_user_can('activate_wordpoints_modules')) {
144
+			wp_die(esc_html__('Sorry, you are not allowed to activate modules for this site.', 'wordpoints'), '', array('response' => 403));
145 145
 		}
146 146
 
147
-		check_admin_referer( 'module-activation-error_' . $module );
147
+		check_admin_referer('module-activation-error_' . $module);
148 148
 
149
-		$valid = wordpoints_validate_module( $module );
149
+		$valid = wordpoints_validate_module($module);
150 150
 
151
-		if ( is_wp_error( $valid ) ) {
152
-			wp_die( wordpoints_sanitize_wp_error( $valid ), '', array( 'response' => 400 ) );
151
+		if (is_wp_error($valid)) {
152
+			wp_die(wordpoints_sanitize_wp_error($valid), '', array('response' => 400));
153 153
 		}
154 154
 
155 155
 		// Ensure that Fatal errors are displayed.
156
-		if ( ! WP_DEBUG ) {
157
-			error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); // @codingStandardsIgnoreLine
156
+		if ( ! WP_DEBUG) {
157
+			error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); // @codingStandardsIgnoreLine
158 158
 		}
159 159
 
160
-		@ini_set( 'display_errors', true ); // @codingStandardsIgnoreLine
160
+		@ini_set('display_errors', true); // @codingStandardsIgnoreLine
161 161
 
162 162
 		/**
163 163
 		 * Go back to "sandbox" scope so we get the same errors as before.
@@ -167,119 +167,119 @@  discard block
 block discarded – undo
167 167
 		 *
168 168
 		 * @param string $module The base path to the module to error scrape.
169 169
 		 */
170
-		function wordpoints_module_sandbox_scrape( $module ) {
170
+		function wordpoints_module_sandbox_scrape($module) {
171 171
 
172 172
 			$modules_dir = wordpoints_modules_dir();
173
-			WordPoints_Module_Paths::register( $modules_dir . '/' . $module );
174
-			include( $modules_dir . '/' . $module );
173
+			WordPoints_Module_Paths::register($modules_dir . '/' . $module);
174
+			include($modules_dir . '/' . $module);
175 175
 		}
176 176
 
177
-		wordpoints_module_sandbox_scrape( $module );
177
+		wordpoints_module_sandbox_scrape($module);
178 178
 
179 179
 		/**
180 180
 		 * @see wordpoints_activate_module()
181 181
 		 */
182
-		do_action( "wordpoints_module_activate-{$module}" );
182
+		do_action("wordpoints_module_activate-{$module}");
183 183
 	exit;
184 184
 
185 185
 	// Deactivate a module.
186 186
 	case 'deactivate':
187
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
188
-			wp_die( esc_html__( 'Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
187
+		if ( ! current_user_can('activate_wordpoints_modules')) {
188
+			wp_die(esc_html__('Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints'), '', array('response' => 403));
189 189
 		}
190 190
 
191
-		check_admin_referer( 'deactivate-module_' . $module );
191
+		check_admin_referer('deactivate-module_' . $module);
192 192
 
193
-		if ( ! is_network_admin() && is_wordpoints_module_active_for_network( $module ) ) {
194
-			wp_safe_redirect( $redirect_url );
193
+		if ( ! is_network_admin() && is_wordpoints_module_active_for_network($module)) {
194
+			wp_safe_redirect($redirect_url);
195 195
 			exit;
196 196
 		}
197 197
 
198
-		wordpoints_deactivate_modules( $module, false, is_network_admin() );
198
+		wordpoints_deactivate_modules($module, false, is_network_admin());
199 199
 
200
-		if ( ! is_network_admin() ) {
201
-			update_option( 'wordpoints_recently_activated_modules', array( $module => time() ) + wordpoints_get_array_option( 'wordpoints_recently_activated_modules' ) );
200
+		if ( ! is_network_admin()) {
201
+			update_option('wordpoints_recently_activated_modules', array($module => time()) + wordpoints_get_array_option('wordpoints_recently_activated_modules'));
202 202
 		}
203 203
 
204
-		$redirect_url = add_query_arg( 'deactivate', 'true', $redirect_url );
204
+		$redirect_url = add_query_arg('deactivate', 'true', $redirect_url);
205 205
 
206
-		if ( headers_sent() ) {
207
-			echo '<meta http-equiv="refresh" content="0;url=' . esc_url( $redirect_url ) . '" />';
206
+		if (headers_sent()) {
207
+			echo '<meta http-equiv="refresh" content="0;url=' . esc_url($redirect_url) . '" />';
208 208
 		} else {
209
-			wp_safe_redirect( $redirect_url );
209
+			wp_safe_redirect($redirect_url);
210 210
 		}
211 211
 	exit;
212 212
 
213 213
 	// Deactivate multiple modules.
214 214
 	case 'deactivate-selected':
215
-		if ( ! current_user_can( 'activate_wordpoints_modules' ) ) {
216
-			wp_die( esc_html__( 'Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
215
+		if ( ! current_user_can('activate_wordpoints_modules')) {
216
+			wp_die(esc_html__('Sorry, you are not allowed to deactivate modules for this site.', 'wordpoints'), '', array('response' => 403));
217 217
 		}
218 218
 
219
-		check_admin_referer( 'bulk-modules' );
219
+		check_admin_referer('bulk-modules');
220 220
 
221
-		$modules = isset( $_POST['checked'] )
222
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) )
221
+		$modules = isset($_POST['checked'])
222
+			? array_map('sanitize_text_field', (array) wp_unslash($_POST['checked']))
223 223
 			: array();
224 224
 
225
-		$network_modules = array_filter( $modules, 'is_wordpoints_module_active_for_network' );
225
+		$network_modules = array_filter($modules, 'is_wordpoints_module_active_for_network');
226 226
 
227 227
 		// Do not deactivate modules which are already deactivated.
228
-		if ( is_network_admin() ) {
228
+		if (is_network_admin()) {
229 229
 			$modules = $network_modules;
230 230
 		} else {
231
-			$modules = array_diff( array_filter( $modules, 'is_wordpoints_module_active' ), $network_modules );
231
+			$modules = array_diff(array_filter($modules, 'is_wordpoints_module_active'), $network_modules);
232 232
 		}
233 233
 
234
-		if ( empty( $modules ) ) {
235
-			wp_safe_redirect( $redirect_url );
234
+		if (empty($modules)) {
235
+			wp_safe_redirect($redirect_url);
236 236
 			exit;
237 237
 		}
238 238
 
239
-		wordpoints_deactivate_modules( $modules, false, is_network_admin() );
239
+		wordpoints_deactivate_modules($modules, false, is_network_admin());
240 240
 
241
-		if ( ! is_network_admin() ) {
241
+		if ( ! is_network_admin()) {
242 242
 
243 243
 			$deactivated = array();
244 244
 
245
-			foreach ( $modules as $module ) {
246
-				$deactivated[ $module ] = time();
245
+			foreach ($modules as $module) {
246
+				$deactivated[$module] = time();
247 247
 			}
248 248
 
249
-			update_option( 'wordpoints_recently_activated_modules', $deactivated + wordpoints_get_array_option( 'wordpoints_recently_activated_modules' ) );
249
+			update_option('wordpoints_recently_activated_modules', $deactivated + wordpoints_get_array_option('wordpoints_recently_activated_modules'));
250 250
 		}
251 251
 
252
-		wp_safe_redirect( add_query_arg( 'deactivate-multi', 'true', $redirect_url ) );
252
+		wp_safe_redirect(add_query_arg('deactivate-multi', 'true', $redirect_url));
253 253
 	exit;
254 254
 
255 255
 	// Delete multiple modules.
256 256
 	case 'delete-selected':
257
-		if ( ! current_user_can( 'delete_wordpoints_modules' ) ) {
258
-			wp_die( esc_html__( 'Sorry, you are not allowed to delete modules for this site.', 'wordpoints' ), '', array( 'response' => 403 ) );
257
+		if ( ! current_user_can('delete_wordpoints_modules')) {
258
+			wp_die(esc_html__('Sorry, you are not allowed to delete modules for this site.', 'wordpoints'), '', array('response' => 403));
259 259
 		}
260 260
 
261
-		check_admin_referer( 'bulk-modules' );
261
+		check_admin_referer('bulk-modules');
262 262
 
263 263
 		// $_POST = from the module form; $_GET = from the FTP details screen.
264
-		$modules = isset( $_REQUEST['checked'] )
265
-			? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST['checked'] ) )
264
+		$modules = isset($_REQUEST['checked'])
265
+			? array_map('sanitize_text_field', (array) wp_unslash($_REQUEST['checked']))
266 266
 			: array();
267 267
 
268
-		if ( empty( $modules ) ) {
269
-			wp_safe_redirect( $redirect_url );
268
+		if (empty($modules)) {
269
+			wp_safe_redirect($redirect_url);
270 270
 			exit;
271 271
 		}
272 272
 
273 273
 		// Do not allow to delete activated modules.
274
-		foreach ( $modules as $key => $module ) {
274
+		foreach ($modules as $key => $module) {
275 275
 
276
-			if ( is_wordpoints_module_active( $module ) ) {
277
-				unset( $modules[ $key ] );
276
+			if (is_wordpoints_module_active($module)) {
277
+				unset($modules[$key]);
278 278
 			}
279 279
 		}
280 280
 
281
-		if ( empty( $modules ) ) {
282
-			wp_safe_redirect( add_query_arg( array( 'error' => 'true', 'main' => 'true' ), $redirect_url ) );
281
+		if (empty($modules)) {
282
+			wp_safe_redirect(add_query_arg(array('error' => 'true', 'main' => 'true'), $redirect_url));
283 283
 			exit;
284 284
 		}
285 285
 
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$parent_file = 'admin.php';
289 289
 
290
-		if ( ! isset( $_REQUEST['verify-delete'] ) ) {
290
+		if ( ! isset($_REQUEST['verify-delete'])) {
291 291
 
292
-			wp_enqueue_script( 'jquery' );
292
+			wp_enqueue_script('jquery');
293 293
 			require_once ABSPATH . 'wp-admin/admin-header.php';
294 294
 
295 295
 			?>
@@ -303,19 +303,19 @@  discard block
 block discarded – undo
303 303
 				$files_to_delete = array();
304 304
 				$have_non_network_modules = false;
305 305
 
306
-				foreach ( $modules as $module ) {
306
+				foreach ($modules as $module) {
307 307
 
308
-					if ( '.' === dirname( $module ) ) {
308
+					if ('.' === dirname($module)) {
309 309
 
310 310
 						$files_to_delete[] = $module_dir . '/' . $module;
311
-						$data = wordpoints_get_module_data( $module_dir . '/' . $module );
311
+						$data = wordpoints_get_module_data($module_dir . '/' . $module);
312 312
 
313
-						if ( ! empty( $data ) ) {
313
+						if ( ! empty($data)) {
314 314
 
315
-							$module_info[ $module ] = $data;
316
-							$module_info[ $module ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module );
315
+							$module_info[$module] = $data;
316
+							$module_info[$module]['is_uninstallable'] = is_uninstallable_wordpoints_module($module);
317 317
 
318
-							if ( ! $module_info[ $module ]['network'] ) {
318
+							if ( ! $module_info[$module]['network']) {
319 319
 								$have_non_network_modules = true;
320 320
 							}
321 321
 						}
@@ -323,21 +323,21 @@  discard block
 block discarded – undo
323 323
 					} else {
324 324
 
325 325
 						// Locate all the files in that folder.
326
-						$files = list_files( $module_dir . '/' . dirname( $module ) );
326
+						$files = list_files($module_dir . '/' . dirname($module));
327 327
 
328
-						if ( $files ) {
329
-							$files_to_delete = array_merge( $files_to_delete, $files );
328
+						if ($files) {
329
+							$files_to_delete = array_merge($files_to_delete, $files);
330 330
 						}
331 331
 
332 332
 						// Get modules list from that folder.
333
-						$folder_modules = wordpoints_get_modules( '/' . dirname( $module ) );
333
+						$folder_modules = wordpoints_get_modules('/' . dirname($module));
334 334
 
335
-						foreach ( $folder_modules as $module_file => $data ) {
335
+						foreach ($folder_modules as $module_file => $data) {
336 336
 
337
-							$module_info[ $module_file ] = $data;
338
-							$module_info[ $module_file ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module );
337
+							$module_info[$module_file] = $data;
338
+							$module_info[$module_file]['is_uninstallable'] = is_uninstallable_wordpoints_module($module);
339 339
 
340
-							if ( ! $module_info[ $module_file ]['network'] ) {
340
+							if ( ! $module_info[$module_file]['network']) {
341 341
 								$have_non_network_modules = true;
342 342
 							}
343 343
 						}
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
 
347 347
 				} // End foreach( $modules ).
348 348
 
349
-				$modules_to_delete = count( $module_info );
349
+				$modules_to_delete = count($module_info);
350 350
 
351
-				echo '<h1>' . esc_html( _n( 'Delete module', 'Delete modules', $modules_to_delete, 'wordpoints' ) ) . '</h1>';
351
+				echo '<h1>' . esc_html(_n('Delete module', 'Delete modules', $modules_to_delete, 'wordpoints')) . '</h1>';
352 352
 
353
-				if ( $have_non_network_modules && is_network_admin() ) {
353
+				if ($have_non_network_modules && is_network_admin()) {
354 354
 					wordpoints_show_admin_message(
355
-						'<strong>' . esc_html__( 'Caution:', 'wordpoints' ) . '</strong>'
355
+						'<strong>' . esc_html__('Caution:', 'wordpoints') . '</strong>'
356 356
 							. esc_html(
357 357
 								_n(
358 358
 									'This module may be active on other sites in the network.'
@@ -367,25 +367,25 @@  discard block
 block discarded – undo
367 367
 
368 368
 				?>
369 369
 
370
-				<p><?php echo esc_html( _n( 'You are about to remove the following module:', 'You are about to remove the following modules:', $modules_to_delete, 'wordpoints' ) ); ?></p>
370
+				<p><?php echo esc_html(_n('You are about to remove the following module:', 'You are about to remove the following modules:', $modules_to_delete, 'wordpoints')); ?></p>
371 371
 					<ul class="ul-disc">
372 372
 
373 373
 						<?php
374 374
 
375 375
 						$data_to_delete = false;
376 376
 
377
-						foreach ( $module_info as $module ) {
377
+						foreach ($module_info as $module) {
378 378
 
379
-							if ( $module['is_uninstallable'] ) {
379
+							if ($module['is_uninstallable']) {
380 380
 
381 381
 								// translators: 1. Module name; 2. Module author.
382
-								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
382
+								echo '<li>', wp_kses(sprintf(__('<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints'), esc_html($module['name']), esc_html($module['author_name'])), array('strong' => array(), 'em' => array())), '</li>';
383 383
 								$data_to_delete = true;
384 384
 
385 385
 							} else {
386 386
 
387 387
 								// translators: 1. Module name; 2. Module author.
388
-								echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>';
388
+								echo '<li>', wp_kses(sprintf(__('<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints'), esc_html($module['name']), esc_html($module['author_name'])), array('strong' => array(), 'em' => array())), '</li>';
389 389
 							}
390 390
 						}
391 391
 
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 				<p>
396 396
 					<?php
397 397
 
398
-					if ( $data_to_delete ) {
399
-						esc_html_e( 'Are you sure you wish to delete these files and data?', 'wordpoints' );
398
+					if ($data_to_delete) {
399
+						esc_html_e('Are you sure you wish to delete these files and data?', 'wordpoints');
400 400
 					} else {
401
-						esc_html_e( 'Are you sure you wish to delete these files?', 'wordpoints' );
401
+						esc_html_e('Are you sure you wish to delete these files?', 'wordpoints');
402 402
 					}
403 403
 
404 404
 					?>
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
 				<form method="post" style="display:inline;">
408 408
 					<input type="hidden" name="verify-delete" value="1" />
409 409
 					<input type="hidden" name="action" value="delete-selected" />
410
-					<?php foreach ( (array) $modules as $module ) : ?>
411
-						<input type="hidden" name="checked[]" value="<?php echo esc_attr( $module ); ?>" />
410
+					<?php foreach ((array) $modules as $module) : ?>
411
+						<input type="hidden" name="checked[]" value="<?php echo esc_attr($module); ?>" />
412 412
 					<?php endforeach; ?>
413
-					<?php wp_nonce_field( 'bulk-modules' ) ?>
414
-					<?php submit_button( $data_to_delete ? __( 'Yes, Delete these files and data', 'wordpoints' ) : __( 'Yes, Delete these files', 'wordpoints' ), 'button', 'submit', false ); ?>
413
+					<?php wp_nonce_field('bulk-modules') ?>
414
+					<?php submit_button($data_to_delete ? __('Yes, Delete these files and data', 'wordpoints') : __('Yes, Delete these files', 'wordpoints'), 'button', 'submit', false); ?>
415 415
 				</form>
416
-				<form method="post" action="<?php echo esc_url( wp_get_referer() ); ?>" style="display:inline;">
417
-					<?php submit_button( __( 'No, Return me to the module list', 'wordpoints' ), 'button', 'submit', false ); ?>
416
+				<form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
417
+					<?php submit_button(__('No, Return me to the module list', 'wordpoints'), 'button', 'submit', false); ?>
418 418
 				</form>
419 419
 
420
-				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php esc_html_e( 'Click to view entire list of files which will be deleted', 'wordpoints' ); ?></a></p>
420
+				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php esc_html_e('Click to view entire list of files which will be deleted', 'wordpoints'); ?></a></p>
421 421
 				<div id="files-list" class="hidden">
422 422
 					<ul class="code">
423
-						<?php foreach ( (array) $files_to_delete as $file ) : ?>
424
-							<li><?php echo esc_html( str_replace( $module_dir, '', $file ) ); ?></li>
423
+						<?php foreach ((array) $files_to_delete as $file) : ?>
424
+							<li><?php echo esc_html(str_replace($module_dir, '', $file)); ?></li>
425 425
 						<?php endforeach; ?>
426 426
 					</ul>
427 427
 				</div>
@@ -434,17 +434,17 @@  discard block
 block discarded – undo
434 434
 
435 435
 		}  // End if ( ! isset( $_REQUEST['verify-delete'] ) ).
436 436
 
437
-		$delete_result = wordpoints_delete_modules( $modules );
437
+		$delete_result = wordpoints_delete_modules($modules);
438 438
 
439 439
 		// Store the result in a cache rather than a URL param due to object type & length
440
-		set_transient( 'wordpoints_modules_delete_result_' . get_current_user_id(), $delete_result );
440
+		set_transient('wordpoints_modules_delete_result_' . get_current_user_id(), $delete_result);
441 441
 
442
-		wp_safe_redirect( add_query_arg( 'deleted', 'true', $redirect_url ) );
442
+		wp_safe_redirect(add_query_arg('deleted', 'true', $redirect_url));
443 443
 	exit;
444 444
 
445 445
 	case 'clear-recent-list':
446
-		if ( ! is_network_admin() ) {
447
-			update_option( 'wordpoints_recently_activated_modules', array() );
446
+		if ( ! is_network_admin()) {
447
+			update_option('wordpoints_recently_activated_modules', array());
448 448
 		}
449 449
 	break;
450 450
 
@@ -454,56 +454,56 @@  discard block
 block discarded – undo
454 454
 		 *
455 455
 		 * @since 1.1.0
456 456
 		 */
457
-		do_action( "wordpoints_modules_screen-{$action}" );
457
+		do_action("wordpoints_modules_screen-{$action}");
458 458
 
459 459
 } // End switch ( $action ).
460 460
 
461
-add_screen_option( 'per_page', array( 'default' => 999 ) );
461
+add_screen_option('per_page', array('default' => 999));
462 462
 
463 463
 $screen = get_current_screen();
464 464
 
465 465
 $screen->add_help_tab(
466 466
 	array(
467 467
 		'id'		=> 'overview',
468
-		'title'		=> __( 'Overview', 'wordpoints' ),
468
+		'title'		=> __('Overview', 'wordpoints'),
469 469
 		'content'	=>
470
-			'<p>' . esc_html__( 'Modules extend and expand the functionality of WordPoints. Once a module is installed, you may activate it or deactivate it here.', 'wordpoints' ) . '</p>' .
470
+			'<p>' . esc_html__('Modules extend and expand the functionality of WordPoints. Once a module is installed, you may activate it or deactivate it here.', 'wordpoints') . '</p>' .
471 471
 			// translators: 1. URL of module directory on WordPoints.org; 2. URL of Install Module admin screen; 3. Directory name.
472
-			'<p>' . wp_kses( sprintf( __( 'You can find modules for your site by by browsing the <a href="%1$s">WordPoints Module Directory</a>. To install a module you generally just need to <a href="%2$s">upload the module file</a> into your %3$s directory. Once a module has been installed, you can activate it here.', 'wordpoints' ), 'https://wordpoints.org/modules/', esc_url( self_admin_url( 'admin.php?page=wordpoints_install_modules' ) ), '<code>/wp-content/wordpoints-modules</code>' ), array( 'a' => array( 'href' => true, 'target' => true ), 'code' => array() ) ) . '</p>',
472
+			'<p>' . wp_kses(sprintf(__('You can find modules for your site by by browsing the <a href="%1$s">WordPoints Module Directory</a>. To install a module you generally just need to <a href="%2$s">upload the module file</a> into your %3$s directory. Once a module has been installed, you can activate it here.', 'wordpoints'), 'https://wordpoints.org/modules/', esc_url(self_admin_url('admin.php?page=wordpoints_install_modules')), '<code>/wp-content/wordpoints-modules</code>'), array('a' => array('href' => true, 'target' => true), 'code' => array())) . '</p>',
473 473
 	)
474 474
 );
475 475
 
476 476
 $screen->add_help_tab(
477 477
 	array(
478 478
 		'id'		=> 'compatibility-problems',
479
-		'title'		=> __( 'Troubleshooting', 'wordpoints' ),
479
+		'title'		=> __('Troubleshooting', 'wordpoints'),
480 480
 		'content'	=>
481
-			'<p>' . esc_html__( 'Most of the time, modules play nicely with the core of WordPoints and with other modules. Sometimes, though, a module&#8217;s code will get in the way of another module, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your modules and re-activating them in various combinations until you isolate which one(s) caused the issue.', 'wordpoints' ) . '</p>' .
481
+			'<p>' . esc_html__('Most of the time, modules play nicely with the core of WordPoints and with other modules. Sometimes, though, a module&#8217;s code will get in the way of another module, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your modules and re-activating them in various combinations until you isolate which one(s) caused the issue.', 'wordpoints') . '</p>' .
482 482
 			// translators: Directory name.
483
-			'<p>' . sprintf( esc_html__( 'If something goes wrong with a module and you can&#8217;t use WordPoints, delete or rename that file in the %s directory and it will be automatically deactivated.', 'wordpoints' ), '<code>' . esc_html( wordpoints_modules_dir() ) . '</code>' ) . '</p>', // XSS OK WPCS
483
+			'<p>' . sprintf(esc_html__('If something goes wrong with a module and you can&#8217;t use WordPoints, delete or rename that file in the %s directory and it will be automatically deactivated.', 'wordpoints'), '<code>' . esc_html(wordpoints_modules_dir()) . '</code>') . '</p>', // XSS OK WPCS
484 484
 	)
485 485
 );
486 486
 
487 487
 $screen->set_help_sidebar(
488
-	'<p><strong>' . esc_html__( 'For more information:', 'wordpoints' ) . '</strong></p>
489
-	<p><a href="https://wordpoints.org/developer-guide/modules/">' . esc_html__( 'Developer Documentation', 'wordpoints' ) . '</a></p>
490
-	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__( 'Support Forums', 'wordpoints' ) . '</a></p>'
488
+	'<p><strong>' . esc_html__('For more information:', 'wordpoints') . '</strong></p>
489
+	<p><a href="https://wordpoints.org/developer-guide/modules/">' . esc_html__('Developer Documentation', 'wordpoints') . '</a></p>
490
+	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__('Support Forums', 'wordpoints') . '</a></p>'
491 491
 );
492 492
 
493 493
 register_column_headers(
494 494
 	$screen
495 495
 	, array(
496 496
 		'cb'          => '<input type="checkbox" />',
497
-		'name'        => _x( 'Module', 'modules table heading', 'wordpoints' ),
498
-		'description' => _x( 'Description', 'modules table heading', 'wordpoints' ),
497
+		'name'        => _x('Module', 'modules table heading', 'wordpoints'),
498
+		'description' => _x('Description', 'modules table heading', 'wordpoints'),
499 499
 	)
500 500
 );
501 501
 
502 502
 $screen->set_screen_reader_content(
503 503
 	array(
504
-		'heading_views'      => __( 'Filter modules list', 'wordpoints' ),
505
-		'heading_pagination' => __( 'Modules list navigation', 'wordpoints' ),
506
-		'heading_list'       => __( 'Modules list', 'wordpoints' ),
504
+		'heading_views'      => __('Filter modules list', 'wordpoints'),
505
+		'heading_pagination' => __('Modules list navigation', 'wordpoints'),
506
+		'heading_list'       => __('Modules list', 'wordpoints'),
507 507
 	)
508 508
 );
509 509
 
Please login to merge, or discard this patch.