Completed
Pull Request — master (#11)
by J.D.
02:14
created
tests/phpunit/includes/feedback.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,22 +14,22 @@
 block discarded – undo
14 14
  */
15 15
 class WordPoints_Importer_Tests_Feedback extends WordPoints_Importer_Feedback {
16 16
 
17
-	/**
18
-	 * The messages that have been reported.
19
-	 *
20
-	 * @since 1.0.0
21
-	 *
22
-	 * @var string[][]
23
-	 */
24
-	public $messages;
17
+    /**
18
+     * The messages that have been reported.
19
+     *
20
+     * @since 1.0.0
21
+     *
22
+     * @var string[][]
23
+     */
24
+    public $messages;
25 25
 
26
-	/**
27
-	 * @since 1.0.0
28
-	 */
29
-	protected function _send( $message, $type = 'info' ) {
26
+    /**
27
+     * @since 1.0.0
28
+     */
29
+    protected function _send( $message, $type = 'info' ) {
30 30
 
31
-		$this->messages[ $type ][] = $message;
32
-	}
31
+        $this->messages[ $type ][] = $message;
32
+    }
33 33
 }
34 34
 
35 35
 // EOF
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 	/**
27 27
 	 * @since 1.0.0
28 28
 	 */
29
-	protected function _send( $message, $type = 'info' ) {
29
+	protected function _send($message, $type = 'info') {
30 30
 
31
-		$this->messages[ $type ][] = $message;
31
+		$this->messages[$type][] = $message;
32 32
 	}
33 33
 }
34 34
 
Please login to merge, or discard this patch.
tests/phpunit/includes/testcases/hook.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -21,113 +21,113 @@
 block discarded – undo
21 21
  * @coversNothing
22 22
  */
23 23
 abstract class WordPoints_Importer_Hook_UnitTestCase
24
-	extends WordPoints_Points_UnitTestCase {
25
-
26
-	/**
27
-	 * The option where CubePoints stores the number of points to award for this.
28
-	 *
29
-	 * @since 1.2.0
30
-	 *
31
-	 * @var string
32
-	 */
33
-	protected $cubepoints_option;
34
-
35
-	/**
36
-	 * The type of hook being tested.
37
-	 *
38
-	 * @since 1.2.0
39
-	 *
40
-	 * @var string
41
-	 */
42
-	protected $type;
43
-
44
-	/**
45
-	 * Test that the hook behaves properly.
46
-	 *
47
-	 * @since 1.2.0
48
-	 *
49
-	 * @param string $type The type of test.
50
-	 *
51
-	 * @dataProvider data_provider_types
52
-	 */
53
-	abstract public function test( $type );
54
-
55
-	/**
56
-	 * Data provider for types of tests.
57
-	 *
58
-	 * @since 1.2.0
59
-	 *
60
-	 * @return array
61
-	 */
62
-	public function data_provider_types() {
63
-		return array(
64
-			'cubepoints' => array( 'cubepoints' ),
65
-			'wordpoints' => array( 'wordpoints' ),
66
-		);
67
-	}
68
-
69
-	/**
70
-	 * Set up before a test.
71
-	 *
72
-	 * @since 1.2.0
73
-	 *
74
-	 * @param string $type The type of test being run.
75
-	 */
76
-	protected function before( $type ) {
77
-
78
-		update_option( 'cp_reg_points', 0 );
79
-
80
-		$this->type = $type;
81
-
82
-		update_option( $this->cubepoints_option, 10 );
83
-
84
-		if ( 'wordpoints' === $this->type ) {
85
-			$this->do_points_import( 'settings' );
86
-		}
87
-	}
88
-
89
-	/**
90
-	 * Get the number of points a user has.
91
-	 *
92
-	 * @since 1.2.0
93
-	 *
94
-	 * @param int $user_id The user ID.
95
-	 *
96
-	 * @return int The number of points the user has.
97
-	 */
98
-	protected function get_user_points( $user_id ) {
99
-		if ( 'cubepoints' === $this->type ) {
100
-			return cp_getPoints( $user_id );
101
-		} else {
102
-			return wordpoints_get_points( $user_id, 'points' );
103
-		}
104
-	}
105
-
106
-	/**
107
-	 * Do the import for the points settings.
108
-	 *
109
-	 * @since 1.2.0
110
-	 *
111
-	 * @param string $type The type of points import.
112
-	 */
113
-	protected function do_points_import( $type ) {
114
-
115
-		$importer = new WordPoints_CubePoints_Importer( 'Test CubePoints' );
116
-		$feedback = new WordPoints_Importer_Tests_Feedback();
117
-
118
-		$importer->do_import(
119
-			array(
120
-				'points' => array(
121
-					$type => '1',
122
-					'_data' => array( 'points_type' => 'points' ),
123
-				),
124
-			)
125
-			, $feedback
126
-		);
127
-
128
-		$this->assertCount( 4, $feedback->messages['info'] );
129
-		$this->assertCount( 1, $feedback->messages['success'] );
130
-	}
24
+    extends WordPoints_Points_UnitTestCase {
25
+
26
+    /**
27
+     * The option where CubePoints stores the number of points to award for this.
28
+     *
29
+     * @since 1.2.0
30
+     *
31
+     * @var string
32
+     */
33
+    protected $cubepoints_option;
34
+
35
+    /**
36
+     * The type of hook being tested.
37
+     *
38
+     * @since 1.2.0
39
+     *
40
+     * @var string
41
+     */
42
+    protected $type;
43
+
44
+    /**
45
+     * Test that the hook behaves properly.
46
+     *
47
+     * @since 1.2.0
48
+     *
49
+     * @param string $type The type of test.
50
+     *
51
+     * @dataProvider data_provider_types
52
+     */
53
+    abstract public function test( $type );
54
+
55
+    /**
56
+     * Data provider for types of tests.
57
+     *
58
+     * @since 1.2.0
59
+     *
60
+     * @return array
61
+     */
62
+    public function data_provider_types() {
63
+        return array(
64
+            'cubepoints' => array( 'cubepoints' ),
65
+            'wordpoints' => array( 'wordpoints' ),
66
+        );
67
+    }
68
+
69
+    /**
70
+     * Set up before a test.
71
+     *
72
+     * @since 1.2.0
73
+     *
74
+     * @param string $type The type of test being run.
75
+     */
76
+    protected function before( $type ) {
77
+
78
+        update_option( 'cp_reg_points', 0 );
79
+
80
+        $this->type = $type;
81
+
82
+        update_option( $this->cubepoints_option, 10 );
83
+
84
+        if ( 'wordpoints' === $this->type ) {
85
+            $this->do_points_import( 'settings' );
86
+        }
87
+    }
88
+
89
+    /**
90
+     * Get the number of points a user has.
91
+     *
92
+     * @since 1.2.0
93
+     *
94
+     * @param int $user_id The user ID.
95
+     *
96
+     * @return int The number of points the user has.
97
+     */
98
+    protected function get_user_points( $user_id ) {
99
+        if ( 'cubepoints' === $this->type ) {
100
+            return cp_getPoints( $user_id );
101
+        } else {
102
+            return wordpoints_get_points( $user_id, 'points' );
103
+        }
104
+    }
105
+
106
+    /**
107
+     * Do the import for the points settings.
108
+     *
109
+     * @since 1.2.0
110
+     *
111
+     * @param string $type The type of points import.
112
+     */
113
+    protected function do_points_import( $type ) {
114
+
115
+        $importer = new WordPoints_CubePoints_Importer( 'Test CubePoints' );
116
+        $feedback = new WordPoints_Importer_Tests_Feedback();
117
+
118
+        $importer->do_import(
119
+            array(
120
+                'points' => array(
121
+                    $type => '1',
122
+                    '_data' => array( 'points_type' => 'points' ),
123
+                ),
124
+            )
125
+            , $feedback
126
+        );
127
+
128
+        $this->assertCount( 4, $feedback->messages['info'] );
129
+        $this->assertCount( 1, $feedback->messages['success'] );
130
+    }
131 131
 }
132 132
 
133 133
 // EOF
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @dataProvider data_provider_types
52 52
 	 */
53
-	abstract public function test( $type );
53
+	abstract public function test($type);
54 54
 
55 55
 	/**
56 56
 	 * Data provider for types of tests.
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function data_provider_types() {
63 63
 		return array(
64
-			'cubepoints' => array( 'cubepoints' ),
65
-			'wordpoints' => array( 'wordpoints' ),
64
+			'cubepoints' => array('cubepoints'),
65
+			'wordpoints' => array('wordpoints'),
66 66
 		);
67 67
 	}
68 68
 
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @param string $type The type of test being run.
75 75
 	 */
76
-	protected function before( $type ) {
76
+	protected function before($type) {
77 77
 
78
-		update_option( 'cp_reg_points', 0 );
78
+		update_option('cp_reg_points', 0);
79 79
 
80 80
 		$this->type = $type;
81 81
 
82
-		update_option( $this->cubepoints_option, 10 );
82
+		update_option($this->cubepoints_option, 10);
83 83
 
84
-		if ( 'wordpoints' === $this->type ) {
85
-			$this->do_points_import( 'settings' );
84
+		if ('wordpoints' === $this->type) {
85
+			$this->do_points_import('settings');
86 86
 		}
87 87
 	}
88 88
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return int The number of points the user has.
97 97
 	 */
98
-	protected function get_user_points( $user_id ) {
99
-		if ( 'cubepoints' === $this->type ) {
100
-			return cp_getPoints( $user_id );
98
+	protected function get_user_points($user_id) {
99
+		if ('cubepoints' === $this->type) {
100
+			return cp_getPoints($user_id);
101 101
 		} else {
102
-			return wordpoints_get_points( $user_id, 'points' );
102
+			return wordpoints_get_points($user_id, 'points');
103 103
 		}
104 104
 	}
105 105
 
@@ -110,23 +110,23 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param string $type The type of points import.
112 112
 	 */
113
-	protected function do_points_import( $type ) {
113
+	protected function do_points_import($type) {
114 114
 
115
-		$importer = new WordPoints_CubePoints_Importer( 'Test CubePoints' );
115
+		$importer = new WordPoints_CubePoints_Importer('Test CubePoints');
116 116
 		$feedback = new WordPoints_Importer_Tests_Feedback();
117 117
 
118 118
 		$importer->do_import(
119 119
 			array(
120 120
 				'points' => array(
121 121
 					$type => '1',
122
-					'_data' => array( 'points_type' => 'points' ),
122
+					'_data' => array('points_type' => 'points'),
123 123
 				),
124 124
 			)
125 125
 			, $feedback
126 126
 		);
127 127
 
128
-		$this->assertCount( 4, $feedback->messages['info'] );
129
-		$this->assertCount( 1, $feedback->messages['success'] );
128
+		$this->assertCount(4, $feedback->messages['info']);
129
+		$this->assertCount(1, $feedback->messages['success']);
130 130
 	}
131 131
 }
132 132
 
Please login to merge, or discard this patch.
tests/phpunit/includes/functions.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'WORDPOINTS_MODULE_TESTS_LOADER' ) ) {
11
-	/**
12
-	 * The function that loads the module for the tests.
13
-	 *
14
-	 * @since 1.0.0
15
-	 */
16
-	define( 'WORDPOINTS_MODULE_TESTS_LOADER', 'wordpoints_importer_tests_manually_load_module' );
11
+    /**
12
+     * The function that loads the module for the tests.
13
+     *
14
+     * @since 1.0.0
15
+     */
16
+    define( 'WORDPOINTS_MODULE_TESTS_LOADER', 'wordpoints_importer_tests_manually_load_module' );
17 17
 }
18 18
 
19 19
 /**
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function wordpoints_importer_tests_manually_load_module() {
34 34
 
35
-	require( WORDPOINTS_IMPORTER_TESTS_DIR . '/../../src/importer.php' );
36
-	require( WORDPOINTS_IMPORTER_TESTS_DIR . '/../../src/admin/admin.php' );
35
+    require( WORDPOINTS_IMPORTER_TESTS_DIR . '/../../src/importer.php' );
36
+    require( WORDPOINTS_IMPORTER_TESTS_DIR . '/../../src/admin/admin.php' );
37 37
 
38
-	wordpoints_importer_tests_manually_load_cubepoints();
38
+    wordpoints_importer_tests_manually_load_cubepoints();
39 39
 }
40 40
 
41 41
 /**
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
  */
46 46
 function wordpoints_importer_tests_manually_load_cubepoints() {
47 47
 
48
-	require( WP_PLUGIN_DIR . '/cubepoints/cubepoints.php' );
48
+    require( WP_PLUGIN_DIR . '/cubepoints/cubepoints.php' );
49 49
 
50
-	cp_activate();
50
+    cp_activate();
51 51
 
52
-	// We activate these now so that they will be fully loaded. Otherwise only part
53
-	// of their functions will be loaded, as the rest are defined in a conditional.
54
-	// Because of some of the functions are defined outside of the conditional, there
55
-	// is no way for us to load the functions later without a fatal error from
56
-	// "already defined function".
57
-	cp_module_activation_set( 'dailypoints', 'active' );
58
-	cp_module_activation_set( 'post_author_points', 'active' );
52
+    // We activate these now so that they will be fully loaded. Otherwise only part
53
+    // of their functions will be loaded, as the rest are defined in a conditional.
54
+    // Because of some of the functions are defined outside of the conditional, there
55
+    // is no way for us to load the functions later without a fatal error from
56
+    // "already defined function".
57
+    cp_module_activation_set( 'dailypoints', 'active' );
58
+    cp_module_activation_set( 'post_author_points', 'active' );
59 59
 }
60 60
 
61 61
 // EOF
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  * @since 1.0.0
8 8
  */
9 9
 
10
-if ( ! defined( 'WORDPOINTS_MODULE_TESTS_LOADER' ) ) {
10
+if (!defined('WORDPOINTS_MODULE_TESTS_LOADER')) {
11 11
 	/**
12 12
 	 * The function that loads the module for the tests.
13 13
 	 *
14 14
 	 * @since 1.0.0
15 15
 	 */
16
-	define( 'WORDPOINTS_MODULE_TESTS_LOADER', 'wordpoints_importer_tests_manually_load_module' );
16
+	define('WORDPOINTS_MODULE_TESTS_LOADER', 'wordpoints_importer_tests_manually_load_module');
17 17
 }
18 18
 
19 19
 /**
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @type string
25 25
  */
26
-define( 'WORDPOINTS_IMPORTER_TESTS_DIR', dirname( dirname( __FILE__ ) ) );
26
+define('WORDPOINTS_IMPORTER_TESTS_DIR', dirname(dirname(__FILE__)));
27 27
 
28 28
 /**
29 29
  * Manually load the module.
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function wordpoints_importer_tests_manually_load_module() {
34 34
 
35
-	require( WORDPOINTS_IMPORTER_TESTS_DIR . '/../../src/importer.php' );
36
-	require( WORDPOINTS_IMPORTER_TESTS_DIR . '/../../src/admin/admin.php' );
35
+	require(WORDPOINTS_IMPORTER_TESTS_DIR.'/../../src/importer.php');
36
+	require(WORDPOINTS_IMPORTER_TESTS_DIR.'/../../src/admin/admin.php');
37 37
 
38 38
 	wordpoints_importer_tests_manually_load_cubepoints();
39 39
 }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  */
46 46
 function wordpoints_importer_tests_manually_load_cubepoints() {
47 47
 
48
-	require( WP_PLUGIN_DIR . '/cubepoints/cubepoints.php' );
48
+	require(WP_PLUGIN_DIR.'/cubepoints/cubepoints.php');
49 49
 
50 50
 	cp_activate();
51 51
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	// Because of some of the functions are defined outside of the conditional, there
55 55
 	// is no way for us to load the functions later without a fatal error from
56 56
 	// "already defined function".
57
-	cp_module_activation_set( 'dailypoints', 'active' );
58
-	cp_module_activation_set( 'post_author_points', 'active' );
57
+	cp_module_activation_set('dailypoints', 'active');
58
+	cp_module_activation_set('post_author_points', 'active');
59 59
 }
60 60
 
61 61
 // EOF
Please login to merge, or discard this patch.
tests/phpunit/includes/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@
 block discarded – undo
12 12
  *
13 13
  * @since 1.0.0
14 14
  */
15
-require_once( WORDPOINTS_IMPORTER_TESTS_DIR . '/includes/feedback.php' );
15
+require_once(WORDPOINTS_IMPORTER_TESTS_DIR.'/includes/feedback.php');
16 16
 
17 17
 /**
18 18
  * Mocks used in the tests.
19 19
  *
20 20
  * @since 1.0.0
21 21
  */
22
-require_once( WORDPOINTS_IMPORTER_TESTS_DIR . '/includes/mocks.php' );
22
+require_once(WORDPOINTS_IMPORTER_TESTS_DIR.'/includes/mocks.php');
23 23
 
24 24
 /**
25 25
  * Testcase for testing hooks.
26 26
  *
27 27
  * @since 1.2.0
28 28
  */
29
-require_once( WORDPOINTS_IMPORTER_TESTS_DIR . '/includes/testcases/hook.php' );
29
+require_once(WORDPOINTS_IMPORTER_TESTS_DIR.'/includes/testcases/hook.php');
30 30
 
31 31
 // EOF
Please login to merge, or discard this patch.
src/admin/admin.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function wordpoints_importer_admin_menu() {
16 16
 
17
-	add_submenu_page(
18
-		wordpoints_get_main_admin_menu()
19
-		,__( 'WordPoints — Import', 'wordpoints-importer' )
20
-		,__( 'Import', 'wordpoints-importer' )
21
-		,'manage_options'
22
-		,'wordpoints_import'
23
-		,'wordpoints_import_admin_screen'
24
-	);
25
-
26
-	add_submenu_page(
27
-		'_wordpoints_import' // Fake.
28
-		,__( 'WordPoints — Importing', 'wordpoints-importer' )
29
-		,__( 'Importing', 'wordpoints-importer' )
30
-		,'manage_options'
31
-		,'wordpoints_importing'
32
-		,'wordpoints_importing_admin_screen'
33
-	);
17
+    add_submenu_page(
18
+        wordpoints_get_main_admin_menu()
19
+        ,__( 'WordPoints — Import', 'wordpoints-importer' )
20
+        ,__( 'Import', 'wordpoints-importer' )
21
+        ,'manage_options'
22
+        ,'wordpoints_import'
23
+        ,'wordpoints_import_admin_screen'
24
+    );
25
+
26
+    add_submenu_page(
27
+        '_wordpoints_import' // Fake.
28
+        ,__( 'WordPoints — Importing', 'wordpoints-importer' )
29
+        ,__( 'Importing', 'wordpoints-importer' )
30
+        ,'manage_options'
31
+        ,'wordpoints_importing'
32
+        ,'wordpoints_importing_admin_screen'
33
+    );
34 34
 }
35 35
 add_action( 'admin_menu', 'wordpoints_importer_admin_menu' );
36 36
 add_action( 'network_admin_menu', 'wordpoints_importer_admin_menu' );
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
  */
43 43
 function wordpoints_import_admin_screen() {
44 44
 
45
-	/**
46
-	 * The importer admin screen.
47
-	 *
48
-	 * @since 1.0.0
49
-	 */
50
-	require( dirname( __FILE__ ) . '/screens/import.php' );
45
+    /**
46
+     * The importer admin screen.
47
+     *
48
+     * @since 1.0.0
49
+     */
50
+    require( dirname( __FILE__ ) . '/screens/import.php' );
51 51
 }
52 52
 
53 53
 /**
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
  */
58 58
 function wordpoints_importing_admin_screen() {
59 59
 
60
-	/**
61
-	 * The importer admin screen.
62
-	 *
63
-	 * @since 1.0.0
64
-	 */
65
-	require( dirname( __FILE__ ) . '/screens/importing.php' );
60
+    /**
61
+     * The importer admin screen.
62
+     *
63
+     * @since 1.0.0
64
+     */
65
+    require( dirname( __FILE__ ) . '/screens/importing.php' );
66 66
 }
67 67
 
68 68
 /**
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function wordpoints_importer_register_admin_scripts() {
74 74
 
75
-	$assets_url = wordpoints_modules_url(
76
-		'admin/assets'
77
-		, dirname( dirname( __FILE__ ) ) . '/importer.php'
78
-	);
75
+    $assets_url = wordpoints_modules_url(
76
+        'admin/assets'
77
+        , dirname( dirname( __FILE__ ) ) . '/importer.php'
78
+    );
79 79
 
80
-	wp_register_style(
81
-		'wordpoints-importer-feedback'
82
-		, $assets_url . '/css/feedback.css'
83
-	);
80
+    wp_register_style(
81
+        'wordpoints-importer-feedback'
82
+        , $assets_url . '/css/feedback.css'
83
+    );
84 84
 }
85 85
 add_action( 'init', 'wordpoints_importer_register_admin_scripts' );
86 86
 
@@ -91,41 +91,41 @@  discard block
 block discarded – undo
91 91
  */
92 92
 function wordpoints_importer_do_import() {
93 93
 
94
-	if ( ! defined( 'IFRAME_REQUEST' ) ) {
95
-		define( 'IFRAME_REQUEST', true );
96
-	}
94
+    if ( ! defined( 'IFRAME_REQUEST' ) ) {
95
+        define( 'IFRAME_REQUEST', true );
96
+    }
97 97
 
98
-	if ( ! current_user_can( 'manage_options' ) ) {
99
-		wp_die( esc_html__( 'You do not have sufficient permissions to import to WordPoints.', 'wordpoints-importer' ) );
100
-	}
98
+    if ( ! current_user_can( 'manage_options' ) ) {
99
+        wp_die( esc_html__( 'You do not have sufficient permissions to import to WordPoints.', 'wordpoints-importer' ) );
100
+    }
101 101
 
102
-	check_admin_referer( 'wordpoints_import' );
102
+    check_admin_referer( 'wordpoints_import' );
103 103
 
104
-	if ( ! isset( $_GET['importer'] ) ) {
105
-		wp_die( esc_html__( 'No importer selected.', 'wordpoints-importer' ) );
106
-	}
104
+    if ( ! isset( $_GET['importer'] ) ) {
105
+        wp_die( esc_html__( 'No importer selected.', 'wordpoints-importer' ) );
106
+    }
107 107
 
108
-	$importer = WordPoints_Importers::get_importer(
109
-		sanitize_key( $_GET['importer'] )
110
-	);
108
+    $importer = WordPoints_Importers::get_importer(
109
+        sanitize_key( $_GET['importer'] )
110
+    );
111 111
 
112
-	if ( ! ( $importer instanceof WordPoints_Importer ) ) {
113
-		wp_die( esc_html__( 'Importer not installed.', 'wordpoints-importer' ) );
114
-	}
112
+    if ( ! ( $importer instanceof WordPoints_Importer ) ) {
113
+        wp_die( esc_html__( 'Importer not installed.', 'wordpoints-importer' ) );
114
+    }
115 115
 
116
-	wp_enqueue_style( 'wordpoints-importer-feedback' );
116
+    wp_enqueue_style( 'wordpoints-importer-feedback' );
117 117
 
118
-	$args = array();
118
+    $args = array();
119 119
 
120
-	if ( isset( $_GET['wordpoints_import'] ) && is_array( $_GET['wordpoints_import'] ) ) {
121
-		$args = wp_unslash( $_GET['wordpoints_import'] ); // WPCS: sanitization OK.
122
-	}
120
+    if ( isset( $_GET['wordpoints_import'] ) && is_array( $_GET['wordpoints_import'] ) ) {
121
+        $args = wp_unslash( $_GET['wordpoints_import'] ); // WPCS: sanitization OK.
122
+    }
123 123
 
124
-	iframe_header();
124
+    iframe_header();
125 125
 
126
-	$importer->do_import( $args );
126
+    $importer->do_import( $args );
127 127
 
128
-	iframe_footer();
128
+    iframe_footer();
129 129
 }
130 130
 add_action( 'update-custom_wordpoints_import', 'wordpoints_importer_do_import' );
131 131
 
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
  */
137 137
 function wordpoints_importer_admin_screen_points_type_select() {
138 138
 
139
-	$args = array( 'name' => 'wordpoints_import[points][_data][points_type]' );
139
+    $args = array( 'name' => 'wordpoints_import[points][_data][points_type]' );
140 140
 
141
-	?>
141
+    ?>
142 142
 
143 143
 	<p>
144 144
 		<label for="wordpoints_import[points][_data][points_type]">
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	<?php
151 151
 }
152 152
 add_action(
153
-	'wordpoints_importer_before_component_options-points'
154
-	, 'wordpoints_importer_admin_screen_points_type_select'
153
+    'wordpoints_importer_before_component_options-points'
154
+    , 'wordpoints_importer_admin_screen_points_type_select'
155 155
 );
156 156
 
157 157
 /**
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
  */
168 168
 function wordpoints_importer_validate_points_type_setting( $valid, $settings, $feedback ) {
169 169
 
170
-	if ( $valid ) {
170
+    if ( $valid ) {
171 171
 
172
-		if ( ! isset( $settings['points_type'] ) ) {
173
-			$feedback->warning( __( 'Skipping Points component—no points type specified.', 'wordpoints-importer' ) );
174
-			$valid = false;
175
-		} elseif ( ! wordpoints_is_points_type( $settings['points_type'] ) ) {
176
-			$feedback->warning( __( 'Skipping Points component—invalid points type selected.', 'wordpoints-importer' ) );
177
-			$valid = false;
178
-		}
179
-	}
172
+        if ( ! isset( $settings['points_type'] ) ) {
173
+            $feedback->warning( __( 'Skipping Points component—no points type specified.', 'wordpoints-importer' ) );
174
+            $valid = false;
175
+        } elseif ( ! wordpoints_is_points_type( $settings['points_type'] ) ) {
176
+            $feedback->warning( __( 'Skipping Points component—invalid points type selected.', 'wordpoints-importer' ) );
177
+            $valid = false;
178
+        }
179
+    }
180 180
 
181
-	return $valid;
181
+    return $valid;
182 182
 }
183 183
 add_action(
184
-	'wordpoints_import_settings_valid-points'
185
-	, 'wordpoints_importer_validate_points_type_setting'
186
-	, 10
187
-	, 3
184
+    'wordpoints_import_settings_valid-points'
185
+    , 'wordpoints_importer_validate_points_type_setting'
186
+    , 10
187
+    , 3
188 188
 );
189 189
 
190 190
 /**
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function wordpoints_importer_admin_screen_rank_group_select() {
196 196
 
197
-	$rank_groups = WordPoints_Rank_Groups::get();
197
+    $rank_groups = WordPoints_Rank_Groups::get();
198 198
 
199
-	// See https://github.com/WordPoints/wordpoints/issues/310.
200
-	$options = array();
201
-	foreach ( $rank_groups as $rank_group ) {
202
-		$options[ $rank_group->slug ] = $rank_group->name;
203
-	}
199
+    // See https://github.com/WordPoints/wordpoints/issues/310.
200
+    $options = array();
201
+    foreach ( $rank_groups as $rank_group ) {
202
+        $options[ $rank_group->slug ] = $rank_group->name;
203
+    }
204 204
 
205
-	$dropdown = new WordPoints_Dropdown_Builder(
206
-		$options
207
-		, array( 'name' => 'wordpoints_import[ranks][_data][rank_group]' )
208
-	);
205
+    $dropdown = new WordPoints_Dropdown_Builder(
206
+        $options
207
+        , array( 'name' => 'wordpoints_import[ranks][_data][rank_group]' )
208
+    );
209 209
 
210
-	?>
210
+    ?>
211 211
 
212 212
 	<p>
213 213
 		<label for="wordpoints_import[ranks][_data][rank_group]">
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 <?php
220 220
 }
221 221
 add_action(
222
-	'wordpoints_importer_before_component_options-ranks'
223
-	, 'wordpoints_importer_admin_screen_rank_group_select'
222
+    'wordpoints_importer_before_component_options-ranks'
223
+    , 'wordpoints_importer_admin_screen_rank_group_select'
224 224
 );
225 225
 
226 226
 /**
@@ -236,24 +236,24 @@  discard block
 block discarded – undo
236 236
  */
237 237
 function wordpoints_importer_validate_rank_group_setting( $valid, $settings, $feedback ) {
238 238
 
239
-	if ( $valid ) {
239
+    if ( $valid ) {
240 240
 
241
-		if ( ! isset( $settings['rank_group'] ) ) {
242
-			$feedback->warning( __( 'Skipping Ranks component—no rank group specified.', 'wordpoints-importer' ) );
243
-			$valid = false;
244
-		} elseif ( ! WordPoints_Rank_Groups::is_group_registered( $settings['rank_group'] ) ) {
245
-			$feedback->warning( __( 'Skipping Ranks component—invalid rank group selected.', 'wordpoints-importer' ) );
246
-			$valid = false;
247
-		}
248
-	}
241
+        if ( ! isset( $settings['rank_group'] ) ) {
242
+            $feedback->warning( __( 'Skipping Ranks component—no rank group specified.', 'wordpoints-importer' ) );
243
+            $valid = false;
244
+        } elseif ( ! WordPoints_Rank_Groups::is_group_registered( $settings['rank_group'] ) ) {
245
+            $feedback->warning( __( 'Skipping Ranks component—invalid rank group selected.', 'wordpoints-importer' ) );
246
+            $valid = false;
247
+        }
248
+    }
249 249
 
250
-	return $valid;
250
+    return $valid;
251 251
 }
252 252
 add_action(
253
-	'wordpoints_import_settings_valid-ranks'
254
-	, 'wordpoints_importer_validate_rank_group_setting'
255
-	, 10
256
-	, 3
253
+    'wordpoints_import_settings_valid-ranks'
254
+    , 'wordpoints_importer_validate_rank_group_setting'
255
+    , 10
256
+    , 3
257 257
 );
258 258
 
259 259
 // EOF
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 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,15 +74,15 @@  discard block
 block discarded – undo
74 74
 
75 75
 	$assets_url = wordpoints_modules_url(
76 76
 		'admin/assets'
77
-		, dirname( dirname( __FILE__ ) ) . '/importer.php'
77
+		, dirname(dirname(__FILE__)).'/importer.php'
78 78
 	);
79 79
 
80 80
 	wp_register_style(
81 81
 		'wordpoints-importer-feedback'
82
-		, $assets_url . '/css/feedback.css'
82
+		, $assets_url.'/css/feedback.css'
83 83
 	);
84 84
 }
85
-add_action( 'init', 'wordpoints_importer_register_admin_scripts' );
85
+add_action('init', 'wordpoints_importer_register_admin_scripts');
86 86
 
87 87
 /**
88 88
  * Handle an import request.
@@ -91,43 +91,43 @@  discard block
 block discarded – undo
91 91
  */
92 92
 function wordpoints_importer_do_import() {
93 93
 
94
-	if ( ! defined( 'IFRAME_REQUEST' ) ) {
95
-		define( 'IFRAME_REQUEST', true );
94
+	if (!defined('IFRAME_REQUEST')) {
95
+		define('IFRAME_REQUEST', true);
96 96
 	}
97 97
 
98
-	if ( ! current_user_can( 'manage_options' ) ) {
99
-		wp_die( esc_html__( 'You do not have sufficient permissions to import to WordPoints.', 'wordpoints-importer' ) );
98
+	if (!current_user_can('manage_options')) {
99
+		wp_die(esc_html__('You do not have sufficient permissions to import to WordPoints.', 'wordpoints-importer'));
100 100
 	}
101 101
 
102
-	check_admin_referer( 'wordpoints_import' );
102
+	check_admin_referer('wordpoints_import');
103 103
 
104
-	if ( ! isset( $_GET['importer'] ) ) {
105
-		wp_die( esc_html__( 'No importer selected.', 'wordpoints-importer' ) );
104
+	if (!isset($_GET['importer'])) {
105
+		wp_die(esc_html__('No importer selected.', 'wordpoints-importer'));
106 106
 	}
107 107
 
108 108
 	$importer = WordPoints_Importers::get_importer(
109
-		sanitize_key( $_GET['importer'] )
109
+		sanitize_key($_GET['importer'])
110 110
 	);
111 111
 
112
-	if ( ! ( $importer instanceof WordPoints_Importer ) ) {
113
-		wp_die( esc_html__( 'Importer not installed.', 'wordpoints-importer' ) );
112
+	if (!($importer instanceof WordPoints_Importer)) {
113
+		wp_die(esc_html__('Importer not installed.', 'wordpoints-importer'));
114 114
 	}
115 115
 
116
-	wp_enqueue_style( 'wordpoints-importer-feedback' );
116
+	wp_enqueue_style('wordpoints-importer-feedback');
117 117
 
118 118
 	$args = array();
119 119
 
120
-	if ( isset( $_GET['wordpoints_import'] ) && is_array( $_GET['wordpoints_import'] ) ) {
121
-		$args = wp_unslash( $_GET['wordpoints_import'] ); // WPCS: sanitization OK.
120
+	if (isset($_GET['wordpoints_import']) && is_array($_GET['wordpoints_import'])) {
121
+		$args = wp_unslash($_GET['wordpoints_import']); // WPCS: sanitization OK.
122 122
 	}
123 123
 
124 124
 	iframe_header();
125 125
 
126
-	$importer->do_import( $args );
126
+	$importer->do_import($args);
127 127
 
128 128
 	iframe_footer();
129 129
 }
130
-add_action( 'update-custom_wordpoints_import', 'wordpoints_importer_do_import' );
130
+add_action('update-custom_wordpoints_import', 'wordpoints_importer_do_import');
131 131
 
132 132
 /**
133 133
  * Display a points type dropdown above the points component settings.
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
  */
137 137
 function wordpoints_importer_admin_screen_points_type_select() {
138 138
 
139
-	$args = array( 'name' => 'wordpoints_import[points][_data][points_type]' );
139
+	$args = array('name' => 'wordpoints_import[points][_data][points_type]');
140 140
 
141 141
 	?>
142 142
 
143 143
 	<p>
144 144
 		<label for="wordpoints_import[points][_data][points_type]">
145
-			<?php esc_html_e( 'Import to points type:', 'wordpoints-importer' ); ?>
146
-			<?php wordpoints_points_types_dropdown( $args ); ?>
145
+			<?php esc_html_e('Import to points type:', 'wordpoints-importer'); ?>
146
+			<?php wordpoints_points_types_dropdown($args); ?>
147 147
 		</label>
148 148
 	</p>
149 149
 
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
  *
166 166
  * @return bool Whether the settings are valid.
167 167
  */
168
-function wordpoints_importer_validate_points_type_setting( $valid, $settings, $feedback ) {
168
+function wordpoints_importer_validate_points_type_setting($valid, $settings, $feedback) {
169 169
 
170
-	if ( $valid ) {
170
+	if ($valid) {
171 171
 
172
-		if ( ! isset( $settings['points_type'] ) ) {
173
-			$feedback->warning( __( 'Skipping Points component—no points type specified.', 'wordpoints-importer' ) );
172
+		if (!isset($settings['points_type'])) {
173
+			$feedback->warning(__('Skipping Points component—no points type specified.', 'wordpoints-importer'));
174 174
 			$valid = false;
175
-		} elseif ( ! wordpoints_is_points_type( $settings['points_type'] ) ) {
176
-			$feedback->warning( __( 'Skipping Points component—invalid points type selected.', 'wordpoints-importer' ) );
175
+		} elseif (!wordpoints_is_points_type($settings['points_type'])) {
176
+			$feedback->warning(__('Skipping Points component—invalid points type selected.', 'wordpoints-importer'));
177 177
 			$valid = false;
178 178
 		}
179 179
 	}
@@ -198,20 +198,20 @@  discard block
 block discarded – undo
198 198
 
199 199
 	// See https://github.com/WordPoints/wordpoints/issues/310.
200 200
 	$options = array();
201
-	foreach ( $rank_groups as $rank_group ) {
202
-		$options[ $rank_group->slug ] = $rank_group->name;
201
+	foreach ($rank_groups as $rank_group) {
202
+		$options[$rank_group->slug] = $rank_group->name;
203 203
 	}
204 204
 
205 205
 	$dropdown = new WordPoints_Dropdown_Builder(
206 206
 		$options
207
-		, array( 'name' => 'wordpoints_import[ranks][_data][rank_group]' )
207
+		, array('name' => 'wordpoints_import[ranks][_data][rank_group]')
208 208
 	);
209 209
 
210 210
 	?>
211 211
 
212 212
 	<p>
213 213
 		<label for="wordpoints_import[ranks][_data][rank_group]">
214
-			<?php esc_html_e( 'Import to rank group:', 'wordpoints-importer' ); ?>
214
+			<?php esc_html_e('Import to rank group:', 'wordpoints-importer'); ?>
215 215
 			<?php $dropdown->display(); ?>
216 216
 		</label>
217 217
 	</p>
@@ -234,15 +234,15 @@  discard block
 block discarded – undo
234 234
  *
235 235
  * @return bool Whether the settings are valid.
236 236
  */
237
-function wordpoints_importer_validate_rank_group_setting( $valid, $settings, $feedback ) {
237
+function wordpoints_importer_validate_rank_group_setting($valid, $settings, $feedback) {
238 238
 
239
-	if ( $valid ) {
239
+	if ($valid) {
240 240
 
241
-		if ( ! isset( $settings['rank_group'] ) ) {
242
-			$feedback->warning( __( 'Skipping Ranks component—no rank group specified.', 'wordpoints-importer' ) );
241
+		if (!isset($settings['rank_group'])) {
242
+			$feedback->warning(__('Skipping Ranks component—no rank group specified.', 'wordpoints-importer'));
243 243
 			$valid = false;
244
-		} elseif ( ! WordPoints_Rank_Groups::is_group_registered( $settings['rank_group'] ) ) {
245
-			$feedback->warning( __( 'Skipping Ranks component—invalid rank group selected.', 'wordpoints-importer' ) );
244
+		} elseif (!WordPoints_Rank_Groups::is_group_registered($settings['rank_group'])) {
245
+			$feedback->warning(__('Skipping Ranks component—invalid rank group selected.', 'wordpoints-importer'));
246 246
 			$valid = false;
247 247
 		}
248 248
 	}
Please login to merge, or discard this patch.
src/admin/screens/importing.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( true !== current_user_can( 'manage_options' ) ) {
11
-	wp_die();
11
+    wp_die();
12 12
 }
13 13
 
14 14
 check_admin_referer( 'wordpoints_import' );
Please login to merge, or discard this 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_attr( 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_attr(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.
src/admin/screens/import.php 3 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( true !== current_user_can( 'manage_options' ) ) {
11
-	wp_die();
11
+    wp_die();
12 12
 }
13 13
 
14 14
 $tabs = array( 'unavailable' => __( 'Unavailable', 'wordpoints-importer' ) );
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
 
17 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
-	$is_available = $importer->is_available();
21
+    $is_available = $importer->is_available();
22 22
 
23
-	if ( is_wp_error( $is_available ) ) {
24
-		$unavailable[ $args['name'] ] = $is_available;
25
-	} else {
26
-		$tabs[ $slug ] = $args['name'];
27
-	}
23
+    if ( is_wp_error( $is_available ) ) {
24
+        $unavailable[ $args['name'] ] = $is_available;
25
+    } else {
26
+        $tabs[ $slug ] = $args['name'];
27
+    }
28 28
 }
29 29
 
30 30
 if ( empty( $unavailable ) ) {
31
-	unset( $tabs['unavailable'] );
31
+    unset( $tabs['unavailable'] );
32 32
 }
33 33
 
34 34
 $current_tab = wordpoints_admin_get_current_tab( $tabs );
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 				<li>
52 52
 					<?php
53 53
 
54
-					printf(
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() )
59
-					);
54
+                    printf(
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() )
59
+                    );
60 60
 
61
-					?>
61
+                    ?>
62 62
 				</li>
63 63
 			<?php endforeach; ?>
64 64
 		</ul>
@@ -74,39 +74,39 @@  discard block
 block discarded – undo
74 74
 
75 75
 				<?php
76 76
 
77
-				if ( ! $importer->supports_component( $slug ) ) {
78
-					continue;
79
-				}
77
+                if ( ! $importer->supports_component( $slug ) ) {
78
+                    continue;
79
+                }
80 80
 
81
-				$supported = true;
81
+                $supported = true;
82 82
 
83
-				?>
83
+                ?>
84 84
 
85 85
 				<h3><?php echo esc_html( $component['name'] ); ?></h3>
86 86
 
87 87
 				<?php
88 88
 
89
-				/**
90
-				 * Before the import option fields for a component.
91
-				 *
92
-				 * @since 1.0.0
93
-				 */
94
-				do_action( "wordpoints_importer_before_component_options-{$slug}" );
89
+                /**
90
+                 * Before the import option fields for a component.
91
+                 *
92
+                 * @since 1.0.0
93
+                 */
94
+                do_action( "wordpoints_importer_before_component_options-{$slug}" );
95 95
 
96
-				?>
96
+                ?>
97 97
 
98 98
 				<?php foreach ( $importer->get_options_for_component( $slug ) as $name => $option ) : ?>
99 99
 
100 100
 					<?php
101 101
 
102
-					$can_import = true;
102
+                    $can_import = true;
103 103
 
104
-					// Check if this option is available.
105
-					if ( isset( $option['can_import'] ) ) {
106
-						$can_import = call_user_func( $option['can_import'], array() );
107
-					}
104
+                    // Check if this option is available.
105
+                    if ( isset( $option['can_import'] ) ) {
106
+                        $can_import = call_user_func( $option['can_import'], array() );
107
+                    }
108 108
 
109
-					?>
109
+                    ?>
110 110
 
111 111
 					<label for="wordpoints_import[<?php echo esc_attr( $slug ); ?>][<?php echo esc_attr( $name ); ?>]">
112 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 ); ?> />
@@ -132,20 +132,20 @@  discard block
 block discarded – undo
132 132
 
133 133
 			<?php
134 134
 
135
-			if ( ! isset( $supported ) ) {
135
+            if ( ! isset( $supported ) ) {
136 136
 
137
-				esc_html_e(
138
-					'This importer does not support any of the installed components.'
139
-					, 'wordpoints-importer'
140
-				);
137
+                esc_html_e(
138
+                    'This importer does not support any of the installed components.'
139
+                    , 'wordpoints-importer'
140
+                );
141 141
 
142
-			} else {
142
+            } else {
143 143
 
144
-				wp_nonce_field( 'wordpoints_import' );
145
-				submit_button( __( 'Import', 'wordpoints-importer' ) );
146
-			}
144
+                wp_nonce_field( 'wordpoints_import' );
145
+                submit_button( __( 'Import', 'wordpoints-importer' ) );
146
+            }
147 147
 
148
-			?>
148
+            ?>
149 149
 		</form>
150 150
 	<?php endif; ?>
151 151
 </div>
Please login to merge, or discard this 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_attr( admin_url( 'admin.php?page=wordpoints_importing' ) ); ?>">
73
-			<?php foreach ( $components as $slug => $component ) : ?>
72
+		<form method="post" action="<?php echo esc_attr(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,34 +91,34 @@  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 ) ) : ?>
115
-							&nbsp;&nbsp;<em><?php printf( esc_html__( 'Disabled (%s)', 'wordpoints-importer' ), esc_html( $can_import->get_error_message() ) ); ?></em>
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
+							&nbsp;&nbsp;<em><?php printf(esc_html__('Disabled (%s)', 'wordpoints-importer'), esc_html($can_import->get_error_message())); ?></em>
116 116
 						<?php endif; ?>
117 117
 					</label>
118 118
 
119
-					<?php if ( isset( $option['description'] ) ) : ?>
119
+					<?php if (isset($option['description'])) : ?>
120 120
 						<p class="description" style="margin-bottom: 10px; margin-left: 25px;">
121
-							<?php echo esc_html( $option['description'] ); ?>
121
+							<?php echo esc_html($option['description']); ?>
122 122
 						</p>
123 123
 					<?php else : ?>
124 124
 						<br style="margin-bottom: 10px" />
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 
129 129
 			<?php endforeach; ?>
130 130
 
131
-			<input type="hidden" value="<?php echo esc_attr( $current_tab ); ?>" name="importer" />
131
+			<input type="hidden" value="<?php echo esc_attr($current_tab); ?>" name="importer" />
132 132
 
133 133
 			<?php
134 134
 
135
-			if ( ! isset( $supported ) ) {
135
+			if (!isset($supported)) {
136 136
 
137 137
 				esc_html_e(
138 138
 					'This importer does not support any of the installed components.'
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 
142 142
 			} else {
143 143
 
144
-				wp_nonce_field( 'wordpoints_import' );
145
-				submit_button( __( 'Import', 'wordpoints-importer' ) );
144
+				wp_nonce_field('wordpoints_import');
145
+				submit_button(__('Import', 'wordpoints-importer'));
146 146
 			}
147 147
 
148 148
 			?>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,9 +63,12 @@  discard block
 block discarded – undo
63 63
 			<?php endforeach; ?>
64 64
 		</ul>
65 65
 
66
-	<?php else : ?>
66
+	<?php else {
67
+    : ?>
67 68
 
68
-		<?php $importer = WordPoints_Importers::get_importer( $current_tab ); ?>
69
+		<?php $importer = WordPoints_Importers::get_importer( $current_tab );
70
+}
71
+?>
69 72
 
70 73
 		<p><?php esc_html_e( 'Select which items you would like imported.', 'wordpoints-importer' ); ?></p>
71 74
 
@@ -120,9 +123,12 @@  discard block
 block discarded – undo
120 123
 						<p class="description" style="margin-bottom: 10px; margin-left: 25px;">
121 124
 							<?php echo esc_html( $option['description'] ); ?>
122 125
 						</p>
123
-					<?php else : ?>
126
+					<?php else {
127
+    : ?>
124 128
 						<br style="margin-bottom: 10px" />
125
-					<?php endif; ?>
129
+					<?php endif;
130
+}
131
+?>
126 132
 
127 133
 				<?php endforeach; ?>
128 134
 
Please login to merge, or discard this patch.
src/importer.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,12 +64,12 @@
 block discarded – undo
64 64
 
65 65
 if ( is_admin() ) {
66 66
 
67
-	/**
68
-	 * The module's admin-side code.
69
-	 *
70
-	 * @since 1.0.0
71
-	 */
72
-	require_once( dirname( __FILE__ ) . '/admin/admin.php' );
67
+    /**
68
+     * The module's admin-side code.
69
+     *
70
+     * @since 1.0.0
71
+     */
72
+    require_once( dirname( __FILE__ ) . '/admin/admin.php' );
73 73
 }
74 74
 
75 75
 // EOF
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,30 +46,30 @@
 block discarded – undo
46 46
  *
47 47
  * @since 1.0.0
48 48
  */
49
-require_once( dirname( __FILE__ ) . '/includes/class-feedback.php' );
49
+require_once(dirname(__FILE__).'/includes/class-feedback.php');
50 50
 
51 51
 /**
52 52
  * The base importer class.
53 53
  *
54 54
  * @since 1.0.0
55 55
  */
56
-require_once( dirname( __FILE__ ) . '/includes/class-importer.php' );
56
+require_once(dirname(__FILE__).'/includes/class-importer.php');
57 57
 
58 58
 /**
59 59
  * The module's general functions.
60 60
  *
61 61
  * @since 1.0.0
62 62
  */
63
-require_once( dirname( __FILE__ ) . '/includes/functions.php' );
63
+require_once(dirname(__FILE__).'/includes/functions.php');
64 64
 
65
-if ( is_admin() ) {
65
+if (is_admin()) {
66 66
 
67 67
 	/**
68 68
 	 * The module's admin-side code.
69 69
 	 *
70 70
 	 * @since 1.0.0
71 71
 	 */
72
-	require_once( dirname( __FILE__ ) . '/admin/admin.php' );
72
+	require_once(dirname(__FILE__).'/admin/admin.php');
73 73
 }
74 74
 
75 75
 // EOF
Please login to merge, or discard this patch.
src/includes/class-feedback.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -16,84 +16,84 @@
 block discarded – undo
16 16
  */
17 17
 class WordPoints_Importer_Feedback {
18 18
 
19
-	/**
20
-	 * Send an info message.
21
-	 *
22
-	 * Use this to give the user any info that wouldn't be handles by the other
23
-	 * methods.
24
-	 *
25
-	 * @since 1.0.0
26
-	 *
27
-	 * @param string $message The info message.
28
-	 */
29
-	public function info( $message ) {
30
-		$this->_send( $message, 'info' );
31
-	}
19
+    /**
20
+     * Send an info message.
21
+     *
22
+     * Use this to give the user any info that wouldn't be handles by the other
23
+     * methods.
24
+     *
25
+     * @since 1.0.0
26
+     *
27
+     * @param string $message The info message.
28
+     */
29
+    public function info( $message ) {
30
+        $this->_send( $message, 'info' );
31
+    }
32 32
 
33
-	/**
34
-	 * Send a success message.
35
-	 *
36
-	 * Use this when you want to let the user know that something was a success.
37
-	 *
38
-	 * @since 1.0.0
39
-	 *
40
-	 * @param string $message The success message.
41
-	 */
42
-	public function success( $message ) {
43
-		$this->_send( $message, 'success' );
44
-	}
33
+    /**
34
+     * Send a success message.
35
+     *
36
+     * Use this when you want to let the user know that something was a success.
37
+     *
38
+     * @since 1.0.0
39
+     *
40
+     * @param string $message The success message.
41
+     */
42
+    public function success( $message ) {
43
+        $this->_send( $message, 'success' );
44
+    }
45 45
 
46
-	/**
47
-	 * Send an error message.
48
-	 *
49
-	 * Use this when you want to let the user know that there was an error.
50
-	 *
51
-	 * @since 1.0.0
52
-	 *
53
-	 * @param string $message The error message.
54
-	 */
55
-	public function error( $message ) {
56
-		$this->_send( $message, 'error' );
57
-	}
46
+    /**
47
+     * Send an error message.
48
+     *
49
+     * Use this when you want to let the user know that there was an error.
50
+     *
51
+     * @since 1.0.0
52
+     *
53
+     * @param string $message The error message.
54
+     */
55
+    public function error( $message ) {
56
+        $this->_send( $message, 'error' );
57
+    }
58 58
 
59
-	/**
60
-	 * Send a warning message.
61
-	 *
62
-	 * Use this to warn the user about something. A warning doesn't necessarily imply
63
-	 * an error, but that something unexpected has occured that the user might need
64
-	 * to know.
65
-	 *
66
-	 * @since 1.0.0
67
-	 *
68
-	 * @param string $message The warning message.
69
-	 */
70
-	public function warning( $message ) {
71
-		$this->_send( $message, 'warning' );
72
-	}
59
+    /**
60
+     * Send a warning message.
61
+     *
62
+     * Use this to warn the user about something. A warning doesn't necessarily imply
63
+     * an error, but that something unexpected has occured that the user might need
64
+     * to know.
65
+     *
66
+     * @since 1.0.0
67
+     *
68
+     * @param string $message The warning message.
69
+     */
70
+    public function warning( $message ) {
71
+        $this->_send( $message, 'warning' );
72
+    }
73 73
 
74
-	//
75
-	// Protected Methods.
76
-	//
74
+    //
75
+    // Protected Methods.
76
+    //
77 77
 
78
-	/**
79
-	 * Send a message to the user.
80
-	 *
81
-	 * @since 1.0.0
82
-	 *
83
-	 * @param string $message The feedback message.
84
-	 * @param string $type    The type of message: 'info' (defuault), 'sucess',
85
-	 *                        'error', 'warning'.
86
-	 */
87
-	protected function _send( $message, $type = 'info' ) {
78
+    /**
79
+     * Send a message to the user.
80
+     *
81
+     * @since 1.0.0
82
+     *
83
+     * @param string $message The feedback message.
84
+     * @param string $type    The type of message: 'info' (defuault), 'sucess',
85
+     *                        'error', 'warning'.
86
+     */
87
+    protected function _send( $message, $type = 'info' ) {
88 88
 
89
-		?>
89
+        ?>
90 90
 
91 91
 		<p class="wordpoints-feedback wordpoints-feedback-<?php echo esc_attr( $type ); ?>">
92 92
 			<?php echo wp_kses( $message, 'wordpoints_importer_feedback' ); ?>
93 93
 		</p>
94 94
 
95 95
 		<?php
96
-	}
96
+    }
97 97
 }
98 98
 
99 99
 // EOF
Please login to merge, or discard this 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' ) {
87
+	protected function _send($message, $type = 'info') {
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.