Completed
Push — master ( e7ef90...760553 )
by J.D.
03:28
created
src/classes/dropdown/builder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                                       option is an array or object.
75 75
 	 * }
76 76
 	 */
77
-	public function __construct( array $options, array $args ) {
77
+	public function __construct(array $options, array $args) {
78 78
 
79
-		$this->args = array_merge( $this->args, $args );
79
+		$this->args = array_merge($this->args, $args);
80 80
 
81 81
 		$this->options = $options;
82 82
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function start() {
102 102
 
103
-		echo '<select id="', esc_attr( $this->args['id'] ), '" name="', esc_attr( $this->args['name'] ), '" class="', esc_attr( $this->args['class'] ), '">';
103
+		echo '<select id="', esc_attr($this->args['id']), '" name="', esc_attr($this->args['name']), '" class="', esc_attr($this->args['class']), '">';
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function options() {
112 112
 
113
-		if ( ! empty( $this->args['show_option_none'] ) ) {
113
+		if ( ! empty($this->args['show_option_none'])) {
114 114
 
115
-			echo '<option value="-1"', selected( '-1', $this->args['selected'], false ), '>', esc_html( $this->args['show_option_none'] ), '</option>';
115
+			echo '<option value="-1"', selected('-1', $this->args['selected'], false), '>', esc_html($this->args['show_option_none']), '</option>';
116 116
 		}
117 117
 
118
-		foreach ( $this->options as $value => $option ) {
118
+		foreach ($this->options as $value => $option) {
119 119
 
120
-			if ( isset( $this->args['values_key'], $this->args['options_key'] ) ) {
120
+			if (isset($this->args['values_key'], $this->args['options_key'])) {
121 121
 				$option = (array) $option;
122
-				$value = $option[ $this->args['values_key'] ];
123
-				$option = $option[ $this->args['options_key'] ];
122
+				$value = $option[$this->args['values_key']];
123
+				$option = $option[$this->args['options_key']];
124 124
 			}
125 125
 
126
-			echo '<option value="', esc_attr( $value ), '"', selected( $value, $this->args['selected'], false ), '>', esc_html( $option ), '</option>';
126
+			echo '<option value="', esc_attr($value), '"', selected($value, $this->args['selected'], false), '>', esc_html($option), '</option>';
127 127
 		}
128 128
 	}
129 129
 
Please login to merge, or discard this patch.
src/components/ranks/includes/filters.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
  * @since 2.1.0
8 8
  */
9 9
 
10
-add_action( 'wordpoints_modules_loaded', 'WordPoints_Rank_Types::init' );
10
+add_action('wordpoints_modules_loaded', 'WordPoints_Rank_Types::init');
11 11
 
12
-add_action( 'wordpoints_ranks_register', 'wordpoints_register_core_ranks' );
12
+add_action('wordpoints_ranks_register', 'wordpoints_register_core_ranks');
13 13
 
14
-WordPoints_Shortcodes::register( 'wordpoints_user_rank', 'WordPoints_Rank_Shortcode_User_Rank' );
14
+WordPoints_Shortcodes::register('wordpoints_user_rank', 'WordPoints_Rank_Shortcode_User_Rank');
15 15
 
16 16
 // EOF
Please login to merge, or discard this patch.
src/components/ranks/includes/shortcodes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @since 2.3.0
21 21
 	 */
22
-	public function __construct( $atts, $content, $shortcode = null ) {
22
+	public function __construct($atts, $content, $shortcode = null) {
23 23
 
24 24
 		_deprecated_function(
25 25
 			__METHOD__
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			, 'WordPoints_Rank_Shortcode_User_Rank::__construct'
28 28
 		);
29 29
 
30
-		parent::__construct( $atts, $content, $shortcode );
30
+		parent::__construct($atts, $content, $shortcode);
31 31
 	}
32 32
 }
33 33
 
Please login to merge, or discard this patch.
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_Shortcode_Top_Users' );
63
-WordPoints_Shortcodes::register( 'wordpoints_points_logs', 'WordPoints_Points_Shortcode_Logs' );
64
-WordPoints_Shortcodes::register( 'wordpoints_points', 'WordPoints_Points_Shortcode_User_Points' );
65
-WordPoints_Shortcodes::register( 'wordpoints_how_to_get_points', 'WordPoints_Points_Shortcode_HTGP' );
62
+WordPoints_Shortcodes::register('wordpoints_points_top', 'WordPoints_Points_Shortcode_Top_Users');
63
+WordPoints_Shortcodes::register('wordpoints_points_logs', 'WordPoints_Points_Shortcode_Logs');
64
+WordPoints_Shortcodes::register('wordpoints_points', 'WordPoints_Points_Shortcode_User_Points');
65
+WordPoints_Shortcodes::register('wordpoints_how_to_get_points', 'WordPoints_Points_Shortcode_HTGP');
66 66
 
67 67
 // EOF
Please login to merge, or discard this patch.
src/components/points/includes/logs.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
  *
40 40
  * @return bool Whether the query was registered.
41 41
  */
42
-function wordpoints_register_points_logs_query( $slug, array $args, array $data = array() ) {
42
+function wordpoints_register_points_logs_query($slug, array $args, array $data = array()) {
43 43
 
44
-	return WordPoints_Points_Log_Queries::register_query( $slug, $args, $data );
44
+	return WordPoints_Points_Log_Queries::register_query($slug, $args, $data);
45 45
 }
46 46
 
47 47
 /**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
  *
56 56
  * @return bool Whether $slug is the slug of a registered query.
57 57
  */
58
-function wordpoints_is_points_logs_query( $slug ) {
58
+function wordpoints_is_points_logs_query($slug) {
59 59
 
60
-	return WordPoints_Points_Log_Queries::is_query( $slug );
60
+	return WordPoints_Points_Log_Queries::is_query($slug);
61 61
 }
62 62
 
63 63
 /**
@@ -72,23 +72,23 @@  discard block
 block discarded – undo
72 72
  *
73 73
  * @return array|false The args for the query, or false on failure.
74 74
  */
75
-function wordpoints_get_points_logs_query_args( $points_type, $query_slug = 'default' ) {
75
+function wordpoints_get_points_logs_query_args($points_type, $query_slug = 'default') {
76 76
 
77
-	$args = WordPoints_Points_Log_Queries::get_query_args( $query_slug );
77
+	$args = WordPoints_Points_Log_Queries::get_query_args($query_slug);
78 78
 
79
-	if ( is_null( $args ) || ! wordpoints_is_points_type( $points_type ) ) {
79
+	if (is_null($args) || ! wordpoints_is_points_type($points_type)) {
80 80
 		return false;
81 81
 	}
82 82
 
83 83
 	$defaults = array(
84
-		'user_id__not_in' => wordpoints_get_excluded_users( 'points_logs' ),
84
+		'user_id__not_in' => wordpoints_get_excluded_users('points_logs'),
85 85
 		'points_type'     => $points_type,
86 86
 	);
87 87
 
88
-	$args = array_merge( $defaults, $args );
88
+	$args = array_merge($defaults, $args);
89 89
 
90 90
 	// The current user needs to be set dynamically, since it can change at times.
91
-	if ( 'current_user' === $query_slug ) {
91
+	if ('current_user' === $query_slug) {
92 92
 		$args['user_id'] = get_current_user_id();
93 93
 	}
94 94
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string $query_slug  The slug for the query.
106 106
 	 * @param string $points_type The points type the query is being made for.
107 107
 	 */
108
-	return apply_filters( 'wordpoints_points_logs_query_args', $args, $query_slug, $points_type );
108
+	return apply_filters('wordpoints_points_logs_query_args', $args, $query_slug, $points_type);
109 109
 }
110 110
 
111 111
 /**
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return WordPoints_Points_Logs_Query|false Logs query instance, or false.
127 127
  */
128
-function wordpoints_get_points_logs_query( $points_type, $query_slug = 'default' ) {
128
+function wordpoints_get_points_logs_query($points_type, $query_slug = 'default') {
129 129
 
130
-	$args = wordpoints_get_points_logs_query_args( $points_type, $query_slug );
130
+	$args = wordpoints_get_points_logs_query_args($points_type, $query_slug);
131 131
 
132
-	if ( ! $args ) {
132
+	if ( ! $args) {
133 133
 		return false;
134 134
 	}
135 135
 
136
-	$query = new WordPoints_Points_Logs_Query( $args );
136
+	$query = new WordPoints_Points_Logs_Query($args);
137 137
 
138
-	$query_data = WordPoints_Points_Log_Queries::get_query_data( $query_slug );
138
+	$query_data = WordPoints_Points_Log_Queries::get_query_data($query_slug);
139 139
 
140
-	if ( $query_data['cache_queries'] ) {
140
+	if ($query_data['cache_queries']) {
141 141
 
142 142
 		$query->prime_cache(
143 143
 			$query_data['cache_key']
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function wordpoints_show_points_logs( $logs_query, array $args = array() ) {
183
+function wordpoints_show_points_logs($logs_query, array $args = array()) {
184 184
 
185
-	if ( ! $logs_query instanceof WordPoints_Points_Logs_Query ) {
185
+	if ( ! $logs_query instanceof WordPoints_Points_Logs_Query) {
186 186
 		return;
187 187
 	}
188 188
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 		'show_users' => true,
195 195
 	);
196 196
 
197
-	$args = array_merge( $defaults, $args );
197
+	$args = array_merge($defaults, $args);
198 198
 
199
-	if ( ! $args['datatable'] ) {
199
+	if ( ! $args['datatable']) {
200 200
 
201 201
 		_deprecated_argument(
202 202
 			__FUNCTION__
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
 		$args['paginate'] = false;
208 208
 	}
209 209
 
210
-	$view = wordpoints_component( 'points' )
211
-		->get_sub_app( 'logs' )
212
-		->get_sub_app( 'views' )
213
-		->get( $args['view'], array( $logs_query, $args ) );
210
+	$view = wordpoints_component('points')
211
+		->get_sub_app('logs')
212
+		->get_sub_app('views')
213
+		->get($args['view'], array($logs_query, $args));
214 214
 
215
-	if ( ! $view instanceof WordPoints_Points_Logs_View ) {
215
+	if ( ! $view instanceof WordPoints_Points_Logs_View) {
216 216
 		return;
217 217
 	}
218 218
 
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
  * @param string $query_slug  The query to use to display the logs.
233 233
  * @param array  $args        Arguments to pass to wordpoints_show_points_logs().
234 234
  */
235
-function wordpoints_show_points_logs_query( $points_type, $query_slug = 'default', array $args = array() ) {
235
+function wordpoints_show_points_logs_query($points_type, $query_slug = 'default', array $args = array()) {
236 236
 
237
-	wordpoints_show_points_logs( wordpoints_get_points_logs_query( $points_type, $query_slug ), $args );
237
+	wordpoints_show_points_logs(wordpoints_get_points_logs_query($points_type, $query_slug), $args);
238 238
 }
239 239
 
240 240
 /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	wordpoints_register_points_logs_query(
255 255
 		'current_user'
256
-		, array( 'user_id' => get_current_user_id() )
256
+		, array('user_id' => get_current_user_id())
257 257
 		, array(
258 258
 			'cache_key'     => 'current_user:%points_type%:%user_id%',
259 259
 			'cache_queries' => true,
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	wordpoints_register_points_logs_query(
269 269
 		'network'
270
-		, array( 'blog_id' => false )
270
+		, array('blog_id' => false)
271 271
 		, array(
272 272
 			'network_wide'  => true,
273 273
 			'cache_queries' => true,
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @WordPress\action wordpoints_points_log-profile_edit
284 284
  */
285
-function wordpoints_points_logs_profile_edit( $text, $points, $points_type, $user_id, $log_type, $meta ) {
285
+function wordpoints_points_logs_profile_edit($text, $points, $points_type, $user_id, $log_type, $meta) {
286 286
 
287
-	$user_name = sanitize_user_field( 'display_name', get_userdata( $meta['user_id'] )->display_name, $meta['user_id'], 'display' );
287
+	$user_name = sanitize_user_field('display_name', get_userdata($meta['user_id'])->display_name, $meta['user_id'], 'display');
288 288
 
289 289
 	// translators: 1. User name; 2. Reason given.
290
-	return sprintf( _x( 'Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints' ), $user_name, esc_html( $meta['reason'] ) );
290
+	return sprintf(_x('Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints'), $user_name, esc_html($meta['reason']));
291 291
 }
292 292
 
293 293
 /**
@@ -297,20 +297,20 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @WordPress\action wordpoints_points_log-comment_disapprove
299 299
  */
300
-function wordpoints_points_logs_comment_disapprove( $text, $points, $points_type, $user_id, $log_type, $meta ) {
300
+function wordpoints_points_logs_comment_disapprove($text, $points, $points_type, $user_id, $log_type, $meta) {
301 301
 
302
-	switch ( $meta['status'] ) {
302
+	switch ($meta['status']) {
303 303
 
304 304
 		case 'spam':
305
-			$text = _x( 'Comment marked as spam.', 'points log description', 'wordpoints' );
305
+			$text = _x('Comment marked as spam.', 'points log description', 'wordpoints');
306 306
 		break;
307 307
 
308 308
 		case 'trash':
309
-			$text = _x( 'Comment moved to trash.', 'points log description', 'wordpoints' );
309
+			$text = _x('Comment moved to trash.', 'points log description', 'wordpoints');
310 310
 		break;
311 311
 
312 312
 		default:
313
-			$text = _x( 'Comment unapproved.', 'points log description', 'wordpoints' );
313
+			$text = _x('Comment unapproved.', 'points log description', 'wordpoints');
314 314
 	}
315 315
 
316 316
 	return $text;
@@ -323,23 +323,23 @@  discard block
 block discarded – undo
323 323
  *
324 324
  * @WordPress\action wordpoints_points_log-post_delete
325 325
  */
326
-function wordpoints_points_logs_post_delete( $text, $points, $points_type, $user_id, $log_type, $meta ) {
326
+function wordpoints_points_logs_post_delete($text, $points, $points_type, $user_id, $log_type, $meta) {
327 327
 
328
-	if ( isset( $meta['post_type'] ) ) {
328
+	if (isset($meta['post_type'])) {
329 329
 
330
-		$post_type = get_post_type_object( $meta['post_type'] );
330
+		$post_type = get_post_type_object($meta['post_type']);
331 331
 
332
-		if ( ! is_null( $post_type ) ) {
332
+		if ( ! is_null($post_type)) {
333 333
 
334 334
 			return sprintf(
335 335
 				// translators: Singular post type name.
336
-				_x( '%s deleted.', 'points log description', 'wordpoints' )
336
+				_x('%s deleted.', 'points log description', 'wordpoints')
337 337
 				, $post_type->labels->singular_name
338 338
 			);
339 339
 		}
340 340
 	}
341 341
 
342
-	return _x( 'Post deleted.', 'points log description', 'wordpoints' );
342
+	return _x('Post deleted.', 'points log description', 'wordpoints');
343 343
 }
344 344
 
345 345
 /**
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
  * @param int    $points      The number of points. Not used.
356 356
  * @param string $points_type The type of points being awarded.
357 357
  */
358
-function wordpoints_clean_points_logs_cache( $user_id, $points, $points_type ) {
358
+function wordpoints_clean_points_logs_cache($user_id, $points, $points_type) {
359 359
 
360 360
 	wordpoints_flush_points_logs_caches(
361
-		array( 'user_id' => $user_id, 'points_type' => $points_type )
361
+		array('user_id' => $user_id, 'points_type' => $points_type)
362 362
 	);
363 363
 }
364 364
 
@@ -380,27 +380,27 @@  discard block
 block discarded – undo
380 380
  *        @type int             $user_id     Only clear the cache for this user.
381 381
  * }
382 382
  */
383
-function wordpoints_flush_points_logs_caches( $args = array() ) {
383
+function wordpoints_flush_points_logs_caches($args = array()) {
384 384
 
385
-	$args = array_merge( array( 'points_type' => false, 'user_id' => 0 ), $args );
385
+	$args = array_merge(array('points_type' => false, 'user_id' => 0), $args);
386 386
 
387 387
 	$find = array(
388 388
 		'%points_type%',
389 389
 		'%user_id%',
390 390
 	);
391 391
 
392
-	if ( empty( $args['points_type'] ) ) {
393
-		$points_types = array_keys( wordpoints_get_points_types() );
392
+	if (empty($args['points_type'])) {
393
+		$points_types = array_keys(wordpoints_get_points_types());
394 394
 	} else {
395 395
 		$points_types = (array) $args['points_type'];
396 396
 	}
397 397
 
398
-	foreach ( $points_types as $points_type ) {
399
-		foreach ( WordPoints_Points_Log_Queries::get_queries() as $query ) {
398
+	foreach ($points_types as $points_type) {
399
+		foreach (WordPoints_Points_Log_Queries::get_queries() as $query) {
400 400
 
401
-			if ( ! empty( $query['cache_key'] ) ) {
401
+			if ( ! empty($query['cache_key'])) {
402 402
 
403
-				if ( $query['network_wide'] ) {
403
+				if ($query['network_wide']) {
404 404
 					$group = 'wordpoints_network_points_logs_query';
405 405
 				} else {
406 406
 					$group = 'wordpoints_points_logs_query';
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 				);
413 413
 
414 414
 				wp_cache_delete(
415
-					str_replace( $find, $replace, $query['cache_key'] )
415
+					str_replace($find, $replace, $query['cache_key'])
416 416
 					, $group
417 417
 				);
418 418
 			}
@@ -431,26 +431,26 @@  discard block
 block discarded – undo
431 431
  *
432 432
  * @return bool Whether the user can view this points log entry.
433 433
  */
434
-function wordpoints_user_can_view_points_log( $user_id, $log ) {
434
+function wordpoints_user_can_view_points_log($user_id, $log) {
435 435
 
436 436
 	// We do this just once here for optimization, as otherwise it would run 3 times.
437
-	if ( $log->blog_id && get_current_blog_id() !== $log->blog_id ) {
438
-		$switched = switch_to_blog( $log->blog_id );
437
+	if ($log->blog_id && get_current_blog_id() !== $log->blog_id) {
438
+		$switched = switch_to_blog($log->blog_id);
439 439
 	}
440 440
 
441 441
 	/** @var WordPoints_Points_Logs_Viewing_Restrictions $viewing_restrictions */
442
-	$viewing_restrictions = wordpoints_component( 'points' )
443
-		->get_sub_app( 'logs' )
444
-		->get_sub_app( 'viewing_restrictions' );
442
+	$viewing_restrictions = wordpoints_component('points')
443
+		->get_sub_app('logs')
444
+		->get_sub_app('viewing_restrictions');
445 445
 
446
-	$can_view = $viewing_restrictions->get_restriction( $log )
447
-		->user_can( $user_id );
446
+	$can_view = $viewing_restrictions->get_restriction($log)
447
+		->user_can($user_id);
448 448
 
449
-	if ( $can_view ) {
450
-		$can_view = $viewing_restrictions->apply_legacy_filters( $user_id, $log );
449
+	if ($can_view) {
450
+		$can_view = $viewing_restrictions->apply_legacy_filters($user_id, $log);
451 451
 	}
452 452
 
453
-	if ( isset( $switched ) ) {
453
+	if (isset($switched)) {
454 454
 		restore_current_blog();
455 455
 	}
456 456
 
@@ -471,17 +471,17 @@  discard block
 block discarded – undo
471 471
  *
472 472
  * @return bool Whether the user can view the points log.
473 473
  */
474
-function wordpoints_hooks_user_can_view_points_log( $can_view, $user_id, $log ) {
474
+function wordpoints_hooks_user_can_view_points_log($can_view, $user_id, $log) {
475 475
 
476
-	_deprecated_function( __FUNCTION__, '2.2.0' );
476
+	_deprecated_function(__FUNCTION__, '2.2.0');
477 477
 
478
-	if ( ! $can_view ) {
478
+	if ( ! $can_view) {
479 479
 		return $can_view;
480 480
 	}
481 481
 
482
-	$restriction = new WordPoints_Points_Logs_Viewing_Restriction_Hooks( $log );
482
+	$restriction = new WordPoints_Points_Logs_Viewing_Restriction_Hooks($log);
483 483
 
484
-	return $restriction->user_can( $user_id );
484
+	return $restriction->user_can($user_id);
485 485
 }
486 486
 
487 487
 // EOF
Please login to merge, or discard this patch.
src/components/points/includes/shortcodes.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @since 2.3.0
21 21
 	 */
22
-	public function __construct( $atts, $content, $shortcode = null ) {
22
+	public function __construct($atts, $content, $shortcode = null) {
23 23
 
24 24
 		_deprecated_function(
25 25
 			__METHOD__
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			, 'WordPoints_Points_Shortcode_HTGP::__construct'
28 28
 		);
29 29
 
30
-		parent::__construct( $atts, $content, $shortcode );
30
+		parent::__construct($atts, $content, $shortcode);
31 31
 	}
32 32
 }
33 33
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 * @since 2.3.0
44 44
 	 */
45
-	public function __construct( $atts, $content, $shortcode = null ) {
45
+	public function __construct($atts, $content, $shortcode = null) {
46 46
 
47 47
 		_deprecated_function(
48 48
 			__METHOD__
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			, 'WordPoints_Points_Shortcode_User_Points::__construct'
51 51
 		);
52 52
 
53
-		parent::__construct( $atts, $content, $shortcode );
53
+		parent::__construct($atts, $content, $shortcode);
54 54
 	}
55 55
 }
56 56
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @since 2.3.0
67 67
 	 */
68
-	public function __construct( $atts, $content, $shortcode = null ) {
68
+	public function __construct($atts, $content, $shortcode = null) {
69 69
 
70 70
 		_deprecated_function(
71 71
 			__METHOD__
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			, 'WordPoints_Points_Shortcode_Logs::__construct'
74 74
 		);
75 75
 
76
-		parent::__construct( $atts, $content, $shortcode );
76
+		parent::__construct($atts, $content, $shortcode);
77 77
 	}
78 78
 }
79 79
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * @since 2.3.0
90 90
 	 */
91
-	public function __construct( $atts, $content, $shortcode = null ) {
91
+	public function __construct($atts, $content, $shortcode = null) {
92 92
 
93 93
 		_deprecated_function(
94 94
 			__METHOD__
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			, 'WordPoints_Points_Shortcode_Top_Users::__construct'
97 97
 		);
98 98
 
99
-		parent::__construct( $atts, $content, $shortcode );
99
+		parent::__construct($atts, $content, $shortcode);
100 100
 	}
101 101
 }
102 102
 
Please login to merge, or discard this patch.
src/components/points/includes/functions.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @param WordPoints_Class_Registry_Persistent $reactors The reactors registry.
18 18
  */
19
-function wordpoints_points_hook_reactors_init( $reactors ) {
19
+function wordpoints_points_hook_reactors_init($reactors) {
20 20
 
21
-	$reactors->register( 'points', 'WordPoints_Points_Hook_Reactor' );
22
-	$reactors->register( 'points_legacy', 'WordPoints_Points_Hook_Reactor_Legacy' );
21
+	$reactors->register('points', 'WordPoints_Points_Hook_Reactor');
22
+	$reactors->register('points_legacy', 'WordPoints_Points_Hook_Reactor_Legacy');
23 23
 }
24 24
 
25 25
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @param WordPoints_Class_Registry_Children $reaction_stores The store registry.
33 33
  */
34
-function wordpoints_points_hook_reaction_stores_init( $reaction_stores ) {
34
+function wordpoints_points_hook_reaction_stores_init($reaction_stores) {
35 35
 
36 36
 	$reaction_stores->register(
37 37
 		'standard'
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		, 'WordPoints_Hook_Reaction_Store_Options'
40 40
 	);
41 41
 
42
-	if ( is_wordpoints_network_active() ) {
42
+	if (is_wordpoints_network_active()) {
43 43
 		$reaction_stores->register(
44 44
 			'network'
45 45
 			, 'points'
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @param WordPoints_Class_Registry_Persistent $extensions The extension registry.
59 59
  */
60
-function wordpoints_points_hook_extensions_init( $extensions ) {
60
+function wordpoints_points_hook_extensions_init($extensions) {
61 61
 
62 62
 	$extensions->register(
63 63
 		'points_legacy_reversals'
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
  *
86 86
  * @param string $slug The slug of the post type.
87 87
  */
88
-function wordpoints_points_register_legacy_post_publish_events( $slug ) {
88
+function wordpoints_points_register_legacy_post_publish_events($slug) {
89 89
 
90
-	if ( 'attachment' === $slug ) {
90
+	if ('attachment' === $slug) {
91 91
 		return;
92 92
 	}
93 93
 
94
-	$events = wordpoints_hooks()->get_sub_app( 'events' );
94
+	$events = wordpoints_hooks()->get_sub_app('events');
95 95
 
96 96
 	$events->register(
97 97
 		"points_legacy_post_publish\\{$slug}"
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
 	wp_register_style(
132 132
 		'wordpoints-points-logs'
133 133
 		, "{$assets_url}/css/points-logs{$suffix}.css"
134
-		, array( 'dashicons' )
134
+		, array('dashicons')
135 135
 		, WORDPOINTS_VERSION
136 136
 	);
137 137
 
138 138
 	$styles = wp_styles();
139
-	$rtl_styles = array( 'wordpoints-top-users', 'wordpoints-points-logs' );
139
+	$rtl_styles = array('wordpoints-top-users', 'wordpoints-points-logs');
140 140
 
141
-	foreach ( $rtl_styles as $rtl_style ) {
141
+	foreach ($rtl_styles as $rtl_style) {
142 142
 
143
-		$styles->add_data( $rtl_style, 'rtl', 'replace' );
143
+		$styles->add_data($rtl_style, 'rtl', 'replace');
144 144
 
145
-		if ( $suffix ) {
146
-			$styles->add_data( $rtl_style, 'suffix', $suffix );
145
+		if ($suffix) {
146
+			$styles->add_data($rtl_style, 'suffix', $suffix);
147 147
 		}
148 148
 	}
149 149
 }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	return array(
161 161
 		'set_wordpoints_points'                  => 'manage_options',
162 162
 		'manage_network_wordpoints_points_hooks' => 'manage_network_options',
163
-		'manage_wordpoints_points_types'         => ( is_wordpoints_network_active() ) ? 'manage_network_options' : 'manage_options',
163
+		'manage_wordpoints_points_types'         => (is_wordpoints_network_active()) ? 'manage_network_options' : 'manage_options',
164 164
 	);
165 165
 }
166 166
 
@@ -178,23 +178,23 @@  discard block
 block discarded – undo
178 178
  *
179 179
  * @return string $points formatted with prefix and suffix.
180 180
  */
181
-function wordpoints_format_points_filter( $formatted, $points, $type ) {
181
+function wordpoints_format_points_filter($formatted, $points, $type) {
182 182
 
183
-	$points_type = wordpoints_get_points_type( $type );
183
+	$points_type = wordpoints_get_points_type($type);
184 184
 
185
-	if ( isset( $points_type['prefix'] ) ) {
185
+	if (isset($points_type['prefix'])) {
186 186
 
187
-		if ( $points < 0 ) {
187
+		if ($points < 0) {
188 188
 
189
-			$points = abs( $points );
189
+			$points = abs($points);
190 190
 			$points_type['prefix'] = '-' . $points_type['prefix'];
191 191
 		}
192 192
 
193
-		$formatted = esc_html( $points_type['prefix'] . $points );
193
+		$formatted = esc_html($points_type['prefix'] . $points);
194 194
 	}
195 195
 
196
-	if ( isset( $points_type['suffix'] ) ) {
197
-		$formatted = $formatted . esc_html( $points_type['suffix'] );
196
+	if (isset($points_type['suffix'])) {
197
+		$formatted = $formatted . esc_html($points_type['suffix']);
198 198
 	}
199 199
 
200 200
 	return $formatted;
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
  * @param array $args The arguments for the dropdown {@see
212 212
  *        WordPoints_Dropdown_Builder::$args}.
213 213
  */
214
-function wordpoints_points_types_dropdown( array $args ) {
214
+function wordpoints_points_types_dropdown(array $args) {
215 215
 
216 216
 	$points_types = array();
217 217
 
218
-	foreach ( wordpoints_get_points_types() as $slug => $settings ) {
218
+	foreach (wordpoints_get_points_types() as $slug => $settings) {
219 219
 
220
-		$points_types[ $slug ] = $settings['name'];
220
+		$points_types[$slug] = $settings['name'];
221 221
 	}
222 222
 
223
-	if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
223
+	if (isset($args['options']) && is_array($args['options'])) {
224 224
 		$points_types = $args['options'] + $points_types;
225 225
 	}
226 226
 
227
-	$dropdown = new WordPoints_Dropdown_Builder( $points_types, $args );
227
+	$dropdown = new WordPoints_Dropdown_Builder($points_types, $args);
228 228
 
229 229
 	$dropdown->display();
230 230
 }
@@ -238,27 +238,27 @@  discard block
 block discarded – undo
238 238
  *
239 239
  * @param int $user_id The ID of the user just deleted.
240 240
  */
241
-function wordpoints_delete_points_logs_for_user( $user_id ) {
241
+function wordpoints_delete_points_logs_for_user($user_id) {
242 242
 
243 243
 	global $wpdb;
244 244
 
245
-	$query_args = array( 'fields' => 'id', 'user_id' => $user_id );
245
+	$query_args = array('fields' => 'id', 'user_id' => $user_id);
246 246
 
247 247
 	// If the user is being deleted from all blogs on multisite.
248
-	if ( is_multisite() && ! get_userdata( $user_id ) ) {
248
+	if (is_multisite() && ! get_userdata($user_id)) {
249 249
 		$query_args['blog_id'] = 0;
250 250
 	}
251 251
 
252 252
 	// Delete log meta.
253
-	$query = new WordPoints_Points_Logs_Query( $query_args );
253
+	$query = new WordPoints_Points_Logs_Query($query_args);
254 254
 
255
-	foreach ( $query->get( 'col' ) as $log_id ) {
256
-		wordpoints_points_log_delete_all_metadata( $log_id );
255
+	foreach ($query->get('col') as $log_id) {
256
+		wordpoints_points_log_delete_all_metadata($log_id);
257 257
 	}
258 258
 
259
-	$where = array( 'user_id' => $user_id );
259
+	$where = array('user_id' => $user_id);
260 260
 
261
-	if ( ! isset( $query_args['blog_id'] ) ) {
261
+	if ( ! isset($query_args['blog_id'])) {
262 262
 		$where['blog_id'] = $wpdb->blogid;
263 263
 	}
264 264
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		,'%d'
270 270
 	);
271 271
 
272
-	wordpoints_flush_points_logs_caches( array( 'user_id' => $user_id ) );
272
+	wordpoints_flush_points_logs_caches(array('user_id' => $user_id));
273 273
 }
274 274
 
275 275
 /**
@@ -281,21 +281,21 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @param int $blog_id The ID of the blog being deleted.
283 283
  */
284
-function wordpoints_delete_points_logs_for_blog( $blog_id ) {
284
+function wordpoints_delete_points_logs_for_blog($blog_id) {
285 285
 
286 286
 	global $wpdb;
287 287
 
288 288
 	// Delete log meta.
289
-	$query = new WordPoints_Points_Logs_Query( array( 'fields' => 'id' ) );
289
+	$query = new WordPoints_Points_Logs_Query(array('fields' => 'id'));
290 290
 
291
-	foreach ( $query->get( 'col' ) as $log_id ) {
292
-		wordpoints_points_log_delete_all_metadata( $log_id );
291
+	foreach ($query->get('col') as $log_id) {
292
+		wordpoints_points_log_delete_all_metadata($log_id);
293 293
 	}
294 294
 
295 295
 	// Now delete the logs.
296 296
 	$wpdb->delete(
297 297
 		$wpdb->wordpoints_points_logs
298
-		,array( 'blog_id' => $blog_id )
298
+		,array('blog_id' => $blog_id)
299 299
 		,'%d'
300 300
 	);
301 301
 
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
  *
312 312
  * @param string $points_type The type of points the settings are being shown for.
313 313
  */
314
-function wordpoints_points_settings_custom_meta_key_message( $points_type ) {
314
+function wordpoints_points_settings_custom_meta_key_message($points_type) {
315 315
 
316
-	$custom_key = wordpoints_get_points_type_setting( $points_type, 'meta_key' );
316
+	$custom_key = wordpoints_get_points_type_setting($points_type, 'meta_key');
317 317
 
318
-	if ( ! empty( $custom_key ) ) {
318
+	if ( ! empty($custom_key)) {
319 319
 		// translators: 1. Meta key.
320
-		echo '<p>' . esc_html( sprintf( __( 'This points type uses a custom meta key: %s', 'wordpoints' ), $custom_key ) ) . '</p>';
320
+		echo '<p>' . esc_html(sprintf(__('This points type uses a custom meta key: %s', 'wordpoints'), $custom_key)) . '</p>';
321 321
 	}
322 322
 }
323 323
 
@@ -330,20 +330,20 @@  discard block
 block discarded – undo
330 330
  *
331 331
  * @param string $points_type The type of points whose logs are being displayed.
332 332
  */
333
-function wordpoints_points_logs_custom_meta_key_message( $points_type ) {
333
+function wordpoints_points_logs_custom_meta_key_message($points_type) {
334 334
 
335
-	if ( ! current_user_can( 'manage_options' ) ) {
335
+	if ( ! current_user_can('manage_options')) {
336 336
 		return;
337 337
 	}
338 338
 
339
-	$custom_key = wordpoints_get_points_type_setting( $points_type, 'meta_key' );
339
+	$custom_key = wordpoints_get_points_type_setting($points_type, 'meta_key');
340 340
 
341
-	if ( ! empty( $custom_key ) ) {
341
+	if ( ! empty($custom_key)) {
342 342
 		wordpoints_show_admin_message(
343 343
 			esc_html(
344 344
 				sprintf(
345 345
 					// translators: Meta key.
346
-					__( 'This points type uses a custom meta key (&#8220;%s&#8221;). If this key is also used by another plugin, changes made by it will not be logged. Only transactions performed by WordPoints are included in the logs.', 'wordpoints' )
346
+					__('This points type uses a custom meta key (&#8220;%s&#8221;). If this key is also used by another plugin, changes made by it will not be logged. Only transactions performed by WordPoints are included in the logs.', 'wordpoints')
347 347
 					, $custom_key
348 348
 				)
349 349
 			)
@@ -362,18 +362,18 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function wordpoints_points_add_global_cache_groups() {
364 364
 
365
-	if ( function_exists( 'wp_cache_add_global_groups' ) ) {
365
+	if (function_exists('wp_cache_add_global_groups')) {
366 366
 
367 367
 		$groups = array(
368 368
 			'wordpoints_network_points_logs_query',
369 369
 			'wordpoints_points_log_meta',
370 370
 		);
371 371
 
372
-		if ( is_wordpoints_network_active() ) {
372
+		if (is_wordpoints_network_active()) {
373 373
 			$groups[] = 'wordpoints_points_top_users';
374 374
 		}
375 375
 
376
-		wp_cache_add_global_groups( $groups );
376
+		wp_cache_add_global_groups($groups);
377 377
 	}
378 378
 }
379 379
 
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 function wordpoints_register_points_widgets() {
388 388
 
389 389
 	// My points widget.
390
-	register_widget( 'WordPoints_Points_Widget_User_Points' );
390
+	register_widget('WordPoints_Points_Widget_User_Points');
391 391
 
392 392
 	// Top users widget.
393
-	register_widget( 'WordPoints_Points_Widget_Top_Users' );
393
+	register_widget('WordPoints_Points_Widget_Top_Users');
394 394
 
395 395
 	// Points logs widget.
396
-	register_widget( 'WordPoints_Points_Widget_Logs' );
396
+	register_widget('WordPoints_Points_Widget_Logs');
397 397
 }
398 398
 
399 399
 // EOF
Please login to merge, or discard this patch.
src/components/points/classes/widget.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @since 1.9.0
21 21
 	 */
22
-	protected function verify_settings( $instance ) {
22
+	protected function verify_settings($instance) {
23 23
 
24
-		if ( isset( $this->defaults['points_type'] ) ) {
24
+		if (isset($this->defaults['points_type'])) {
25 25
 
26 26
 			if (
27
-				empty( $instance['points_type'] )
28
-				|| ! wordpoints_is_points_type( $instance['points_type'] )
27
+				empty($instance['points_type'])
28
+				|| ! wordpoints_is_points_type($instance['points_type'])
29 29
 			) {
30 30
 				return new WP_Error(
31 31
 					'wordpoints_widget_invalid_points_type'
32
-					, esc_html__( 'Please select a valid points type.', 'wordpoints' )
32
+					, esc_html__('Please select a valid points type.', 'wordpoints')
33 33
 				);
34 34
 			}
35 35
 		}
36 36
 
37
-		return parent::verify_settings( $instance );
37
+		return parent::verify_settings($instance);
38 38
 	}
39 39
 
40 40
 	/**
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @param string $maybe_points_type The variable to insure is a points type.
50 50
 	 */
51
-	protected function make_a_points_type( &$maybe_points_type ) {
51
+	protected function make_a_points_type(&$maybe_points_type) {
52 52
 
53
-		if ( ! wordpoints_is_points_type( $maybe_points_type ) ) {
53
+		if ( ! wordpoints_is_points_type($maybe_points_type)) {
54 54
 
55 55
 			$maybe_points_type = wordpoints_get_default_points_type();
56 56
 
57
-			if ( ! $maybe_points_type ) {
57
+			if ( ! $maybe_points_type) {
58 58
 
59 59
 				$points_types = wordpoints_get_points_types();
60 60
 
61
-				$maybe_points_type = key( $points_types );
61
+				$maybe_points_type = key($points_types);
62 62
 			}
63 63
 		}
64 64
 	}
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	/**
67 67
 	 * @since 2.0.0
68 68
 	 */
69
-	public function update( $new_instance, $old_instance ) {
69
+	public function update($new_instance, $old_instance) {
70 70
 
71
-		parent::update( $new_instance, $old_instance );
71
+		parent::update($new_instance, $old_instance);
72 72
 
73
-		$this->make_a_points_type( $this->instance['points_type'] );
73
+		$this->make_a_points_type($this->instance['points_type']);
74 74
 
75 75
 		return $this->instance;
76 76
 	}
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * @since 2.0.0
80 80
 	 */
81
-	public function form( $instance ) {
81
+	public function form($instance) {
82 82
 
83
-		parent::form( $instance );
83
+		parent::form($instance);
84 84
 
85 85
 		$this->form_points_type_field();
86 86
 
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 
97 97
 		$dropdown_args = array(
98 98
 			'selected' => $this->instance['points_type'],
99
-			'id'       => $this->get_field_id( 'points_type' ),
100
-			'name'     => $this->get_field_name( 'points_type' ),
99
+			'id'       => $this->get_field_id('points_type'),
100
+			'name'     => $this->get_field_name('points_type'),
101 101
 			'class'    => 'widefat',
102 102
 		);
103 103
 
104 104
 		?>
105 105
 
106 106
 		<p>
107
-			<label for="<?php echo esc_attr( $dropdown_args['id'] ); ?>"><?php echo esc_html_x( 'Points type', 'form label', 'wordpoints' ); ?></label>
108
-			<?php wordpoints_points_types_dropdown( $dropdown_args ); ?>
107
+			<label for="<?php echo esc_attr($dropdown_args['id']); ?>"><?php echo esc_html_x('Points type', 'form label', 'wordpoints'); ?></label>
108
+			<?php wordpoints_points_types_dropdown($dropdown_args); ?>
109 109
 		</p>
110 110
 
111 111
 		<?php
Please login to merge, or discard this patch.
src/components/points/classes/hook/extension/legacy/periods.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@  discard block
 block discarded – undo
31 31
 		WordPoints_Hook_ReactionI $reaction
32 32
 	) {
33 33
 
34
-		$period = parent::get_period_by_reaction( $settings, $reaction );
34
+		$period = parent::get_period_by_reaction($settings, $reaction);
35 35
 
36
-		if ( $period ) {
36
+		if ($period) {
37 37
 			return $period;
38 38
 		}
39 39
 
40
-		$expected_settings = array( array( 'current:user' ) );
40
+		$expected_settings = array(array('current:user'));
41 41
 
42
-		if ( ! isset( $settings['args'] ) || $settings['args'] !== $expected_settings ) {
42
+		if ( ! isset($settings['args']) || $settings['args'] !== $expected_settings) {
43 43
 			return false;
44 44
 		}
45 45
 
46 46
 		// Get the user ID.
47
-		$user = $this->event_args->get_from_hierarchy( array( 'current:user' ) );
47
+		$user = $this->event_args->get_from_hierarchy(array('current:user'));
48 48
 
49
-		if ( ! $user instanceof WordPoints_Entity ) {
49
+		if ( ! $user instanceof WordPoints_Entity) {
50 50
 			return false;
51 51
 		}
52 52
 
53 53
 		$user_id = $user->get_the_id();
54 54
 		$reaction_guid = $reaction->get_guid();
55
-		$points_type   = $reaction->get_meta( 'points_type' );
56
-		$log_type      = $reaction->get_meta( 'legacy_log_type' );
55
+		$points_type   = $reaction->get_meta('points_type');
56
+		$log_type      = $reaction->get_meta('legacy_log_type');
57 57
 
58
-		$cache_key = wp_json_encode( $reaction_guid ) . "-{$user_id}-{$points_type}-{$log_type}";
58
+		$cache_key = wp_json_encode($reaction_guid) . "-{$user_id}-{$points_type}-{$log_type}";
59 59
 
60 60
 		// Before we run the query, we try to lookup the period in the cache.
61
-		$period = wp_cache_get( $cache_key, 'wordpoints_points_legacy_hook_periods' );
61
+		$period = wp_cache_get($cache_key, 'wordpoints_points_legacy_hook_periods');
62 62
 
63
-		if ( $period ) {
63
+		if ($period) {
64 64
 			return $period;
65 65
 		}
66 66
 
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 			)
75 75
 		);
76 76
 
77
-		$date = $query->get( 'var' );
77
+		$date = $query->get('var');
78 78
 
79
-		if ( ! $date ) {
79
+		if ( ! $date) {
80 80
 			return false;
81 81
 		}
82 82
 
83
-		$period = (object) array( 'date' => $date );
83
+		$period = (object) array('date' => $date);
84 84
 
85
-		wp_cache_set( $cache_key, $period, 'wordpoints_points_legacy_hook_periods' );
85
+		wp_cache_set($cache_key, $period, 'wordpoints_points_legacy_hook_periods');
86 86
 
87 87
 		return $period;
88 88
 	}
Please login to merge, or discard this patch.