Completed
Push — master ( ea7c62...226003 )
by J.D.
03:16
created
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/admin/includes/actions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-add_action( 'wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps' );
10
+add_action('wordpoints_init_app-apps', 'wordpoints_hooks_register_admin_apps');
11 11
 
12
-add_action( 'admin_menu', 'wordpoints_hooks_api_admin_menu' );
12
+add_action('admin_menu', 'wordpoints_hooks_api_admin_menu');
13 13
 
14
-if ( is_wordpoints_network_active() ) {
15
-	add_action( 'network_admin_menu', 'wordpoints_hooks_api_admin_menu' );
14
+if (is_wordpoints_network_active()) {
15
+	add_action('network_admin_menu', 'wordpoints_hooks_api_admin_menu');
16 16
 }
17 17
 
18
-add_action( 'admin_init', 'wordpoints_hooks_admin_register_scripts' );
19
-add_action( 'admin_init', 'wordpoints_hooks_admin_ajax' );
18
+add_action('admin_init', 'wordpoints_hooks_admin_register_scripts');
19
+add_action('admin_init', 'wordpoints_hooks_admin_ajax');
20 20
 
21
-add_filter( 'script_loader_tag', 'wordpoints_script_templates_filter', 10, 2 );
21
+add_filter('script_loader_tag', 'wordpoints_script_templates_filter', 10, 2);
22 22
 
23 23
 // EOF
Please login to merge, or discard this patch.
src/admin/includes/classes/screen.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	public function hooks() {
63 63
 
64 64
 		/* Load the JavaScript needed for the settings screen. */
65
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
66
-		add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) );
65
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
66
+		add_action("admin_footer-{$this->id}", array($this, 'footer_scripts'));
67 67
 	}
68 68
 
69 69
 	/**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 
99 99
 		<div class="wrap">
100 100
 
101
-			<h1><?php echo esc_html( $this->get_title() ); ?></h1>
101
+			<h1><?php echo esc_html($this->get_title()); ?></h1>
102 102
 
103 103
 			<?php settings_errors(); ?>
104 104
 
105
-			<?php if ( ! empty( $this->tabs ) ) : ?>
106
-				<?php wordpoints_admin_show_tabs( $this->tabs, false ); ?>
105
+			<?php if ( ! empty($this->tabs)) : ?>
106
+				<?php wordpoints_admin_show_tabs($this->tabs, false); ?>
107 107
 			<?php endif; ?>
108 108
 
109 109
 			<?php $this->display_content(); ?>
Please login to merge, or discard this patch.
src/admin/includes/classes/screens.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @since 1.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'current_screen', array( $this, 'set_current_screen' ) );
30
+		add_action('current_screen', array($this, 'set_current_screen'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param WP_Screen $current_screen The WP_Screen object for the current screen.
39 39
 	 */
40
-	public function set_current_screen( $current_screen ) {
40
+	public function set_current_screen($current_screen) {
41 41
 
42 42
 		$screen_id = $current_screen->id;
43 43
 
44
-		if ( is_network_admin() ) {
45
-			$screen_id = substr( $screen_id, 0, -8 /* -network */ );
44
+		if (is_network_admin()) {
45
+			$screen_id = substr($screen_id, 0, -8 /* -network */);
46 46
 		}
47 47
 
48
-		$screen = $this->get( $screen_id );
48
+		$screen = $this->get($screen_id);
49 49
 
50
-		if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) {
50
+		if ( ! ($screen instanceof WordPoints_Admin_Screen)) {
51 51
 			return;
52 52
 		}
53 53
 
54 54
 		$this->current_screen = $screen;
55 55
 
56
-		add_action( "load-{$screen_id}", array( $this->current_screen, 'load' ) );
56
+		add_action("load-{$screen_id}", array($this->current_screen, 'load'));
57 57
 	}
58 58
 
59 59
 	/**
Please login to merge, or discard this patch.
src/includes/classes/hook/reaction/validator.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 	 * @param bool                            $fail_fast Whether to fail as soon as
105 105
 	 *                                                   the first error is found.
106 106
 	 */
107
-	public function __construct( $settings, WordPoints_Hook_Reactor $reactor, $fail_fast = false ) {
107
+	public function __construct($settings, WordPoints_Hook_Reactor $reactor, $fail_fast = false) {
108 108
 
109 109
 		$this->reactor = $reactor;
110 110
 		$this->fail_fast = $fail_fast;
111 111
 		$this->hooks = wordpoints_hooks();
112 112
 
113
-		if ( $settings instanceof WordPoints_Hook_ReactionI ) {
113
+		if ($settings instanceof WordPoints_Hook_ReactionI) {
114 114
 
115 115
 			$this->reaction   = $settings;
116 116
 			$this->settings   = $this->reaction->get_all_meta();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 			$this->settings = $settings;
122 122
 
123
-			if ( isset( $this->settings['event'] ) ) {
123
+			if (isset($this->settings['event'])) {
124 124
 				$this->event_slug = $this->settings['event'];
125 125
 			}
126 126
 		}
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 			$fail_fast = $this->fail_fast;
145 145
 			$this->fail_fast = true;
146 146
 
147
-			if ( ! isset( $this->event_slug ) ) {
148
-				$this->add_error( __( 'Event is missing.', 'wordpoints' ), 'event' );
149
-			} elseif ( ! $this->hooks->events->is_registered( $this->event_slug ) ) {
150
-				$this->add_error( __( 'Event is invalid.', 'wordpoints' ), 'event' );
147
+			if ( ! isset($this->event_slug)) {
148
+				$this->add_error(__('Event is missing.', 'wordpoints'), 'event');
149
+			} elseif ( ! $this->hooks->events->is_registered($this->event_slug)) {
150
+				$this->add_error(__('Event is invalid.', 'wordpoints'), 'event');
151 151
 			}
152 152
 
153 153
 			// From here on out we can collect errors as they come (unless we are
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 				$this->event_slug
159 159
 			);
160 160
 
161
-			$this->event_args = new WordPoints_Hook_Event_Args( $event_args );
162
-			$this->event_args->set_validator( $this );
161
+			$this->event_args = new WordPoints_Hook_Event_Args($event_args);
162
+			$this->event_args->set_validator($this);
163 163
 
164
-			$this->settings = $this->reactor->validate_settings( $this->settings, $this, $this->event_args );
164
+			$this->settings = $this->reactor->validate_settings($this->settings, $this, $this->event_args);
165 165
 
166 166
 			/** @var WordPoints_Hook_Extension $extension */
167
-			foreach ( $this->hooks->extensions->get_all() as $extension ) {
168
-				$this->settings = $extension->validate_settings( $this->settings, $this, $this->event_args );
167
+			foreach ($this->hooks->extensions->get_all() as $extension) {
168
+				$this->settings = $extension->validate_settings($this->settings, $this, $this->event_args);
169 169
 			}
170 170
 
171 171
 			/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 			 * @param WordPoints_Hook_Reaction_Validator $validator The validator object.
176 176
 			 * @param WordPoints_Hook_Event_Args         $args      The event args object.
177 177
 			 */
178
-			$this->settings = apply_filters( 'wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args );
178
+			$this->settings = apply_filters('wordpoints_hook_reaction_validate', $this->settings, $this, $this->event_args);
179 179
 
180
-		} catch ( WordPoints_Hook_Validator_Exception $e ) {
180
+		} catch (WordPoints_Hook_Validator_Exception $e) {
181 181
 
182 182
 			// Do nothing.
183
-			unset( $e );
183
+			unset($e);
184 184
 		}
185 185
 
186 186
 		return $this->settings;
@@ -208,17 +208,17 @@  discard block
 block discarded – undo
208 208
 	 * @throws WordPoints_Hook_Validator_Exception If the validator is configured to
209 209
 	 *                                             fail as soon as an error is found.
210 210
 	 */
211
-	public function add_error( $message, $field = null ) {
211
+	public function add_error($message, $field = null) {
212 212
 
213 213
 		$field_stack = $this->field_stack;
214 214
 
215
-		if ( null !== $field ) {
215
+		if (null !== $field) {
216 216
 			$field_stack[] = $field;
217 217
 		}
218 218
 
219
-		$this->errors[] = array( 'message' => $message, 'field' => $field_stack );
219
+		$this->errors[] = array('message' => $message, 'field' => $field_stack);
220 220
 
221
-		if ( $this->fail_fast ) {
221
+		if ($this->fail_fast) {
222 222
 			throw new WordPoints_Hook_Validator_Exception;
223 223
 		}
224 224
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return bool Whether the validator found any errors.
232 232
 	 */
233 233
 	public function had_errors() {
234
-		return ! empty( $this->errors );
234
+		return ! empty($this->errors);
235 235
 	}
236 236
 
237 237
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param string $field The field.
254 254
 	 */
255
-	public function push_field( $field ) {
255
+	public function push_field($field) {
256 256
 		$this->field_stack[] = $field;
257 257
 	}
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @since 1.0.0
263 263
 	 */
264 264
 	public function pop_field() {
265
-		array_pop( $this->field_stack );
265
+		array_pop($this->field_stack);
266 266
 	}
267 267
 
268 268
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	public function get_id() {
309 309
 
310
-		if ( ! $this->reaction ) {
310
+		if ( ! $this->reaction) {
311 311
 			return false;
312 312
 		}
313 313
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @return mixed The meta value.
347 347
 	 */
348
-	public function get_meta( $key ) {
348
+	public function get_meta($key) {
349 349
 
350
-		if ( ! isset( $this->settings[ $key ] ) ) {
350
+		if ( ! isset($this->settings[$key])) {
351 351
 			return null;
352 352
 		}
353 353
 
354
-		return $this->settings[ $key ];
354
+		return $this->settings[$key];
355 355
 	}
356 356
 
357 357
 	/**
Please login to merge, or discard this patch.