Completed
Push — master ( b792a1...ed9362 )
by J.D.
03:30
created
src/includes/classes/hook/firer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) {
20
+	public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) {
21 21
 
22 22
 		$hooks = wordpoints_hooks();
23 23
 
24 24
 		/** @var WordPoints_Hook_Reactor $reactor */
25
-		foreach ( $hooks->reactors->get_all() as $reactor ) {
25
+		foreach ($hooks->reactors->get_all() as $reactor) {
26 26
 
27
-			foreach ( $reactor->get_all_reactions_to_event( $event_slug ) as $reaction ) {
27
+			foreach ($reactor->get_all_reactions_to_event($event_slug) as $reaction) {
28 28
 
29 29
 				$validator = new WordPoints_Hook_Reaction_Validator(
30 30
 					$reaction
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
 
35 35
 				$validator->validate();
36 36
 
37
-				if ( $validator->had_errors() ) {
37
+				if ($validator->had_errors()) {
38 38
 					continue;
39 39
 				}
40 40
 
41
-				$event_args->set_validator( $validator );
41
+				$event_args->set_validator($validator);
42 42
 				$reaction = $validator;
43 43
 
44 44
 				/** @var WordPoints_Hook_Extension[] $extensions */
45 45
 				$extensions = $hooks->extensions->get_all();
46 46
 
47
-				foreach ( $extensions as $extension ) {
48
-					if ( ! $extension->should_hit( $reaction, $event_args ) ) {
47
+				foreach ($extensions as $extension) {
48
+					if ( ! $extension->should_hit($reaction, $event_args)) {
49 49
 						continue 2;
50 50
 					}
51 51
 				}
52 52
 
53
-				$reactor->hit( $event_args, $reaction );
53
+				$reactor->hit($event_args, $reaction);
54 54
 
55
-				foreach ( $extensions as $extension ) {
56
-					$extension->after_hit( $reaction, $event_args );
55
+				foreach ($extensions as $extension) {
56
+					$extension->after_hit($reaction, $event_args);
57 57
 				}
58 58
 			}
59 59
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/extension/periods.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	public function get_ui_script_data() {
26 26
 
27 27
 		$periods = array(
28
-			MINUTE_IN_SECONDS   => __( 'Minute', 'wordpoints' ),
29
-			HOUR_IN_SECONDS     => __( 'Hour',   'wordpoints' ),
30
-			DAY_IN_SECONDS      => __( 'Day',    'wordpoints' ),
31
-			WEEK_IN_SECONDS     => __( 'Week',   'wordpoints' ),
32
-			30 * DAY_IN_SECONDS => __( 'Month',  'wordpoints' ),
28
+			MINUTE_IN_SECONDS   => __('Minute', 'wordpoints'),
29
+			HOUR_IN_SECONDS     => __('Hour', 'wordpoints'),
30
+			DAY_IN_SECONDS      => __('Day', 'wordpoints'),
31
+			WEEK_IN_SECONDS     => __('Week', 'wordpoints'),
32
+			30 * DAY_IN_SECONDS => __('Month', 'wordpoints'),
33 33
 		);
34 34
 
35 35
 		return array(
36 36
 			'periods' => $periods,
37 37
 			'l10n' => array(
38 38
 				// TODO this should be supplied per-reactor
39
-				'label' => __( 'Award each user no more than once per:', 'wordpoints' ),
39
+				'label' => __('Award each user no more than once per:', 'wordpoints'),
40 40
 			),
41 41
 		);
42 42
 	}
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return array The validated periods.
52 52
 	 */
53
-	protected function validate_periods( $periods ) {
53
+	protected function validate_periods($periods) {
54 54
 
55
-		if ( ! is_array( $periods ) ) {
55
+		if ( ! is_array($periods)) {
56 56
 
57 57
 			$this->validator->add_error(
58
-				__( 'Periods do not match expected format.', 'wordpoints' )
58
+				__('Periods do not match expected format.', 'wordpoints')
59 59
 			);
60 60
 
61 61
 			return array();
62 62
 		}
63 63
 
64
-		foreach ( $periods as $index => $period ) {
64
+		foreach ($periods as $index => $period) {
65 65
 
66
-			$this->validator->push_field( $index );
66
+			$this->validator->push_field($index);
67 67
 
68
-			$period = $this->validate_period( $period );
68
+			$period = $this->validate_period($period);
69 69
 
70
-			if ( $period ) {
71
-				$periods[ $index ] = $period;
70
+			if ($period) {
71
+				$periods[$index] = $period;
72 72
 			}
73 73
 
74 74
 			$this->validator->pop_field();
@@ -86,30 +86,30 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return array|false The validated period, or false if invalid.
88 88
 	 */
89
-	protected function validate_period( $period ) {
89
+	protected function validate_period($period) {
90 90
 
91
-		if ( ! is_array( $period ) ) {
91
+		if ( ! is_array($period)) {
92 92
 			$this->validator->add_error(
93
-				__( 'Period does not match expected format.', 'wordpoints' )
93
+				__('Period does not match expected format.', 'wordpoints')
94 94
 			);
95 95
 
96 96
 			return false;
97 97
 		}
98 98
 
99
-		if ( isset( $period['args'] ) ) {
100
-			$this->validate_period_args( $period['args'] );
99
+		if (isset($period['args'])) {
100
+			$this->validate_period_args($period['args']);
101 101
 		}
102 102
 
103
-		if ( ! isset( $period['length'] ) ) {
103
+		if ( ! isset($period['length'])) {
104 104
 
105 105
 			$this->validator->add_error(
106
-				__( 'Period length setting is missing.', 'wordpoints' )
106
+				__('Period length setting is missing.', 'wordpoints')
107 107
 			);
108 108
 
109
-		} elseif ( false === wordpoints_posint( $period['length'] ) ) {
109
+		} elseif (false === wordpoints_posint($period['length'])) {
110 110
 
111 111
 			$this->validator->add_error(
112
-				__( 'Period length must be a positive integer.', 'wordpoints' )
112
+				__('Period length must be a positive integer.', 'wordpoints')
113 113
 				, 'length'
114 114
 			);
115 115
 
@@ -126,34 +126,34 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param mixed $args The args the period is related to.
128 128
 	 */
129
-	protected function validate_period_args( $args ) {
129
+	protected function validate_period_args($args) {
130 130
 
131
-		if ( ! is_array( $args ) ) {
131
+		if ( ! is_array($args)) {
132 132
 
133 133
 			$this->validator->add_error(
134
-				__( 'Period does not match expected format.', 'wordpoints' )
134
+				__('Period does not match expected format.', 'wordpoints')
135 135
 				, 'args'
136 136
 			);
137 137
 
138 138
 			return;
139 139
 		}
140 140
 
141
-		$this->validator->push_field( 'args' );
141
+		$this->validator->push_field('args');
142 142
 
143
-		foreach ( $args as $index => $hierarchy ) {
143
+		foreach ($args as $index => $hierarchy) {
144 144
 
145
-			$this->validator->push_field( $index );
145
+			$this->validator->push_field($index);
146 146
 
147
-			if ( ! is_array( $hierarchy ) ) {
147
+			if ( ! is_array($hierarchy)) {
148 148
 
149 149
 				$this->validator->add_error(
150
-					__( 'Period does not match expected format.', 'wordpoints' )
150
+					__('Period does not match expected format.', 'wordpoints')
151 151
 				);
152 152
 
153
-			} elseif ( ! $this->event_args->get_from_hierarchy( $hierarchy ) ) {
153
+			} elseif ( ! $this->event_args->get_from_hierarchy($hierarchy)) {
154 154
 
155 155
 				$this->validator->add_error(
156
-					__( 'Invalid period.', 'wordpoints' ) // TODO better error message
156
+					__('Invalid period.', 'wordpoints') // TODO better error message
157 157
 				);
158 158
 			}
159 159
 
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
 		WordPoints_Hook_Event_Args $event_args
172 172
 	) {
173 173
 
174
-		$periods = $reaction->get_meta( 'periods' );
174
+		$periods = $reaction->get_meta('periods');
175 175
 
176
-		if ( empty( $periods ) ) {
176
+		if (empty($periods)) {
177 177
 			return true;
178 178
 		}
179 179
 
180 180
 		$this->event_args = $event_args;
181 181
 
182
-		foreach ( $periods as $period ) {
183
-			if ( ! $this->has_period_ended( $period, $reaction ) ) {
182
+		foreach ($periods as $period) {
183
+			if ( ! $this->has_period_ended($period, $reaction)) {
184 184
 				return false;
185 185
 			}
186 186
 		}
@@ -204,23 +204,23 @@  discard block
 block discarded – undo
204 204
 	) {
205 205
 
206 206
 		$period = $this->get_period_by_reaction(
207
-			$this->get_period_signature( $settings, $reaction )
207
+			$this->get_period_signature($settings, $reaction)
208 208
 			, $reaction
209 209
 		);
210 210
 
211 211
 		// If the period isn't found, we know that we can still fire.
212
-		if ( ! $period ) {
212
+		if ( ! $period) {
213 213
 			return true;
214 214
 		}
215 215
 
216
-		$now = current_time( 'timestamp' );
216
+		$now = current_time('timestamp');
217 217
 
218
-		if ( ! empty( $settings['relative'] ) ) {
219
-			return ( $period->hit_time < $now - $settings['length'] );
218
+		if ( ! empty($settings['relative'])) {
219
+			return ($period->hit_time < $now - $settings['length']);
220 220
 		} else {
221 221
 			return (
222
-				(int) ( $period->hit_time / $settings['length'] )
223
-				< (int) ( $now / $settings['length'] )
222
+				(int) ($period->hit_time / $settings['length'])
223
+				< (int) ($now / $settings['length'])
224 224
 			);
225 225
 		}
226 226
 	}
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @return array The arg values.
236 236
 	 */
237
-	protected function get_arg_values( array $period_args ) {
237
+	protected function get_arg_values(array $period_args) {
238 238
 
239 239
 		$values = array();
240 240
 
241
-		foreach ( $period_args as $arg_hierarchy ) {
241
+		foreach ($period_args as $arg_hierarchy) {
242 242
 
243 243
 			$arg = $this->event_args->get_from_hierarchy(
244 244
 				$arg_hierarchy
245 245
 			);
246 246
 
247
-			if ( ! $arg instanceof WordPoints_EntityishI ) {
247
+			if ( ! $arg instanceof WordPoints_EntityishI) {
248 248
 				continue;
249 249
 			}
250 250
 
251
-			$values[ implode( '.', $arg_hierarchy ) ] = $arg->get_the_value();
251
+			$values[implode('.', $arg_hierarchy)] = $arg->get_the_value();
252 252
 		}
253 253
 
254 254
 		return $values;
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return object|false The period data, or false if not found.
265 265
 	 */
266
-	protected function get_period( $period_id ) {
266
+	protected function get_period($period_id) {
267 267
 
268
-		$period = wp_cache_get( $period_id, 'wordpoints_hook_period' );
268
+		$period = wp_cache_get($period_id, 'wordpoints_hook_period');
269 269
 
270
-		if ( ! $period ) {
270
+		if ( ! $period) {
271 271
 
272 272
 			global $wpdb;
273 273
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 				)
283 283
 			);
284 284
 
285
-			if ( ! $period ) {
285
+			if ( ! $period) {
286 286
 				return false;
287 287
 			}
288 288
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 				, 'wordpoints_hook_period_ids'
293 293
 			);
294 294
 
295
-			wp_cache_set( $period->id, $period, 'wordpoints_hook_periods' );
295
+			wp_cache_set($period->id, $period, 'wordpoints_hook_periods');
296 296
 		}
297 297
 
298 298
 		return $period;
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 		$cache_key = "{$reaction_id}-{$signature}";
320 320
 
321 321
 		// Before we run the query, we try to lookup the ID in the cache.
322
-		$period_id = wp_cache_get( $cache_key, 'wordpoints_hook_period_ids' );
322
+		$period_id = wp_cache_get($cache_key, 'wordpoints_hook_period_ids');
323 323
 
324 324
 		// If we found it, we can retrieve the period by ID instead.
325
-		if ( $period_id ) {
326
-			return $this->get_period( $period_id );
325
+		if ($period_id) {
326
+			return $this->get_period($period_id);
327 327
 		}
328 328
 
329 329
 		global $wpdb;
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 			)
343 343
 		);
344 344
 
345
-		if ( ! $period ) {
345
+		if ( ! $period) {
346 346
 			return false;
347 347
 		}
348 348
 
349
-		wp_cache_set( $cache_key, $period->id, 'wordpoints_hook_period_ids' );
350
-		wp_cache_set( $period->id, $period, 'wordpoints_hook_periods' );
349
+		wp_cache_set($cache_key, $period->id, 'wordpoints_hook_period_ids');
350
+		wp_cache_set($period->id, $period, 'wordpoints_hook_periods');
351 351
 
352 352
 		return $period;
353 353
 	}
@@ -360,18 +360,18 @@  discard block
 block discarded – undo
360 360
 		WordPoints_Hook_Event_Args $event_args
361 361
 	) {
362 362
 
363
-		$periods = $reaction->get_meta( 'periods' );
363
+		$periods = $reaction->get_meta('periods');
364 364
 
365
-		if ( empty( $periods ) ) {
365
+		if (empty($periods)) {
366 366
 			return;
367 367
 		}
368 368
 
369 369
 		$this->event_args = $event_args;
370 370
 
371
-		foreach ( $periods as $settings ) {
371
+		foreach ($periods as $settings) {
372 372
 
373 373
 			$this->add_period(
374
-				$this->get_period_signature( $settings, $reaction )
374
+				$this->get_period_signature($settings, $reaction)
375 375
 				, $reaction
376 376
 			);
377 377
 		}
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
 		WordPoints_Hook_Reaction_Validator $reaction
397 397
 	) {
398 398
 
399
-		if ( isset( $settings['args'] ) ) {
399
+		if (isset($settings['args'])) {
400 400
 			$period_args = $settings['args'];
401 401
 		} else {
402
-			$period_args = array( $reaction->get_meta( 'target' ) );
402
+			$period_args = array($reaction->get_meta('target'));
403 403
 		}
404 404
 
405 405
 		return wordpoints_hash(
406
-			wp_json_encode( $this->get_arg_values( $period_args ) )
406
+			wp_json_encode($this->get_arg_values($period_args))
407 407
 		);
408 408
 	}
409 409
 
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
 			, array(
432 432
 				'reaction_id' => $reaction_id,
433 433
 				'signature'   => $signature,
434
-				'hit_time'    => current_time( 'timestamp' ),
434
+				'hit_time'    => current_time('timestamp'),
435 435
 			)
436
-			, array( '%d', '%s', '%d' )
436
+			, array('%d', '%s', '%d')
437 437
 		);
438 438
 
439
-		if ( ! $inserted ) {
439
+		if ( ! $inserted) {
440 440
 			return false;
441 441
 		}
442 442
 
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/includes/classes/hooks.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 	protected function init() {
47 47
 
48 48
 		$sub_apps = $this->sub_apps;
49
-		$sub_apps->register( 'router', 'WordPoints_Hook_Router' );
50
-		$sub_apps->register( 'actions', 'WordPoints_Hook_Actions' );
51
-		$sub_apps->register( 'events', 'WordPoints_Hook_Events' );
52
-		$sub_apps->register( 'firers', 'WordPoints_Class_Registry_Persistent' );
53
-		$sub_apps->register( 'reactors', 'WordPoints_Class_Registry_Persistent' );
54
-		$sub_apps->register( 'extensions', 'WordPoints_Class_Registry_Persistent' );
55
-		$sub_apps->register( 'conditions', 'WordPoints_Class_Registry_Children' );
49
+		$sub_apps->register('router', 'WordPoints_Hook_Router');
50
+		$sub_apps->register('actions', 'WordPoints_Hook_Actions');
51
+		$sub_apps->register('events', 'WordPoints_Hook_Events');
52
+		$sub_apps->register('firers', 'WordPoints_Class_Registry_Persistent');
53
+		$sub_apps->register('reactors', 'WordPoints_Class_Registry_Persistent');
54
+		$sub_apps->register('extensions', 'WordPoints_Class_Registry_Persistent');
55
+		$sub_apps->register('conditions', 'WordPoints_Class_Registry_Children');
56 56
 
57 57
 		parent::init();
58 58
 	}
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function get_network_mode() {
68 68
 
69
-		if ( ! isset( $this->network_mode ) ) {
69
+		if ( ! isset($this->network_mode)) {
70 70
 			$this->network_mode = is_network_admin();
71 71
 
72 72
 			// See https://core.trac.wordpress.org/ticket/22589
73 73
 			if (
74
-				defined( 'DOING_AJAX' )
74
+				defined('DOING_AJAX')
75 75
 				&& DOING_AJAX
76 76
 				&& is_multisite()
77
-				&& isset( $_SERVER['HTTP_REFERER'] )
77
+				&& isset($_SERVER['HTTP_REFERER'])
78 78
 				&& preg_match(
79
-					'#^' . preg_quote( network_admin_url(), '#' ) . '#i'
80
-					, esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) )
79
+					'#^'.preg_quote(network_admin_url(), '#').'#i'
80
+					, esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER']))
81 81
 				)
82 82
 			) {
83 83
 				$this->network_mode = true;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @param bool $on Whether network-wide mode should be on (or off).
123 123
 	 */
124
-	public function _set_network_mode( $on = true ) {
124
+	public function _set_network_mode($on = true) {
125 125
 		$this->network_mode = (bool) $on;
126 126
 	}
127 127
 }
Please login to merge, or discard this patch.