Completed
Push — master ( 947d26...1e2c33 )
by J.D.
04:30
created
src/includes/classes/hook/event/dynamic.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@
 block discarded – undo
46 46
 	 */
47 47
 	protected function get_entity_title() {
48 48
 
49
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
49
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
50 50
 
51
-		if ( $parts['dynamic'] ) {
51
+		if ($parts['dynamic']) {
52 52
 			$entity_slug = "{$this->generic_entity_slug}\\{$parts['dynamic']}";
53 53
 		} else {
54 54
 			$entity_slug = $this->generic_entity_slug;
55 55
 		}
56 56
 
57
-		$entity = wordpoints_entities()->get( $entity_slug );
57
+		$entity = wordpoints_entities()->get($entity_slug);
58 58
 
59
-		if ( ! $entity instanceof WordPoints_Entity ) {
59
+		if ( ! $entity instanceof WordPoints_Entity) {
60 60
 			return $this->slug;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.
src/includes/classes/hook/event/post/publish.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function get_title() {
26 26
 
27
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
27
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
28 28
 
29
-		switch ( $parsed['dynamic'] ) {
29
+		switch ($parsed['dynamic']) {
30 30
 
31 31
 			case 'post':
32
-				return __( 'Publish Post', 'wordpoints' );
32
+				return __('Publish Post', 'wordpoints');
33 33
 
34 34
 			case 'page':
35
-				return __( 'Publish Page', 'wordpoints' );
35
+				return __('Publish Page', 'wordpoints');
36 36
 
37 37
 			default:
38 38
 				return sprintf(
39 39
 					// translators: singular name of the post type
40
-					__( 'Publish %s', 'wordpoints' )
40
+					__('Publish %s', 'wordpoints')
41 41
 					, $this->get_entity_title()
42 42
 				);
43 43
 		}
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function get_description() {
50 50
 
51
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
51
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
52 52
 
53
-		switch ( $parsed['dynamic'] ) {
53
+		switch ($parsed['dynamic']) {
54 54
 
55 55
 			case 'post':
56
-				return __( 'When a Post is published.', 'wordpoints' );
56
+				return __('When a Post is published.', 'wordpoints');
57 57
 
58 58
 			case 'page':
59
-				return __( 'When a Page is published.', 'wordpoints' );
59
+				return __('When a Page is published.', 'wordpoints');
60 60
 
61 61
 			default:
62 62
 				return sprintf(
63 63
 					// translators: singular name of the post type
64
-					__( 'When a %s is published.', 'wordpoints' )
64
+					__('When a %s is published.', 'wordpoints')
65 65
 					, $this->get_entity_title()
66 66
 				);
67 67
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/event/comment/leave.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function get_title() {
26 26
 
27
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
27
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
28 28
 
29
-		switch ( $parsed['dynamic'] ) {
29
+		switch ($parsed['dynamic']) {
30 30
 
31 31
 			case 'post':
32
-				return __( 'Comment on a Post', 'wordpoints' );
32
+				return __('Comment on a Post', 'wordpoints');
33 33
 
34 34
 			case 'page':
35
-				return __( 'Comment on a Page', 'wordpoints' );
35
+				return __('Comment on a Page', 'wordpoints');
36 36
 
37 37
 			case 'attachment':
38
-				return __( 'Comment on a Media Upload', 'wordpoints' );
38
+				return __('Comment on a Media Upload', 'wordpoints');
39 39
 
40 40
 			default:
41 41
 				return sprintf(
42 42
 					// translators: singular name of the post type
43
-					__( 'Comment on a %s', 'wordpoints' )
43
+					__('Comment on a %s', 'wordpoints')
44 44
 					, $this->get_entity_title()
45 45
 				);
46 46
 		}
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function get_description() {
53 53
 
54
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
54
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
55 55
 
56
-		switch ( $parsed['dynamic'] ) {
56
+		switch ($parsed['dynamic']) {
57 57
 
58 58
 			case 'post':
59
-				return __( 'When a user leaves a comment on a Post.', 'wordpoints' );
59
+				return __('When a user leaves a comment on a Post.', 'wordpoints');
60 60
 
61 61
 			case 'page':
62
-				return __( 'When a user leaves a comment on a Page.', 'wordpoints' );
62
+				return __('When a user leaves a comment on a Page.', 'wordpoints');
63 63
 
64 64
 			case 'attachment':
65
-				return __( 'When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints' );
65
+				return __('When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints');
66 66
 
67 67
 			default:
68 68
 				return sprintf(
69 69
 					// translators: singular name of the post type
70
-					__( 'When a user leaves a comment on a %s.', 'wordpoints' )
70
+					__('When a user leaves a comment on a %s.', 'wordpoints')
71 71
 					, $this->get_entity_title()
72 72
 				);
73 73
 		}
Please login to merge, or discard this patch.
src/includes/classes/entity/relationship/dynamic.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,20 +17,20 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	public function __construct( $slug ) {
20
+	public function __construct($slug) {
21 21
 
22
-		parent::__construct( $slug );
22
+		parent::__construct($slug);
23 23
 
24
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
24
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
25 25
 
26
-		if ( $parts['dynamic'] ) {
26
+		if ($parts['dynamic']) {
27 27
 
28
-			$parsed = $this->parse_slug( $this->related_entity_slug );
28
+			$parsed = $this->parse_slug($this->related_entity_slug);
29 29
 
30 30
 			$this->primary_entity_slug = "{$this->primary_entity_slug}\\{$parts['dynamic']}";
31 31
 			$this->related_entity_slug = "{$parsed['slug']}\\{$parts['dynamic']}";
32 32
 
33
-			if ( $parsed['is_array'] ) {
33
+			if ($parsed['is_array']) {
34 34
 				$this->related_entity_slug .= '{}';
35 35
 			}
36 36
 		}
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function get_title() {
43 43
 
44
-		$parsed = $this->parse_slug( $this->related_entity_slug );
44
+		$parsed = $this->parse_slug($this->related_entity_slug);
45 45
 
46
-		$entity = wordpoints_entities()->get( $parsed['slug'] );
46
+		$entity = wordpoints_entities()->get($parsed['slug']);
47 47
 
48
-		if ( $entity instanceof WordPoints_Entity ) {
48
+		if ($entity instanceof WordPoints_Entity) {
49 49
 			return $entity->get_title();
50 50
 		} else {
51 51
 			return $this->related_entity_slug;
Please login to merge, or discard this patch.
src/admin/includes/actions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' );
10
+add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps');
11 11
 
12
-add_action( 'admin_menu', 'wordpoints_hooks_api_admin_menu' );
12
+add_action('admin_menu', 'wordpoints_hooks_api_admin_menu');
13 13
 
14
-if ( is_wordpoints_network_active() ) {
15
-	add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' );
14
+if (is_wordpoints_network_active()) {
15
+	add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu');
16 16
 }
17 17
 
18
-add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' );
19
-add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' );
18
+add_action('admin_init', 'wordpoints_hooks_admin_register_scripts');
19
+add_action('admin_init', 'wordpoints_hooks_admin_ajax');
20 20
 
21
-add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 );
21
+add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2);
22 22
 
23 23
 // EOF
Please login to merge, or discard this patch.
src/admin/includes/classes/screen.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	public function hooks() {
63 63
 
64 64
 		/* Load the JavaScript needed for the settings screen. */
65
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
66
-		add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) );
65
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
66
+		add_action("admin_footer-{$this->id}", array($this, 'footer_scripts'));
67 67
 	}
68 68
 
69 69
 	/**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 
99 99
 		<div class="wrap">
100 100
 
101
-			<h1><?php echo esc_html( $this->get_title() ); ?></h1>
101
+			<h1><?php echo esc_html($this->get_title()); ?></h1>
102 102
 
103 103
 			<?php settings_errors(); ?>
104 104
 
105
-			<?php if ( ! empty( $this->tabs ) ) : ?>
106
-				<?php wordpoints_admin_show_tabs( $this->tabs, false ); ?>
105
+			<?php if ( ! empty($this->tabs)) : ?>
106
+				<?php wordpoints_admin_show_tabs($this->tabs, false); ?>
107 107
 			<?php endif; ?>
108 108
 
109 109
 			<?php $this->display_content(); ?>
Please login to merge, or discard this patch.
src/admin/includes/classes/screens.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @since 1.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'current_screen', array( $this, 'set_current_screen' ) );
30
+		add_action('current_screen', array($this, 'set_current_screen'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param WP_Screen $current_screen The WP_Screen object for the current screen.
39 39
 	 */
40
-	public function set_current_screen( $current_screen ) {
40
+	public function set_current_screen($current_screen) {
41 41
 
42 42
 		$screen_id = $current_screen->id;
43 43
 
44
-		if ( is_network_admin() ) {
45
-			$screen_id = substr( $screen_id, 0, -8 /* -network */ );
44
+		if (is_network_admin()) {
45
+			$screen_id = substr($screen_id, 0, -8 /* -network */);
46 46
 		}
47 47
 
48
-		$screen = $this->get( $screen_id );
48
+		$screen = $this->get($screen_id);
49 49
 
50
-		if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) {
50
+		if ( ! ($screen instanceof WordPoints_Admin_Screen)) {
51 51
 			return;
52 52
 		}
53 53
 
54 54
 		$this->current_screen = $screen;
55 55
 
56
-		add_action( "load-{$screen_id}", array( $this->current_screen, 'load' ) );
56
+		add_action("load-{$screen_id}", array($this->current_screen, 'load'));
57 57
 	}
58 58
 
59 59
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/validator.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 	 * @param bool                            $fail_fast Whether to fail as soon as
105 105
 	 *                                                   the first error is found.
106 106
 	 */
107
-	public function __construct( $settings, WordPoints_Hook_Reactor $reactor, $fail_fast = false ) {
107
+	public function __construct($settings, WordPoints_Hook_Reactor $reactor, $fail_fast = false) {
108 108
 
109 109
 		$this->reactor = $reactor;
110 110
 		$this->fail_fast = $fail_fast;
111 111
 		$this->hooks = wordpoints_hooks();
112 112
 
113
-		if ( $settings instanceof WordPoints_Hook_ReactionI ) {
113
+		if ($settings instanceof WordPoints_Hook_ReactionI) {
114 114
 
115 115
 			$this->reaction   = $settings;
116 116
 			$this->settings   = $this->reaction->get_all_meta();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 			$this->settings = $settings;
122 122
 
123
-			if ( isset( $this->settings['event'] ) ) {
123
+			if (isset($this->settings['event'])) {
124 124
 				$this->event_slug = $this->settings['event'];
125 125
 			}
126 126
 		}
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 			$fail_fast = $this->fail_fast;
145 145
 			$this->fail_fast = true;
146 146
 
147
-			if ( ! isset( $this->event_slug ) ) {
148
-				$this->add_error( __( 'Event is missing.', 'wordpoints' ), 'event' );
149
-			} elseif ( ! $this->hooks->events->is_registered( $this->event_slug ) ) {
150
-				$this->add_error( __( 'Event is invalid.', 'wordpoints' ), 'event' );
147
+			if ( ! isset($this->event_slug)) {
148
+				$this->add_error(__('Event is missing.', 'wordpoints'), 'event');
149
+			} elseif ( ! $this->hooks->events->is_registered($this->event_slug)) {
150
+				$this->add_error(__('Event is invalid.', 'wordpoints'), 'event');
151 151
 			}
152 152
 
153 153
 			// From here on out we can collect errors as they come (unless we are
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 				$this->event_slug
159 159
 			);
160 160
 
161
-			$this->event_args = new WordPoints_Hook_Event_Args( $event_args );
162
-			$this->event_args->set_validator( $this );
161
+			$this->event_args = new WordPoints_Hook_Event_Args($event_args);
162
+			$this->event_args->set_validator($this);
163 163
 
164
-			$this->settings = $this->reactor->validate_settings( $this->settings, $this, $this->event_args );
164
+			$this->settings = $this->reactor->validate_settings($this->settings, $this, $this->event_args);
165 165
 
166 166
 			/** @var WordPoints_Hook_Extension $extension */
167
-			foreach ( $this->hooks->extensions->get_all() as $extension ) {
168
-				$this->settings = $extension->validate_settings( $this->settings, $this, $this->event_args );
167
+			foreach ($this->hooks->extensions->get_all() as $extension) {
168
+				$this->settings = $extension->validate_settings($this->settings, $this, $this->event_args);
169 169
 			}
170 170
 
171 171
 			/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 			 * @param WordPoints_Hook_Reaction_Validator $validator The validator object.
176 176
 			 * @param WordPoints_Hook_Event_Args         $args      The event args object.
177 177
 			 */
178
-			$this->settings = apply_filters( 'wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args );
178
+			$this->settings = apply_filters('wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args);
179 179
 
180
-		} catch ( WordPoints_Hook_Validator_Exception $e ) {
180
+		} catch (WordPoints_Hook_Validator_Exception $e) {
181 181
 
182 182
 			// Do nothing.
183
-			unset( $e );
183
+			unset($e);
184 184
 		}
185 185
 
186 186
 		return $this->settings;
@@ -208,17 +208,17 @@  discard block
 block discarded – undo
208 208
 	 * @throws WordPoints_Hook_Validator_Exception If the validator is configured to
209 209
 	 *                                             fail as soon as an error is found.
210 210
 	 */
211
-	public function add_error( $message, $field = null ) {
211
+	public function add_error($message, $field = null) {
212 212
 
213 213
 		$field_stack = $this->field_stack;
214 214
 
215
-		if ( null !== $field ) {
215
+		if (null !== $field) {
216 216
 			$field_stack[] = $field;
217 217
 		}
218 218
 
219
-		$this->errors[] = array( 'message' => $message, 'field' => $field_stack );
219
+		$this->errors[] = array('message' => $message, 'field' => $field_stack);
220 220
 
221
-		if ( $this->fail_fast ) {
221
+		if ($this->fail_fast) {
222 222
 			throw new WordPoints_Hook_Validator_Exception;
223 223
 		}
224 224
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return bool Whether the validator found any errors.
232 232
 	 */
233 233
 	public function had_errors() {
234
-		return ! empty( $this->errors );
234
+		return ! empty($this->errors);
235 235
 	}
236 236
 
237 237
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param string $field The field.
254 254
 	 */
255
-	public function push_field( $field ) {
255
+	public function push_field($field) {
256 256
 		$this->field_stack[] = $field;
257 257
 	}
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @since 1.0.0
263 263
 	 */
264 264
 	public function pop_field() {
265
-		array_pop( $this->field_stack );
265
+		array_pop($this->field_stack);
266 266
 	}
267 267
 
268 268
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function get_id() {
309 309
 
310
-		if ( ! $this->reaction ) {
310
+		if ( ! $this->reaction) {
311 311
 			return false;
312 312
 		}
313 313
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @return mixed The meta value.
347 347
 	 */
348
-	public function get_meta( $key ) {
348
+	public function get_meta($key) {
349 349
 
350
-		if ( ! isset( $this->settings[ $key ] ) ) {
350
+		if ( ! isset($this->settings[$key])) {
351 351
 			return null;
352 352
 		}
353 353
 
354
-		return $this->settings[ $key ];
354
+		return $this->settings[$key];
355 355
 	}
356 356
 
357 357
 	/**
Please login to merge, or discard this patch.
src/admin/includes/classes/screen/points/types.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @since 1.0.0
57 57
 	 */
58 58
 	protected function get_title() {
59
-		return _x( 'Points Types', 'page title', 'wordpoints' );
59
+		return _x('Points Types', 'page title', 'wordpoints');
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
 		parent::hooks();
68 68
 
69
-		add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) );
70
-		add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) );
69
+		add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box'));
70
+		add_action('add_meta_boxes', array($this, 'add_event_meta_boxes'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function enqueue_scripts() {
77 77
 
78
-		wp_enqueue_style( 'wordpoints-hooks-admin' );
78
+		wp_enqueue_style('wordpoints-hooks-admin');
79 79
 
80
-		wp_enqueue_script( 'postbox' );
80
+		wp_enqueue_script('postbox');
81 81
 
82 82
 		wordpoints_hooks_ui_setup_script_data();
83 83
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					.addClass( 'closed' );
98 98
 
99 99
 				postboxes.add_postbox_toggles(
100
-					<?php echo wp_json_encode( $this->id ); ?>
100
+					<?php echo wp_json_encode($this->id); ?>
101 101
 				);
102 102
 			} );
103 103
 		</script>
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function add_points_settings_meta_box() {
114 114
 
115
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
115
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
116 116
 			return;
117 117
 		}
118 118
 
119 119
 		add_meta_box(
120 120
 			'settings'
121
-			, __( 'Settings', 'wordpoints' )
122
-			, array( $this, 'display_points_settings_meta_box' )
121
+			, __('Settings', 'wordpoints')
122
+			, array($this, 'display_points_settings_meta_box')
123 123
 			, $this->id
124 124
 			, 'side'
125 125
 			, 'default'
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function display_points_settings_meta_box() {
135 135
 
136
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
136
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
137 137
 			return;
138 138
 		}
139 139
 
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 
142 142
 		$add_new = 0;
143 143
 
144
-		$points_type = wordpoints_get_points_type( $slug );
144
+		$points_type = wordpoints_get_points_type($slug);
145 145
 
146
-		if ( ! $points_type ) {
146
+		if ( ! $points_type) {
147 147
 
148 148
 			$points_type = array();
149
-			$add_new     = wp_create_nonce( 'wordpoints_add_new_points_type' );
149
+			$add_new     = wp_create_nonce('wordpoints_add_new_points_type');
150 150
 		}
151 151
 
152 152
 		$points_type = array_merge(
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 		?>
162 162
 
163 163
 		<form method="post">
164
-			<?php if ( $slug ) : ?>
164
+			<?php if ($slug) : ?>
165 165
 				<p>
166 166
 					<span class="wordpoints-points-slug">
167 167
 						<em>
168
-							<?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?>
168
+							<?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?>
169 169
 						</em>
170 170
 					</span>
171 171
 				</p>
172
-				<?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?>
172
+				<?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?>
173 173
 			<?php endif; ?>
174 174
 
175 175
 			<?php
@@ -183,45 +183,45 @@  discard block
 block discarded – undo
183 183
 			 *
184 184
 			 * @param string $points_type The slug of the points type.
185 185
 			 */
186
-			do_action( 'wordpoints_points_type_form_top', $slug );
186
+			do_action('wordpoints_points_type_form_top', $slug);
187 187
 
188
-			if ( $add_new ) {
188
+			if ($add_new) {
189 189
 
190 190
 				// Mark the prefix and suffix optional on the add new form.
191
-				$prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' );
192
-				$suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' );
191
+				$prefix = _x('Prefix (optional):', 'points type', 'wordpoints');
192
+				$suffix = _x('Suffix (optional):', 'points type', 'wordpoints');
193 193
 
194 194
 			} else {
195 195
 
196
-				$prefix = _x( 'Prefix:', 'points type', 'wordpoints' );
197
-				$suffix = _x( 'Suffix:', 'points type', 'wordpoints' );
196
+				$prefix = _x('Prefix:', 'points type', 'wordpoints');
197
+				$suffix = _x('Suffix:', 'points type', 'wordpoints');
198 198
 			}
199 199
 
200 200
 			?>
201 201
 
202 202
 			<p>
203 203
 				<label
204
-					for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label>
204
+					for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label>
205 205
 				<input class="widefat" type="text"
206
-				       id="points-name-<?php echo esc_attr( $slug ); ?>"
206
+				       id="points-name-<?php echo esc_attr($slug); ?>"
207 207
 				       name="points-name"
208
-				       value="<?php echo esc_attr( $points_type['name'] ); ?>"/>
208
+				       value="<?php echo esc_attr($points_type['name']); ?>"/>
209 209
 			</p>
210 210
 			<p>
211 211
 				<label
212
-					for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label>
212
+					for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label>
213 213
 				<input class="widefat" type="text"
214
-				       id="points-prefix-<?php echo esc_attr( $slug ); ?>"
214
+				       id="points-prefix-<?php echo esc_attr($slug); ?>"
215 215
 				       name="points-prefix"
216
-				       value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/>
216
+				       value="<?php echo esc_attr($points_type['prefix']); ?>"/>
217 217
 			</p>
218 218
 			<p>
219 219
 				<label
220
-					for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label>
220
+					for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label>
221 221
 				<input class="widefat" type="text"
222
-				       id="points-suffix-<?php echo esc_attr( $slug ); ?>"
222
+				       id="points-suffix-<?php echo esc_attr($slug); ?>"
223 223
 				       name="points-suffix"
224
-				       value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/>
224
+				       value="<?php echo esc_attr($points_type['suffix']); ?>"/>
225 225
 			</p>
226 226
 
227 227
 			<?php
@@ -235,28 +235,28 @@  discard block
 block discarded – undo
235 235
 			 *
236 236
 			 * @param string $points_type The slug of the points type.
237 237
 			 */
238
-			do_action( 'wordpoints_points_type_form_bottom', $slug );
238
+			do_action('wordpoints_points_type_form_bottom', $slug);
239 239
 
240 240
 			?>
241 241
 
242 242
 			<input type="hidden" name="points-slug"
243
-			       value="<?php echo esc_attr( $slug ); ?>"/>
243
+			       value="<?php echo esc_attr($slug); ?>"/>
244 244
 			<input type="hidden" name="add_new" class="add_new"
245
-			       value="<?php echo esc_attr( $add_new ); ?>"/>
245
+			       value="<?php echo esc_attr($add_new); ?>"/>
246 246
 
247 247
 			<div class="hook-control-actions">
248 248
 				<div class="alignleft">
249 249
 					<?php
250 250
 
251
-					if ( ! $add_new ) {
252
-						wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' );
253
-						submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) );
251
+					if ( ! $add_new) {
252
+						wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce');
253
+						submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}"));
254 254
 					}
255 255
 
256 256
 					?>
257 257
 				</div>
258 258
 				<div class="alignright">
259
-					<?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?>
259
+					<?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?>
260 260
 					<span class="spinner"></span>
261 261
 				</div>
262 262
 				<br class="clear"/>
@@ -273,17 +273,17 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function add_event_meta_boxes() {
275 275
 
276
-		if ( ! $this->current_points_type ) {
276
+		if ( ! $this->current_points_type) {
277 277
 			return;
278 278
 		}
279 279
 
280 280
 		/** @var WordPoints_Hook_EventI $event */
281
-		foreach ( $this->hooks->events->get_all() as $slug => $event ) {
281
+		foreach ($this->hooks->events->get_all() as $slug => $event) {
282 282
 
283 283
 			add_meta_box(
284 284
 				"{$this->current_points_type}-{$slug}"
285 285
 				, $event->get_title()
286
-				, array( $this, 'display_event_meta_box' )
286
+				, array($this, 'display_event_meta_box')
287 287
 				, $this->id
288 288
 				, 'events'
289 289
 				, 'default'
@@ -304,55 +304,55 @@  discard block
 block discarded – undo
304 304
 	 * @param array $points_type The points type this meta-box relates to.
305 305
 	 * @param array $meta_box    The data the meta-box was created with.
306 306
 	 */
307
-	public function display_event_meta_box( $points_type, $meta_box ) {
307
+	public function display_event_meta_box($points_type, $meta_box) {
308 308
 
309 309
 		$event_slug = $meta_box['args']['slug'];
310 310
 
311 311
 		/** @var WordPoints_Hook_Reactor $points_reactor */
312
-		$points_reactor = $this->hooks->reactors->get( 'points' );
312
+		$points_reactor = $this->hooks->reactors->get('points');
313 313
 
314 314
 		$data = array();
315 315
 
316
-		foreach ( $points_reactor->reactions->get_reactions_to_event( $event_slug ) as $id => $reaction ) {
317
-			if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) {
316
+		foreach ($points_reactor->reactions->get_reactions_to_event($event_slug) as $id => $reaction) {
317
+			if ($reaction->get_meta('points_type') === $this->current_points_type) {
318 318
 				$data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction(
319 319
 					$reaction
320 320
 				);
321 321
 			}
322 322
 		}
323 323
 
324
-		$args = $this->hooks->events->args->get_children( $event_slug );
324
+		$args = $this->hooks->events->args->get_children($event_slug);
325 325
 
326
-		$event_data = array( 'args' => array() );
326
+		$event_data = array('args' => array());
327 327
 
328
-		foreach ( $args as $slug => $arg ) {
328
+		foreach ($args as $slug => $arg) {
329 329
 
330
-			$event_data['args'][ $slug ] = array(
330
+			$event_data['args'][$slug] = array(
331 331
 				'slug' => $slug,
332 332
 			);
333 333
 
334
-			if ( $arg instanceof WordPoints_Hook_Arg ) {
335
-				$event_data['args'][ $slug ]['title'] = $arg->get_title();
336
-				$event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful();
334
+			if ($arg instanceof WordPoints_Hook_Arg) {
335
+				$event_data['args'][$slug]['title'] = $arg->get_title();
336
+				$event_data['args'][$slug]['is_stateful'] = $arg->is_stateful();
337 337
 			}
338 338
 		}
339 339
 
340 340
 		?>
341 341
 
342 342
 		<script>
343
-			WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>;
344
-			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>;
343
+			WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>;
344
+			WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>;
345 345
 		</script>
346 346
 
347 347
 		<div class="wordpoints-hook-reaction-group-container">
348 348
 			<p class="description wordpoints-hook-reaction-group-description">
349
-				<?php echo esc_html( $meta_box['args']['event']->get_description() ); ?>
349
+				<?php echo esc_html($meta_box['args']['event']->get_description()); ?>
350 350
 			</p>
351 351
 
352 352
 			<div class="wordpoints-hook-reaction-group"
353
-				data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>"
354
-				data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>"
355
-				data-wordpoints-hooks-create-nonce="<?php echo esc_attr( wp_create_nonce( 'wordpoints_create_hook_reaction|points' ) ); ?>"
353
+				data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>"
354
+				data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>"
355
+				data-wordpoints-hooks-create-nonce="<?php echo esc_attr(wp_create_nonce('wordpoints_create_hook_reaction|points')); ?>"
356 356
 				data-wordpoints-hooks-reactor="points">
357 357
 			</div>
358 358
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
 			<div class="controls">
368 368
 				<button type="button" class="button-primary add-reaction">
369
-					<?php esc_html_e( 'Add New', 'wordpoints' ); ?>
369
+					<?php esc_html_e('Add New', 'wordpoints'); ?>
370 370
 				</button>
371 371
 			</div>
372 372
 		</div>
@@ -386,19 +386,19 @@  discard block
 block discarded – undo
386 386
 		// Show a tab for each points type.
387 387
 		$tabs = array();
388 388
 
389
-		foreach ( $points_types as $slug => $settings ) {
390
-			$tabs[ $slug ] = $settings['name'];
389
+		foreach ($points_types as $slug => $settings) {
390
+			$tabs[$slug] = $settings['name'];
391 391
 		}
392 392
 
393
-		$tabs['add-new'] = __( 'Add New', 'wordpoints' );
393
+		$tabs['add-new'] = __('Add New', 'wordpoints');
394 394
 
395
-		$tab = wordpoints_admin_get_current_tab( $tabs );
395
+		$tab = wordpoints_admin_get_current_tab($tabs);
396 396
 
397
-		if ( 'add-new' !== $tab ) {
397
+		if ('add-new' !== $tab) {
398 398
 			$this->current_points_type = $tab;
399 399
 		}
400 400
 
401
-		do_action( 'add_meta_boxes', $this->id );
401
+		do_action('add_meta_boxes', $this->id);
402 402
 
403 403
 		$this->tabs = $tabs;
404 404
 	}
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 */
411 411
 	public function save_points_type() {
412 412
 
413
-		if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) {
413
+		if ( ! current_user_can('manage_wordpoints_points_types')) {
414 414
 			return;
415 415
 		}
416 416
 
@@ -425,43 +425,43 @@  discard block
 block discarded – undo
425 425
 
426 426
 			$settings = array();
427 427
 
428
-			$settings['name']   = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) ); // WPCS: CSRF OK
429
-			$settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) ); // WPCS: CSRF OK
430
-			$settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) ); // WPCS: CSRF OK
428
+			$settings['name']   = trim(sanitize_text_field(wp_unslash($_POST['points-name']))); // WPCS: CSRF OK
429
+			$settings['prefix'] = ltrim(sanitize_text_field(wp_unslash($_POST['points-prefix']))); // WPCS: CSRF OK
430
+			$settings['suffix'] = rtrim(sanitize_text_field(wp_unslash($_POST['points-suffix']))); // WPCS: CSRF OK
431 431
 
432 432
 			if (
433
-				isset( $_POST['points-slug'] )
434
-				&& wordpoints_verify_nonce( 'update_points_type', 'wordpoints_update_points_type-%s', array( 'points-slug' ), 'post' )
433
+				isset($_POST['points-slug'])
434
+				&& wordpoints_verify_nonce('update_points_type', 'wordpoints_update_points_type-%s', array('points-slug'), 'post')
435 435
 			) {
436 436
 
437 437
 				// - We are updating an existing points type.
438 438
 
439
-				$points_type = sanitize_key( $_POST['points-slug'] );
439
+				$points_type = sanitize_key($_POST['points-slug']);
440 440
 
441
-				$old_settings = wordpoints_get_points_type( $points_type );
441
+				$old_settings = wordpoints_get_points_type($points_type);
442 442
 
443
-				if ( false === $old_settings ) {
443
+				if (false === $old_settings) {
444 444
 
445 445
 					add_settings_error(
446 446
 						''
447 447
 						, 'wordpoints_points_type_update'
448
-						, __( 'Error: failed updating points type.', 'wordpoints' )
448
+						, __('Error: failed updating points type.', 'wordpoints')
449 449
 						, 'updated'
450 450
 					);
451 451
 
452 452
 					return;
453 453
 				}
454 454
 
455
-				if ( is_array( $old_settings ) ) {
456
-					$settings = array_merge( $old_settings, $settings );
455
+				if (is_array($old_settings)) {
456
+					$settings = array_merge($old_settings, $settings);
457 457
 				}
458 458
 
459
-				if ( ! wordpoints_update_points_type( $points_type, $settings ) ) {
459
+				if ( ! wordpoints_update_points_type($points_type, $settings)) {
460 460
 
461 461
 					add_settings_error(
462 462
 						''
463 463
 						, 'wordpoints_points_type_update'
464
-						, __( 'Error: failed updating points type.', 'wordpoints' )
464
+						, __('Error: failed updating points type.', 'wordpoints')
465 465
 						, 'updated'
466 466
 					);
467 467
 
@@ -470,23 +470,23 @@  discard block
 block discarded – undo
470 470
 					add_settings_error(
471 471
 						''
472 472
 						, 'wordpoints_points_type_update'
473
-						, __( 'Points type updated.', 'wordpoints' )
473
+						, __('Points type updated.', 'wordpoints')
474 474
 						, 'updated'
475 475
 					);
476 476
 				}
477 477
 
478
-			} elseif ( wordpoints_verify_nonce( 'add_new', 'wordpoints_add_new_points_type', null, 'post' ) ) {
478
+			} elseif (wordpoints_verify_nonce('add_new', 'wordpoints_add_new_points_type', null, 'post')) {
479 479
 
480 480
 				// - We are creating a new points type.
481 481
 
482
-				$slug = wordpoints_add_points_type( $settings );
482
+				$slug = wordpoints_add_points_type($settings);
483 483
 
484
-				if ( ! $slug ) {
484
+				if ( ! $slug) {
485 485
 
486 486
 					add_settings_error(
487 487
 						''
488 488
 						, 'wordpoints_points_type_create'
489
-						, __( 'Please choose a unique name for this points type.', 'wordpoints' )
489
+						, __('Please choose a unique name for this points type.', 'wordpoints')
490 490
 					);
491 491
 
492 492
 				} else {
@@ -496,26 +496,26 @@  discard block
 block discarded – undo
496 496
 					add_settings_error(
497 497
 						''
498 498
 						, 'wordpoints_points_type_create'
499
-						, __( 'Points type created.', 'wordpoints' )
499
+						, __('Points type created.', 'wordpoints')
500 500
 						, 'updated'
501 501
 					);
502 502
 				}
503 503
 			}
504 504
 
505 505
 		} elseif (
506
-			! empty( $_POST['delete-points-type'] )
507
-			&& isset( $_POST['points-slug'] )
508
-			&& wordpoints_verify_nonce( 'delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array( 'points-slug' ), 'post' )
506
+			! empty($_POST['delete-points-type'])
507
+			&& isset($_POST['points-slug'])
508
+			&& wordpoints_verify_nonce('delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array('points-slug'), 'post')
509 509
 		) {
510 510
 
511 511
 			// - We are deleting a points type.
512 512
 
513
-			if ( wordpoints_delete_points_type( sanitize_key( $_POST['points-slug'] ) ) ) {
513
+			if (wordpoints_delete_points_type(sanitize_key($_POST['points-slug']))) {
514 514
 
515 515
 				add_settings_error(
516 516
 					''
517 517
 					, 'wordpoints_points_type_delete'
518
-					, __( 'Points type deleted.', 'wordpoints' )
518
+					, __('Points type deleted.', 'wordpoints')
519 519
 					, 'updated'
520 520
 				);
521 521
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 				add_settings_error(
525 525
 					''
526 526
 					, 'wordpoints_points_type_delete'
527
-					, __( 'Error while deleting.', 'wordpoints' )
527
+					, __('Error while deleting.', 'wordpoints')
528 528
 				);
529 529
 			}
530 530
 		}
@@ -540,25 +540,25 @@  discard block
 block discarded – undo
540 540
 		 *
541 541
 		 * @since 1.0.0
542 542
 		 */
543
-		do_action( 'wordpoints_admin_points_events_head' );
543
+		do_action('wordpoints_admin_points_events_head');
544 544
 
545
-		if ( is_network_admin() ) {
546
-			$title = __( 'Network Events', 'wordpoints' );
547
-			$description = __( 'Award points when various events happen on this network.', 'wordpoints' );
545
+		if (is_network_admin()) {
546
+			$title = __('Network Events', 'wordpoints');
547
+			$description = __('Award points when various events happen on this network.', 'wordpoints');
548 548
 		} else {
549
-			$title = __( 'Events', 'wordpoints' );
550
-			$description = __( 'Award points when various events happen on this site.', 'wordpoints' );
549
+			$title = __('Events', 'wordpoints');
550
+			$description = __('Award points when various events happen on this site.', 'wordpoints');
551 551
 		}
552 552
 
553
-		$points_type = wordpoints_get_points_type( $this->current_points_type );
553
+		$points_type = wordpoints_get_points_type($this->current_points_type);
554 554
 
555 555
 		?>
556 556
 
557 557
 		<div class="wordpoints-points-type-meta-box-wrap">
558 558
 
559 559
 				<form>
560
-					<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
561
-					<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
560
+					<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
561
+					<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
562 562
 				</form>
563 563
 
564 564
 				<div id="poststuff">
@@ -566,17 +566,17 @@  discard block
 block discarded – undo
566 566
 					<div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>">
567 567
 
568 568
 						<div id="postbox-container-1" class="postbox-container">
569
-							<?php do_meta_boxes( $this->id, 'side', $points_type ); ?>
569
+							<?php do_meta_boxes($this->id, 'side', $points_type); ?>
570 570
 						</div>
571 571
 
572
-						<?php if ( isset( $this->current_points_type ) ) : ?>
572
+						<?php if (isset($this->current_points_type)) : ?>
573 573
 							<div class="wordpoints-hook-events-heading">
574
-								<h2><?php echo esc_html( $title ); ?></h2>
575
-								<p class="description"><?php echo esc_html( $description ); ?></p>
574
+								<h2><?php echo esc_html($title); ?></h2>
575
+								<p class="description"><?php echo esc_html($description); ?></p>
576 576
 							</div>
577 577
 
578 578
 							<div id="postbox-container-2" class="postbox-container">
579
-								<?php do_meta_boxes( $this->id, 'events', $points_type ); ?>
579
+								<?php do_meta_boxes($this->id, 'events', $points_type); ?>
580 580
 							</div>
581 581
 						<?php endif; ?>
582 582
 
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		 *
596 596
 		 * @since 1.0.0
597 597
 		 */
598
-		do_action( 'wordpoints_admin_points_events_foot' );
598
+		do_action('wordpoints_admin_points_events_foot');
599 599
 	}
600 600
 }
601 601
 
Please login to merge, or discard this patch.