Completed
Push — master ( cbda97...e7ef90 )
by J.D.
03:04
created
src/includes/class-widget.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 * @param WP_Error|string $message The error message to display.
53 53
 	 * @param array           $args    Arguments for widget display.
54 54
 	 */
55
-	public function wordpoints_widget_error( $message, $args ) {
55
+	public function wordpoints_widget_error($message, $args) {
56 56
 
57
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
57
+		if ( ! current_user_can('edit_theme_options')) {
58 58
 			return;
59 59
 		}
60 60
 
61
-		if ( is_wp_error( $message ) ) {
61
+		if (is_wp_error($message)) {
62 62
 			$message = $message->get_error_message();
63 63
 		}
64 64
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
 				echo wp_kses(
74 74
 					sprintf(
75
-						esc_html__( 'The “%1$s” widget could not be displayed because of an error: %2$s', 'wordpoints' )
76
-						, esc_html( $this->name )
75
+						esc_html__('The “%1$s” widget could not be displayed because of an error: %2$s', 'wordpoints')
76
+						, esc_html($this->name)
77 77
 						,  $message
78 78
 					)
79 79
 					, 'wordpoints_widget_error'
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return array|WP_Error The verified settings.
105 105
 	 */
106
-	protected function verify_settings( $instance ) {
106
+	protected function verify_settings($instance) {
107 107
 
108
-		if ( ! isset( $instance['title'] ) ) {
108
+		if ( ! isset($instance['title'])) {
109 109
 			$instance['title'] = '';
110 110
 		}
111 111
 
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 	 * @param array $args     Arguments for widget display.
121 121
 	 * @param array $instance The settings for this widget instance.
122 122
 	 */
123
-	public function widget( $args, $instance ) {
123
+	public function widget($args, $instance) {
124 124
 
125
-		$instance = $this->verify_settings( $instance );
125
+		$instance = $this->verify_settings($instance);
126 126
 
127
-		if ( is_wp_error( $instance ) ) {
128
-			$this->wordpoints_widget_error( $instance, $args );
127
+		if (is_wp_error($instance)) {
128
+			$this->wordpoints_widget_error($instance, $args);
129 129
 			return;
130 130
 		}
131 131
 
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 		 *
139 139
 		 * @param string $title The widget title.
140 140
 		 */
141
-		$title = apply_filters( 'widget_title', $instance['title'] );
141
+		$title = apply_filters('widget_title', $instance['title']);
142 142
 
143
-		if ( ! empty( $title ) ) {
143
+		if ( ! empty($title)) {
144 144
 
145 145
 			echo $args['before_title'] . $title . $args['after_title']; // XSS OK, WPCS.
146 146
 		}
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 		 *
155 155
 		 * @param array $instance The settings for this widget instance.
156 156
 		 */
157
-		do_action( "wordpoints_{$widget_slug}_widget_before", $instance );
157
+		do_action("wordpoints_{$widget_slug}_widget_before", $instance);
158 158
 
159
-		$this->widget_body( $instance );
159
+		$this->widget_body($instance);
160 160
 
161 161
 		/**
162 162
 		 * After a WordPoints widget.
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		 *
166 166
 		 * @param array $instance The settings for this widget instance.
167 167
 		 */
168
-		do_action( "wordpoints_{$widget_slug}_widget_after", $instance );
168
+		do_action("wordpoints_{$widget_slug}_widget_after", $instance);
169 169
 
170 170
 		echo $args['after_widget']; // XSS OK here too, WPCS.
171 171
 	}
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @param array $instance The settings of the widget instance to display.
187 187
 	 */
188
-	protected function widget_body( $instance ) {}
188
+	protected function widget_body($instance) {}
189 189
 
190 190
 	/**
191 191
 	 * @since 2.0.0
192 192
 	 */
193
-	public function update( $new_instance, $old_instance ) {
193
+	public function update($new_instance, $old_instance) {
194 194
 
195
-		$this->instance = array_merge( $this->defaults, $old_instance, $new_instance );
195
+		$this->instance = array_merge($this->defaults, $old_instance, $new_instance);
196 196
 
197 197
 		$this->update_title();
198 198
 
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 	 * @since 2.0.0
206 206
 	 */
207 207
 	public function update_title() {
208
-		$this->instance['title'] = strip_tags( $this->instance['title'] );
208
+		$this->instance['title'] = strip_tags($this->instance['title']);
209 209
 	}
210 210
 
211 211
 	/**
212 212
 	 * @since 2.0.0
213 213
 	 */
214
-	public function form( $instance ) {
214
+	public function form($instance) {
215 215
 
216
-		$this->instance = array_merge( $this->defaults, $instance );
216
+		$this->instance = array_merge($this->defaults, $instance);
217 217
 
218 218
 		$this->form_title_field();
219 219
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 		?>
231 231
 
232 232
 		<p>
233
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php echo esc_html_x( 'Title', 'form label', 'wordpoints' ); ?></label>
234
-			<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $this->instance['title'] ); ?>" />
233
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php echo esc_html_x('Title', 'form label', 'wordpoints'); ?></label>
234
+			<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($this->instance['title']); ?>" />
235 235
 		</p>
236 236
 
237 237
 		<?php
Please login to merge, or discard this patch.
src/includes/class-breaking-updater.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @since 2.0.0
24 24
 	 */
25 25
 	protected $updates = array(
26
-		'breaking'  => array( 'single' => true, 'site' => true, 'network' => true ),
26
+		'breaking'  => array('single' => true, 'site' => true, 'network' => true),
27 27
 	);
28 28
 
29 29
 	/**
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 		 *
46 46
 		 * @since 2.0.0
47 47
 		 */
48
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
48
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
49 49
 
50
-		if ( ! WP_Filesystem( false, ABSPATH ) ) {
50
+		if ( ! WP_Filesystem(false, ABSPATH)) {
51 51
 			return;
52 52
 		}
53 53
 
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	protected function after_update() {
61 61
 
62
-		$this->maintenance_mode( false );
62
+		$this->maintenance_mode(false);
63 63
 
64
-		if ( $this->network_wide ) {
64
+		if ($this->network_wide) {
65 65
 
66 66
 			$deactivated_modules = array_diff(
67 67
 				$this->checked_modules
68
-				, array_filter( $this->checked_modules )
68
+				, array_filter($this->checked_modules)
69 69
 			);
70 70
 
71 71
 			update_site_option(
72 72
 				'wordpoints_breaking_deactivated_modules'
73
-				, array_keys( $deactivated_modules )
73
+				, array_keys($deactivated_modules)
74 74
 			);
75 75
 		}
76 76
 	}
@@ -89,27 +89,27 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param bool $enable Whether to turn maintenance mode on or off.
91 91
 	 */
92
-	protected function maintenance_mode( $enable = true ) {
92
+	protected function maintenance_mode($enable = true) {
93 93
 
94 94
 		/**
95 95
 		 * @var WP_Filesystem_Base $wp_filesystem
96 96
 		 */
97 97
 		global $wp_filesystem;
98 98
 
99
-		if ( ! ( $wp_filesystem instanceof WP_Filesystem_Base ) ) {
99
+		if ( ! ($wp_filesystem instanceof WP_Filesystem_Base)) {
100 100
 			return;
101 101
 		}
102 102
 
103 103
 		$file = $wp_filesystem->abspath() . '.maintenance';
104 104
 
105
-		if ( $enable ) {
105
+		if ($enable) {
106 106
 
107 107
 			$maintenance_string = '<?php $upgrading = ' . time() . '; include( "' . WORDPOINTS_DIR . '/includes/maintenance.php" ); ?>';
108
-			$wp_filesystem->delete( $file );
109
-			$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
108
+			$wp_filesystem->delete($file);
109
+			$wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
110 110
 
111
-		} elseif ( $wp_filesystem->exists( $file ) ) {
112
-			$wp_filesystem->delete( $file );
111
+		} elseif ($wp_filesystem->exists($file)) {
112
+			$wp_filesystem->delete($file);
113 113
 		}
114 114
 	}
115 115
 
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function update_network_to_breaking() {
122 122
 
123
-		if ( ! $this->network_wide ) {
123
+		if ( ! $this->network_wide) {
124 124
 			return;
125 125
 		}
126 126
 
127 127
 		$network_active_modules = array_keys(
128
-			wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' )
128
+			wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site')
129 129
 		);
130 130
 
131
-		$this->check_modules( $network_active_modules );
131
+		$this->check_modules($network_active_modules);
132 132
 	}
133 133
 
134 134
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	protected function update_single_to_breaking() {
149 149
 
150 150
 		$this->check_modules(
151
-			wordpoints_get_array_option( 'wordpoints_active_modules' )
151
+			wordpoints_get_array_option('wordpoints_active_modules')
152 152
 		);
153 153
 	}
154 154
 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @param array $modules A list of basename-paths of modules to check.
161 161
 	 */
162
-	protected function check_modules( $modules ) {
162
+	protected function check_modules($modules) {
163 163
 
164
-		$modules = $this->validate_modules( $modules );
164
+		$modules = $this->validate_modules($modules);
165 165
 
166
-		if ( empty( $modules ) ) {
166
+		if (empty($modules)) {
167 167
 			return;
168 168
 		}
169 169
 
170 170
 		// First try checking all of them at once.
171
-		if ( count( $modules ) > 1 ) {
172
-			if ( $this->check_module( implode( ',', $modules ) ) ) {
171
+		if (count($modules) > 1) {
172
+			if ($this->check_module(implode(',', $modules))) {
173 173
 				return;
174 174
 			}
175 175
 		}
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 		// If there was one or more broken, we'll have to check each to find them.
178 178
 		$incompatible_modules = array();
179 179
 
180
-		foreach ( $modules as $module ) {
181
-			if ( ! $this->check_module( $module ) ) {
180
+		foreach ($modules as $module) {
181
+			if ( ! $this->check_module($module)) {
182 182
 				$incompatible_modules[] = $module;
183
-				$this->checked_modules[ $module ] = false;
183
+				$this->checked_modules[$module] = false;
184 184
 			}
185 185
 		}
186 186
 
187
-		if ( empty( $incompatible_modules ) ) {
187
+		if (empty($incompatible_modules)) {
188 188
 			return;
189 189
 		}
190 190
 
191
-		$this->deactivate_modules( $incompatible_modules );
191
+		$this->deactivate_modules($incompatible_modules);
192 192
 	}
193 193
 
194 194
 	/**
@@ -200,32 +200,32 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return string[] The valid modules.
202 202
 	 */
203
-	protected function validate_modules( $modules ) {
203
+	protected function validate_modules($modules) {
204 204
 
205 205
 		$incompatible = array();
206 206
 
207
-		foreach ( $modules as $index => $module ) {
207
+		foreach ($modules as $index => $module) {
208 208
 
209
-			if ( isset( $this->checked_modules[ $module ] ) ) {
209
+			if (isset($this->checked_modules[$module])) {
210 210
 
211
-				unset( $modules[ $index ] );
211
+				unset($modules[$index]);
212 212
 
213
-				if ( ! $this->checked_modules[ $module ] ) {
213
+				if ( ! $this->checked_modules[$module]) {
214 214
 					$incompatible[] = $module;
215 215
 				}
216 216
 			}
217 217
 
218
-			$valid = wordpoints_validate_module( $module );
218
+			$valid = wordpoints_validate_module($module);
219 219
 
220
-			if ( is_wp_error( $valid ) ) {
221
-				unset( $modules[ $index ] );
220
+			if (is_wp_error($valid)) {
221
+				unset($modules[$index]);
222 222
 			}
223 223
 
224
-			$this->checked_modules[ $module ] = true;
224
+			$this->checked_modules[$module] = true;
225 225
 		}
226 226
 
227
-		if ( ! empty( $incompatible ) ) {
228
-			$this->deactivate_modules( $incompatible );
227
+		if ( ! empty($incompatible)) {
228
+			$this->deactivate_modules($incompatible);
229 229
 		}
230 230
 
231 231
 		return $modules;
@@ -241,43 +241,43 @@  discard block
 block discarded – undo
241 241
 	 * @return bool|WP_Error Whether the page loaded correctly, or a WP_Error if
242 242
 	 *                       unable to make the request.
243 243
 	 */
244
-	protected function check_module( $module ) {
244
+	protected function check_module($module) {
245 245
 
246
-		$rand_str = wp_generate_password( 256, true, true );
247
-		$nonce = wordpoints_hash( $rand_str . 'wordpoints_check_modules-' . $module );
246
+		$rand_str = wp_generate_password(256, true, true);
247
+		$nonce = wordpoints_hash($rand_str . 'wordpoints_check_modules-' . $module);
248 248
 
249
-		if ( 'network' === $this->context ) {
250
-			update_site_option( 'wordpoints_module_check_rand_str', $rand_str );
251
-			update_site_option( 'wordpoints_module_check_nonce', $nonce );
249
+		if ('network' === $this->context) {
250
+			update_site_option('wordpoints_module_check_rand_str', $rand_str);
251
+			update_site_option('wordpoints_module_check_nonce', $nonce);
252 252
 		} else {
253
-			update_option( 'wordpoints_module_check_rand_str', $rand_str );
254
-			update_option( 'wordpoints_module_check_nonce', $nonce );
253
+			update_option('wordpoints_module_check_rand_str', $rand_str);
254
+			update_option('wordpoints_module_check_nonce', $nonce);
255 255
 		}
256 256
 
257 257
 		$response = wp_safe_remote_post(
258 258
 			add_query_arg(
259 259
 				'wordpoints_module_check'
260 260
 				, $nonce
261
-				, self_admin_url( 'admin-ajax.php?action=wordpoints_breaking_module_check&check_module=' . $module )
261
+				, self_admin_url('admin-ajax.php?action=wordpoints_breaking_module_check&check_module=' . $module)
262 262
 			)
263
-			, array( 'timeout' => 20 )
263
+			, array('timeout' => 20)
264 264
 		);
265 265
 
266
-		if ( 'network' === $this->context ) {
267
-			delete_site_option( 'wordpoints_module_check_rand_str' );
268
-			delete_site_option( 'wordpoints_module_check_nonce' );
266
+		if ('network' === $this->context) {
267
+			delete_site_option('wordpoints_module_check_rand_str');
268
+			delete_site_option('wordpoints_module_check_nonce');
269 269
 		} else {
270
-			delete_option( 'wordpoints_module_check_rand_str' );
271
-			delete_option( 'wordpoints_module_check_nonce' );
270
+			delete_option('wordpoints_module_check_rand_str');
271
+			delete_option('wordpoints_module_check_nonce');
272 272
 		}
273 273
 
274
-		if ( is_wp_error( $response ) ) {
274
+		if (is_wp_error($response)) {
275 275
 			return $response;
276 276
 		}
277 277
 
278
-		$body = wp_remote_retrieve_body( $response );
278
+		$body = wp_remote_retrieve_body($response);
279 279
 
280
-		return (bool) strpos( $body, $rand_str );
280
+		return (bool) strpos($body, $rand_str);
281 281
 	}
282 282
 
283 283
 	/**
@@ -287,23 +287,23 @@  discard block
 block discarded – undo
287 287
 	 *
288 288
 	 * @param array $modules A list of basename-paths of modules to deactivate.
289 289
 	 */
290
-	protected function deactivate_modules( $modules ) {
290
+	protected function deactivate_modules($modules) {
291 291
 
292
-		if ( 'network' === $this->context ) {
292
+		if ('network' === $this->context) {
293 293
 
294
-			$active_modules = wordpoints_get_array_option( 'wordpoints_sitewide_active_modules', 'site' );
295
-			$active_modules = array_diff_key( $active_modules, array_flip( $modules ) );
296
-			update_site_option( 'wordpoints_sitewide_active_modules', $active_modules );
294
+			$active_modules = wordpoints_get_array_option('wordpoints_sitewide_active_modules', 'site');
295
+			$active_modules = array_diff_key($active_modules, array_flip($modules));
296
+			update_site_option('wordpoints_sitewide_active_modules', $active_modules);
297 297
 
298
-			update_site_option( 'wordpoints_incompatible_modules', $modules );
298
+			update_site_option('wordpoints_incompatible_modules', $modules);
299 299
 
300 300
 		} else {
301 301
 
302
-			$active_modules = wordpoints_get_array_option( 'wordpoints_active_modules' );
303
-			$active_modules = array_diff( $active_modules, $modules );
304
-			update_option( 'wordpoints_active_modules', $active_modules );
302
+			$active_modules = wordpoints_get_array_option('wordpoints_active_modules');
303
+			$active_modules = array_diff($active_modules, $modules);
304
+			update_option('wordpoints_active_modules', $active_modules);
305 305
 
306
-			update_option( 'wordpoints_incompatible_modules', $modules );
306
+			update_option('wordpoints_incompatible_modules', $modules);
307 307
 		}
308 308
 	}
309 309
 }
Please login to merge, or discard this patch.
src/includes/constants.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @const WORDPOINTS_VERSION
24 24
  */
25
-define( 'WORDPOINTS_VERSION', '2.3.0-alpha-2' );
25
+define('WORDPOINTS_VERSION', '2.3.0-alpha-2');
26 26
 
27 27
 /**
28 28
  * The full path to the plugin's main directory.
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @const WORDPOINTS_DIR
33 33
  */
34
-define( 'WORDPOINTS_DIR', dirname( dirname( __FILE__ ) ) . '/' );
34
+define('WORDPOINTS_DIR', dirname(dirname(__FILE__)) . '/');
35 35
 
36 36
 /**
37 37
  * The full URL to the plugin's main directory.
@@ -40,6 +40,6 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @const WORDPOINTS_URL
42 42
  */
43
-define( 'WORDPOINTS_URL', plugins_url( '', WORDPOINTS_DIR . 'wordpoints.php' ) );
43
+define('WORDPOINTS_URL', plugins_url('', WORDPOINTS_DIR . 'wordpoints.php'));
44 44
 
45 45
 // EOF
Please login to merge, or discard this patch.
src/includes/maintenance.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
 $time = time();
16 16
 
17 17
 // Don't lock the user out of their site if the file fails to delete for some reason.
18
-if ( $time - $upgrading >= 10 * MINUTE_IN_SECONDS ) {
18
+if ($time - $upgrading >= 10 * MINUTE_IN_SECONDS) {
19 19
 	return;
20 20
 }
21 21
 
22 22
 // If we're not running a module check, let the maintenance message show.
23
-if ( ! isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) {
23
+if ( ! isset($_GET['wordpoints_module_check'], $_GET['check_module'])) {
24 24
 	return;
25 25
 }
26 26
 
Please login to merge, or discard this patch.
src/includes/class-modules.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return string The unique slug used to identify this module.
93 93
 	 */
94
-	public static function get_slug( $file ) {
94
+	public static function get_slug($file) {
95 95
 
96 96
 		return strrev(
97
-			basename( strrev( wordpoints_module_basename( $file ) ) )
97
+			basename(strrev(wordpoints_module_basename($file)))
98 98
 		);
99 99
 	}
100 100
 
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return string[]|string|false The data, or false if it isn't registered.
110 110
 	 */
111
-	public static function get_data( $module, $data = null ) {
111
+	public static function get_data($module, $data = null) {
112 112
 
113
-		$slug = self::get_slug( $module );
113
+		$slug = self::get_slug($module);
114 114
 
115
-		if ( ! isset( self::$registered[ $slug ] ) ) {
115
+		if ( ! isset(self::$registered[$slug])) {
116 116
 			return false;
117 117
 		}
118 118
 
119
-		if ( $data ) {
120
-			if ( ! isset( self::$registered[ $slug ][ $data ] ) ) {
119
+		if ($data) {
120
+			if ( ! isset(self::$registered[$slug][$data])) {
121 121
 				return false;
122 122
 			}
123 123
 
124
-			return self::$registered[ $slug ][ $data ];
124
+			return self::$registered[$slug][$data];
125 125
 		}
126 126
 
127
-		return self::$registered[ $slug ];
127
+		return self::$registered[$slug];
128 128
 	}
129 129
 
130 130
 	/**
@@ -137,21 +137,21 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return bool True, or false if the module has already been registered.
139 139
 	 */
140
-	public static function register( $data, $file ) {
140
+	public static function register($data, $file) {
141 141
 
142
-		$slug = self::get_slug( $file );
142
+		$slug = self::get_slug($file);
143 143
 
144
-		if ( isset( self::$registered[ $slug ] ) ) {
144
+		if (isset(self::$registered[$slug])) {
145 145
 			return false;
146 146
 		}
147 147
 
148
-		self::$registered[ $slug ] = self::parse_headers( $data );
148
+		self::$registered[$slug] = self::parse_headers($data);
149 149
 
150
-		self::$registered[ $slug ]['raw'] = $data;
151
-		self::$registered[ $slug ]['raw_file'] = wp_normalize_path( $file );
150
+		self::$registered[$slug]['raw'] = $data;
151
+		self::$registered[$slug]['raw_file'] = wp_normalize_path($file);
152 152
 
153
-		self::register_installable( $slug, $file );
154
-		self::maybe_load_textdomain( $slug, $file );
153
+		self::register_installable($slug, $file);
154
+		self::maybe_load_textdomain($slug, $file);
155 155
 
156 156
 		return true;
157 157
 	}
@@ -165,32 +165,32 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return array The parsed header data.
167 167
 	 */
168
-	private static function parse_headers( $data ) {
168
+	private static function parse_headers($data) {
169 169
 
170 170
 		$parsed = array();
171 171
 
172
-		$lines = explode( "\n", $data );
172
+		$lines = explode("\n", $data);
173 173
 
174
-		foreach ( $lines as $line ) {
174
+		foreach ($lines as $line) {
175 175
 
176
-			$line = trim( $line );
176
+			$line = trim($line);
177 177
 
178
-			if ( empty( $line ) ) {
178
+			if (empty($line)) {
179 179
 				continue;
180 180
 			}
181 181
 
182
-			$parts = explode( ':', $line, 2 );
182
+			$parts = explode(':', $line, 2);
183 183
 
184
-			$data_slug = trim( $parts[0] );
184
+			$data_slug = trim($parts[0]);
185 185
 
186
-			if ( isset( self::$default_headers[ $parts[0] ] ) ) {
187
-				$data_slug = self::$default_headers[ $parts[0] ];
186
+			if (isset(self::$default_headers[$parts[0]])) {
187
+				$data_slug = self::$default_headers[$parts[0]];
188 188
 			}
189 189
 
190
-			$parsed[ $data_slug ] = trim( $parts[1] );
190
+			$parsed[$data_slug] = trim($parts[1]);
191 191
 		}
192 192
 
193
-		return $parsed + array_fill_keys( self::$default_headers, '' );
193
+		return $parsed + array_fill_keys(self::$default_headers, '');
194 194
 	}
195 195
 
196 196
 	/**
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 	 * @param string $slug The module slug.
202 202
 	 * @param string $file The main module file.
203 203
 	 */
204
-	private static function register_installable( $slug, $file ) {
204
+	private static function register_installable($slug, $file) {
205 205
 
206 206
 		WordPoints_Installables::register(
207 207
 			'module'
208 208
 			, $slug
209 209
 			, array(
210
-				'version'      => self::$registered[ $slug ]['version'],
211
-				'un_installer' => dirname( $file ) . '/includes/class-un-installer.php',
212
-				'network_wide' => is_wordpoints_module_active_for_network( $file ),
210
+				'version'      => self::$registered[$slug]['version'],
211
+				'un_installer' => dirname($file) . '/includes/class-un-installer.php',
212
+				'network_wide' => is_wordpoints_module_active_for_network($file),
213 213
 			)
214 214
 		);
215 215
 	}
@@ -222,20 +222,20 @@  discard block
 block discarded – undo
222 222
 	 * @param string $slug The module slug.
223 223
 	 * @param string $file The main module file.
224 224
 	 */
225
-	private static function maybe_load_textdomain( $slug, $file ) {
225
+	private static function maybe_load_textdomain($slug, $file) {
226 226
 
227
-		if ( empty( self::$registered[ $slug ]['text_domain'] ) ) {
227
+		if (empty(self::$registered[$slug]['text_domain'])) {
228 228
 			return;
229 229
 		}
230 230
 
231 231
 		$path = false;
232 232
 
233
-		if ( ! empty( self::$registered[ $slug ]['domain_path'] ) ) {
234
-			$path = wordpoints_module_basename( $file ) . self::$registered[ $slug ]['domain_path'];
233
+		if ( ! empty(self::$registered[$slug]['domain_path'])) {
234
+			$path = wordpoints_module_basename($file) . self::$registered[$slug]['domain_path'];
235 235
 		}
236 236
 
237 237
 		wordpoints_load_module_textdomain(
238
-			self::$registered[ $slug ]['text_domain']
238
+			self::$registered[$slug]['text_domain']
239 239
 			, $path
240 240
 		);
241 241
 	}
Please login to merge, or discard this patch.
src/includes/class-shortcode.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	 * @param string $shortcode The shortcode to register a handler class for.
46 46
 	 * @param string $class     The handler class for this shortcode.
47 47
 	 */
48
-	public static function register( $shortcode, $class ) {
48
+	public static function register($shortcode, $class) {
49 49
 
50
-		self::$shortcodes[ $shortcode ] = $class;
50
+		self::$shortcodes[$shortcode] = $class;
51 51
 
52
-		add_shortcode( $shortcode, array( __CLASS__, 'do_shortcode' ) );
52
+		add_shortcode($shortcode, array(__CLASS__, 'do_shortcode'));
53 53
 	}
54 54
 
55 55
 	/**
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	 *                                          or a handler, or false if $shortcode
72 72
 	 *                                          is invalid.
73 73
 	 */
74
-	public static function get( $shortcode = null, $atts = null, $content = null ) {
74
+	public static function get($shortcode = null, $atts = null, $content = null) {
75 75
 
76
-		if ( isset( $shortcode ) ) {
76
+		if (isset($shortcode)) {
77 77
 
78
-			if ( isset( self::$shortcodes[ $shortcode ] ) ) {
79
-				return new self::$shortcodes[ $shortcode ]( $atts, $content, $shortcode );
78
+			if (isset(self::$shortcodes[$shortcode])) {
79
+				return new self::$shortcodes[$shortcode]($atts, $content, $shortcode);
80 80
 			} else {
81 81
 				return false;
82 82
 			}
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return string The content generated for this shortcode.
105 105
 	 */
106
-	public static function do_shortcode( $atts, $content, $shortcode ) {
106
+	public static function do_shortcode($atts, $content, $shortcode) {
107 107
 
108
-		if ( ! isset( self::$shortcodes[ $shortcode ] ) ) {
108
+		if ( ! isset(self::$shortcodes[$shortcode])) {
109 109
 			return wordpoints_shortcode_error(
110 110
 				sprintf(
111
-					esc_html__( 'The %s shortcode was not registered properly.', 'wordpoints' )
112
-					, '<code>[' . esc_html( $shortcode ) . ']</code>'
111
+					esc_html__('The %s shortcode was not registered properly.', 'wordpoints')
112
+					, '<code>[' . esc_html($shortcode) . ']</code>'
113 113
 				)
114 114
 			);
115 115
 		}
116 116
 
117
-		$shortcode = new self::$shortcodes[ $shortcode ]( $atts, $content, $shortcode );
117
+		$shortcode = new self::$shortcodes[$shortcode]($atts, $content, $shortcode);
118 118
 		return $shortcode->expand();
119 119
 	}
120 120
 }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 * @param string $content   The shortcode's content.
206 206
 	 * @param string $shortcode The shortcode's name.
207 207
 	 */
208
-	public function __construct( $atts, $content, $shortcode = null ) {
208
+	public function __construct($atts, $content, $shortcode = null) {
209 209
 
210 210
 		$this->atts = $atts;
211 211
 		$this->content = $content;
212 212
 
213
-		if ( isset( $shortcode ) ) {
213
+		if (isset($shortcode)) {
214 214
 			$this->shortcode = $shortcode;
215 215
 		}
216 216
 	}
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function expand() {
230 230
 
231
-		$this->atts = shortcode_atts( $this->pairs, $this->atts, $this->shortcode );
231
+		$this->atts = shortcode_atts($this->pairs, $this->atts, $this->shortcode);
232 232
 
233 233
 		/**
234 234
 		 * Filter the shortcode attribute values supplied by the user.
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$error = $this->verify_atts();
259 259
 
260
-		if ( ! empty( $error ) ) {
261
-			return wordpoints_shortcode_error( $error );
260
+		if ( ! empty($error)) {
261
+			return wordpoints_shortcode_error($error);
262 262
 		}
263 263
 
264 264
 		return $this->generate();
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 	protected function verify_atts() {
284 284
 
285 285
 		// If this shortcode supports the user_id attribute, verify it.
286
-		if ( isset( $this->pairs['user_id'] ) ) {
286
+		if (isset($this->pairs['user_id'])) {
287 287
 
288
-			if ( 'post_author' === $this->atts['user_id'] ) {
288
+			if ('post_author' === $this->atts['user_id']) {
289 289
 
290 290
 				$post = get_post();
291 291
 
292
-				if ( ! $post ) {
292
+				if ( ! $post) {
293 293
 					return sprintf(
294
-						esc_html__( 'The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be used inside of a Post, Page, or other post type.', 'wordpoints' )
294
+						esc_html__('The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be used inside of a Post, Page, or other post type.', 'wordpoints')
295 295
 						, 'user_id="post_author"'
296 296
 						, "<code>[{$this->shortcode}]</code>"
297 297
 					);
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
 
300 300
 				$this->atts['user_id'] = $post->post_author;
301 301
 
302
-			} elseif ( ! $this->atts['user_id'] ) {
302
+			} elseif ( ! $this->atts['user_id']) {
303 303
 
304 304
 				$this->atts['user_id'] = get_current_user_id();
305 305
 
306
-			} elseif ( ! wordpoints_posint( $this->atts['user_id'] ) ) {
306
+			} elseif ( ! wordpoints_posint($this->atts['user_id'])) {
307 307
 
308 308
 				return sprintf(
309
-					esc_html__( 'Unrecognized value for the %1$s attribute of the %2$s shortcode. Expected &#8220;%3$s&#8221; or a user ID.', 'wordpoints' )
309
+					esc_html__('Unrecognized value for the %1$s attribute of the %2$s shortcode. Expected &#8220;%3$s&#8221; or a user ID.', 'wordpoints')
310 310
 					, 'user_id'
311 311
 					, "<code>[{$this->shortcode}]</code>"
312 312
 					, 'post_author'
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
 	 *
281 281
 	 * @since 1.8.0
282 282
 	 *
283
-	 * @return string|WP_Error|null An error message or object on failure.
283
+	 * @return string|null An error message or object on failure.
284 284
 	 */
285 285
 	protected function verify_atts() {
286 286
 
Please login to merge, or discard this patch.
src/includes/apps.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wordpoints_apps() {
22 22
 
23
-	if ( ! isset( WordPoints_App::$main ) ) {
24
-		WordPoints_App::$main = new WordPoints_App( 'apps' );
23
+	if ( ! isset(WordPoints_App::$main)) {
24
+		WordPoints_App::$main = new WordPoints_App('apps');
25 25
 	}
26 26
 
27 27
 	return WordPoints_App::$main;
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @param WordPoints_App $app The main apps app.
38 38
  */
39
-function wordpoints_apps_init( $app ) {
39
+function wordpoints_apps_init($app) {
40 40
 
41 41
 	$apps = $app->sub_apps();
42 42
 
43
-	$apps->register( 'hooks', 'WordPoints_Hooks' );
44
-	$apps->register( 'entities', 'WordPoints_App_Registry' );
45
-	$apps->register( 'data_types', 'WordPoints_Class_Registry' );
46
-	$apps->register( 'components', 'WordPoints_App' );
47
-	$apps->register( 'modules', 'WordPoints_App' );
43
+	$apps->register('hooks', 'WordPoints_Hooks');
44
+	$apps->register('entities', 'WordPoints_App_Registry');
45
+	$apps->register('data_types', 'WordPoints_Class_Registry');
46
+	$apps->register('components', 'WordPoints_App');
47
+	$apps->register('modules', 'WordPoints_App');
48 48
 }
49 49
 
50 50
 /**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
  * @return array The slug parsed into the 'generic' and 'dynamic' portions. If the
64 64
  *               slug is not dynamic, the value of each of those keys will be false.
65 65
  */
66
-function wordpoints_parse_dynamic_slug( $slug ) {
66
+function wordpoints_parse_dynamic_slug($slug) {
67 67
 
68
-	$parsed = array( 'dynamic' => false, 'generic' => false );
68
+	$parsed = array('dynamic' => false, 'generic' => false);
69 69
 
70
-	$parts = explode( '\\', $slug, 2 );
70
+	$parts = explode('\\', $slug, 2);
71 71
 
72
-	if ( isset( $parts[1] ) ) {
72
+	if (isset($parts[1])) {
73 73
 		$parsed['dynamic'] = $parts[1];
74 74
 		$parsed['generic'] = $parts[0];
75 75
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function wordpoints_get_post_types_for_auto_integration() {
88 88
 
89
-	$post_types = get_post_types( array( 'public' => true ) );
89
+	$post_types = get_post_types(array('public' => true));
90 90
 
91 91
 	/**
92 92
 	 * Filter which post types to automatically integrate with.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @param string[] $post_types The post type slugs ("names").
97 97
 	 */
98
-	return apply_filters( 'wordpoints_post_types_for_auto_integration', $post_types );
98
+	return apply_filters('wordpoints_post_types_for_auto_integration', $post_types);
99 99
 }
100 100
 
101 101
 //
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return false|WordPoints_App The component's app.
113 113
  */
114
-function wordpoints_component( $slug ) {
114
+function wordpoints_component($slug) {
115 115
 
116
-	if ( ! isset( WordPoints_App::$main ) ) {
116
+	if ( ! isset(WordPoints_App::$main)) {
117 117
 		wordpoints_apps();
118 118
 	}
119 119
 
120
-	return WordPoints_App::$main->get_sub_app( 'components' )->get_sub_app( $slug );
120
+	return WordPoints_App::$main->get_sub_app('components')->get_sub_app($slug);
121 121
 }
122 122
 
123 123
 //
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return false|WordPoints_App The module's app.
135 135
  */
136
-function wordpoints_module( $slug ) {
136
+function wordpoints_module($slug) {
137 137
 
138
-	if ( ! isset( WordPoints_App::$main ) ) {
138
+	if ( ! isset(WordPoints_App::$main)) {
139 139
 		wordpoints_apps();
140 140
 	}
141 141
 
142
-	return WordPoints_App::$main->get_sub_app( 'modules' )->get_sub_app( $slug );
142
+	return WordPoints_App::$main->get_sub_app('modules')->get_sub_app($slug);
143 143
 }
144 144
 
145 145
 //
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function wordpoints_entities() {
157 157
 
158
-	if ( ! isset( WordPoints_App::$main ) ) {
158
+	if ( ! isset(WordPoints_App::$main)) {
159 159
 		wordpoints_apps();
160 160
 	}
161 161
 
162
-	return WordPoints_App::$main->get_sub_app( 'entities' );
162
+	return WordPoints_App::$main->get_sub_app('entities');
163 163
 }
164 164
 
165 165
 /**
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @param WordPoints_App_Registry $entities The entities app.
173 173
  */
174
-function wordpoints_entities_app_init( $entities ) {
174
+function wordpoints_entities_app_init($entities) {
175 175
 
176 176
 	$sub_apps = $entities->sub_apps();
177
-	$sub_apps->register( 'children', 'WordPoints_Class_Registry_Children' );
178
-	$sub_apps->register( 'contexts', 'WordPoints_Entity_Contexts' );
179
-	$sub_apps->register( 'restrictions', 'WordPoints_Entity_Restrictions' );
177
+	$sub_apps->register('children', 'WordPoints_Class_Registry_Children');
178
+	$sub_apps->register('contexts', 'WordPoints_Entity_Contexts');
179
+	$sub_apps->register('restrictions', 'WordPoints_Entity_Restrictions');
180 180
 }
181 181
 
182 182
 /**
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
  *
189 189
  * @param WordPoints_Class_RegistryI $contexts The entity context registry.
190 190
  */
191
-function wordpoints_entity_contexts_init( $contexts ) {
191
+function wordpoints_entity_contexts_init($contexts) {
192 192
 
193
-	$contexts->register( 'network', 'WordPoints_Entity_Context_Network' );
194
-	$contexts->register( 'site', 'WordPoints_Entity_Context_Site' );
193
+	$contexts->register('network', 'WordPoints_Entity_Context_Network');
194
+	$contexts->register('site', 'WordPoints_Entity_Context_Site');
195 195
 }
196 196
 
197 197
 /**
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @param WordPoints_App $restrictions The entity restrictions app.
205 205
  */
206
-function wordpoints_entities_restrictions_app_init( $restrictions ) {
206
+function wordpoints_entities_restrictions_app_init($restrictions) {
207 207
 
208 208
 	$sub_apps = $restrictions->sub_apps();
209
-	$sub_apps->register( 'know', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless' );
210
-	$sub_apps->register( 'view', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless' );
209
+	$sub_apps->register('know', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless');
210
+	$sub_apps->register('view', 'WordPoints_Class_Registry_Deep_Multilevel_Slugless');
211 211
 }
212 212
 
213 213
 /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
  * @param WordPoints_Class_Registry_Deep_Multilevel $restrictions The restrictions
224 224
  *                                                                registry.
225 225
  */
226
-function wordpoints_entity_restrictions_know_init( $restrictions ) {
226
+function wordpoints_entity_restrictions_know_init($restrictions) {
227 227
 
228 228
 	$restrictions->register(
229 229
 		'unregistered'
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 		, 'WordPoints_Entity_Restriction_Legacy'
238 238
 	);
239 239
 
240
-	foreach ( wordpoints_get_post_types_for_entities() as $slug ) {
240
+	foreach (wordpoints_get_post_types_for_entities() as $slug) {
241 241
 
242 242
 		$restrictions->register(
243 243
 			'status_nonpublic'
244
-			, array( "post\\$slug" )
244
+			, array("post\\$slug")
245 245
 			, 'WordPoints_Entity_Restriction_Post_Status_Nonpublic'
246 246
 		);
247 247
 
248 248
 		$restrictions->register(
249 249
 			'post_status_nonpublic'
250
-			, array( "comment\\$slug" )
250
+			, array("comment\\$slug")
251 251
 			, 'WordPoints_Entity_Restriction_Comment_Post_Status_Nonpublic'
252 252
 		);
253 253
 	}
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
  * @param WordPoints_Class_Registry_Deep_Multilevel $restrictions The restrictions
264 264
  *                                                                registry.
265 265
  */
266
-function wordpoints_entity_restrictions_view_init( $restrictions ) {
266
+function wordpoints_entity_restrictions_view_init($restrictions) {
267 267
 
268
-	foreach ( wordpoints_get_post_types_for_entities() as $slug ) {
268
+	foreach (wordpoints_get_post_types_for_entities() as $slug) {
269 269
 
270 270
 		$restrictions->register(
271 271
 			'password_protected'
272
-			, array( "post\\$slug", 'content' )
272
+			, array("post\\$slug", 'content')
273 273
 			, 'WordPoints_Entity_Restriction_View_Post_Content_Password_Protected'
274 274
 		);
275 275
 	}
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
  *
285 285
  * @param WordPoints_App_Registry $entities The entities app.
286 286
  */
287
-function wordpoints_entities_init( $entities ) {
287
+function wordpoints_entities_init($entities) {
288 288
 
289
-	$children = $entities->get_sub_app( 'children' );
289
+	$children = $entities->get_sub_app('children');
290 290
 
291
-	$entities->register( 'user', 'WordPoints_Entity_User' );
292
-	$children->register( 'user', 'roles', 'WordPoints_Entity_User_Roles' );
291
+	$entities->register('user', 'WordPoints_Entity_User');
292
+	$children->register('user', 'roles', 'WordPoints_Entity_User_Roles');
293 293
 
294
-	$entities->register( 'user_role', 'WordPoints_Entity_User_Role' );
294
+	$entities->register('user_role', 'WordPoints_Entity_User_Role');
295 295
 
296
-	foreach ( wordpoints_get_post_types_for_entities() as $slug ) {
297
-		wordpoints_register_post_type_entities( $slug );
296
+	foreach (wordpoints_get_post_types_for_entities() as $slug) {
297
+		wordpoints_register_post_type_entities($slug);
298 298
 	}
299 299
 }
300 300
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @param string[] $post_types The post type slugs ("names").
318 318
 	 */
319
-	return apply_filters( 'wordpoints_register_entities_for_post_types', $post_types );
319
+	return apply_filters('wordpoints_register_entities_for_post_types', $post_types);
320 320
 }
321 321
 
322 322
 /**
@@ -326,24 +326,24 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @param string $slug The slug of the post type.
328 328
  */
329
-function wordpoints_register_post_type_entities( $slug ) {
329
+function wordpoints_register_post_type_entities($slug) {
330 330
 
331 331
 	$entities = wordpoints_entities();
332
-	$children = $entities->get_sub_app( 'children' );
332
+	$children = $entities->get_sub_app('children');
333 333
 
334
-	$entities->register( "post\\{$slug}", 'WordPoints_Entity_Post' );
335
-	$children->register( "post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author' );
334
+	$entities->register("post\\{$slug}", 'WordPoints_Entity_Post');
335
+	$children->register("post\\{$slug}", 'author', 'WordPoints_Entity_Post_Author');
336 336
 
337
-	$supports = get_all_post_type_supports( $slug );
337
+	$supports = get_all_post_type_supports($slug);
338 338
 
339
-	if ( isset( $supports['editor'] ) ) {
340
-		$children->register( "post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content' );
339
+	if (isset($supports['editor'])) {
340
+		$children->register("post\\{$slug}", 'content', 'WordPoints_Entity_Post_Content');
341 341
 	}
342 342
 
343
-	if ( isset( $supports['comments'] ) ) {
344
-		$entities->register( "comment\\{$slug}", 'WordPoints_Entity_Comment' );
345
-		$children->register( "comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post' );
346
-		$children->register( "comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author' );
343
+	if (isset($supports['comments'])) {
344
+		$entities->register("comment\\{$slug}", 'WordPoints_Entity_Comment');
345
+		$children->register("comment\\{$slug}", "post\\{$slug}", 'WordPoints_Entity_Comment_Post');
346
+		$children->register("comment\\{$slug}", 'author', 'WordPoints_Entity_Comment_Author');
347 347
 	}
348 348
 
349 349
 	/**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @param string $slug The slug ("name") of the post type.
355 355
 	 */
356
-	do_action( 'wordpoints_register_post_type_entities', $slug );
356
+	do_action('wordpoints_register_post_type_entities', $slug);
357 357
 }
358 358
 
359 359
 /**
@@ -368,12 +368,12 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return bool Whether the user can view this entity.
370 370
  */
371
-function wordpoints_entity_user_can_view( $user_id, $entity_slug, $entity_id ) {
371
+function wordpoints_entity_user_can_view($user_id, $entity_slug, $entity_id) {
372 372
 
373 373
 	/** @var WordPoints_Entity_Restrictions $restrictions */
374
-	$restrictions = wordpoints_entities()->get_sub_app( 'restrictions' );
375
-	$restriction = $restrictions->get( $entity_id, $entity_slug, 'view' );
376
-	return $restriction->user_can( $user_id );
374
+	$restrictions = wordpoints_entities()->get_sub_app('restrictions');
375
+	$restriction = $restrictions->get($entity_id, $entity_slug, 'view');
376
+	return $restriction->user_can($user_id);
377 377
 }
378 378
 
379 379
 /**
@@ -407,28 +407,28 @@  discard block
 block discarded – undo
407 407
  *                     contexts, indexed by context slug, or false if any of the
408 408
  *                     contexts isn't current.
409 409
  */
410
-function wordpoints_entities_get_current_context_id( $slug ) {
410
+function wordpoints_entities_get_current_context_id($slug) {
411 411
 
412 412
 	$current_context = array();
413 413
 
414 414
 	/** @var WordPoints_Class_Registry $contexts */
415
-	$contexts = wordpoints_entities()->get_sub_app( 'contexts' );
415
+	$contexts = wordpoints_entities()->get_sub_app('contexts');
416 416
 
417
-	while ( $slug ) {
417
+	while ($slug) {
418 418
 
419
-		$context = $contexts->get( $slug );
419
+		$context = $contexts->get($slug);
420 420
 
421
-		if ( ! $context instanceof WordPoints_Entity_Context ) {
421
+		if ( ! $context instanceof WordPoints_Entity_Context) {
422 422
 			return false;
423 423
 		}
424 424
 
425 425
 		$id = $context->get_current_id();
426 426
 
427
-		if ( false === $id ) {
427
+		if (false === $id) {
428 428
 			return false;
429 429
 		}
430 430
 
431
-		$current_context[ $slug ] = $id;
431
+		$current_context[$slug] = $id;
432 432
 
433 433
 		$slug = $context->get_parent_slug();
434 434
 	}
@@ -449,22 +449,22 @@  discard block
 block discarded – undo
449 449
  */
450 450
 function wordpoints_is_network_context() {
451 451
 
452
-	if ( ! is_multisite() ) {
452
+	if ( ! is_multisite()) {
453 453
 		return false;
454 454
 	}
455 455
 
456
-	if ( is_network_admin() ) {
456
+	if (is_network_admin()) {
457 457
 		return true;
458 458
 	}
459 459
 
460 460
 	// See https://core.trac.wordpress.org/ticket/22589
461 461
 	if (
462
-		defined( 'DOING_AJAX' )
462
+		defined('DOING_AJAX')
463 463
 		&& DOING_AJAX
464
-		&& isset( $_SERVER['HTTP_REFERER'] )
464
+		&& isset($_SERVER['HTTP_REFERER'])
465 465
 		&& preg_match(
466
-			'#^' . preg_quote( network_admin_url(), '#' ) . '#i'
467
-			, esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) )
466
+			'#^' . preg_quote(network_admin_url(), '#') . '#i'
467
+			, esc_url_raw(wp_unslash($_SERVER['HTTP_REFERER']))
468 468
 		)
469 469
 	) {
470 470
 		return true;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 *
478 478
 	 * @param bool $in_network_context Whether we are in network context.
479 479
 	 */
480
-	return apply_filters( 'wordpoints_is_network_context', false );
480
+	return apply_filters('wordpoints_is_network_context', false);
481 481
 }
482 482
 
483 483
 //
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
  *
494 494
  * @param WordPoints_Class_RegistryI $data_types The data types registry.
495 495
  */
496
-function wordpoints_data_types_init( $data_types ) {
496
+function wordpoints_data_types_init($data_types) {
497 497
 
498
-	$data_types->register( 'integer', 'WordPoints_Data_Type_Integer' );
499
-	$data_types->register( 'text', 'WordPoints_Data_Type_Text' );
498
+	$data_types->register('integer', 'WordPoints_Data_Type_Integer');
499
+	$data_types->register('text', 'WordPoints_Data_Type_Text');
500 500
 }
501 501
 
502 502
 // EOF
Please login to merge, or discard this patch.
src/admin/admin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @since 2.1.0
19 19
  */
20
-require_once( WORDPOINTS_DIR . '/admin/includes/functions.php' );
20
+require_once(WORDPOINTS_DIR . '/admin/includes/functions.php');
21 21
 
22 22
 /**
23 23
  * Admin-side hooks.
24 24
  *
25 25
  * @since 2.1.0
26 26
  */
27
-require_once( WORDPOINTS_DIR . '/admin/includes/filters.php' );
27
+require_once(WORDPOINTS_DIR . '/admin/includes/filters.php');
28 28
 
29 29
 /**
30 30
  * Screen: Configuration.
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  */
34 34
 include_once WORDPOINTS_DIR . 'admin/screens/configure.php';
35 35
 
36
-WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'admin/includes' );
37
-WordPoints_Class_Autoloader::register_dir( WORDPOINTS_DIR . 'admin/classes' );
36
+WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'admin/includes');
37
+WordPoints_Class_Autoloader::register_dir(WORDPOINTS_DIR . 'admin/classes');
38 38
 
39 39
 // EOF
Please login to merge, or discard this patch.
src/admin/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_print_footer_scripts', array( $this, 'footer_scripts' ) );
65
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
66
+		add_action('admin_print_footer_scripts', 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.