Completed
Push — master ( b6760c...d0c54a )
by J.D.
03:04
created
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/actions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 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' );
13
-add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' );
12
+add_action('admin_menu', 'wordpoints_hooks_api_admin_menu');
13
+add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu');
14 14
 
15
-add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' );
16
-add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' );
15
+add_action('admin_init', 'wordpoints_hooks_admin_register_scripts');
16
+add_action('admin_init', 'wordpoints_hooks_admin_ajax');
17 17
 
18
-add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 );
18
+add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2);
19 19
 
20 20
 // EOF
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.
src/includes/classes/hook/arg/current/site.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	 * @since 1.0.0
36 36
 	 */
37 37
 	public function get_title() {
38
-		return __( 'Site', 'wordpoints' );
38
+		return __('Site', 'wordpoints');
39 39
 	}
40 40
 }
41 41
 
Please login to merge, or discard this patch.
src/includes/classes/hook/condition/entity/array/contains.php 1 patch
Spacing   +34 added lines, -34 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
 	public function get_title() {
59
-		return __( 'Contains', 'wordpoints' );
59
+		return __('Contains', 'wordpoints');
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 		return array(
67 67
 			'min' => array(
68 68
 				'slug'    => 'min',
69
-				'label'   => __( 'Minimum number of items', 'wordpoints' ),
69
+				'label'   => __('Minimum number of items', 'wordpoints'),
70 70
 				'type'    => 'number',
71 71
 				'default' => 1,
72 72
 			),
73 73
 			'max' => array(
74 74
 				'slug'  => 'max',
75
-				'label' => __( 'Maximum number of items', 'wordpoints' ),
75
+				'label' => __('Maximum number of items', 'wordpoints'),
76 76
 				'type'  => 'number',
77 77
 			),
78 78
 		);
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 
93 93
 		$this->validate_count();
94 94
 
95
-		if ( isset( $settings['conditions'] ) ) {
96
-			$this->validate_conditions( $arg );
95
+		if (isset($settings['conditions'])) {
96
+			$this->validate_conditions($arg);
97 97
 		}
98 98
 
99 99
 		return $this->settings;
@@ -107,31 +107,31 @@  discard block
 block discarded – undo
107 107
 	protected function validate_count() {
108 108
 
109 109
 		if (
110
-			! empty( $this->settings['max'] )
111
-			&& ! wordpoints_posint( $this->settings['max'] )
110
+			! empty($this->settings['max'])
111
+			&& ! wordpoints_posint($this->settings['max'])
112 112
 		) {
113 113
 			$this->validator->add_error(
114
-				__( 'The maximum must be a positive integer.', 'wordpoints' )
114
+				__('The maximum must be a positive integer.', 'wordpoints')
115 115
 				, 'max'
116 116
 			);
117 117
 		}
118 118
 
119
-		if ( ! empty( $this->settings['min'] ) ) {
119
+		if ( ! empty($this->settings['min'])) {
120 120
 
121
-			if ( ! wordpoints_posint( $this->settings['min'] ) ) {
121
+			if ( ! wordpoints_posint($this->settings['min'])) {
122 122
 
123 123
 				$this->validator->add_error(
124
-					__( 'The minimum must be a positive integer.', 'wordpoints' )
124
+					__('The minimum must be a positive integer.', 'wordpoints')
125 125
 					, 'min'
126 126
 				);
127 127
 
128 128
 			} elseif (
129
-				! empty( $this->settings['max'] )
129
+				! empty($this->settings['max'])
130 130
 				&& $this->settings['max'] < $this->settings['min']
131 131
 			) {
132 132
 
133 133
 				$this->validator->add_error(
134
-					__( 'The minimum must be less than the maximum.', 'wordpoints' )
134
+					__('The minimum must be less than the maximum.', 'wordpoints')
135 135
 					, 'min'
136 136
 				);
137 137
 			}
@@ -145,25 +145,25 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @param WordPoints_EntityishI $current_arg The current arg.
147 147
 	 */
148
-	protected function validate_conditions( $current_arg ) {
148
+	protected function validate_conditions($current_arg) {
149 149
 
150
-		$args = new WordPoints_Hook_Event_Args( array() );
150
+		$args = new WordPoints_Hook_Event_Args(array());
151 151
 
152
-		if ( $current_arg instanceof WordPoints_Entity_Array ) {
152
+		if ($current_arg instanceof WordPoints_Entity_Array) {
153 153
 
154 154
 			$entity = wordpoints_entities()->get(
155 155
 				$current_arg->get_entity_slug()
156 156
 			);
157 157
 
158
-			if ( $entity instanceof WordPoints_Entity ) {
159
-				$args->add_entity( $entity );
158
+			if ($entity instanceof WordPoints_Entity) {
159
+				$args->add_entity($entity);
160 160
 			}
161 161
 		}
162 162
 
163
-		$args->set_validator( $this->validator );
163
+		$args->set_validator($this->validator);
164 164
 
165 165
 		$conditions = $this->conditions_extension->validate_settings(
166
-			array( 'conditions' => $this->settings['conditions'] )
166
+			array('conditions' => $this->settings['conditions'])
167 167
 			, $this->validator
168 168
 			, $args
169 169
 		);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	/**
175 175
 	 * @since 1.0.0
176 176
 	 */
177
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) {
177
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args) {
178 178
 
179 179
 		$this->settings = $settings;
180 180
 
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$entities = array();
184 184
 
185
-		if ( $arg instanceof WordPoints_Entity_Array ) {
185
+		if ($arg instanceof WordPoints_Entity_Array) {
186 186
 
187 187
 			$entities = $arg->get_the_entities();
188 188
 
189
-			if ( isset( $this->settings['conditions'] ) ) {
190
-				$entities = $this->filter_entities( $entities );
189
+			if (isset($this->settings['conditions'])) {
190
+				$entities = $this->filter_entities($entities);
191 191
 			}
192 192
 		}
193 193
 
194
-		return $this->check_count( count( $entities ) );
194
+		return $this->check_count(count($entities));
195 195
 	}
196 196
 
197 197
 	/**
@@ -203,20 +203,20 @@  discard block
 block discarded – undo
203 203
 	 *
204 204
 	 * @return WordPoints_Entity[] The entities that matched the sub-conditions.
205 205
 	 */
206
-	protected function filter_entities( $entities ) {
206
+	protected function filter_entities($entities) {
207 207
 
208
-		foreach ( $entities as $index => $entity ) {
208
+		foreach ($entities as $index => $entity) {
209 209
 
210
-			$event_args = new WordPoints_Hook_Event_Args( array() );
211
-			$event_args->add_entity( $entity );
210
+			$event_args = new WordPoints_Hook_Event_Args(array());
211
+			$event_args->add_entity($entity);
212 212
 
213 213
 			$matches = $this->conditions_extension->conditions_are_met(
214 214
 				$this->settings['conditions']
215 215
 				, $event_args
216 216
 			);
217 217
 
218
-			if ( ! $matches ) {
219
-				unset( $entities[ $index ] );
218
+			if ( ! $matches) {
219
+				unset($entities[$index]);
220 220
 			}
221 221
 		}
222 222
 
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @return bool Whether the count met the requirements.
234 234
 	 */
235
-	protected function check_count( $count ) {
235
+	protected function check_count($count) {
236 236
 
237
-		if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) {
237
+		if (isset($this->settings['max']) && $count > $this->settings['max']) {
238 238
 			return false;
239 239
 		}
240 240
 
241
-		if ( isset( $this->settings['min'] ) && $count < $this->settings['min'] ) {
241
+		if (isset($this->settings['min']) && $count < $this->settings['min']) {
242 242
 			return false;
243 243
 		}
244 244
 
Please login to merge, or discard this patch.