Completed
Push — master ( e9e0b4...cbda97 )
by J.D.
03:49
created
src/components/points/includes/filters.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,61 +7,61 @@
 block discarded – undo
7 7
  * @since 2.1.0
8 8
  */
9 9
 
10
-add_action( 'wordpoints_init_app-components', 'wordpoints_points_components_app_init' );
10
+add_action('wordpoints_init_app-components', 'wordpoints_points_components_app_init');
11 11
 
12
-add_action( 'wordpoints_init_app-components-points', 'wordpoints_points_apps_init' );
13
-add_action( 'wordpoints_init_app-components-points-logs', 'wordpoints_points_logs_apps_init' );
12
+add_action('wordpoints_init_app-components-points', 'wordpoints_points_apps_init');
13
+add_action('wordpoints_init_app-components-points-logs', 'wordpoints_points_logs_apps_init');
14 14
 
15
-add_action( 'wordpoints_init_app_registry-components-points-logs-views', 'wordpoints_points_logs_views_init' );
16
-add_action( 'wordpoints_init_app_registry-components-points-logs-viewing_restrictions', 'wordpoints_points_logs_viewing_restrictions_init' );
15
+add_action('wordpoints_init_app_registry-components-points-logs-views', 'wordpoints_points_logs_views_init');
16
+add_action('wordpoints_init_app_registry-components-points-logs-viewing_restrictions', 'wordpoints_points_logs_viewing_restrictions_init');
17 17
 
18
-add_action( 'wordpoints_init_app_registry-hooks-reactors', 'wordpoints_points_hook_reactors_init' );
19
-add_action( 'wordpoints_init_app_registry-hooks-reaction_stores', 'wordpoints_points_hook_reaction_stores_init' );
20
-add_action( 'wordpoints_init_app_registry-hooks-extensions', 'wordpoints_points_hook_extensions_init' );
18
+add_action('wordpoints_init_app_registry-hooks-reactors', 'wordpoints_points_hook_reactors_init');
19
+add_action('wordpoints_init_app_registry-hooks-reaction_stores', 'wordpoints_points_hook_reaction_stores_init');
20
+add_action('wordpoints_init_app_registry-hooks-extensions', 'wordpoints_points_hook_extensions_init');
21 21
 
22
-if ( get_option( 'wordpoints_points_register_legacy_post_publish_event' ) ) {
23
-	add_action( 'wordpoints_register_post_type_hook_events', 'wordpoints_points_register_legacy_post_publish_events' );
22
+if (get_option('wordpoints_points_register_legacy_post_publish_event')) {
23
+	add_action('wordpoints_register_post_type_hook_events', 'wordpoints_points_register_legacy_post_publish_events');
24 24
 }
25 25
 
26
-add_action( 'wp_enqueue_scripts', 'wordpoints_points_register_scripts', 5 );
27
-add_action( 'admin_enqueue_scripts', 'wordpoints_points_register_scripts', 5 );
26
+add_action('wp_enqueue_scripts', 'wordpoints_points_register_scripts', 5);
27
+add_action('admin_enqueue_scripts', 'wordpoints_points_register_scripts', 5);
28 28
 
29
-add_filter( 'wordpoints_format_points', 'wordpoints_format_points_filter', 5, 3 );
29
+add_filter('wordpoints_format_points', 'wordpoints_format_points_filter', 5, 3);
30 30
 
31
-add_action( 'deleted_user', 'wordpoints_delete_points_logs_for_user' );
32
-add_action( 'delete_blog', 'wordpoints_delete_points_logs_for_blog' );
31
+add_action('deleted_user', 'wordpoints_delete_points_logs_for_user');
32
+add_action('delete_blog', 'wordpoints_delete_points_logs_for_blog');
33 33
 
34
-add_action( 'wordpoints_points_type_form_top', 'wordpoints_points_settings_custom_meta_key_message' );
35
-add_action( 'wordpoints_admin_points_logs_tab', 'wordpoints_points_logs_custom_meta_key_message' );
34
+add_action('wordpoints_points_type_form_top', 'wordpoints_points_settings_custom_meta_key_message');
35
+add_action('wordpoints_admin_points_logs_tab', 'wordpoints_points_logs_custom_meta_key_message');
36 36
 
37
-add_action( 'init', 'wordpoints_points_add_global_cache_groups', 5 );
37
+add_action('init', 'wordpoints_points_add_global_cache_groups', 5);
38 38
 
39
-add_action( 'wordpoints_register_points_logs_queries', 'wordpoints_register_default_points_logs_queries' );
39
+add_action('wordpoints_register_points_logs_queries', 'wordpoints_register_default_points_logs_queries');
40 40
 
41
-add_action( 'wordpoints_points_log-profile_edit', 'wordpoints_points_logs_profile_edit', 10, 6 );
42
-add_action( 'wordpoints_points_log-comment_disapprove', 'wordpoints_points_logs_comment_disapprove', 10, 6 );
43
-add_action( 'wordpoints_points_log-post_delete', 'wordpoints_points_logs_post_delete', 10, 6 );
41
+add_action('wordpoints_points_log-profile_edit', 'wordpoints_points_logs_profile_edit', 10, 6);
42
+add_action('wordpoints_points_log-comment_disapprove', 'wordpoints_points_logs_comment_disapprove', 10, 6);
43
+add_action('wordpoints_points_log-post_delete', 'wordpoints_points_logs_post_delete', 10, 6);
44 44
 
45
-add_action( 'wordpoints_points_altered', 'wordpoints_clean_points_logs_cache', 10, 3 );
46
-add_action( 'wordpoints_points_altered', 'wordpoints_clean_points_top_users_cache', 10, 3 );
45
+add_action('wordpoints_points_altered', 'wordpoints_clean_points_logs_cache', 10, 3);
46
+add_action('wordpoints_points_altered', 'wordpoints_clean_points_top_users_cache', 10, 3);
47 47
 
48
-add_action( 'user_register', 'wordpoints_clean_points_top_users_cache_user_register' );
48
+add_action('user_register', 'wordpoints_clean_points_top_users_cache_user_register');
49 49
 
50
-add_action( 'wordpoints_modules_loaded', 'WordPoints_Points_Hooks::initialize_hooks' );
50
+add_action('wordpoints_modules_loaded', 'WordPoints_Points_Hooks::initialize_hooks');
51 51
 
52
-add_action( 'widgets_init', 'wordpoints_register_points_widgets' );
52
+add_action('widgets_init', 'wordpoints_register_points_widgets');
53 53
 
54
-add_action( 'wordpoints_points_hooks_register', 'wordpoints_register_points_hooks' );
54
+add_action('wordpoints_points_hooks_register', 'wordpoints_register_points_hooks');
55 55
 
56
-if ( ! is_multisite() || is_wordpoints_network_active() ) {
57
-	add_action( 'deleted_user', 'wordpoints_clean_points_top_users_cache_user_deleted' );
56
+if ( ! is_multisite() || is_wordpoints_network_active()) {
57
+	add_action('deleted_user', 'wordpoints_clean_points_top_users_cache_user_deleted');
58 58
 } else {
59
-	add_action( 'remove_user_from_blog', 'wordpoints_clean_points_top_users_cache_user_deleted' );
59
+	add_action('remove_user_from_blog', 'wordpoints_clean_points_top_users_cache_user_deleted');
60 60
 }
61 61
 
62
-WordPoints_Shortcodes::register( 'wordpoints_points_top', 'WordPoints_Points_Top_Shortcode' );
63
-WordPoints_Shortcodes::register( 'wordpoints_points_logs', 'WordPoints_Points_Logs_Shortcode' );
64
-WordPoints_Shortcodes::register( 'wordpoints_points', 'WordPoints_User_Points_Shortcode' );
65
-WordPoints_Shortcodes::register( 'wordpoints_how_to_get_points', 'WordPoints_How_To_Get_Points_Shortcode' );
62
+WordPoints_Shortcodes::register('wordpoints_points_top', 'WordPoints_Points_Top_Shortcode');
63
+WordPoints_Shortcodes::register('wordpoints_points_logs', 'WordPoints_Points_Logs_Shortcode');
64
+WordPoints_Shortcodes::register('wordpoints_points', 'WordPoints_User_Points_Shortcode');
65
+WordPoints_Shortcodes::register('wordpoints_how_to_get_points', 'WordPoints_How_To_Get_Points_Shortcode');
66 66
 
67 67
 // EOF
Please login to merge, or discard this patch.
src/components/points/includes/shortcodes.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	protected function verify_atts() {
26 26
 
27
-		if ( isset( $this->pairs['points_type'] ) ) {
27
+		if (isset($this->pairs['points_type'])) {
28 28
 
29 29
 			$points_type = $this->get_points_type();
30 30
 
31
-			if ( is_wp_error( $points_type ) ) {
31
+			if (is_wp_error($points_type)) {
32 32
 				return $points_type;
33 33
 			}
34 34
 
@@ -54,19 +54,19 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$points_type = $this->atts['points_type'];
56 56
 
57
-		if ( ! wordpoints_is_points_type( $points_type ) ) {
57
+		if ( ! wordpoints_is_points_type($points_type)) {
58 58
 
59 59
 			$points_type = wordpoints_get_default_points_type();
60 60
 
61
-			if ( ! $points_type ) {
61
+			if ( ! $points_type) {
62 62
 
63 63
 				$points_type = new WP_Error(
64 64
 					'wordpoints_shortcode_no_points_type'
65 65
 					, sprintf(
66
-						__( 'The “%1$s” attribute of the %2$s shortcode must be the slug of a points type. Example: %3$s.', 'wordpoints' )
66
+						__('The “%1$s” attribute of the %2$s shortcode must be the slug of a points type. Example: %3$s.', 'wordpoints')
67 67
 						, 'points_type'
68
-						, '<code>[' . sanitize_key( $this->shortcode ) . ']</code>'
69
-						, '<code>[' . sanitize_key( $this->shortcode ) . ' points_type="points"]</code>'
68
+						, '<code>[' . sanitize_key($this->shortcode) . ']</code>'
69
+						, '<code>[' . sanitize_key($this->shortcode) . ' points_type="points"]</code>'
70 70
 					)
71 71
 				);
72 72
 			}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		 * @param array           $atts        The shortcode attributes.
82 82
 		 * @param string          $shortcode   The shortcode.
83 83
 		 */
84
-		return apply_filters( 'wordpoints_shortcode_points_type', $points_type, $this->atts, $this->shortcode );
84
+		return apply_filters('wordpoints_shortcode_points_type', $points_type, $this->atts, $this->shortcode);
85 85
 	}
86 86
 }
87 87
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function verify_atts() {
112 112
 
113
-		if ( ! wordpoints_posint( $this->atts['users'] ) ) {
113
+		if ( ! wordpoints_posint($this->atts['users'])) {
114 114
 			return sprintf(
115
-				__( 'The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints' )
115
+				__('The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints')
116 116
 				, 'users'
117
-				, '<code>[' . sanitize_key( $this->shortcode ) . ']</code>'
118
-				, '<code>[' . sanitize_key( $this->shortcode ) . ' <b>users="10"</b> type="points"]</code>'
117
+				, '<code>[' . sanitize_key($this->shortcode) . ']</code>'
118
+				, '<code>[' . sanitize_key($this->shortcode) . ' <b>users="10"</b> type="points"]</code>'
119 119
 			);
120 120
 		}
121 121
 
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function verify_atts() {
169 169
 
170
-		if ( ! wordpoints_is_points_logs_query( $this->atts['query'] ) ) {
170
+		if ( ! wordpoints_is_points_logs_query($this->atts['query'])) {
171 171
 			return sprintf(
172
-				__( 'The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints' )
172
+				__('The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints')
173 173
 				, 'query'
174
-				, '<code>[' . sanitize_key( $this->shortcode ) . ']</code>'
175
-				, '<code>[' . sanitize_key( $this->shortcode ) . ' <b>query="default"</b> points_type="points"]</code>'
174
+				, '<code>[' . sanitize_key($this->shortcode) . ']</code>'
175
+				, '<code>[' . sanitize_key($this->shortcode) . ' <b>query="default"</b> points_type="points"]</code>'
176 176
 			);
177 177
 		}
178 178
 
179
-		if ( false === wordpoints_int( $this->atts['paginate'] ) ) {
179
+		if (false === wordpoints_int($this->atts['paginate'])) {
180 180
 			$this->atts['paginate'] = 1;
181 181
 		}
182 182
 
183 183
 		// Back-compat. Needs to stay here "forever" for legacy installs.
184
-		if ( isset( $this->atts['datatables'] ) ) {
185
-			$this->atts['paginate'] = wordpoints_int( $this->atts['datatables'] );
184
+		if (isset($this->atts['datatables'])) {
185
+			$this->atts['paginate'] = wordpoints_int($this->atts['datatables']);
186 186
 		}
187 187
 
188
-		if ( false === wordpoints_int( $this->atts['show_users'] ) ) {
188
+		if (false === wordpoints_int($this->atts['show_users'])) {
189 189
 			$this->atts['show_users'] = 1;
190 190
 		}
191 191
 
@@ -277,34 +277,34 @@  discard block
 block discarded – undo
277 277
 		 * @param string[] $extra_classes The extra classes for the table element.
278 278
 		 * @param array    $atts          The arguments for table display from the shortcode.
279 279
 		 */
280
-		$extra_classes = apply_filters( 'wordpoints_how_to_get_points_table_extra_classes', array(), $this->atts );
280
+		$extra_classes = apply_filters('wordpoints_how_to_get_points_table_extra_classes', array(), $this->atts);
281 281
 
282
-		$points_heading = _x( 'Points', 'column name', 'wordpoints' );
282
+		$points_heading = _x('Points', 'column name', 'wordpoints');
283 283
 
284 284
 		$points_type_name = wordpoints_get_points_type_setting(
285 285
 			$this->atts['points_type']
286 286
 			, 'name'
287 287
 		);
288 288
 
289
-		if ( ! empty( $points_type_name ) ) {
289
+		if ( ! empty($points_type_name)) {
290 290
 			$points_heading = $points_type_name;
291 291
 		}
292 292
 
293
-		$html = '<table class="wordpoints-how-to-get-points ' . esc_attr( implode( ' ', $extra_classes ) ) . '">
293
+		$html = '<table class="wordpoints-how-to-get-points ' . esc_attr(implode(' ', $extra_classes)) . '">
294 294
 			<thead>
295
-				<tr><th style="padding-right: 10px">' . esc_html( $points_heading ) . '</th>
296
-				<th>' . esc_html_x( 'Action', 'column name', 'wordpoints' ) . '</th></tr>
295
+				<tr><th style="padding-right: 10px">' . esc_html($points_heading) . '</th>
296
+				<th>' . esc_html_x('Action', 'column name', 'wordpoints') . '</th></tr>
297 297
 			</thead>
298 298
 			<tbody>';
299 299
 
300
-		$html .= $this->list_reactions( 'points' );
300
+		$html .= $this->list_reactions('points');
301 301
 		$html .= $this->list_points_hooks();
302 302
 
303
-		if ( is_wordpoints_network_active() ) {
303
+		if (is_wordpoints_network_active()) {
304 304
 
305
-			WordPoints_Points_Hooks::set_network_mode( true );
305
+			WordPoints_Points_Hooks::set_network_mode(true);
306 306
 			$html .= $this->list_points_hooks();
307
-			WordPoints_Points_Hooks::set_network_mode( false );
307
+			WordPoints_Points_Hooks::set_network_mode(false);
308 308
 		}
309 309
 
310 310
 		$html .= '</tbody></table>';
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
 		$network = '';
325 325
 
326
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
326
+		if (WordPoints_Points_Hooks::get_network_mode()) {
327 327
 			$network = 'network_';
328 328
 		}
329 329
 
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
 
334 334
 		$html = '';
335 335
 
336
-		foreach ( $hooks as $hook_id ) {
336
+		foreach ($hooks as $hook_id) {
337 337
 
338
-			$hook = WordPoints_Points_Hooks::get_handler( $hook_id );
338
+			$hook = WordPoints_Points_Hooks::get_handler($hook_id);
339 339
 
340
-			if ( ! $hook ) {
340
+			if ( ! $hook) {
341 341
 				continue;
342 342
 			}
343 343
 
344
-			$points = $hook->get_points( $network . $hook->get_number() );
344
+			$points = $hook->get_points($network . $hook->get_number());
345 345
 
346
-			if ( ! $points ) {
346
+			if ( ! $points) {
347 347
 				continue;
348 348
 			}
349 349
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
 			$html .= '<tr>
357 357
 				<td>' . $points . '</td>
358
-				<td>' . esc_html( $hook->get_description() ) . '</td>
358
+				<td>' . esc_html($hook->get_description()) . '</td>
359 359
 				</tr>';
360 360
 		}
361 361
 
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return string The HTML for the table rows.
376 376
 	 */
377
-	protected function list_reactions( $store_slug ) {
377
+	protected function list_reactions($store_slug) {
378 378
 
379 379
 		$html = '';
380 380
 
381
-		foreach ( wordpoints_hooks()->get_reaction_stores( $store_slug ) as $store ) {
381
+		foreach (wordpoints_hooks()->get_reaction_stores($store_slug) as $store) {
382 382
 
383
-			foreach ( $store->get_reactions() as $reaction ) {
383
+			foreach ($store->get_reactions() as $reaction) {
384 384
 
385
-				if ( $reaction->get_meta( 'points_type' ) !== $this->atts['points_type'] ) {
385
+				if ($reaction->get_meta('points_type') !== $this->atts['points_type']) {
386 386
 					continue;
387 387
 				}
388 388
 
389
-				$points = $reaction->get_meta( 'points' );
389
+				$points = $reaction->get_meta('points');
390 390
 
391
-				if ( ! $points ) {
391
+				if ( ! $points) {
392 392
 					continue;
393 393
 				}
394 394
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
 				$html .= '<tr>
402 402
 					<td>' . $points . '</td>
403
-					<td>' . esc_html( $reaction->get_meta( 'description' ) ) . '</td>
403
+					<td>' . esc_html($reaction->get_meta('description')) . '</td>
404 404
 					</tr>';
405 405
 			}
406 406
 		}
Please login to merge, or discard this patch.
src/components/points/includes/deprecated.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return string
24 24
  */
25
-function wordpoints_points_top_shortcode( $atts ) {
25
+function wordpoints_points_top_shortcode($atts) {
26 26
 
27
-	_deprecated_function( __FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()' );
27
+	_deprecated_function(__FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()');
28 28
 
29
-	return WordPoints_Shortcodes::do_shortcode( $atts, null, 'wordpoints_points_top' );
29
+	return WordPoints_Shortcodes::do_shortcode($atts, null, 'wordpoints_points_top');
30 30
 }
31 31
 
32 32
 /**
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
  *
52 52
  * @return string
53 53
  */
54
-function wordpoints_points_logs_shortcode( $atts ) {
54
+function wordpoints_points_logs_shortcode($atts) {
55 55
 
56
-	_deprecated_function( __FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()' );
56
+	_deprecated_function(__FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()');
57 57
 
58
-	return WordPoints_Shortcodes::do_shortcode( $atts, null, 'wordpoints_points_logs' );
58
+	return WordPoints_Shortcodes::do_shortcode($atts, null, 'wordpoints_points_logs');
59 59
 }
60 60
 
61 61
 /**
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
  *
77 77
  * @return string The points for the user.
78 78
  */
79
-function wordpoints_points_shortcode( $atts ) {
79
+function wordpoints_points_shortcode($atts) {
80 80
 
81
-	_deprecated_function( __FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()' );
81
+	_deprecated_function(__FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()');
82 82
 
83
-	return WordPoints_Shortcodes::do_shortcode( $atts, null, 'wordpoints_points' );
83
+	return WordPoints_Shortcodes::do_shortcode($atts, null, 'wordpoints_points');
84 84
 }
85 85
 
86 86
 /**
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @return string A list of points hooks describing how the user can earn points.
99 99
  */
100
-function wordpoints_how_to_get_points_shortcode( $atts ) {
100
+function wordpoints_how_to_get_points_shortcode($atts) {
101 101
 
102
-	_deprecated_function( __FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()' );
102
+	_deprecated_function(__FUNCTION__, '1.8.0', 'WordPoints_Shortcodes::do_shortcode()');
103 103
 
104
-	return WordPoints_Shortcodes::do_shortcode( $atts, null, 'wordpoints_how_to_get_points' );
104
+	return WordPoints_Shortcodes::do_shortcode($atts, null, 'wordpoints_how_to_get_points');
105 105
 }
106 106
 
107 107
 /**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @type array $defaults
125 125
 	 */
126
-	protected $defaults = array( 'points' => 10, 'post_type' => 'ALL' );
126
+	protected $defaults = array('points' => 10, 'post_type' => 'ALL');
127 127
 
128 128
 	/**
129 129
 	 * Initialize the hook.
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function __construct() {
134 134
 
135
-		if ( ! get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
136
-			_deprecated_function( __METHOD__, '1.9.0' );
135
+		if ( ! get_site_option('wordpoints_comment_removed_hook_legacy')) {
136
+			_deprecated_function(__METHOD__, '1.9.0');
137 137
 		}
138 138
 
139 139
 		$this->init(
140
-			_x( 'Comment Removed', 'points hook name', 'wordpoints' )
140
+			_x('Comment Removed', 'points hook name', 'wordpoints')
141 141
 			, array(
142
-				'description' => __( 'Comment removed from the site.', 'wordpoints' ),
142
+				'description' => __('Comment removed from the site.', 'wordpoints'),
143 143
 				/* translators: the post type name. */
144
-				'post_type_description' => __( 'Comment on a %s removed from the site.', 'wordpoints' ),
145
-				'post_type_filter' => array( $this, 'post_type_supports_comments' ),
146
-				'points_label' => __( 'Points subtracted if comment removed:', 'wordpoints' ),
144
+				'post_type_description' => __('Comment on a %s removed from the site.', 'wordpoints'),
145
+				'post_type_filter' => array($this, 'post_type_supports_comments'),
146
+				'points_label' => __('Points subtracted if comment removed:', 'wordpoints'),
147 147
 			)
148 148
 		);
149 149
 
150
-		add_action( 'transition_comment_status', array( $this, 'hook' ), 10, 3 );
151
-		add_filter( 'wordpoints_points_log-comment_disapprove', array( $this, 'logs' ), 10, 6 );
150
+		add_action('transition_comment_status', array($this, 'hook'), 10, 3);
151
+		add_filter('wordpoints_points_log-comment_disapprove', array($this, 'logs'), 10, 6);
152 152
 	}
153 153
 
154 154
 	/**
@@ -166,36 +166,36 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return void
168 168
 	 */
169
-	public function hook( $new_status, $old_status, $comment ) {
169
+	public function hook($new_status, $old_status, $comment) {
170 170
 
171
-		if ( ! get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
172
-			_deprecated_function( __METHOD__, '1.9.0' );
171
+		if ( ! get_site_option('wordpoints_comment_removed_hook_legacy')) {
172
+			_deprecated_function(__METHOD__, '1.9.0');
173 173
 		}
174 174
 
175
-		if ( ! $comment->user_id || $old_status === $new_status ) {
175
+		if ( ! $comment->user_id || $old_status === $new_status) {
176 176
 			return;
177 177
 		}
178 178
 
179
-		$post = get_post( $comment->comment_post_ID );
179
+		$post = get_post($comment->comment_post_ID);
180 180
 
181
-		if ( 'approved' === $old_status ) {
181
+		if ('approved' === $old_status) {
182 182
 
183
-			foreach ( $this->get_instances() as $number => $instance ) {
183
+			foreach ($this->get_instances() as $number => $instance) {
184 184
 
185
-				$instance = array_merge( $this->defaults, $instance );
185
+				$instance = array_merge($this->defaults, $instance);
186 186
 
187
-				if ( ! $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) ) {
187
+				if ( ! $this->is_matching_post_type($post->post_type, $instance['post_type'])) {
188 188
 					continue;
189 189
 				}
190 190
 
191
-				$points_type = $this->points_type( $number );
191
+				$points_type = $this->points_type($number);
192 192
 
193
-				wordpoints_subtract_points( $comment->user_id, $instance['points'], $points_type, 'comment_disapprove', array( 'status' => $new_status ) );
193
+				wordpoints_subtract_points($comment->user_id, $instance['points'], $points_type, 'comment_disapprove', array('status' => $new_status));
194 194
 
195 195
 				update_comment_meta(
196 196
 					$comment->comment_ID
197
-					, wp_slash( "wordpoints_last_status-{$points_type}" )
198
-					, wp_slash( $new_status )
197
+					, wp_slash("wordpoints_last_status-{$points_type}")
198
+					, wp_slash($new_status)
199 199
 				);
200 200
 			}
201 201
 		}
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return void
222 222
 	 */
223
-	public function new_comment_hook( $comment_id, $comment ) {
223
+	public function new_comment_hook($comment_id, $comment) {
224 224
 
225
-		if ( ! get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
226
-			_deprecated_function( __METHOD__, '1.9.0' );
225
+		if ( ! get_site_option('wordpoints_comment_removed_hook_legacy')) {
226
+			_deprecated_function(__METHOD__, '1.9.0');
227 227
 		}
228 228
 
229
-		if ( 0 === (int) $comment->user_id ) {
229
+		if (0 === (int) $comment->user_id) {
230 230
 			return;
231 231
 		}
232 232
 
233
-		switch ( $comment->comment_approved ) {
233
+		switch ($comment->comment_approved) {
234 234
 
235 235
 			// Comment hasn't been approved yet.
236 236
 			case 0: return;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 				$old_status = 'approved';
245 245
 		}
246 246
 
247
-		$this->hook( $new_status, $old_status, $comment );
247
+		$this->hook($new_status, $old_status, $comment);
248 248
 	}
249 249
 
250 250
 	/**
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return string
265 265
 	 */
266
-	public function logs( $text, $points, $points_type, $user_id, $log_type, $meta ) {
266
+	public function logs($text, $points, $points_type, $user_id, $log_type, $meta) {
267 267
 
268
-		if ( ! get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
269
-			_deprecated_function( __METHOD__, '1.9.0', 'wordpoints_points_logs_comment_disapprove' );
268
+		if ( ! get_site_option('wordpoints_comment_removed_hook_legacy')) {
269
+			_deprecated_function(__METHOD__, '1.9.0', 'wordpoints_points_logs_comment_disapprove');
270 270
 		}
271 271
 
272 272
 		return wordpoints_points_logs_comment_disapprove(
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @return int|false The number of points, or false.
290 290
 	 */
291
-	public function get_points( $number = null ) {
291
+	public function get_points($number = null) {
292 292
 
293
-		if ( ! get_site_option( 'wordpoints_comment_removed_hook_legacy' ) ) {
294
-			_deprecated_function( __METHOD__, '1.9.0' );
293
+		if ( ! get_site_option('wordpoints_comment_removed_hook_legacy')) {
294
+			_deprecated_function(__METHOD__, '1.9.0');
295 295
 		}
296 296
 
297
-		$points = parent::get_points( $number );
297
+		$points = parent::get_points($number);
298 298
 
299
-		if ( $points ) {
299
+		if ($points) {
300 300
 			$points = -$points;
301 301
 		}
302 302
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @type array $defaults
324 324
 	 */
325
-	protected $defaults = array( 'points' => 20, 'post_type' => 'ALL' );
325
+	protected $defaults = array('points' => 20, 'post_type' => 'ALL');
326 326
 
327 327
 	//
328 328
 	// Public Methods.
@@ -335,22 +335,22 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	public function __construct() {
337 337
 
338
-		if ( ! get_site_option( 'wordpoints_post_delete_hook_legacy' ) ) {
339
-			_deprecated_function( __METHOD__, '1.9.0' );
338
+		if ( ! get_site_option('wordpoints_post_delete_hook_legacy')) {
339
+			_deprecated_function(__METHOD__, '1.9.0');
340 340
 		}
341 341
 
342 342
 		$this->init(
343
-			_x( 'Post Delete', 'points hook name', 'wordpoints' )
343
+			_x('Post Delete', 'points hook name', 'wordpoints')
344 344
 			,array(
345
-				'description'  => __( 'A post is permanently deleted.', 'wordpoints' ),
346
-				'points_label' => __( 'Points removed when deleted:', 'wordpoints' ),
345
+				'description'  => __('A post is permanently deleted.', 'wordpoints'),
346
+				'points_label' => __('Points removed when deleted:', 'wordpoints'),
347 347
 				/* translators: the post type name. */
348
-				'post_type_description' => __( '%s permanently deleted.', 'wordpoints' ),
348
+				'post_type_description' => __('%s permanently deleted.', 'wordpoints'),
349 349
 			)
350 350
 		);
351 351
 
352
-		add_action( 'delete_post', array( $this, 'hook' ) );
353
-		add_filter( 'wordpoints_points_log-post_delete', array( $this, 'logs' ), 10, 6 );
352
+		add_action('delete_post', array($this, 'hook'));
353
+		add_filter('wordpoints_points_log-post_delete', array($this, 'logs'), 10, 6);
354 354
 	}
355 355
 
356 356
 	/**
@@ -362,30 +362,30 @@  discard block
 block discarded – undo
362 362
 	 *
363 363
 	 * @param int $post_id The post's ID.
364 364
 	 */
365
-	public function hook( $post_id ) {
365
+	public function hook($post_id) {
366 366
 
367
-		if ( ! get_site_option( 'wordpoints_post_delete_hook_legacy' ) ) {
368
-			_deprecated_function( __METHOD__, '1.9.0' );
367
+		if ( ! get_site_option('wordpoints_post_delete_hook_legacy')) {
368
+			_deprecated_function(__METHOD__, '1.9.0');
369 369
 		}
370 370
 
371
-		$post = get_post( $post_id, OBJECT, 'display' );
371
+		$post = get_post($post_id, OBJECT, 'display');
372 372
 
373
-		foreach ( $this->get_instances() as $number => $instance ) {
373
+		foreach ($this->get_instances() as $number => $instance) {
374 374
 
375
-			$instance = array_merge( $this->defaults, $instance );
375
+			$instance = array_merge($this->defaults, $instance);
376 376
 
377 377
 			if (
378
-				$this->is_matching_post_type( $post->post_type, $instance['post_type'] )
378
+				$this->is_matching_post_type($post->post_type, $instance['post_type'])
379 379
 				&& 'auto-draft' !== $post->post_status
380
-				&& __( 'Auto Draft', 'default' ) !== $post->post_title
380
+				&& __('Auto Draft', 'default') !== $post->post_title
381 381
 			) {
382 382
 
383 383
 				wordpoints_alter_points(
384 384
 					$post->post_author
385 385
 					, -$instance['points']
386
-					, $this->points_type( $number )
386
+					, $this->points_type($number)
387 387
 					, 'post_delete'
388
-					, array( 'post_title' => $post->post_title, 'post_type' => $post->post_type )
388
+					, array('post_title' => $post->post_title, 'post_type' => $post->post_type)
389 389
 				);
390 390
 			}
391 391
 		}
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 	 *
410 410
 	 * @return string
411 411
 	 */
412
-	public function logs( $text, $points, $points_type, $user_id, $log_type, $meta ) {
412
+	public function logs($text, $points, $points_type, $user_id, $log_type, $meta) {
413 413
 
414
-		if ( ! get_site_option( 'wordpoints_post_delete_hook_legacy' ) ) {
415
-			_deprecated_function( __METHOD__, '1.9.0', 'wordpoints_points_logs_post_delete' );
414
+		if ( ! get_site_option('wordpoints_post_delete_hook_legacy')) {
415
+			_deprecated_function(__METHOD__, '1.9.0', 'wordpoints_points_logs_post_delete');
416 416
 		}
417 417
 
418 418
 		return wordpoints_points_logs_post_delete(
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 	 *
435 435
 	 * @return int|false The number of points, or false.
436 436
 	 */
437
-	public function get_points( $number = null ) {
437
+	public function get_points($number = null) {
438 438
 
439
-		if ( ! get_site_option( 'wordpoints_post_delete_hook_legacy' ) ) {
440
-			_deprecated_function( __METHOD__, '1.9.0' );
439
+		if ( ! get_site_option('wordpoints_post_delete_hook_legacy')) {
440
+			_deprecated_function(__METHOD__, '1.9.0');
441 441
 		}
442 442
 
443
-		$points = parent::get_points( $number );
443
+		$points = parent::get_points($number);
444 444
 
445
-		if ( $points ) {
445
+		if ($points) {
446 446
 			$points = -$points;
447 447
 		}
448 448
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
  */
462 462
 function wordpoints_points_get_db_schema() {
463 463
 
464
-	_deprecated_function( __FUNCTION__, '2.0.0' );
464
+	_deprecated_function(__FUNCTION__, '2.0.0');
465 465
 
466 466
 	global $wpdb;
467 467
 
@@ -500,16 +500,16 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @param int $blog_id The ID of the new site.
502 502
  */
503
-function wordpoints_points_add_custom_caps_to_new_sites( $blog_id ) {
503
+function wordpoints_points_add_custom_caps_to_new_sites($blog_id) {
504 504
 
505
-	_deprecated_function( __FUNCTION__, '2.0.0' );
505
+	_deprecated_function(__FUNCTION__, '2.0.0');
506 506
 
507
-	if ( ! is_wordpoints_network_active() ) {
507
+	if ( ! is_wordpoints_network_active()) {
508 508
 		return;
509 509
 	}
510 510
 
511
-	switch_to_blog( $blog_id );
512
-	wordpoints_add_custom_caps( wordpoints_points_get_custom_caps() );
511
+	switch_to_blog($blog_id);
512
+	wordpoints_add_custom_caps(wordpoints_points_get_custom_caps());
513 513
 	restore_current_blog();
514 514
 }
515 515
 
Please login to merge, or discard this patch.
src/components/points/includes/apps.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @param WordPoints_App $components The components app.
18 18
  */
19
-function wordpoints_points_components_app_init( $components ) {
19
+function wordpoints_points_components_app_init($components) {
20 20
 
21 21
 	$apps = $components->sub_apps();
22 22
 
23
-	$apps->register( 'points', 'WordPoints_App' );
23
+	$apps->register('points', 'WordPoints_App');
24 24
 }
25 25
 
26 26
 /**
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @param WordPoints_App $app The points app.
34 34
  */
35
-function wordpoints_points_apps_init( $app ) {
35
+function wordpoints_points_apps_init($app) {
36 36
 
37 37
 	$apps = $app->sub_apps();
38 38
 
39
-	$apps->register( 'logs', 'WordPoints_App' );
39
+	$apps->register('logs', 'WordPoints_App');
40 40
 }
41 41
 
42 42
 /**
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @param WordPoints_App $app The points logs app.
50 50
  */
51
-function wordpoints_points_logs_apps_init( $app ) {
51
+function wordpoints_points_logs_apps_init($app) {
52 52
 
53 53
 	$apps = $app->sub_apps();
54 54
 
55
-	$apps->register( 'views', 'WordPoints_Class_Registry' );
56
-	$apps->register( 'viewing_restrictions', 'WordPoints_Points_Logs_Viewing_Restrictions' );
55
+	$apps->register('views', 'WordPoints_Class_Registry');
56
+	$apps->register('viewing_restrictions', 'WordPoints_Points_Logs_Viewing_Restrictions');
57 57
 }
58 58
 
59 59
 /**
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @param WordPoints_Class_RegistryI $views The points log views registry.
67 67
  */
68
-function wordpoints_points_logs_views_init( $views ) {
68
+function wordpoints_points_logs_views_init($views) {
69 69
 
70
-	$views->register( 'table', 'WordPoints_Points_Logs_View_Table' );
70
+	$views->register('table', 'WordPoints_Points_Logs_View_Table');
71 71
 }
72 72
 
73 73
 /**
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
  *
80 80
  * @param WordPoints_Points_Logs_Viewing_Restrictions $restrictions The registry.
81 81
  */
82
-function wordpoints_points_logs_viewing_restrictions_init( $restrictions ) {
82
+function wordpoints_points_logs_viewing_restrictions_init($restrictions) {
83 83
 
84
-	$restrictions->register( 'all', 'hooks', 'WordPoints_Points_Logs_Viewing_Restriction_Hooks' );
84
+	$restrictions->register('all', 'hooks', 'WordPoints_Points_Logs_Viewing_Restriction_Hooks');
85 85
 
86
-	$restrictions->register( 'comment_approve', 'read_comment', 'WordPoints_Points_Logs_Viewing_Restriction_Read_Comment_Post' );
87
-	$restrictions->register( 'comment_received', 'read_comment', 'WordPoints_Points_Logs_Viewing_Restriction_Read_Comment_Post' );
88
-	$restrictions->register( 'post_publish', 'read_post', 'WordPoints_Points_Logs_Viewing_Restriction_Read_Post' );
86
+	$restrictions->register('comment_approve', 'read_comment', 'WordPoints_Points_Logs_Viewing_Restriction_Read_Comment_Post');
87
+	$restrictions->register('comment_received', 'read_comment', 'WordPoints_Points_Logs_Viewing_Restriction_Read_Comment_Post');
88
+	$restrictions->register('post_publish', 'read_post', 'WordPoints_Points_Logs_Viewing_Restriction_Read_Post');
89 89
 }
90 90
 
91 91
 // EOF
Please login to merge, or discard this patch.
src/components/points/admin/admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@
 block discarded – undo
22 22
  *
23 23
  * @since 2.1.0
24 24
  */
25
-require_once( WORDPOINTS_DIR . '/components/points/admin/includes/functions.php' );
25
+require_once(WORDPOINTS_DIR . '/components/points/admin/includes/functions.php');
26 26
 
27 27
 /**
28 28
  * Admin-side hooks.
29 29
  *
30 30
  * @since 2.1.0
31 31
  */
32
-require_once( WORDPOINTS_DIR . '/components/points/admin/includes/filters.php' );
32
+require_once(WORDPOINTS_DIR . '/components/points/admin/includes/filters.php');
33 33
 
34 34
 WordPoints_Class_Autoloader::register_dir(
35 35
 	WORDPOINTS_DIR . '/components/points/admin/classes'
Please login to merge, or discard this patch.
src/components/points/admin/classes/screen/points/types.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -211,9 +211,12 @@
 block discarded – undo
211 211
 					<p>
212 212
 						<?php if ( $slug ) : ?>
213 213
 							<?php esc_html_e( 'Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints' ) ?>
214
-						<?php else : ?>
214
+						<?php else {
215
+	: ?>
215 216
 							<?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ) ?>
216
-						<?php endif; ?>
217
+						<?php endif;
218
+}
219
+?>
217 220
 					</p>
218 221
 				</div>
219 222
 			<?php endif; ?>
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 2.1.0
79 79
 	 */
80 80
 	protected function get_title() {
81
-		return _x( 'Points Types', 'page title', 'wordpoints' );
81
+		return _x('Points Types', 'page title', 'wordpoints');
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
 		parent::hooks();
90 90
 
91
-		add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) );
92
-		add_action( 'add_meta_boxes', array( $this, 'add_points_logs_meta_box' ) );
93
-		add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) );
91
+		add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box'));
92
+		add_action('add_meta_boxes', array($this, 'add_points_logs_meta_box'));
93
+		add_action('add_meta_boxes', array($this, 'add_event_meta_boxes'));
94 94
 	}
95 95
 
96 96
 	/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function enqueue_scripts() {
100 100
 
101
-		wp_enqueue_style( 'wordpoints-hooks-admin' );
101
+		wp_enqueue_style('wordpoints-hooks-admin');
102 102
 
103
-		wp_enqueue_script( 'postbox' );
104
-		wp_enqueue_script( 'wordpoints-admin-points-types' );
103
+		wp_enqueue_script('postbox');
104
+		wp_enqueue_script('wordpoints-admin-points-types');
105 105
 
106 106
 		wordpoints_hooks_ui_setup_script_data();
107 107
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 					.addClass( 'closed' );
122 122
 
123 123
 				postboxes.add_postbox_toggles(
124
-					<?php echo wp_json_encode( $this->id ); ?>
124
+					<?php echo wp_json_encode($this->id); ?>
125 125
 				);
126 126
 			} );
127 127
 		</script>
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function add_points_settings_meta_box() {
138 138
 
139
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
139
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
140 140
 			return;
141 141
 		}
142 142
 
143 143
 		add_meta_box(
144 144
 			'settings'
145
-			, __( 'Settings', 'wordpoints' )
146
-			, array( $this, 'display_points_settings_meta_box' )
145
+			, __('Settings', 'wordpoints')
146
+			, array($this, 'display_points_settings_meta_box')
147 147
 			, $this->id
148 148
 			, 'side'
149 149
 			, 'default'
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function add_points_logs_meta_box() {
159 159
 
160
-		if ( ! $this->current_points_type ) {
160
+		if ( ! $this->current_points_type) {
161 161
 			return;
162 162
 		}
163 163
 
164 164
 		add_meta_box(
165 165
 			'logs'
166
-			, __( 'Logs', 'wordpoints' )
167
-			, array( $this, 'display_points_logs_meta_box' )
166
+			, __('Logs', 'wordpoints')
167
+			, array($this, 'display_points_logs_meta_box')
168 168
 			, $this->id
169 169
 			, 'side'
170 170
 			, 'default'
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function display_points_settings_meta_box() {
180 180
 
181
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
181
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
182 182
 			return;
183 183
 		}
184 184
 
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$add_new = 0;
188 188
 
189
-		$points_type = wordpoints_get_points_type( $slug );
189
+		$points_type = wordpoints_get_points_type($slug);
190 190
 
191
-		if ( ! $points_type ) {
191
+		if ( ! $points_type) {
192 192
 
193 193
 			$points_type = array();
194
-			$add_new     = wp_create_nonce( 'wordpoints_add_new_points_type' );
194
+			$add_new     = wp_create_nonce('wordpoints_add_new_points_type');
195 195
 		}
196 196
 
197 197
 		$points_type = array_merge(
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 		?>
207 207
 
208 208
 		<form method="post">
209
-			<?php if ( is_wordpoints_network_active() && ! is_network_admin() ) : ?>
209
+			<?php if (is_wordpoints_network_active() && ! is_network_admin()) : ?>
210 210
 				<div class="notice notice-info inline">
211 211
 					<p>
212
-						<?php if ( $slug ) : ?>
213
-							<?php esc_html_e( 'Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints' ) ?>
212
+						<?php if ($slug) : ?>
213
+							<?php esc_html_e('Changes to this points type&#8217;s settings will affect all sites on this network.', 'wordpoints') ?>
214 214
 						<?php else : ?>
215
-							<?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ) ?>
215
+							<?php esc_html_e('The new points type will be global across all sites on this network.', 'wordpoints') ?>
216 216
 						<?php endif; ?>
217 217
 					</p>
218 218
 				</div>
219 219
 			<?php endif; ?>
220 220
 
221
-			<?php if ( $slug ) : ?>
221
+			<?php if ($slug) : ?>
222 222
 				<p>
223 223
 					<span class="wordpoints-points-slug">
224 224
 						<em>
225 225
 							<?php
226 226
 
227 227
 							// translators: Points type slug.
228
-							echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) );
228
+							echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug));
229 229
 
230 230
 							?>
231 231
 						</em>
232 232
 					</span>
233 233
 				</p>
234
-				<?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?>
234
+				<?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?>
235 235
 			<?php endif; ?>
236 236
 
237 237
 			<?php
@@ -245,45 +245,45 @@  discard block
 block discarded – undo
245 245
 			 *
246 246
 			 * @param string $points_type The slug of the points type.
247 247
 			 */
248
-			do_action( 'wordpoints_points_type_form_top', $slug );
248
+			do_action('wordpoints_points_type_form_top', $slug);
249 249
 
250
-			if ( $add_new ) {
250
+			if ($add_new) {
251 251
 
252 252
 				// Mark the prefix and suffix optional on the add new form.
253
-				$prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' );
254
-				$suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' );
253
+				$prefix = _x('Prefix (optional):', 'points type', 'wordpoints');
254
+				$suffix = _x('Suffix (optional):', 'points type', 'wordpoints');
255 255
 
256 256
 			} else {
257 257
 
258
-				$prefix = _x( 'Prefix:', 'points type', 'wordpoints' );
259
-				$suffix = _x( 'Suffix:', 'points type', 'wordpoints' );
258
+				$prefix = _x('Prefix:', 'points type', 'wordpoints');
259
+				$suffix = _x('Suffix:', 'points type', 'wordpoints');
260 260
 			}
261 261
 
262 262
 			?>
263 263
 
264 264
 			<p>
265 265
 				<label
266
-					for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label>
266
+					for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label>
267 267
 				<input class="widefat" type="text"
268
-				       id="points-name-<?php echo esc_attr( $slug ); ?>"
268
+				       id="points-name-<?php echo esc_attr($slug); ?>"
269 269
 				       name="points-name"
270
-				       value="<?php echo esc_attr( $points_type['name'] ); ?>"/>
270
+				       value="<?php echo esc_attr($points_type['name']); ?>"/>
271 271
 			</p>
272 272
 			<p>
273 273
 				<label
274
-					for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label>
274
+					for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label>
275 275
 				<input class="widefat" type="text"
276
-				       id="points-prefix-<?php echo esc_attr( $slug ); ?>"
276
+				       id="points-prefix-<?php echo esc_attr($slug); ?>"
277 277
 				       name="points-prefix"
278
-				       value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/>
278
+				       value="<?php echo esc_attr($points_type['prefix']); ?>"/>
279 279
 			</p>
280 280
 			<p>
281 281
 				<label
282
-					for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label>
282
+					for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label>
283 283
 				<input class="widefat" type="text"
284
-				       id="points-suffix-<?php echo esc_attr( $slug ); ?>"
284
+				       id="points-suffix-<?php echo esc_attr($slug); ?>"
285 285
 				       name="points-suffix"
286
-				       value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/>
286
+				       value="<?php echo esc_attr($points_type['suffix']); ?>"/>
287 287
 			</p>
288 288
 
289 289
 			<?php
@@ -297,28 +297,28 @@  discard block
 block discarded – undo
297 297
 			 *
298 298
 			 * @param string $points_type The slug of the points type.
299 299
 			 */
300
-			do_action( 'wordpoints_points_type_form_bottom', $slug );
300
+			do_action('wordpoints_points_type_form_bottom', $slug);
301 301
 
302 302
 			?>
303 303
 
304 304
 			<input type="hidden" name="points-slug"
305
-			       value="<?php echo esc_attr( $slug ); ?>"/>
305
+			       value="<?php echo esc_attr($slug); ?>"/>
306 306
 			<input type="hidden" name="add_new" class="add_new"
307
-			       value="<?php echo esc_attr( $add_new ); ?>"/>
307
+			       value="<?php echo esc_attr($add_new); ?>"/>
308 308
 
309 309
 			<div class="hook-control-actions">
310 310
 				<div class="alignleft">
311 311
 					<?php
312 312
 
313
-					if ( ! $add_new ) {
314
-						wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' );
315
-						submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) );
313
+					if ( ! $add_new) {
314
+						wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce');
315
+						submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}"));
316 316
 					}
317 317
 
318 318
 					?>
319 319
 				</div>
320 320
 				<div class="alignright">
321
-					<?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?>
321
+					<?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?>
322 322
 					<span class="spinner"></span>
323 323
 				</div>
324 324
 				<br class="clear"/>
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 
338 338
 		?>
339 339
 
340
-		<a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_logs&tab=' . $this->current_points_type ) ); ?>">
341
-			<?php esc_html_e( 'Go to the logs for this points type.', 'wordpoints' ); ?>
340
+		<a href="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_points_logs&tab=' . $this->current_points_type)); ?>">
341
+			<?php esc_html_e('Go to the logs for this points type.', 'wordpoints'); ?>
342 342
 		</a>
343 343
 
344 344
 		<?php
@@ -351,22 +351,22 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	public function add_event_meta_boxes() {
353 353
 
354
-		if ( ! $this->current_points_type ) {
354
+		if ( ! $this->current_points_type) {
355 355
 			return;
356 356
 		}
357 357
 
358
-		$events_app       = $this->hooks->get_sub_app( 'events' );
359
-		$this->event_args = $events_app->get_sub_app( 'args' );
358
+		$events_app       = $this->hooks->get_sub_app('events');
359
+		$this->event_args = $events_app->get_sub_app('args');
360 360
 
361
-		$this->reaction_store = wordpoints_hooks()->get_reaction_store( 'points' );
361
+		$this->reaction_store = wordpoints_hooks()->get_reaction_store('points');
362 362
 
363
-		if ( ! $this->reaction_store ) {
363
+		if ( ! $this->reaction_store) {
364 364
 			return;
365 365
 		}
366 366
 
367 367
 		/** @var WordPoints_Hook_ReactorI $reactor */
368
-		$reactor = $this->hooks->get_sub_app( 'reactors' )->get( 'points' );
369
-		$reactor_action_types = array_fill_keys( $reactor->get_action_types(), true );
368
+		$reactor = $this->hooks->get_sub_app('reactors')->get('points');
369
+		$reactor_action_types = array_fill_keys($reactor->get_action_types(), true);
370 370
 
371 371
 		$event_action_types = wordpoints_hooks_ui_get_script_data_event_action_types();
372 372
 
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 			, $this->current_points_type
392 392
 		);
393 393
 
394
-		foreach ( $events as $slug => $event ) {
394
+		foreach ($events as $slug => $event) {
395 395
 
396 396
 			if (
397 397
 				! array_intersect_key(
398
-					$event_action_types[ $slug ]
398
+					$event_action_types[$slug]
399 399
 					, $reactor_action_types
400 400
 				)
401 401
 			) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			add_meta_box(
406 406
 				"{$this->current_points_type}-{$slug}"
407 407
 				, $event->get_title()
408
-				, array( $this, 'display_event_meta_box' )
408
+				, array($this, 'display_event_meta_box')
409 409
 				, $this->id
410 410
 				, 'events'
411 411
 				, 'default'
@@ -426,50 +426,50 @@  discard block
 block discarded – undo
426 426
 	 * @param array $points_type The points type this meta-box relates to.
427 427
 	 * @param array $meta_box    The data the meta-box was created with.
428 428
 	 */
429
-	public function display_event_meta_box( $points_type, $meta_box ) {
429
+	public function display_event_meta_box($points_type, $meta_box) {
430 430
 
431 431
 		$event_slug = $meta_box['args']['slug'];
432 432
 
433 433
 		$data = array();
434 434
 
435
-		foreach ( $this->reaction_store->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
436
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
435
+		foreach ($this->reaction_store->get_reactions_to_event($event_slug) as $id => $reaction) {
436
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
437 437
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
438 438
 					$reaction
439 439
 				);
440 440
 			}
441 441
 		}
442 442
 
443
-		$event_data = array( 'args' => array() );
443
+		$event_data = array('args' => array());
444 444
 
445
-		foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) {
445
+		foreach ($this->event_args->get_children($event_slug) as $slug => $arg) {
446 446
 
447
-			$event_data['args'][ $slug ] = array(
447
+			$event_data['args'][$slug] = array(
448 448
 				'slug' => $slug,
449 449
 			);
450 450
 
451
-			if ( $arg instanceof WordPoints_Hook_ArgI ) {
452
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
453
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
451
+			if ($arg instanceof WordPoints_Hook_ArgI) {
452
+				$event_data['args'][$slug]['title'] = $arg->get_title();
453
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
454 454
 			}
455 455
 		}
456 456
 
457 457
 		?>
458 458
 
459 459
 		<script>
460
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
461
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
460
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
461
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
462 462
 		</script>
463 463
 
464 464
 		<div class="wordpoints-hook-reaction-group-container">
465 465
 			<p class="description wordpoints-hook-reaction-group-description">
466
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
466
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
467 467
 			</p>
468 468
 
469 469
 			<div class="wordpoints-hook-reaction-group"
470
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
471
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
472
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( WordPoints_Admin_Ajax_Hooks::get_create_nonce( $this->reaction_store ) ); ?>"
470
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
471
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
472
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(WordPoints_Admin_Ajax_Hooks::get_create_nonce($this->reaction_store)); ?>"
473 473
 				data-wordpoints-hooks-reaction-store="points"
474 474
 				data-wordpoints-hooks-reactor="points">
475 475
 			</div>
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 
485 485
 			<div class="controls">
486 486
 				<button type="button" class="button-primary add-reaction">
487
-					<?php esc_html_e( 'Add New Reaction', 'wordpoints' ); ?>
487
+					<?php esc_html_e('Add New Reaction', 'wordpoints'); ?>
488 488
 				</button>
489 489
 			</div>
490 490
 		</div>
@@ -504,19 +504,19 @@  discard block
 block discarded – undo
504 504
 		// Show a tab for each points type.
505 505
 		$tabs = array();
506 506
 
507
-		foreach ( $points_types as $slug => $settings ) {
508
-			$tabs[ $slug ] = $settings['name'];
507
+		foreach ($points_types as $slug => $settings) {
508
+			$tabs[$slug] = $settings['name'];
509 509
 		}
510 510
 
511
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
511
+		$tabs['add-new'] = __('Add New', 'wordpoints');
512 512
 
513
-		$tab = wordpoints_admin_get_current_tab( $tabs );
513
+		$tab = wordpoints_admin_get_current_tab($tabs);
514 514
 
515
-		if ( 'add-new' !== $tab ) {
515
+		if ('add-new' !== $tab) {
516 516
 			$this->current_points_type = $tab;
517 517
 		}
518 518
 
519
-		do_action( 'add_meta_boxes', $this->id );
519
+		do_action('add_meta_boxes', $this->id);
520 520
 
521 521
 		$this->tabs = $tabs;
522 522
 	}
@@ -528,19 +528,19 @@  discard block
 block discarded – undo
528 528
 	 */
529 529
 	public function save_points_type() {
530 530
 
531
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
531
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
532 532
 			return;
533 533
 		}
534 534
 
535
-		if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK
535
+		if (isset($_POST['save-points-type'])) { // WPCS: CSRF OK
536 536
 
537
-			if ( ! empty( $_POST['add_new'] ) ) { // WPCS: CSRF OK
537
+			if ( ! empty($_POST['add_new'])) { // WPCS: CSRF OK
538 538
 				$this->add_points_type();
539 539
 			} else {
540 540
 				$this->update_points_type();
541 541
 			}
542 542
 
543
-		} elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK
543
+		} elseif ( ! empty($_POST['delete-points-type'])) { // WPCS: CSRF OK
544 544
 
545 545
 			$this->delete_points_type();
546 546
 		}
@@ -557,21 +557,21 @@  discard block
 block discarded – undo
557 557
 
558 558
 		$settings = array();
559 559
 
560
-		if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK
560
+		if (isset($_POST['points-name'])) { // WPCS: CSRF OK
561 561
 			$settings['name'] = trim(
562
-				sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK
562
+				sanitize_text_field(wp_unslash($_POST['points-name'])) // WPCS: CSRF OK
563 563
 			);
564 564
 		}
565 565
 
566
-		if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK
566
+		if (isset($_POST['points-prefix'])) { // WPCS: CSRF OK
567 567
 			$settings['prefix'] = ltrim(
568
-				sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK
568
+				sanitize_text_field(wp_unslash($_POST['points-prefix'])) // WPCS: CSRF OK
569 569
 			);
570 570
 		}
571 571
 
572
-		if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK
572
+		if (isset($_POST['points-suffix'])) { // WPCS: CSRF OK
573 573
 			$settings['suffix'] = rtrim(
574
-				sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK
574
+				sanitize_text_field(wp_unslash($_POST['points-suffix'])) // WPCS: CSRF OK
575 575
 			);
576 576
 		}
577 577
 
@@ -589,52 +589,52 @@  discard block
 block discarded – undo
589 589
 			! wordpoints_verify_nonce(
590 590
 				'update_points_type'
591 591
 				, 'wordpoints_update_points_type-%s'
592
-				, array( 'points-slug' )
592
+				, array('points-slug')
593 593
 				, 'post'
594 594
 			)
595
-			|| ! isset( $_POST['points-slug'] )
595
+			|| ! isset($_POST['points-slug'])
596 596
 		) {
597 597
 			return;
598 598
 		}
599 599
 
600 600
 		$settings = $this->get_points_type_settings();
601 601
 
602
-		if ( empty( $settings['name'] ) ) {
602
+		if (empty($settings['name'])) {
603 603
 
604 604
 			add_settings_error(
605 605
 				'points-name'
606 606
 				, 'wordpoints_points_type_update'
607
-				, __( 'Error: points type name cannot be empty.', 'wordpoints' )
607
+				, __('Error: points type name cannot be empty.', 'wordpoints')
608 608
 			);
609 609
 
610 610
 			return;
611 611
 		}
612 612
 
613
-		$points_type = sanitize_key( $_POST['points-slug'] );
613
+		$points_type = sanitize_key($_POST['points-slug']);
614 614
 
615
-		$old_settings = wordpoints_get_points_type( $points_type );
615
+		$old_settings = wordpoints_get_points_type($points_type);
616 616
 
617
-		if ( false === $old_settings ) {
617
+		if (false === $old_settings) {
618 618
 
619 619
 			add_settings_error(
620 620
 				''
621 621
 				, 'wordpoints_points_type_update'
622
-				, __( 'Error: failed updating points type.', 'wordpoints' )
622
+				, __('Error: failed updating points type.', 'wordpoints')
623 623
 			);
624 624
 
625 625
 			return;
626 626
 		}
627 627
 
628
-		if ( is_array( $old_settings ) ) {
629
-			$settings = array_merge( $old_settings, $settings );
628
+		if (is_array($old_settings)) {
629
+			$settings = array_merge($old_settings, $settings);
630 630
 		}
631 631
 
632
-		if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
632
+		if ( ! wordpoints_update_points_type($points_type, $settings)) {
633 633
 
634 634
 			add_settings_error(
635 635
 				''
636 636
 				, 'wordpoints_points_type_update'
637
-				, __( 'Error: failed updating points type.', 'wordpoints' )
637
+				, __('Error: failed updating points type.', 'wordpoints')
638 638
 			);
639 639
 
640 640
 		} else {
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 			add_settings_error(
643 643
 				''
644 644
 				, 'wordpoints_points_type_update'
645
-				, __( 'Points type updated.', 'wordpoints' )
645
+				, __('Points type updated.', 'wordpoints')
646 646
 				, 'updated'
647 647
 			);
648 648
 		}
@@ -668,14 +668,14 @@  discard block
 block discarded – undo
668 668
 
669 669
 		$settings = $this->get_points_type_settings();
670 670
 
671
-		$slug = wordpoints_add_points_type( $settings );
671
+		$slug = wordpoints_add_points_type($settings);
672 672
 
673
-		if ( ! $slug ) {
673
+		if ( ! $slug) {
674 674
 
675 675
 			add_settings_error(
676 676
 				''
677 677
 				, 'wordpoints_points_type_create'
678
-				, __( 'Please choose a unique name for this points type.', 'wordpoints' )
678
+				, __('Please choose a unique name for this points type.', 'wordpoints')
679 679
 			);
680 680
 
681 681
 		} else {
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 			add_settings_error(
686 686
 				''
687 687
 				, 'wordpoints_points_type_create'
688
-				, __( 'Points type created.', 'wordpoints' )
688
+				, __('Points type created.', 'wordpoints')
689 689
 				, 'updated'
690 690
 			);
691 691
 		}
@@ -702,22 +702,22 @@  discard block
 block discarded – undo
702 702
 			wordpoints_verify_nonce(
703 703
 				'delete-points-type-nonce'
704 704
 				, 'wordpoints_delete_points_type-%s'
705
-				, array( 'points-slug' )
705
+				, array('points-slug')
706 706
 				, 'post'
707 707
 			)
708
-			&& isset( $_POST['points-slug'] )
708
+			&& isset($_POST['points-slug'])
709 709
 		) {
710 710
 
711 711
 			if (
712 712
 				wordpoints_delete_points_type(
713
-					sanitize_key( $_POST['points-slug'] )
713
+					sanitize_key($_POST['points-slug'])
714 714
 				)
715 715
 			) {
716 716
 
717 717
 				add_settings_error(
718 718
 					''
719 719
 					, 'wordpoints_points_type_delete'
720
-					, __( 'Points type deleted.', 'wordpoints' )
720
+					, __('Points type deleted.', 'wordpoints')
721 721
 					, 'updated'
722 722
 				);
723 723
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 				add_settings_error(
727 727
 					''
728 728
 					, 'wordpoints_points_type_delete'
729
-					, __( 'Error while deleting.', 'wordpoints' )
729
+					, __('Error while deleting.', 'wordpoints')
730 730
 				);
731 731
 			}
732 732
 		}
@@ -742,18 +742,18 @@  discard block
 block discarded – undo
742 742
 		 *
743 743
 		 * @since 2.1.0
744 744
 		 */
745
-		do_action( 'wordpoints_admin_points_events_head' );
745
+		do_action('wordpoints_admin_points_events_head');
746 746
 
747
-		if ( is_network_admin() ) {
748
-			$title = __( 'Network Events', 'wordpoints' );
749
-			$description = __( 'Add reactions to these events to award points whenever they take place on this network.', 'wordpoints' );
747
+		if (is_network_admin()) {
748
+			$title = __('Network Events', 'wordpoints');
749
+			$description = __('Add reactions to these events to award points whenever they take place on this network.', 'wordpoints');
750 750
 		} else {
751
-			$title = __( 'Events', 'wordpoints' );
752
-			$description = __( 'Add reactions to these events to award points whenever they take place on this site.', 'wordpoints' );
751
+			$title = __('Events', 'wordpoints');
752
+			$description = __('Add reactions to these events to award points whenever they take place on this site.', 'wordpoints');
753 753
 		}
754 754
 
755
-		if ( isset( $this->current_points_type ) ) {
756
-			$points_type = wordpoints_get_points_type( $this->current_points_type );
755
+		if (isset($this->current_points_type)) {
756
+			$points_type = wordpoints_get_points_type($this->current_points_type);
757 757
 			$points_type['slug'] = $this->current_points_type;
758 758
 		} else {
759 759
 			$points_type = false;
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 		<div class="wordpoints-points-type-meta-box-wrap">
765 765
 
766 766
 				<form>
767
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
768
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
767
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
768
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
769 769
 				</form>
770 770
 
771 771
 				<div id="poststuff">
@@ -773,23 +773,23 @@  discard block
 block discarded – undo
773 773
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
774 774
 
775 775
 						<div id="postbox-container-1" class="postbox-container">
776
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
776
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
777 777
 						</div>
778 778
 
779
-						<?php if ( isset( $this->current_points_type ) ) : ?>
779
+						<?php if (isset($this->current_points_type)) : ?>
780 780
 							<div class="wordpoints-hook-events-heading">
781
-								<h2><?php echo esc_html( $title ); ?></h2>
781
+								<h2><?php echo esc_html($title); ?></h2>
782 782
 								<p class="description">
783
-									<?php echo esc_html( $description ); ?>
783
+									<?php echo esc_html($description); ?>
784 784
 									<?php
785 785
 
786 786
 									echo wp_kses(
787 787
 										sprintf(
788 788
 											// translators: URL of points reactions user docs on WordPoints.org.
789
-											__( 'You can learn more about how they work from <a href="%s">the user guide on WordPoints.org</a>.', 'wordpoints' )
789
+											__('You can learn more about how they work from <a href="%s">the user guide on WordPoints.org</a>.', 'wordpoints')
790 790
 											, 'https://wordpoints.org/user-guide/points-reactions/'
791 791
 										)
792
-										, array( 'a' => array( 'href' => true, 'target' => true ) )
792
+										, array('a' => array('href' => true, 'target' => true))
793 793
 									);
794 794
 
795 795
 									?>
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 							</div>
798 798
 
799 799
 							<div id="postbox-container-2" class="postbox-container">
800
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
800
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
801 801
 							</div>
802 802
 						<?php endif; ?>
803 803
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		 *
817 817
 		 * @since 2.1.0
818 818
 		 */
819
-		do_action( 'wordpoints_admin_points_events_foot' );
819
+		do_action('wordpoints_admin_points_events_foot');
820 820
 	}
821 821
 }
822 822
 
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks-load.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@
 block discarded – undo
13 13
 $screen->add_help_tab(
14 14
 	array(
15 15
 		'id'      => 'overview',
16
-		'title'   => esc_html__( 'Overview', 'wordpoints' ),
16
+		'title'   => esc_html__('Overview', 'wordpoints'),
17 17
 		'content' =>
18
-			'<p>' . esc_html__( 'Points Hooks let you award users points by &#8220;hooking into&#8221; different actions. They can be hooked to any points type that you have created.', 'wordpoints' ) . '</p>
19
-			<p>' . esc_html__( 'To link a hook to a points type, click on the hook&#8217;s title bar and select a points type, or drag and drop the hook title bars into the desired points type. By default, only the first points type area is expanded. To populate additional points types, click on their title bars to expand them.', 'wordpoints' ) . '</p>
20
-			<p>' . esc_html__( 'The Available Hooks section contains all the hooks you can choose from. Once you add a hook into a points type, it will open to allow you to configure its settings. When you are happy with the hook settings, click the Save button and the hook will begin awarding points. If you click Delete, it will remove the hook.', 'wordpoints' ) . '</p>',
18
+			'<p>' . esc_html__('Points Hooks let you award users points by &#8220;hooking into&#8221; different actions. They can be hooked to any points type that you have created.', 'wordpoints') . '</p>
19
+			<p>' . esc_html__('To link a hook to a points type, click on the hook&#8217;s title bar and select a points type, or drag and drop the hook title bars into the desired points type. By default, only the first points type area is expanded. To populate additional points types, click on their title bars to expand them.', 'wordpoints') . '</p>
20
+			<p>' . esc_html__('The Available Hooks section contains all the hooks you can choose from. Once you add a hook into a points type, it will open to allow you to configure its settings. When you are happy with the hook settings, click the Save button and the hook will begin awarding points. If you click Delete, it will remove the hook.', 'wordpoints') . '</p>',
21 21
 	)
22 22
 );
23 23
 
24 24
 $screen->add_help_tab(
25 25
 	array(
26 26
 		'id'      => 'removing-reusing',
27
-		'title'   => esc_html__( 'Removing and Reusing', 'wordpoints' ),
27
+		'title'   => esc_html__('Removing and Reusing', 'wordpoints'),
28 28
 		'content' =>
29
-			'<p>' . esc_html__( 'If you want to remove the hook but save its setting for possible future use, just drag it into the Inactive Hooks area. You can add them back anytime from there.', 'wordpoints' ) . '</p>
30
-			<p>' . esc_html__( 'Hooks may be used multiple times.', 'wordpoints' ) . '</p>
31
-			<p>' . esc_html__( 'Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.', 'wordpoints' ) . '</p>',
29
+			'<p>' . esc_html__('If you want to remove the hook but save its setting for possible future use, just drag it into the Inactive Hooks area. You can add them back anytime from there.', 'wordpoints') . '</p>
30
+			<p>' . esc_html__('Hooks may be used multiple times.', 'wordpoints') . '</p>
31
+			<p>' . esc_html__('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.', 'wordpoints') . '</p>',
32 32
 	)
33 33
 );
34 34
 
35 35
 $screen->set_help_sidebar(
36
-	'<p><strong>' . esc_html__( 'For more information:', 'wordpoints' ) . '</strong></p>
37
-	<p><a href="https://wordpoints.org/user-guide/points-hooks/">' . esc_html__( 'Documentation on Points Hooks', 'wordpoints' ) . '</a></p>
38
-	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__( 'Support Forums', 'wordpoints' ) . '</a></p>'
36
+	'<p><strong>' . esc_html__('For more information:', 'wordpoints') . '</strong></p>
37
+	<p><a href="https://wordpoints.org/user-guide/points-hooks/">' . esc_html__('Documentation on Points Hooks', 'wordpoints') . '</a></p>
38
+	<p><a href="https://wordpress.org/support/plugin/wordpoints">' . esc_html__('Support Forums', 'wordpoints') . '</a></p>'
39 39
 );
40 40
 
41
-$accessibility_mode = get_user_setting( 'wordpoints_points_hooks_access' );
41
+$accessibility_mode = get_user_setting('wordpoints_points_hooks_access');
42 42
 
43 43
 if (
44
-	isset( $_GET['accessibility-mode'], $_GET['wordpoints-accessiblity-nonce'] )
45
-	&& wordpoints_verify_nonce( 'wordpoints-accessiblity-nonce', 'wordpoints_points_hooks_accessiblity' )
44
+	isset($_GET['accessibility-mode'], $_GET['wordpoints-accessiblity-nonce'])
45
+	&& wordpoints_verify_nonce('wordpoints-accessiblity-nonce', 'wordpoints_points_hooks_accessiblity')
46 46
 ) {
47 47
 
48
-	$accessibility_mode = ( 'on' === sanitize_key( $_GET['accessibility-mode'] ) ) ? 'on' : 'off';
49
-	set_user_setting( 'wordpoints_points_hooks_access', $accessibility_mode );
48
+	$accessibility_mode = ('on' === sanitize_key($_GET['accessibility-mode'])) ? 'on' : 'off';
49
+	set_user_setting('wordpoints_points_hooks_access', $accessibility_mode);
50 50
 }
51 51
 
52 52
 // Enqueue needed scripts and styles.
53
-if ( 'on' === $accessibility_mode ) {
53
+if ('on' === $accessibility_mode) {
54 54
 
55
-	add_filter( 'admin_body_class', 'wordpoints_points_hooks_access_body_class' );
55
+	add_filter('admin_body_class', 'wordpoints_points_hooks_access_body_class');
56 56
 
57 57
 } else {
58 58
 
59
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
59
+	wp_enqueue_style('wp-jquery-ui-dialog');
60 60
 
61
-	wp_enqueue_script( 'wordpoints-admin-points-hooks' );
61
+	wp_enqueue_script('wordpoints-admin-points-hooks');
62 62
 
63
-	if ( wp_is_mobile() ) {
64
-		wp_enqueue_script( 'jquery-touch-punch' );
63
+	if (wp_is_mobile()) {
64
+		wp_enqueue_script('jquery-touch-punch');
65 65
 	}
66 66
 }
67 67
 
68
-wp_enqueue_style( 'wordpoints-admin-points-hooks' );
68
+wp_enqueue_style('wordpoints-admin-points-hooks');
69 69
 
70 70
 // EOF
Please login to merge, or discard this patch.
src/components/points/admin/screens/logs.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( is_network_admin() ) {
11
-	$title = __( 'WordPoints — Network Points Logs', 'wordpoints' );
10
+if (is_network_admin()) {
11
+	$title = __('WordPoints — Network Points Logs', 'wordpoints');
12 12
 } else {
13
-	$title = __( 'WordPoints — Points Logs', 'wordpoints' );
13
+	$title = __('WordPoints — Points Logs', 'wordpoints');
14 14
 }
15 15
 
16 16
 ?>
17 17
 
18 18
 <div class="wrap">
19
-	<h1><?php echo esc_html( $title ); ?></h1>
20
-	<p class="wordpoints-admin-panel-desc"><?php esc_html_e( 'View recent points transactions.', 'wordpoints' ); ?></p>
19
+	<h1><?php echo esc_html($title); ?></h1>
20
+	<p class="wordpoints-admin-panel-desc"><?php esc_html_e('View recent points transactions.', 'wordpoints'); ?></p>
21 21
 
22 22
 	<?php
23 23
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @since 1.0.0
28 28
 	 */
29
-	do_action( 'wordpoints_admin_points_logs' );
29
+	do_action('wordpoints_admin_points_logs');
30 30
 
31 31
 	$points_types = wordpoints_get_points_types();
32 32
 
33
-	if ( empty( $points_types ) ) {
33
+	if (empty($points_types)) {
34 34
 
35 35
 		wordpoints_show_admin_error(
36 36
 			sprintf(
37
-				__( 'You need to <a href="%s">create a type of points</a> before you can use this page.', 'wordpoints' )
38
-				, esc_url( self_admin_url( 'admin.php?page=wordpoints_points_types' ) )
37
+				__('You need to <a href="%s">create a type of points</a> before you can use this page.', 'wordpoints')
38
+				, esc_url(self_admin_url('admin.php?page=wordpoints_points_types'))
39 39
 			)
40 40
 		);
41 41
 
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
 		// Show a tab for each points type.
45 45
 		$tabs = array();
46 46
 
47
-		foreach ( $points_types as $slug => $settings ) {
47
+		foreach ($points_types as $slug => $settings) {
48 48
 
49
-			$tabs[ $slug ] = $settings['name'];
49
+			$tabs[$slug] = $settings['name'];
50 50
 		}
51 51
 
52
-		wordpoints_admin_show_tabs( $tabs, false );
52
+		wordpoints_admin_show_tabs($tabs, false);
53 53
 
54
-		if ( is_network_admin() ) {
54
+		if (is_network_admin()) {
55 55
 			$query = 'network';
56 56
 		} else {
57 57
 			$query = 'default';
58 58
 		}
59 59
 
60
-		$current_type = wordpoints_admin_get_current_tab( $tabs );
60
+		$current_type = wordpoints_admin_get_current_tab($tabs);
61 61
 
62 62
 		/**
63 63
 		 * At the top of one of the tabs on the points logs admin panel.
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 * @param string $points_type The points type the current tab is for.
68 68
 		 * @param string $query       The current logs query being performed.
69 69
 		 */
70
-		do_action( 'wordpoints_admin_points_logs_tab', $current_type, $query );
70
+		do_action('wordpoints_admin_points_logs_tab', $current_type, $query);
71 71
 
72 72
 		// Get and display the logs based on current points type.
73
-		wordpoints_show_points_logs_query( $current_type, $query );
73
+		wordpoints_show_points_logs_query($current_type, $query);
74 74
 
75 75
 		/**
76 76
 		 * At the bottom of one of the tabs on the points logs admin panel.
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		 * @param string $points_type The points type the current tab is for.
81 81
 		 * @param string $query       The current logs query being performed.
82 82
 		 */
83
-		do_action( 'wordpoints_admin_points_logs_tab_after', $current_type, $query );
83
+		do_action('wordpoints_admin_points_logs_tab_after', $current_type, $query);
84 84
 
85 85
 	} // End if ( empty( $points_types ) ) else.
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @since 1.0.0
91 91
 	 */
92
-	do_action( 'wordpoints_admin_points_logs_after' );
92
+	do_action('wordpoints_admin_points_logs_after');
93 93
 
94 94
 	?>
95 95
 
Please login to merge, or discard this patch.
src/components/points/admin/screens/hooks-no-js-load.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,122 +7,122 @@
 block discarded – undo
7 7
  * @since 1.2.0
8 8
  */
9 9
 
10
-if ( ! current_user_can( 'manage_options' ) ) {
10
+if ( ! current_user_can('manage_options')) {
11 11
 	return;
12 12
 }
13 13
 
14
-if ( ! isset( $_POST['hook-id'] ) ) {
14
+if ( ! isset($_POST['hook-id'])) {
15 15
 	return;
16 16
 }
17 17
 
18
-$hook_id = sanitize_key( $_POST['hook-id'] );
18
+$hook_id = sanitize_key($_POST['hook-id']);
19 19
 
20
-check_admin_referer( "save-delete-hook-{$hook_id}" );
20
+check_admin_referer("save-delete-hook-{$hook_id}");
21 21
 
22
-$redirect_url = self_admin_url( 'admin.php?page=wordpoints_points_hooks' );
22
+$redirect_url = self_admin_url('admin.php?page=wordpoints_points_hooks');
23 23
 
24
-if ( is_network_admin() ) {
25
-	WordPoints_Points_Hooks::set_network_mode( true );
24
+if (is_network_admin()) {
25
+	WordPoints_Points_Hooks::set_network_mode(true);
26 26
 }
27 27
 
28
-if ( ! isset( $_POST['points_type'], $_POST['id_base'] ) ) {
28
+if ( ! isset($_POST['points_type'], $_POST['id_base'])) {
29 29
 	return;
30 30
 }
31 31
 
32
-$points_type_id = sanitize_key( $_POST['points_type'] );
33
-$id_base        = sanitize_key( $_POST['id_base'] );
32
+$points_type_id = sanitize_key($_POST['points_type']);
33
+$id_base        = sanitize_key($_POST['id_base']);
34 34
 
35 35
 // These are the hooks grouped by points type.
36 36
 $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks();
37 37
 
38
-if ( empty( $points_types_hooks ) ) {
38
+if (empty($points_types_hooks)) {
39 39
 	$points_types_hooks = WordPoints_Points_Hooks::get_defaults();
40 40
 }
41 41
 
42
-if ( isset( $points_types_hooks[ $points_type_id ] ) ) {
43
-	$points_type_hooks = $points_types_hooks[ $points_type_id ];
42
+if (isset($points_types_hooks[$points_type_id])) {
43
+	$points_type_hooks = $points_types_hooks[$points_type_id];
44 44
 } else {
45 45
 	$points_type_hooks = array();
46 46
 }
47 47
 
48
-$hook = WordPoints_Points_Hooks::get_handler_by_id_base( $id_base );
48
+$hook = WordPoints_Points_Hooks::get_handler_by_id_base($id_base);
49 49
 
50
-if ( ! empty( $_POST['removehook'] ) ) {
50
+if ( ! empty($_POST['removehook'])) {
51 51
 
52 52
 	// - We are deleting an instance of a hook.
53 53
 
54
-	if ( ! in_array( $hook_id, $points_type_hooks, true ) ) {
54
+	if ( ! in_array($hook_id, $points_type_hooks, true)) {
55 55
 
56 56
 		// The hook isn't hooked to this points type, give an error.
57
-		wp_safe_redirect( $redirect_url . '&error=0' );
57
+		wp_safe_redirect($redirect_url . '&error=0');
58 58
 		exit;
59 59
 	}
60 60
 
61 61
 	// Remove the hook from this points type.
62
-	$points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) );
62
+	$points_types_hooks[$points_type_id] = array_diff($points_type_hooks, array($hook_id));
63 63
 
64
-	$hook->delete_callback( $hook_id );
64
+	$hook->delete_callback($hook_id);
65 65
 
66
-} elseif ( ! empty( $_POST['savehook'] ) ) {
66
+} elseif ( ! empty($_POST['savehook'])) {
67 67
 
68 68
 	// - We are saving an instance of a hook.
69 69
 
70
-	$number = isset( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : '';
70
+	$number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : '';
71 71
 
72
-	if ( $number ) {
72
+	if ($number) {
73 73
 
74 74
 		// Search the POST for the instance settings.
75
-		foreach ( $_POST as $key => $val ) {
75
+		foreach ($_POST as $key => $val) {
76 76
 
77
-			if ( is_array( $val ) && preg_match( '/__i__|%i%/', key( $val ) ) ) {
77
+			if (is_array($val) && preg_match('/__i__|%i%/', key($val))) {
78 78
 
79
-				$new_instance = array_shift( $val );
79
+				$new_instance = array_shift($val);
80 80
 				break;
81 81
 			}
82 82
 		}
83 83
 
84 84
 	} else {
85 85
 
86
-		if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) {
87
-			$new_instance = wp_unslash( reset( $_POST[ 'hook-' . $id_base ] ) ); // WPCS sanitization OK.
86
+		if (isset($_POST['hook-' . $id_base]) && is_array($_POST['hook-' . $id_base])) {
87
+			$new_instance = wp_unslash(reset($_POST['hook-' . $id_base])); // WPCS sanitization OK.
88 88
 		}
89 89
 
90
-		$number = $hook->get_number_by_id( $hook_id );
90
+		$number = $hook->get_number_by_id($hook_id);
91 91
 	}
92 92
 
93
-	if ( ! isset( $new_instance ) || ! is_array( $new_instance ) ) {
93
+	if ( ! isset($new_instance) || ! is_array($new_instance)) {
94 94
 
95 95
 		$new_instance = array();
96 96
 	}
97 97
 
98 98
 	// Update the hook.
99
-	$hook->update_callback( $new_instance, $number );
99
+	$hook->update_callback($new_instance, $number);
100 100
 
101 101
 	// Add hook it to this points type.
102
-	if ( ! in_array( $hook_id, $points_type_hooks ) ) {
102
+	if ( ! in_array($hook_id, $points_type_hooks)) {
103 103
 
104 104
 		$points_type_hooks[] = $hook_id;
105
-		$points_types_hooks[ $points_type_id ] = $points_type_hooks;
105
+		$points_types_hooks[$points_type_id] = $points_type_hooks;
106 106
 	}
107 107
 
108 108
 	// Remove from old points type if it has changed.
109
-	$old_points_type = WordPoints_Points_Hooks::get_points_type( $hook_id );
109
+	$old_points_type = WordPoints_Points_Hooks::get_points_type($hook_id);
110 110
 
111
-	if ( $old_points_type && $old_points_type !== $points_type_id && is_array( $points_types_hooks[ $old_points_type ] ) ) {
111
+	if ($old_points_type && $old_points_type !== $points_type_id && is_array($points_types_hooks[$old_points_type])) {
112 112
 
113
-		$points_types_hooks[ $old_points_type ] = array_diff( $points_types_hooks[ $old_points_type ], array( $hook_id ) );
113
+		$points_types_hooks[$old_points_type] = array_diff($points_types_hooks[$old_points_type], array($hook_id));
114 114
 	}
115 115
 
116 116
 } else {
117 117
 
118
-	wp_safe_redirect( $redirect_url . '&error=0' );
118
+	wp_safe_redirect($redirect_url . '&error=0');
119 119
 	exit;
120 120
 
121 121
 } // End if ( deleting hook ) elseif ( saving hook ) else.
122 122
 
123
-WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks );
123
+WordPoints_Points_Hooks::save_points_types_hooks($points_types_hooks);
124 124
 
125
-wp_safe_redirect( $redirect_url . '&message=0' );
125
+wp_safe_redirect($redirect_url . '&message=0');
126 126
 exit;
127 127
 
128 128
 // EOF
Please login to merge, or discard this patch.