Passed
Push — master ( 6c33bf...2e88d0 )
by Brian
15:54
created
includes/admin/class-wpinv-items-report-table.php 2 patches
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 // Load WP_List_Table if not loaded
11 11
 if ( ! class_exists( 'WP_List_Table' ) ) {
12
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
12
+    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
15 15
 /**
@@ -21,129 +21,129 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class WPInv_Items_Report_Table extends WP_List_Table {
23 23
 
24
-	/**
25
-	 * @var int Number of items per page
26
-	 * @since 1.0.19
27
-	 */
28
-	public $per_page = 300;
29
-
30
-
31
-	/**
32
-	 * Get things started
33
-	 *
34
-	 * @since 1.0.19
35
-	 * @see WP_List_Table::__construct()
36
-	 */
37
-	public function __construct() {
38
-
39
-		// Set parent defaults
40
-		parent::__construct( array(
41
-			'singular' => 'id',
42
-			'plural'   => 'ids',
43
-			'ajax'     => false,
44
-		) );
45
-
46
-	}
47
-
48
-	/**
49
-	 * Gets the name of the primary column.
50
-	 *
51
-	 * @since 1.0.19
52
-	 * @access protected
53
-	 *
54
-	 * @return string Name of the primary column.
55
-	 */
56
-	protected function get_primary_column_name() {
57
-		return 'item';
58
-	}
59
-
60
-	/**
61
-	 * This function renders most of the columns in the list table.
62
-	 *
63
-	 * @since 1.0.19
64
-	 *
65
-	 * @param array $item Contains all the data of the gateways
66
-	 * @param string $column_name The name of the column
67
-	 *
68
-	 * @return string Column Name
69
-	 */
70
-	public function column_default( $item, $column_name ) {
71
-		return wp_kses_post( $item[ $column_name ] );
72
-	}
73
-
74
-	/**
75
-	 * Retrieve the table columns
76
-	 *
77
-	 * @since 1.0.19
78
-	 * @return array $columns Array of all the list table columns
79
-	 */
80
-	public function get_columns() {
81
-
82
-		return array(
83
-			'item'     => __( 'Item', 'invoicing' ),
84
-			'sales'    => __( 'Quantity Sold', 'invoicing' ),
85
-			'total'    => __( 'Total Earnings', 'invoicing' ),
86
-			'discount' => __( 'Total Discounts', 'invoicing' ),
87
-			'tax'      => __( 'Total Taxes', 'invoicing' ),
88
-		);
89
-
90
-	}
91
-
92
-	/**
93
-	 * Retrieve the current page number
94
-	 *
95
-	 * @since 1.0.19
96
-	 * @return int Current page number
97
-	 */
98
-	public function get_paged() {
99
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
100
-	}
101
-
102
-	/**
103
-	 * Outputs the reporting views
104
-	 *
105
-	 * @since 1.0.19
106
-	 * @return void
107
-	 */
108
-	public function bulk_actions( $which = '' ) {
109
-		return array();
110
-	}
111
-
112
-	/**
113
-	 * Build all the reports data
114
-	 *
115
-	 * @since 1.0.19
116
-	 * @return array $reports_data All the data for gateway reports
117
-	 */
118
-	public function reports_data() {
119
-
120
-		$reports_data = $this->revenue_reports_data();
121
-
122
-		$prepared = array();
123
-		foreach ( $reports_data as $report_data ) {
124
-			$prepared[] = array(
125
-				'item'     => $report_data['item_name'],
126
-				'sales'    => $report_data['sales'],
127
-				'total'    => wpinv_price( wpinv_format_amount( $report_data['total'] ) ),
128
-				'discount' => wpinv_price( wpinv_format_amount( $report_data['discount'] ) ),
129
-				'tax'      => wpinv_price( wpinv_format_amount( $report_data['tax'] ) ),
130
-			);
131
-		}
132
-
133
-		return $prepared;
134
-	}
135
-
136
-	/**
137
-	 * Retrieves report data.
138
-	 *
139
-	 * @since 1.0.19
140
-	 */
141
-	public function revenue_reports_data() {
142
-		global $wpdb;
143
-
144
-		$table =  $wpdb->prefix . 'getpaid_invoice_items';
145
-		return $wpdb->get_results(
146
-			"SELECT
24
+    /**
25
+     * @var int Number of items per page
26
+     * @since 1.0.19
27
+     */
28
+    public $per_page = 300;
29
+
30
+
31
+    /**
32
+     * Get things started
33
+     *
34
+     * @since 1.0.19
35
+     * @see WP_List_Table::__construct()
36
+     */
37
+    public function __construct() {
38
+
39
+        // Set parent defaults
40
+        parent::__construct( array(
41
+            'singular' => 'id',
42
+            'plural'   => 'ids',
43
+            'ajax'     => false,
44
+        ) );
45
+
46
+    }
47
+
48
+    /**
49
+     * Gets the name of the primary column.
50
+     *
51
+     * @since 1.0.19
52
+     * @access protected
53
+     *
54
+     * @return string Name of the primary column.
55
+     */
56
+    protected function get_primary_column_name() {
57
+        return 'item';
58
+    }
59
+
60
+    /**
61
+     * This function renders most of the columns in the list table.
62
+     *
63
+     * @since 1.0.19
64
+     *
65
+     * @param array $item Contains all the data of the gateways
66
+     * @param string $column_name The name of the column
67
+     *
68
+     * @return string Column Name
69
+     */
70
+    public function column_default( $item, $column_name ) {
71
+        return wp_kses_post( $item[ $column_name ] );
72
+    }
73
+
74
+    /**
75
+     * Retrieve the table columns
76
+     *
77
+     * @since 1.0.19
78
+     * @return array $columns Array of all the list table columns
79
+     */
80
+    public function get_columns() {
81
+
82
+        return array(
83
+            'item'     => __( 'Item', 'invoicing' ),
84
+            'sales'    => __( 'Quantity Sold', 'invoicing' ),
85
+            'total'    => __( 'Total Earnings', 'invoicing' ),
86
+            'discount' => __( 'Total Discounts', 'invoicing' ),
87
+            'tax'      => __( 'Total Taxes', 'invoicing' ),
88
+        );
89
+
90
+    }
91
+
92
+    /**
93
+     * Retrieve the current page number
94
+     *
95
+     * @since 1.0.19
96
+     * @return int Current page number
97
+     */
98
+    public function get_paged() {
99
+        return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
100
+    }
101
+
102
+    /**
103
+     * Outputs the reporting views
104
+     *
105
+     * @since 1.0.19
106
+     * @return void
107
+     */
108
+    public function bulk_actions( $which = '' ) {
109
+        return array();
110
+    }
111
+
112
+    /**
113
+     * Build all the reports data
114
+     *
115
+     * @since 1.0.19
116
+     * @return array $reports_data All the data for gateway reports
117
+     */
118
+    public function reports_data() {
119
+
120
+        $reports_data = $this->revenue_reports_data();
121
+
122
+        $prepared = array();
123
+        foreach ( $reports_data as $report_data ) {
124
+            $prepared[] = array(
125
+                'item'     => $report_data['item_name'],
126
+                'sales'    => $report_data['sales'],
127
+                'total'    => wpinv_price( wpinv_format_amount( $report_data['total'] ) ),
128
+                'discount' => wpinv_price( wpinv_format_amount( $report_data['discount'] ) ),
129
+                'tax'      => wpinv_price( wpinv_format_amount( $report_data['tax'] ) ),
130
+            );
131
+        }
132
+
133
+        return $prepared;
134
+    }
135
+
136
+    /**
137
+     * Retrieves report data.
138
+     *
139
+     * @since 1.0.19
140
+     */
141
+    public function revenue_reports_data() {
142
+        global $wpdb;
143
+
144
+        $table =  $wpdb->prefix . 'getpaid_invoice_items';
145
+        return $wpdb->get_results(
146
+            "SELECT
147 147
 				SUM(quantity) as sales,
148 148
 				item_name,
149 149
 				SUM(tax) as tax,
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 			GROUP BY item_id
158 158
 			ORDER BY item_name ASC", ARRAY_A);
159 159
 
160
-	}
161
-
162
-	/**
163
-	 * Setup the final data for the table
164
-	 *
165
-	 * @since 1.0.19
166
-	 * @return void
167
-	 */
168
-	public function prepare_items() {
169
-		$columns               = $this->get_columns();
170
-		$hidden                = array(); // No hidden columns
171
-		$sortable              = $this->get_sortable_columns();
172
-		$this->_column_headers = array( $columns, $hidden, $sortable );
173
-		$this->items           = $this->reports_data();
174
-	}
160
+    }
161
+
162
+    /**
163
+     * Setup the final data for the table
164
+     *
165
+     * @since 1.0.19
166
+     * @return void
167
+     */
168
+    public function prepare_items() {
169
+        $columns               = $this->get_columns();
170
+        $hidden                = array(); // No hidden columns
171
+        $sortable              = $this->get_sortable_columns();
172
+        $this->_column_headers = array( $columns, $hidden, $sortable );
173
+        $this->items           = $this->reports_data();
174
+    }
175 175
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Exit if accessed directly
8
-if ( ! defined( 'ABSPATH' ) ) exit;
8
+if (!defined('ABSPATH')) exit;
9 9
 
10 10
 // Load WP_List_Table if not loaded
11
-if ( ! class_exists( 'WP_List_Table' ) ) {
11
+if (!class_exists('WP_List_Table')) {
12 12
 	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	public function __construct() {
38 38
 
39 39
 		// Set parent defaults
40
-		parent::__construct( array(
40
+		parent::__construct(array(
41 41
 			'singular' => 'id',
42 42
 			'plural'   => 'ids',
43 43
 			'ajax'     => false,
44
-		) );
44
+		));
45 45
 
46 46
 	}
47 47
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return string Column Name
69 69
 	 */
70
-	public function column_default( $item, $column_name ) {
71
-		return wp_kses_post( $item[ $column_name ] );
70
+	public function column_default($item, $column_name) {
71
+		return wp_kses_post($item[$column_name]);
72 72
 	}
73 73
 
74 74
 	/**
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	public function get_columns() {
81 81
 
82 82
 		return array(
83
-			'item'     => __( 'Item', 'invoicing' ),
84
-			'sales'    => __( 'Quantity Sold', 'invoicing' ),
85
-			'total'    => __( 'Total Earnings', 'invoicing' ),
86
-			'discount' => __( 'Total Discounts', 'invoicing' ),
87
-			'tax'      => __( 'Total Taxes', 'invoicing' ),
83
+			'item'     => __('Item', 'invoicing'),
84
+			'sales'    => __('Quantity Sold', 'invoicing'),
85
+			'total'    => __('Total Earnings', 'invoicing'),
86
+			'discount' => __('Total Discounts', 'invoicing'),
87
+			'tax'      => __('Total Taxes', 'invoicing'),
88 88
 		);
89 89
 
90 90
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return int Current page number
97 97
 	 */
98 98
 	public function get_paged() {
99
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
99
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @since 1.0.19
106 106
 	 * @return void
107 107
 	 */
108
-	public function bulk_actions( $which = '' ) {
108
+	public function bulk_actions($which = '') {
109 109
 		return array();
110 110
 	}
111 111
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 		$reports_data = $this->revenue_reports_data();
121 121
 
122 122
 		$prepared = array();
123
-		foreach ( $reports_data as $report_data ) {
123
+		foreach ($reports_data as $report_data) {
124 124
 			$prepared[] = array(
125 125
 				'item'     => $report_data['item_name'],
126 126
 				'sales'    => $report_data['sales'],
127
-				'total'    => wpinv_price( wpinv_format_amount( $report_data['total'] ) ),
128
-				'discount' => wpinv_price( wpinv_format_amount( $report_data['discount'] ) ),
129
-				'tax'      => wpinv_price( wpinv_format_amount( $report_data['tax'] ) ),
127
+				'total'    => wpinv_price(wpinv_format_amount($report_data['total'])),
128
+				'discount' => wpinv_price(wpinv_format_amount($report_data['discount'])),
129
+				'tax'      => wpinv_price(wpinv_format_amount($report_data['tax'])),
130 130
 			);
131 131
 		}
132 132
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	public function revenue_reports_data() {
142 142
 		global $wpdb;
143 143
 
144
-		$table =  $wpdb->prefix . 'getpaid_invoice_items';
144
+		$table = $wpdb->prefix . 'getpaid_invoice_items';
145 145
 		return $wpdb->get_results(
146 146
 			"SELECT
147 147
 				SUM(quantity) as sales,
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		$columns               = $this->get_columns();
170 170
 		$hidden                = array(); // No hidden columns
171 171
 		$sortable              = $this->get_sortable_columns();
172
-		$this->_column_headers = array( $columns, $hidden, $sortable );
172
+		$this->_column_headers = array($columns, $hidden, $sortable);
173 173
 		$this->items           = $this->reports_data();
174 174
 	}
175 175
 }
Please login to merge, or discard this patch.
includes/admin/class-wpinv-gateways-report-table.php 2 patches
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 // Load WP_List_Table if not loaded
11 11
 if ( ! class_exists( 'WP_List_Table' ) ) {
12
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
12
+    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
15 15
 /**
@@ -21,148 +21,148 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class WPInv_Gateways_Report_Table extends WP_List_Table {
23 23
 
24
-	/**
25
-	 * @var int Number of items per page
26
-	 * @since 1.0.19
27
-	 */
28
-	public $per_page = 300;
29
-
30
-
31
-	/**
32
-	 * Get things started
33
-	 *
34
-	 * @since 1.0.19
35
-	 * @see WP_List_Table::__construct()
36
-	 */
37
-	public function __construct() {
38
-
39
-		// Set parent defaults
40
-		parent::__construct( array(
41
-			'singular' => 'id',
42
-			'plural'   => 'ids',
43
-			'ajax'     => false,
44
-		) );
45
-
46
-	}
47
-
48
-	/**
49
-	 * Gets the name of the primary column.
50
-	 *
51
-	 * @since 1.0.19
52
-	 * @access protected
53
-	 *
54
-	 * @return string Name of the primary column.
55
-	 */
56
-	protected function get_primary_column_name() {
57
-		return 'gateway';
58
-	}
59
-
60
-	/**
61
-	 * This function renders most of the columns in the list table.
62
-	 *
63
-	 * @since 1.0.19
64
-	 *
65
-	 * @param array $item Contains all the data of the gateways
66
-	 * @param string $column_name The name of the column
67
-	 *
68
-	 * @return string Column Name
69
-	 */
70
-	public function column_default( $item, $column_name ) {
71
-		return wp_kses_post( $item[ $column_name ] );
72
-	}
73
-
74
-	/**
75
-	 * Retrieve the table columns
76
-	 *
77
-	 * @since 1.0.19
78
-	 * @return array $columns Array of all the list table columns
79
-	 */
80
-	public function get_columns() {
81
-
82
-		return array(
83
-			'gateway'  => __( 'Gateway', 'invoicing' ),
84
-			'sales'    => __( 'Total Sales', 'invoicing' ),
85
-			'total'    => __( 'Total Earnings', 'invoicing' ),
86
-			'discount' => __( 'Total Discounts', 'invoicing' ),
87
-			'tax'      => __( 'Total Taxes', 'invoicing' ),
88
-			'fees'     => __( 'Total Fees', 'invoicing' ),
89
-		);
90
-
91
-	}
92
-
93
-	/**
94
-	 * Retrieve the current page number
95
-	 *
96
-	 * @since 1.0.19
97
-	 * @return int Current page number
98
-	 */
99
-	public function get_paged() {
100
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
101
-	}
102
-
103
-	/**
104
-	 * Outputs the reporting views
105
-	 *
106
-	 * @since 1.0.19
107
-	 * @return void
108
-	 */
109
-	public function bulk_actions( $which = '' ) {
110
-		return array();
111
-	}
112
-
113
-	/**
114
-	 * Build all the reports data
115
-	 *
116
-	 * @since 1.0.19
117
-	 * @return array $reports_data All the data for gateway reports
118
-	 */
119
-	public function reports_data() {
120
-
121
-		$reports_data = $this->revenue_reports_data();
122
-		$gateways     = wpinv_get_payment_gateways();
123
-
124
-		foreach ( $gateways as $gateway_id => $gateway ) {
125
-
126
-			if ( ! empty( $reports_data[ $gateway_id ] ) ) {
127
-				continue;
128
-			}
129
-
130
-			$reports_data[] = array(
131
-				'gateway'  => $gateway_id,
132
-				'sales'    => 0,
133
-				'total'    => 0,
134
-				'discount' => 0,
135
-				'tax'      => 0,
136
-				'fees'     => 0,
137
-			);
138
-		}
139
-
140
-		$prepared = array();
141
-		foreach ( $reports_data as $report_data ) {
142
-			$prepared[] = array(
143
-				'gateway'  => wpinv_get_gateway_admin_label( $report_data['gateway'] ),
144
-				'sales'    => $report_data['sales'],
145
-				'total'    => wpinv_price( wpinv_format_amount( $report_data['total'] ) ),
146
-				'discount' => wpinv_price( wpinv_format_amount( $report_data['discount'] ) ),
147
-				'tax'      => wpinv_price( wpinv_format_amount( $report_data['tax'] ) ),
148
-				'fees'     => wpinv_price( wpinv_format_amount( $report_data['fees'] ) ),
149
-			);
150
-		}
151
-
152
-		return $prepared;
153
-	}
154
-
155
-	/**
156
-	 * Retrieves report data.
157
-	 *
158
-	 * @since 1.0.19
159
-	 */
160
-	public function revenue_reports_data() {
161
-		global $wpdb;
162
-
163
-		$table =  $wpdb->prefix . 'getpaid_invoices';
164
-		$data  = $wpdb->get_results(
165
-			"SELECT
24
+    /**
25
+     * @var int Number of items per page
26
+     * @since 1.0.19
27
+     */
28
+    public $per_page = 300;
29
+
30
+
31
+    /**
32
+     * Get things started
33
+     *
34
+     * @since 1.0.19
35
+     * @see WP_List_Table::__construct()
36
+     */
37
+    public function __construct() {
38
+
39
+        // Set parent defaults
40
+        parent::__construct( array(
41
+            'singular' => 'id',
42
+            'plural'   => 'ids',
43
+            'ajax'     => false,
44
+        ) );
45
+
46
+    }
47
+
48
+    /**
49
+     * Gets the name of the primary column.
50
+     *
51
+     * @since 1.0.19
52
+     * @access protected
53
+     *
54
+     * @return string Name of the primary column.
55
+     */
56
+    protected function get_primary_column_name() {
57
+        return 'gateway';
58
+    }
59
+
60
+    /**
61
+     * This function renders most of the columns in the list table.
62
+     *
63
+     * @since 1.0.19
64
+     *
65
+     * @param array $item Contains all the data of the gateways
66
+     * @param string $column_name The name of the column
67
+     *
68
+     * @return string Column Name
69
+     */
70
+    public function column_default( $item, $column_name ) {
71
+        return wp_kses_post( $item[ $column_name ] );
72
+    }
73
+
74
+    /**
75
+     * Retrieve the table columns
76
+     *
77
+     * @since 1.0.19
78
+     * @return array $columns Array of all the list table columns
79
+     */
80
+    public function get_columns() {
81
+
82
+        return array(
83
+            'gateway'  => __( 'Gateway', 'invoicing' ),
84
+            'sales'    => __( 'Total Sales', 'invoicing' ),
85
+            'total'    => __( 'Total Earnings', 'invoicing' ),
86
+            'discount' => __( 'Total Discounts', 'invoicing' ),
87
+            'tax'      => __( 'Total Taxes', 'invoicing' ),
88
+            'fees'     => __( 'Total Fees', 'invoicing' ),
89
+        );
90
+
91
+    }
92
+
93
+    /**
94
+     * Retrieve the current page number
95
+     *
96
+     * @since 1.0.19
97
+     * @return int Current page number
98
+     */
99
+    public function get_paged() {
100
+        return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
101
+    }
102
+
103
+    /**
104
+     * Outputs the reporting views
105
+     *
106
+     * @since 1.0.19
107
+     * @return void
108
+     */
109
+    public function bulk_actions( $which = '' ) {
110
+        return array();
111
+    }
112
+
113
+    /**
114
+     * Build all the reports data
115
+     *
116
+     * @since 1.0.19
117
+     * @return array $reports_data All the data for gateway reports
118
+     */
119
+    public function reports_data() {
120
+
121
+        $reports_data = $this->revenue_reports_data();
122
+        $gateways     = wpinv_get_payment_gateways();
123
+
124
+        foreach ( $gateways as $gateway_id => $gateway ) {
125
+
126
+            if ( ! empty( $reports_data[ $gateway_id ] ) ) {
127
+                continue;
128
+            }
129
+
130
+            $reports_data[] = array(
131
+                'gateway'  => $gateway_id,
132
+                'sales'    => 0,
133
+                'total'    => 0,
134
+                'discount' => 0,
135
+                'tax'      => 0,
136
+                'fees'     => 0,
137
+            );
138
+        }
139
+
140
+        $prepared = array();
141
+        foreach ( $reports_data as $report_data ) {
142
+            $prepared[] = array(
143
+                'gateway'  => wpinv_get_gateway_admin_label( $report_data['gateway'] ),
144
+                'sales'    => $report_data['sales'],
145
+                'total'    => wpinv_price( wpinv_format_amount( $report_data['total'] ) ),
146
+                'discount' => wpinv_price( wpinv_format_amount( $report_data['discount'] ) ),
147
+                'tax'      => wpinv_price( wpinv_format_amount( $report_data['tax'] ) ),
148
+                'fees'     => wpinv_price( wpinv_format_amount( $report_data['fees'] ) ),
149
+            );
150
+        }
151
+
152
+        return $prepared;
153
+    }
154
+
155
+    /**
156
+     * Retrieves report data.
157
+     *
158
+     * @since 1.0.19
159
+     */
160
+    public function revenue_reports_data() {
161
+        global $wpdb;
162
+
163
+        $table =  $wpdb->prefix . 'getpaid_invoices';
164
+        $data  = $wpdb->get_results(
165
+            "SELECT
166 166
 				COUNT(posts.ID) as sales,
167 167
 				meta.gateway as gateway,
168 168
 				SUM(meta.total) as total,
@@ -177,27 +177,27 @@  discard block
 block discarded – undo
177 177
                 AND ( posts.post_status = 'publish' OR posts.post_status = 'renewal' )
178 178
 			GROUP BY meta.gateway", ARRAY_A);
179 179
 		
180
-		$return = array();
181
-
182
-		foreach ( $data as $gateway ) {
183
-			$return[ $gateway ['gateway']] = $gateway;
184
-		}
185
-
186
-		return $return;
187
-
188
-	}
189
-
190
-	/**
191
-	 * Setup the final data for the table
192
-	 *
193
-	 * @since 1.0.19
194
-	 * @return void
195
-	 */
196
-	public function prepare_items() {
197
-		$columns               = $this->get_columns();
198
-		$hidden                = array(); // No hidden columns
199
-		$sortable              = $this->get_sortable_columns();
200
-		$this->_column_headers = array( $columns, $hidden, $sortable );
201
-		$this->items           = $this->reports_data();
202
-	}
180
+        $return = array();
181
+
182
+        foreach ( $data as $gateway ) {
183
+            $return[ $gateway ['gateway']] = $gateway;
184
+        }
185
+
186
+        return $return;
187
+
188
+    }
189
+
190
+    /**
191
+     * Setup the final data for the table
192
+     *
193
+     * @since 1.0.19
194
+     * @return void
195
+     */
196
+    public function prepare_items() {
197
+        $columns               = $this->get_columns();
198
+        $hidden                = array(); // No hidden columns
199
+        $sortable              = $this->get_sortable_columns();
200
+        $this->_column_headers = array( $columns, $hidden, $sortable );
201
+        $this->items           = $this->reports_data();
202
+    }
203 203
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Exit if accessed directly
8
-if ( ! defined( 'ABSPATH' ) ) exit;
8
+if (!defined('ABSPATH')) exit;
9 9
 
10 10
 // Load WP_List_Table if not loaded
11
-if ( ! class_exists( 'WP_List_Table' ) ) {
11
+if (!class_exists('WP_List_Table')) {
12 12
 	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	public function __construct() {
38 38
 
39 39
 		// Set parent defaults
40
-		parent::__construct( array(
40
+		parent::__construct(array(
41 41
 			'singular' => 'id',
42 42
 			'plural'   => 'ids',
43 43
 			'ajax'     => false,
44
-		) );
44
+		));
45 45
 
46 46
 	}
47 47
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return string Column Name
69 69
 	 */
70
-	public function column_default( $item, $column_name ) {
71
-		return wp_kses_post( $item[ $column_name ] );
70
+	public function column_default($item, $column_name) {
71
+		return wp_kses_post($item[$column_name]);
72 72
 	}
73 73
 
74 74
 	/**
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 	public function get_columns() {
81 81
 
82 82
 		return array(
83
-			'gateway'  => __( 'Gateway', 'invoicing' ),
84
-			'sales'    => __( 'Total Sales', 'invoicing' ),
85
-			'total'    => __( 'Total Earnings', 'invoicing' ),
86
-			'discount' => __( 'Total Discounts', 'invoicing' ),
87
-			'tax'      => __( 'Total Taxes', 'invoicing' ),
88
-			'fees'     => __( 'Total Fees', 'invoicing' ),
83
+			'gateway'  => __('Gateway', 'invoicing'),
84
+			'sales'    => __('Total Sales', 'invoicing'),
85
+			'total'    => __('Total Earnings', 'invoicing'),
86
+			'discount' => __('Total Discounts', 'invoicing'),
87
+			'tax'      => __('Total Taxes', 'invoicing'),
88
+			'fees'     => __('Total Fees', 'invoicing'),
89 89
 		);
90 90
 
91 91
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @return int Current page number
98 98
 	 */
99 99
 	public function get_paged() {
100
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
100
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
101 101
 	}
102 102
 
103 103
 	/**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @since 1.0.19
107 107
 	 * @return void
108 108
 	 */
109
-	public function bulk_actions( $which = '' ) {
109
+	public function bulk_actions($which = '') {
110 110
 		return array();
111 111
 	}
112 112
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 		$reports_data = $this->revenue_reports_data();
122 122
 		$gateways     = wpinv_get_payment_gateways();
123 123
 
124
-		foreach ( $gateways as $gateway_id => $gateway ) {
124
+		foreach ($gateways as $gateway_id => $gateway) {
125 125
 
126
-			if ( ! empty( $reports_data[ $gateway_id ] ) ) {
126
+			if (!empty($reports_data[$gateway_id])) {
127 127
 				continue;
128 128
 			}
129 129
 
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 
140 140
 		$prepared = array();
141
-		foreach ( $reports_data as $report_data ) {
141
+		foreach ($reports_data as $report_data) {
142 142
 			$prepared[] = array(
143
-				'gateway'  => wpinv_get_gateway_admin_label( $report_data['gateway'] ),
143
+				'gateway'  => wpinv_get_gateway_admin_label($report_data['gateway']),
144 144
 				'sales'    => $report_data['sales'],
145
-				'total'    => wpinv_price( wpinv_format_amount( $report_data['total'] ) ),
146
-				'discount' => wpinv_price( wpinv_format_amount( $report_data['discount'] ) ),
147
-				'tax'      => wpinv_price( wpinv_format_amount( $report_data['tax'] ) ),
148
-				'fees'     => wpinv_price( wpinv_format_amount( $report_data['fees'] ) ),
145
+				'total'    => wpinv_price(wpinv_format_amount($report_data['total'])),
146
+				'discount' => wpinv_price(wpinv_format_amount($report_data['discount'])),
147
+				'tax'      => wpinv_price(wpinv_format_amount($report_data['tax'])),
148
+				'fees'     => wpinv_price(wpinv_format_amount($report_data['fees'])),
149 149
 			);
150 150
 		}
151 151
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	public function revenue_reports_data() {
161 161
 		global $wpdb;
162 162
 
163
-		$table =  $wpdb->prefix . 'getpaid_invoices';
163
+		$table = $wpdb->prefix . 'getpaid_invoices';
164 164
 		$data  = $wpdb->get_results(
165 165
 			"SELECT
166 166
 				COUNT(posts.ID) as sales,
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 		
180 180
 		$return = array();
181 181
 
182
-		foreach ( $data as $gateway ) {
183
-			$return[ $gateway ['gateway']] = $gateway;
182
+		foreach ($data as $gateway) {
183
+			$return[$gateway ['gateway']] = $gateway;
184 184
 		}
185 185
 
186 186
 		return $return;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$columns               = $this->get_columns();
198 198
 		$hidden                = array(); // No hidden columns
199 199
 		$sortable              = $this->get_sortable_columns();
200
-		$this->_column_headers = array( $columns, $hidden, $sortable );
200
+		$this->_column_headers = array($columns, $hidden, $sortable);
201 201
 		$this->items           = $this->reports_data();
202 202
 	}
203 203
 }
Please login to merge, or discard this patch.
includes/admin/class-wpinv-taxes-report-table.php 2 patches
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 // Load WP_List_Table if not loaded
11 11
 if ( ! class_exists( 'WP_List_Table' ) ) {
12
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
12
+    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
15 15
 /**
@@ -21,145 +21,145 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class WPInv_Taxes_Reports_Table extends WP_List_Table {
23 23
 
24
-	/**
25
-	 * @var int Number of items per page
26
-	 * @since 1.0.19
27
-	 */
28
-	public $per_page = 300;
29
-
30
-
31
-	/**
32
-	 * Get things started
33
-	 *
34
-	 * @since 1.0.19
35
-	 * @see WP_List_Table::__construct()
36
-	 */
37
-	public function __construct() {
38
-
39
-		// Set parent defaults
40
-		parent::__construct( array(
41
-			'singular' => 'id',
42
-			'plural'   => 'ids',
43
-			'ajax'     => false,
44
-		) );
45
-
46
-	}
47
-
48
-	/**
49
-	 * Gets the name of the primary column.
50
-	 *
51
-	 * @since 1.0.19
52
-	 * @access protected
53
-	 *
54
-	 * @return string Name of the primary column.
55
-	 */
56
-	protected function get_primary_column_name() {
57
-		return 'month';
58
-	}
59
-
60
-	/**
61
-	 * This function renders most of the columns in the list table.
62
-	 *
63
-	 * @since 1.0.19
64
-	 *
65
-	 * @param array $item Contains all the data of the gateways
66
-	 * @param string $column_name The name of the column
67
-	 *
68
-	 * @return string Column Name
69
-	 */
70
-	public function column_default( $item, $column_name ) {
71
-		return wp_kses_post( $item[ $column_name ] );
72
-	}
73
-
74
-	/**
75
-	 * Retrieve the table columns
76
-	 *
77
-	 * @since 1.0.19
78
-	 * @return array $columns Array of all the list table columns
79
-	 */
80
-	public function get_columns() {
81
-
82
-		return array(
83
-			'month'    => __( 'Month', 'invoicing' ),
84
-			'tax'      => __( 'Total Taxes', 'invoicing' ),
85
-		);
86
-
87
-	}
88
-
89
-	/**
90
-	 * Retrieve the current page number
91
-	 *
92
-	 * @since 1.0.19
93
-	 * @return int Current page number
94
-	 */
95
-	public function get_paged() {
96
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
97
-	}
98
-
99
-	/**
100
-	 * Outputs the reporting views
101
-	 *
102
-	 * @since 1.0.19
103
-	 * @return void
104
-	 */
105
-	public function bulk_actions( $which = '' ) {
106
-		return array();
107
-	}
108
-
109
-	/**
110
-	 * Build all the reports data
111
-	 *
112
-	 * @since 1.0.19
113
-	 * @return array $reports_data All the data for taxes reports
114
-	 */
115
-	public function reports_data() {
116
-
117
-		$reports_data = $this->taxes_reports_data();
118
-		$months       = array(
119
-			'1' => __( 'January', 'invoicing' ),
120
-			'2' => __( 'February', 'invoicing' ),
121
-			'3' => __( 'March', 'invoicing' ),
122
-			'4' => __( 'April', 'invoicing' ),
123
-			'5' => __( 'May', 'invoicing' ),
124
-			'6' => __( 'June', 'invoicing' ),
125
-			'7' => __( 'July', 'invoicing' ),
126
-			'8' => __( 'August', 'invoicing' ),
127
-			'9' => __( 'September', 'invoicing' ),
128
-			'10' => __( 'October', 'invoicing' ),
129
-			'11' => __( 'November', 'invoicing' ),
130
-			'12' => __( 'December', 'invoicing' ),
131
-		);
132
-
133
-		$prepared = array();
134
-		foreach ( $months as $month => $label ) {
135
-
136
-			$tax = wpinv_price( 0 );
137
-			if ( ! empty( $reports_data[ $month ] ) ) {
138
-				$tax = wpinv_price( wpinv_format_amount( $reports_data[ $month ] ) );
139
-			}
140
-
141
-			$prepared[] = array(
142
-				'month'    => $label,
143
-				'tax'      => $tax,
144
-			);
145
-
146
-		}
147
-
148
-		return $prepared;
149
-	}
150
-
151
-	/**
152
-	 * Retrieves taxes data.
153
-	 *
154
-	 * @since 1.0.19
155
-	 */
156
-	public function taxes_reports_data() {
157
-		global $wpdb;
158
-
159
-		$table =  $wpdb->prefix . 'getpaid_invoices';
160
-		$year  = isset( $_GET['year'] ) ? absint( $_GET['year'] ) : date( 'Y' );
161
-		$data  = $wpdb->get_results(
162
-			"SELECT
24
+    /**
25
+     * @var int Number of items per page
26
+     * @since 1.0.19
27
+     */
28
+    public $per_page = 300;
29
+
30
+
31
+    /**
32
+     * Get things started
33
+     *
34
+     * @since 1.0.19
35
+     * @see WP_List_Table::__construct()
36
+     */
37
+    public function __construct() {
38
+
39
+        // Set parent defaults
40
+        parent::__construct( array(
41
+            'singular' => 'id',
42
+            'plural'   => 'ids',
43
+            'ajax'     => false,
44
+        ) );
45
+
46
+    }
47
+
48
+    /**
49
+     * Gets the name of the primary column.
50
+     *
51
+     * @since 1.0.19
52
+     * @access protected
53
+     *
54
+     * @return string Name of the primary column.
55
+     */
56
+    protected function get_primary_column_name() {
57
+        return 'month';
58
+    }
59
+
60
+    /**
61
+     * This function renders most of the columns in the list table.
62
+     *
63
+     * @since 1.0.19
64
+     *
65
+     * @param array $item Contains all the data of the gateways
66
+     * @param string $column_name The name of the column
67
+     *
68
+     * @return string Column Name
69
+     */
70
+    public function column_default( $item, $column_name ) {
71
+        return wp_kses_post( $item[ $column_name ] );
72
+    }
73
+
74
+    /**
75
+     * Retrieve the table columns
76
+     *
77
+     * @since 1.0.19
78
+     * @return array $columns Array of all the list table columns
79
+     */
80
+    public function get_columns() {
81
+
82
+        return array(
83
+            'month'    => __( 'Month', 'invoicing' ),
84
+            'tax'      => __( 'Total Taxes', 'invoicing' ),
85
+        );
86
+
87
+    }
88
+
89
+    /**
90
+     * Retrieve the current page number
91
+     *
92
+     * @since 1.0.19
93
+     * @return int Current page number
94
+     */
95
+    public function get_paged() {
96
+        return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
97
+    }
98
+
99
+    /**
100
+     * Outputs the reporting views
101
+     *
102
+     * @since 1.0.19
103
+     * @return void
104
+     */
105
+    public function bulk_actions( $which = '' ) {
106
+        return array();
107
+    }
108
+
109
+    /**
110
+     * Build all the reports data
111
+     *
112
+     * @since 1.0.19
113
+     * @return array $reports_data All the data for taxes reports
114
+     */
115
+    public function reports_data() {
116
+
117
+        $reports_data = $this->taxes_reports_data();
118
+        $months       = array(
119
+            '1' => __( 'January', 'invoicing' ),
120
+            '2' => __( 'February', 'invoicing' ),
121
+            '3' => __( 'March', 'invoicing' ),
122
+            '4' => __( 'April', 'invoicing' ),
123
+            '5' => __( 'May', 'invoicing' ),
124
+            '6' => __( 'June', 'invoicing' ),
125
+            '7' => __( 'July', 'invoicing' ),
126
+            '8' => __( 'August', 'invoicing' ),
127
+            '9' => __( 'September', 'invoicing' ),
128
+            '10' => __( 'October', 'invoicing' ),
129
+            '11' => __( 'November', 'invoicing' ),
130
+            '12' => __( 'December', 'invoicing' ),
131
+        );
132
+
133
+        $prepared = array();
134
+        foreach ( $months as $month => $label ) {
135
+
136
+            $tax = wpinv_price( 0 );
137
+            if ( ! empty( $reports_data[ $month ] ) ) {
138
+                $tax = wpinv_price( wpinv_format_amount( $reports_data[ $month ] ) );
139
+            }
140
+
141
+            $prepared[] = array(
142
+                'month'    => $label,
143
+                'tax'      => $tax,
144
+            );
145
+
146
+        }
147
+
148
+        return $prepared;
149
+    }
150
+
151
+    /**
152
+     * Retrieves taxes data.
153
+     *
154
+     * @since 1.0.19
155
+     */
156
+    public function taxes_reports_data() {
157
+        global $wpdb;
158
+
159
+        $table =  $wpdb->prefix . 'getpaid_invoices';
160
+        $year  = isset( $_GET['year'] ) ? absint( $_GET['year'] ) : date( 'Y' );
161
+        $data  = $wpdb->get_results(
162
+            "SELECT
163 163
 				MONTH(meta.completed_date) as _month,
164 164
 				SUM(meta.tax) as tax
165 165
 			FROM $wpdb->posts as posts
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 				AND ( YEAR(meta.completed_date) = '$year' )
172 172
 			GROUP BY MONTH(meta.completed_date)");
173 173
 
174
-		return wp_list_pluck( $data, 'tax', '_month' );
175
-
176
-	}
177
-
178
-	/**
179
-	 * Setup the final data for the table
180
-	 *
181
-	 * @since 1.0.19
182
-	 * @return void
183
-	 */
184
-	public function prepare_items() {
185
-		$columns               = $this->get_columns();
186
-		$hidden                = array(); // No hidden columns
187
-		$sortable              = $this->get_sortable_columns();
188
-		$this->_column_headers = array( $columns, $hidden, $sortable );
189
-		$this->items           = $this->reports_data();
190
-	}
174
+        return wp_list_pluck( $data, 'tax', '_month' );
175
+
176
+    }
177
+
178
+    /**
179
+     * Setup the final data for the table
180
+     *
181
+     * @since 1.0.19
182
+     * @return void
183
+     */
184
+    public function prepare_items() {
185
+        $columns               = $this->get_columns();
186
+        $hidden                = array(); // No hidden columns
187
+        $sortable              = $this->get_sortable_columns();
188
+        $this->_column_headers = array( $columns, $hidden, $sortable );
189
+        $this->items           = $this->reports_data();
190
+    }
191 191
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Exit if accessed directly
8
-if ( ! defined( 'ABSPATH' ) ) exit;
8
+if (!defined('ABSPATH')) exit;
9 9
 
10 10
 // Load WP_List_Table if not loaded
11
-if ( ! class_exists( 'WP_List_Table' ) ) {
11
+if (!class_exists('WP_List_Table')) {
12 12
 	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	public function __construct() {
38 38
 
39 39
 		// Set parent defaults
40
-		parent::__construct( array(
40
+		parent::__construct(array(
41 41
 			'singular' => 'id',
42 42
 			'plural'   => 'ids',
43 43
 			'ajax'     => false,
44
-		) );
44
+		));
45 45
 
46 46
 	}
47 47
 
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return string Column Name
69 69
 	 */
70
-	public function column_default( $item, $column_name ) {
71
-		return wp_kses_post( $item[ $column_name ] );
70
+	public function column_default($item, $column_name) {
71
+		return wp_kses_post($item[$column_name]);
72 72
 	}
73 73
 
74 74
 	/**
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	public function get_columns() {
81 81
 
82 82
 		return array(
83
-			'month'    => __( 'Month', 'invoicing' ),
84
-			'tax'      => __( 'Total Taxes', 'invoicing' ),
83
+			'month'    => __('Month', 'invoicing'),
84
+			'tax'      => __('Total Taxes', 'invoicing'),
85 85
 		);
86 86
 
87 87
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return int Current page number
94 94
 	 */
95 95
 	public function get_paged() {
96
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
96
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
97 97
 	}
98 98
 
99 99
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @since 1.0.19
103 103
 	 * @return void
104 104
 	 */
105
-	public function bulk_actions( $which = '' ) {
105
+	public function bulk_actions($which = '') {
106 106
 		return array();
107 107
 	}
108 108
 
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$reports_data = $this->taxes_reports_data();
118 118
 		$months       = array(
119
-			'1' => __( 'January', 'invoicing' ),
120
-			'2' => __( 'February', 'invoicing' ),
121
-			'3' => __( 'March', 'invoicing' ),
122
-			'4' => __( 'April', 'invoicing' ),
123
-			'5' => __( 'May', 'invoicing' ),
124
-			'6' => __( 'June', 'invoicing' ),
125
-			'7' => __( 'July', 'invoicing' ),
126
-			'8' => __( 'August', 'invoicing' ),
127
-			'9' => __( 'September', 'invoicing' ),
128
-			'10' => __( 'October', 'invoicing' ),
129
-			'11' => __( 'November', 'invoicing' ),
130
-			'12' => __( 'December', 'invoicing' ),
119
+			'1' => __('January', 'invoicing'),
120
+			'2' => __('February', 'invoicing'),
121
+			'3' => __('March', 'invoicing'),
122
+			'4' => __('April', 'invoicing'),
123
+			'5' => __('May', 'invoicing'),
124
+			'6' => __('June', 'invoicing'),
125
+			'7' => __('July', 'invoicing'),
126
+			'8' => __('August', 'invoicing'),
127
+			'9' => __('September', 'invoicing'),
128
+			'10' => __('October', 'invoicing'),
129
+			'11' => __('November', 'invoicing'),
130
+			'12' => __('December', 'invoicing'),
131 131
 		);
132 132
 
133 133
 		$prepared = array();
134
-		foreach ( $months as $month => $label ) {
134
+		foreach ($months as $month => $label) {
135 135
 
136
-			$tax = wpinv_price( 0 );
137
-			if ( ! empty( $reports_data[ $month ] ) ) {
138
-				$tax = wpinv_price( wpinv_format_amount( $reports_data[ $month ] ) );
136
+			$tax = wpinv_price(0);
137
+			if (!empty($reports_data[$month])) {
138
+				$tax = wpinv_price(wpinv_format_amount($reports_data[$month]));
139 139
 			}
140 140
 
141 141
 			$prepared[] = array(
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	public function taxes_reports_data() {
157 157
 		global $wpdb;
158 158
 
159
-		$table =  $wpdb->prefix . 'getpaid_invoices';
160
-		$year  = isset( $_GET['year'] ) ? absint( $_GET['year'] ) : date( 'Y' );
159
+		$table = $wpdb->prefix . 'getpaid_invoices';
160
+		$year  = isset($_GET['year']) ? absint($_GET['year']) : date('Y');
161 161
 		$data  = $wpdb->get_results(
162 162
 			"SELECT
163 163
 				MONTH(meta.completed_date) as _month,
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 				AND ( YEAR(meta.completed_date) = '$year' )
172 172
 			GROUP BY MONTH(meta.completed_date)");
173 173
 
174
-		return wp_list_pluck( $data, 'tax', '_month' );
174
+		return wp_list_pluck($data, 'tax', '_month');
175 175
 
176 176
 	}
177 177
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		$columns               = $this->get_columns();
186 186
 		$hidden                = array(); // No hidden columns
187 187
 		$sortable              = $this->get_sortable_columns();
188
-		$this->_column_headers = array( $columns, $hidden, $sortable );
188
+		$this->_column_headers = array($columns, $hidden, $sortable);
189 189
 		$this->items           = $this->reports_data();
190 190
 	}
191 191
 }
Please login to merge, or discard this patch.
includes/class-wpinv-cli.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
10
+if (!defined('WPINC')) {
11 11
     exit;
12 12
 }
13 13
 
@@ -24,40 +24,40 @@  discard block
 block discarded – undo
24 24
      *  @param Array $assoc_args Key value arguments stored in associated array format.
25 25
      *  @since 1.0.13
26 26
      */
27
-    public function insert_invoice( $args, $assoc_args ) {
27
+    public function insert_invoice($args, $assoc_args) {
28 28
 
29 29
         // Fetch invoice data from the args
30
-        $invoice_data = wp_unslash( $assoc_args );
30
+        $invoice_data = wp_unslash($assoc_args);
31 31
 
32 32
         // Abort if no invoice data is provided
33
-        if( empty( $invoice_data ) ) {
34
-            return WP_CLI::error( __( 'Invoice data not provided', 'invoicing' ) );
33
+        if (empty($invoice_data)) {
34
+            return WP_CLI::error(__('Invoice data not provided', 'invoicing'));
35 35
         }
36 36
 
37 37
         //Cart details
38
-        if( !empty( $invoice_data['cart_details'] ) ) {
39
-            $invoice_data['cart_details'] = json_decode( $invoice_data['cart_details'], true );
38
+        if (!empty($invoice_data['cart_details'])) {
39
+            $invoice_data['cart_details'] = json_decode($invoice_data['cart_details'], true);
40 40
         }
41 41
 
42 42
         //User details
43
-        if( !empty( $invoice_data['user_info'] ) ) {
44
-            $invoice_data['user_info'] = json_decode( $invoice_data['user_info'], true );
43
+        if (!empty($invoice_data['user_info'])) {
44
+            $invoice_data['user_info'] = json_decode($invoice_data['user_info'], true);
45 45
         }
46 46
 
47 47
         //Payment info
48
-        if( !empty( $invoice_data['payment_details'] ) ) {
49
-            $invoice_data['payment_details'] = json_decode( $invoice_data['payment_details'], true );
48
+        if (!empty($invoice_data['payment_details'])) {
49
+            $invoice_data['payment_details'] = json_decode($invoice_data['payment_details'], true);
50 50
         }
51 51
 
52 52
         // Try creating the invoice
53
-        $invoice = wpinv_insert_invoice( $invoice_data, true );
53
+        $invoice = wpinv_insert_invoice($invoice_data, true);
54 54
 
55
-        if ( is_wp_error( $invoice ) ) {
56
-            return WP_CLI::error( $invoice->get_error_message() );
55
+        if (is_wp_error($invoice)) {
56
+            return WP_CLI::error($invoice->get_error_message());
57 57
         }
58 58
 
59
-        $message = sprintf( __( 'Invoice %s created', 'invoicing' ), $invoice->get_id() );
60
-        WP_CLI::success( $message );
59
+        $message = sprintf(__('Invoice %s created', 'invoicing'), $invoice->get_id());
60
+        WP_CLI::success($message);
61 61
     }
62 62
     
63 63
     
Please login to merge, or discard this patch.
includes/wpinv-gateway-functions.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Contains gateway functions.
4 4
  *
5 5
  */
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * Returns an array of payment gateways.
@@ -11,82 +11,82 @@  discard block
 block discarded – undo
11 11
  * @return array
12 12
  */
13 13
 function wpinv_get_payment_gateways() {
14
-    return apply_filters( 'wpinv_payment_gateways', array() );
14
+    return apply_filters('wpinv_payment_gateways', array());
15 15
 }
16 16
 
17
-function wpinv_payment_gateway_titles( $all_gateways ) {
17
+function wpinv_payment_gateway_titles($all_gateways) {
18 18
     global $wpinv_options;
19 19
 
20 20
     $gateways = array();
21
-    foreach ( $all_gateways as $key => $gateway ) {
22
-        if ( !empty( $wpinv_options[$key . '_title'] ) ) {
23
-            $all_gateways[$key]['checkout_label'] = __( $wpinv_options[$key . '_title'], 'invoicing' );
21
+    foreach ($all_gateways as $key => $gateway) {
22
+        if (!empty($wpinv_options[$key . '_title'])) {
23
+            $all_gateways[$key]['checkout_label'] = __($wpinv_options[$key . '_title'], 'invoicing');
24 24
         }
25 25
 
26
-        $gateways[$key] = isset( $wpinv_options[$key . '_ordering'] ) ? $wpinv_options[$key . '_ordering'] : ( isset( $gateway['ordering'] ) ? $gateway['ordering'] : '' );
26
+        $gateways[$key] = isset($wpinv_options[$key . '_ordering']) ? $wpinv_options[$key . '_ordering'] : (isset($gateway['ordering']) ? $gateway['ordering'] : '');
27 27
     }
28 28
 
29
-    asort( $gateways );
29
+    asort($gateways);
30 30
 
31
-    foreach ( $gateways as $gateway => $key ) {
31
+    foreach ($gateways as $gateway => $key) {
32 32
         $gateways[$gateway] = $all_gateways[$gateway];
33 33
     }
34 34
 
35 35
     return $gateways;
36 36
 }
37
-add_filter( 'wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1 );
37
+add_filter('wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1);
38 38
 
39
-function wpinv_get_enabled_payment_gateways( $sort = false ) {
39
+function wpinv_get_enabled_payment_gateways($sort = false) {
40 40
     $gateways = wpinv_get_payment_gateways();
41
-    $enabled  = wpinv_get_option( 'gateways', false );
41
+    $enabled  = wpinv_get_option('gateways', false);
42 42
 
43 43
     $gateway_list = array();
44 44
 
45
-    foreach ( $gateways as $key => $gateway ) {
46
-        if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
47
-            $gateway_list[ $key ] = $gateway;
45
+    foreach ($gateways as $key => $gateway) {
46
+        if (isset($enabled[$key]) && $enabled[$key] == 1) {
47
+            $gateway_list[$key] = $gateway;
48 48
         }
49 49
     }
50 50
 
51
-    if ( true === $sort ) {
52
-        uasort( $gateway_list, 'wpinv_sort_gateway_order' );
51
+    if (true === $sort) {
52
+        uasort($gateway_list, 'wpinv_sort_gateway_order');
53 53
         
54 54
         // Reorder our gateways so the default is first
55 55
         $default_gateway_id = wpinv_get_default_gateway();
56 56
 
57
-        if ( wpinv_is_gateway_active( $default_gateway_id ) ) {
58
-            $default_gateway    = array( $default_gateway_id => $gateway_list[ $default_gateway_id ] );
59
-            unset( $gateway_list[ $default_gateway_id ] );
57
+        if (wpinv_is_gateway_active($default_gateway_id)) {
58
+            $default_gateway = array($default_gateway_id => $gateway_list[$default_gateway_id]);
59
+            unset($gateway_list[$default_gateway_id]);
60 60
 
61
-            $gateway_list = array_merge( $default_gateway, $gateway_list );
61
+            $gateway_list = array_merge($default_gateway, $gateway_list);
62 62
         }
63 63
     }
64 64
 
65
-    return apply_filters( 'wpinv_enabled_payment_gateways', $gateway_list );
65
+    return apply_filters('wpinv_enabled_payment_gateways', $gateway_list);
66 66
 }
67 67
 
68
-function wpinv_sort_gateway_order( $a, $b ) {
68
+function wpinv_sort_gateway_order($a, $b) {
69 69
     return $a['ordering'] - $b['ordering'];
70 70
 }
71 71
 
72
-function wpinv_is_gateway_active( $gateway ) {
72
+function wpinv_is_gateway_active($gateway) {
73 73
     $gateways = wpinv_get_enabled_payment_gateways();
74 74
 
75
-    $ret = is_array($gateways) && $gateway ?  array_key_exists( $gateway, $gateways ) : false;
75
+    $ret = is_array($gateways) && $gateway ?  array_key_exists($gateway, $gateways) : false;
76 76
 
77
-    return apply_filters( 'wpinv_is_gateway_active', $ret, $gateway, $gateways );
77
+    return apply_filters('wpinv_is_gateway_active', $ret, $gateway, $gateways);
78 78
 }
79 79
 
80 80
 function wpinv_get_default_gateway() {
81
-    $default = wpinv_get_option( 'default_gateway', 'paypal' );
81
+    $default = wpinv_get_option('default_gateway', 'paypal');
82 82
 
83
-    if ( !wpinv_is_gateway_active( $default ) ) {
83
+    if (!wpinv_is_gateway_active($default)) {
84 84
         $gateways = wpinv_get_enabled_payment_gateways();
85
-        $gateways = array_keys( $gateways );
86
-        $default  = reset( $gateways );
85
+        $gateways = array_keys($gateways);
86
+        $default  = reset($gateways);
87 87
     }
88 88
 
89
-    return apply_filters( 'wpinv_default_gateway', $default );
89
+    return apply_filters('wpinv_default_gateway', $default);
90 90
 }
91 91
 
92 92
 /**
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
  * @param string $gateway The gateway to key.
96 96
  * @return string
97 97
  */
98
-function wpinv_get_gateway_admin_label( $gateway ) {
98
+function wpinv_get_gateway_admin_label($gateway) {
99 99
 
100
-    if ( empty( $gateway ) || 'none' == $gateway ) {
101
-        return esc_html__( 'No Gateway', 'invoicing' );
100
+    if (empty($gateway) || 'none' == $gateway) {
101
+        return esc_html__('No Gateway', 'invoicing');
102 102
     }
103 103
 
104 104
     $gateways = wpinv_get_payment_gateways();
105
-    $label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
106
-    $gateway  = apply_filters( 'wpinv_gateway_admin_label', $label, $gateway );
105
+    $label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
106
+    $gateway  = apply_filters('wpinv_gateway_admin_label', $label, $gateway);
107 107
 
108
-    return wpinv_clean( $gateway );
108
+    return wpinv_clean($gateway);
109 109
 }
110 110
 
111 111
 /**
@@ -113,49 +113,49 @@  discard block
 block discarded – undo
113 113
  * 
114 114
  * @param string $gateway
115 115
  */
116
-function wpinv_get_gateway_description( $gateway ) {
116
+function wpinv_get_gateway_description($gateway) {
117 117
     global $wpinv_options;
118 118
 
119
-    $description = ! empty( $wpinv_options[$gateway . '_desc'] ) ? $wpinv_options[$gateway . '_desc'] : '';
119
+    $description = !empty($wpinv_options[$gateway . '_desc']) ? $wpinv_options[$gateway . '_desc'] : '';
120 120
 
121
-    return apply_filters( 'wpinv_gateway_description', $description, $gateway );
121
+    return apply_filters('wpinv_gateway_description', $description, $gateway);
122 122
 }
123 123
 
124
-function wpinv_get_gateway_button_label( $gateway ) {
125
-    return apply_filters( 'wpinv_gateway_' . $gateway . '_button_label', '' );
124
+function wpinv_get_gateway_button_label($gateway) {
125
+    return apply_filters('wpinv_gateway_' . $gateway . '_button_label', '');
126 126
 }
127 127
 
128
-function wpinv_get_gateway_checkout_label( $gateway ) {
128
+function wpinv_get_gateway_checkout_label($gateway) {
129 129
     $gateways = wpinv_get_payment_gateways();
130
-    $label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
130
+    $label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
131 131
 
132
-    if ( $gateway == 'none' ) {
133
-        $label = __( 'None', 'invoicing' );
132
+    if ($gateway == 'none') {
133
+        $label = __('None', 'invoicing');
134 134
     }
135 135
 
136
-    return apply_filters( 'wpinv_gateway_checkout_label', ucfirst( $label ), $gateway );
136
+    return apply_filters('wpinv_gateway_checkout_label', ucfirst($label), $gateway);
137 137
 }
138 138
 
139
-function wpinv_settings_sections_gateways( $settings ) {
139
+function wpinv_settings_sections_gateways($settings) {
140 140
     $gateways = wpinv_get_payment_gateways();
141 141
     
142 142
     if (!empty($gateways)) {
143
-        foreach  ($gateways as $key => $gateway) {
143
+        foreach ($gateways as $key => $gateway) {
144 144
             $settings[$key] = $gateway['admin_label'];
145 145
         }
146 146
     }
147 147
     
148 148
     return $settings;    
149 149
 }
150
-add_filter( 'wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1 );
150
+add_filter('wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1);
151 151
 
152 152
 /**
153 153
  * Adds GateWay settings.
154 154
  */
155
-function wpinv_settings_gateways( $settings ) {
155
+function wpinv_settings_gateways($settings) {
156 156
 
157 157
     // Loop through each gateway.
158
-    foreach  ( wpinv_get_payment_gateways() as $key => $gateway ) {
158
+    foreach (wpinv_get_payment_gateways() as $key => $gateway) {
159 159
 
160 160
         $gateway_settings = array(
161 161
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             "{$key}_header" => array(
164 164
 
165 165
                 'id'     => "{$key}_gateway_header",
166
-                'name'   => '<h3>' . wp_sprintf( __( '%s Settings', 'invoicing' ), $gateway['admin_label'] ) . '</h3>',
166
+                'name'   => '<h3>' . wp_sprintf(__('%s Settings', 'invoicing'), $gateway['admin_label']) . '</h3>',
167 167
                 'custom' => $key,
168 168
                 'type'   => 'gateway_header',
169 169
 
@@ -172,56 +172,56 @@  discard block
 block discarded – undo
172 172
             // Activate/Deactivate a gateway.
173 173
             "{$key}_active" => array(
174 174
                 'id'   => $key . '_active',
175
-                'name' => __( 'Activate', 'invoicing' ),
176
-                'desc' => wp_sprintf( __( 'Enable %s', 'invoicing' ), $gateway['admin_label'] ),
175
+                'name' => __('Activate', 'invoicing'),
176
+                'desc' => wp_sprintf(__('Enable %s', 'invoicing'), $gateway['admin_label']),
177 177
                 'type' => 'checkbox',
178 178
             ),
179 179
 
180 180
             // Activate/Deactivate sandbox.
181 181
             "{$key}_sandbox" => array(
182 182
                 'id'   => $key . '_sandbox',
183
-                'name' => __( 'Sandbox', 'invoicing' ),
184
-                'desc' => __( 'Enable sandbox to test payments', 'invoicing' ),
183
+                'name' => __('Sandbox', 'invoicing'),
184
+                'desc' => __('Enable sandbox to test payments', 'invoicing'),
185 185
                 'type' => 'checkbox',
186 186
             ),
187 187
 
188 188
             // Checkout title.
189 189
             "{$key}_title" => array(
190 190
                 'id'   => $key . '_title',
191
-                'name' => __( 'Checkout Title', 'invoicing' ),
192
-                'std'  => isset( $gateway['checkout_label'] ) ? $gateway['checkout_label'] : '',
191
+                'name' => __('Checkout Title', 'invoicing'),
192
+                'std'  => isset($gateway['checkout_label']) ? $gateway['checkout_label'] : '',
193 193
                 'type' => 'text',
194 194
             ),
195 195
 
196 196
             // Checkout description.
197 197
             "{$key}_desc" => array(
198 198
                 'id'   => $key . '_desc',
199
-                'name' => __( 'Checkout Description', 'invoicing' ),
200
-                'std'  => apply_filters( "getpaid_default_{$key}_checkout_description", '' ),
199
+                'name' => __('Checkout Description', 'invoicing'),
200
+                'std'  => apply_filters("getpaid_default_{$key}_checkout_description", ''),
201 201
                 'type' => 'text',
202 202
             ),
203 203
 
204 204
             // Checkout order.
205 205
             "{$key}_ordering" => array(
206 206
                 'id'   => $key . '_ordering',
207
-                'name' => __( 'Priority', 'invoicing' ),
208
-                'std'  => apply_filters( "getpaid_default_{$key}_checkout_description", '' ),
207
+                'name' => __('Priority', 'invoicing'),
208
+                'std'  => apply_filters("getpaid_default_{$key}_checkout_description", ''),
209 209
                 'type' => 'number',
210 210
                 'step' => '1',
211 211
                 'min'  => '-100000',
212 212
                 'max'  => '100000',
213
-                'std'  => isset( $gateway['ordering'] ) ? $gateway['ordering'] : '10',
213
+                'std'  => isset($gateway['ordering']) ? $gateway['ordering'] : '10',
214 214
             ),
215 215
 
216 216
         );
217 217
 
218 218
         // Maybe remove the sandbox.
219
-        if ( ! apply_filters( "wpinv_{$key}_supports_sandbox", false ) ) {
220
-            unset( $gateway_settings["{$key}_sandbox"] );
219
+        if (!apply_filters("wpinv_{$key}_supports_sandbox", false)) {
220
+            unset($gateway_settings["{$key}_sandbox"]);
221 221
         }
222 222
   
223
-        $gateway_settings = apply_filters( 'wpinv_gateway_settings', $gateway_settings, $key, $gateway );
224
-        $gateway_settings = apply_filters( 'wpinv_gateway_settings_' . $key, $gateway_settings, $gateway );
223
+        $gateway_settings = apply_filters('wpinv_gateway_settings', $gateway_settings, $key, $gateway);
224
+        $gateway_settings = apply_filters('wpinv_gateway_settings_' . $key, $gateway_settings, $gateway);
225 225
         
226 226
         $settings[$key] = $gateway_settings;
227 227
     }
@@ -229,57 +229,57 @@  discard block
 block discarded – undo
229 229
     return $settings;
230 230
 
231 231
 }
232
-add_filter( 'wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1 );
232
+add_filter('wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1);
233 233
 
234
-function wpinv_gateway_header_callback( $args ) {
235
-    echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr( $args['custom'] ) . '" />';
234
+function wpinv_gateway_header_callback($args) {
235
+    echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr($args['custom']) . '" />';
236 236
 }
237 237
 
238
-function wpinv_get_gateway_supports( $gateway ) {
238
+function wpinv_get_gateway_supports($gateway) {
239 239
     $gateways = wpinv_get_enabled_payment_gateways();
240
-    $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
241
-    return apply_filters( 'wpinv_gateway_supports', $supports, $gateway );
240
+    $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
241
+    return apply_filters('wpinv_gateway_supports', $supports, $gateway);
242 242
 }
243 243
 
244
-function wpinv_get_chosen_gateway( $invoice_id = 0 ) {
245
-	$gateways = array_keys( wpinv_get_enabled_payment_gateways() );
244
+function wpinv_get_chosen_gateway($invoice_id = 0) {
245
+	$gateways = array_keys(wpinv_get_enabled_payment_gateways());
246 246
 
247 247
     $chosen = false;
248
-    if ( $invoice_id > 0 && $invoice = wpinv_get_invoice( $invoice_id ) ) {
248
+    if ($invoice_id > 0 && $invoice = wpinv_get_invoice($invoice_id)) {
249 249
         $chosen = $invoice->get_gateway();
250 250
     }
251 251
 
252
-	$chosen   = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen;
252
+	$chosen = isset($_REQUEST['payment-mode']) ? sanitize_text_field($_REQUEST['payment-mode']) : $chosen;
253 253
 
254
-	if ( false !== $chosen ) {
255
-		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen );
254
+	if (false !== $chosen) {
255
+		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen);
256 256
 	}
257 257
 
258
-	if ( ! empty ( $chosen ) ) {
259
-		$enabled_gateway = urldecode( $chosen );
260
-	} else if (  !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) {
258
+	if (!empty ($chosen)) {
259
+		$enabled_gateway = urldecode($chosen);
260
+	} else if (!empty($invoice) && (float) $invoice->get_subtotal() <= 0) {
261 261
 		$enabled_gateway = 'manual';
262 262
 	} else {
263 263
 		$enabled_gateway = wpinv_get_default_gateway();
264 264
 	}
265 265
     
266
-    if ( !wpinv_is_gateway_active( $enabled_gateway ) && !empty( $gateways ) ) {
267
-        if(wpinv_is_gateway_active( wpinv_get_default_gateway()) ){
266
+    if (!wpinv_is_gateway_active($enabled_gateway) && !empty($gateways)) {
267
+        if (wpinv_is_gateway_active(wpinv_get_default_gateway())) {
268 268
             $enabled_gateway = wpinv_get_default_gateway();
269
-        }else{
269
+        } else {
270 270
             $enabled_gateway = $gateways[0];
271 271
         }
272 272
 
273 273
     }
274 274
 
275
-	return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway );
275
+	return apply_filters('wpinv_chosen_gateway', $enabled_gateway);
276 276
 }
277 277
 
278
-function wpinv_record_gateway_error( $title = '', $message = '' ) {
279
-    return wpinv_error_log( $message, $title );
278
+function wpinv_record_gateway_error($title = '', $message = '') {
279
+    return wpinv_error_log($message, $title);
280 280
 }
281 281
 
282
-function wpinv_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
282
+function wpinv_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
283 283
 	$ret  = 0;
284 284
 	$args = array(
285 285
 		'meta_key'    => '_wpinv_gateway',
@@ -290,48 +290,48 @@  discard block
 block discarded – undo
290 290
 		'fields'      => 'ids'
291 291
 	);
292 292
 
293
-	$payments = new WP_Query( $args );
293
+	$payments = new WP_Query($args);
294 294
 
295
-	if( $payments )
295
+	if ($payments)
296 296
 		$ret = $payments->post_count;
297 297
 	return $ret;
298 298
 }
299 299
 
300
-function wpinv_settings_update_gateways( $input ) {
300
+function wpinv_settings_update_gateways($input) {
301 301
     global $wpinv_options;
302 302
     
303
-    if ( !empty( $input['save_gateway'] ) ) {
304
-        $gateways = wpinv_get_option( 'gateways', false );
303
+    if (!empty($input['save_gateway'])) {
304
+        $gateways = wpinv_get_option('gateways', false);
305 305
         $gateways = !empty($gateways) ? $gateways : array();
306 306
         $gateway = $input['save_gateway'];
307 307
         
308
-        if ( !empty( $input[$gateway . '_active'] ) ) {
308
+        if (!empty($input[$gateway . '_active'])) {
309 309
             $gateways[$gateway] = 1;
310 310
         } else {
311
-            if ( isset( $gateways[$gateway] ) ) {
312
-                unset( $gateways[$gateway] );
311
+            if (isset($gateways[$gateway])) {
312
+                unset($gateways[$gateway]);
313 313
             }
314 314
         }
315 315
         
316 316
         $input['gateways'] = $gateways;
317 317
     }
318 318
     
319
-    if ( !empty( $input['default_gateway'] ) ) {
319
+    if (!empty($input['default_gateway'])) {
320 320
         $gateways = wpinv_get_payment_gateways();
321 321
         
322
-        foreach ( $gateways as $key => $gateway ) {
323
-            $active   = 0;
324
-            if ( !empty( $input['gateways'] ) && !empty( $input['gateways'][$key] ) ) {
322
+        foreach ($gateways as $key => $gateway) {
323
+            $active = 0;
324
+            if (!empty($input['gateways']) && !empty($input['gateways'][$key])) {
325 325
                 $active = 1;
326 326
             }
327 327
             
328 328
             $input[$key . '_active'] = $active;
329 329
             
330
-            if ( empty( $wpinv_options[$key . '_title'] ) ) {
330
+            if (empty($wpinv_options[$key . '_title'])) {
331 331
                 $input[$key . '_title'] = $gateway['checkout_label'];
332 332
             }
333 333
             
334
-            if ( !isset( $wpinv_options[$key . '_ordering'] ) && isset( $gateway['ordering'] ) ) {
334
+            if (!isset($wpinv_options[$key . '_ordering']) && isset($gateway['ordering'])) {
335 335
                 $input[$key . '_ordering'] = $gateway['ordering'];
336 336
             }
337 337
         }
@@ -339,27 +339,27 @@  discard block
 block discarded – undo
339 339
     
340 340
     return $input;
341 341
 }
342
-add_filter( 'wpinv_settings_tab_gateways_sanitize', 'wpinv_settings_update_gateways', 10, 1 );
342
+add_filter('wpinv_settings_tab_gateways_sanitize', 'wpinv_settings_update_gateways', 10, 1);
343 343
 
344 344
 // PayPal Standard settings
345
-function wpinv_gateway_settings_paypal( $setting ) {    
346
-    $setting['paypal_active']['desc'] = $setting['paypal_active']['desc'] . ' ' . __( '( Supported Currencies: AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, NOK, NZD, PHP, PLN, GBP, SGD, SEK, CHF, TWD, THB, USD )', 'invoicing' );
347
-    $setting['paypal_desc']['std'] = __( 'Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing' );
345
+function wpinv_gateway_settings_paypal($setting) {    
346
+    $setting['paypal_active']['desc'] = $setting['paypal_active']['desc'] . ' ' . __('( Supported Currencies: AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, NOK, NZD, PHP, PLN, GBP, SGD, SEK, CHF, TWD, THB, USD )', 'invoicing');
347
+    $setting['paypal_desc']['std'] = __('Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing');
348 348
     
349 349
     $setting['paypal_sandbox'] = array(
350 350
             'type' => 'checkbox',
351 351
             'id'   => 'paypal_sandbox',
352
-            'name' => __( 'PayPal Sandbox', 'invoicing' ),
353
-            'desc' => __( 'PayPal sandbox can be used to test payments.', 'invoicing' ),
352
+            'name' => __('PayPal Sandbox', 'invoicing'),
353
+            'desc' => __('PayPal sandbox can be used to test payments.', 'invoicing'),
354 354
             'std'  => 1
355 355
         );
356 356
         
357 357
     $setting['paypal_email'] = array(
358 358
             'type' => 'text',
359 359
             'id'   => 'paypal_email',
360
-            'name' => __( 'PayPal Email', 'invoicing' ),
361
-            'desc' => __( 'Please enter your PayPal account\'s email address. Ex: [email protected]', 'invoicing' ),
362
-            'std' => __( '[email protected]', 'invoicing' ),
360
+            'name' => __('PayPal Email', 'invoicing'),
361
+            'desc' => __('Please enter your PayPal account\'s email address. Ex: [email protected]', 'invoicing'),
362
+            'std' => __('[email protected]', 'invoicing'),
363 363
         );
364 364
     /*
365 365
     $setting['paypal_ipn_url'] = array(
@@ -373,18 +373,18 @@  discard block
 block discarded – undo
373 373
         
374 374
     return $setting;
375 375
 }
376
-add_filter( 'wpinv_gateway_settings_paypal', 'wpinv_gateway_settings_paypal', 10, 1 );
376
+add_filter('wpinv_gateway_settings_paypal', 'wpinv_gateway_settings_paypal', 10, 1);
377 377
 
378 378
 /**
379 379
  * Displays the ipn url field.
380 380
  */
381
-function wpinv_ipn_url_callback( $args ) {
382
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
381
+function wpinv_ipn_url_callback($args) {
382
+    $sanitize_id = wpinv_sanitize_key($args['id']);
383 383
     
384 384
     $attrs = $args['readonly'] ? ' readonly' : '';
385 385
 
386
-    $html = '<input class="regular-text" type="text" ' . $attrs . ' value="' . esc_attr( $args['std'] ) . '" name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . ']" onClick="this.select()">';
387
-    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']">'  . $args['desc'] . '</label>';
386
+    $html = '<input class="regular-text" type="text" ' . $attrs . ' value="' . esc_attr($args['std']) . '" name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . ']" onClick="this.select()">';
387
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']">' . $args['desc'] . '</label>';
388 388
 
389 389
     echo $html;
390 390
 }
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
  * 
397 397
  * @return bool
398 398
  */
399
-function wpinv_is_test_mode( $gateway = '' ) {
400
-    $sandbox = empty( $gateway ) ? false : wpinv_get_option( "{$gateway}_sandbox", false );
401
-    return apply_filters( 'wpinv_is_test_mode', $sandbox, $gateway );
399
+function wpinv_is_test_mode($gateway = '') {
400
+    $sandbox = empty($gateway) ? false : wpinv_get_option("{$gateway}_sandbox", false);
401
+    return apply_filters('wpinv_is_test_mode', $sandbox, $gateway);
402 402
 }
403 403
 
404 404
 /**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
  * 
410 410
  * @return string
411 411
  */
412
-function wpinv_get_ipn_url( $gateway = false, $args = array() ) {
412
+function wpinv_get_ipn_url($gateway = false, $args = array()) {
413 413
     $args = wp_parse_args(
414 414
         array(
415 415
             'wpi-listener' => 'IPN',
@@ -418,37 +418,37 @@  discard block
 block discarded – undo
418 418
         $args
419 419
     );
420 420
 
421
-    return apply_filters( 'wpinv_ipn_url', add_query_arg( $args,  home_url( 'index.php' ) ), $gateway, $args );
421
+    return apply_filters('wpinv_ipn_url', add_query_arg($args, home_url('index.php')), $gateway, $args);
422 422
 
423 423
 }
424 424
 
425 425
 /**
426 426
  * Retrieves request data with slashes removed slashes.
427 427
  */
428
-function wpinv_get_post_data( $method = 'request' ) {
428
+function wpinv_get_post_data($method = 'request') {
429 429
 
430
-    if ( $method == 'post' ) {
431
-        return wp_unslash( $_POST );
430
+    if ($method == 'post') {
431
+        return wp_unslash($_POST);
432 432
     }
433 433
 
434
-    if ( $method == 'get' ) {
435
-        return wp_unslash( $_GET );
434
+    if ($method == 'get') {
435
+        return wp_unslash($_GET);
436 436
     }
437 437
 
438
-    return wp_unslash( $_REQUEST );
438
+    return wp_unslash($_REQUEST);
439 439
   
440 440
 }
441 441
 
442 442
 /**
443 443
  * Checks if a given gateway supports subscription payments.
444 444
  */
445
-function wpinv_gateway_support_subscription( $gateway ) {
445
+function wpinv_gateway_support_subscription($gateway) {
446 446
     $supports = false;
447 447
 
448
-    if ( wpinv_is_gateway_active( $gateway ) ) {
449
-        $supports = apply_filters( 'wpinv_' . $gateway . '_support_subscription', $supports );
448
+    if (wpinv_is_gateway_active($gateway)) {
449
+        $supports = apply_filters('wpinv_' . $gateway . '_support_subscription', $supports);
450 450
 
451
-        $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $gateway );
451
+        $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $gateway);
452 452
     }
453 453
 
454 454
     return $supports;
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
  * @param array $gateways an array of gateways.
461 461
  * @param GetPaid_Payment_Form $form payment form.
462 462
  */
463
-function wpinv_payment_gateways_on_cart( $gateways, $form ) {
463
+function wpinv_payment_gateways_on_cart($gateways, $form) {
464 464
 
465
-    if ( $form->is_recurring() ) {
465
+    if ($form->is_recurring()) {
466 466
 
467
-        foreach ( array_keys( $gateways ) as $gateway ) {
467
+        foreach (array_keys($gateways) as $gateway) {
468 468
 
469
-            if ( ! wpinv_gateway_support_subscription( $gateway ) ) {
470
-                unset( $gateways[$gateway] );
469
+            if (!wpinv_gateway_support_subscription($gateway)) {
470
+                unset($gateways[$gateway]);
471 471
             }
472 472
 
473 473
         }
@@ -476,4 +476,4 @@  discard block
 block discarded – undo
476 476
 
477 477
     return $gateways;
478 478
 }
479
-add_filter( 'getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2 );
479
+add_filter('getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2);
Please login to merge, or discard this patch.