Passed
Pull Request — master (#281)
by Kiran
04:07
created
includes/gateways/authorizenet/anet_php_sdk/lib/AuthorizeNetDPM.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
             }
77 77
             else
78 78
             {
79
-              echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
79
+                echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
80 80
             }
81 81
         }
82 82
     }
Please login to merge, or discard this patch.
templates/wpinv-invoice-history.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 if ( !( $user_id = get_current_user_id() ) ) {
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		<tbody>
32 32
 			<?php foreach ( $user_invoices->invoices as $invoice ) {
33
-				?>
33
+                ?>
34 34
 				<tr class="wpinv-item wpinv-item-<?php echo $invoice_status = $invoice->get_status(); ?>">
35 35
 					<?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?>
36 36
 						<td class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>" data-title="<?php echo esc_attr( $column_name['title'] ); ?>">
@@ -53,31 +53,31 @@  discard block
 block discarded – undo
53 53
 
54 54
 							<?php elseif ( 'invoice-actions' === $column_id ) : ?>
55 55
 								<?php
56
-									$actions = array(
57
-										'pay'    => array(
58
-											'url'  => $invoice->get_checkout_payment_url(),
59
-											'name' => __( 'Pay Now', 'invoicing' ),
56
+                                    $actions = array(
57
+                                        'pay'    => array(
58
+                                            'url'  => $invoice->get_checkout_payment_url(),
59
+                                            'name' => __( 'Pay Now', 'invoicing' ),
60 60
                                             'class' => 'btn-success'
61
-										),
61
+                                        ),
62 62
                                         'print'   => array(
63
-											'url'  => $invoice->get_view_url(),
64
-											'name' => __( 'Print', 'invoicing' ),
63
+                                            'url'  => $invoice->get_view_url(),
64
+                                            'name' => __( 'Print', 'invoicing' ),
65 65
                                             'class' => 'btn-primary',
66 66
                                             'attrs' => 'target="_blank"'
67
-										)
68
-									);
67
+                                        )
68
+                                    );
69 69
 
70
-									if ( ! $invoice->needs_payment() ) {
71
-										unset( $actions['pay'] );
72
-									}
70
+                                    if ( ! $invoice->needs_payment() ) {
71
+                                        unset( $actions['pay'] );
72
+                                    }
73 73
 
74
-									if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) {
75
-										foreach ( $actions as $key => $action ) {
76
-											$class = !empty($action['class']) ? sanitize_html_class($action['class']) : '';
74
+                                    if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) {
75
+                                        foreach ( $actions as $key => $action ) {
76
+                                            $class = !empty($action['class']) ? sanitize_html_class($action['class']) : '';
77 77
                                             echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>';
78
-										}
79
-									}
80
-								?>
78
+                                        }
79
+                                    }
80
+                                ?>
81 81
 							<?php endif; ?>
82 82
 						</td>
83 83
 					<?php endforeach; ?>
@@ -91,22 +91,22 @@  discard block
 block discarded – undo
91 91
 	<?php if ( 1 < $user_invoices->max_num_pages ) : ?>
92 92
 		<div class="invoicing-Pagination">
93 93
 			<?php
94
-			$big = 999999;
95
-
96
-			if (get_query_var('paged'))
97
-				$current_page = get_query_var('paged');
98
-			elseif (get_query_var('page'))
99
-				$current_page = get_query_var('page');
100
-			else
101
-				$current_page = 1;
102
-
103
-			echo paginate_links( array(
104
-				'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
105
-				'format'  => '?paged=%#%',
106
-				'current' => max( 1, $current_page ),
107
-				'total'   => $user_invoices->max_num_pages,
108
-			) );
109
-			?>
94
+            $big = 999999;
95
+
96
+            if (get_query_var('paged'))
97
+                $current_page = get_query_var('paged');
98
+            elseif (get_query_var('page'))
99
+                $current_page = get_query_var('page');
100
+            else
101
+                $current_page = 1;
102
+
103
+            echo paginate_links( array(
104
+                'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
105
+                'format'  => '?paged=%#%',
106
+                'current' => max( 1, $current_page ),
107
+                'total'   => $user_invoices->max_num_pages,
108
+            ) );
109
+            ?>
110 110
 		</div>
111 111
 	<?php endif; ?>
112 112
 
Please login to merge, or discard this patch.
includes/class-wpinv-db.php 1 patch
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -5,237 +5,237 @@
 block discarded – undo
5 5
 
6 6
 abstract class Wpinv_DB {
7 7
 
8
-	/**
9
-	 * The name of our database table
10
-	 *
11
-	 * @access  public
12
-	 * @since   1.0.0
13
-	 */
14
-	public $table_name;
15
-
16
-	/**
17
-	 * The version of our database table
18
-	 *
19
-	 * @access  public
20
-	 * @since   1.0.0
21
-	 */
22
-	public $version;
23
-
24
-	/**
25
-	 * The name of the primary column
26
-	 *
27
-	 * @access  public
28
-	 * @since   1.0.0
29
-	 */
30
-	public $primary_key;
31
-
32
-	/**
33
-	 * Get things started
34
-	 *
35
-	 * @access  public
36
-	 * @since   1.0.0
37
-	 */
38
-	public function __construct() {}
39
-
40
-	/**
41
-	 * Whitelist of columns
42
-	 *
43
-	 * @access  public
44
-	 * @since   1.0.0
45
-	 * @return  array
46
-	 */
47
-	public function get_columns() {
48
-		return array();
49
-	}
50
-
51
-	/**
52
-	 * Default column values
53
-	 *
54
-	 * @access  public
55
-	 * @since   1.0.0
56
-	 * @return  array
57
-	 */
58
-	public function get_column_defaults() {
59
-		return array();
60
-	}
61
-
62
-	/**
63
-	 * Retrieve a row by the primary key
64
-	 *
65
-	 * @access  public
66
-	 * @since   1.0.0
67
-	 * @return  object
68
-	 */
69
-	public function get( $row_id ) {
70
-		global $wpdb;
71
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
72
-	}
73
-
74
-	/**
75
-	 * Retrieve a row by a specific column / value
76
-	 *
77
-	 * @access  public
78
-	 * @since   1.0.0
79
-	 * @return  object
80
-	 */
81
-	public function get_by( $column, $row_id ) {
82
-		global $wpdb;
83
-		$column = esc_sql( $column );
84
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
85
-	}
86
-
87
-	/**
88
-	 * Retrieve a specific column's value by the primary key
89
-	 *
90
-	 * @access  public
91
-	 * @since   1.0.0
92
-	 * @return  string
93
-	 */
94
-	public function get_column( $column, $row_id ) {
95
-		global $wpdb;
96
-		$column = esc_sql( $column );
97
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
98
-	}
99
-
100
-	/**
101
-	 * Retrieve a specific column's value by the the specified column / value
102
-	 *
103
-	 * @access  public
104
-	 * @since   1.0.0
105
-	 * @return  string
106
-	 */
107
-	public function get_column_by( $column, $column_where, $column_value ) {
108
-		global $wpdb;
109
-		$column_where = esc_sql( $column_where );
110
-		$column       = esc_sql( $column );
111
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
112
-	}
113
-
114
-	/**
115
-	 * Insert a new row
116
-	 *
117
-	 * @access  public
118
-	 * @since   1.0.0
119
-	 * @return  int
120
-	 */
121
-	public function insert( $data, $type = '' ) {
122
-		global $wpdb;
123
-
124
-		// Set default values
125
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
126
-
127
-		do_action( 'wpinv_pre_insert_' . $type, $data );
128
-
129
-		// Initialise column format array
130
-		$column_formats = $this->get_columns();
131
-
132
-		// Force fields to lower case
133
-		$data = array_change_key_case( $data );
134
-
135
-		// White list columns
136
-		$data = array_intersect_key( $data, $column_formats );
137
-
138
-		// Reorder $column_formats to match the order of columns given in $data
139
-		$data_keys = array_keys( $data );
140
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
141
-
142
-		$wpdb->insert( $this->table_name, $data, $column_formats );
143
-		$wpdb_insert_id = $wpdb->insert_id;
144
-
145
-		do_action( 'wpinv_post_insert_' . $type, $wpdb_insert_id, $data );
146
-
147
-		return $wpdb_insert_id;
148
-	}
149
-
150
-	/**
151
-	 * Update a row
152
-	 *
153
-	 * @access  public
154
-	 * @since   1.0.0
155
-	 * @return  bool
156
-	 */
157
-	public function update( $row_id, $data = array(), $where = '' ) {
158
-
159
-		global $wpdb;
160
-
161
-		// Row ID must be positive integer
162
-		$row_id = absint( $row_id );
163
-
164
-		if( empty( $row_id ) ) {
165
-			return false;
166
-		}
167
-
168
-		if( empty( $where ) ) {
169
-			$where = $this->primary_key;
170
-		}
171
-
172
-		// Initialise column format array
173
-		$column_formats = $this->get_columns();
174
-
175
-		// Force fields to lower case
176
-		$data = array_change_key_case( $data );
177
-
178
-		// White list columns
179
-		$data = array_intersect_key( $data, $column_formats );
180
-
181
-		// Reorder $column_formats to match the order of columns given in $data
182
-		$data_keys = array_keys( $data );
183
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
184
-
185
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
186
-			return false;
187
-		}
188
-
189
-		return true;
190
-	}
191
-
192
-	/**
193
-	 * Delete a row identified by the primary key
194
-	 *
195
-	 * @access  public
196
-	 * @since   1.0.0
197
-	 * @return  bool
198
-	 */
199
-	public function delete( $row_id = 0 ) {
200
-
201
-		global $wpdb;
202
-
203
-		// Row ID must be positive integer
204
-		$row_id = absint( $row_id );
205
-
206
-		if( empty( $row_id ) ) {
207
-			return false;
208
-		}
209
-
210
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
211
-			return false;
212
-		}
213
-
214
-		return true;
215
-	}
216
-
217
-	/**
218
-	 * Check if the given table exists
219
-	 *
220
-	 * @since  2.4
221
-	 * @param  string $table The table name
222
-	 * @return bool          If the table name exists
223
-	 */
224
-	public function table_exists( $table ) {
225
-		global $wpdb;
226
-		$table = sanitize_text_field( $table );
227
-
228
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
229
-	}
230
-
231
-	/**
232
-	 * Check if the table was ever installed
233
-	 *
234
-	 * @since  2.4
235
-	 * @return bool Returns if the customers table was installed and upgrade routine run
236
-	 */
237
-	public function installed() {
238
-		return $this->table_exists( $this->table_name );
239
-	}
8
+    /**
9
+     * The name of our database table
10
+     *
11
+     * @access  public
12
+     * @since   1.0.0
13
+     */
14
+    public $table_name;
15
+
16
+    /**
17
+     * The version of our database table
18
+     *
19
+     * @access  public
20
+     * @since   1.0.0
21
+     */
22
+    public $version;
23
+
24
+    /**
25
+     * The name of the primary column
26
+     *
27
+     * @access  public
28
+     * @since   1.0.0
29
+     */
30
+    public $primary_key;
31
+
32
+    /**
33
+     * Get things started
34
+     *
35
+     * @access  public
36
+     * @since   1.0.0
37
+     */
38
+    public function __construct() {}
39
+
40
+    /**
41
+     * Whitelist of columns
42
+     *
43
+     * @access  public
44
+     * @since   1.0.0
45
+     * @return  array
46
+     */
47
+    public function get_columns() {
48
+        return array();
49
+    }
50
+
51
+    /**
52
+     * Default column values
53
+     *
54
+     * @access  public
55
+     * @since   1.0.0
56
+     * @return  array
57
+     */
58
+    public function get_column_defaults() {
59
+        return array();
60
+    }
61
+
62
+    /**
63
+     * Retrieve a row by the primary key
64
+     *
65
+     * @access  public
66
+     * @since   1.0.0
67
+     * @return  object
68
+     */
69
+    public function get( $row_id ) {
70
+        global $wpdb;
71
+        return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
72
+    }
73
+
74
+    /**
75
+     * Retrieve a row by a specific column / value
76
+     *
77
+     * @access  public
78
+     * @since   1.0.0
79
+     * @return  object
80
+     */
81
+    public function get_by( $column, $row_id ) {
82
+        global $wpdb;
83
+        $column = esc_sql( $column );
84
+        return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
85
+    }
86
+
87
+    /**
88
+     * Retrieve a specific column's value by the primary key
89
+     *
90
+     * @access  public
91
+     * @since   1.0.0
92
+     * @return  string
93
+     */
94
+    public function get_column( $column, $row_id ) {
95
+        global $wpdb;
96
+        $column = esc_sql( $column );
97
+        return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
98
+    }
99
+
100
+    /**
101
+     * Retrieve a specific column's value by the the specified column / value
102
+     *
103
+     * @access  public
104
+     * @since   1.0.0
105
+     * @return  string
106
+     */
107
+    public function get_column_by( $column, $column_where, $column_value ) {
108
+        global $wpdb;
109
+        $column_where = esc_sql( $column_where );
110
+        $column       = esc_sql( $column );
111
+        return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
112
+    }
113
+
114
+    /**
115
+     * Insert a new row
116
+     *
117
+     * @access  public
118
+     * @since   1.0.0
119
+     * @return  int
120
+     */
121
+    public function insert( $data, $type = '' ) {
122
+        global $wpdb;
123
+
124
+        // Set default values
125
+        $data = wp_parse_args( $data, $this->get_column_defaults() );
126
+
127
+        do_action( 'wpinv_pre_insert_' . $type, $data );
128
+
129
+        // Initialise column format array
130
+        $column_formats = $this->get_columns();
131
+
132
+        // Force fields to lower case
133
+        $data = array_change_key_case( $data );
134
+
135
+        // White list columns
136
+        $data = array_intersect_key( $data, $column_formats );
137
+
138
+        // Reorder $column_formats to match the order of columns given in $data
139
+        $data_keys = array_keys( $data );
140
+        $column_formats = array_merge( array_flip( $data_keys ), $column_formats );
141
+
142
+        $wpdb->insert( $this->table_name, $data, $column_formats );
143
+        $wpdb_insert_id = $wpdb->insert_id;
144
+
145
+        do_action( 'wpinv_post_insert_' . $type, $wpdb_insert_id, $data );
146
+
147
+        return $wpdb_insert_id;
148
+    }
149
+
150
+    /**
151
+     * Update a row
152
+     *
153
+     * @access  public
154
+     * @since   1.0.0
155
+     * @return  bool
156
+     */
157
+    public function update( $row_id, $data = array(), $where = '' ) {
158
+
159
+        global $wpdb;
160
+
161
+        // Row ID must be positive integer
162
+        $row_id = absint( $row_id );
163
+
164
+        if( empty( $row_id ) ) {
165
+            return false;
166
+        }
167
+
168
+        if( empty( $where ) ) {
169
+            $where = $this->primary_key;
170
+        }
171
+
172
+        // Initialise column format array
173
+        $column_formats = $this->get_columns();
174
+
175
+        // Force fields to lower case
176
+        $data = array_change_key_case( $data );
177
+
178
+        // White list columns
179
+        $data = array_intersect_key( $data, $column_formats );
180
+
181
+        // Reorder $column_formats to match the order of columns given in $data
182
+        $data_keys = array_keys( $data );
183
+        $column_formats = array_merge( array_flip( $data_keys ), $column_formats );
184
+
185
+        if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
186
+            return false;
187
+        }
188
+
189
+        return true;
190
+    }
191
+
192
+    /**
193
+     * Delete a row identified by the primary key
194
+     *
195
+     * @access  public
196
+     * @since   1.0.0
197
+     * @return  bool
198
+     */
199
+    public function delete( $row_id = 0 ) {
200
+
201
+        global $wpdb;
202
+
203
+        // Row ID must be positive integer
204
+        $row_id = absint( $row_id );
205
+
206
+        if( empty( $row_id ) ) {
207
+            return false;
208
+        }
209
+
210
+        if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
211
+            return false;
212
+        }
213
+
214
+        return true;
215
+    }
216
+
217
+    /**
218
+     * Check if the given table exists
219
+     *
220
+     * @since  2.4
221
+     * @param  string $table The table name
222
+     * @return bool          If the table name exists
223
+     */
224
+    public function table_exists( $table ) {
225
+        global $wpdb;
226
+        $table = sanitize_text_field( $table );
227
+
228
+        return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
229
+    }
230
+
231
+    /**
232
+     * Check if the table was ever installed
233
+     *
234
+     * @since  2.4
235
+     * @return bool Returns if the customers table was installed and upgrade routine run
236
+     */
237
+    public function installed() {
238
+        return $this->table_exists( $this->table_name );
239
+    }
240 240
 
241 241
 }
Please login to merge, or discard this patch.
includes/admin/class-wpinv-subscriptions-list-table.php 1 patch
Indentation   +349 added lines, -349 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 // Load WP_List_Table if not loaded
15 15
 if( ! class_exists( 'WP_List_Table' ) ) {
16
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
16
+    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17 17
 }
18 18
 
19 19
 /**
@@ -23,102 +23,102 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class WPInv_Subscription_Reports_Table extends WP_List_Table {
25 25
 
26
-	/**
27
-	 * Number of results to show per page
28
-	 *
29
-	 * @since       1.0.0
30
-	 */
31
-
32
-	public $per_page        = 20;
33
-	public $total_count     = 0;
34
-	public $active_count    = 0;
35
-	public $pending_count   = 0;
36
-	public $expired_count   = 0;
37
-	public $completed_count = 0;
38
-	public $trialling_count  = 0;
39
-	public $cancelled_count = 0;
40
-	public $failing_count   = 0;
41
-
42
-	/**
43
-	 * Get things started
44
-	 *
45
-	 * @access      private
46
-	 * @since       1.0.0
47
-	 * @return      void
48
-	 */
49
-	function __construct(){
50
-		global $status, $page;
51
-
52
-		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular'  => 'subscription',
55
-			'plural'    => 'subscriptions',
56
-			'ajax'      => false
57
-		) );
58
-
59
-		$this->get_subscription_counts();
60
-
61
-	}
62
-
63
-	/**
64
-	 * Retrieve the view types
65
-	 *
66
-	 * @access public
67
-	 * @since 1.0.0
68
-	 * @return array $views All the views available
69
-	 */
70
-	public function get_views() {
71
-
72
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
73
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count    . ')</span>';
74
-		$active_count    = '&nbsp;<span class="count">(' . $this->active_count . ')</span>';
75
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
76
-		$expired_count   = '&nbsp;<span class="count">(' . $this->expired_count  . ')</span>';
77
-		$completed_count = '&nbsp;<span class="count">(' . $this->completed_count . ')</span>';
78
-		$trialling_count  = '&nbsp;<span class="count">(' . $this->trialling_count   . ')</span>';
79
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count   . ')</span>';
80
-		$failing_count   = '&nbsp;<span class="count">(' . $this->failing_count   . ')</span>';
81
-
82
-		$views = array(
83
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( 'status', 'paged' ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __('All','invoicing' ) . $total_count ),
84
-			'active'    => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'active', 'paged' => FALSE ) ), $current === 'active' ? ' class="current"' : '', __('Active','invoicing' ) . $active_count ),
85
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'pending', 'paged' => FALSE ) ), $current === 'pending' ? ' class="current"' : '', __('Pending','invoicing' ) . $pending_count ),
86
-			'expired'   => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'expired', 'paged' => FALSE ) ), $current === 'expired' ? ' class="current"' : '', __('Expired','invoicing' ) . $expired_count ),
87
-			'completed' => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'completed', 'paged' => FALSE ) ), $current === 'completed' ? ' class="current"' : '', __('Completed','invoicing' ) . $completed_count ),
88
-			'trialling'  => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'trialling', 'paged' => FALSE ) ), $current === 'trialling' ? ' class="current"' : '', __('Trialling','invoicing' ) . $trialling_count ),
89
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'cancelled', 'paged' => FALSE ) ), $current === 'cancelled' ? ' class="current"' : '', __('Cancelled','invoicing' ) . $cancelled_count ),
90
-			'failing'   => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'failing', 'paged' => FALSE ) ), $current === 'failing' ? ' class="current"' : '', __('Failing','invoicing' ) . $failing_count ),
91
-		);
92
-
93
-		return apply_filters( 'wpinv_recurring_subscriptions_table_views', $views );
94
-	}
95
-
96
-	/**
97
-	 * Show the search field
98
-	 *
99
-	 * @since 2.5
100
-	 * @access public
101
-	 *
102
-	 * @param string $text Label for the search box
103
-	 * @param string $input_id ID of the search box
104
-	 *
105
-	 * @return void
106
-	 */
107
-	public function search_box( $text, $input_id ) {
108
-
109
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
110
-			return;
111
-		}
112
-
113
-		$input_id = $input_id . '-search-input';
114
-
115
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
116
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
117
-		}
118
-
119
-		if ( ! empty( $_REQUEST['order'] ) ) {
120
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
121
-		}
26
+    /**
27
+     * Number of results to show per page
28
+     *
29
+     * @since       1.0.0
30
+     */
31
+
32
+    public $per_page        = 20;
33
+    public $total_count     = 0;
34
+    public $active_count    = 0;
35
+    public $pending_count   = 0;
36
+    public $expired_count   = 0;
37
+    public $completed_count = 0;
38
+    public $trialling_count  = 0;
39
+    public $cancelled_count = 0;
40
+    public $failing_count   = 0;
41
+
42
+    /**
43
+     * Get things started
44
+     *
45
+     * @access      private
46
+     * @since       1.0.0
47
+     * @return      void
48
+     */
49
+    function __construct(){
50
+        global $status, $page;
51
+
52
+        // Set parent defaults
53
+        parent::__construct( array(
54
+            'singular'  => 'subscription',
55
+            'plural'    => 'subscriptions',
56
+            'ajax'      => false
57
+        ) );
58
+
59
+        $this->get_subscription_counts();
60
+
61
+    }
62
+
63
+    /**
64
+     * Retrieve the view types
65
+     *
66
+     * @access public
67
+     * @since 1.0.0
68
+     * @return array $views All the views available
69
+     */
70
+    public function get_views() {
71
+
72
+        $current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
73
+        $total_count     = '&nbsp;<span class="count">(' . $this->total_count    . ')</span>';
74
+        $active_count    = '&nbsp;<span class="count">(' . $this->active_count . ')</span>';
75
+        $pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
76
+        $expired_count   = '&nbsp;<span class="count">(' . $this->expired_count  . ')</span>';
77
+        $completed_count = '&nbsp;<span class="count">(' . $this->completed_count . ')</span>';
78
+        $trialling_count  = '&nbsp;<span class="count">(' . $this->trialling_count   . ')</span>';
79
+        $cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count   . ')</span>';
80
+        $failing_count   = '&nbsp;<span class="count">(' . $this->failing_count   . ')</span>';
81
+
82
+        $views = array(
83
+            'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( 'status', 'paged' ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __('All','invoicing' ) . $total_count ),
84
+            'active'    => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'active', 'paged' => FALSE ) ), $current === 'active' ? ' class="current"' : '', __('Active','invoicing' ) . $active_count ),
85
+            'pending'   => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'pending', 'paged' => FALSE ) ), $current === 'pending' ? ' class="current"' : '', __('Pending','invoicing' ) . $pending_count ),
86
+            'expired'   => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'expired', 'paged' => FALSE ) ), $current === 'expired' ? ' class="current"' : '', __('Expired','invoicing' ) . $expired_count ),
87
+            'completed' => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'completed', 'paged' => FALSE ) ), $current === 'completed' ? ' class="current"' : '', __('Completed','invoicing' ) . $completed_count ),
88
+            'trialling'  => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'trialling', 'paged' => FALSE ) ), $current === 'trialling' ? ' class="current"' : '', __('Trialling','invoicing' ) . $trialling_count ),
89
+            'cancelled' => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'cancelled', 'paged' => FALSE ) ), $current === 'cancelled' ? ' class="current"' : '', __('Cancelled','invoicing' ) . $cancelled_count ),
90
+            'failing'   => sprintf( '<a href="%s"%s>%s</a>', add_query_arg( array( 'status' => 'failing', 'paged' => FALSE ) ), $current === 'failing' ? ' class="current"' : '', __('Failing','invoicing' ) . $failing_count ),
91
+        );
92
+
93
+        return apply_filters( 'wpinv_recurring_subscriptions_table_views', $views );
94
+    }
95
+
96
+    /**
97
+     * Show the search field
98
+     *
99
+     * @since 2.5
100
+     * @access public
101
+     *
102
+     * @param string $text Label for the search box
103
+     * @param string $input_id ID of the search box
104
+     *
105
+     * @return void
106
+     */
107
+    public function search_box( $text, $input_id ) {
108
+
109
+        if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
110
+            return;
111
+        }
112
+
113
+        $input_id = $input_id . '-search-input';
114
+
115
+        if ( ! empty( $_REQUEST['orderby'] ) ) {
116
+            echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
117
+        }
118
+
119
+        if ( ! empty( $_REQUEST['order'] ) ) {
120
+            echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
121
+        }
122 122
 ?>
123 123
 		<p class="search-box">
124 124
 			<?php do_action( 'wpinv_recurring_subscription_search_box' ); ?>
@@ -127,18 +127,18 @@  discard block
 block discarded – undo
127 127
 			<?php submit_button( $text, 'button', false, false, array('ID' => 'search-submit') ); ?><br/>
128 128
 		</p>
129 129
 <?php
130
-	}
131
-
132
-	/**
133
-	 * Render most columns
134
-	 *
135
-	 * @access      private
136
-	 * @since       1.0.0
137
-	 * @return      string
138
-	 */
139
-	function column_default( $item, $column_name ) {
140
-		return $item->$column_name;
141
-	}
130
+    }
131
+
132
+    /**
133
+     * Render most columns
134
+     *
135
+     * @access      private
136
+     * @since       1.0.0
137
+     * @return      string
138
+     */
139
+    function column_default( $item, $column_name ) {
140
+        return $item->$column_name;
141
+    }
142 142
 
143 143
     /**
144 144
      * Subscription id column
@@ -151,244 +151,244 @@  discard block
 block discarded – undo
151 151
         return '<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $item->id ) ) . '" target="_blank">' . $item->id . '</a>';
152 152
     }
153 153
 
154
-	/**
155
-	 * Customer column
156
-	 *
157
-	 * @access      private
158
-	 * @since       1.0.0
159
-	 * @return      string
160
-	 */
161
-	function column_customer_id( $item ) {
162
-		$subscriber = get_userdata( $item->customer_id );
163
-		$customer   = ! empty( $subscriber->display_name ) ? $subscriber->display_name : $subscriber->user_email;
164
-
165
-		return '<a href="' . esc_url( get_edit_user_link( $item->customer_id ) ) . '" target="_blank">' . $customer . '</a>';
166
-	}
167
-
168
-	/**
169
-	 * Status column
170
-	 *
171
-	 * @access      private
172
-	 * @since       1.0.0
173
-	 * @return      string
174
-	 */
175
-	function column_status( $item ) {
176
-		return $item->get_status_label();
177
-	}
178
-
179
-	/**
180
-	 * Period column
181
-	 *
182
-	 * @access      private
183
-	 * @since       1.0.0
184
-	 * @return      string
185
-	 */
186
-	function column_period( $item ) {
187
-
188
-		$period = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $item->period,$item->frequency );
189
-
190
-		return wpinv_price( wpinv_format_amount( $item->recurring_amount ), wpinv_get_invoice_currency_code( $item->parent_payment_id ) ) . ' / ' . $period;
191
-	}
192
-
193
-	/**
194
-	 * Billing Times column
195
-	 *
196
-	 * @access      private
197
-	 * @since       1.0.0
198
-	 * @return      string
199
-	 */
200
-	function column_bill_times( $item ) {
201
-		return $item->get_times_billed() . ' / ' . ( ( $item->bill_times == 0 ) ? 'Until Cancelled' : $item->bill_times );
202
-	}
203
-
204
-	/**
205
-	 * Initial Amount column
206
-	 *
207
-	 * @access      private
208
-	 * @since       1.0.0
209
-	 * @return      string
210
-	 */
211
-	function column_initial_amount( $item ) {
212
-		return wpinv_price( wpinv_format_amount( $item->initial_amount ), wpinv_get_invoice_currency_code( $item->parent_payment_id ) );
213
-	}
214
-
215
-	/**
216
-	 * Renewal date column
217
-	 *
218
-	 * @access      private
219
-	 * @since       1.0.0
220
-	 * @return      string
221
-	 */
222
-	function column_renewal_date( $item ) {
223
-		return $renewal_date = ! empty( $item->expiration ) ? date_i18n( get_option( 'date_format' ), strtotime( $item->expiration ) ) : __( 'N/A', 'invoicing' );
224
-	}
225
-
226
-	/**
227
-	 * Payment column
228
-	 *
229
-	 * @access      private
230
-	 * @since       1.0.0
231
-	 * @return      string
232
-	 */
233
-	function column_parent_payment_id( $item ) {
234
-		return '<a href="' . get_edit_post_link( $item->parent_payment_id ) . '" target="_blank">' . wpinv_get_invoice_number( $item->parent_payment_id ) . '</a>';
235
-	}
236
-
237
-	/**
238
-	 * Product ID column
239
-	 *
240
-	 * @access      private
241
-	 * @since       1.0.0
242
-	 * @return      string
243
-	 */
244
-	function column_product_id( $item ) {
245
-		return '<a href="' . esc_url( admin_url( 'post.php?action=edit&post=' . $item->product_id ) ) . '" target="_blank">' . get_the_title( $item->product_id ) . '</a>';
246
-	}
247
-
248
-	/**
249
-	 * Render the edit column
250
-	 *
251
-	 * @access      private
252
-	 * @since       2.0
253
-	 * @return      string
254
-	 */
255
-	function column_actions( $item ) {
256
-		return '<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $item->id ) ) . '" title="' . esc_attr( __( 'View or edit subscription', 'invoicing' ) ) . '" target="_blank">' . __( 'View', 'invoicing' ) . '</a>';
257
-	}
258
-
259
-
260
-	/**
261
-	 * Retrieve the table columns
262
-	 *
263
-	 * @access      private
264
-	 * @since       1.0.0
265
-	 * @return      array
266
-	 */
267
-
268
-	function get_columns(){
269
-		$columns = array(
270
-			'sub_id'            => __( 'ID', 'invoicing' ),
271
-			'customer_id'       => __( 'Customer', 'invoicing' ),
272
-			'status'            => __( 'Status', 'invoicing' ),
273
-			'period'            => __( 'Billing Cycle', 'invoicing' ),
274
-			'initial_amount'    => __( 'Initial Amount', 'invoicing' ),
275
-			'bill_times'        => __( 'Times Billed', 'invoicing' ),
276
-			'renewal_date'      => __( 'Renewal Date', 'invoicing' ),
277
-			'parent_payment_id' => __( 'Invoice', 'invoicing' ),
278
-			'product_id'        => __( 'Item', 'invoicing' ),
279
-			'actions'           => __( 'Actions', 'invoicing' ),
280
-		);
281
-
282
-		return apply_filters( 'wpinv_report_subscription_columns', $columns );
283
-	}
284
-
285
-	/**
286
-	 * Retrieve the current page number
287
-	 *
288
-	 * @access      private
289
-	 * @since       1.0.0
290
-	 * @return      int
291
-	 */
292
-	function get_paged() {
293
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
294
-	}
295
-
296
-	/**
297
-	 * Retrieve the subscription counts
298
-	 *
299
-	 * @access public
300
-	 * @since 1.4
301
-	 * @return void
302
-	 */
303
-	public function get_subscription_counts() {
304
-
305
-		global $wp_query;
306
-
307
-		$db = new WPInv_Subscriptions_DB;
308
-
309
-		$search = ! empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
310
-
311
-		$this->total_count     = $db->count();
312
-		$this->active_count    = $db->count( array( 'status' => 'active', 'search' => $search ) );
313
-		$this->pending_count   = $db->count( array( 'status' => 'pending', 'search' => $search ) );
314
-		$this->expired_count   = $db->count( array( 'status' => 'expired', 'search' => $search ) );
315
-		$this->trialling_count  = $db->count( array( 'status' => 'trialling', 'search' => $search ) );
316
-		$this->cancelled_count = $db->count( array( 'status' => 'cancelled', 'search' => $search ) );
317
-		$this->completed_count = $db->count( array( 'status' => 'completed', 'search' => $search ) );
318
-		$this->failing_count   = $db->count( array( 'status' => 'failing', 'search' => $search ) );
319
-
320
-	}
321
-
322
-	/**
323
-	 * Setup the final data for the table
324
-	 *
325
-	 * @access      private
326
-	 * @since       1.0.0
327
-	 * @uses        $this->_column_headers
328
-	 * @uses        $this->items
329
-	 * @uses        $this->get_columns()
330
-	 * @uses        $this->get_sortable_columns()
331
-	 * @uses        $this->get_pagenum()
332
-	 * @uses        $this->set_pagination_args()
333
-	 * @return      array
334
-	 */
335
-	function prepare_items() {
336
-
337
-		$columns  = $this->get_columns();
338
-		$hidden   = array(); // No hidden columns
339
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
340
-		$sortable = $this->get_sortable_columns();
341
-
342
-		$this->_column_headers = array( $columns, $hidden, $sortable );
343
-
344
-		$current_page = $this->get_pagenum();
345
-
346
-		$db     = new WPInv_Subscriptions_DB;
347
-		$search = ! empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
348
-		$args   = array(
349
-			'number' => $this->per_page,
350
-			'offset' => $this->per_page * ( $this->get_paged() - 1 ),
351
-			'search' => $search
352
-		);
353
-
354
-		if ( 'any' !== $status ) {
355
-			$args['status'] = $status;
356
-		}
357
-
358
-		$this->items = $db->get_subscriptions( $args );
359
-
360
-		switch ( $status ) {
361
-			case 'active':
362
-				$total_items = $this->active_count;
363
-				break;
364
-			case 'pending':
365
-				$total_items = $this->pending_count;
366
-				break;
367
-			case 'expired':
368
-				$total_items = $this->expired_count;
369
-				break;
370
-			case 'cancelled':
371
-				$total_items = $this->cancelled_count;
372
-				break;
373
-			case 'failing':
374
-				$total_items = $this->failing_count;
375
-				break;
376
-			case 'trialling':
377
-				$total_items = $this->trialling_count;
378
-				break;
379
-			case 'completed':
380
-				$total_items = $this->completed_count;
381
-				break;
382
-			case 'any':
383
-			default:
384
-				$total_items = $this->total_count;
385
-				break;
386
-		}
387
-
388
-		$this->set_pagination_args( array(
389
-			'total_items' => $total_items,
390
-			'per_page'    => $this->per_page,
391
-			'total_pages' => ceil( $total_items / $this->per_page )
392
-		) );
393
-	}
154
+    /**
155
+     * Customer column
156
+     *
157
+     * @access      private
158
+     * @since       1.0.0
159
+     * @return      string
160
+     */
161
+    function column_customer_id( $item ) {
162
+        $subscriber = get_userdata( $item->customer_id );
163
+        $customer   = ! empty( $subscriber->display_name ) ? $subscriber->display_name : $subscriber->user_email;
164
+
165
+        return '<a href="' . esc_url( get_edit_user_link( $item->customer_id ) ) . '" target="_blank">' . $customer . '</a>';
166
+    }
167
+
168
+    /**
169
+     * Status column
170
+     *
171
+     * @access      private
172
+     * @since       1.0.0
173
+     * @return      string
174
+     */
175
+    function column_status( $item ) {
176
+        return $item->get_status_label();
177
+    }
178
+
179
+    /**
180
+     * Period column
181
+     *
182
+     * @access      private
183
+     * @since       1.0.0
184
+     * @return      string
185
+     */
186
+    function column_period( $item ) {
187
+
188
+        $period = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $item->period,$item->frequency );
189
+
190
+        return wpinv_price( wpinv_format_amount( $item->recurring_amount ), wpinv_get_invoice_currency_code( $item->parent_payment_id ) ) . ' / ' . $period;
191
+    }
192
+
193
+    /**
194
+     * Billing Times column
195
+     *
196
+     * @access      private
197
+     * @since       1.0.0
198
+     * @return      string
199
+     */
200
+    function column_bill_times( $item ) {
201
+        return $item->get_times_billed() . ' / ' . ( ( $item->bill_times == 0 ) ? 'Until Cancelled' : $item->bill_times );
202
+    }
203
+
204
+    /**
205
+     * Initial Amount column
206
+     *
207
+     * @access      private
208
+     * @since       1.0.0
209
+     * @return      string
210
+     */
211
+    function column_initial_amount( $item ) {
212
+        return wpinv_price( wpinv_format_amount( $item->initial_amount ), wpinv_get_invoice_currency_code( $item->parent_payment_id ) );
213
+    }
214
+
215
+    /**
216
+     * Renewal date column
217
+     *
218
+     * @access      private
219
+     * @since       1.0.0
220
+     * @return      string
221
+     */
222
+    function column_renewal_date( $item ) {
223
+        return $renewal_date = ! empty( $item->expiration ) ? date_i18n( get_option( 'date_format' ), strtotime( $item->expiration ) ) : __( 'N/A', 'invoicing' );
224
+    }
225
+
226
+    /**
227
+     * Payment column
228
+     *
229
+     * @access      private
230
+     * @since       1.0.0
231
+     * @return      string
232
+     */
233
+    function column_parent_payment_id( $item ) {
234
+        return '<a href="' . get_edit_post_link( $item->parent_payment_id ) . '" target="_blank">' . wpinv_get_invoice_number( $item->parent_payment_id ) . '</a>';
235
+    }
236
+
237
+    /**
238
+     * Product ID column
239
+     *
240
+     * @access      private
241
+     * @since       1.0.0
242
+     * @return      string
243
+     */
244
+    function column_product_id( $item ) {
245
+        return '<a href="' . esc_url( admin_url( 'post.php?action=edit&post=' . $item->product_id ) ) . '" target="_blank">' . get_the_title( $item->product_id ) . '</a>';
246
+    }
247
+
248
+    /**
249
+     * Render the edit column
250
+     *
251
+     * @access      private
252
+     * @since       2.0
253
+     * @return      string
254
+     */
255
+    function column_actions( $item ) {
256
+        return '<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $item->id ) ) . '" title="' . esc_attr( __( 'View or edit subscription', 'invoicing' ) ) . '" target="_blank">' . __( 'View', 'invoicing' ) . '</a>';
257
+    }
258
+
259
+
260
+    /**
261
+     * Retrieve the table columns
262
+     *
263
+     * @access      private
264
+     * @since       1.0.0
265
+     * @return      array
266
+     */
267
+
268
+    function get_columns(){
269
+        $columns = array(
270
+            'sub_id'            => __( 'ID', 'invoicing' ),
271
+            'customer_id'       => __( 'Customer', 'invoicing' ),
272
+            'status'            => __( 'Status', 'invoicing' ),
273
+            'period'            => __( 'Billing Cycle', 'invoicing' ),
274
+            'initial_amount'    => __( 'Initial Amount', 'invoicing' ),
275
+            'bill_times'        => __( 'Times Billed', 'invoicing' ),
276
+            'renewal_date'      => __( 'Renewal Date', 'invoicing' ),
277
+            'parent_payment_id' => __( 'Invoice', 'invoicing' ),
278
+            'product_id'        => __( 'Item', 'invoicing' ),
279
+            'actions'           => __( 'Actions', 'invoicing' ),
280
+        );
281
+
282
+        return apply_filters( 'wpinv_report_subscription_columns', $columns );
283
+    }
284
+
285
+    /**
286
+     * Retrieve the current page number
287
+     *
288
+     * @access      private
289
+     * @since       1.0.0
290
+     * @return      int
291
+     */
292
+    function get_paged() {
293
+        return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
294
+    }
295
+
296
+    /**
297
+     * Retrieve the subscription counts
298
+     *
299
+     * @access public
300
+     * @since 1.4
301
+     * @return void
302
+     */
303
+    public function get_subscription_counts() {
304
+
305
+        global $wp_query;
306
+
307
+        $db = new WPInv_Subscriptions_DB;
308
+
309
+        $search = ! empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
310
+
311
+        $this->total_count     = $db->count();
312
+        $this->active_count    = $db->count( array( 'status' => 'active', 'search' => $search ) );
313
+        $this->pending_count   = $db->count( array( 'status' => 'pending', 'search' => $search ) );
314
+        $this->expired_count   = $db->count( array( 'status' => 'expired', 'search' => $search ) );
315
+        $this->trialling_count  = $db->count( array( 'status' => 'trialling', 'search' => $search ) );
316
+        $this->cancelled_count = $db->count( array( 'status' => 'cancelled', 'search' => $search ) );
317
+        $this->completed_count = $db->count( array( 'status' => 'completed', 'search' => $search ) );
318
+        $this->failing_count   = $db->count( array( 'status' => 'failing', 'search' => $search ) );
319
+
320
+    }
321
+
322
+    /**
323
+     * Setup the final data for the table
324
+     *
325
+     * @access      private
326
+     * @since       1.0.0
327
+     * @uses        $this->_column_headers
328
+     * @uses        $this->items
329
+     * @uses        $this->get_columns()
330
+     * @uses        $this->get_sortable_columns()
331
+     * @uses        $this->get_pagenum()
332
+     * @uses        $this->set_pagination_args()
333
+     * @return      array
334
+     */
335
+    function prepare_items() {
336
+
337
+        $columns  = $this->get_columns();
338
+        $hidden   = array(); // No hidden columns
339
+        $status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
340
+        $sortable = $this->get_sortable_columns();
341
+
342
+        $this->_column_headers = array( $columns, $hidden, $sortable );
343
+
344
+        $current_page = $this->get_pagenum();
345
+
346
+        $db     = new WPInv_Subscriptions_DB;
347
+        $search = ! empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
348
+        $args   = array(
349
+            'number' => $this->per_page,
350
+            'offset' => $this->per_page * ( $this->get_paged() - 1 ),
351
+            'search' => $search
352
+        );
353
+
354
+        if ( 'any' !== $status ) {
355
+            $args['status'] = $status;
356
+        }
357
+
358
+        $this->items = $db->get_subscriptions( $args );
359
+
360
+        switch ( $status ) {
361
+            case 'active':
362
+                $total_items = $this->active_count;
363
+                break;
364
+            case 'pending':
365
+                $total_items = $this->pending_count;
366
+                break;
367
+            case 'expired':
368
+                $total_items = $this->expired_count;
369
+                break;
370
+            case 'cancelled':
371
+                $total_items = $this->cancelled_count;
372
+                break;
373
+            case 'failing':
374
+                $total_items = $this->failing_count;
375
+                break;
376
+            case 'trialling':
377
+                $total_items = $this->trialling_count;
378
+                break;
379
+            case 'completed':
380
+                $total_items = $this->completed_count;
381
+                break;
382
+            case 'any':
383
+            default:
384
+                $total_items = $this->total_count;
385
+                break;
386
+        }
387
+
388
+        $this->set_pagination_args( array(
389
+            'total_items' => $total_items,
390
+            'per_page'    => $this->per_page,
391
+            'total_pages' => ceil( $total_items / $this->per_page )
392
+        ) );
393
+    }
394 394
 }
Please login to merge, or discard this patch.
includes/admin/subscriptions.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -8,23 +8,23 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function wpinv_subscriptions_page() {
10 10
 
11
-	if ( ! empty( $_GET['id'] ) ) {
11
+    if ( ! empty( $_GET['id'] ) ) {
12 12
 
13 13
         wpinv_recurring_subscription_details();
14 14
 
15
-		return;
15
+        return;
16 16
 
17
-	}
18
-	?>
17
+    }
18
+    ?>
19 19
 	<div class="wrap">
20 20
 
21 21
 		<h1>
22 22
 			<?php _e( 'Subscriptions', 'invoicing' ); ?>
23 23
 		</h1>
24 24
 		<?php
25
-		$subscribers_table = new WPInv_Subscription_Reports_Table();
26
-		$subscribers_table->prepare_items();
27
-		?>
25
+        $subscribers_table = new WPInv_Subscription_Reports_Table();
26
+        $subscribers_table->prepare_items();
27
+        ?>
28 28
 
29 29
 		<form id="subscribers-filter" method="get">
30 30
 
@@ -47,24 +47,24 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function wpinv_recurring_subscription_details() {
49 49
 
50
-	$render = true;
50
+    $render = true;
51 51
 
52
-	if ( ! current_user_can( 'manage_invoicing' ) ) {
53
-		die( __( 'You are not permitted to view this data.', 'invoicing' ) );
54
-	}
52
+    if ( ! current_user_can( 'manage_invoicing' ) ) {
53
+        die( __( 'You are not permitted to view this data.', 'invoicing' ) );
54
+    }
55 55
 
56
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
56
+    if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
57 57
         die( __( 'Invalid subscription ID Provided.', 'invoicing' ) );
58
-	}
58
+    }
59 59
 
60
-	$sub_id  = (int) $_GET['id'];
61
-	$sub     = new WPInv_Subscription( $sub_id );
60
+    $sub_id  = (int) $_GET['id'];
61
+    $sub     = new WPInv_Subscription( $sub_id );
62 62
 
63
-	if ( empty( $sub ) ) {
64
-		die( __( 'Invalid subscription ID Provided.', 'invoicing' ) );
65
-	}
63
+    if ( empty( $sub ) ) {
64
+        die( __( 'Invalid subscription ID Provided.', 'invoicing' ) );
65
+    }
66 66
 
67
-	?>
67
+    ?>
68 68
 	<div class="wrap">
69 69
 		<h2><?php _e( 'Subscription Details', 'invoicing' ); ?></h2>
70 70
 
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 										</td>
89 89
 										<td>
90 90
 											<?php
91
-											$frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $sub->period, $sub->frequency );
92
-											$billing   = wpinv_price( wpinv_format_amount( $sub->recurring_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) ) . ' / ' . $frequency;
93
-											$initial   = wpinv_price( wpinv_format_amount( $sub->initial_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) );
94
-											printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing );
95
-											?>
91
+                                            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $sub->period, $sub->frequency );
92
+                                            $billing   = wpinv_price( wpinv_format_amount( $sub->recurring_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) ) . ' / ' . $frequency;
93
+                                            $initial   = wpinv_price( wpinv_format_amount( $sub->initial_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) );
94
+                                            printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing );
95
+                                            ?>
96 96
 										</td>
97 97
 									</tr>
98 98
 									<tr>
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 
135 135
                                             ?>
136 136
 											<a href="<?php echo esc_url( add_query_arg( array(
137
-													'post'   => $sub->product_id,
138
-													'action' => 'edit'
139
-												), admin_url( 'post.php' ) ) ); ?>" target="_blank"><?php _e( 'View Item', 'invoicing' ) ; ?></a>
137
+                                                    'post'   => $sub->product_id,
138
+                                                    'action' => 'edit'
139
+                                                ), admin_url( 'post.php' ) ) ); ?>" target="_blank"><?php _e( 'View Item', 'invoicing' ) ; ?></a>
140 140
 										</td>
141 141
 									</tr>
142 142
 									<tr>
@@ -299,56 +299,56 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function wpinv_recurring_process_subscription_update() {
301 301
 
302
-	if( empty( $_POST['sub_id'] ) ) {
303
-		return;
304
-	}
302
+    if( empty( $_POST['sub_id'] ) ) {
303
+        return;
304
+    }
305 305
 
306
-	if( empty( $_POST['wpinv_update_subscription'] ) ) {
307
-		return;
308
-	}
306
+    if( empty( $_POST['wpinv_update_subscription'] ) ) {
307
+        return;
308
+    }
309 309
 
310
-	if( ! current_user_can( 'manage_invoicing') ) {
311
-		return;
312
-	}
310
+    if( ! current_user_can( 'manage_invoicing') ) {
311
+        return;
312
+    }
313 313
 
314
-	if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
315
-		wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
316
-	}
314
+    if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
315
+        wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
316
+    }
317 317
 
318
-	$profile_id      = sanitize_text_field( $_POST['profile_id'] );
319
-	$transaction_id  = sanitize_text_field( $_POST['transaction_id'] );
320
-	$product_id      = absint( $_POST['product_id'] );
321
-	$subscription    = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
322
-	$subscription->update( array(
323
-		'status'         => sanitize_text_field( $_POST['status'] ),
324
-		'profile_id'     => $profile_id,
325
-		'product_id'     => $product_id,
326
-		'transaction_id' => $transaction_id,
327
-	) );
318
+    $profile_id      = sanitize_text_field( $_POST['profile_id'] );
319
+    $transaction_id  = sanitize_text_field( $_POST['transaction_id'] );
320
+    $product_id      = absint( $_POST['product_id'] );
321
+    $subscription    = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
322
+    $subscription->update( array(
323
+        'status'         => sanitize_text_field( $_POST['status'] ),
324
+        'profile_id'     => $profile_id,
325
+        'product_id'     => $product_id,
326
+        'transaction_id' => $transaction_id,
327
+    ) );
328 328
 
329
-	$status = sanitize_text_field( $_POST['status'] );
329
+    $status = sanitize_text_field( $_POST['status'] );
330 330
 
331
-	switch( $status ) {
331
+    switch( $status ) {
332 332
 
333
-		case 'cancelled' :
333
+        case 'cancelled' :
334 334
 
335
-			$subscription->cancel();
336
-			break;
335
+            $subscription->cancel();
336
+            break;
337 337
 
338
-		case 'expired' :
338
+        case 'expired' :
339 339
 
340
-			$subscription->expire();
341
-			break;
340
+            $subscription->expire();
341
+            break;
342 342
 
343
-		case 'completed' :
343
+        case 'completed' :
344 344
 
345
-			$subscription->complete();
346
-			break;
345
+            $subscription->complete();
346
+            break;
347 347
 
348
-	}
348
+    }
349 349
 
350
-	wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=updated&id=' . $subscription->id ) );
351
-	exit;
350
+    wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=updated&id=' . $subscription->id ) );
351
+    exit;
352 352
 
353 353
 }
354 354
 add_action( 'admin_init', 'wpinv_recurring_process_subscription_update', 1 );
@@ -362,30 +362,30 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function wpinv_recurring_process_subscription_deletion() {
364 364
 
365
-	if( empty( $_POST['sub_id'] ) ) {
366
-		return;
367
-	}
365
+    if( empty( $_POST['sub_id'] ) ) {
366
+        return;
367
+    }
368 368
 
369
-	if( empty( $_POST['wpinv_delete_subscription'] ) ) {
370
-		return;
371
-	}
369
+    if( empty( $_POST['wpinv_delete_subscription'] ) ) {
370
+        return;
371
+    }
372 372
 
373
-	if( ! current_user_can( 'manage_invoicing') ) {
374
-		return;
375
-	}
373
+    if( ! current_user_can( 'manage_invoicing') ) {
374
+        return;
375
+    }
376 376
 
377
-	if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
378
-		wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
379
-	}
377
+    if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
378
+        wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
379
+    }
380 380
 
381
-	$subscription = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
381
+    $subscription = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
382 382
 
383
-	delete_post_meta( $subscription->parent_payment_id, '_wpinv_subscription_payment' );
383
+    delete_post_meta( $subscription->parent_payment_id, '_wpinv_subscription_payment' );
384 384
 
385
-	$subscription->delete();
385
+    $subscription->delete();
386 386
 
387
-	wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=deleted' ) );
388
-	exit;
387
+    wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=deleted' ) );
388
+    exit;
389 389
 
390 390
 }
391 391
 add_action( 'admin_init', 'wpinv_recurring_process_subscription_deletion', 2 );
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class OxidInstaller extends BaseInstaller
7 7
 {
8
-	const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
8
+    const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
9 9
 
10 10
     protected $locations = array(
11 11
         'module'    => 'modules/{$name}/',
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
         'out'    => 'out/{$name}/',
14 14
     );
15 15
 
16
-	/**
17
-	 * getInstallPath
18
-	 *
19
-	 * @param PackageInterface $package
20
-	 * @param string $frameworkType
21
-	 * @return void
22
-	 */
23
-	public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
-	{
25
-		$installPath = parent::getInstallPath($package, $frameworkType);
26
-		$type = $this->package->getType();
27
-		if ($type === 'oxid-module') {
28
-			$this->prepareVendorDirectory($installPath);
29
-		}
30
-		return $installPath;
31
-	}
16
+    /**
17
+     * getInstallPath
18
+     *
19
+     * @param PackageInterface $package
20
+     * @param string $frameworkType
21
+     * @return void
22
+     */
23
+    public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+    {
25
+        $installPath = parent::getInstallPath($package, $frameworkType);
26
+        $type = $this->package->getType();
27
+        if ($type === 'oxid-module') {
28
+            $this->prepareVendorDirectory($installPath);
29
+        }
30
+        return $installPath;
31
+    }
32 32
 
33
-	/**
34
-	 * prepareVendorDirectory
35
-	 *
36
-	 * Makes sure there is a vendormetadata.php file inside
37
-	 * the vendor folder if there is a vendor folder.
38
-	 *
39
-	 * @param string $installPath
40
-	 * @return void
41
-	 */
42
-	protected function prepareVendorDirectory($installPath)
43
-	{
44
-		$matches = '';
45
-		$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
-		if (!$hasVendorDirectory) {
47
-			return;
48
-		}
33
+    /**
34
+     * prepareVendorDirectory
35
+     *
36
+     * Makes sure there is a vendormetadata.php file inside
37
+     * the vendor folder if there is a vendor folder.
38
+     *
39
+     * @param string $installPath
40
+     * @return void
41
+     */
42
+    protected function prepareVendorDirectory($installPath)
43
+    {
44
+        $matches = '';
45
+        $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
+        if (!$hasVendorDirectory) {
47
+            return;
48
+        }
49 49
 
50
-		$vendorDirectory = $matches['vendor'];
51
-		$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
-		if (!file_exists($vendorPath)) {
53
-			mkdir($vendorPath, 0755, true);
54
-		}
50
+        $vendorDirectory = $matches['vendor'];
51
+        $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
+        if (!file_exists($vendorPath)) {
53
+            mkdir($vendorPath, 0755, true);
54
+        }
55 55
 
56
-		$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
-		touch($vendorMetaDataPath);
58
-	}
56
+        $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
+        touch($vendorMetaDataPath);
58
+    }
59 59
 }
Please login to merge, or discard this patch.
composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 
4 4
 class ClanCatsFrameworkInstaller extends BaseInstaller
5 5
 {
6
-	protected $locations = array(
7
-		'ship'      => 'CCF/orbit/{$name}/',
8
-		'theme'     => 'CCF/app/themes/{$name}/',
9
-	);
6
+    protected $locations = array(
7
+        'ship'      => 'CCF/orbit/{$name}/',
8
+        'theme'     => 'CCF/app/themes/{$name}/',
9
+    );
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
includes/wpinv-item-functions.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,7 @@
 block discarded – undo
799 799
                 case 'trial_interval':
800 800
                     $value = absint( $value );
801 801
                 break;
802
-				case 'editable':
802
+                case 'editable':
803 803
                     $value = (int) $value;
804 804
                 break;
805 805
             }
Please login to merge, or discard this patch.
includes/wpinv-general-functions.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
 }
31 31
 
32 32
 function wpinv_can_checkout() {
33
-	$can_checkout = true; // Always true for now
33
+    $can_checkout = true; // Always true for now
34 34
 
35
-	return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
35
+    return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
36 36
 }
37 37
 
38 38
 function wpinv_get_success_page_uri() {
39
-	$page_id = wpinv_get_option( 'success_page', 0 );
40
-	$page_id = absint( $page_id );
39
+    $page_id = wpinv_get_option( 'success_page', 0 );
40
+    $page_id = absint( $page_id );
41 41
 
42
-	return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
42
+    return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
43 43
 }
44 44
 
45 45
 function wpinv_get_history_page_uri() {
46
-	$page_id = wpinv_get_option( 'invoice_history_page', 0 );
47
-	$page_id = absint( $page_id );
46
+    $page_id = wpinv_get_option( 'invoice_history_page', 0 );
47
+    $page_id = absint( $page_id );
48 48
 
49
-	return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
49
+    return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
50 50
 }
51 51
 
52 52
 function wpinv_is_success_page() {
53
-	$is_success_page = wpinv_get_option( 'success_page', false );
54
-	$is_success_page = isset( $is_success_page ) ? is_page( $is_success_page ) : false;
53
+    $is_success_page = wpinv_get_option( 'success_page', false );
54
+    $is_success_page = isset( $is_success_page ) ? is_page( $is_success_page ) : false;
55 55
 
56
-	return apply_filters( 'wpinv_is_success_page', $is_success_page );
56
+    return apply_filters( 'wpinv_is_success_page', $is_success_page );
57 57
 }
58 58
 
59 59
 function wpinv_is_invoice_history_page() {
60
-	$ret = wpinv_get_option( 'invoice_history_page', false );
61
-	$ret = $ret ? is_page( $ret ) : false;
62
-	return apply_filters( 'wpinv_is_invoice_history_page', $ret );
60
+    $ret = wpinv_get_option( 'invoice_history_page', false );
61
+    $ret = $ret ? is_page( $ret ) : false;
62
+    return apply_filters( 'wpinv_is_invoice_history_page', $ret );
63 63
 }
64 64
 
65 65
 function wpinv_is_subscriptions_history_page() {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 function wpinv_send_to_success_page( $args = null ) {
72
-	$redirect = wpinv_get_success_page_uri();
72
+    $redirect = wpinv_get_success_page_uri();
73 73
     
74 74
     if ( !empty( $args ) ) {
75 75
         // Check for backward compatibility
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 }
90 90
 
91 91
 function wpinv_send_to_failed_page( $args = null ) {
92
-	$redirect = wpinv_get_failed_transaction_uri();
92
+    $redirect = wpinv_get_failed_transaction_uri();
93 93
     
94 94
     if ( !empty( $args ) ) {
95 95
         // Check for backward compatibility
@@ -109,72 +109,72 @@  discard block
 block discarded – undo
109 109
 }
110 110
 
111 111
 function wpinv_get_checkout_uri( $args = array() ) {
112
-	$uri = wpinv_get_option( 'checkout_page', false );
113
-	$uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
112
+    $uri = wpinv_get_option( 'checkout_page', false );
113
+    $uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
114 114
 
115
-	if ( !empty( $args ) ) {
116
-		// Check for backward compatibility
117
-		if ( is_string( $args ) )
118
-			$args = str_replace( '?', '', $args );
115
+    if ( !empty( $args ) ) {
116
+        // Check for backward compatibility
117
+        if ( is_string( $args ) )
118
+            $args = str_replace( '?', '', $args );
119 119
 
120
-		$args = wp_parse_args( $args );
120
+        $args = wp_parse_args( $args );
121 121
 
122
-		$uri = add_query_arg( $args, $uri );
123
-	}
122
+        $uri = add_query_arg( $args, $uri );
123
+    }
124 124
 
125
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
125
+    $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
126 126
 
127
-	$ajax_url = admin_url( 'admin-ajax.php', $scheme );
127
+    $ajax_url = admin_url( 'admin-ajax.php', $scheme );
128 128
 
129
-	if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
130
-		$uri = preg_replace( '/^http:/', 'https:', $uri );
131
-	}
129
+    if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
130
+        $uri = preg_replace( '/^http:/', 'https:', $uri );
131
+    }
132 132
 
133
-	return apply_filters( 'wpinv_get_checkout_uri', $uri );
133
+    return apply_filters( 'wpinv_get_checkout_uri', $uri );
134 134
 }
135 135
 
136 136
 function wpinv_send_back_to_checkout( $args = array() ) {
137
-	$redirect = wpinv_get_checkout_uri();
137
+    $redirect = wpinv_get_checkout_uri();
138 138
 
139
-	if ( ! empty( $args ) ) {
140
-		// Check for backward compatibility
141
-		if ( is_string( $args ) )
142
-			$args = str_replace( '?', '', $args );
139
+    if ( ! empty( $args ) ) {
140
+        // Check for backward compatibility
141
+        if ( is_string( $args ) )
142
+            $args = str_replace( '?', '', $args );
143 143
 
144
-		$args = wp_parse_args( $args );
144
+        $args = wp_parse_args( $args );
145 145
 
146
-		$redirect = add_query_arg( $args, $redirect );
147
-	}
146
+        $redirect = add_query_arg( $args, $redirect );
147
+    }
148 148
 
149
-	wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
150
-	exit;
149
+    wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
150
+    exit;
151 151
 }
152 152
 
153 153
 function wpinv_get_success_page_url( $query_string = null ) {
154
-	$success_page = wpinv_get_option( 'success_page', 0 );
155
-	$success_page = get_permalink( $success_page );
154
+    $success_page = wpinv_get_option( 'success_page', 0 );
155
+    $success_page = get_permalink( $success_page );
156 156
 
157
-	if ( $query_string )
158
-		$success_page .= $query_string;
157
+    if ( $query_string )
158
+        $success_page .= $query_string;
159 159
 
160
-	return apply_filters( 'wpinv_success_page_url', $success_page );
160
+    return apply_filters( 'wpinv_success_page_url', $success_page );
161 161
 }
162 162
 
163 163
 function wpinv_get_failed_transaction_uri( $extras = false ) {
164
-	$uri = wpinv_get_option( 'failure_page', '' );
165
-	$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
164
+    $uri = wpinv_get_option( 'failure_page', '' );
165
+    $uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
166 166
 
167
-	if ( $extras )
168
-		$uri .= $extras;
167
+    if ( $extras )
168
+        $uri .= $extras;
169 169
 
170
-	return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
170
+    return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
171 171
 }
172 172
 
173 173
 function wpinv_is_failed_transaction_page() {
174
-	$ret = wpinv_get_option( 'failure_page', false );
175
-	$ret = isset( $ret ) ? is_page( $ret ) : false;
174
+    $ret = wpinv_get_option( 'failure_page', false );
175
+    $ret = isset( $ret ) ? is_page( $ret ) : false;
176 176
 
177
-	return apply_filters( 'wpinv_is_failure_page', $ret );
177
+    return apply_filters( 'wpinv_is_failure_page', $ret );
178 178
 }
179 179
 
180 180
 function wpinv_transaction_query( $type = 'start' ) {
@@ -320,36 +320,36 @@  discard block
 block discarded – undo
320 320
     $require_billing_details = apply_filters( 'wpinv_checkout_required_billing_details', wpinv_use_taxes() );
321 321
     
322 322
     if ( $require_billing_details ) {
323
-		if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
324
-			$required_fields['first_name'] = array(
325
-				'error_id' => 'invalid_first_name',
326
-				'error_message' => __( 'Please enter your first name', 'invoicing' )
327
-			);
328
-		}
329
-		if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
330
-			$required_fields['address'] = array(
331
-				'error_id' => 'invalid_address',
332
-				'error_message' => __( 'Please enter your address', 'invoicing' )
333
-			);
334
-		}
335
-		if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
336
-			$required_fields['city'] = array(
337
-				'error_id' => 'invalid_city',
338
-				'error_message' => __( 'Please enter your billing city', 'invoicing' )
339
-			);
340
-		}
341
-		if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
342
-			$required_fields['state'] = array(
343
-				'error_id' => 'invalid_state',
344
-				'error_message' => __( 'Please enter billing state / province', 'invoicing' )
345
-			);
346
-		}
347
-		if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
348
-			$required_fields['country'] = array(
349
-				'error_id' => 'invalid_country',
350
-				'error_message' => __( 'Please select your billing country', 'invoicing' )
351
-			);
352
-		}
323
+        if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
324
+            $required_fields['first_name'] = array(
325
+                'error_id' => 'invalid_first_name',
326
+                'error_message' => __( 'Please enter your first name', 'invoicing' )
327
+            );
328
+        }
329
+        if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
330
+            $required_fields['address'] = array(
331
+                'error_id' => 'invalid_address',
332
+                'error_message' => __( 'Please enter your address', 'invoicing' )
333
+            );
334
+        }
335
+        if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
336
+            $required_fields['city'] = array(
337
+                'error_id' => 'invalid_city',
338
+                'error_message' => __( 'Please enter your billing city', 'invoicing' )
339
+            );
340
+        }
341
+        if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
342
+            $required_fields['state'] = array(
343
+                'error_id' => 'invalid_state',
344
+                'error_message' => __( 'Please enter billing state / province', 'invoicing' )
345
+            );
346
+        }
347
+        if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
348
+            $required_fields['country'] = array(
349
+                'error_id' => 'invalid_country',
350
+                'error_message' => __( 'Please select your billing country', 'invoicing' )
351
+            );
352
+        }
353 353
     }
354 354
 
355 355
     return apply_filters( 'wpinv_checkout_required_fields', $required_fields );
Please login to merge, or discard this patch.