Completed
Push — master ( 873ec4...144c08 )
by J.D.
03:34
created
src/includes/classes/entity/user/roles.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	/**
35 35
 	 * @since 1.0.0
36 36
 	 */
37
-	protected function get_related_entity_ids( WordPoints_Entity $entity ) {
38
-		return $entity->get_the_attr_value( $this->related_ids_field );
37
+	protected function get_related_entity_ids(WordPoints_Entity $entity) {
38
+		return $entity->get_the_attr_value($this->related_ids_field);
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @since 1.0.0
43 43
 	 */
44 44
 	public function get_title() {
45
-		return __( 'Roles', 'wordpoints' );
45
+		return __('Roles', 'wordpoints');
46 46
 	}
47 47
 
48 48
 	/**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				'conditions'       => array(
63 63
 					array(
64 64
 						'field' => 'meta_key',
65
-						'value' => $GLOBALS['wpdb']->get_blog_prefix() . 'capabilities',
65
+						'value' => $GLOBALS['wpdb']->get_blog_prefix().'capabilities',
66 66
 					),
67 67
 				),
68 68
 			),
Please login to merge, or discard this patch.
src/includes/classes/index.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -10,113 +10,113 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // auto-generated {
13
-require_once( dirname( __FILE__ ) . 'app.php' );
14
-require_once( dirname( __FILE__ ) . 'app/registry.php' );
15
-require_once( dirname( __FILE__ ) . 'class/autoloader.php' );
16
-require_once( dirname( __FILE__ ) . 'class/registry.php' );
17
-require_once( dirname( __FILE__ ) . 'class/registry/children.php' );
18
-require_once( dirname( __FILE__ ) . 'class/registry/childreni.php' );
19
-require_once( dirname( __FILE__ ) . 'class/registry/persistent.php' );
20
-require_once( dirname( __FILE__ ) . 'class/registryi.php' );
21
-require_once( dirname( __FILE__ ) . 'data/type.php' );
22
-require_once( dirname( __FILE__ ) . 'data/type/integer.php' );
23
-require_once( dirname( __FILE__ ) . 'data/type/text.php' );
24
-require_once( dirname( __FILE__ ) . 'data/typei.php' );
25
-require_once( dirname( __FILE__ ) . 'db/query.php' );
26
-require_once( dirname( __FILE__ ) . 'entity.php' );
27
-require_once( dirname( __FILE__ ) . 'entity/array.php' );
28
-require_once( dirname( __FILE__ ) . 'entity/attr.php' );
29
-require_once( dirname( __FILE__ ) . 'entity/attr/field.php' );
30
-require_once( dirname( __FILE__ ) . 'entity/childi.php' );
31
-require_once( dirname( __FILE__ ) . 'entity/comment.php' );
32
-require_once( dirname( __FILE__ ) . 'entity/comment/author.php' );
33
-require_once( dirname( __FILE__ ) . 'entity/comment/post.php' );
34
-require_once( dirname( __FILE__ ) . 'entity/context.php' );
35
-require_once( dirname( __FILE__ ) . 'entity/context/network.php' );
36
-require_once( dirname( __FILE__ ) . 'entity/context/site.php' );
37
-require_once( dirname( __FILE__ ) . 'entity/enumerablei.php' );
38
-require_once( dirname( __FILE__ ) . 'entity/hierarchy.php' );
39
-require_once( dirname( __FILE__ ) . 'entity/hierarchyi.php' );
40
-require_once( dirname( __FILE__ ) . 'entity/parenti.php' );
41
-require_once( dirname( __FILE__ ) . 'entity/post.php' );
42
-require_once( dirname( __FILE__ ) . 'entity/post/author.php' );
43
-require_once( dirname( __FILE__ ) . 'entity/post/content.php' );
44
-require_once( dirname( __FILE__ ) . 'entity/post/terms.php' );
45
-require_once( dirname( __FILE__ ) . 'entity/post/type.php' );
46
-require_once( dirname( __FILE__ ) . 'entity/post/type/name.php' );
47
-require_once( dirname( __FILE__ ) . 'entity/post/type/relationship.php' );
48
-require_once( dirname( __FILE__ ) . 'entity/relationship.php' );
49
-require_once( dirname( __FILE__ ) . 'entity/relationship/dynamic.php' );
50
-require_once( dirname( __FILE__ ) . 'entity/relationship/stored/field.php' );
51
-require_once( dirname( __FILE__ ) . 'entity/restricted/visibilityi.php' );
52
-require_once( dirname( __FILE__ ) . 'entity/site.php' );
53
-require_once( dirname( __FILE__ ) . 'entity/stored/array.php' );
54
-require_once( dirname( __FILE__ ) . 'entity/stored/db/table.php' );
55
-require_once( dirname( __FILE__ ) . 'entity/term.php' );
56
-require_once( dirname( __FILE__ ) . 'entity/term/id.php' );
57
-require_once( dirname( __FILE__ ) . 'entity/user.php' );
58
-require_once( dirname( __FILE__ ) . 'entity/user/role.php' );
59
-require_once( dirname( __FILE__ ) . 'entity/user/role/name.php' );
60
-require_once( dirname( __FILE__ ) . 'entity/user/roles.php' );
61
-require_once( dirname( __FILE__ ) . 'entityish.php' );
62
-require_once( dirname( __FILE__ ) . 'entityish/storedi.php' );
63
-require_once( dirname( __FILE__ ) . 'entityishi.php' );
64
-require_once( dirname( __FILE__ ) . 'hierarchy.php' );
65
-require_once( dirname( __FILE__ ) . 'hook/action.php' );
66
-require_once( dirname( __FILE__ ) . 'hook/action/comment/new.php' );
67
-require_once( dirname( __FILE__ ) . 'hook/action/post/publish.php' );
68
-require_once( dirname( __FILE__ ) . 'hook/actioni.php' );
69
-require_once( dirname( __FILE__ ) . 'hook/actions.php' );
70
-require_once( dirname( __FILE__ ) . 'hook/arg.php' );
71
-require_once( dirname( __FILE__ ) . 'hook/arg/current/post.php' );
72
-require_once( dirname( __FILE__ ) . 'hook/arg/current/site.php' );
73
-require_once( dirname( __FILE__ ) . 'hook/arg/current/user.php' );
74
-require_once( dirname( __FILE__ ) . 'hook/arg/dynamic.php' );
75
-require_once( dirname( __FILE__ ) . 'hook/condition.php' );
76
-require_once( dirname( __FILE__ ) . 'hook/condition/entity/array/contains.php' );
77
-require_once( dirname( __FILE__ ) . 'hook/condition/equals.php' );
78
-require_once( dirname( __FILE__ ) . 'hook/condition/string/contains.php' );
79
-require_once( dirname( __FILE__ ) . 'hook/conditioni.php' );
80
-require_once( dirname( __FILE__ ) . 'hook/event.php' );
81
-require_once( dirname( __FILE__ ) . 'hook/event/args.php' );
82
-require_once( dirname( __FILE__ ) . 'hook/event/comment/leave.php' );
83
-require_once( dirname( __FILE__ ) . 'hook/event/dynamic.php' );
84
-require_once( dirname( __FILE__ ) . 'hook/event/media/upload.php' );
85
-require_once( dirname( __FILE__ ) . 'hook/event/post/publish.php' );
86
-require_once( dirname( __FILE__ ) . 'hook/event/user/register.php' );
87
-require_once( dirname( __FILE__ ) . 'hook/event/user/visit.php' );
88
-require_once( dirname( __FILE__ ) . 'hook/eventi.php' );
89
-require_once( dirname( __FILE__ ) . 'hook/events.php' );
90
-require_once( dirname( __FILE__ ) . 'hook/extension.php' );
91
-require_once( dirname( __FILE__ ) . 'hook/extension/blocker.php' );
92
-require_once( dirname( __FILE__ ) . 'hook/extension/conditions.php' );
93
-require_once( dirname( __FILE__ ) . 'hook/extension/periods.php' );
94
-require_once( dirname( __FILE__ ) . 'hook/fire.php' );
95
-require_once( dirname( __FILE__ ) . 'hook/hit/logger.php' );
96
-require_once( dirname( __FILE__ ) . 'hook/hit/query.php' );
97
-require_once( dirname( __FILE__ ) . 'hook/reaction.php' );
98
-require_once( dirname( __FILE__ ) . 'hook/reaction/options.php' );
99
-require_once( dirname( __FILE__ ) . 'hook/reaction/store.php' );
100
-require_once( dirname( __FILE__ ) . 'hook/reaction/store/options.php' );
101
-require_once( dirname( __FILE__ ) . 'hook/reaction/store/options/network.php' );
102
-require_once( dirname( __FILE__ ) . 'hook/reaction/storei.php' );
103
-require_once( dirname( __FILE__ ) . 'hook/reaction/validator.php' );
104
-require_once( dirname( __FILE__ ) . 'hook/reactioni.php' );
105
-require_once( dirname( __FILE__ ) . 'hook/reactor.php' );
106
-require_once( dirname( __FILE__ ) . 'hook/reactor/points.php' );
107
-require_once( dirname( __FILE__ ) . 'hook/retroactive/conditions.php' );
108
-require_once( dirname( __FILE__ ) . 'hook/retroactive/query.php' );
109
-require_once( dirname( __FILE__ ) . 'hook/retroactive/query/modifieri.php' );
110
-require_once( dirname( __FILE__ ) . 'hook/retroactive/queryable.php' );
111
-require_once( dirname( __FILE__ ) . 'hook/retroactive/queryi.php' );
112
-require_once( dirname( __FILE__ ) . 'hook/router.php' );
113
-require_once( dirname( __FILE__ ) . 'hook/settings.php' );
114
-require_once( dirname( __FILE__ ) . 'hook/settingsi.php' );
115
-require_once( dirname( __FILE__ ) . 'hook/validator/exception.php' );
116
-require_once( dirname( __FILE__ ) . 'hooks.php' );
117
-require_once( dirname( __FILE__ ) . 'query/builder/db/mysql.php' );
118
-require_once( dirname( __FILE__ ) . 'spec.php' );
119
-require_once( dirname( __FILE__ ) . 'specedi.php' );
13
+require_once(dirname(__FILE__).'app.php');
14
+require_once(dirname(__FILE__).'app/registry.php');
15
+require_once(dirname(__FILE__).'class/autoloader.php');
16
+require_once(dirname(__FILE__).'class/registry.php');
17
+require_once(dirname(__FILE__).'class/registry/children.php');
18
+require_once(dirname(__FILE__).'class/registry/childreni.php');
19
+require_once(dirname(__FILE__).'class/registry/persistent.php');
20
+require_once(dirname(__FILE__).'class/registryi.php');
21
+require_once(dirname(__FILE__).'data/type.php');
22
+require_once(dirname(__FILE__).'data/type/integer.php');
23
+require_once(dirname(__FILE__).'data/type/text.php');
24
+require_once(dirname(__FILE__).'data/typei.php');
25
+require_once(dirname(__FILE__).'db/query.php');
26
+require_once(dirname(__FILE__).'entity.php');
27
+require_once(dirname(__FILE__).'entity/array.php');
28
+require_once(dirname(__FILE__).'entity/attr.php');
29
+require_once(dirname(__FILE__).'entity/attr/field.php');
30
+require_once(dirname(__FILE__).'entity/childi.php');
31
+require_once(dirname(__FILE__).'entity/comment.php');
32
+require_once(dirname(__FILE__).'entity/comment/author.php');
33
+require_once(dirname(__FILE__).'entity/comment/post.php');
34
+require_once(dirname(__FILE__).'entity/context.php');
35
+require_once(dirname(__FILE__).'entity/context/network.php');
36
+require_once(dirname(__FILE__).'entity/context/site.php');
37
+require_once(dirname(__FILE__).'entity/enumerablei.php');
38
+require_once(dirname(__FILE__).'entity/hierarchy.php');
39
+require_once(dirname(__FILE__).'entity/hierarchyi.php');
40
+require_once(dirname(__FILE__).'entity/parenti.php');
41
+require_once(dirname(__FILE__).'entity/post.php');
42
+require_once(dirname(__FILE__).'entity/post/author.php');
43
+require_once(dirname(__FILE__).'entity/post/content.php');
44
+require_once(dirname(__FILE__).'entity/post/terms.php');
45
+require_once(dirname(__FILE__).'entity/post/type.php');
46
+require_once(dirname(__FILE__).'entity/post/type/name.php');
47
+require_once(dirname(__FILE__).'entity/post/type/relationship.php');
48
+require_once(dirname(__FILE__).'entity/relationship.php');
49
+require_once(dirname(__FILE__).'entity/relationship/dynamic.php');
50
+require_once(dirname(__FILE__).'entity/relationship/stored/field.php');
51
+require_once(dirname(__FILE__).'entity/restricted/visibilityi.php');
52
+require_once(dirname(__FILE__).'entity/site.php');
53
+require_once(dirname(__FILE__).'entity/stored/array.php');
54
+require_once(dirname(__FILE__).'entity/stored/db/table.php');
55
+require_once(dirname(__FILE__).'entity/term.php');
56
+require_once(dirname(__FILE__).'entity/term/id.php');
57
+require_once(dirname(__FILE__).'entity/user.php');
58
+require_once(dirname(__FILE__).'entity/user/role.php');
59
+require_once(dirname(__FILE__).'entity/user/role/name.php');
60
+require_once(dirname(__FILE__).'entity/user/roles.php');
61
+require_once(dirname(__FILE__).'entityish.php');
62
+require_once(dirname(__FILE__).'entityish/storedi.php');
63
+require_once(dirname(__FILE__).'entityishi.php');
64
+require_once(dirname(__FILE__).'hierarchy.php');
65
+require_once(dirname(__FILE__).'hook/action.php');
66
+require_once(dirname(__FILE__).'hook/action/comment/new.php');
67
+require_once(dirname(__FILE__).'hook/action/post/publish.php');
68
+require_once(dirname(__FILE__).'hook/actioni.php');
69
+require_once(dirname(__FILE__).'hook/actions.php');
70
+require_once(dirname(__FILE__).'hook/arg.php');
71
+require_once(dirname(__FILE__).'hook/arg/current/post.php');
72
+require_once(dirname(__FILE__).'hook/arg/current/site.php');
73
+require_once(dirname(__FILE__).'hook/arg/current/user.php');
74
+require_once(dirname(__FILE__).'hook/arg/dynamic.php');
75
+require_once(dirname(__FILE__).'hook/condition.php');
76
+require_once(dirname(__FILE__).'hook/condition/entity/array/contains.php');
77
+require_once(dirname(__FILE__).'hook/condition/equals.php');
78
+require_once(dirname(__FILE__).'hook/condition/string/contains.php');
79
+require_once(dirname(__FILE__).'hook/conditioni.php');
80
+require_once(dirname(__FILE__).'hook/event.php');
81
+require_once(dirname(__FILE__).'hook/event/args.php');
82
+require_once(dirname(__FILE__).'hook/event/comment/leave.php');
83
+require_once(dirname(__FILE__).'hook/event/dynamic.php');
84
+require_once(dirname(__FILE__).'hook/event/media/upload.php');
85
+require_once(dirname(__FILE__).'hook/event/post/publish.php');
86
+require_once(dirname(__FILE__).'hook/event/user/register.php');
87
+require_once(dirname(__FILE__).'hook/event/user/visit.php');
88
+require_once(dirname(__FILE__).'hook/eventi.php');
89
+require_once(dirname(__FILE__).'hook/events.php');
90
+require_once(dirname(__FILE__).'hook/extension.php');
91
+require_once(dirname(__FILE__).'hook/extension/blocker.php');
92
+require_once(dirname(__FILE__).'hook/extension/conditions.php');
93
+require_once(dirname(__FILE__).'hook/extension/periods.php');
94
+require_once(dirname(__FILE__).'hook/fire.php');
95
+require_once(dirname(__FILE__).'hook/hit/logger.php');
96
+require_once(dirname(__FILE__).'hook/hit/query.php');
97
+require_once(dirname(__FILE__).'hook/reaction.php');
98
+require_once(dirname(__FILE__).'hook/reaction/options.php');
99
+require_once(dirname(__FILE__).'hook/reaction/store.php');
100
+require_once(dirname(__FILE__).'hook/reaction/store/options.php');
101
+require_once(dirname(__FILE__).'hook/reaction/store/options/network.php');
102
+require_once(dirname(__FILE__).'hook/reaction/storei.php');
103
+require_once(dirname(__FILE__).'hook/reaction/validator.php');
104
+require_once(dirname(__FILE__).'hook/reactioni.php');
105
+require_once(dirname(__FILE__).'hook/reactor.php');
106
+require_once(dirname(__FILE__).'hook/reactor/points.php');
107
+require_once(dirname(__FILE__).'hook/retroactive/conditions.php');
108
+require_once(dirname(__FILE__).'hook/retroactive/query.php');
109
+require_once(dirname(__FILE__).'hook/retroactive/query/modifieri.php');
110
+require_once(dirname(__FILE__).'hook/retroactive/queryable.php');
111
+require_once(dirname(__FILE__).'hook/retroactive/queryi.php');
112
+require_once(dirname(__FILE__).'hook/router.php');
113
+require_once(dirname(__FILE__).'hook/settings.php');
114
+require_once(dirname(__FILE__).'hook/settingsi.php');
115
+require_once(dirname(__FILE__).'hook/validator/exception.php');
116
+require_once(dirname(__FILE__).'hooks.php');
117
+require_once(dirname(__FILE__).'query/builder/db/mysql.php');
118
+require_once(dirname(__FILE__).'spec.php');
119
+require_once(dirname(__FILE__).'specedi.php');
120 120
 // }
121 121
 
122 122
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	) {
132 132
 
133 133
 		if (
134
-			empty( $settings['target'] )
135
-			|| ! is_array( $settings['target'] )
134
+			empty($settings['target'])
135
+			|| ! is_array($settings['target'])
136 136
 		) {
137 137
 
138
-			$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
138
+			$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
139 139
 
140 140
 		} else {
141 141
 
142
-			$target = $event_args->get_from_hierarchy( $settings['target'] );
142
+			$target = $event_args->get_from_hierarchy($settings['target']);
143 143
 
144 144
 			if (
145 145
 				! $target instanceof WordPoints_Entity
146
-				|| ! in_array( $target->get_slug(), (array) $this->arg_types )
146
+				|| ! in_array($target->get_slug(), (array) $this->arg_types)
147 147
 			) {
148
-				$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
148
+				$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
149 149
 			}
150 150
 		}
151 151
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	/**
156 156
 	 * @since 1.0.0
157 157
 	 */
158
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
159
-		$reaction->update_meta( 'target', $settings['target'] );
158
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
159
+		$reaction->update_meta('target', $settings['target']);
160 160
 	}
161 161
 
162 162
 	/**
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	 * @param string               $hit_type The type of hit to perform.
168 168
 	 * @param WordPoints_Hook_Fire $fire     The hook fire object.
169 169
 	 */
170
-	public function hit( $hit_type, WordPoints_Hook_Fire $fire ) {
170
+	public function hit($hit_type, WordPoints_Hook_Fire $fire) {
171 171
 
172
-		if ( in_array( $hit_type, (array) $this->hit_types ) ) {
172
+		if (in_array($hit_type, (array) $this->hit_types)) {
173 173
 
174
-			call_user_func( array( $this, $hit_type ), $fire );
174
+			call_user_func(array($this, $hit_type), $fire);
175 175
 
176 176
 		} else {
177 177
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			 * @param string               $hit_type The type of hit to perform.
184 184
 			 * @param WordPoints_Hook_Fire $fire     The hook fire object.
185 185
 			 */
186
-			do_action( "wordpoints_hook_reactor_hit-{$this->slug}", $hit_type, $fire );
186
+			do_action("wordpoints_hook_reactor_hit-{$this->slug}", $hit_type, $fire);
187 187
 		}
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
src/includes/classes/hook/router.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	/**
87 87
 	 * @since 1.0.0
88 88
 	 */
89
-	public function __call( $name, $args ) {
89
+	public function __call($name, $args) {
90 90
 
91
-		$this->route_action( $name, $args );
91
+		$this->route_action($name, $args);
92 92
 
93 93
 		// Return the first value, in case it is hooked to a filter.
94 94
 		$return = null;
95
-		if ( isset( $args[0] ) ) {
95
+		if (isset($args[0])) {
96 96
 			$return = $args[0];
97 97
 		}
98 98
 
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 	 *                     action name and the priority.
110 110
 	 * @param array  $args The args the action was fired with.
111 111
 	 */
112
-	protected function route_action( $name, $args ) {
112
+	protected function route_action($name, $args) {
113 113
 
114
-		if ( ! isset( $this->action_index[ $name ] ) ) {
114
+		if ( ! isset($this->action_index[$name])) {
115 115
 			return;
116 116
 		}
117 117
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		// registry attempts to access the router in its own constructor. The result
120 120
 		// of attempting to do this before the router itself has been fully
121 121
 		// constructed is that the events registry gets null instead of the router.
122
-		if ( ! isset( $this->actions ) ) {
122
+		if ( ! isset($this->actions)) {
123 123
 
124 124
 			$hooks = wordpoints_hooks();
125 125
 
@@ -127,38 +127,38 @@  discard block
 block discarded – undo
127 127
 			$this->actions = $hooks->actions;
128 128
 		}
129 129
 
130
-		foreach ( $this->action_index[ $name ]['actions'] as $slug => $data ) {
130
+		foreach ($this->action_index[$name]['actions'] as $slug => $data) {
131 131
 
132
-			if ( ! isset( $this->event_index[ $slug ] ) ) {
132
+			if ( ! isset($this->event_index[$slug])) {
133 133
 				continue;
134 134
 			}
135 135
 
136
-			$action_object = $this->actions->get( $slug, $args, $data );
136
+			$action_object = $this->actions->get($slug, $args, $data);
137 137
 
138
-			if ( ! ( $action_object instanceof WordPoints_Hook_ActionI ) ) {
138
+			if ( ! ($action_object instanceof WordPoints_Hook_ActionI)) {
139 139
 				continue;
140 140
 			}
141 141
 
142
-			if ( ! $action_object->should_fire() ) {
142
+			if ( ! $action_object->should_fire()) {
143 143
 				continue;
144 144
 			}
145 145
 
146
-			foreach ( $this->event_index[ $slug ] as $type => $events ) {
147
-				foreach ( $events as $event_slug => $unused ) {
146
+			foreach ($this->event_index[$slug] as $type => $events) {
147
+				foreach ($events as $event_slug => $unused) {
148 148
 
149
-					if ( ! $this->events->is_registered( $event_slug ) ) {
149
+					if ( ! $this->events->is_registered($event_slug)) {
150 150
 						continue;
151 151
 					}
152 152
 
153
-					$event_args = $this->events->args->get_children( $event_slug, array( $action_object ) );
153
+					$event_args = $this->events->args->get_children($event_slug, array($action_object));
154 154
 
155
-					if ( empty( $event_args ) ) {
155
+					if (empty($event_args)) {
156 156
 						continue;
157 157
 					}
158 158
 
159
-					$event_args = new WordPoints_Hook_Event_Args( $event_args );
159
+					$event_args = new WordPoints_Hook_Event_Args($event_args);
160 160
 
161
-					$this->fire_event( $type, $event_slug, $event_args );
161
+					$this->fire_event($type, $event_slug, $event_args);
162 162
 				}
163 163
 			}
164 164
 		}
@@ -182,19 +182,19 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$hooks = wordpoints_hooks();
184 184
 
185
-		foreach ( $hooks->reaction_stores->get_all() as $reaction_stores ) {
186
-			foreach ( $reaction_stores as $reaction_store ) {
185
+		foreach ($hooks->reaction_stores->get_all() as $reaction_stores) {
186
+			foreach ($reaction_stores as $reaction_store) {
187 187
 
188
-				if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI ) {
188
+				if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI) {
189 189
 					continue;
190 190
 				}
191 191
 
192 192
 				// Allowing access to stores out-of-context would lead to strange behavior.
193
-				if ( false === $reaction_store->get_context_id() ) {
193
+				if (false === $reaction_store->get_context_id()) {
194 194
 					continue;
195 195
 				}
196 196
 
197
-				foreach ( $reaction_store->get_reactions_to_event( $event_slug ) as $reaction ) {
197
+				foreach ($reaction_store->get_reactions_to_event($event_slug) as $reaction) {
198 198
 
199 199
 					$fire = new WordPoints_Hook_Fire(
200 200
 						$action_type
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 						, $reaction
203 203
 					);
204 204
 
205
-					$this->fire_reaction( $fire );
205
+					$this->fire_reaction($fire);
206 206
 				}
207 207
 			}
208 208
 		}
@@ -215,32 +215,32 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @param WordPoints_Hook_Fire $fire The hook fire object.
217 217
 	 */
218
-	protected function fire_reaction( $fire ) {
218
+	protected function fire_reaction($fire) {
219 219
 
220 220
 		$hooks = wordpoints_hooks();
221 221
 
222 222
 		$reactor_slug = $fire->reaction->get_reactor_slug();
223 223
 
224
-		if ( ! isset( $this->reactor_index[ $reactor_slug ][ $fire->action_type ] ) ) {
224
+		if ( ! isset($this->reactor_index[$reactor_slug][$fire->action_type])) {
225 225
 			return;
226 226
 		}
227 227
 
228
-		$hit_type = $this->reactor_index[ $reactor_slug ][ $fire->action_type ];
228
+		$hit_type = $this->reactor_index[$reactor_slug][$fire->action_type];
229 229
 
230
-		$validator = new WordPoints_Hook_Reaction_Validator( $fire->reaction, true );
230
+		$validator = new WordPoints_Hook_Reaction_Validator($fire->reaction, true);
231 231
 		$validator->validate();
232 232
 
233
-		if ( $validator->had_errors() ) {
233
+		if ($validator->had_errors()) {
234 234
 			return;
235 235
 		}
236 236
 
237
-		unset( $validator );
237
+		unset($validator);
238 238
 
239 239
 		/** @var WordPoints_Hook_Extension[] $extensions */
240 240
 		$extensions = $hooks->extensions->get_all();
241 241
 
242
-		foreach ( $extensions as $extension ) {
243
-			if ( ! $extension->should_hit( $fire ) ) {
242
+		foreach ($extensions as $extension) {
243
+			if ( ! $extension->should_hit($fire)) {
244 244
 				return;
245 245
 			}
246 246
 		}
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 		$fire->hit();
249 249
 
250 250
 		/** @var WordPoints_Hook_Reactor $reactor */
251
-		$reactor = $hooks->reactors->get( $reactor_slug );
251
+		$reactor = $hooks->reactors->get($reactor_slug);
252 252
 
253
-		$reactor->hit( $hit_type, $fire );
253
+		$reactor->hit($hit_type, $fire);
254 254
 
255
-		foreach ( $extensions as $extension ) {
256
-			$extension->after_hit( $fire );
255
+		foreach ($extensions as $extension) {
256
+			$extension->after_hit($fire);
257 257
 		}
258 258
 	}
259 259
 
@@ -280,56 +280,56 @@  discard block
 block discarded – undo
280 280
 	 *        }
281 281
 	 * }
282 282
 	 */
283
-	public function add_action( $slug, array $args ) {
283
+	public function add_action($slug, array $args) {
284 284
 
285 285
 		$priority = 10;
286
-		if ( isset( $args['priority'] ) ) {
286
+		if (isset($args['priority'])) {
287 287
 			$priority = $args['priority'];
288 288
 		}
289 289
 
290
-		if ( ! isset( $args['action'] ) ) {
290
+		if ( ! isset($args['action'])) {
291 291
 			return;
292 292
 		}
293 293
 
294 294
 		$method = "{$args['action']},{$priority}";
295 295
 
296
-		$this->action_index[ $method ]['actions'][ $slug ] = array();
296
+		$this->action_index[$method]['actions'][$slug] = array();
297 297
 
298 298
 		$arg_number = 1;
299 299
 
300
-		if ( isset( $args['data'] ) ) {
300
+		if (isset($args['data'])) {
301 301
 
302
-			if ( isset( $args['data']['arg_index'] ) ) {
303
-				$arg_number = 1 + max( $args['data']['arg_index'] );
302
+			if (isset($args['data']['arg_index'])) {
303
+				$arg_number = 1 + max($args['data']['arg_index']);
304 304
 			}
305 305
 
306
-			if ( isset( $args['data']['requirements'] ) ) {
307
-				$requirements = 1 + max( array_keys( $args['data']['requirements'] ) );
306
+			if (isset($args['data']['requirements'])) {
307
+				$requirements = 1 + max(array_keys($args['data']['requirements']));
308 308
 
309
-				if ( $requirements > $arg_number ) {
309
+				if ($requirements > $arg_number) {
310 310
 					$arg_number = $requirements;
311 311
 				}
312 312
 			}
313 313
 
314
-			$this->action_index[ $method ]['actions'][ $slug ] = $args['data'];
314
+			$this->action_index[$method]['actions'][$slug] = $args['data'];
315 315
 		}
316 316
 
317
-		if ( isset( $args['arg_number'] ) ) {
317
+		if (isset($args['arg_number'])) {
318 318
 			$arg_number = $args['arg_number'];
319 319
 		}
320 320
 
321 321
 		// If this action is already being routed, and will have enough args, we
322 322
 		// don't need to hook to it again.
323 323
 		if (
324
-			isset( $this->action_index[ $method ]['arg_number'] )
325
-			&& $this->action_index[ $method ]['arg_number'] >= $arg_number
324
+			isset($this->action_index[$method]['arg_number'])
325
+			&& $this->action_index[$method]['arg_number'] >= $arg_number
326 326
 		) {
327 327
 			return;
328 328
 		}
329 329
 
330
-		$this->action_index[ $method ]['arg_number'] = $arg_number;
330
+		$this->action_index[$method]['arg_number'] = $arg_number;
331 331
 
332
-		add_action( $args['action'], array( $this, $method ), $priority, $arg_number );
332
+		add_action($args['action'], array($this, $method), $priority, $arg_number);
333 333
 	}
334 334
 
335 335
 	/**
@@ -339,20 +339,20 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @param string $slug The action slug.
341 341
 	 */
342
-	public function remove_action( $slug ) {
342
+	public function remove_action($slug) {
343 343
 
344
-		foreach ( $this->action_index as $method => $data ) {
345
-			if ( isset( $data['actions'][ $slug ] ) ) {
344
+		foreach ($this->action_index as $method => $data) {
345
+			if (isset($data['actions'][$slug])) {
346 346
 
347
-				unset( $this->action_index[ $method ]['actions'][ $slug ] );
347
+				unset($this->action_index[$method]['actions'][$slug]);
348 348
 
349
-				if ( empty( $this->action_index[ $method ]['actions'] ) ) {
349
+				if (empty($this->action_index[$method]['actions'])) {
350 350
 
351
-					unset( $this->action_index[ $method ] );
351
+					unset($this->action_index[$method]);
352 352
 
353
-					list( $action, $priority ) = explode( ',', $method );
353
+					list($action, $priority) = explode(',', $method);
354 354
 
355
-					remove_action( $action, array( $this, $method ), $priority );
355
+					remove_action($action, array($this, $method), $priority);
356 356
 				}
357 357
 			}
358 358
 		}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param string $action_slug The slug of the action.
368 368
 	 * @param string $action_type The type of action. Default is 'fire'.
369 369
 	 */
370
-	public function add_event_to_action( $event_slug, $action_slug, $action_type = 'fire' ) {
371
-		$this->event_index[ $action_slug ][ $action_type ][ $event_slug ] = true;
370
+	public function add_event_to_action($event_slug, $action_slug, $action_type = 'fire') {
371
+		$this->event_index[$action_slug][$action_type][$event_slug] = true;
372 372
 	}
373 373
 
374 374
 	/**
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 	 * @param string $action_slug The slug of the action.
381 381
 	 * @param string $action_type The type of action. Default is 'fire'.
382 382
 	 */
383
-	public function remove_event_from_action( $event_slug, $action_slug, $action_type = 'fire' ) {
384
-		unset( $this->event_index[ $action_slug ][ $action_type ][ $event_slug ] );
383
+	public function remove_event_from_action($event_slug, $action_slug, $action_type = 'fire') {
384
+		unset($this->event_index[$action_slug][$action_type][$event_slug]);
385 385
 	}
386 386
 
387 387
 	/**
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param string $hit_type     The type of hit the reactor should perform when
395 395
 	 *                             hit by this type of event.
396 396
 	 */
397
-	public function add_action_type_to_reactor( $action_type, $reactor_slug, $hit_type ) {
398
-		$this->reactor_index[ $reactor_slug ][ $action_type ] = $hit_type;
397
+	public function add_action_type_to_reactor($action_type, $reactor_slug, $hit_type) {
398
+		$this->reactor_index[$reactor_slug][$action_type] = $hit_type;
399 399
 	}
400 400
 
401 401
 	/**
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	 * @param string $action_type  The slug of the action type.
407 407
 	 * @param string $reactor_slug The slug of the reactor.
408 408
 	 */
409
-	public function remove_action_type_from_reactor( $action_type, $reactor_slug ) {
410
-		unset( $this->reactor_index[ $reactor_slug ][ $action_type ] );
409
+	public function remove_action_type_from_reactor($action_type, $reactor_slug) {
410
+		unset($this->reactor_index[$reactor_slug][$action_type]);
411 411
 	}
412 412
 
413 413
 	/**
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	public function get_event_index() {
421 421
 
422
-		if ( empty( $this->reactor_index ) ) {
422
+		if (empty($this->reactor_index)) {
423 423
 			wordpoints_hooks()->events;
424 424
 		}
425 425
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	public function get_reactor_index() {
437 437
 
438
-		if ( empty( $this->reactor_index ) ) {
438
+		if (empty($this->reactor_index)) {
439 439
 			wordpoints_hooks()->reactors;
440 440
 		}
441 441
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * @since 1.0.0
37 37
 	 */
38
-	public function __construct( $id, WordPoints_Hook_Reaction_StoreI $store ) {
38
+	public function __construct($id, WordPoints_Hook_Reaction_StoreI $store) {
39 39
 
40
-		$this->ID    = wordpoints_int( $id );
40
+		$this->ID    = wordpoints_int($id);
41 41
 		$this->store = $store;
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @since 1.0.0
46 46
 	 */
47
-	public function __get( $var ) {
47
+	public function __get($var) {
48 48
 
49
-		if ( 'ID' === $var ) {
49
+		if ('ID' === $var) {
50 50
 			return $this->ID;
51 51
 		}
52 52
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @since 1.0.0
70 70
 	 */
71 71
 	public function get_reactor_slug() {
72
-		return $this->get_meta( 'reactor' ); // TODO remove this method?
72
+		return $this->get_meta('reactor'); // TODO remove this method?
73 73
 	}
74 74
 
75 75
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor/points.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * @since 1.0.0
29 29
 	 */
30
-	protected $hit_types = array( 'award', 'reverse' );
30
+	protected $hit_types = array('award', 'reverse');
31 31
 
32 32
 	/**
33 33
 	 * @since 1.0.0
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function get_settings_fields() {
60 60
 
61
-		$this->settings_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' );
62
-		$this->settings_fields['log_text']['label'] = _x( 'Log Text', 'form label', 'wordpoints' );
63
-		$this->settings_fields['description']['label'] = _x( 'Description', 'form label', 'wordpoints' );
61
+		$this->settings_fields['points']['label'] = _x('Points', 'form label', 'wordpoints');
62
+		$this->settings_fields['log_text']['label'] = _x('Log Text', 'form label', 'wordpoints');
63
+		$this->settings_fields['description']['label'] = _x('Description', 'form label', 'wordpoints');
64 64
 
65 65
 		return parent::get_settings_fields();
66 66
 	}
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
 		$data = parent::get_ui_script_data();
74 74
 
75
-		$data['target_label'] = __( 'Award To', 'wordpoints' );
76
-		$data['periods_label'] = __( 'Award each user no more than once per:', 'wordpoints' );
75
+		$data['target_label'] = __('Award To', 'wordpoints');
76
+		$data['periods_label'] = __('Award each user no more than once per:', 'wordpoints');
77 77
 
78 78
 		return $data;
79 79
 	}
@@ -87,23 +87,23 @@  discard block
 block discarded – undo
87 87
 		WordPoints_Hook_Event_Args $event_args
88 88
 	) {
89 89
 
90
-		if ( ! isset( $settings['points'] ) || false === wordpoints_int( $settings['points'] ) ) {
91
-			$validator->add_error( __( 'Points must be an integer.', 'wordpoints' ), 'points' );
90
+		if ( ! isset($settings['points']) || false === wordpoints_int($settings['points'])) {
91
+			$validator->add_error(__('Points must be an integer.', 'wordpoints'), 'points');
92 92
 		}
93 93
 
94
-		if ( ! isset( $settings['points_type'] ) || ! wordpoints_is_points_type( $settings['points_type'] ) ) {
95
-			$validator->add_error( __( 'Invalid points type.', 'wordpoints' ), 'points_type' );
94
+		if ( ! isset($settings['points_type']) || ! wordpoints_is_points_type($settings['points_type'])) {
95
+			$validator->add_error(__('Invalid points type.', 'wordpoints'), 'points_type');
96 96
 		}
97 97
 
98
-		if ( ! isset( $settings['description'] ) ) {
99
-			$validator->add_error( __( 'Description is required.', 'wordpoints' ), 'description' );
98
+		if ( ! isset($settings['description'])) {
99
+			$validator->add_error(__('Description is required.', 'wordpoints'), 'description');
100 100
 		}
101 101
 
102
-		if ( ! isset( $settings['log_text'] ) ) {
103
-			$validator->add_error( __( 'Log Text is required.', 'wordpoints' ), 'log_text' );
102
+		if ( ! isset($settings['log_text'])) {
103
+			$validator->add_error(__('Log Text is required.', 'wordpoints'), 'log_text');
104 104
 		}
105 105
 
106
-		return parent::validate_settings( $settings, $validator, $event_args );
106
+		return parent::validate_settings($settings, $validator, $event_args);
107 107
 	}
108 108
 
109 109
 	/**
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 		array $settings
115 115
 	) {
116 116
 
117
-		parent::update_settings( $reaction, $settings );
117
+		parent::update_settings($reaction, $settings);
118 118
 
119
-		$reaction->update_meta( 'points', $settings['points'] );
120
-		$reaction->update_meta( 'points_type', $settings['points_type'] );
121
-		$reaction->update_meta( 'description', $settings['description'] );
122
-		$reaction->update_meta( 'log_text', $settings['log_text'] );
119
+		$reaction->update_meta('points', $settings['points']);
120
+		$reaction->update_meta('points_type', $settings['points_type']);
121
+		$reaction->update_meta('description', $settings['description']);
122
+		$reaction->update_meta('log_text', $settings['log_text']);
123 123
 	}
124 124
 
125 125
 	/**
@@ -129,31 +129,31 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @param WordPoints_Hook_Fire $fire The hook fire object.
131 131
 	 */
132
-	protected function award( WordPoints_Hook_Fire $fire ) {
132
+	protected function award(WordPoints_Hook_Fire $fire) {
133 133
 
134 134
 		$reaction = $fire->reaction;
135 135
 
136 136
 		$target = $fire->event_args->get_from_hierarchy(
137
-			$reaction->get_meta( 'target' )
137
+			$reaction->get_meta('target')
138 138
 		);
139 139
 
140
-		if ( ! $target instanceof WordPoints_Entity ) {
140
+		if ( ! $target instanceof WordPoints_Entity) {
141 141
 			return;
142 142
 		}
143 143
 
144 144
 		$meta = array();
145 145
 
146
-		foreach ( $fire->event_args->get_entities() as $entity ) {
147
-			$meta[ $entity->get_slug() ] = $entity->get_the_id();
146
+		foreach ($fire->event_args->get_entities() as $entity) {
147
+			$meta[$entity->get_slug()] = $entity->get_the_id();
148 148
 		}
149 149
 
150 150
 		wordpoints_alter_points(
151 151
 			$target->get_the_id()
152
-			, $reaction->get_meta( 'points' )
153
-			, $reaction->get_meta( 'points_type' )
152
+			, $reaction->get_meta('points')
153
+			, $reaction->get_meta('points_type')
154 154
 			, $reaction->get_event_slug()
155 155
 			, $meta
156
-			, $reaction->get_meta( 'log_text' )
156
+			, $reaction->get_meta('log_text')
157 157
 		);
158 158
 	}
159 159
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @param WordPoints_Hook_Fire $fire The fire object.
166 166
 	 */
167
-	protected function reverse( WordPoints_Hook_Fire $fire ) {
167
+	protected function reverse(WordPoints_Hook_Fire $fire) {
168 168
 
169 169
 		$meta_queries = array(
170 170
 			array(
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			),
176 176
 		);
177 177
 
178
-		foreach ( $fire->event_args->get_entities() as $slug => $entity ) {
178
+		foreach ($fire->event_args->get_entities() as $slug => $entity) {
179 179
 
180 180
 			$meta_queries[] = array(
181 181
 				'key'   => $slug,
@@ -192,35 +192,35 @@  discard block
 block discarded – undo
192 192
 
193 193
 		$logs = $query->get();
194 194
 
195
-		if ( ! $logs ) {
195
+		if ( ! $logs) {
196 196
 			return;
197 197
 		}
198 198
 
199 199
 		global $wpdb;
200 200
 
201
-		add_filter( 'wordpoints_points_log', '__return_false' );
201
+		add_filter('wordpoints_points_log', '__return_false');
202 202
 
203
-		foreach ( $logs as $log ) {
203
+		foreach ($logs as $log) {
204 204
 
205 205
 			wordpoints_alter_points(
206 206
 				$log->user_id
207 207
 				, -$log->points
208 208
 				, $log->points_type
209 209
 				, "reverse-{$log->log_type}"
210
-				, array( 'original_log_id' => $log->id )
210
+				, array('original_log_id' => $log->id)
211 211
 			);
212 212
 
213
-			wordpoints_points_log_delete_all_metadata( $log->id );
213
+			wordpoints_points_log_delete_all_metadata($log->id);
214 214
 
215 215
 			// Now delete the log.
216 216
 			$wpdb->delete(
217 217
 				$wpdb->wordpoints_points_logs
218
-				, array( 'id' => $log->id )
218
+				, array('id' => $log->id)
219 219
 				, '%d'
220 220
 			); // WPCS: cache OK, cleaned by wordpoints_alter_points().
221 221
 		}
222 222
 
223
-		remove_filter( 'wordpoints_points_log', '__return_false' );
223
+		remove_filter('wordpoints_points_log', '__return_false');
224 224
 	}
225 225
 }
226 226
 
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/validator.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 	 * @param bool                            $fail_fast Whether to fail as soon as
104 104
 	 *                                                   the first error is found.
105 105
 	 */
106
-	public function __construct( $settings, $fail_fast = false ) {
106
+	public function __construct($settings, $fail_fast = false) {
107 107
 
108 108
 		$this->fail_fast = $fail_fast;
109 109
 		$this->hooks = wordpoints_hooks();
110 110
 
111
-		if ( $settings instanceof WordPoints_Hook_ReactionI ) {
111
+		if ($settings instanceof WordPoints_Hook_ReactionI) {
112 112
 
113 113
 			$this->reaction     = $settings;
114 114
 			$this->settings     = $this->reaction->get_all_meta();
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 
120 120
 			$this->settings = $settings;
121 121
 
122
-			if ( isset( $this->settings['event'] ) ) {
122
+			if (isset($this->settings['event'])) {
123 123
 				$this->event_slug = $this->settings['event'];
124 124
 			}
125 125
 
126
-			if ( isset( $this->settings['reactor'] ) ) {
126
+			if (isset($this->settings['reactor'])) {
127 127
 				$this->reactor_slug = $this->settings['reactor'];
128 128
 			}
129 129
 		}
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 			$fail_fast = $this->fail_fast;
147 147
 			$this->fail_fast = true;
148 148
 
149
-			if ( ! isset( $this->event_slug ) ) {
150
-				$this->add_error( __( 'Event is missing.', 'wordpoints' ), 'event' );
151
-			} elseif ( ! $this->hooks->events->is_registered( $this->event_slug ) ) {
152
-				$this->add_error( __( 'Event is invalid.', 'wordpoints' ), 'event' );
149
+			if ( ! isset($this->event_slug)) {
150
+				$this->add_error(__('Event is missing.', 'wordpoints'), 'event');
151
+			} elseif ( ! $this->hooks->events->is_registered($this->event_slug)) {
152
+				$this->add_error(__('Event is invalid.', 'wordpoints'), 'event');
153 153
 			}
154 154
 
155
-			if ( ! isset( $this->reactor_slug ) ) {
156
-				$this->add_error( __( 'Reactor is missing.', 'wordpoints' ), 'reactor' );
157
-			} elseif ( ! $this->hooks->reactors->is_registered( $this->reactor_slug ) ) {
158
-				$this->add_error( __( 'Reactor is invalid.', 'wordpoints' ), 'reactor' );
155
+			if ( ! isset($this->reactor_slug)) {
156
+				$this->add_error(__('Reactor is missing.', 'wordpoints'), 'reactor');
157
+			} elseif ( ! $this->hooks->reactors->is_registered($this->reactor_slug)) {
158
+				$this->add_error(__('Reactor is invalid.', 'wordpoints'), 'reactor');
159 159
 			}
160 160
 
161 161
 			// From here on out we can collect errors as they come (unless we are
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
 				$this->event_slug
167 167
 			);
168 168
 
169
-			$this->event_args = new WordPoints_Hook_Event_Args( $event_args );
170
-			$this->event_args->set_validator( $this );
169
+			$this->event_args = new WordPoints_Hook_Event_Args($event_args);
170
+			$this->event_args->set_validator($this);
171 171
 
172
-			$reactor = $this->hooks->reactors->get( $this->reactor_slug );
172
+			$reactor = $this->hooks->reactors->get($this->reactor_slug);
173 173
 
174
-			$this->settings = $reactor->validate_settings( $this->settings, $this, $this->event_args );
174
+			$this->settings = $reactor->validate_settings($this->settings, $this, $this->event_args);
175 175
 
176 176
 			/** @var WordPoints_Hook_Extension $extension */
177
-			foreach ( $this->hooks->extensions->get_all() as $extension ) {
178
-				$this->settings = $extension->validate_settings( $this->settings, $this, $this->event_args );
177
+			foreach ($this->hooks->extensions->get_all() as $extension) {
178
+				$this->settings = $extension->validate_settings($this->settings, $this, $this->event_args);
179 179
 			}
180 180
 
181 181
 			/**
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 			 * @param WordPoints_Hook_Reaction_Validator $validator The validator object.
186 186
 			 * @param WordPoints_Hook_Event_Args         $args      The event args object.
187 187
 			 */
188
-			$this->settings = apply_filters( 'wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args );
188
+			$this->settings = apply_filters('wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args);
189 189
 
190
-		} catch ( WordPoints_Hook_Validator_Exception $e ) {
190
+		} catch (WordPoints_Hook_Validator_Exception $e) {
191 191
 
192 192
 			// Do nothing.
193
-			unset( $e );
193
+			unset($e);
194 194
 		}
195 195
 
196 196
 		return $this->settings;
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
 	 * @throws WordPoints_Hook_Validator_Exception If the validator is configured to
219 219
 	 *                                             fail as soon as an error is found.
220 220
 	 */
221
-	public function add_error( $message, $field = null ) {
221
+	public function add_error($message, $field = null) {
222 222
 
223 223
 		$field_stack = $this->field_stack;
224 224
 
225
-		if ( null !== $field ) {
225
+		if (null !== $field) {
226 226
 			$field_stack[] = $field;
227 227
 		}
228 228
 
229
-		$this->errors[] = array( 'message' => $message, 'field' => $field_stack );
229
+		$this->errors[] = array('message' => $message, 'field' => $field_stack);
230 230
 
231
-		if ( $this->fail_fast ) {
231
+		if ($this->fail_fast) {
232 232
 			throw new WordPoints_Hook_Validator_Exception;
233 233
 		}
234 234
 	}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @return bool Whether the validator found any errors.
242 242
 	 */
243 243
 	public function had_errors() {
244
-		return ! empty( $this->errors );
244
+		return ! empty($this->errors);
245 245
 	}
246 246
 
247 247
 	/**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 *
263 263
 	 * @param string $field The field.
264 264
 	 */
265
-	public function push_field( $field ) {
265
+	public function push_field($field) {
266 266
 		$this->field_stack[] = $field;
267 267
 	}
268 268
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @since 1.0.0
273 273
 	 */
274 274
 	public function pop_field() {
275
-		array_pop( $this->field_stack );
275
+		array_pop($this->field_stack);
276 276
 	}
277 277
 
278 278
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function get_id() {
319 319
 
320
-		if ( ! $this->reaction ) {
320
+		if ( ! $this->reaction) {
321 321
 			return false;
322 322
 		}
323 323
 
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return mixed The meta value.
357 357
 	 */
358
-	public function get_meta( $key ) {
358
+	public function get_meta($key) {
359 359
 
360
-		if ( ! isset( $this->settings[ $key ] ) ) {
360
+		if ( ! isset($this->settings[$key])) {
361 361
 			return null;
362 362
 		}
363 363
 
364
-		return $this->settings[ $key ];
364
+		return $this->settings[$key];
365 365
 	}
366 366
 
367 367
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storei.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param string $slug The slug of this store.
26 26
 	 */
27
-	public function __construct( $slug );
27
+	public function __construct($slug);
28 28
 
29 29
 	/**
30 30
 	 * Get the slug of this reaction store.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return bool Whether the reaction exists.
61 61
 	 */
62
-	public function reaction_exists( $id );
62
+	public function reaction_exists($id);
63 63
 
64 64
 	/**
65 65
 	 * Get an reaction object.
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return WordPoints_Hook_ReactionI|false The reaction, or false if nonexistent.
72 72
 	 */
73
-	public function get_reaction( $id );
73
+	public function get_reaction($id);
74 74
 
75 75
 	/**
76 76
 	 * Create an reaction.
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *         The reaction object if created successfully. False or a validator
84 84
 	 *         instance if not.
85 85
 	 */
86
-	public function create_reaction( array $settings );
86
+	public function create_reaction(array $settings);
87 87
 
88 88
 	/**
89 89
 	 * Update an reaction.
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *         The reaction object if updated successfully. False or a validator
98 98
 	 *         instance if not.
99 99
 	 */
100
-	public function update_reaction( $id, array $settings );
100
+	public function update_reaction($id, array $settings);
101 101
 
102 102
 	/**
103 103
 	 * Delete an reaction.
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool Whether the reaction was deleted successfully.
110 110
 	 */
111
-	public function delete_reaction( $id );
111
+	public function delete_reaction($id);
112 112
 
113 113
 	/**
114 114
 	 * Get all hook reactions for the reactor.
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return WordPoints_Hook_ReactionI[]
133 133
 	 */
134
-	public function get_reactions_to_event( $event_slug );
134
+	public function get_reactions_to_event($event_slug);
135 135
 }
136 136
 
137 137
 // EOF
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( 'reactors', 'WordPoints_Class_Registry_Persistent' );
53
-		$sub_apps->register( 'reaction_stores', 'WordPoints_Class_Registry_Children' );
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('reactors', 'WordPoints_Class_Registry_Persistent');
53
+		$sub_apps->register('reaction_stores', 'WordPoints_Class_Registry_Children');
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
 	}
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function get_current_mode() {
77 77
 
78
-		if ( ! isset( $this->current_mode ) ) {
79
-			$this->current_mode = ( wordpoints_is_network_context() ? 'network' : 'standard' );
78
+		if ( ! isset($this->current_mode)) {
79
+			$this->current_mode = (wordpoints_is_network_context() ? 'network' : 'standard');
80 80
 		}
81 81
 
82 82
 		return $this->current_mode;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @param string $mode The slug of the mode to set as the current mode.
96 96
 	 */
97
-	public function set_current_mode( $mode ) {
97
+	public function set_current_mode($mode) {
98 98
 		$this->current_mode = $mode;
99 99
 	}
100 100
 
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return WordPoints_Hook_Reaction_StoreI|false The reaction storage object.
109 109
 	 */
110
-	public function get_reaction_store( $slug ) {
110
+	public function get_reaction_store($slug) {
111 111
 
112 112
 		$reaction_store = $this->reaction_stores->get(
113 113
 			$this->get_current_mode()
114 114
 			, $slug
115 115
 		);
116 116
 
117
-		if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI ) {
117
+		if ( ! $reaction_store instanceof WordPoints_Hook_Reaction_StoreI) {
118 118
 			return false;
119 119
 		}
120 120
 
121 121
 		// Allowing access to stores out-of-context would lead to strange behavior.
122
-		if ( false === $reaction_store->get_context_id() ) {
122
+		if (false === $reaction_store->get_context_id()) {
123 123
 			return false;
124 124
 		}
125 125
 
Please login to merge, or discard this patch.