Completed
Push — master ( 975fd1...3e68e7 )
by J.D.
03:16
created
src/includes/classes/hook/extension/reversals/legacy/points.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * @since 1.0.0
25 25
 	 */
26
-	public function should_hit( WordPoints_Hook_Fire $fire ) {
26
+	public function should_hit(WordPoints_Hook_Fire $fire) {
27 27
 
28
-		if ( ! parent::should_hit( $fire ) ) {
28
+		if ( ! parent::should_hit($fire)) {
29 29
 
30
-			$logs = $this->get_points_logs_to_be_reversed( $fire );
30
+			$logs = $this->get_points_logs_to_be_reversed($fire);
31 31
 
32
-			return count( $logs ) > 0;
32
+			return count($logs) > 0;
33 33
 		}
34 34
 
35 35
 		return true;
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	/**
39 39
 	 * @since 1.0.0
40 40
 	 */
41
-	public function after_miss( WordPoints_Hook_Fire $fire ) {
41
+	public function after_miss(WordPoints_Hook_Fire $fire) {
42 42
 
43
-		parent::after_miss( $fire );
43
+		parent::after_miss($fire);
44 44
 
45
-		if ( ! $this->get_settings_from_fire( $fire ) ) {
45
+		if ( ! $this->get_settings_from_fire($fire)) {
46 46
 			return;
47 47
 		}
48 48
 
49
-		foreach ( $this->get_points_logs_to_be_reversed( $fire ) as $log ) {
50
-			wordpoints_add_points_log_meta( $log->id, 'auto_reversed', 0 );
49
+		foreach ($this->get_points_logs_to_be_reversed($fire) as $log) {
50
+			wordpoints_add_points_log_meta($log->id, 'auto_reversed', 0);
51 51
 		}
52 52
 	}
53 53
 
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return array The points logs to be reversed.
62 62
 	 */
63
-	protected function get_points_logs_to_be_reversed( WordPoints_Hook_Fire $fire ) {
63
+	protected function get_points_logs_to_be_reversed(WordPoints_Hook_Fire $fire) {
64 64
 
65
-		if ( isset( $fire->data[ $this->slug ]['points_logs'] ) ) {
66
-			return $fire->data[ $this->slug ]['points_logs'];
65
+		if (isset($fire->data[$this->slug]['points_logs'])) {
66
+			return $fire->data[$this->slug]['points_logs'];
67 67
 		}
68 68
 
69 69
 		$entity = $fire->event_args->get_primary_arg();
70 70
 
71
-		if ( ! $entity ) {
72
-			$fire->data[ $this->slug ]['points_logs'] = array();
71
+		if ( ! $entity) {
72
+			$fire->data[$this->slug]['points_logs'] = array();
73 73
 			return array();
74 74
 		}
75 75
 
76 76
 		$slug = $entity->get_slug();
77 77
 
78
-		if ( ( $pos = strpos( $slug, '\\' ) ) ) {
79
-			$slug = substr( $slug, 0, $pos );
78
+		if (($pos = strpos($slug, '\\'))) {
79
+			$slug = substr($slug, 0, $pos);
80 80
 		}
81 81
 
82 82
 		$meta_queries = array(
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 			)
93 93
 		);
94 94
 
95
-		$log_type = $fire->reaction->get_meta( 'legacy_log_type' );
95
+		$log_type = $fire->reaction->get_meta('legacy_log_type');
96 96
 
97
-		if ( ! $log_type ) {
97
+		if ( ! $log_type) {
98 98
 			$log_type = $fire->reaction->get_event_slug();
99 99
 		}
100 100
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 
108 108
 		$logs = $query->get();
109 109
 
110
-		if ( ! $logs ) {
110
+		if ( ! $logs) {
111 111
 			$logs = array();
112 112
 		}
113 113
 
114
-		$fire->data[ $this->slug ]['points_logs'] = $logs;
114
+		$fire->data[$this->slug]['points_logs'] = $logs;
115 115
 
116 116
 		return $logs;
117 117
 	}
Please login to merge, or discard this patch.
src/admin/includes/functions.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 		, 'WordPointsPointsTypesL10n'
107 107
 		, array(
108 108
 			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' )
109
-			                   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
109
+							   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
110 110
 			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
111 111
 			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
112 112
 			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @param WordPoints_App $app The main WordPoints app.
18 18
  */
19
-function wordpoints_hooks_register_admin_apps( $app ) {
19
+function wordpoints_hooks_register_admin_apps($app) {
20 20
 
21 21
 	$apps = $app->sub_apps();
22 22
 
23
-	$apps->register( 'admin', 'WordPoints_App' );
23
+	$apps->register('admin', 'WordPoints_App');
24 24
 
25 25
 	/** @var WordPoints_App $admin */
26
-	$admin = $apps->get( 'admin' );
26
+	$admin = $apps->get('admin');
27 27
 
28
-	$admin->sub_apps()->register( 'screen', 'WordPoints_Admin_Screens' );
28
+	$admin->sub_apps()->register('screen', 'WordPoints_Admin_Screens');
29 29
 }
30 30
 
31 31
 /**
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 	$wordpoints_menu = wordpoints_get_main_admin_menu();
42 42
 
43 43
 	/** @var WordPoints_Admin_Screens $admin_screens */
44
-	$admin_screens = wordpoints_apps()->get_sub_app( 'admin' )->get_sub_app(
44
+	$admin_screens = wordpoints_apps()->get_sub_app('admin')->get_sub_app(
45 45
 		'screen'
46 46
 	);
47 47
 
48 48
 	// Hooks page.
49 49
 	$id = add_submenu_page(
50 50
 		$wordpoints_menu
51
-		, __( 'WordPoints — Points Types', 'wordpoints' )
52
-		, __( 'Points Types', 'wordpoints' )
51
+		, __('WordPoints — Points Types', 'wordpoints')
52
+		, __('Points Types', 'wordpoints')
53 53
 		, 'manage_options'
54 54
 		, 'wordpoints_points_types'
55
-		, array( $admin_screens, 'display' )
55
+		, array($admin_screens, 'display')
56 56
 	);
57 57
 
58
-	if ( $id ) {
59
-		$admin_screens->register( $id, 'WordPoints_Admin_Screen_Points_Types' );
58
+	if ($id) {
59
+		$admin_screens->register($id, 'WordPoints_Admin_Screen_Points_Types');
60 60
 	}
61 61
 }
62 62
 
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
  */
70 70
 function wordpoints_hooks_admin_register_scripts() {
71 71
 
72
-	$assets_url = wordpoints_modules_url( '/assets', dirname( __FILE__ ) );
72
+	$assets_url = wordpoints_modules_url('/assets', dirname(__FILE__));
73 73
 
74 74
 	// CSS
75 75
 
76 76
 	wp_register_style(
77 77
 		'wordpoints-hooks-admin'
78
-		, $assets_url . '/css/hooks.css'
79
-		, array( 'dashicons', 'wp-jquery-ui-dialog' )
78
+		, $assets_url.'/css/hooks.css'
79
+		, array('dashicons', 'wp-jquery-ui-dialog')
80 80
 		, WORDPOINTS_VERSION
81 81
 	);
82 82
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 
85 85
 	wp_register_script(
86 86
 		'wordpoints-admin-points-types'
87
-		, $assets_url . '/js/points-types.js'
88
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
87
+		, $assets_url.'/js/points-types.js'
88
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
89 89
 		, WORDPOINTS_VERSION
90 90
 	);
91 91
 
92 92
 	wp_register_script(
93 93
 		'wordpoints-hooks-models'
94
-		, $assets_url . '/js/hooks/models.js'
95
-		, array( 'backbone', 'jquery-ui-dialog', 'wp-util' )
94
+		, $assets_url.'/js/hooks/models.js'
95
+		, array('backbone', 'jquery-ui-dialog', 'wp-util')
96 96
 		, WORDPOINTS_VERSION
97 97
 	);
98 98
 
99 99
 	wp_register_script(
100 100
 		'wordpoints-hooks-views'
101
-		, $assets_url . '/js/hooks/views.js'
102
-		, array( 'wordpoints-hooks-models' )
101
+		, $assets_url.'/js/hooks/views.js'
102
+		, array('wordpoints-hooks-models')
103 103
 		, WORDPOINTS_VERSION
104 104
 	);
105 105
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 		'wordpoints-admin-points-types'
108 108
 		, 'WordPointsPointsTypesL10n'
109 109
 		, array(
110
-			'confirmDelete' => esc_html__( 'Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints' )
111
-			                   . ' ' . esc_html__( 'Once a points type has been deleted, you cannot bring it back.', 'wordpoints' ),
112
-			'confirmTitle'  => esc_html__( 'Are you sure?', 'wordpoints' ),
113
-			'deleteText'    => esc_html__( 'Delete', 'wordpoints' ),
114
-			'cancelText'    => esc_html__( 'Cancel', 'wordpoints' ),
110
+			'confirmDelete' => esc_html__('Are you sure that you want to delete this points type? This will delete all related logs and event hooks.', 'wordpoints')
111
+			                   . ' '.esc_html__('Once a points type has been deleted, you cannot bring it back.', 'wordpoints'),
112
+			'confirmTitle'  => esc_html__('Are you sure?', 'wordpoints'),
113
+			'deleteText'    => esc_html__('Delete', 'wordpoints'),
114
+			'cancelText'    => esc_html__('Cancel', 'wordpoints'),
115 115
 		)
116 116
 	);
117 117
 
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 		'wordpoints-hooks-views'
120 120
 		, 'WordPointsHooksAdminL10n'
121 121
 		, array(
122
-			'unexpectedError' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ),
123
-			'changesSaved'    => __( 'Your changes have been saved.', 'wordpoints' ),
122
+			'unexpectedError' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'),
123
+			'changesSaved'    => __('Your changes have been saved.', 'wordpoints'),
124 124
 			/* translators: the name of the field that cannot be empty */
125
-			'emptyField'      => sprintf( __( '%s cannot be empty.', 'wordpoints' ), '{{ data.label }}' ),
126
-			'confirmDelete'   => __( 'Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints' ),
127
-			'confirmTitle'    => __( 'Are you sure?', 'wordpoints' ),
128
-			'deleteText'      => __( 'Delete', 'wordpoints' ),
129
-			'cancelText'      => __( 'Cancel', 'wordpoints' ),
130
-			'separator'       => __( ' » ', 'wordpoints' ),
131
-			'target_label'    => __( 'Target', 'wordpoints' ),
125
+			'emptyField'      => sprintf(__('%s cannot be empty.', 'wordpoints'), '{{ data.label }}'),
126
+			'confirmDelete'   => __('Are you sure that you want to delete this reaction? This action cannot be undone.', 'wordpoints'),
127
+			'confirmTitle'    => __('Are you sure?', 'wordpoints'),
128
+			'deleteText'      => __('Delete', 'wordpoints'),
129
+			'cancelText'      => __('Cancel', 'wordpoints'),
130
+			'separator'       => __(' » ', 'wordpoints'),
131
+			'target_label'    => __('Target', 'wordpoints'),
132 132
 			// translators: form field
133
-			'cannotBeChanged' => __( '(cannot be changed)', 'wordpoints' ),
134
-			'fieldsInvalid'   => __( 'Error: the values of some fields are invalid. Please correct these and then try again.', 'wordpoints' ),
133
+			'cannotBeChanged' => __('(cannot be changed)', 'wordpoints'),
134
+			'fieldsInvalid'   => __('Error: the values of some fields are invalid. Please correct these and then try again.', 'wordpoints'),
135 135
 		)
136 136
 	);
137 137
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 			<div class="view">
144 144
 				<div class="title"></div>
145 145
 				<button type="button" class="edit button-secondary">
146
-					' . esc_html__( 'Edit', 'wordpoints' ) . '
146
+					' . esc_html__('Edit', 'wordpoints').'
147 147
 				</button>
148 148
 				<button type="button" class="close button-secondary">
149
-					' . esc_html__( 'Close', 'wordpoints' ) . '
149
+					' . esc_html__('Close', 'wordpoints').'
150 150
 				</button>
151 151
 			</div>
152 152
 			<div class="form">
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 						</div>
166 166
 						<div class="action-buttons">
167 167
 							<button type="button" class="save button-primary" disabled>
168
-								' . esc_html__( 'Save', 'wordpoints' ) . '
168
+								' . esc_html__('Save', 'wordpoints').'
169 169
 							</button>
170 170
 							<button type="button" class="cancel button-secondary">
171
-								' . esc_html__( 'Cancel', 'wordpoints' ) . '
171
+								' . esc_html__('Cancel', 'wordpoints').'
172 172
 							</button>
173 173
 							<button type="button" class="close button-secondary">
174
-								' . esc_html__( 'Close', 'wordpoints' ) . '
174
+								' . esc_html__('Close', 'wordpoints').'
175 175
 							</button>
176 176
 							<button type="button" class="delete button-secondary">
177
-								' . esc_html__( 'Delete', 'wordpoints' ) . '
177
+								' . esc_html__('Delete', 'wordpoints').'
178 178
 							</button>
179 179
 						</div>
180 180
 					</div>
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 
223 223
 	wp_register_script(
224 224
 		'wordpoints-hooks-reactor-points'
225
-		, $assets_url . '/js/hooks/reactors/points.js'
226
-		, array( 'wordpoints-hooks-views' )
225
+		, $assets_url.'/js/hooks/reactors/points.js'
226
+		, array('wordpoints-hooks-views')
227 227
 		, WORDPOINTS_VERSION
228 228
 	);
229 229
 
230 230
 	wp_register_script(
231 231
 		'wordpoints-hooks-extension-conditions'
232
-		, $assets_url . '/js/hooks/extensions/conditions.js'
233
-		, array( 'wordpoints-hooks-views' )
232
+		, $assets_url.'/js/hooks/extensions/conditions.js'
233
+		, array('wordpoints-hooks-views')
234 234
 		, WORDPOINTS_VERSION
235 235
 	);
236 236
 
@@ -240,25 +240,25 @@  discard block
 block discarded – undo
240 240
 		, '
241 241
 			<script type="text/template" id="tmpl-wordpoints-hook-condition-groups">
242 242
 				<div class="conditions-title section-title">
243
-					<h4>' . esc_html__( 'Conditions', 'wordpoints' ) . '</h4>
243
+					<h4>' . esc_html__('Conditions', 'wordpoints').'</h4>
244 244
 					<button type="button" class="add-new button-secondary button-link">
245
-						<span class="screen-reader-text">' . esc_html__( 'Add New Condition', 'wordpoints' ) . '</span>
245
+						<span class="screen-reader-text">' . esc_html__('Add New Condition', 'wordpoints').'</span>
246 246
 						<span class="dashicons dashicons-plus"></span>
247 247
 					</button>
248 248
 				</div>
249 249
 				<div class="add-condition-form hidden">
250 250
 					<div class="no-conditions hidden">
251
-						' . esc_html__( 'No conditions available.', 'wordpoints' ) . '
251
+						' . esc_html__('No conditions available.', 'wordpoints').'
252 252
 					</div>
253 253
 					<div class="condition-selectors">
254 254
 						<div class="arg-selectors"></div>
255 255
 						<div class="condition-selector"></div>
256 256
 					</div>
257
-					<button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__( 'Add Condition', 'wordpoints' ) . '">
258
-						' . esc_html_x( 'Add', 'reaction condition', 'wordpoints' ) . '
257
+					<button type="button" class="confirm-add-new button-secondary" disabled aria-label="' . esc_attr__('Add Condition', 'wordpoints').'">
258
+						' . esc_html_x('Add', 'reaction condition', 'wordpoints').'
259 259
 					</button>
260
-					<button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__( 'Cancel Adding New Condition', 'wordpoints' ) . '">
261
-						' . esc_html_x( 'Cancel', 'reaction condition', 'wordpoints' ) . '
260
+					<button type="button" class="cancel-add-new button-secondary" aria-label="' . esc_attr__('Cancel Adding New Condition', 'wordpoints').'">
261
+						' . esc_html_x('Cancel', 'reaction condition', 'wordpoints').'
262 262
 					</button>
263 263
 				</div>
264 264
 				<div class="condition-groups section-content"></div>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 				<div class="condition-controls">
273 273
 					<div class="condition-title"></div>
274 274
 					<button type="button" class="delete button-secondary button-link">
275
-						<span class="screen-reader-text">' . esc_html__( 'Remove Condition', 'wordpoints' ) . '</span>
275
+						<span class="screen-reader-text">' . esc_html__('Remove Condition', 'wordpoints').'</span>
276 276
 						<span class="dashicons dashicons-no"></span>
277 277
 					</button>
278 278
 				</div>
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
 
291 291
 	wp_register_script(
292 292
 		'wordpoints-hooks-extension-periods'
293
-		, $assets_url . '/js/hooks/extensions/periods.js'
294
-		, array( 'wordpoints-hooks-views' )
293
+		, $assets_url.'/js/hooks/extensions/periods.js'
294
+		, array('wordpoints-hooks-views')
295 295
 		, WORDPOINTS_VERSION
296 296
 	);
297 297
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		, '
302 302
 			<script type="text/template" id="tmpl-wordpoints-hook-periods">
303 303
 				<div class="periods-title section-title">
304
-					<h4>' . esc_html__( 'Rate Limit', 'wordpoints' ) . '</h4>
304
+					<h4>' . esc_html__('Rate Limit', 'wordpoints').'</h4>
305 305
 				</div>
306 306
 				<div class="periods section-content"></div>
307 307
 			</script>
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
 	$hooks = wordpoints_hooks();
320 320
 
321 321
 	$extensions_data = wordpoints_hooks_ui_get_script_data_from_objects(
322
-		$hooks->get_sub_app( 'extensions' )->get_all()
322
+		$hooks->get_sub_app('extensions')->get_all()
323 323
 		, 'extension'
324 324
 	);
325 325
 
326 326
 	$reactor_data = wordpoints_hooks_ui_get_script_data_from_objects(
327
-		$hooks->get_sub_app( 'reactors' )->get_all()
327
+		$hooks->get_sub_app('reactors')->get_all()
328 328
 		, 'reactor'
329 329
 	);
330 330
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @param array $data The data.
352 352
 	 */
353
-	$data = apply_filters( 'wordpoints_hooks_ui_data', $data );
353
+	$data = apply_filters('wordpoints_hooks_ui_data', $data);
354 354
 
355 355
 	wp_localize_script(
356 356
 		'wordpoints-hooks-models'
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
  *
371 371
  * @return array The data extracted from the objects.
372 372
  */
373
-function wordpoints_hooks_ui_get_script_data_from_objects( $objects, $type ) {
373
+function wordpoints_hooks_ui_get_script_data_from_objects($objects, $type) {
374 374
 
375 375
 	$data = array();
376 376
 
377
-	foreach ( $objects as $slug => $object ) {
377
+	foreach ($objects as $slug => $object) {
378 378
 
379
-		if ( $object instanceof WordPoints_Hook_UI_Script_Data_ProviderI ) {
380
-			$data[ $slug ] = $object->get_ui_script_data();
379
+		if ($object instanceof WordPoints_Hook_UI_Script_Data_ProviderI) {
380
+			$data[$slug] = $object->get_ui_script_data();
381 381
 		}
382 382
 
383
-		if ( wp_script_is( "wordpoints-hooks-{$type}-{$slug}", 'registered' ) ) {
384
-			wp_enqueue_script( "wordpoints-hooks-{$type}-{$slug}" );
383
+		if (wp_script_is("wordpoints-hooks-{$type}-{$slug}", 'registered')) {
384
+			wp_enqueue_script("wordpoints-hooks-{$type}-{$slug}");
385 385
 		}
386 386
 	}
387 387
 
@@ -402,31 +402,31 @@  discard block
 block discarded – undo
402 402
 	$entities_data = array();
403 403
 
404 404
 	/** @var WordPoints_Class_Registry_Children $entity_children */
405
-	$entity_children = $entities->get_sub_app( 'children' );
405
+	$entity_children = $entities->get_sub_app('children');
406 406
 
407 407
 	/** @var WordPoints_Entity $entity */
408
-	foreach ( $entities->get_all() as $slug => $entity ) {
408
+	foreach ($entities->get_all() as $slug => $entity) {
409 409
 
410 410
 		$child_data = array();
411 411
 
412 412
 		/** @var WordPoints_EntityishI $child */
413
-		foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) {
413
+		foreach ($entity_children->get_children($slug) as $child_slug => $child) {
414 414
 
415
-			$child_data[ $child_slug ] = array(
415
+			$child_data[$child_slug] = array(
416 416
 				'slug'  => $child_slug,
417 417
 				'title' => $child->get_title(),
418 418
 			);
419 419
 
420
-			if ( $child instanceof WordPoints_Entity_Attr ) {
420
+			if ($child instanceof WordPoints_Entity_Attr) {
421 421
 
422
-				$child_data[ $child_slug ]['_type']     = 'attr';
423
-				$child_data[ $child_slug ]['data_type'] = $child->get_data_type();
422
+				$child_data[$child_slug]['_type']     = 'attr';
423
+				$child_data[$child_slug]['data_type'] = $child->get_data_type();
424 424
 
425
-			} elseif ( $child instanceof WordPoints_Entity_Relationship ) {
425
+			} elseif ($child instanceof WordPoints_Entity_Relationship) {
426 426
 
427
-				$child_data[ $child_slug ]['_type']     = 'relationship';
428
-				$child_data[ $child_slug ]['primary']   = $child->get_primary_entity_slug();
429
-				$child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug();
427
+				$child_data[$child_slug]['_type']     = 'relationship';
428
+				$child_data[$child_slug]['primary']   = $child->get_primary_entity_slug();
429
+				$child_data[$child_slug]['secondary'] = $child->get_related_entity_slug();
430 430
 			}
431 431
 
432 432
 			/**
@@ -437,14 +437,14 @@  discard block
 block discarded – undo
437 437
 			 * @param array                $data  The data for the entity child.
438 438
 			 * @param WordPoints_Entityish $child The child's object.
439 439
 			 */
440
-			$child_data[ $child_slug ] = apply_filters(
440
+			$child_data[$child_slug] = apply_filters(
441 441
 				'wordpoints_hooks_ui_data_entity_child'
442
-				, $child_data[ $child_slug ]
442
+				, $child_data[$child_slug]
443 443
 				, $child
444 444
 			);
445 445
 		}
446 446
 
447
-		$entities_data[ $slug ] = array(
447
+		$entities_data[$slug] = array(
448 448
 			'slug'     => $slug,
449 449
 			'title'    => $entity->get_title(),
450 450
 			'children' => $child_data,
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
 			'_type'    => 'entity',
453 453
 		);
454 454
 
455
-		if ( $entity instanceof WordPoints_Entity_EnumerableI ) {
455
+		if ($entity instanceof WordPoints_Entity_EnumerableI) {
456 456
 
457 457
 			$values = array();
458 458
 
459
-			foreach ( $entity->get_enumerated_values() as $value ) {
460
-				if ( $entity->set_the_value( $value ) ) {
459
+			foreach ($entity->get_enumerated_values() as $value) {
460
+				if ($entity->set_the_value($value)) {
461 461
 					$values[] = array(
462 462
 						'value' => $entity->get_the_id(),
463 463
 						'label' => $entity->get_the_human_id(),
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 				}
466 466
 			}
467 467
 
468
-			$entities_data[ $slug ]['values'] = $values;
468
+			$entities_data[$slug]['values'] = $values;
469 469
 		}
470 470
 
471 471
 		/**
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 		 * @param array             $data   The data for the entity.
475 475
 		 * @param WordPoints_Entity $entity The entity object.
476 476
 		 */
477
-		$entities_data[ $slug ] = apply_filters(
477
+		$entities_data[$slug] = apply_filters(
478 478
 			'wordpoints_hooks_ui_data_entity'
479
-			, $entities_data[ $slug ]
479
+			, $entities_data[$slug]
480 480
 			, $entity
481 481
 		);
482 482
 	}
@@ -496,19 +496,19 @@  discard block
 block discarded – undo
496 496
 	// We want a list of the action types for each event. We can start with this list
497 497
 	// but it is indexed by action slug and then action type and then event slug, so
498 498
 	// we ned to do some processing.
499
-	$event_index = wordpoints_hooks()->get_sub_app( 'router' )->get_event_index();
499
+	$event_index = wordpoints_hooks()->get_sub_app('router')->get_event_index();
500 500
 
501 501
 	// We don't care about the action slugs, so first we get rid of that bottom level
502 502
 	// of the array.
503
-	$event_index = call_user_func_array( 'array_merge_recursive', $event_index );
503
+	$event_index = call_user_func_array('array_merge_recursive', $event_index);
504 504
 
505 505
 	$event_action_types = array();
506 506
 
507 507
 	// This leaves us the event indexed by action type. But we actually need to flip
508 508
 	// this, so that we have the action types indexed by event slug.
509
-	foreach ( $event_index as $action_type => $events ) {
510
-		foreach ( $events as $event => $unused ) {
511
-			$event_action_types[ $event ][ $action_type ] = true;
509
+	foreach ($event_index as $action_type => $events) {
510
+		foreach ($events as $event => $unused) {
511
+			$event_action_types[$event][$action_type] = true;
512 512
 		}
513 513
 	}
514 514
 
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
  *
532 532
  * @return string The HTML with templates appended.
533 533
  */
534
-function wordpoints_script_templates_filter( $html, $handle ) {
534
+function wordpoints_script_templates_filter($html, $handle) {
535 535
 
536 536
 	global $wp_scripts;
537 537
 
538
-	$templates = $wp_scripts->get_data( $handle, 'wordpoints-templates' );
538
+	$templates = $wp_scripts->get_data($handle, 'wordpoints-templates');
539 539
 
540
-	if ( $templates ) {
540
+	if ($templates) {
541 541
 		$html .= $templates;
542 542
 	}
543 543
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
  */
554 554
 function wordpoints_hooks_admin_ajax() {
555 555
 
556
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
556
+	if (defined('DOING_AJAX') && DOING_AJAX) {
557 557
 		new WordPoints_Admin_Ajax_Hooks;
558 558
 	}
559 559
 }
Please login to merge, or discard this patch.
src/includes/classes/hook/action/post/depublish/delete.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function should_fire() {
21 21
 
22
-		$post = $this->get_arg_value( 'post' );
22
+		$post = $this->get_arg_value('post');
23 23
 
24
-		if ( ! $post ) {
24
+		if ( ! $post) {
25 25
 			return false;
26 26
 		}
27 27
 
28
-		if ( 'publish' !== get_post_status( $post ) ) {
28
+		if ('publish' !== get_post_status($post)) {
29 29
 			return false;
30 30
 		}
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/extension/periods.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 	public function get_ui_script_data() {
39 39
 
40 40
 		$periods = array(
41
-			MINUTE_IN_SECONDS   => __( 'Minute', 'wordpoints' ),
42
-			HOUR_IN_SECONDS     => __( 'Hour',   'wordpoints' ),
43
-			DAY_IN_SECONDS      => __( 'Day',    'wordpoints' ),
44
-			WEEK_IN_SECONDS     => __( 'Week',   'wordpoints' ),
45
-			30 * DAY_IN_SECONDS => __( 'Month',  'wordpoints' ),
41
+			MINUTE_IN_SECONDS   => __('Minute', 'wordpoints'),
42
+			HOUR_IN_SECONDS     => __('Hour', 'wordpoints'),
43
+			DAY_IN_SECONDS      => __('Day', 'wordpoints'),
44
+			WEEK_IN_SECONDS     => __('Week', 'wordpoints'),
45
+			30 * DAY_IN_SECONDS => __('Month', 'wordpoints'),
46 46
 		);
47 47
 
48 48
 		/**
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 		 *
53 53
 		 * @param string[] $periods The period titles, indexed by length in seconds.
54 54
 		 */
55
-		$periods = apply_filters( 'wordpoints_hooks_ui_data_periods', $periods );
55
+		$periods = apply_filters('wordpoints_hooks_ui_data_periods', $periods);
56 56
 
57 57
 		return array(
58 58
 			'periods' => $periods,
59 59
 			'l10n' => array(
60
-				'label' => __( 'Trigger reaction no more than once per:', 'wordpoints' ),
60
+				'label' => __('Trigger reaction no more than once per:', 'wordpoints'),
61 61
 			),
62 62
 		);
63 63
 	}
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return array The validated periods.
73 73
 	 */
74
-	protected function validate_action_type_settings( $periods ) {
74
+	protected function validate_action_type_settings($periods) {
75 75
 
76
-		if ( ! is_array( $periods ) ) {
76
+		if ( ! is_array($periods)) {
77 77
 
78 78
 			$this->validator->add_error(
79
-				__( 'Periods do not match expected format.', 'wordpoints' )
79
+				__('Periods do not match expected format.', 'wordpoints')
80 80
 			);
81 81
 
82 82
 			return array();
83 83
 		}
84 84
 
85
-		foreach ( $periods as $index => $period ) {
85
+		foreach ($periods as $index => $period) {
86 86
 
87
-			$this->validator->push_field( $index );
87
+			$this->validator->push_field($index);
88 88
 
89
-			$period = $this->validate_period( $period );
89
+			$period = $this->validate_period($period);
90 90
 
91
-			if ( $period ) {
92
-				$periods[ $index ] = $period;
91
+			if ($period) {
92
+				$periods[$index] = $period;
93 93
 			}
94 94
 
95 95
 			$this->validator->pop_field();
@@ -107,30 +107,30 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return array|false The validated period, or false if invalid.
109 109
 	 */
110
-	protected function validate_period( $period ) {
110
+	protected function validate_period($period) {
111 111
 
112
-		if ( ! is_array( $period ) ) {
112
+		if ( ! is_array($period)) {
113 113
 			$this->validator->add_error(
114
-				__( 'Period does not match expected format.', 'wordpoints' )
114
+				__('Period does not match expected format.', 'wordpoints')
115 115
 			);
116 116
 
117 117
 			return false;
118 118
 		}
119 119
 
120
-		if ( isset( $period['args'] ) ) {
121
-			$this->validate_period_args( $period['args'] );
120
+		if (isset($period['args'])) {
121
+			$this->validate_period_args($period['args']);
122 122
 		}
123 123
 
124
-		if ( ! isset( $period['length'] ) ) {
124
+		if ( ! isset($period['length'])) {
125 125
 
126 126
 			$this->validator->add_error(
127
-				__( 'Period length setting is missing.', 'wordpoints' )
127
+				__('Period length setting is missing.', 'wordpoints')
128 128
 			);
129 129
 
130
-		} elseif ( false === wordpoints_posint( $period['length'] ) ) {
130
+		} elseif (false === wordpoints_posint($period['length'])) {
131 131
 
132 132
 			$this->validator->add_error(
133
-				__( 'Period length must be a positive integer.', 'wordpoints' )
133
+				__('Period length must be a positive integer.', 'wordpoints')
134 134
 				, 'length'
135 135
 			);
136 136
 
@@ -147,34 +147,34 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param mixed $args The args the period is related to.
149 149
 	 */
150
-	protected function validate_period_args( $args ) {
150
+	protected function validate_period_args($args) {
151 151
 
152
-		if ( ! is_array( $args ) ) {
152
+		if ( ! is_array($args)) {
153 153
 
154 154
 			$this->validator->add_error(
155
-				__( 'Period does not match expected format.', 'wordpoints' )
155
+				__('Period does not match expected format.', 'wordpoints')
156 156
 				, 'args'
157 157
 			);
158 158
 
159 159
 			return;
160 160
 		}
161 161
 
162
-		$this->validator->push_field( 'args' );
162
+		$this->validator->push_field('args');
163 163
 
164
-		foreach ( $args as $index => $hierarchy ) {
164
+		foreach ($args as $index => $hierarchy) {
165 165
 
166
-			$this->validator->push_field( $index );
166
+			$this->validator->push_field($index);
167 167
 
168
-			if ( ! is_array( $hierarchy ) ) {
168
+			if ( ! is_array($hierarchy)) {
169 169
 
170 170
 				$this->validator->add_error(
171
-					__( 'Period does not match expected format.', 'wordpoints' )
171
+					__('Period does not match expected format.', 'wordpoints')
172 172
 				);
173 173
 
174
-			} elseif ( ! $this->event_args->get_from_hierarchy( $hierarchy ) ) {
174
+			} elseif ( ! $this->event_args->get_from_hierarchy($hierarchy)) {
175 175
 
176 176
 				$this->validator->add_error(
177
-					__( 'Invalid arg hierarchy for period.', 'wordpoints' )
177
+					__('Invalid arg hierarchy for period.', 'wordpoints')
178 178
 				);
179 179
 			}
180 180
 
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
 	/**
188 188
 	 * @since 1.0.0
189 189
 	 */
190
-	public function should_hit( WordPoints_Hook_Fire $fire ) {
190
+	public function should_hit(WordPoints_Hook_Fire $fire) {
191 191
 
192
-		$periods = $this->get_settings_from_fire( $fire );
192
+		$periods = $this->get_settings_from_fire($fire);
193 193
 
194
-		if ( empty( $periods ) ) {
194
+		if (empty($periods)) {
195 195
 			return true;
196 196
 		}
197 197
 
198 198
 		$this->event_args = $fire->event_args;
199 199
 		$this->action_type = $fire->action_type;
200 200
 
201
-		foreach ( $periods as $period ) {
202
-			if ( ! $this->has_period_ended( $period, $fire->reaction ) ) {
201
+		foreach ($periods as $period) {
202
+			if ( ! $this->has_period_ended($period, $fire->reaction)) {
203 203
 				return false;
204 204
 			}
205 205
 		}
@@ -223,24 +223,24 @@  discard block
 block discarded – undo
223 223
 	) {
224 224
 
225 225
 		$period = $this->get_period_by_reaction(
226
-			$this->get_period_signature( $settings, $reaction )
226
+			$this->get_period_signature($settings, $reaction)
227 227
 			, $reaction
228 228
 		);
229 229
 
230 230
 		// If the period isn't found, we know that we can still fire.
231
-		if ( ! $period ) {
231
+		if ( ! $period) {
232 232
 			return true;
233 233
 		}
234 234
 
235
-		$now = current_time( 'timestamp' );
236
-		$hit_time = strtotime( $period->date, $now );
235
+		$now = current_time('timestamp');
236
+		$hit_time = strtotime($period->date, $now);
237 237
 
238
-		if ( ! empty( $settings['relative'] ) ) {
239
-			return ( $hit_time < $now - $settings['length'] );
238
+		if ( ! empty($settings['relative'])) {
239
+			return ($hit_time < $now - $settings['length']);
240 240
 		} else {
241 241
 			return (
242
-				(int) ( $hit_time / $settings['length'] )
243
-				< (int) ( $now / $settings['length'] )
242
+				(int) ($hit_time / $settings['length'])
243
+				< (int) ($now / $settings['length'])
244 244
 			);
245 245
 		}
246 246
 	}
@@ -254,24 +254,24 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @return array The arg values.
256 256
 	 */
257
-	protected function get_arg_values( array $period_args ) {
257
+	protected function get_arg_values(array $period_args) {
258 258
 
259 259
 		$values = array();
260 260
 
261
-		foreach ( $period_args as $arg_hierarchy ) {
261
+		foreach ($period_args as $arg_hierarchy) {
262 262
 
263 263
 			$arg = $this->event_args->get_from_hierarchy(
264 264
 				$arg_hierarchy
265 265
 			);
266 266
 
267
-			if ( ! $arg instanceof WordPoints_EntityishI ) {
267
+			if ( ! $arg instanceof WordPoints_EntityishI) {
268 268
 				continue;
269 269
 			}
270 270
 
271
-			$values[ implode( '.', $arg_hierarchy ) ] = $arg->get_the_value();
271
+			$values[implode('.', $arg_hierarchy)] = $arg->get_the_value();
272 272
 		}
273 273
 
274
-		ksort( $values );
274
+		ksort($values);
275 275
 
276 276
 		return $values;
277 277
 	}
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return object|false The period data, or false if not found.
287 287
 	 */
288
-	protected function get_period( $period_id ) {
288
+	protected function get_period($period_id) {
289 289
 
290
-		$period = wp_cache_get( $period_id, 'wordpoints_hook_periods' );
290
+		$period = wp_cache_get($period_id, 'wordpoints_hook_periods');
291 291
 
292
-		if ( ! $period ) {
292
+		if ( ! $period) {
293 293
 
294 294
 			global $wpdb;
295 295
 
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
 				)
307 307
 			);
308 308
 
309
-			if ( ! $period ) {
309
+			if ( ! $period) {
310 310
 				return false;
311 311
 			}
312 312
 
313
-			wp_cache_set( $period->id, $period, 'wordpoints_hook_periods' );
313
+			wp_cache_set($period->id, $period, 'wordpoints_hook_periods');
314 314
 		}
315 315
 
316 316
 		return $period;
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 
335 335
 		$reaction_guid = $reaction->get_guid();
336 336
 
337
-		$cache_key = wp_json_encode( $reaction_guid ) . "-{$signature}-{$this->action_type}";
337
+		$cache_key = wp_json_encode($reaction_guid)."-{$signature}-{$this->action_type}";
338 338
 
339 339
 		// Before we run the query, we try to lookup the ID in the cache.
340
-		$period_id = wp_cache_get( $cache_key, 'wordpoints_hook_period_ids_by_reaction' );
340
+		$period_id = wp_cache_get($cache_key, 'wordpoints_hook_period_ids_by_reaction');
341 341
 
342 342
 		// If we found it, we can retrieve the period by ID instead.
343
-		if ( $period_id ) {
344
-			return $this->get_period( $period_id );
343
+		if ($period_id) {
344
+			return $this->get_period($period_id);
345 345
 		}
346 346
 
347 347
 		global $wpdb;
@@ -364,18 +364,18 @@  discard block
 block discarded – undo
364 364
 				"
365 365
 				, $signature
366 366
 				, $reaction_guid['store']
367
-				, wp_json_encode( $reaction_guid['context_id'] )
367
+				, wp_json_encode($reaction_guid['context_id'])
368 368
 				, $reaction_guid['id']
369 369
 				, $this->action_type
370 370
 			)
371 371
 		);
372 372
 
373
-		if ( ! $period ) {
373
+		if ( ! $period) {
374 374
 			return false;
375 375
 		}
376 376
 
377
-		wp_cache_set( $cache_key, $period->id, 'wordpoints_hook_period_ids_by_reaction' );
378
-		wp_cache_set( $period->id, $period, 'wordpoints_hook_periods' );
377
+		wp_cache_set($cache_key, $period->id, 'wordpoints_hook_period_ids_by_reaction');
378
+		wp_cache_set($period->id, $period, 'wordpoints_hook_periods');
379 379
 
380 380
 		return $period;
381 381
 	}
@@ -383,21 +383,21 @@  discard block
 block discarded – undo
383 383
 	/**
384 384
 	 * @since 1.0.0
385 385
 	 */
386
-	public function after_hit( WordPoints_Hook_Fire $fire ) {
386
+	public function after_hit(WordPoints_Hook_Fire $fire) {
387 387
 
388
-		$periods = $this->get_settings_from_fire( $fire );
388
+		$periods = $this->get_settings_from_fire($fire);
389 389
 
390
-		if ( empty( $periods ) ) {
390
+		if (empty($periods)) {
391 391
 			return;
392 392
 		}
393 393
 
394 394
 		$this->event_args = $fire->event_args;
395 395
 		$this->action_type = $fire->action_type;
396 396
 
397
-		foreach ( $periods as $settings ) {
397
+		foreach ($periods as $settings) {
398 398
 
399 399
 			$this->add_period(
400
-				$this->get_period_signature( $settings, $fire->reaction )
400
+				$this->get_period_signature($settings, $fire->reaction)
401 401
 				, $fire
402 402
 			);
403 403
 		}
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 		WordPoints_Hook_ReactionI $reaction
423 423
 	) {
424 424
 
425
-		if ( isset( $settings['args'] ) ) {
425
+		if (isset($settings['args'])) {
426 426
 			$period_args = $settings['args'];
427 427
 		} else {
428
-			$period_args = array( $reaction->get_meta( 'target' ) );
428
+			$period_args = array($reaction->get_meta('target'));
429 429
 		}
430 430
 
431 431
 		return wordpoints_hash(
432
-			wp_json_encode( $this->get_arg_values( $period_args ) )
432
+			wp_json_encode($this->get_arg_values($period_args))
433 433
 		);
434 434
 	}
435 435
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @return false|object The period data, or false if not found.
445 445
 	 */
446
-	protected function add_period( $signature, WordPoints_Hook_Fire $fire ) {
446
+	protected function add_period($signature, WordPoints_Hook_Fire $fire) {
447 447
 
448 448
 		global $wpdb;
449 449
 
@@ -453,17 +453,17 @@  discard block
 block discarded – undo
453 453
 				'hit_id' => $fire->hit_id,
454 454
 				'signature' => $signature,
455 455
 			)
456
-			, array( '%d', '%s' )
456
+			, array('%d', '%s')
457 457
 		);
458 458
 
459
-		if ( ! $inserted ) {
459
+		if ( ! $inserted) {
460 460
 			return false;
461 461
 		}
462 462
 
463 463
 		$period_id = $wpdb->insert_id;
464 464
 
465 465
 		wp_cache_set(
466
-			wp_json_encode( $fire->reaction->get_guid() ) . "-{$signature}-{$this->action_type}"
466
+			wp_json_encode($fire->reaction->get_guid())."-{$signature}-{$this->action_type}"
467 467
 			, $period_id
468 468
 			, 'wordpoints_hook_period_ids_by_reaction'
469 469
 		);
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/store/options.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @since 1.0.0
24 24
 	 */
25
-	public function reaction_exists( $id ) {
26
-		return (bool) $this->get_option( $this->get_settings_option_name( $id ) );
25
+	public function reaction_exists($id) {
26
+		return (bool) $this->get_option($this->get_settings_option_name($id));
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @since 1.0.0
31 31
 	 */
32 32
 	public function get_reactions() {
33
-		return $this->create_reaction_objects( $this->get_reaction_index() );
33
+		return $this->create_reaction_objects($this->get_reaction_index());
34 34
 	}
35 35
 
36 36
 	/**
37 37
 	 * @since 1.0.0
38 38
 	 */
39
-	public function get_reactions_to_event( $event_slug ) {
39
+	public function get_reactions_to_event($event_slug) {
40 40
 
41 41
 		$index = $this->get_reaction_index();
42
-		$index = wp_list_filter( $index, array( 'event' => $event_slug ) );
43
-		return $this->create_reaction_objects( $index );
42
+		$index = wp_list_filter($index, array('event' => $event_slug));
43
+		return $this->create_reaction_objects($index);
44 44
 	}
45 45
 
46 46
 	/**
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	protected function get_reaction_index() {
61 61
 
62
-		$index = $this->get_option( $this->get_reaction_index_option_name() );
62
+		$index = $this->get_option($this->get_reaction_index_option_name());
63 63
 
64
-		if ( ! is_array( $index ) ) {
64
+		if ( ! is_array($index)) {
65 65
 			$index = array();
66 66
 		}
67 67
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @return bool Whether the index was updated successfully.
79 79
 	 */
80
-	protected function update_reaction_index( $index ) {
80
+	protected function update_reaction_index($index) {
81 81
 
82 82
 		return $this->update_option(
83 83
 			$this->get_reaction_index_option_name()
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return string|false The event slug, or false if not found.
98 98
 	 */
99
-	public function get_reaction_event_from_index( $id ) {
99
+	public function get_reaction_event_from_index($id) {
100 100
 
101 101
 		$index = $this->get_reaction_index();
102 102
 
103
-		if ( ! isset( $index[ $id ]['event'] ) ) {
103
+		if ( ! isset($index[$id]['event'])) {
104 104
 			return false;
105 105
 		}
106 106
 
107
-		return $index[ $id ]['event'];
107
+		return $index[$id]['event'];
108 108
 	}
109 109
 
110 110
 	/**
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return bool Whether the event was updated successfully.
121 121
 	 */
122
-	public function update_reaction_event_in_index( $id, $event ) {
122
+	public function update_reaction_event_in_index($id, $event) {
123 123
 
124 124
 		$index = $this->get_reaction_index();
125 125
 
126
-		if ( ! isset( $index[ $id ] ) ) {
126
+		if ( ! isset($index[$id])) {
127 127
 			return false;
128 128
 		}
129 129
 
130
-		$index[ $id ]['event'] = $event;
130
+		$index[$id]['event'] = $event;
131 131
 
132
-		return $this->update_reaction_index( $index );
132
+		return $this->update_reaction_index($index);
133 133
 	}
134 134
 
135 135
 	/**
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return WordPoints_Hook_Reaction_Options[] The objects for the reactions.
143 143
 	 */
144
-	protected function create_reaction_objects( $index ) {
144
+	protected function create_reaction_objects($index) {
145 145
 
146 146
 		$reactions = array();
147 147
 
148
-		foreach ( $index as $reaction ) {
148
+		foreach ($index as $reaction) {
149 149
 
150
-			$object = $this->get_reaction( $reaction['id'] );
150
+			$object = $this->get_reaction($reaction['id']);
151 151
 
152
-			if ( ! $object ) {
152
+			if ( ! $object) {
153 153
 				continue;
154 154
 			}
155 155
 
@@ -162,52 +162,52 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * @since 1.0.0
164 164
 	 */
165
-	public function delete_reaction( $id ) {
165
+	public function delete_reaction($id) {
166 166
 
167
-		if ( ! $this->reaction_exists( $id ) ) {
167
+		if ( ! $this->reaction_exists($id)) {
168 168
 			return false;
169 169
 		}
170 170
 
171
-		$result = $this->delete_option( $this->get_settings_option_name( $id ) );
171
+		$result = $this->delete_option($this->get_settings_option_name($id));
172 172
 
173
-		if ( ! $result ) {
173
+		if ( ! $result) {
174 174
 			return false;
175 175
 		}
176 176
 
177 177
 		$index = $this->get_reaction_index();
178 178
 
179
-		unset( $index[ $id ] );
179
+		unset($index[$id]);
180 180
 
181
-		return $this->update_reaction_index( $index );
181
+		return $this->update_reaction_index($index);
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @since 1.0.0
186 186
 	 */
187
-	protected function _create_reaction( $event_slug ) {
187
+	protected function _create_reaction($event_slug) {
188 188
 
189 189
 		$index = $this->get_reaction_index();
190 190
 
191
-		$id = $this->get_next_id( $index );
191
+		$id = $this->get_next_id($index);
192 192
 
193
-		$settings = array( 'event' => $event_slug );
193
+		$settings = array('event' => $event_slug);
194 194
 
195 195
 		$result = $this->add_option(
196
-			$this->get_settings_option_name( $id )
196
+			$this->get_settings_option_name($id)
197 197
 			, $settings
198 198
 		);
199 199
 
200
-		if ( ! $result ) {
200
+		if ( ! $result) {
201 201
 			return false;
202 202
 		}
203 203
 
204
-		$index[ $id ] = array( 'event' => $event_slug, 'id' => $id );
204
+		$index[$id] = array('event' => $event_slug, 'id' => $id);
205 205
 
206
-		if ( ! $this->update_reaction_index( $index ) ) {
206
+		if ( ! $this->update_reaction_index($index)) {
207 207
 			return false;
208 208
 		}
209 209
 
210
-		$this->update_option( $this->get_last_reaction_id_option_name(), $id );
210
+		$this->update_option($this->get_last_reaction_id_option_name(), $id);
211 211
 
212 212
 		return $id;
213 213
 	}
@@ -221,23 +221,23 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return int The ID to use for the next reaction.
223 223
 	 */
224
-	protected function get_next_id( $index ) {
224
+	protected function get_next_id($index) {
225 225
 
226 226
 		$id = 1;
227 227
 
228
-		$last_id = $this->get_option( $this->get_last_reaction_id_option_name() );
228
+		$last_id = $this->get_option($this->get_last_reaction_id_option_name());
229 229
 
230
-		if ( wordpoints_posint( $last_id ) ) {
230
+		if (wordpoints_posint($last_id)) {
231 231
 			$id = $last_id + 1;
232 232
 		}
233 233
 
234 234
 		// Double-check this against the index. This should avoid some issues from
235 235
 		// race conditions.
236
-		if ( ! empty( $index ) ) {
236
+		if ( ! empty($index)) {
237 237
 
238
-			$max = max( array_keys( $index ) );
238
+			$max = max(array_keys($index));
239 239
 
240
-			if ( $max >= $id ) {
240
+			if ($max >= $id) {
241 241
 				$id = $max + 1;
242 242
 			}
243 243
 		}
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return mixed The option value, or false.
258 258
 	 */
259
-	public function get_option( $name ) {
260
-		return get_option( $name );
259
+	public function get_option($name) {
260
+		return get_option($name);
261 261
 	}
262 262
 
263 263
 	/**
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return bool Whether the option was added successfully.
272 272
 	 */
273
-	protected function add_option( $name, $value ) {
274
-		return add_option( $name, $value );
273
+	protected function add_option($name, $value) {
274
+		return add_option($name, $value);
275 275
 	}
276 276
 
277 277
 	/**
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @return bool Whether the option was updated successfully.
288 288
 	 */
289
-	public function update_option( $name, $value ) {
290
-		return update_option( $name, $value );
289
+	public function update_option($name, $value) {
290
+		return update_option($name, $value);
291 291
 	}
292 292
 
293 293
 	/**
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return bool Whether the option was deleted successfully.
301 301
 	 */
302
-	protected function delete_option( $name ) {
303
-		return delete_option( $name );
302
+	protected function delete_option($name) {
303
+		return delete_option($name);
304 304
 	}
305 305
 
306 306
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return string The name of the option where the settings are stored.
316 316
 	 */
317
-	public function get_settings_option_name( $id ) {
317
+	public function get_settings_option_name($id) {
318 318
 
319 319
 		$current_mode = wordpoints_hooks()->get_current_mode();
320 320
 
Please login to merge, or discard this patch.
src/includes/classes/hook/condition/string/contains.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Contains', 'wordpoints' );
21
+		return __('Contains', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		return array(
29 29
 			'value' => array(
30 30
 				'type'     => 'text',
31
-				'label'    => __( 'Word or phrase (case sensitive)', 'wordpoints' ),
31
+				'label'    => __('Word or phrase (case sensitive)', 'wordpoints'),
32 32
 				'required' => true,
33 33
 			),
34 34
 		);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) {
40
+	public function is_met(array $settings, WordPoints_Hook_Event_Args $args) {
41 41
 
42 42
 		return false !== strpos(
43 43
 			$args->get_current()->get_the_value()
Please login to merge, or discard this patch.
src/includes/classes/entity/user/role/name.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 _x( 'Name', 'user role', 'wordpoints' );
36
+		return _x('Name', 'user role', 'wordpoints');
37 37
 	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
src/includes/classes/entity/term/id.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 _x( 'ID', 'taxonomy term', 'wordpoints' );
36
+		return _x('ID', 'taxonomy term', 'wordpoints');
37 37
 	}
38 38
 }
39 39
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/extension.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		WordPoints_Hook_Event_Args $event_args
58 58
 	) {
59 59
 
60
-		if ( ! isset( $settings[ $this->slug ] ) ) {
60
+		if ( ! isset($settings[$this->slug])) {
61 61
 			return $settings;
62 62
 		}
63 63
 
64
-		if ( ! is_array( $settings[ $this->slug ] ) ) {
64
+		if ( ! is_array($settings[$this->slug])) {
65 65
 
66 66
 			$validator->add_error(
67
-				__( 'Invalid settings format.', 'wordpoints' )
67
+				__('Invalid settings format.', 'wordpoints')
68 68
 				, $this->slug
69 69
 			);
70 70
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 		$this->validator = $validator;
75 75
 		$this->event_args = $event_args;
76 76
 
77
-		$this->validator->push_field( $this->slug );
77
+		$this->validator->push_field($this->slug);
78 78
 
79
-		foreach ( $settings[ $this->slug ] as $action_type => $action_type_settings ) {
79
+		foreach ($settings[$this->slug] as $action_type => $action_type_settings) {
80 80
 
81
-			$this->validator->push_field( $action_type );
81
+			$this->validator->push_field($action_type);
82 82
 
83
-			$settings[ $this->slug ][ $action_type ] = $this->validate_action_type_settings(
83
+			$settings[$this->slug][$action_type] = $this->validate_action_type_settings(
84 84
 				$action_type_settings
85 85
 			);
86 86
 
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	/**
96 96
 	 * @since 1.0.0
97 97
 	 */
98
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
98
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
99 99
 
100
-		if ( isset( $settings[ $this->slug ] ) ) {
101
-			$reaction->update_meta( $this->slug, $settings[ $this->slug ] );
100
+		if (isset($settings[$this->slug])) {
101
+			$reaction->update_meta($this->slug, $settings[$this->slug]);
102 102
 		} else {
103
-			$reaction->delete_meta( $this->slug );
103
+			$reaction->delete_meta($this->slug);
104 104
 		}
105 105
 	}
106 106
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return mixed The validated settings.
115 115
 	 */
116
-	protected function validate_action_type_settings( $settings ) {
116
+	protected function validate_action_type_settings($settings) {
117 117
 		return $settings;
118 118
 	}
119 119
 
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return mixed The settings for the extension, or false if none.
132 132
 	 */
133
-	protected function get_settings_from_fire( WordPoints_Hook_Fire $fire ) {
133
+	protected function get_settings_from_fire(WordPoints_Hook_Fire $fire) {
134 134
 
135
-		$settings = $fire->reaction->get_meta( $this->slug );
135
+		$settings = $fire->reaction->get_meta($this->slug);
136 136
 
137
-		if ( ! is_array( $settings ) ) {
137
+		if ( ! is_array($settings)) {
138 138
 			return $settings;
139 139
 		}
140 140
 
141
-		if ( isset( $settings[ $fire->action_type ] ) ) {
142
-			return $settings[ $fire->action_type ];
141
+		if (isset($settings[$fire->action_type])) {
142
+			return $settings[$fire->action_type];
143 143
 		} else {
144 144
 			return false;
145 145
 		}
Please login to merge, or discard this patch.