Completed
Push — master ( 13507f...637b3c )
by J.D.
14:42
created
src/includes/classes/entity/term.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function get_title() {
31 31
 
32
-		$taxonomy = get_taxonomy( substr( $this->slug, 5 /* term\ */ ) );
32
+		$taxonomy = get_taxonomy(substr($this->slug, 5 /* term\ */));
33 33
 
34
-		if ( $taxonomy ) {
34
+		if ($taxonomy) {
35 35
 			return $taxonomy->labels->singular_name;
36 36
 		} else {
37 37
 			return $this->slug;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @since 1.0.0
43 43
 	 */
44
-	public function get_entity( $id ) {
45
-		return get_term( $id, 'taxonomy' );
44
+	public function get_entity($id) {
45
+		return get_term($id, 'taxonomy');
46 46
 	}
47 47
 }
48 48
 
Please login to merge, or discard this patch.
src/includes/classes/entity/post/terms.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function get_title() {
31 31
 
32
-		$taxonomy = get_taxonomy( substr( $this->slug, 6 /* terms\ */ ) );
32
+		$taxonomy = get_taxonomy(substr($this->slug, 6 /* terms\ */));
33 33
 
34
-		if ( $taxonomy ) {
34
+		if ($taxonomy) {
35 35
 			return $taxonomy->labels->name;
36 36
 		} else {
37 37
 			return parent::get_title();
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @since 1.0.0
43 43
 	 */
44
-	protected function get_related_entity_ids( WordPoints_Entity $entity ) {
44
+	protected function get_related_entity_ids(WordPoints_Entity $entity) {
45 45
 
46 46
 		$id = $entity->get_the_id();
47 47
 
48
-		$taxonomies = get_object_taxonomies( get_post( $id ) );
48
+		$taxonomies = get_object_taxonomies(get_post($id));
49 49
 
50
-		return wp_get_object_terms( $id, $taxonomies, array( 'fields' => 'ids' ) );
50
+		return wp_get_object_terms($id, $taxonomies, array('fields' => 'ids'));
51 51
 	}
52 52
 }
53 53
 
Please login to merge, or discard this patch.
src/includes/classes/app.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @since 1.0.0
99 99
 	 */
100
-	public function __construct( $slug, $parent = null ) {
100
+	public function __construct($slug, $parent = null) {
101 101
 
102 102
 		$this->slug = $slug;
103 103
 		$this->full_slug = $slug;
104 104
 
105
-		if ( $parent instanceof WordPoints_App ) {
105
+		if ($parent instanceof WordPoints_App) {
106 106
 			$this->parent = $parent;
107 107
 
108
-			if ( 'apps' !== $this->parent->full_slug ) {
109
-				$this->full_slug = $this->parent->full_slug . '-' . $this->full_slug;
108
+			if ('apps' !== $this->parent->full_slug) {
109
+				$this->full_slug = $this->parent->full_slug.'-'.$this->full_slug;
110 110
 			}
111 111
 		}
112 112
 
@@ -118,32 +118,32 @@  discard block
 block discarded – undo
118 118
 	/**
119 119
 	 * @since 1.0.0
120 120
 	 */
121
-	public function __isset( $var ) {
122
-		return $this->sub_apps->is_registered( $var );
121
+	public function __isset($var) {
122
+		return $this->sub_apps->is_registered($var);
123 123
 	}
124 124
 
125 125
 	/**
126 126
 	 * @since 1.0.0
127 127
 	 */
128
-	public function __get( $var ) {
128
+	public function __get($var) {
129 129
 
130
-		if ( 'sub_apps' === $var ) {
130
+		if ('sub_apps' === $var) {
131 131
 			return $this->$var;
132 132
 		}
133 133
 
134
-		$sub = $this->sub_apps->get( $var, array( $this ) );
134
+		$sub = $this->sub_apps->get($var, array($this));
135 135
 
136
-		if ( ! $sub ) {
136
+		if ( ! $sub) {
137 137
 			return null;
138 138
 		}
139 139
 
140 140
 		if (
141
-			empty( $this->did_init[ $var ] )
141
+			empty($this->did_init[$var])
142 142
 			&& ! self::$main->silent
143
-			&& $this->should_do_registry_init( $sub )
143
+			&& $this->should_do_registry_init($sub)
144 144
 		) {
145 145
 
146
-			$is_protected_property = array_key_exists( $var, get_object_vars( $this ) );
146
+			$is_protected_property = array_key_exists($var, get_object_vars($this));
147 147
 
148 148
 			// When the below action is called it is possible that some hooked code
149 149
 			// may attempt to access the property that is being initialized. However,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			// temporarily set this as a public property. However, we can't do this
153 153
 			// for properties that the class has declared, because otherwise it would
154 154
 			// be possible to modify and then unset protected class properties.
155
-			if ( ! $is_protected_property ) {
155
+			if ( ! $is_protected_property) {
156 156
 				$this->allow_set = true;
157 157
 				$this->$var = $sub;
158 158
 				$this->allow_set = false;
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 			 * @param WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI
169 169
 			 *        $registry The registry object.
170 170
 			 */
171
-			do_action( "wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub );
171
+			do_action("wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub);
172 172
 
173 173
 			// Because this property was public, it's possible that it might have
174 174
 			// been modified inadvertently. If this happens we give a warning.
175
-			if ( $sub !== $this->$var ) {
175
+			if ($sub !== $this->$var) {
176 176
 				_doing_it_wrong(
177 177
 					__METHOD__
178
-					, esc_html( "Do not modify the {$var} property directly." )
178
+					, esc_html("Do not modify the {$var} property directly.")
179 179
 					, '1.0.0'
180 180
 				);
181 181
 			}
182 182
 
183
-			if ( ! $is_protected_property ) {
183
+			if ( ! $is_protected_property) {
184 184
 				$this->allow_set = true;
185
-				unset( $this->$var );
185
+				unset($this->$var);
186 186
 				$this->allow_set = false;
187 187
 			}
188 188
 
189
-			$this->did_init[ $var ] = true;
189
+			$this->did_init[$var] = true;
190 190
 		}
191 191
 
192 192
 		return $sub;
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 	/**
196 196
 	 * @since 1.0.0
197 197
 	 */
198
-	public function __set( $var, $value ) {
198
+	public function __set($var, $value) {
199 199
 
200
-		if ( $this->allow_set ) {
200
+		if ($this->allow_set) {
201 201
 			$this->$var = $value;
202 202
 		} else {
203 203
 			_doing_it_wrong(
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	/**
212 212
 	 * @since 1.0.0
213 213
 	 */
214
-	public function __unset( $var ) {
214
+	public function __unset($var) {
215 215
 
216
-		if ( $this->allow_set ) {
217
-			unset( $this->$var );
216
+		if ($this->allow_set) {
217
+			unset($this->$var);
218 218
 		} else {
219 219
 			_doing_it_wrong(
220 220
 				__METHOD__
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return bool Whether to call the init action or not.
235 235
 	 */
236
-	protected function should_do_registry_init( $registry ) {
236
+	protected function should_do_registry_init($registry) {
237 237
 		return (
238 238
 		   $registry instanceof WordPoints_Class_RegistryI
239 239
 		   || $registry instanceof WordPoints_Class_Registry_ChildrenI
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		 *
258 258
 		 * @param WordPoints_App $app The app object.
259 259
 		 */
260
-		do_action( "wordpoints_init_app-{$this->full_slug}", $this );
260
+		do_action("wordpoints_init_app-{$this->full_slug}", $this);
261 261
 	}
262 262
 }
263 263
 
Please login to merge, or discard this patch.
src/includes/classes/hook/arg/dynamic.php 1 patch
Spacing   +6 added lines, -6 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, WordPoints_Hook_ActionI $action = null ) {
40
+	public function __construct($slug, WordPoints_Hook_ActionI $action = null) {
41 41
 
42
-		parent::__construct( $slug, $action );
42
+		parent::__construct($slug, $action);
43 43
 
44
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
44
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
45 45
 
46
-		if ( $parts['dynamic'] ) {
46
+		if ($parts['dynamic']) {
47 47
 			$this->arg_slug = $parts['generic'];
48 48
 		} else {
49 49
 			$this->arg_slug = $this->slug;
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		$value = parent::get_value();
60 60
 
61 61
 		// If not, then we check for an arg with the generic name.
62
-		if ( null === $value && $this->action instanceof WordPoints_Hook_ActionI ) {
63
-			$value = $this->action->get_arg_value( $this->arg_slug );
62
+		if (null === $value && $this->action instanceof WordPoints_Hook_ActionI) {
63
+			$value = $this->action->get_arg_value($this->arg_slug);
64 64
 		}
65 65
 
66 66
 		return $value;
Please login to merge, or discard this patch.
src/includes/classes/hook/event/dynamic.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@
 block discarded – undo
46 46
 	 */
47 47
 	protected function get_entity_title() {
48 48
 
49
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
49
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
50 50
 
51
-		if ( $parts['dynamic'] ) {
51
+		if ($parts['dynamic']) {
52 52
 			$entity_slug = "{$this->generic_entity_slug}\\{$parts['dynamic']}";
53 53
 		} else {
54 54
 			$entity_slug = $this->generic_entity_slug;
55 55
 		}
56 56
 
57
-		$entity = wordpoints_entities()->get( $entity_slug );
57
+		$entity = wordpoints_entities()->get($entity_slug);
58 58
 
59
-		if ( ! $entity instanceof WordPoints_Entity ) {
59
+		if ( ! $entity instanceof WordPoints_Entity) {
60 60
 			return $this->slug;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.
src/includes/classes/hook/event/post/publish.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function get_title() {
26 26
 
27
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
27
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
28 28
 
29
-		switch ( $parsed['dynamic'] ) {
29
+		switch ($parsed['dynamic']) {
30 30
 
31 31
 			case 'post':
32
-				return __( 'Publish Post', 'wordpoints' );
32
+				return __('Publish Post', 'wordpoints');
33 33
 
34 34
 			case 'page':
35
-				return __( 'Publish Page', 'wordpoints' );
35
+				return __('Publish Page', 'wordpoints');
36 36
 
37 37
 			default:
38 38
 				return sprintf(
39 39
 					// translators: singular name of the post type
40
-					__( 'Publish %s', 'wordpoints' )
40
+					__('Publish %s', 'wordpoints')
41 41
 					, $this->get_entity_title()
42 42
 				);
43 43
 		}
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function get_description() {
50 50
 
51
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
51
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
52 52
 
53
-		switch ( $parsed['dynamic'] ) {
53
+		switch ($parsed['dynamic']) {
54 54
 
55 55
 			case 'post':
56
-				return __( 'When a Post is published.', 'wordpoints' );
56
+				return __('When a Post is published.', 'wordpoints');
57 57
 
58 58
 			case 'page':
59
-				return __( 'When a Page is published.', 'wordpoints' );
59
+				return __('When a Page is published.', 'wordpoints');
60 60
 
61 61
 			default:
62 62
 				return sprintf(
63 63
 					// translators: singular name of the post type
64
-					__( 'When a %s is published.', 'wordpoints' )
64
+					__('When a %s is published.', 'wordpoints')
65 65
 					, $this->get_entity_title()
66 66
 				);
67 67
 		}
Please login to merge, or discard this patch.
src/includes/classes/hook/event/comment/leave.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function get_title() {
26 26
 
27
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
27
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
28 28
 
29
-		switch ( $parsed['dynamic'] ) {
29
+		switch ($parsed['dynamic']) {
30 30
 
31 31
 			case 'post':
32
-				return __( 'Comment on a Post', 'wordpoints' );
32
+				return __('Comment on a Post', 'wordpoints');
33 33
 
34 34
 			case 'page':
35
-				return __( 'Comment on a Page', 'wordpoints' );
35
+				return __('Comment on a Page', 'wordpoints');
36 36
 
37 37
 			case 'attachment':
38
-				return __( 'Comment on a Media Upload', 'wordpoints' );
38
+				return __('Comment on a Media Upload', 'wordpoints');
39 39
 
40 40
 			default:
41 41
 				return sprintf(
42 42
 					// translators: singular name of the post type
43
-					__( 'Comment on a %s', 'wordpoints' )
43
+					__('Comment on a %s', 'wordpoints')
44 44
 					, $this->get_entity_title()
45 45
 				);
46 46
 		}
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function get_description() {
53 53
 
54
-		$parsed = wordpoints_parse_dynamic_slug( $this->slug );
54
+		$parsed = wordpoints_parse_dynamic_slug($this->slug);
55 55
 
56
-		switch ( $parsed['dynamic'] ) {
56
+		switch ($parsed['dynamic']) {
57 57
 
58 58
 			case 'post':
59
-				return __( 'When a user leaves a comment on a Post.', 'wordpoints' );
59
+				return __('When a user leaves a comment on a Post.', 'wordpoints');
60 60
 
61 61
 			case 'page':
62
-				return __( 'When a user leaves a comment on a Page.', 'wordpoints' );
62
+				return __('When a user leaves a comment on a Page.', 'wordpoints');
63 63
 
64 64
 			case 'attachment':
65
-				return __( 'When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints' );
65
+				return __('When a user leaves a comment on a file uploaded to the Media Library.', 'wordpoints');
66 66
 
67 67
 			default:
68 68
 				return sprintf(
69 69
 					// translators: singular name of the post type
70
-					__( 'When a user leaves a comment on a %s.', 'wordpoints' )
70
+					__('When a user leaves a comment on a %s.', 'wordpoints')
71 71
 					, $this->get_entity_title()
72 72
 				);
73 73
 		}
Please login to merge, or discard this patch.
src/includes/classes/entity/relationship/dynamic.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,20 +17,20 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @since 1.0.0
19 19
 	 */
20
-	public function __construct( $slug ) {
20
+	public function __construct($slug) {
21 21
 
22
-		parent::__construct( $slug );
22
+		parent::__construct($slug);
23 23
 
24
-		$parts = wordpoints_parse_dynamic_slug( $this->slug );
24
+		$parts = wordpoints_parse_dynamic_slug($this->slug);
25 25
 
26
-		if ( $parts['dynamic'] ) {
26
+		if ($parts['dynamic']) {
27 27
 
28
-			$parsed = $this->parse_slug( $this->related_entity_slug );
28
+			$parsed = $this->parse_slug($this->related_entity_slug);
29 29
 
30 30
 			$this->primary_entity_slug = "{$this->primary_entity_slug}\\{$parts['dynamic']}";
31 31
 			$this->related_entity_slug = "{$parsed['slug']}\\{$parts['dynamic']}";
32 32
 
33
-			if ( $parsed['is_array'] ) {
33
+			if ($parsed['is_array']) {
34 34
 				$this->related_entity_slug .= '{}';
35 35
 			}
36 36
 		}
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function get_title() {
43 43
 
44
-		$parsed = $this->parse_slug( $this->related_entity_slug );
44
+		$parsed = $this->parse_slug($this->related_entity_slug);
45 45
 
46
-		$entity = wordpoints_entities()->get( $parsed['slug'] );
46
+		$entity = wordpoints_entities()->get($parsed['slug']);
47 47
 
48
-		if ( $entity instanceof WordPoints_Entity ) {
48
+		if ($entity instanceof WordPoints_Entity) {
49 49
 			return $entity->get_title();
50 50
 		} else {
51 51
 			return $this->related_entity_slug;
Please login to merge, or discard this patch.
src/includes/classes/hook/reactor.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -97,30 +97,30 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @since 1.0.0
99 99
 	 */
100
-	public function __get( $var ) {
100
+	public function __get($var) {
101 101
 
102 102
 		$network_mode = wordpoints_hooks()->get_network_mode();
103 103
 
104
-		switch ( $var ) {
104
+		switch ($var) {
105 105
 			case 'reactions':
106 106
 				$var = $network_mode ? 'network_reactions' : 'standard_reactions';
107 107
 				// fall through
108 108
 
109 109
 			case 'standard_reactions':
110 110
 			case 'network_reactions':
111
-				if ( $network_mode && 'standard_reactions' === $var ) {
111
+				if ($network_mode && 'standard_reactions' === $var) {
112 112
 					return null;
113 113
 				}
114 114
 
115
-				if ( 'network_reactions' === $var && ! $this->is_network_wide() ) {
115
+				if ('network_reactions' === $var && ! $this->is_network_wide()) {
116 116
 					return null;
117 117
 				}
118 118
 
119
-				if ( ! isset( $this->$var ) ) {
120
-					if ( isset( $this->{"{$var}_class"} ) ) {
119
+				if ( ! isset($this->$var)) {
120
+					if (isset($this->{"{$var}_class"} )) {
121 121
 						$this->$var = new $this->{"{$var}_class"}(
122 122
 							$this->slug
123
-							, ( 'network_reactions' === $var )
123
+							, ('network_reactions' === $var)
124 124
 						);
125 125
 					}
126 126
 				}
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return WordPoints_Hook_ReactionI[] All of the reaction objects.
196 196
 	 */
197
-	public function get_all_reactions_to_event( $event_slug ) {
197
+	public function get_all_reactions_to_event($event_slug) {
198 198
 
199 199
 		$reactions = array();
200 200
 
201
-		foreach ( array( 'standard', 'network' ) as $store ) {
201
+		foreach (array('standard', 'network') as $store) {
202 202
 
203 203
 			$storage = $this->{"{$store}_reactions"};
204 204
 
205
-			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) {
205
+			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) {
206 206
 				continue;
207 207
 			}
208 208
 
209 209
 			$reactions = array_merge(
210 210
 				$reactions
211
-				, $storage->get_reactions_to_event( $event_slug )
211
+				, $storage->get_reactions_to_event($event_slug)
212 212
 			);
213 213
 		}
214 214
 
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$reactions = array();
232 232
 
233
-		foreach ( array( 'standard', 'network' ) as $store ) {
233
+		foreach (array('standard', 'network') as $store) {
234 234
 
235 235
 			$storage = $this->{"{$store}_reactions"};
236 236
 
237
-			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI ) {
237
+			if ( ! $storage instanceof WordPoints_Hook_Reaction_StorageI) {
238 238
 				continue;
239 239
 			}
240 240
 
241
-			$reactions = array_merge( $reactions, $storage->get_reactions() );
241
+			$reactions = array_merge($reactions, $storage->get_reactions());
242 242
 		}
243 243
 
244 244
 		return $reactions;
@@ -254,21 +254,21 @@  discard block
 block discarded – undo
254 254
 	) {
255 255
 
256 256
 		if (
257
-			empty( $settings['target'] )
258
-			|| ! is_array( $settings['target'] )
257
+			empty($settings['target'])
258
+			|| ! is_array($settings['target'])
259 259
 		) {
260 260
 
261
-			$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
261
+			$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
262 262
 
263 263
 		} else {
264 264
 
265
-			$target = $event_args->get_from_hierarchy( $settings['target'] );
265
+			$target = $event_args->get_from_hierarchy($settings['target']);
266 266
 
267 267
 			if (
268 268
 				! $target instanceof WordPoints_Entity
269
-				|| ! in_array( $target->get_slug(), (array) $this->arg_types )
269
+				|| ! in_array($target->get_slug(), (array) $this->arg_types)
270 270
 			) {
271
-				$validator->add_error( __( 'Invalid target.', 'wordpoints' ), 'target' );
271
+				$validator->add_error(__('Invalid target.', 'wordpoints'), 'target');
272 272
 			}
273 273
 		}
274 274
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	/**
279 279
 	 * @since 1.0.0
280 280
 	 */
281
-	public function update_settings( WordPoints_Hook_ReactionI $reaction, array $settings ) {
282
-		$reaction->update_meta( 'target', $settings['target'] );
281
+	public function update_settings(WordPoints_Hook_ReactionI $reaction, array $settings) {
282
+		$reaction->update_meta('target', $settings['target']);
283 283
 	}
284 284
 
285 285
 	/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @param WordPoints_Hook_Event_Args         $event_args The event args.
291 291
 	 * @param WordPoints_Hook_Reaction_Validator $reaction   The reaction.
292 292
 	 */
293
-	abstract public function hit( WordPoints_Hook_Event_Args $event_args, WordPoints_Hook_Reaction_Validator $reaction );
293
+	abstract public function hit(WordPoints_Hook_Event_Args $event_args, WordPoints_Hook_Reaction_Validator $reaction);
294 294
 }
295 295
 
296 296
 // EOF
Please login to merge, or discard this patch.