Completed
Push — master ( 0cb291...9bc524 )
by J.D.
14s queued 10s
created
tests/phpunit/includes/mocks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param array $settings The settings for this "component".
62 62
 	 */
63
-	public function do_an_import( $settings ) {
63
+	public function do_an_import($settings) {
64 64
 
65 65
 		$this->imports[] = $settings;
66 66
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return true
76 76
 	 */
77
-	public function can_import( $settings ) {
77
+	public function can_import($settings) {
78 78
 
79 79
 		$this->can_imports[] = $settings;
80 80
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return WP_Error An error.
92 92
 	 */
93
-	public function cant_import( $settings ) {
93
+	public function cant_import($settings) {
94 94
 
95 95
 		$this->can_imports[] = $settings;
96 96
 
Please login to merge, or discard this patch.
src/admin/screens/importing.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( true !== current_user_can( 'manage_options' ) ) {
10
+if (true !== current_user_can('manage_options')) {
11 11
 	wp_die();
12 12
 }
13 13
 
14
-check_admin_referer( 'wordpoints_import' );
14
+check_admin_referer('wordpoints_import');
15 15
 
16 16
 ?>
17 17
 
18
-<h2><?php esc_html_e( 'WordPoints Importer', 'wordpoints-importer' ); ?></h2>
18
+<h2><?php esc_html_e('WordPoints Importer', 'wordpoints-importer'); ?></h2>
19 19
 
20 20
 <div class="wrap">
21
-	<p><?php esc_html_e( 'Starting import (this could take a few moments)&hellip;', 'wordpoints-importer' ); ?></p>
21
+	<p><?php esc_html_e('Starting import (this could take a few moments)&hellip;', 'wordpoints-importer'); ?></p>
22 22
 
23
-	<iframe src="<?php echo esc_url( self_admin_url( 'update.php?action=wordpoints_import&' . http_build_query( $_POST ) ) ); ?>" style="width: 100%; height:100%; min-height:850px;"></iframe>
23
+	<iframe src="<?php echo esc_url(self_admin_url('update.php?action=wordpoints_import&'.http_build_query($_POST))); ?>" style="width: 100%; height:100%; min-height:850px;"></iframe>
24 24
 </div>
Please login to merge, or discard this patch.
tests/phpunit/includes/activate-cubepoints-components.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
  * @since 1.2.1
8 8
  */
9 9
 
10
-foreach ( $data as $module_slug ) {
11
-	cp_module_activation_set( $module_slug, 'active' );
10
+foreach ($data as $module_slug) {
11
+	cp_module_activation_set($module_slug, 'active');
12 12
 }
13 13
 
14 14
 // EOF
Please login to merge, or discard this patch.
src/importer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@
 block discarded – undo
44 44
 	, __FILE__
45 45
 );
46 46
 
47
-WordPoints_Class_Autoloader::register_dir( dirname( __FILE__ ) . '/includes' );
47
+WordPoints_Class_Autoloader::register_dir(dirname(__FILE__).'/includes');
48 48
 
49 49
 /**
50 50
  * The extension's general functions.
51 51
  *
52 52
  * @since 1.0.0
53 53
  */
54
-require_once dirname( __FILE__ ) . '/includes/functions.php';
54
+require_once dirname(__FILE__).'/includes/functions.php';
55 55
 
56
-if ( is_admin() ) {
56
+if (is_admin()) {
57 57
 
58 58
 	/**
59 59
 	 * The extension's admin-side code.
60 60
 	 *
61 61
 	 * @since 1.0.0
62 62
 	 */
63
-	require_once dirname( __FILE__ ) . '/admin/admin.php';
63
+	require_once dirname(__FILE__).'/admin/admin.php';
64 64
 }
65 65
 
66 66
 // EOF
Please login to merge, or discard this patch.
src/admin/admin.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 	add_submenu_page(
18 18
 		wordpoints_get_main_admin_menu()
19
-		,__( 'WordPoints — Import', 'wordpoints-importer' )
20
-		,__( 'Import', 'wordpoints-importer' )
19
+		,__('WordPoints — Import', 'wordpoints-importer')
20
+		,__('Import', 'wordpoints-importer')
21 21
 		,'manage_options'
22 22
 		,'wordpoints_import'
23 23
 		,'wordpoints_import_admin_screen'
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 	add_submenu_page(
27 27
 		'_wordpoints_import' // Fake.
28
-		,__( 'WordPoints — Importing', 'wordpoints-importer' )
29
-		,__( 'Importing', 'wordpoints-importer' )
28
+		,__('WordPoints — Importing', 'wordpoints-importer')
29
+		,__('Importing', 'wordpoints-importer')
30 30
 		,'manage_options'
31 31
 		,'wordpoints_importing'
32 32
 		,'wordpoints_importing_admin_screen'
33 33
 	);
34 34
 }
35
-add_action( 'admin_menu', 'wordpoints_importer_admin_menu' );
36
-add_action( 'network_admin_menu', 'wordpoints_importer_admin_menu' );
35
+add_action('admin_menu', 'wordpoints_importer_admin_menu');
36
+add_action('network_admin_menu', 'wordpoints_importer_admin_menu');
37 37
 
38 38
 /**
39 39
  * Display the importer administration screen.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 *
48 48
 	 * @since 1.0.0
49 49
 	 */
50
-	require dirname( __FILE__ ) . '/screens/import.php';
50
+	require dirname(__FILE__).'/screens/import.php';
51 51
 }
52 52
 
53 53
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @since 1.0.0
64 64
 	 */
65
-	require dirname( __FILE__ ) . '/screens/importing.php';
65
+	require dirname(__FILE__).'/screens/importing.php';
66 66
 }
67 67
 
68 68
 /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	$assets_url = wordpoints_extensions_url(
76 76
 		'admin/assets'
77
-		, dirname( dirname( __FILE__ ) ) . '/importer.php'
77
+		, dirname(dirname(__FILE__)).'/importer.php'
78 78
 	);
79 79
 
80 80
 	$suffix = SCRIPT_DEBUG ? '' : '.min';
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		, "{$assets_url}/css/feedback{$suffix}.css"
85 85
 	);
86 86
 }
87
-add_action( 'init', 'wordpoints_importer_register_admin_scripts' );
87
+add_action('init', 'wordpoints_importer_register_admin_scripts');
88 88
 
89 89
 /**
90 90
  * Handle an import request.
@@ -93,43 +93,43 @@  discard block
 block discarded – undo
93 93
  */
94 94
 function wordpoints_importer_do_import() {
95 95
 
96
-	if ( ! defined( 'IFRAME_REQUEST' ) ) {
97
-		define( 'IFRAME_REQUEST', true );
96
+	if (!defined('IFRAME_REQUEST')) {
97
+		define('IFRAME_REQUEST', true);
98 98
 	}
99 99
 
100
-	if ( ! current_user_can( 'manage_options' ) ) {
101
-		wp_die( esc_html__( 'Sorry, you are not allowed to import to WordPoints.', 'wordpoints-importer' ) );
100
+	if (!current_user_can('manage_options')) {
101
+		wp_die(esc_html__('Sorry, you are not allowed to import to WordPoints.', 'wordpoints-importer'));
102 102
 	}
103 103
 
104
-	check_admin_referer( 'wordpoints_import' );
104
+	check_admin_referer('wordpoints_import');
105 105
 
106
-	if ( ! isset( $_GET['importer'] ) ) {
107
-		wp_die( esc_html__( 'No importer selected.', 'wordpoints-importer' ) );
106
+	if (!isset($_GET['importer'])) {
107
+		wp_die(esc_html__('No importer selected.', 'wordpoints-importer'));
108 108
 	}
109 109
 
110 110
 	$importer = WordPoints_Importers::get_importer(
111
-		sanitize_key( $_GET['importer'] )
111
+		sanitize_key($_GET['importer'])
112 112
 	);
113 113
 
114
-	if ( ! ( $importer instanceof WordPoints_Importer ) ) {
115
-		wp_die( esc_html__( 'Importer not installed.', 'wordpoints-importer' ) );
114
+	if (!($importer instanceof WordPoints_Importer)) {
115
+		wp_die(esc_html__('Importer not installed.', 'wordpoints-importer'));
116 116
 	}
117 117
 
118
-	wp_enqueue_style( 'wordpoints-importer-feedback' );
118
+	wp_enqueue_style('wordpoints-importer-feedback');
119 119
 
120 120
 	$args = array();
121 121
 
122
-	if ( isset( $_GET['wordpoints_import'] ) && is_array( $_GET['wordpoints_import'] ) ) {
123
-		$args = wp_unslash( $_GET['wordpoints_import'] ); // WPCS: sanitization OK.
122
+	if (isset($_GET['wordpoints_import']) && is_array($_GET['wordpoints_import'])) {
123
+		$args = wp_unslash($_GET['wordpoints_import']); // WPCS: sanitization OK.
124 124
 	}
125 125
 
126 126
 	iframe_header();
127 127
 
128
-	$importer->do_import( $args );
128
+	$importer->do_import($args);
129 129
 
130 130
 	iframe_footer();
131 131
 }
132
-add_action( 'update-custom_wordpoints_import', 'wordpoints_importer_do_import' );
132
+add_action('update-custom_wordpoints_import', 'wordpoints_importer_do_import');
133 133
 
134 134
 /**
135 135
  * Display a points type dropdown above the points component settings.
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
  */
139 139
 function wordpoints_importer_admin_screen_points_type_select() {
140 140
 
141
-	$args = array( 'name' => 'wordpoints_import[points][_data][points_type]' );
141
+	$args = array('name' => 'wordpoints_import[points][_data][points_type]');
142 142
 
143 143
 	?>
144 144
 
145 145
 	<p>
146 146
 		<label for="wordpoints_import[points][_data][points_type]">
147
-			<?php esc_html_e( 'Import to points type:', 'wordpoints-importer' ); ?>
148
-			<?php wordpoints_points_types_dropdown( $args ); ?>
147
+			<?php esc_html_e('Import to points type:', 'wordpoints-importer'); ?>
148
+			<?php wordpoints_points_types_dropdown($args); ?>
149 149
 		</label>
150 150
 	</p>
151 151
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return bool Whether the settings are valid.
169 169
  */
170
-function wordpoints_importer_validate_points_type_setting( $valid, $settings, $feedback ) {
170
+function wordpoints_importer_validate_points_type_setting($valid, $settings, $feedback) {
171 171
 
172
-	if ( $valid ) {
172
+	if ($valid) {
173 173
 
174
-		if ( ! isset( $settings['points_type'] ) ) {
175
-			$feedback->warning( __( 'Skipping Points component—no points type specified.', 'wordpoints-importer' ) );
174
+		if (!isset($settings['points_type'])) {
175
+			$feedback->warning(__('Skipping Points component—no points type specified.', 'wordpoints-importer'));
176 176
 			$valid = false;
177
-		} elseif ( ! wordpoints_is_points_type( $settings['points_type'] ) ) {
178
-			$feedback->warning( __( 'Skipping Points component—invalid points type selected.', 'wordpoints-importer' ) );
177
+		} elseif (!wordpoints_is_points_type($settings['points_type'])) {
178
+			$feedback->warning(__('Skipping Points component—invalid points type selected.', 'wordpoints-importer'));
179 179
 			$valid = false;
180 180
 		}
181 181
 	}
@@ -200,20 +200,20 @@  discard block
 block discarded – undo
200 200
 
201 201
 	// See https://github.com/WordPoints/wordpoints/issues/310.
202 202
 	$options = array();
203
-	foreach ( $rank_groups as $rank_group ) {
204
-		$options[ $rank_group->slug ] = $rank_group->name;
203
+	foreach ($rank_groups as $rank_group) {
204
+		$options[$rank_group->slug] = $rank_group->name;
205 205
 	}
206 206
 
207 207
 	$dropdown = new WordPoints_Dropdown_Builder(
208 208
 		$options
209
-		, array( 'name' => 'wordpoints_import[ranks][_data][rank_group]' )
209
+		, array('name' => 'wordpoints_import[ranks][_data][rank_group]')
210 210
 	);
211 211
 
212 212
 	?>
213 213
 
214 214
 	<p>
215 215
 		<label for="wordpoints_import[ranks][_data][rank_group]">
216
-			<?php esc_html_e( 'Import to rank group:', 'wordpoints-importer' ); ?>
216
+			<?php esc_html_e('Import to rank group:', 'wordpoints-importer'); ?>
217 217
 			<?php $dropdown->display(); ?>
218 218
 		</label>
219 219
 	</p>
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
  *
237 237
  * @return bool Whether the settings are valid.
238 238
  */
239
-function wordpoints_importer_validate_rank_group_setting( $valid, $settings, $feedback ) {
239
+function wordpoints_importer_validate_rank_group_setting($valid, $settings, $feedback) {
240 240
 
241
-	if ( $valid ) {
241
+	if ($valid) {
242 242
 
243
-		if ( ! isset( $settings['rank_group'] ) ) {
244
-			$feedback->warning( __( 'Skipping Ranks component—no rank group specified.', 'wordpoints-importer' ) );
243
+		if (!isset($settings['rank_group'])) {
244
+			$feedback->warning(__('Skipping Ranks component—no rank group specified.', 'wordpoints-importer'));
245 245
 			$valid = false;
246
-		} elseif ( ! WordPoints_Rank_Groups::is_group_registered( $settings['rank_group'] ) ) {
247
-			$feedback->warning( __( 'Skipping Ranks component—invalid rank group selected.', 'wordpoints-importer' ) );
246
+		} elseif (!WordPoints_Rank_Groups::is_group_registered($settings['rank_group'])) {
247
+			$feedback->warning(__('Skipping Ranks component—invalid rank group selected.', 'wordpoints-importer'));
248 248
 			$valid = false;
249 249
 		}
250 250
 	}
Please login to merge, or discard this patch.
src/admin/screens/import.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -7,55 +7,55 @@  discard block
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( true !== current_user_can( 'manage_options' ) ) {
10
+if (true !== current_user_can('manage_options')) {
11 11
 	wp_die();
12 12
 }
13 13
 
14
-$tabs = array( 'unavailable' => __( 'Unavailable', 'wordpoints-importer' ) );
14
+$tabs = array('unavailable' => __('Unavailable', 'wordpoints-importer'));
15 15
 $unavailable = array();
16 16
 
17
-foreach ( WordPoints_Importers::get() as $slug => $args ) {
17
+foreach (WordPoints_Importers::get() as $slug => $args) {
18 18
 
19
-	$importer = WordPoints_Importers::get_importer( $slug );
19
+	$importer = WordPoints_Importers::get_importer($slug);
20 20
 
21 21
 	$is_available = $importer->is_available();
22 22
 
23
-	if ( is_wp_error( $is_available ) ) {
24
-		$unavailable[ $args['name'] ] = $is_available;
23
+	if (is_wp_error($is_available)) {
24
+		$unavailable[$args['name']] = $is_available;
25 25
 	} else {
26
-		$tabs[ $slug ] = $args['name'];
26
+		$tabs[$slug] = $args['name'];
27 27
 	}
28 28
 }
29 29
 
30
-if ( empty( $unavailable ) ) {
31
-	unset( $tabs['unavailable'] );
30
+if (empty($unavailable)) {
31
+	unset($tabs['unavailable']);
32 32
 }
33 33
 
34
-$current_tab = wordpoints_admin_get_current_tab( $tabs );
34
+$current_tab = wordpoints_admin_get_current_tab($tabs);
35 35
 
36 36
 $components = WordPoints_Components::instance()->get();
37 37
 
38 38
 ?>
39 39
 
40
-<h2><?php esc_html_e( 'WordPoints Importer', 'wordpoints-importer' ); ?></h2>
40
+<h2><?php esc_html_e('WordPoints Importer', 'wordpoints-importer'); ?></h2>
41 41
 
42 42
 <div class="wrap">
43
-	<?php wordpoints_admin_show_tabs( $tabs, false ); ?>
43
+	<?php wordpoints_admin_show_tabs($tabs, false); ?>
44 44
 
45
-	<?php if ( 'unavailable' === $current_tab ) : ?>
45
+	<?php if ('unavailable' === $current_tab) : ?>
46 46
 
47
-		<p><?php esc_html_e( 'The below importers are not currently available.', 'wordpoints-importer' ); ?></p>
47
+		<p><?php esc_html_e('The below importers are not currently available.', 'wordpoints-importer'); ?></p>
48 48
 
49 49
 		<ul>
50
-			<?php foreach ( $unavailable as $name => $error ) : ?>
50
+			<?php foreach ($unavailable as $name => $error) : ?>
51 51
 				<li>
52 52
 					<?php
53 53
 
54 54
 					printf(
55 55
 						/* translators: 1 is an importer name, 2 is the reason that it is unavailable. */
56
-						esc_html__( '%1$s — %2$s', 'wordpoints-importer' )
57
-						, '<strong>' . esc_html( $name ) . '</strong>'
58
-						, esc_html( $error->get_error_message() )
56
+						esc_html__('%1$s — %2$s', 'wordpoints-importer')
57
+						, '<strong>'.esc_html($name).'</strong>'
58
+						, esc_html($error->get_error_message())
59 59
 					);
60 60
 
61 61
 					?>
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 
66 66
 	<?php else : ?>
67 67
 
68
-		<?php $importer = WordPoints_Importers::get_importer( $current_tab ); ?>
68
+		<?php $importer = WordPoints_Importers::get_importer($current_tab); ?>
69 69
 
70
-		<p><?php esc_html_e( 'Select which items you would like imported.', 'wordpoints-importer' ); ?></p>
70
+		<p><?php esc_html_e('Select which items you would like imported.', 'wordpoints-importer'); ?></p>
71 71
 
72
-		<form method="post" action="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_importing' ) ); ?>">
73
-			<?php foreach ( $components as $slug => $component ) : ?>
72
+		<form method="post" action="<?php echo esc_url(self_admin_url('admin.php?page=wordpoints_importing')); ?>">
73
+			<?php foreach ($components as $slug => $component) : ?>
74 74
 
75 75
 				<?php
76 76
 
77
-				if ( ! $importer->supports_component( $slug ) ) {
77
+				if (!$importer->supports_component($slug)) {
78 78
 					continue;
79 79
 				}
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 				?>
84 84
 
85
-				<h3><?php echo esc_html( $component['name'] ); ?></h3>
85
+				<h3><?php echo esc_html($component['name']); ?></h3>
86 86
 
87 87
 				<?php
88 88
 
@@ -91,42 +91,42 @@  discard block
 block discarded – undo
91 91
 				 *
92 92
 				 * @since 1.0.0
93 93
 				 */
94
-				do_action( "wordpoints_importer_before_component_options-{$slug}" );
94
+				do_action("wordpoints_importer_before_component_options-{$slug}");
95 95
 
96 96
 				?>
97 97
 
98
-				<?php foreach ( $importer->get_options_for_component( $slug ) as $name => $option ) : ?>
98
+				<?php foreach ($importer->get_options_for_component($slug) as $name => $option) : ?>
99 99
 
100 100
 					<?php
101 101
 
102 102
 					$can_import = true;
103 103
 
104 104
 					// Check if this option is available.
105
-					if ( isset( $option['can_import'] ) ) {
106
-						$can_import = call_user_func( $option['can_import'], array() );
105
+					if (isset($option['can_import'])) {
106
+						$can_import = call_user_func($option['can_import'], array());
107 107
 					}
108 108
 
109 109
 					?>
110 110
 
111
-					<label for="wordpoints_import[<?php echo esc_attr( $slug ); ?>][<?php echo esc_attr( $name ); ?>]">
112
-						<input type="checkbox" value="1" id="wordpoints_import[<?php echo esc_attr( $slug ); ?>][<?php echo esc_attr( $name ); ?>]" name="wordpoints_import[<?php echo esc_attr( $slug ); ?>][<?php echo esc_attr( $name ); ?>]" <?php disabled( is_wp_error( $can_import ), true ); ?> />
113
-						<?php echo esc_html( $option['label'] ); ?>
114
-						<?php if ( is_wp_error( $can_import ) ) : ?>
111
+					<label for="wordpoints_import[<?php echo esc_attr($slug); ?>][<?php echo esc_attr($name); ?>]">
112
+						<input type="checkbox" value="1" id="wordpoints_import[<?php echo esc_attr($slug); ?>][<?php echo esc_attr($name); ?>]" name="wordpoints_import[<?php echo esc_attr($slug); ?>][<?php echo esc_attr($name); ?>]" <?php disabled(is_wp_error($can_import), true); ?> />
113
+						<?php echo esc_html($option['label']); ?>
114
+						<?php if (is_wp_error($can_import)) : ?>
115 115
 							&nbsp;&nbsp;
116 116
 							<em>
117 117
 								<?php
118 118
 
119 119
 								// translators: Error message explaining the reason why the importer is disabled.
120
-								printf( esc_html__( 'Disabled (%s)', 'wordpoints-importer' ), esc_html( $can_import->get_error_message() ) );
120
+								printf(esc_html__('Disabled (%s)', 'wordpoints-importer'), esc_html($can_import->get_error_message()));
121 121
 
122 122
 								?>
123 123
 							</em>
124 124
 						<?php endif; ?>
125 125
 					</label>
126 126
 
127
-					<?php if ( isset( $option['description'] ) ) : ?>
127
+					<?php if (isset($option['description'])) : ?>
128 128
 						<p class="description" style="margin-bottom: 10px; margin-left: 25px;">
129
-							<?php echo esc_html( $option['description'] ); ?>
129
+							<?php echo esc_html($option['description']); ?>
130 130
 						</p>
131 131
 					<?php else : ?>
132 132
 						<br style="margin-bottom: 10px" />
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 
137 137
 			<?php endforeach; ?>
138 138
 
139
-			<input type="hidden" value="<?php echo esc_attr( $current_tab ); ?>" name="importer" />
139
+			<input type="hidden" value="<?php echo esc_attr($current_tab); ?>" name="importer" />
140 140
 
141 141
 			<?php
142 142
 
143
-			if ( ! isset( $supported ) ) {
143
+			if (!isset($supported)) {
144 144
 
145 145
 				esc_html_e(
146 146
 					'This importer does not support any of the installed components.'
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
 			} else {
151 151
 
152
-				wp_nonce_field( 'wordpoints_import' );
153
-				submit_button( __( 'Import', 'wordpoints-importer' ) );
152
+				wp_nonce_field('wordpoints_import');
153
+				submit_button(__('Import', 'wordpoints-importer'));
154 154
 			}
155 155
 
156 156
 			?>
Please login to merge, or discard this patch.
src/includes/class-importer.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @param string $name The name of the importer.
64 64
 	 */
65
-	public function __construct( $name ) {
65
+	public function __construct($name) {
66 66
 
67 67
 		$this->name = $name;
68 68
 	}
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return bool True if the component is supported, otherwise false.
78 78
 	 */
79
-	public function supports_component( $component ) {
79
+	public function supports_component($component) {
80 80
 
81
-		return isset( $this->components[ $component ] );
81
+		return isset($this->components[$component]);
82 82
 	}
83 83
 
84 84
 	/**
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return array[] The options for this component.
92 92
 	 */
93
-	public function get_options_for_component( $component ) {
93
+	public function get_options_for_component($component) {
94 94
 
95
-		if ( ! $this->supports_component( $component ) ) {
95
+		if (!$this->supports_component($component)) {
96 96
 			return array();
97 97
 		}
98 98
 
99
-		return $this->components[ $component ];
99
+		return $this->components[$component];
100 100
 	}
101 101
 
102 102
 	/**
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 	 * @param array                        $args     The settings for the import.
108 108
 	 * @param WordPoints_Importer_Feedback $feedback The feedback object.
109 109
 	 */
110
-	public function do_import( array $args, $feedback = null ) {
110
+	public function do_import(array $args, $feedback = null) {
111 111
 
112
-		if ( ! ( $feedback instanceof WordPoints_Importer_Feedback ) ) {
112
+		if (!($feedback instanceof WordPoints_Importer_Feedback)) {
113 113
 			$feedback = new WordPoints_Importer_Feedback();
114 114
 		}
115 115
 
116 116
 		$this->feedback = $feedback;
117 117
 
118 118
 		// translators: Plugin name.
119
-		$this->feedback->info( sprintf( __( 'Importing from %s&hellip;', 'wordpoints-importer' ), $this->name ) );
119
+		$this->feedback->info(sprintf(__('Importing from %s&hellip;', 'wordpoints-importer'), $this->name));
120 120
 
121 121
 		$this->no_interruptions();
122 122
 
123
-		foreach ( $args as $component => $options ) {
124
-			$this->do_import_for_component( $component, $options );
123
+		foreach ($args as $component => $options) {
124
+			$this->do_import_for_component($component, $options);
125 125
 		}
126 126
 
127
-		$this->feedback->info( __( 'Import complete.', 'wordpoints-importer' ) );
127
+		$this->feedback->info(__('Import complete.', 'wordpoints-importer'));
128 128
 	}
129 129
 
130 130
 	/**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return bool Whether the settings are valid.
149 149
 	 */
150
-	protected function validate_import_settings( $component, $settings ) {
150
+	protected function validate_import_settings($component, $settings) {
151 151
 
152 152
 		/**
153 153
 		 * Filter whether the settings are valid before importing.
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		 * @param array $settings The settings for this component.
159 159
 		 * @param WordPoints_Importer_Feedback $feedback The feedback object.
160 160
 		 */
161
-		return apply_filters( "wordpoints_import_settings_valid-{$component}", true, $settings, $this->feedback );
161
+		return apply_filters("wordpoints_import_settings_valid-{$component}", true, $settings, $this->feedback);
162 162
 	}
163 163
 
164 164
 	/**
@@ -169,40 +169,40 @@  discard block
 block discarded – undo
169 169
 	 * @param string $component The component to run the import for.
170 170
 	 * @param array  $options   The selected options of what to import.
171 171
 	 */
172
-	protected function do_import_for_component( $component, $options ) {
172
+	protected function do_import_for_component($component, $options) {
173 173
 
174 174
 		$component_data = WordPoints_Components::instance()->get_component(
175 175
 			$component
176 176
 		);
177 177
 
178
-		if ( false === $component_data ) {
178
+		if (false === $component_data) {
179 179
 			// translators: Component name.
180
-			$this->feedback->warning( sprintf( __( 'Skipping %s component—not installed.', 'wordpoints-importer' ), esc_html( $component ) ) );
180
+			$this->feedback->warning(sprintf(__('Skipping %s component—not installed.', 'wordpoints-importer'), esc_html($component)));
181 181
 			return;
182 182
 		}
183 183
 
184
-		if ( true !== $this->supports_component( $component ) ) {
184
+		if (true !== $this->supports_component($component)) {
185 185
 			// translators: Component name.
186
-			$this->feedback->warning( sprintf( __( 'Skipping the %s component—not supported.', 'wordpoints-importer' ), $component_data['name'] ) );
186
+			$this->feedback->warning(sprintf(__('Skipping the %s component—not supported.', 'wordpoints-importer'), $component_data['name']));
187 187
 			return;
188 188
 		}
189 189
 
190 190
 		$settings = array();
191 191
 
192
-		if ( isset( $options['_data'] ) ) {
192
+		if (isset($options['_data'])) {
193 193
 			$settings = $options['_data'];
194
-			unset( $options['_data'] );
194
+			unset($options['_data']);
195 195
 		}
196 196
 
197
-		if ( empty( $options ) || ! $this->validate_import_settings( $component, $settings ) ) {
197
+		if (empty($options) || !$this->validate_import_settings($component, $settings)) {
198 198
 			return;
199 199
 		}
200 200
 
201 201
 		// translators: Component name.
202
-		$this->feedback->info( sprintf( __( 'Importing data to the %s component&hellip;', 'wordpoints-importer' ), $component_data['name'] ) );
202
+		$this->feedback->info(sprintf(__('Importing data to the %s component&hellip;', 'wordpoints-importer'), $component_data['name']));
203 203
 
204
-		foreach ( $options as $option => $unused ) {
205
-			$this->do_import_for_option( $option, $component, $settings );
204
+		foreach ($options as $option => $unused) {
205
+			$this->do_import_for_option($option, $component, $settings);
206 206
 		}
207 207
 	}
208 208
 
@@ -220,30 +220,30 @@  discard block
 block discarded – undo
220 220
 	 * @param string $component The component this option is for.
221 221
 	 * @param array  $settings  Other settings for this component.
222 222
 	 */
223
-	protected function do_import_for_option( $option, $component, $settings ) {
223
+	protected function do_import_for_option($option, $component, $settings) {
224 224
 
225
-		if ( ! isset( $this->components[ $component ][ $option ] ) ) {
225
+		if (!isset($this->components[$component][$option])) {
226 226
 			// translators: Option name.
227
-			$this->feedback->warning( sprintf( __( 'Skipping unrecognized import option &#8220;%s&#8221;&hellip;', 'wordpoints-importer' ), $option ) );
227
+			$this->feedback->warning(sprintf(__('Skipping unrecognized import option &#8220;%s&#8221;&hellip;', 'wordpoints-importer'), $option));
228 228
 			return;
229 229
 		}
230 230
 
231
-		$option_data = $this->components[ $component ][ $option ];
231
+		$option_data = $this->components[$component][$option];
232 232
 
233 233
 		// Check if we can actually run this option.
234
-		if ( isset( $option_data['can_import'] ) ) {
234
+		if (isset($option_data['can_import'])) {
235 235
 
236
-			$cant_import = call_user_func( $option_data['can_import'], $settings );
236
+			$cant_import = call_user_func($option_data['can_import'], $settings);
237 237
 
238
-			if ( is_wp_error( $cant_import ) ) {
238
+			if (is_wp_error($cant_import)) {
239 239
 				// translators: 1. Option name; 2. Reason the import was skipped.
240
-				$this->feedback->warning( sprintf( __( 'Skipping importing %1$s. Reason: %2$s', 'wordpoints-importer' ), $option_data['label'], $cant_import->get_error_message() ) );
240
+				$this->feedback->warning(sprintf(__('Skipping importing %1$s. Reason: %2$s', 'wordpoints-importer'), $option_data['label'], $cant_import->get_error_message()));
241 241
 				return;
242 242
 			}
243 243
 		}
244 244
 
245 245
 		// OK, we can run the import method for this option.
246
-		call_user_func( $option_data['function'], $settings );
246
+		call_user_func($option_data['function'], $settings);
247 247
 	}
248 248
 }
249 249
 
Please login to merge, or discard this patch.
src/includes/class-feedback.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param string $message The info message.
28 28
 	 */
29
-	public function info( $message ) {
30
-		$this->_send( $message, 'info' );
29
+	public function info($message) {
30
+		$this->_send($message, 'info');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @param string $message The success message.
41 41
 	 */
42
-	public function success( $message ) {
43
-		$this->_send( $message, 'success' );
42
+	public function success($message) {
43
+		$this->_send($message, 'success');
44 44
 	}
45 45
 
46 46
 	/**
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param string $message The error message.
54 54
 	 */
55
-	public function error( $message ) {
56
-		$this->_send( $message, 'error' );
55
+	public function error($message) {
56
+		$this->_send($message, 'error');
57 57
 	}
58 58
 
59 59
 	/**
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @param string $message The warning message.
69 69
 	 */
70
-	public function warning( $message ) {
71
-		$this->_send( $message, 'warning' );
70
+	public function warning($message) {
71
+		$this->_send($message, 'warning');
72 72
 	}
73 73
 
74 74
 	//
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 	 * @param string $type    The type of message: 'info' (defuault), 'sucess',
85 85
 	 *                        'error', 'warning'.
86 86
 	 */
87
-	protected function _send( $message, $type = 'info' ) { // @codingStandardsIgnoreLine
87
+	protected function _send($message, $type = 'info') { // @codingStandardsIgnoreLine
88 88
 
89 89
 		?>
90 90
 
91
-		<p class="wordpoints-feedback wordpoints-feedback-<?php echo esc_attr( $type ); ?>">
92
-			<?php echo wp_kses( $message, 'wordpoints_importer_feedback' ); ?>
91
+		<p class="wordpoints-feedback wordpoints-feedback-<?php echo esc_attr($type); ?>">
92
+			<?php echo wp_kses($message, 'wordpoints_importer_feedback'); ?>
93 93
 		</p>
94 94
 
95 95
 		<?php
Please login to merge, or discard this patch.
src/includes/functions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function wordpoints_importer_load_textdomain() {
17 17
 
18
-	_deprecated_function( __FUNCTION__, '1.3.0' );
18
+	_deprecated_function(__FUNCTION__, '1.3.0');
19 19
 
20 20
 	wordpoints_load_module_textdomain(
21 21
 		'wordpoints-importer'
22
-		, wordpoints_module_basename( dirname( dirname( __FILE__ ) ) ) . '/languages'
22
+		, wordpoints_module_basename(dirname(dirname(__FILE__))).'/languages'
23 23
 	);
24 24
 }
25 25
 
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
 	$args = array(
34 34
 		'class' => 'WordPoints_CubePoints_Importer',
35
-		'name'  => __( 'CubePoints', 'wordpoints-importer' ),
35
+		'name'  => __('CubePoints', 'wordpoints-importer'),
36 36
 	);
37 37
 
38
-	WordPoints_Importers::register( 'cubepoints', $args );
38
+	WordPoints_Importers::register('cubepoints', $args);
39 39
 }
40
-add_action( 'wordpoints_register_importers', 'wordpoints_importer_register_importers' );
40
+add_action('wordpoints_register_importers', 'wordpoints_importer_register_importers');
41 41
 
42 42
 // EOF
Please login to merge, or discard this patch.