Completed
Push — master ( faeb69...3d46b5 )
by J.D.
02:57
created
src/includes/classes/hook/event/user/visit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 	 * @since 1.0.0
19 19
 	 */
20 20
 	public function get_title() {
21
-		return __( 'Visit', 'wordpoints' );
21
+		return __('Visit', 'wordpoints');
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @since 1.0.0
26 26
 	 */
27 27
 	public function get_description() {
28
-		return __( 'When a logged-in user or guest visits the site.', 'wordpoints' );
28
+		return __('When a logged-in user or guest visits the site.', 'wordpoints');
29 29
 	}
30 30
 }
31 31
 
Please login to merge, or discard this patch.
src/includes/classes/hook/eventi.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 	/**
18 18
 	 * @param string $slug The event slug.
19 19
 	 */
20
-	public function __construct( $slug );
20
+	public function __construct($slug);
21 21
 
22 22
 	/**
23 23
 	 * Get the event slug.
Please login to merge, or discard this patch.
src/includes/classes/hook/events.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @since 1.0.0
39 39
 	 */
40
-	public function __construct( $slug ) {
40
+	public function __construct($slug) {
41 41
 
42 42
 		$hooks = wordpoints_hooks();
43 43
 
44 44
 		$this->router = $hooks->router;
45 45
 
46
-		parent::__construct( $slug );
46
+		parent::__construct($slug);
47 47
 	}
48 48
 
49 49
 	/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function init() {
53 53
 
54
-		$this->sub_apps->register( 'args', 'WordPoints_Class_Registry_Children' );
54
+		$this->sub_apps->register('args', 'WordPoints_Class_Registry_Children');
55 55
 
56 56
 		parent::init();
57 57
 	}
@@ -75,29 +75,29 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return bool Whether the event was registered.
77 77
 	 */
78
-	public function register( $slug, $class, array $args = array() ) {
78
+	public function register($slug, $class, array $args = array()) {
79 79
 
80 80
 		// TODO shoudl this be required?
81
-		if ( ! isset( $args['actions'] ) ) {
81
+		if ( ! isset($args['actions'])) {
82 82
 			return false;
83 83
 		}
84 84
 
85
-		parent::register( $slug, $class, $args );
85
+		parent::register($slug, $class, $args);
86 86
 
87
-		foreach ( $args['actions'] as $type => $actions ) {
88
-			foreach ( (array) $actions as $action_slug ) {
89
-				$this->router->add_event_to_action( $slug, $action_slug, $type );
87
+		foreach ($args['actions'] as $type => $actions) {
88
+			foreach ((array) $actions as $action_slug) {
89
+				$this->router->add_event_to_action($slug, $action_slug, $type);
90 90
 			}
91 91
 		}
92 92
 
93 93
 		// TODO should this be required?
94
-		if ( isset( $args['args'] ) ) {
95
-			foreach ( $args['args'] as $arg_slug => $class ) {
96
-				$this->args->register( $slug, $arg_slug, $class );
94
+		if (isset($args['args'])) {
95
+			foreach ($args['args'] as $arg_slug => $class) {
96
+				$this->args->register($slug, $arg_slug, $class);
97 97
 			}
98 98
 		}
99 99
 
100
-		$this->event_data[ $slug ] = $args;
100
+		$this->event_data[$slug] = $args;
101 101
 
102 102
 		return true;
103 103
 	}
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @since 1.0.0
107 107
 	 */
108
-	public function deregister( $slug ) {
108
+	public function deregister($slug) {
109 109
 
110
-		if ( ! $this->is_registered( $slug ) ) {
110
+		if ( ! $this->is_registered($slug)) {
111 111
 			return;
112 112
 		}
113 113
 
114
-		parent::deregister( $slug );
114
+		parent::deregister($slug);
115 115
 
116
-		foreach ( (array) $this->event_data[ $slug ]['actions'] as $type => $actions ) {
117
-			foreach ( (array) $actions as $action_slug ) {
118
-				$this->router->remove_event_from_action( $slug, $action_slug, $type );
116
+		foreach ((array) $this->event_data[$slug]['actions'] as $type => $actions) {
117
+			foreach ((array) $actions as $action_slug) {
118
+				$this->router->remove_event_from_action($slug, $action_slug, $type);
119 119
 			}
120 120
 		}
121 121
 
122
-		$this->args->deregister_children( $slug );
122
+		$this->args->deregister_children($slug);
123 123
 
124
-		unset( $this->event_data[ $slug ] );
124
+		unset($this->event_data[$slug]);
125 125
 	}
126 126
 }
127 127
 
Please login to merge, or discard this patch.
src/includes/classes/hook/extension.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 		WordPoints_Hook_Event_Args $event_args
66 66
 	) {
67 67
 
68
-		if ( ! isset( $settings[ $this->slug ] ) ) {
68
+		if ( ! isset($settings[$this->slug])) {
69 69
 			return $settings;
70 70
 		}
71 71
 
72 72
 		$this->validator = $validator;
73 73
 		$this->event_args = $event_args;
74 74
 
75
-		$this->validator->push_field( $this->slug );
76
-		$settings[ $this->slug ] = $this->{"validate_{$this->slug}"}( $settings[ $this->slug ] );
75
+		$this->validator->push_field($this->slug);
76
+		$settings[$this->slug] = $this->{"validate_{$this->slug}"}($settings[$this->slug]);
77 77
 		$this->validator->pop_field();
78 78
 
79 79
 		return $settings;
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 	/**
83 83
 	 * @since 1.0.0
84 84
 	 */
85
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
85
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
86 86
 
87
-		if ( isset( $settings[ $this->slug ] ) ) {
88
-			$reaction->update_meta( $this->slug, $settings[ $this->slug ] );
87
+		if (isset($settings[$this->slug])) {
88
+			$reaction->update_meta($this->slug, $settings[$this->slug]);
89 89
 		} else {
90
-			$reaction->delete_meta( $this->slug );
90
+			$reaction->delete_meta($this->slug);
91 91
 		}
92 92
 	}
93 93
 
Please login to merge, or discard this patch.
src/includes/classes/hook/firer/reverse.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) {
20
+	public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) {
21 21
 
22 22
 		$hooks = wordpoints_hooks();
23 23
 
24
-		foreach ( $hooks->reactors->get_all() as $reactor ) {
24
+		foreach ($hooks->reactors->get_all() as $reactor) {
25 25
 
26
-			if ( ! ( $reactor instanceof WordPoints_Hook_Reactor_ReverseI ) ) {
26
+			if ( ! ($reactor instanceof WordPoints_Hook_Reactor_ReverseI)) {
27 27
 				continue;
28 28
 			}
29 29
 
30
-			$reactor->reverse_hits( $event_slug, $event_args );
30
+			$reactor->reverse_hits($event_slug, $event_args);
31 31
 
32
-			foreach ( $hooks->extensions->get_all() as $extension ) {
33
-				if ( $extension instanceof WordPoints_Hook_Extension_ReverseI ) {
34
-					$extension->after_reverse( $event_slug, $event_args, $reactor );
32
+			foreach ($hooks->extensions->get_all() as $extension) {
33
+				if ($extension instanceof WordPoints_Hook_Extension_ReverseI) {
34
+					$extension->after_reverse($event_slug, $event_args, $reactor);
35 35
 				}
36 36
 			}
37 37
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/firer/spam.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ) {
20
+	public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args) {
21 21
 
22 22
 		$hooks = wordpoints_hooks();
23 23
 
24
-		foreach ( $hooks->reactors->get_all() as $reactor ) {
24
+		foreach ($hooks->reactors->get_all() as $reactor) {
25 25
 
26
-			if ( ! ( $reactor instanceof WordPoints_Hook_Reactor_SpamI ) ) {
26
+			if ( ! ($reactor instanceof WordPoints_Hook_Reactor_SpamI)) {
27 27
 				continue;
28 28
 			}
29 29
 
30
-			$reactor->spam_hits( $event_slug, $event_args );
30
+			$reactor->spam_hits($event_slug, $event_args);
31 31
 
32
-			foreach ( $hooks->extensions->get_all() as $extension ) {
33
-				if ( $extension instanceof WordPoints_Hook_Extension_SpamI ) {
34
-					$extension->after_spam( $event_slug, $event_args, $reactor );
32
+			foreach ($hooks->extensions->get_all() as $extension) {
33
+				if ($extension instanceof WordPoints_Hook_Extension_SpamI) {
34
+					$extension->after_spam($event_slug, $event_args, $reactor);
35 35
 				}
36 36
 			}
37 37
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/fireri.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 * @param string                     $event_slug The event slug.
23 23
 	 * @param WordPoints_Hook_Event_Args $event_args The event args.
24 24
 	 */
25
-	public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args );
25
+	public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args);
26 26
 }
27 27
 
28 28
 // EOF
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/options.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	 * @since 1.0.0
26 26
 	 */
27 27
 	public function get_event_slug() {
28
-		return $this->storage->get_reaction_event_from_index( $this->ID );
28
+		return $this->storage->get_reaction_event_from_index($this->ID);
29 29
 	}
30 30
 
31 31
 	/**
32 32
 	 * @since 1.0.0
33 33
 	 */
34
-	public function update_event_slug( $event_slug ) {
34
+	public function update_event_slug($event_slug) {
35 35
 		return $this->storage->update_reaction_event_in_index(
36 36
 			$this->ID
37 37
 			, $event_slug
@@ -41,63 +41,63 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @since 1.0.0
43 43
 	 */
44
-	public function get_meta( $key ) {
44
+	public function get_meta($key) {
45 45
 
46 46
 		$settings = $this->get_settings();
47 47
 
48
-		if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) {
48
+		if ( ! is_array($settings) || ! isset($settings[$key])) {
49 49
 			return false;
50 50
 		}
51 51
 
52
-		return $settings[ $key ];
52
+		return $settings[$key];
53 53
 	}
54 54
 
55 55
 	/**
56 56
 	 * @since 1.0.0
57 57
 	 */
58
-	public function add_meta( $key, $value ) {
58
+	public function add_meta($key, $value) {
59 59
 
60 60
 		$settings = $this->get_settings();
61 61
 
62
-		if ( ! is_array( $settings ) || isset( $settings[ $key ] ) ) {
62
+		if ( ! is_array($settings) || isset($settings[$key])) {
63 63
 			return false;
64 64
 		}
65 65
 
66
-		$settings[ $key ] = $value;
66
+		$settings[$key] = $value;
67 67
 
68
-		return $this->update_settings( $settings );
68
+		return $this->update_settings($settings);
69 69
 	}
70 70
 
71 71
 	/**
72 72
 	 * @since 1.0.0
73 73
 	 */
74
-	public function update_meta( $key, $value ) {
74
+	public function update_meta($key, $value) {
75 75
 
76 76
 		$settings = $this->get_settings();
77 77
 
78
-		if ( ! is_array( $settings ) ) {
78
+		if ( ! is_array($settings)) {
79 79
 			return false;
80 80
 		}
81 81
 
82
-		$settings[ $key ] = $value;
82
+		$settings[$key] = $value;
83 83
 
84
-		return $this->update_settings( $settings );
84
+		return $this->update_settings($settings);
85 85
 	}
86 86
 
87 87
 	/**
88 88
 	 * @since 1.0.0
89 89
 	 */
90
-	public function delete_meta( $key ) {
90
+	public function delete_meta($key) {
91 91
 
92 92
 		$settings = $this->get_settings();
93 93
 
94
-		if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) {
94
+		if ( ! is_array($settings) || ! isset($settings[$key])) {
95 95
 			return false;
96 96
 		}
97 97
 
98
-		unset( $settings[ $key ] );
98
+		unset($settings[$key]);
99 99
 
100
-		return $this->update_settings( $settings );
100
+		return $this->update_settings($settings);
101 101
 	}
102 102
 
103 103
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	protected function get_settings() {
118 118
 
119 119
 		return $this->storage->get_option(
120
-			$this->storage->get_settings_option_name( $this->ID )
120
+			$this->storage->get_settings_option_name($this->ID)
121 121
 		);
122 122
 	}
123 123
 
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return bool Whether the settings were updated successfully.
132 132
 	 */
133
-	protected function update_settings( $settings ) {
133
+	protected function update_settings($settings) {
134 134
 
135 135
 		return $this->storage->update_option(
136
-			$this->storage->get_settings_option_name( $this->ID )
136
+			$this->storage->get_settings_option_name($this->ID)
137 137
 			, $settings
138 138
 		);
139 139
 	}
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/storage/options.php 1 patch
Spacing   +43 added lines, -43 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,53 +162,53 @@  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 191
 		$id = 1;
192 192
 
193 193
 		// TODO this is fragile when the newest reaction gets deleted.
194
-		if ( ! empty( $index ) ) {
195
-			$id = 1 + max( array_keys( $index ) );
194
+		if ( ! empty($index)) {
195
+			$id = 1 + max(array_keys($index));
196 196
 		}
197 197
 
198
-		$settings = array( 'event' => $event_slug );
198
+		$settings = array('event' => $event_slug);
199 199
 
200 200
 		$result = $this->add_option(
201
-			$this->get_settings_option_name( $id )
201
+			$this->get_settings_option_name($id)
202 202
 			, $settings
203 203
 		);
204 204
 
205
-		if ( ! $result ) {
205
+		if ( ! $result) {
206 206
 			return false;
207 207
 		}
208 208
 
209
-		$index[ $id ] = array( 'event' => $event_slug, 'id' => $id );
209
+		$index[$id] = array('event' => $event_slug, 'id' => $id);
210 210
 
211
-		if ( ! $this->update_reaction_index( $index ) ) {
211
+		if ( ! $this->update_reaction_index($index)) {
212 212
 			return false;
213 213
 		}
214 214
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @return mixed The option value, or false.
228 228
 	 */
229
-	public function get_option( $name ) {
230
-		return get_option( $name );
229
+	public function get_option($name) {
230
+		return get_option($name);
231 231
 	}
232 232
 
233 233
 	/**
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool Whether the option was added successfully.
242 242
 	 */
243
-	protected function add_option( $name, $value ) {
244
-		return add_option( $name, $value );
243
+	protected function add_option($name, $value) {
244
+		return add_option($name, $value);
245 245
 	}
246 246
 
247 247
 	/**
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return bool Whether the option was updated successfully.
258 258
 	 */
259
-	public function update_option( $name, $value ) {
260
-		return update_option( $name, $value );
259
+	public function update_option($name, $value) {
260
+		return update_option($name, $value);
261 261
 	}
262 262
 
263 263
 	/**
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return bool Whether the option was deleted successfully.
271 271
 	 */
272
-	protected function delete_option( $name ) {
273
-		return delete_option( $name );
272
+	protected function delete_option($name) {
273
+		return delete_option($name);
274 274
 	}
275 275
 
276 276
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @return string The name of the option where the settings are stored.
284 284
 	 */
285
-	public function get_settings_option_name( $id ) {
285
+	public function get_settings_option_name($id) {
286 286
 		return "wordpoints_{$this->reactor_slug}_hook_reaction-{$id}";
287 287
 	}
288 288
 
Please login to merge, or discard this patch.