Completed
Push — master ( b792a1...ed9362 )
by J.D.
03:30
created
src/includes/classes/hook/retroactive/query/modifieri.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 interface WordPoints_Hook_Retroactive_Query_ModifierI {
11
-	public function modify_retroactive_query( WordPoints_Hook_Retroactive_QueryI $query );
11
+	public function modify_retroactive_query(WordPoints_Hook_Retroactive_QueryI $query);
12 12
 }
13 13
 
14 14
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/retroactive/queryi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 interface WordPoints_Hook_Retroactive_QueryI {
52 52
 
53
-	public function __construct( WordPoints_Hook_ReactionI $reaction );
53
+	public function __construct(WordPoints_Hook_ReactionI $reaction);
54 54
 
55 55
 	/**
56 56
 	 *
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	public function get_reaction();
62 62
 	public function get_validator();
63 63
 
64
-	public function arg_hierarchy_push( $slug );
64
+	public function arg_hierarchy_push($slug);
65 65
 	public function arg_hierarchy_pop();
66 66
 	public function get_arg();
67 67
 
68
-	public function set_target( $target_arg );
68
+	public function set_target($target_arg);
69 69
 	public function select_value();
70
-	public function add_condition( array $condition );
70
+	public function add_condition(array $condition);
71 71
 
72 72
 	public function get_results();
73 73
 }
Please login to merge, or discard this patch.
src/includes/classes/hook/router.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 	/**
81 81
 	 * @since 1.0.0
82 82
 	 */
83
-	public function __call( $name, $args ) {
83
+	public function __call($name, $args) {
84 84
 
85
-		$this->route_action( $name, $args );
85
+		$this->route_action($name, $args);
86 86
 
87 87
 		// Return the first value, in case it is hooked to a filter.
88 88
 		$return = null;
89
-		if ( isset( $args[0] ) ) {
89
+		if (isset($args[0])) {
90 90
 			$return = $args[0];
91 91
 		}
92 92
 
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 *                     action name and the priority.
104 104
 	 * @param array  $args The args the action was fired with.
105 105
 	 */
106
-	protected function route_action( $name, $args ) {
106
+	protected function route_action($name, $args) {
107 107
 
108
-		if ( ! isset( $this->action_index[ $name ] ) ) {
108
+		if ( ! isset($this->action_index[$name])) {
109 109
 			return;
110 110
 		}
111 111
 
112
-		if ( ! isset( $this->actions ) ) {
112
+		if ( ! isset($this->actions)) {
113 113
 
114 114
 			$hooks = wordpoints_hooks();
115 115
 
@@ -118,41 +118,41 @@  discard block
 block discarded – undo
118 118
 			$this->firers  = $hooks->firers;
119 119
 		}
120 120
 
121
-		foreach ( $this->action_index[ $name ]['actions'] as $slug => $data ) {
121
+		foreach ($this->action_index[$name]['actions'] as $slug => $data) {
122 122
 
123
-			if ( ! isset( $this->event_index[ $slug ] ) ) {
123
+			if ( ! isset($this->event_index[$slug])) {
124 124
 				continue;
125 125
 			}
126 126
 
127
-			$action_object = $this->actions->get( $slug, $args, $data );
127
+			$action_object = $this->actions->get($slug, $args, $data);
128 128
 
129
-			if ( ! ( $action_object instanceof WordPoints_Hook_ActionI ) ) {
129
+			if ( ! ($action_object instanceof WordPoints_Hook_ActionI)) {
130 130
 				continue;
131 131
 			}
132 132
 
133
-			if ( ! $action_object->should_fire() ) {
133
+			if ( ! $action_object->should_fire()) {
134 134
 				continue;
135 135
 			}
136 136
 
137
-			foreach ( $this->event_index[ $slug ] as $type => $events ) {
138
-				foreach ( $events as $event_slug => $unused ) {
137
+			foreach ($this->event_index[$slug] as $type => $events) {
138
+				foreach ($events as $event_slug => $unused) {
139 139
 
140
-					if ( ! $this->events->is_registered( $event_slug ) ) {
140
+					if ( ! $this->events->is_registered($event_slug)) {
141 141
 						continue;
142 142
 					}
143 143
 
144
-					$event_args = $this->events->args->get_children( $event_slug, array( $action_object ) );
144
+					$event_args = $this->events->args->get_children($event_slug, array($action_object));
145 145
 
146
-					if ( empty( $event_args ) ) {
146
+					if (empty($event_args)) {
147 147
 						continue;
148 148
 					}
149 149
 
150
-					$event_args = new WordPoints_Hook_Event_Args( $event_args );
150
+					$event_args = new WordPoints_Hook_Event_Args($event_args);
151 151
 
152
-					$firer = $this->firers->get( $type );
152
+					$firer = $this->firers->get($type);
153 153
 
154
-					if ( $firer instanceof WordPoints_Hook_FirerI ) {
155
-						$firer->do_event( $event_slug, $event_args );
154
+					if ($firer instanceof WordPoints_Hook_FirerI) {
155
+						$firer->do_event($event_slug, $event_args);
156 156
 					}
157 157
 				}
158 158
 			}
@@ -182,56 +182,56 @@  discard block
 block discarded – undo
182 182
 	 *        }
183 183
 	 * }
184 184
 	 */
185
-	public function add_action( $slug, array $args ) {
185
+	public function add_action($slug, array $args) {
186 186
 
187 187
 		$priority = 10;
188
-		if ( isset( $args['priority'] ) ) {
188
+		if (isset($args['priority'])) {
189 189
 			$priority = $args['priority'];
190 190
 		}
191 191
 
192
-		if ( ! isset( $args['action'] ) ) {
192
+		if ( ! isset($args['action'])) {
193 193
 			return;
194 194
 		}
195 195
 
196 196
 		$method = "{$args['action']},{$priority}";
197 197
 
198
-		$this->action_index[ $method ]['actions'][ $slug ] = array();
198
+		$this->action_index[$method]['actions'][$slug] = array();
199 199
 
200 200
 		$arg_number = 1;
201 201
 
202
-		if ( isset( $args['data'] ) ) {
202
+		if (isset($args['data'])) {
203 203
 
204
-			if ( isset( $args['data']['arg_index'] ) ) {
205
-				$arg_number = 1 + max( $args['data']['arg_index'] );
204
+			if (isset($args['data']['arg_index'])) {
205
+				$arg_number = 1 + max($args['data']['arg_index']);
206 206
 			}
207 207
 
208
-			if ( isset( $args['data']['requirements'] ) ) {
209
-				$requirements = 1 + max( array_keys( $args['data']['requirements'] ) );
208
+			if (isset($args['data']['requirements'])) {
209
+				$requirements = 1 + max(array_keys($args['data']['requirements']));
210 210
 
211
-				if ( $requirements > $arg_number ) {
211
+				if ($requirements > $arg_number) {
212 212
 					$arg_number = $requirements;
213 213
 				}
214 214
 			}
215 215
 
216
-			$this->action_index[ $method ]['actions'][ $slug ] = $args['data'];
216
+			$this->action_index[$method]['actions'][$slug] = $args['data'];
217 217
 		}
218 218
 
219
-		if ( isset( $args['arg_number'] ) ) {
219
+		if (isset($args['arg_number'])) {
220 220
 			$arg_number = $args['arg_number'];
221 221
 		}
222 222
 
223 223
 		// If this action is already being routed, and will have enough args, we
224 224
 		// don't need to hook to it again.
225 225
 		if (
226
-			isset( $this->action_index[ $method ]['arg_number'] )
227
-			&& $this->action_index[ $method ]['arg_number'] >= $arg_number
226
+			isset($this->action_index[$method]['arg_number'])
227
+			&& $this->action_index[$method]['arg_number'] >= $arg_number
228 228
 		) {
229 229
 			return;
230 230
 		}
231 231
 
232
-		$this->action_index[ $method ]['arg_number'] = $arg_number;
232
+		$this->action_index[$method]['arg_number'] = $arg_number;
233 233
 
234
-		add_action( $args['action'], array( $this, $method ), $priority, $arg_number );
234
+		add_action($args['action'], array($this, $method), $priority, $arg_number);
235 235
 	}
236 236
 
237 237
 	/**
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @param string $slug The action slug.
243 243
 	 */
244
-	public function remove_action( $slug ) {
244
+	public function remove_action($slug) {
245 245
 
246
-		foreach ( $this->action_index as $method => $data ) {
247
-			if ( isset( $data['actions'][ $slug ] ) ) {
246
+		foreach ($this->action_index as $method => $data) {
247
+			if (isset($data['actions'][$slug])) {
248 248
 
249
-				unset( $this->action_index[ $method ]['actions'][ $slug ] );
249
+				unset($this->action_index[$method]['actions'][$slug]);
250 250
 
251
-				if ( empty( $this->action_index[ $method ]['actions'] ) ) {
251
+				if (empty($this->action_index[$method]['actions'])) {
252 252
 
253
-					unset( $this->action_index[ $method ] );
253
+					unset($this->action_index[$method]);
254 254
 
255
-					list( $action, $priority ) = explode( ',', $method );
255
+					list($action, $priority) = explode(',', $method);
256 256
 
257
-					remove_action( $action, array( $this, $method ), $priority );
257
+					remove_action($action, array($this, $method), $priority);
258 258
 				}
259 259
 			}
260 260
 		}
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @param string $action_slug The slug of the action.
270 270
 	 * @param string $action_type The type of action. Default is 'fire'.
271 271
 	 */
272
-	public function add_event_to_action( $event_slug, $action_slug, $action_type = 'fire' ) {
273
-		$this->event_index[ $action_slug ][ $action_type ][ $event_slug ] = true;
272
+	public function add_event_to_action($event_slug, $action_slug, $action_type = 'fire') {
273
+		$this->event_index[$action_slug][$action_type][$event_slug] = true;
274 274
 	}
275 275
 
276 276
 	/**
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @param string $action_slug The slug of the action.
283 283
 	 * @param string $action_type The type of action. Default is 'fire'.
284 284
 	 */
285
-	public function remove_event_from_action( $event_slug, $action_slug, $action_type = 'fire' ) {
286
-		unset( $this->event_index[ $action_slug ][ $action_type ][ $event_slug ] );
285
+	public function remove_event_from_action($event_slug, $action_slug, $action_type = 'fire') {
286
+		unset($this->event_index[$action_slug][$action_type][$event_slug]);
287 287
 	}
288 288
 }
289 289
 
Please login to merge, or discard this patch.
src/includes/constants.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
 
10 10
 global $wpdb;
11 11
 
12
-$wpdb->wordpoints_hook_periods = $wpdb->base_prefix . 'wordpoints_hook_periods';
12
+$wpdb->wordpoints_hook_periods = $wpdb->base_prefix.'wordpoints_hook_periods';
13 13
 
14 14
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/data/type.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	/**
27 27
 	 * @since 1.0.0
28 28
 	 */
29
-	public function __construct( $slug ) {
29
+	public function __construct($slug) {
30 30
 
31 31
 		$this->slug = $slug;
32 32
 	}
Please login to merge, or discard this patch.
src/includes/classes/entity/comment/author.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @since 1.0.0
34 34
 	 */
35 35
 	public function get_title() {
36
-		return __( 'Author', 'wordpoints' );
36
+		return __('Author', 'wordpoints');
37 37
 	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
src/includes/classes/hook/action/comment/new.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function should_fire() {
21 21
 
22
-		if ( ! isset( $this->args[1]->comment_approved ) ) {
22
+		if ( ! isset($this->args[1]->comment_approved)) {
23 23
 			return false;
24 24
 		}
25 25
 
26
-		if ( 1 !== (int) $this->args[1]->comment_approved ) {
26
+		if (1 !== (int) $this->args[1]->comment_approved) {
27 27
 			return false;
28 28
 		}
29 29
 
Please login to merge, or discard this patch.
src/admin/admin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@
 block discarded – undo
12 12
  *
13 13
  * @since 1.0.0
14 14
  */
15
-require_once( dirname( __FILE__ ) . '/includes/functions.php' );
15
+require_once(dirname(__FILE__).'/includes/functions.php');
16 16
 
17 17
 /**
18 18
  * The admin-side actions and filters.
19 19
  *
20 20
  * @since 1.0.0
21 21
  */
22
-require_once( dirname( __FILE__ ) . '/includes/actions.php' );
22
+require_once(dirname(__FILE__).'/includes/actions.php');
23 23
 
24 24
 WordPoints_Class_Autoloader::register_dir(
25
-	dirname( __FILE__ ) . '/includes/classes'
25
+	dirname(__FILE__).'/includes/classes'
26 26
 	, 'WordPoints_Admin_'
27 27
 );
28 28
 
Please login to merge, or discard this patch.
src/admin/includes/classes/ajax/hooks.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array The hook reaction data extracted into an array.
54 54
 	 */
55
-	public static function prepare_hook_reaction( $reaction ) {
55
+	public static function prepare_hook_reaction($reaction) {
56 56
 
57 57
 		$reactor = $reaction->get_reactor_slug();
58 58
 
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 
96 96
 		add_action(
97 97
 			'wp_ajax_wordpoints_admin_create_hook_reaction'
98
-			, array( $this, 'create_hook_reaction' )
98
+			, array($this, 'create_hook_reaction')
99 99
 		);
100 100
 
101 101
 		add_action(
102 102
 			'wp_ajax_wordpoints_admin_update_hook_reaction'
103
-			, array( $this, 'update_hook_reaction' )
103
+			, array($this, 'update_hook_reaction')
104 104
 		);
105 105
 
106 106
 		add_action(
107 107
 			'wp_ajax_wordpoints_admin_delete_hook_reaction'
108
-			, array( $this, 'delete_hook_reaction' )
108
+			, array($this, 'delete_hook_reaction')
109 109
 		);
110 110
 	}
111 111
 
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 			"wordpoints_create_hook_reaction|{$this->reactor_slug}"
125 125
 		);
126 126
 
127
-		$reaction = $reactor->reactions->create_reaction( $this->get_data() );
127
+		$reaction = $reactor->reactions->create_reaction($this->get_data());
128 128
 
129
-		$this->send_json_result( $reaction, 'create' );
129
+		$this->send_json_result($reaction, 'create');
130 130
 	}
131 131
 
132 132
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			, $this->get_data()
151 151
 		);
152 152
 
153
-		$this->send_json_result( $reaction, 'update' );
153
+		$this->send_json_result($reaction, 'update');
154 154
 	}
155 155
 
156 156
 	/**
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 			"wordpoints_delete_hook_reaction|{$this->reactor_slug}|{$reaction->ID}"
170 170
 		);
171 171
 
172
-		$result = $reactor->reactions->delete_reaction( $reaction->ID );
172
+		$result = $reactor->reactions->delete_reaction($reaction->ID);
173 173
 
174
-		if ( ! $result ) {
175
-			wp_send_json_error( array( 'message' => __( 'There was an error deleting the reaction. Please try again.', 'wordpoints' ) ) );
174
+		if ( ! $result) {
175
+			wp_send_json_error(array('message' => __('There was an error deleting the reaction. Please try again.', 'wordpoints')));
176 176
 		}
177 177
 
178 178
 		wp_send_json_success();
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param string $debug_context Context sent with the message (for debugging).
195 195
 	 */
196
-	private function unexpected_error( $debug_context ) {
196
+	private function unexpected_error($debug_context) {
197 197
 
198 198
 		wp_send_json_error(
199 199
 			array(
200
-				'message' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ),
200
+				'message' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'),
201 201
 				'debug'   => $debug_context,
202 202
 			)
203 203
 		);
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	private function verify_user_can() {
215 215
 
216
-		if ( ! current_user_can( 'manage_options' ) ) {
217
-			wp_send_json_error( array( 'message' => __( 'You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints' ) ) );
216
+		if ( ! current_user_can('manage_options')) {
217
+			wp_send_json_error(array('message' => __('You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints')));
218 218
 		}
219 219
 	}
220 220
 
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param string $action The action the nonce should be for.
229 229
 	 */
230
-	private function verify_request( $action ) {
230
+	private function verify_request($action) {
231 231
 
232 232
 		if (
233
-			empty( $_POST['nonce'] )
234
-			|| ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' )
233
+			empty($_POST['nonce'])
234
+			|| ! wordpoints_verify_nonce('nonce', $action, null, 'post')
235 235
 		) {
236 236
 			wp_send_json_error(
237
-				array( 'message' => __( 'Your security token for this action has expired. Refresh the page and try again.', 'wordpoints' ) )
237
+				array('message' => __('Your security token for this action has expired. Refresh the page and try again.', 'wordpoints'))
238 238
 			);
239 239
 		}
240 240
 	}
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	protected function get_reactor() {
250 250
 
251
-		if ( ! isset( $_POST['reactor'] ) ) { // WPCS: CSRF OK.
252
-			$this->unexpected_error( 'reactor' );
251
+		if ( ! isset($_POST['reactor'])) { // WPCS: CSRF OK.
252
+			$this->unexpected_error('reactor');
253 253
 		}
254 254
 
255
-		$reactor_slug = sanitize_key( $_POST['reactor'] ); // WPCS: CSRF OK.
255
+		$reactor_slug = sanitize_key($_POST['reactor']); // WPCS: CSRF OK.
256 256
 
257
-		$reactor = wordpoints_hooks()->reactors->get( $reactor_slug );
257
+		$reactor = wordpoints_hooks()->reactors->get($reactor_slug);
258 258
 
259
-		if ( ! $reactor instanceof WordPoints_Hook_Reactor ) {
260
-			$this->unexpected_error( 'reactor_invalid' );
259
+		if ( ! $reactor instanceof WordPoints_Hook_Reactor) {
260
+			$this->unexpected_error('reactor_invalid');
261 261
 		}
262 262
 
263 263
 		$this->reactor_slug = $reactor_slug;
@@ -275,16 +275,16 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	protected function get_reaction() {
277 277
 
278
-		if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK.
279
-			$this->unexpected_error( 'id' );
278
+		if ( ! isset($_POST['id'])) { // WPCS: CSRF OK.
279
+			$this->unexpected_error('id');
280 280
 		}
281 281
 
282 282
 		$reaction = $this->reactor->reactions->get_reaction(
283
-			wordpoints_int( $_POST['id'] ) // WPCS: CSRF OK.
283
+			wordpoints_int($_POST['id']) // WPCS: CSRF OK.
284 284
 		);
285 285
 
286
-		if ( ! $reaction ) {
287
-			wp_send_json_error( array( 'message' => __( 'The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) );
286
+		if ( ! $reaction) {
287
+			wp_send_json_error(array('message' => __('The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints')));
288 288
 		}
289 289
 
290 290
 		return $reaction;
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	protected function get_data() {
301 301
 
302
-		$data = wp_unslash( $_POST ); // WPCS: CSRF OK.
302
+		$data = wp_unslash($_POST); // WPCS: CSRF OK.
303 303
 
304
-		unset( $data['id'], $data['action'], $data['nonce'], $data['reactor'] );
304
+		unset($data['id'], $data['action'], $data['nonce'], $data['reactor']);
305 305
 
306 306
 		return $data;
307 307
 	}
@@ -314,30 +314,30 @@  discard block
 block discarded – undo
314 314
 	 * @param mixed  $result The result of the action.
315 315
 	 * @param string $action The action being performed: 'create' or 'update'.
316 316
 	 */
317
-	private function send_json_result( $result, $action ) {
317
+	private function send_json_result($result, $action) {
318 318
 
319
-		if ( ! $result ) {
319
+		if ( ! $result) {
320 320
 
321
-			if ( 'create' === $action ) {
322
-				$message = __( 'There was an error adding the reaction. Please try again.', 'wordpoints' );
321
+			if ('create' === $action) {
322
+				$message = __('There was an error adding the reaction. Please try again.', 'wordpoints');
323 323
 			} else {
324
-				$message = __( 'There was an error updating the reaction. Please try again.', 'wordpoints' );
324
+				$message = __('There was an error updating the reaction. Please try again.', 'wordpoints');
325 325
 			}
326 326
 
327
-			wp_send_json_error( array( 'message' => $message ) );
327
+			wp_send_json_error(array('message' => $message));
328 328
 
329
-		} elseif ( $result instanceof WordPoints_Hook_Reaction_Validator ) {
329
+		} elseif ($result instanceof WordPoints_Hook_Reaction_Validator) {
330 330
 
331
-			wp_send_json_error( array( 'errors' => $result->get_errors() ) );
331
+			wp_send_json_error(array('errors' => $result->get_errors()));
332 332
 		}
333 333
 
334 334
 		$data = null;
335 335
 
336
-		if ( 'create' === $action ) {
337
-			$data = self::prepare_hook_reaction( $result );
336
+		if ('create' === $action) {
337
+			$data = self::prepare_hook_reaction($result);
338 338
 		}
339 339
 
340
-		wp_send_json_success( $data );
340
+		wp_send_json_success($data);
341 341
 	}
342 342
 }
343 343
 
Please login to merge, or discard this patch.