Passed
Push — master ( ec3085...0b939f )
by Brian
04:46
created
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 string
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 string
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.
includes/admin/class-getpaid-post-types-admin.php 2 patches
Indentation   +639 added lines, -639 removed lines patch added patch discarded remove patch
@@ -13,646 +13,646 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Post_Types_Admin {
14 14
 
15 15
     /**
16
-	 * Hook in methods.
17
-	 */
18
-	public static function init() {
19
-
20
-		// Init metaboxes.
21
-		GetPaid_Metaboxes::init();
22
-
23
-		// Filter the post updated messages.
24
-		add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
25
-
26
-		// Filter post actions.
27
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
29
-
30
-		// Invoice table columns.
31
-		add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
-		add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
33
-
34
-		// Items table columns.
35
-		add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
36
-		add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
37
-		add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
38
-		add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
39
-		add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
40
-		add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
41
-
42
-		// Payment forms columns.
43
-		add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
44
-		add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
45
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
46
-
47
-		// Discount table columns.
48
-		add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
49
-		add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
50
-
51
-		// Deleting posts.
52
-		add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
53
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
54
-	}
55
-
56
-	/**
57
-	 * Post updated messages.
58
-	 */
59
-	public static function post_updated_messages( $messages ) {
60
-		global $post;
61
-
62
-		$messages['wpi_discount'] = array(
63
-			0   => '',
64
-			1   => __( 'Discount updated.', 'invoicing' ),
65
-			2   => __( 'Custom field updated.', 'invoicing' ),
66
-			3   => __( 'Custom field deleted.', 'invoicing' ),
67
-			4   => __( 'Discount updated.', 'invoicing' ),
68
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
69
-			6   => __( 'Discount updated.', 'invoicing' ),
70
-			7   => __( 'Discount saved.', 'invoicing' ),
71
-			8   => __( 'Discount submitted.', 'invoicing' ),
72
-			9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
73
-			10  => __( 'Discount draft updated.', 'invoicing' ),
74
-		);
75
-
76
-		$messages['wpi_payment_form'] = array(
77
-			0   => '',
78
-			1   => __( 'Payment Form updated.', 'invoicing' ),
79
-			2   => __( 'Custom field updated.', 'invoicing' ),
80
-			3   => __( 'Custom field deleted.', 'invoicing' ),
81
-			4   => __( 'Payment Form updated.', 'invoicing' ),
82
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
83
-			6   => __( 'Payment Form updated.', 'invoicing' ),
84
-			7   => __( 'Payment Form saved.', 'invoicing' ),
85
-			8   => __( 'Payment Form submitted.', 'invoicing' ),
86
-			9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
87
-			10  => __( 'Payment Form draft updated.', 'invoicing' ),
88
-		);
89
-
90
-		return $messages;
91
-
92
-	}
93
-
94
-	/**
95
-	 * Post row actions.
96
-	 */
97
-	public static function post_row_actions( $actions, $post ) {
98
-
99
-		$post = get_post( $post );
100
-
101
-		// We do not want to edit the default payment form.
102
-		if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) {
103
-			unset( $actions['trash'] );
104
-			unset( $actions['inline hide-if-no-js'] );
105
-		}
106
-
107
-		return $actions;
108
-	}
109
-
110
-	/**
16
+     * Hook in methods.
17
+     */
18
+    public static function init() {
19
+
20
+        // Init metaboxes.
21
+        GetPaid_Metaboxes::init();
22
+
23
+        // Filter the post updated messages.
24
+        add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
25
+
26
+        // Filter post actions.
27
+        add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
+        add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
29
+
30
+        // Invoice table columns.
31
+        add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
+        add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
33
+
34
+        // Items table columns.
35
+        add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
36
+        add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
37
+        add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
38
+        add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
39
+        add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
40
+        add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
41
+
42
+        // Payment forms columns.
43
+        add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
44
+        add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
45
+        add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
46
+
47
+        // Discount table columns.
48
+        add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
49
+        add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
50
+
51
+        // Deleting posts.
52
+        add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
53
+        add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
54
+    }
55
+
56
+    /**
57
+     * Post updated messages.
58
+     */
59
+    public static function post_updated_messages( $messages ) {
60
+        global $post;
61
+
62
+        $messages['wpi_discount'] = array(
63
+            0   => '',
64
+            1   => __( 'Discount updated.', 'invoicing' ),
65
+            2   => __( 'Custom field updated.', 'invoicing' ),
66
+            3   => __( 'Custom field deleted.', 'invoicing' ),
67
+            4   => __( 'Discount updated.', 'invoicing' ),
68
+            5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
69
+            6   => __( 'Discount updated.', 'invoicing' ),
70
+            7   => __( 'Discount saved.', 'invoicing' ),
71
+            8   => __( 'Discount submitted.', 'invoicing' ),
72
+            9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
73
+            10  => __( 'Discount draft updated.', 'invoicing' ),
74
+        );
75
+
76
+        $messages['wpi_payment_form'] = array(
77
+            0   => '',
78
+            1   => __( 'Payment Form updated.', 'invoicing' ),
79
+            2   => __( 'Custom field updated.', 'invoicing' ),
80
+            3   => __( 'Custom field deleted.', 'invoicing' ),
81
+            4   => __( 'Payment Form updated.', 'invoicing' ),
82
+            5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
83
+            6   => __( 'Payment Form updated.', 'invoicing' ),
84
+            7   => __( 'Payment Form saved.', 'invoicing' ),
85
+            8   => __( 'Payment Form submitted.', 'invoicing' ),
86
+            9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
87
+            10  => __( 'Payment Form draft updated.', 'invoicing' ),
88
+        );
89
+
90
+        return $messages;
91
+
92
+    }
93
+
94
+    /**
95
+     * Post row actions.
96
+     */
97
+    public static function post_row_actions( $actions, $post ) {
98
+
99
+        $post = get_post( $post );
100
+
101
+        // We do not want to edit the default payment form.
102
+        if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) {
103
+            unset( $actions['trash'] );
104
+            unset( $actions['inline hide-if-no-js'] );
105
+        }
106
+
107
+        return $actions;
108
+    }
109
+
110
+    /**
111 111
      * Remove bulk edit option from admin side quote listing
112 112
      *
113 113
      * @since    1.0.0
114 114
      * @param array $actions post actions
115
-	 * @param WP_Post $post
115
+     * @param WP_Post $post
116 116
      * @return array $actions actions without edit option
117 117
      */
118 118
     public static function filter_invoice_row_actions( $actions, $post ) {
119 119
 
120 120
         if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
121 121
 
122
-			$actions = array();
123
-			$invoice = new WPInv_Invoice( $post );
124
-
125
-			$actions['edit'] =  sprintf(
126
-				'<a href="%1$s">%2$s</a>',
127
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
128
-				esc_html( __( 'Edit', 'invoicing' ) )
129
-			);
130
-
131
-			if ( ! $invoice->is_draft() ) {
132
-
133
-				$actions['view'] =  sprintf(
134
-					'<a href="%1$s">%2$s</a>',
135
-					esc_url( $invoice->get_view_url() ),
136
-					sprintf(
137
-						esc_html( __( 'View %s', 'invoicing' ) ),
138
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
139
-					)
140
-				);
141
-
142
-				$actions['send'] =  sprintf(
143
-					'<a href="%1$s">%2$s</a>',
144
-					esc_url(
145
-						wp_nonce_url(
146
-							add_query_arg(
147
-								array(
148
-									'getpaid-admin-action' => 'send_invoice',
149
-									'invoice_id'           => $invoice->get_id()
150
-								)
151
-							),
152
-							'getpaid-nonce',
153
-							'getpaid-nonce'
154
-						)
155
-					),
156
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
157
-				);
158
-
159
-			}
122
+            $actions = array();
123
+            $invoice = new WPInv_Invoice( $post );
124
+
125
+            $actions['edit'] =  sprintf(
126
+                '<a href="%1$s">%2$s</a>',
127
+                esc_url( get_edit_post_link( $invoice->get_id() ) ),
128
+                esc_html( __( 'Edit', 'invoicing' ) )
129
+            );
130
+
131
+            if ( ! $invoice->is_draft() ) {
132
+
133
+                $actions['view'] =  sprintf(
134
+                    '<a href="%1$s">%2$s</a>',
135
+                    esc_url( $invoice->get_view_url() ),
136
+                    sprintf(
137
+                        esc_html( __( 'View %s', 'invoicing' ) ),
138
+                        getpaid_get_post_type_label( $invoice->get_post_type(), false )
139
+                    )
140
+                );
141
+
142
+                $actions['send'] =  sprintf(
143
+                    '<a href="%1$s">%2$s</a>',
144
+                    esc_url(
145
+                        wp_nonce_url(
146
+                            add_query_arg(
147
+                                array(
148
+                                    'getpaid-admin-action' => 'send_invoice',
149
+                                    'invoice_id'           => $invoice->get_id()
150
+                                )
151
+                            ),
152
+                            'getpaid-nonce',
153
+                            'getpaid-nonce'
154
+                        )
155
+                    ),
156
+                    esc_html( __( 'Send to Customer', 'invoicing' ) )
157
+                );
158
+
159
+            }
160 160
 
161 161
         }
162 162
 
163 163
         return $actions;
164
-	}
165
-
166
-	/**
167
-	 * Returns an array of invoice table columns.
168
-	 */
169
-	public static function invoice_columns( $columns ) {
170
-
171
-		$columns = array(
172
-			'cb'                => $columns['cb'],
173
-			'number'            => __( 'Invoice', 'invoicing' ),
174
-			'customer'          => __( 'Customer', 'invoicing' ),
175
-			'invoice_date'      => __( 'Created', 'invoicing' ),
176
-			'payment_date'      => __( 'Completed', 'invoicing' ),
177
-			'amount'            => __( 'Amount', 'invoicing' ),
178
-			'recurring'         => __( 'Recurring', 'invoicing' ),
179
-			'status'            => __( 'Status', 'invoicing' ),
180
-		);
181
-
182
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
183
-	}
184
-
185
-	/**
186
-	 * Displays invoice table columns.
187
-	 */
188
-	public static function display_invoice_columns( $column_name, $post_id ) {
189
-
190
-		$invoice = new WPInv_Invoice( $post_id );
191
-
192
-		switch ( $column_name ) {
193
-
194
-			case 'invoice_date' :
195
-				$date_time = esc_attr( $invoice->get_created_date() );
196
-				$date      = getpaid_format_date_value( $date_time, "&mdash;", true );
197
-				echo "<span title='$date_time'>$date</span>";
198
-				break;
199
-
200
-			case 'payment_date' :
201
-
202
-				if ( $invoice->is_paid() ) {
203
-					$date_time = esc_attr( $invoice->get_completed_date() );
204
-					$date      = getpaid_format_date_value( $date_time, "&mdash;", true );
205
-					echo "<span title='$date_time'>$date</span>";
206
-				} else {
207
-					echo "&mdash;";
208
-				}
164
+    }
165
+
166
+    /**
167
+     * Returns an array of invoice table columns.
168
+     */
169
+    public static function invoice_columns( $columns ) {
170
+
171
+        $columns = array(
172
+            'cb'                => $columns['cb'],
173
+            'number'            => __( 'Invoice', 'invoicing' ),
174
+            'customer'          => __( 'Customer', 'invoicing' ),
175
+            'invoice_date'      => __( 'Created', 'invoicing' ),
176
+            'payment_date'      => __( 'Completed', 'invoicing' ),
177
+            'amount'            => __( 'Amount', 'invoicing' ),
178
+            'recurring'         => __( 'Recurring', 'invoicing' ),
179
+            'status'            => __( 'Status', 'invoicing' ),
180
+        );
181
+
182
+        return apply_filters( 'wpi_invoice_table_columns', $columns );
183
+    }
184
+
185
+    /**
186
+     * Displays invoice table columns.
187
+     */
188
+    public static function display_invoice_columns( $column_name, $post_id ) {
189
+
190
+        $invoice = new WPInv_Invoice( $post_id );
191
+
192
+        switch ( $column_name ) {
193
+
194
+            case 'invoice_date' :
195
+                $date_time = esc_attr( $invoice->get_created_date() );
196
+                $date      = getpaid_format_date_value( $date_time, "&mdash;", true );
197
+                echo "<span title='$date_time'>$date</span>";
198
+                break;
199
+
200
+            case 'payment_date' :
201
+
202
+                if ( $invoice->is_paid() ) {
203
+                    $date_time = esc_attr( $invoice->get_completed_date() );
204
+                    $date      = getpaid_format_date_value( $date_time, "&mdash;", true );
205
+                    echo "<span title='$date_time'>$date</span>";
206
+                } else {
207
+                    echo "&mdash;";
208
+                }
209 209
 				
210
-				break;
210
+                break;
211 211
 
212
-			case 'amount' :
212
+            case 'amount' :
213 213
 
214
-				$amount = $invoice->get_total();
215
-				$formated_amount = wpinv_price( $amount, $invoice->get_currency() );
214
+                $amount = $invoice->get_total();
215
+                $formated_amount = wpinv_price( $amount, $invoice->get_currency() );
216 216
 
217
-				if ( $invoice->is_refunded() ) {
218
-					$refunded_amount = wpinv_price( 0, $invoice->get_currency() );
219
-					echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
220
-				} else {
217
+                if ( $invoice->is_refunded() ) {
218
+                    $refunded_amount = wpinv_price( 0, $invoice->get_currency() );
219
+                    echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
220
+                } else {
221 221
 
222
-					$discount = $invoice->get_total_discount();
222
+                    $discount = $invoice->get_total_discount();
223 223
 
224
-					if ( ! empty( $discount ) ) {
225
-						$new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() );
226
-						echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
227
-					} else {
228
-						echo $formated_amount;
229
-					}
224
+                    if ( ! empty( $discount ) ) {
225
+                        $new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() );
226
+                        echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
227
+                    } else {
228
+                        echo $formated_amount;
229
+                    }
230 230
 
231
-				}
231
+                }
232 232
 
233
-				break;
233
+                break;
234 234
 
235
-			case 'status' :
236
-				$status       = sanitize_text_field( $invoice->get_status() );
237
-				$status_label = sanitize_text_field( $invoice->get_status_nicename() );
235
+            case 'status' :
236
+                $status       = sanitize_text_field( $invoice->get_status() );
237
+                $status_label = sanitize_text_field( $invoice->get_status_nicename() );
238 238
 
239
-				// If it is paid, show the gateway title.
240
-				if ( $invoice->is_paid() ) {
241
-					$gateway = sanitize_text_field( $invoice->get_gateway_title() );
242
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
239
+                // If it is paid, show the gateway title.
240
+                if ( $invoice->is_paid() ) {
241
+                    $gateway = sanitize_text_field( $invoice->get_gateway_title() );
242
+                    $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
243 243
 
244
-					echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
245
-				} else {
246
-					echo "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>";
247
-				}
244
+                    echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
245
+                } else {
246
+                    echo "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>";
247
+                }
248 248
 
249
-				// If it is not paid, display the overdue and view status.
250
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
249
+                // If it is not paid, display the overdue and view status.
250
+                if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
251 251
 
252
-					// Invoice view status.
253
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
254
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
255
-					} else {
256
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
257
-					}
252
+                    // Invoice view status.
253
+                    if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
254
+                        echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
255
+                    } else {
256
+                        echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
257
+                    }
258 258
 
259
-					// Display the overview status.
260
-					if ( wpinv_get_option( 'overdue_active' ) ) {
261
-						$due_date = $invoice->get_due_date();
262
-						$fomatted = getpaid_format_date( $due_date );
259
+                    // Display the overview status.
260
+                    if ( wpinv_get_option( 'overdue_active' ) ) {
261
+                        $due_date = $invoice->get_due_date();
262
+                        $fomatted = getpaid_format_date( $due_date );
263 263
 
264
-						if ( ! empty( $fomatted ) ) {
265
-							$date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
266
-							echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
267
-						}
268
-					}
264
+                        if ( ! empty( $fomatted ) ) {
265
+                            $date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
266
+                            echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
267
+                        }
268
+                    }
269 269
 
270
-				}
270
+                }
271 271
 
272
-				break;
272
+                break;
273 273
 
274
-			case 'recurring':
274
+            case 'recurring':
275 275
 
276
-				if ( $invoice->is_recurring() ) {
277
-					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
278
-				} else {
279
-					echo '<i class="fa fa-times" style="color:#616161;"></i>';
280
-				}
281
-				break;
276
+                if ( $invoice->is_recurring() ) {
277
+                    echo '<i class="fa fa-check" style="color:#43850a;"></i>';
278
+                } else {
279
+                    echo '<i class="fa fa-times" style="color:#616161;"></i>';
280
+                }
281
+                break;
282 282
 
283
-			case 'number' :
283
+            case 'number' :
284 284
 
285
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
286
-				$invoice_number  = sanitize_text_field( $invoice->get_number() );
287
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
285
+                $edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
286
+                $invoice_number  = sanitize_text_field( $invoice->get_number() );
287
+                $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
288 288
 
289
-				echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
289
+                echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
290 290
 
291
-				break;
291
+                break;
292 292
 
293
-			case 'customer' :
293
+            case 'customer' :
294 294
 	
295
-				$customer_name = $invoice->get_user_full_name();
295
+                $customer_name = $invoice->get_user_full_name();
296 296
 	
297
-				if ( empty( $customer_name ) ) {
298
-					$customer_name = $invoice->get_email();
299
-				}
297
+                if ( empty( $customer_name ) ) {
298
+                    $customer_name = $invoice->get_email();
299
+                }
300 300
 	
301
-				if ( ! empty( $customer_name ) ) {
302
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
303
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
304
-					echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
305
-				} else {
306
-					echo '<div>&mdash;</div>';
307
-				}
301
+                if ( ! empty( $customer_name ) ) {
302
+                    $customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
303
+                    $view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
304
+                    echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
305
+                } else {
306
+                    echo '<div>&mdash;</div>';
307
+                }
308 308
 
309
-				break;
309
+                break;
310 310
 
311
-		}
311
+        }
312 312
 
313
-	}
313
+    }
314 314
 
315
-	/**
316
-	 * Returns an array of payment forms table columns.
317
-	 */
318
-	public static function payment_form_columns( $columns ) {
315
+    /**
316
+     * Returns an array of payment forms table columns.
317
+     */
318
+    public static function payment_form_columns( $columns ) {
319 319
 
320
-		$columns = array(
321
-			'cb'                => $columns['cb'],
322
-			'title'             => __( 'Name', 'invoicing' ),
323
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
324
-			'earnings'          => __( 'Revenue', 'invoicing' ),
325
-			'refunds'           => __( 'Refunded', 'invoicing' ),
326
-			'items'             => __( 'Items', 'invoicing' ),
327
-			'date'              => __( 'Date', 'invoicing' ),
328
-		);
320
+        $columns = array(
321
+            'cb'                => $columns['cb'],
322
+            'title'             => __( 'Name', 'invoicing' ),
323
+            'shortcode'         => __( 'Shortcode', 'invoicing' ),
324
+            'earnings'          => __( 'Revenue', 'invoicing' ),
325
+            'refunds'           => __( 'Refunded', 'invoicing' ),
326
+            'items'             => __( 'Items', 'invoicing' ),
327
+            'date'              => __( 'Date', 'invoicing' ),
328
+        );
329 329
 
330
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
330
+        return apply_filters( 'wpi_payment_form_table_columns', $columns );
331 331
 
332
-	}
332
+    }
333 333
 
334
-	/**
335
-	 * Displays payment form table columns.
336
-	 */
337
-	public static function display_payment_form_columns( $column_name, $post_id ) {
334
+    /**
335
+     * Displays payment form table columns.
336
+     */
337
+    public static function display_payment_form_columns( $column_name, $post_id ) {
338 338
 
339
-		// Retrieve the payment form.
340
-		$form = new GetPaid_Payment_Form( $post_id );
339
+        // Retrieve the payment form.
340
+        $form = new GetPaid_Payment_Form( $post_id );
341 341
 
342
-		switch ( $column_name ) {
342
+        switch ( $column_name ) {
343 343
 
344
-			case 'earnings' :
345
-				echo wpinv_price( $form->get_earned() );
346
-				break;
344
+            case 'earnings' :
345
+                echo wpinv_price( $form->get_earned() );
346
+                break;
347 347
 
348
-			case 'refunds' :
349
-				echo wpinv_price( $form->get_refunded() );
350
-				break;
348
+            case 'refunds' :
349
+                echo wpinv_price( $form->get_refunded() );
350
+                break;
351 351
 
352
-			case 'refunds' :
353
-				echo wpinv_price( $form->get_refunded() );
354
-				break;
352
+            case 'refunds' :
353
+                echo wpinv_price( $form->get_refunded() );
354
+                break;
355 355
 
356
-			case 'shortcode' :
356
+            case 'shortcode' :
357 357
 
358
-				if ( $form->is_default() ) {
359
-					echo '&mdash;';
360
-				} else {
361
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
362
-				}
358
+                if ( $form->is_default() ) {
359
+                    echo '&mdash;';
360
+                } else {
361
+                    echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
362
+                }
363 363
 
364
-				break;
364
+                break;
365 365
 
366
-			case 'items' :
366
+            case 'items' :
367 367
 
368
-				$items = $form->get_items();
368
+                $items = $form->get_items();
369 369
 
370
-				if ( $form->is_default() || empty( $items ) ) {
371
-					echo '&mdash;';
372
-					return;
373
-				}
370
+                if ( $form->is_default() || empty( $items ) ) {
371
+                    echo '&mdash;';
372
+                    return;
373
+                }
374 374
 
375
-				$_items = array();
375
+                $_items = array();
376 376
 
377
-				foreach ( $items as $item ) {
378
-					$url = $item->get_edit_url();
377
+                foreach ( $items as $item ) {
378
+                    $url = $item->get_edit_url();
379 379
 
380
-					if ( empty( $url ) ) {
381
-						$_items[] = sanitize_text_field( $item->get_name() );
382
-					} else {
383
-						$_items[] = sprintf(
384
-							'<a href="%s">%s</a>',
385
-							esc_url( $url ),
386
-							sanitize_text_field( $item->get_name() )
387
-						);
388
-					}
380
+                    if ( empty( $url ) ) {
381
+                        $_items[] = sanitize_text_field( $item->get_name() );
382
+                    } else {
383
+                        $_items[] = sprintf(
384
+                            '<a href="%s">%s</a>',
385
+                            esc_url( $url ),
386
+                            sanitize_text_field( $item->get_name() )
387
+                        );
388
+                    }
389 389
 
390
-				}
390
+                }
391 391
 
392
-				echo implode( '<br>', $_items );
392
+                echo implode( '<br>', $_items );
393 393
 
394
-				break;
394
+                break;
395 395
 
396
-		}
396
+        }
397 397
 
398
-	}
398
+    }
399 399
 
400
-	/**
401
-	 * Filters post states.
402
-	 */
403
-	public static function filter_payment_form_state( $post_states, $post ) {
400
+    /**
401
+     * Filters post states.
402
+     */
403
+    public static function filter_payment_form_state( $post_states, $post ) {
404 404
 
405
-		if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
406
-			$post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
407
-		}
405
+        if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
406
+            $post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
407
+        }
408 408
 	
409
-		return $post_states;
410
-
411
-	}
412
-
413
-	/**
414
-	 * Returns an array of coupon table columns.
415
-	 */
416
-	public static function discount_columns( $columns ) {
417
-
418
-		$columns = array(
419
-			'cb'                => $columns['cb'],
420
-			'title'             => __( 'Name', 'invoicing' ),
421
-			'code'              => __( 'Code', 'invoicing' ),
422
-			'amount'            => __( 'Amount', 'invoicing' ),
423
-			'usage'             => __( 'Usage / Limit', 'invoicing' ),
424
-			'start_date'        => __( 'Start Date', 'invoicing' ),
425
-			'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
426
-		);
427
-
428
-		return apply_filters( 'wpi_discount_table_columns', $columns );
429
-	}
430
-
431
-	/**
432
-	 * Filters post states.
433
-	 */
434
-	public static function filter_discount_state( $post_states, $post ) {
435
-
436
-		if ( 'wpi_discount' == $post->post_type ) {
437
-
438
-			$discount = new WPInv_Discount( $post );
439
-
440
-			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
441
-
442
-			if ( $status != 'publish' ) {
443
-				return array(
444
-					'discount_status' => wpinv_discount_status( $status ),
445
-				);
446
-			}
447
-
448
-			return array();
449
-
450
-		}
451
-
452
-		return $post_states;
453
-
454
-	}
455
-
456
-	/**
457
-	 * Returns an array of items table columns.
458
-	 */
459
-	public static function item_columns( $columns ) {
460
-
461
-		$columns = array(
462
-			'cb'                => $columns['cb'],
463
-			'title'             => __( 'Name', 'invoicing' ),
464
-			'price'             => __( 'Price', 'invoicing' ),
465
-			'vat_rule'          => __( 'VAT rule', 'invoicing' ),
466
-			'vat_class'         => __( 'VAT class', 'invoicing' ),
467
-			'type'              => __( 'Type', 'invoicing' ),
468
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
469
-		);
470
-
471
-		if ( ! wpinv_use_taxes() ) {
472
-			unset( $columns['vat_rule'] );
473
-			unset( $columns['vat_class'] );
474
-		}
475
-
476
-		return apply_filters( 'wpi_item_table_columns', $columns );
477
-	}
478
-
479
-	/**
480
-	 * Returns an array of sortable items table columns.
481
-	 */
482
-	public static function sortable_item_columns( $columns ) {
483
-
484
-		return array_merge(
485
-			$columns,
486
-			array(
487
-				'price'     => 'price',
488
-				'vat_rule'  => 'vat_rule',
489
-				'vat_class' => 'vat_class',
490
-				'type'      => 'type',
491
-			)
492
-		);
493
-
494
-	}
495
-
496
-	/**
497
-	 * Displays items table columns.
498
-	 */
499
-	public static function display_item_columns( $column_name, $post_id ) {
409
+        return $post_states;
410
+
411
+    }
412
+
413
+    /**
414
+     * Returns an array of coupon table columns.
415
+     */
416
+    public static function discount_columns( $columns ) {
417
+
418
+        $columns = array(
419
+            'cb'                => $columns['cb'],
420
+            'title'             => __( 'Name', 'invoicing' ),
421
+            'code'              => __( 'Code', 'invoicing' ),
422
+            'amount'            => __( 'Amount', 'invoicing' ),
423
+            'usage'             => __( 'Usage / Limit', 'invoicing' ),
424
+            'start_date'        => __( 'Start Date', 'invoicing' ),
425
+            'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
426
+        );
427
+
428
+        return apply_filters( 'wpi_discount_table_columns', $columns );
429
+    }
430
+
431
+    /**
432
+     * Filters post states.
433
+     */
434
+    public static function filter_discount_state( $post_states, $post ) {
435
+
436
+        if ( 'wpi_discount' == $post->post_type ) {
437
+
438
+            $discount = new WPInv_Discount( $post );
439
+
440
+            $status = $discount->is_expired() ? 'expired' : $discount->get_status();
441
+
442
+            if ( $status != 'publish' ) {
443
+                return array(
444
+                    'discount_status' => wpinv_discount_status( $status ),
445
+                );
446
+            }
447
+
448
+            return array();
449
+
450
+        }
451
+
452
+        return $post_states;
453
+
454
+    }
455
+
456
+    /**
457
+     * Returns an array of items table columns.
458
+     */
459
+    public static function item_columns( $columns ) {
460
+
461
+        $columns = array(
462
+            'cb'                => $columns['cb'],
463
+            'title'             => __( 'Name', 'invoicing' ),
464
+            'price'             => __( 'Price', 'invoicing' ),
465
+            'vat_rule'          => __( 'VAT rule', 'invoicing' ),
466
+            'vat_class'         => __( 'VAT class', 'invoicing' ),
467
+            'type'              => __( 'Type', 'invoicing' ),
468
+            'shortcode'         => __( 'Shortcode', 'invoicing' ),
469
+        );
470
+
471
+        if ( ! wpinv_use_taxes() ) {
472
+            unset( $columns['vat_rule'] );
473
+            unset( $columns['vat_class'] );
474
+        }
475
+
476
+        return apply_filters( 'wpi_item_table_columns', $columns );
477
+    }
478
+
479
+    /**
480
+     * Returns an array of sortable items table columns.
481
+     */
482
+    public static function sortable_item_columns( $columns ) {
483
+
484
+        return array_merge(
485
+            $columns,
486
+            array(
487
+                'price'     => 'price',
488
+                'vat_rule'  => 'vat_rule',
489
+                'vat_class' => 'vat_class',
490
+                'type'      => 'type',
491
+            )
492
+        );
493
+
494
+    }
495
+
496
+    /**
497
+     * Displays items table columns.
498
+     */
499
+    public static function display_item_columns( $column_name, $post_id ) {
500 500
  
501
-		$item = new WPInv_Item( $post_id );
501
+        $item = new WPInv_Item( $post_id );
502 502
 
503
-		switch ( $column_name ) {
503
+        switch ( $column_name ) {
504 504
 
505
-			case 'price' :
505
+            case 'price' :
506 506
 
507
-				if ( ! $item->is_recurring() ) {
508
-					echo $item->get_the_price();
509
-					break;
510
-				}
507
+                if ( ! $item->is_recurring() ) {
508
+                    echo $item->get_the_price();
509
+                    break;
510
+                }
511 511
 
512
-				$price = wp_sprintf(
513
-					__( '%s / %s', 'invoicing' ),
514
-					$item->get_the_price(),
515
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
516
-				);
512
+                $price = wp_sprintf(
513
+                    __( '%s / %s', 'invoicing' ),
514
+                    $item->get_the_price(),
515
+                    getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
516
+                );
517 517
 
518
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
519
-					echo $price;
520
-					break;
521
-				}
518
+                if ( $item->get_the_price() == $item->get_the_initial_price() ) {
519
+                    echo $price;
520
+                    break;
521
+                }
522 522
 
523
-				echo $item->get_the_initial_price();
523
+                echo $item->get_the_initial_price();
524 524
 
525
-				echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
526
-				break;
525
+                echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
526
+                break;
527 527
 
528
-			case 'vat_rule' :
529
-				echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
530
-				break;
528
+            case 'vat_rule' :
529
+                echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
530
+                break;
531 531
 
532
-			case 'vat_class' :
533
-				echo getpaid_get_tax_class_label( $item->get_vat_class() );
534
-				break;
532
+            case 'vat_class' :
533
+                echo getpaid_get_tax_class_label( $item->get_vat_class() );
534
+                break;
535 535
 
536
-			case 'shortcode' :
537
-				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
538
-				break;
536
+            case 'shortcode' :
537
+                echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
538
+                break;
539 539
 
540
-			case 'type' :
541
-				echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
542
-				break;
540
+            case 'type' :
541
+                echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
542
+                break;
543 543
 
544
-		}
544
+        }
545 545
 
546
-	}
546
+    }
547 547
 
548
-	/**
549
-	 * Lets users filter items using taxes.
550
-	 */
551
-	public static function add_item_filters( $post_type ) {
548
+    /**
549
+     * Lets users filter items using taxes.
550
+     */
551
+    public static function add_item_filters( $post_type ) {
552 552
 
553
-		// Abort if we're not dealing with items.
554
-		if ( $post_type != 'wpi_item' ) {
555
-			return;
556
-		}
553
+        // Abort if we're not dealing with items.
554
+        if ( $post_type != 'wpi_item' ) {
555
+            return;
556
+        }
557 557
 
558
-		// Filter by vat rules.
559
-		if ( wpinv_use_taxes() ) {
558
+        // Filter by vat rules.
559
+        if ( wpinv_use_taxes() ) {
560 560
 	
561
-			// Sanitize selected vat rule.
562
-			$vat_rule   = '';
563
-			$vat_rules  = getpaid_get_tax_rules();
564
-			if ( isset( $_GET['vat_rule'] ) ) {
565
-				$vat_rule   =  $_GET['vat_rule'];
566
-			}
567
-
568
-			// Filter by VAT rule.
569
-			echo wpinv_html_select(
570
-				array(
571
-					'options'          => array_merge(
572
-						array(
573
-							'' => __( 'All VAT rules', 'invoicing' )
574
-						),
575
-						$vat_rules
576
-					),
577
-					'name'             => 'vat_rule',
578
-					'id'               => 'vat_rule',
579
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
580
-					'show_option_all'  => false,
581
-					'show_option_none' => false,
582
-				)
583
-			);
584
-
585
-			// Filter by VAT class.
561
+            // Sanitize selected vat rule.
562
+            $vat_rule   = '';
563
+            $vat_rules  = getpaid_get_tax_rules();
564
+            if ( isset( $_GET['vat_rule'] ) ) {
565
+                $vat_rule   =  $_GET['vat_rule'];
566
+            }
567
+
568
+            // Filter by VAT rule.
569
+            echo wpinv_html_select(
570
+                array(
571
+                    'options'          => array_merge(
572
+                        array(
573
+                            '' => __( 'All VAT rules', 'invoicing' )
574
+                        ),
575
+                        $vat_rules
576
+                    ),
577
+                    'name'             => 'vat_rule',
578
+                    'id'               => 'vat_rule',
579
+                    'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
580
+                    'show_option_all'  => false,
581
+                    'show_option_none' => false,
582
+                )
583
+            );
584
+
585
+            // Filter by VAT class.
586 586
 	
587
-			// Sanitize selected vat rule.
588
-			$vat_class   = '';
589
-			$vat_classes = getpaid_get_tax_classes();
590
-			if ( isset( $_GET['vat_class'] ) ) {
591
-				$vat_class   =  $_GET['vat_class'];
592
-			}
593
-
594
-			echo wpinv_html_select(
595
-				array(
596
-					'options'          => array_merge(
597
-						array(
598
-							'' => __( 'All VAT classes', 'invoicing' )
599
-						),
600
-						$vat_classes
601
-					),
602
-					'name'             => 'vat_class',
603
-					'id'               => 'vat_class',
604
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
605
-					'show_option_all'  => false,
606
-					'show_option_none' => false,
607
-				)
608
-			);
609
-
610
-		}
611
-
612
-		// Filter by item type.
613
-		$type   = '';
614
-		if ( isset( $_GET['type'] ) ) {
615
-			$type   =  $_GET['type'];
616
-		}
617
-
618
-		echo wpinv_html_select(
619
-			array(
620
-				'options'          => array_merge(
621
-					array(
622
-						'' => __( 'All item types', 'invoicing' )
623
-					),
624
-					wpinv_get_item_types()
625
-				),
626
-				'name'             => 'type',
627
-				'id'               => 'type',
628
-				'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
629
-				'show_option_all'  => false,
630
-				'show_option_none' => false,
631
-			)
632
-		);
633
-
634
-	}
635
-
636
-	/**
637
-	 * Filters the item query.
638
-	 */
639
-	public static function filter_item_query( $query ) {
640
-
641
-		// modify the query only if it admin and main query.
642
-		if ( ! ( is_admin() && $query->is_main_query() ) ){ 
643
-			return $query;
644
-		}
645
-
646
-		// we want to modify the query for our items.
647
-		if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ){
648
-			return $query;
649
-		}
650
-
651
-		if ( empty( $query->query_vars['meta_query'] ) ) {
652
-			$query->query_vars['meta_query'] = array();
653
-		}
654
-
655
-		// Filter vat rule type
587
+            // Sanitize selected vat rule.
588
+            $vat_class   = '';
589
+            $vat_classes = getpaid_get_tax_classes();
590
+            if ( isset( $_GET['vat_class'] ) ) {
591
+                $vat_class   =  $_GET['vat_class'];
592
+            }
593
+
594
+            echo wpinv_html_select(
595
+                array(
596
+                    'options'          => array_merge(
597
+                        array(
598
+                            '' => __( 'All VAT classes', 'invoicing' )
599
+                        ),
600
+                        $vat_classes
601
+                    ),
602
+                    'name'             => 'vat_class',
603
+                    'id'               => 'vat_class',
604
+                    'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
605
+                    'show_option_all'  => false,
606
+                    'show_option_none' => false,
607
+                )
608
+            );
609
+
610
+        }
611
+
612
+        // Filter by item type.
613
+        $type   = '';
614
+        if ( isset( $_GET['type'] ) ) {
615
+            $type   =  $_GET['type'];
616
+        }
617
+
618
+        echo wpinv_html_select(
619
+            array(
620
+                'options'          => array_merge(
621
+                    array(
622
+                        '' => __( 'All item types', 'invoicing' )
623
+                    ),
624
+                    wpinv_get_item_types()
625
+                ),
626
+                'name'             => 'type',
627
+                'id'               => 'type',
628
+                'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
629
+                'show_option_all'  => false,
630
+                'show_option_none' => false,
631
+            )
632
+        );
633
+
634
+    }
635
+
636
+    /**
637
+     * Filters the item query.
638
+     */
639
+    public static function filter_item_query( $query ) {
640
+
641
+        // modify the query only if it admin and main query.
642
+        if ( ! ( is_admin() && $query->is_main_query() ) ){ 
643
+            return $query;
644
+        }
645
+
646
+        // we want to modify the query for our items.
647
+        if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ){
648
+            return $query;
649
+        }
650
+
651
+        if ( empty( $query->query_vars['meta_query'] ) ) {
652
+            $query->query_vars['meta_query'] = array();
653
+        }
654
+
655
+        // Filter vat rule type
656 656
         if ( ! empty( $_GET['vat_rule'] ) ) {
657 657
             $query->query_vars['meta_query'][] = array(
658 658
                 'key'     => '_wpinv_vat_rule',
@@ -677,94 +677,94 @@  discard block
 block discarded – undo
677 677
                 'value'   => sanitize_text_field( $_GET['type'] ),
678 678
                 'compare' => '='
679 679
             );
680
-		}
681
-
682
-	}
683
-
684
-	/**
685
-	 * Reorders items.
686
-	 */
687
-	public static function reorder_items( $vars ) {
688
-		global $typenow;
689
-
690
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
691
-			return $vars;
692
-		}
693
-
694
-		// By item type.
695
-		if ( 'type' == $vars['orderby'] ) {
696
-			return array_merge(
697
-				$vars,
698
-				array(
699
-					'meta_key' => '_wpinv_type',
700
-					'orderby'  => 'meta_value'
701
-				)
702
-			);
703
-		}
704
-
705
-		// By vat class.
706
-		if ( 'vat_class' == $vars['orderby'] ) {
707
-			return array_merge(
708
-				$vars,
709
-				array(
710
-					'meta_key' => '_wpinv_vat_class',
711
-					'orderby'  => 'meta_value'
712
-				)
713
-			);
714
-		}
715
-
716
-		// By vat rule.
717
-		if ( 'vat_rule' == $vars['orderby'] ) {
718
-			return array_merge(
719
-				$vars,
720
-				array(
721
-					'meta_key' => '_wpinv_vat_rule',
722
-					'orderby'  => 'meta_value'
723
-				)
724
-			);
725
-		}
726
-
727
-		// By price.
728
-		if ( 'price' == $vars['orderby'] ) {
729
-			return array_merge(
730
-				$vars,
731
-				array(
732
-					'meta_key' => '_wpinv_price',
733
-					'orderby'  => 'meta_value_num'
734
-				)
735
-			);
736
-		}
737
-
738
-		return $vars;
739
-
740
-	}
741
-
742
-	/**
743
-	 * Fired when deleting a post.
744
-	 */
745
-	public static function delete_post( $post_id ) {
746
-
747
-		switch ( get_post_type( $post_id ) ) {
748
-
749
-			case 'wpi_item' :
750
-				do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
751
-				break;
752
-
753
-			case 'wpi_payment_form' :
754
-				do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
755
-				break;
756
-
757
-			case 'wpi_discount' :
758
-				do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
759
-				break;
760
-
761
-			case 'wpi_invoice' :
762
-				$invoice = new WPInv_Invoice( $post_id );
763
-				do_action( "getpaid_before_delete_invoice", $invoice );
764
-				$invoice->get_data_store()->delete_items( $invoice );
765
-				$invoice->get_data_store()->delete_special_fields( $invoice );
766
-				break;
767
-		}
768
-	}
680
+        }
681
+
682
+    }
683
+
684
+    /**
685
+     * Reorders items.
686
+     */
687
+    public static function reorder_items( $vars ) {
688
+        global $typenow;
689
+
690
+        if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
691
+            return $vars;
692
+        }
693
+
694
+        // By item type.
695
+        if ( 'type' == $vars['orderby'] ) {
696
+            return array_merge(
697
+                $vars,
698
+                array(
699
+                    'meta_key' => '_wpinv_type',
700
+                    'orderby'  => 'meta_value'
701
+                )
702
+            );
703
+        }
704
+
705
+        // By vat class.
706
+        if ( 'vat_class' == $vars['orderby'] ) {
707
+            return array_merge(
708
+                $vars,
709
+                array(
710
+                    'meta_key' => '_wpinv_vat_class',
711
+                    'orderby'  => 'meta_value'
712
+                )
713
+            );
714
+        }
715
+
716
+        // By vat rule.
717
+        if ( 'vat_rule' == $vars['orderby'] ) {
718
+            return array_merge(
719
+                $vars,
720
+                array(
721
+                    'meta_key' => '_wpinv_vat_rule',
722
+                    'orderby'  => 'meta_value'
723
+                )
724
+            );
725
+        }
726
+
727
+        // By price.
728
+        if ( 'price' == $vars['orderby'] ) {
729
+            return array_merge(
730
+                $vars,
731
+                array(
732
+                    'meta_key' => '_wpinv_price',
733
+                    'orderby'  => 'meta_value_num'
734
+                )
735
+            );
736
+        }
737
+
738
+        return $vars;
739
+
740
+    }
741
+
742
+    /**
743
+     * Fired when deleting a post.
744
+     */
745
+    public static function delete_post( $post_id ) {
746
+
747
+        switch ( get_post_type( $post_id ) ) {
748
+
749
+            case 'wpi_item' :
750
+                do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
751
+                break;
752
+
753
+            case 'wpi_payment_form' :
754
+                do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
755
+                break;
756
+
757
+            case 'wpi_discount' :
758
+                do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
759
+                break;
760
+
761
+            case 'wpi_invoice' :
762
+                $invoice = new WPInv_Invoice( $post_id );
763
+                do_action( "getpaid_before_delete_invoice", $invoice );
764
+                $invoice->get_data_store()->delete_items( $invoice );
765
+                $invoice->get_data_store()->delete_special_fields( $invoice );
766
+                break;
767
+        }
768
+    }
769 769
 
770 770
 }
Please login to merge, or discard this patch.
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Post types Admin Class
@@ -21,70 +21,70 @@  discard block
 block discarded – undo
21 21
 		GetPaid_Metaboxes::init();
22 22
 
23 23
 		// Filter the post updated messages.
24
-		add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
24
+		add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages');
25 25
 
26 26
 		// Filter post actions.
27
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
27
+		add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2);
28
+		add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2);
29 29
 
30 30
 		// Invoice table columns.
31
-		add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
-		add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
31
+		add_filter('manage_wpi_invoice_posts_columns', array(__CLASS__, 'invoice_columns'), 100);
32
+		add_action('manage_wpi_invoice_posts_custom_column', array(__CLASS__, 'display_invoice_columns'), 10, 2);
33 33
 
34 34
 		// Items table columns.
35
-		add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
36
-		add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
37
-		add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
38
-		add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
39
-		add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
40
-		add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
35
+		add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100);
36
+		add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20);
37
+		add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2);
38
+		add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100);
39
+		add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100);
40
+		add_action('request', array(__CLASS__, 'reorder_items'), 100);
41 41
 
42 42
 		// Payment forms columns.
43
-		add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
44
-		add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
45
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
43
+		add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100);
44
+		add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2);
45
+		add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2);
46 46
 
47 47
 		// Discount table columns.
48
-		add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
49
-		add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
48
+		add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100);
49
+		add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100);
50 50
 
51 51
 		// Deleting posts.
52
-		add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
53
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
52
+		add_action('delete_post', array(__CLASS__, 'delete_post'));
53
+		add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2);
54 54
 	}
55 55
 
56 56
 	/**
57 57
 	 * Post updated messages.
58 58
 	 */
59
-	public static function post_updated_messages( $messages ) {
59
+	public static function post_updated_messages($messages) {
60 60
 		global $post;
61 61
 
62 62
 		$messages['wpi_discount'] = array(
63 63
 			0   => '',
64
-			1   => __( 'Discount updated.', 'invoicing' ),
65
-			2   => __( 'Custom field updated.', 'invoicing' ),
66
-			3   => __( 'Custom field deleted.', 'invoicing' ),
67
-			4   => __( 'Discount updated.', 'invoicing' ),
68
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
69
-			6   => __( 'Discount updated.', 'invoicing' ),
70
-			7   => __( 'Discount saved.', 'invoicing' ),
71
-			8   => __( 'Discount submitted.', 'invoicing' ),
72
-			9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
73
-			10  => __( 'Discount draft updated.', 'invoicing' ),
64
+			1   => __('Discount updated.', 'invoicing'),
65
+			2   => __('Custom field updated.', 'invoicing'),
66
+			3   => __('Custom field deleted.', 'invoicing'),
67
+			4   => __('Discount updated.', 'invoicing'),
68
+			5   => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
69
+			6   => __('Discount updated.', 'invoicing'),
70
+			7   => __('Discount saved.', 'invoicing'),
71
+			8   => __('Discount submitted.', 'invoicing'),
72
+			9   => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
73
+			10  => __('Discount draft updated.', 'invoicing'),
74 74
 		);
75 75
 
76 76
 		$messages['wpi_payment_form'] = array(
77 77
 			0   => '',
78
-			1   => __( 'Payment Form updated.', 'invoicing' ),
79
-			2   => __( 'Custom field updated.', 'invoicing' ),
80
-			3   => __( 'Custom field deleted.', 'invoicing' ),
81
-			4   => __( 'Payment Form updated.', 'invoicing' ),
82
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
83
-			6   => __( 'Payment Form updated.', 'invoicing' ),
84
-			7   => __( 'Payment Form saved.', 'invoicing' ),
85
-			8   => __( 'Payment Form submitted.', 'invoicing' ),
86
-			9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
87
-			10  => __( 'Payment Form draft updated.', 'invoicing' ),
78
+			1   => __('Payment Form updated.', 'invoicing'),
79
+			2   => __('Custom field updated.', 'invoicing'),
80
+			3   => __('Custom field deleted.', 'invoicing'),
81
+			4   => __('Payment Form updated.', 'invoicing'),
82
+			5   => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
83
+			6   => __('Payment Form updated.', 'invoicing'),
84
+			7   => __('Payment Form saved.', 'invoicing'),
85
+			8   => __('Payment Form submitted.', 'invoicing'),
86
+			9   => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
87
+			10  => __('Payment Form draft updated.', 'invoicing'),
88 88
 		);
89 89
 
90 90
 		return $messages;
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 	/**
95 95
 	 * Post row actions.
96 96
 	 */
97
-	public static function post_row_actions( $actions, $post ) {
97
+	public static function post_row_actions($actions, $post) {
98 98
 
99
-		$post = get_post( $post );
99
+		$post = get_post($post);
100 100
 
101 101
 		// We do not want to edit the default payment form.
102
-		if ( 'wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form() ) {
103
-			unset( $actions['trash'] );
104
-			unset( $actions['inline hide-if-no-js'] );
102
+		if ('wpi_payment_form' == $post->post_type && $post->ID == wpinv_get_default_payment_form()) {
103
+			unset($actions['trash']);
104
+			unset($actions['inline hide-if-no-js']);
105 105
 		}
106 106
 
107 107
 		return $actions;
@@ -115,31 +115,31 @@  discard block
 block discarded – undo
115 115
 	 * @param WP_Post $post
116 116
      * @return array $actions actions without edit option
117 117
      */
118
-    public static function filter_invoice_row_actions( $actions, $post ) {
118
+    public static function filter_invoice_row_actions($actions, $post) {
119 119
 
120
-        if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
120
+        if (getpaid_is_invoice_post_type($post->post_type)) {
121 121
 
122 122
 			$actions = array();
123
-			$invoice = new WPInv_Invoice( $post );
123
+			$invoice = new WPInv_Invoice($post);
124 124
 
125
-			$actions['edit'] =  sprintf(
125
+			$actions['edit'] = sprintf(
126 126
 				'<a href="%1$s">%2$s</a>',
127
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
128
-				esc_html( __( 'Edit', 'invoicing' ) )
127
+				esc_url(get_edit_post_link($invoice->get_id())),
128
+				esc_html(__('Edit', 'invoicing'))
129 129
 			);
130 130
 
131
-			if ( ! $invoice->is_draft() ) {
131
+			if (!$invoice->is_draft()) {
132 132
 
133
-				$actions['view'] =  sprintf(
133
+				$actions['view'] = sprintf(
134 134
 					'<a href="%1$s">%2$s</a>',
135
-					esc_url( $invoice->get_view_url() ),
135
+					esc_url($invoice->get_view_url()),
136 136
 					sprintf(
137
-						esc_html( __( 'View %s', 'invoicing' ) ),
138
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
137
+						esc_html(__('View %s', 'invoicing')),
138
+						getpaid_get_post_type_label($invoice->get_post_type(), false)
139 139
 					)
140 140
 				);
141 141
 
142
-				$actions['send'] =  sprintf(
142
+				$actions['send'] = sprintf(
143 143
 					'<a href="%1$s">%2$s</a>',
144 144
 					esc_url(
145 145
 						wp_nonce_url(
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 							'getpaid-nonce'
154 154
 						)
155 155
 					),
156
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
156
+					esc_html(__('Send to Customer', 'invoicing'))
157 157
 				);
158 158
 
159 159
 			}
@@ -166,42 +166,42 @@  discard block
 block discarded – undo
166 166
 	/**
167 167
 	 * Returns an array of invoice table columns.
168 168
 	 */
169
-	public static function invoice_columns( $columns ) {
169
+	public static function invoice_columns($columns) {
170 170
 
171 171
 		$columns = array(
172 172
 			'cb'                => $columns['cb'],
173
-			'number'            => __( 'Invoice', 'invoicing' ),
174
-			'customer'          => __( 'Customer', 'invoicing' ),
175
-			'invoice_date'      => __( 'Created', 'invoicing' ),
176
-			'payment_date'      => __( 'Completed', 'invoicing' ),
177
-			'amount'            => __( 'Amount', 'invoicing' ),
178
-			'recurring'         => __( 'Recurring', 'invoicing' ),
179
-			'status'            => __( 'Status', 'invoicing' ),
173
+			'number'            => __('Invoice', 'invoicing'),
174
+			'customer'          => __('Customer', 'invoicing'),
175
+			'invoice_date'      => __('Created', 'invoicing'),
176
+			'payment_date'      => __('Completed', 'invoicing'),
177
+			'amount'            => __('Amount', 'invoicing'),
178
+			'recurring'         => __('Recurring', 'invoicing'),
179
+			'status'            => __('Status', 'invoicing'),
180 180
 		);
181 181
 
182
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
182
+		return apply_filters('wpi_invoice_table_columns', $columns);
183 183
 	}
184 184
 
185 185
 	/**
186 186
 	 * Displays invoice table columns.
187 187
 	 */
188
-	public static function display_invoice_columns( $column_name, $post_id ) {
188
+	public static function display_invoice_columns($column_name, $post_id) {
189 189
 
190
-		$invoice = new WPInv_Invoice( $post_id );
190
+		$invoice = new WPInv_Invoice($post_id);
191 191
 
192
-		switch ( $column_name ) {
192
+		switch ($column_name) {
193 193
 
194 194
 			case 'invoice_date' :
195
-				$date_time = esc_attr( $invoice->get_created_date() );
196
-				$date      = getpaid_format_date_value( $date_time, "&mdash;", true );
195
+				$date_time = esc_attr($invoice->get_created_date());
196
+				$date      = getpaid_format_date_value($date_time, "&mdash;", true);
197 197
 				echo "<span title='$date_time'>$date</span>";
198 198
 				break;
199 199
 
200 200
 			case 'payment_date' :
201 201
 
202
-				if ( $invoice->is_paid() ) {
203
-					$date_time = esc_attr( $invoice->get_completed_date() );
204
-					$date      = getpaid_format_date_value( $date_time, "&mdash;", true );
202
+				if ($invoice->is_paid()) {
203
+					$date_time = esc_attr($invoice->get_completed_date());
204
+					$date      = getpaid_format_date_value($date_time, "&mdash;", true);
205 205
 					echo "<span title='$date_time'>$date</span>";
206 206
 				} else {
207 207
 					echo "&mdash;";
@@ -212,17 +212,17 @@  discard block
 block discarded – undo
212 212
 			case 'amount' :
213 213
 
214 214
 				$amount = $invoice->get_total();
215
-				$formated_amount = wpinv_price( $amount, $invoice->get_currency() );
215
+				$formated_amount = wpinv_price($amount, $invoice->get_currency());
216 216
 
217
-				if ( $invoice->is_refunded() ) {
218
-					$refunded_amount = wpinv_price( 0, $invoice->get_currency() );
217
+				if ($invoice->is_refunded()) {
218
+					$refunded_amount = wpinv_price(0, $invoice->get_currency());
219 219
 					echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
220 220
 				} else {
221 221
 
222 222
 					$discount = $invoice->get_total_discount();
223 223
 
224
-					if ( ! empty( $discount ) ) {
225
-						$new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() );
224
+					if (!empty($discount)) {
225
+						$new_amount = wpinv_price($amount + $discount, $invoice->get_currency());
226 226
 						echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
227 227
 					} else {
228 228
 						echo $formated_amount;
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
 				break;
234 234
 
235 235
 			case 'status' :
236
-				$status       = sanitize_text_field( $invoice->get_status() );
237
-				$status_label = sanitize_text_field( $invoice->get_status_nicename() );
236
+				$status       = sanitize_text_field($invoice->get_status());
237
+				$status_label = sanitize_text_field($invoice->get_status_nicename());
238 238
 
239 239
 				// If it is paid, show the gateway title.
240
-				if ( $invoice->is_paid() ) {
241
-					$gateway = sanitize_text_field( $invoice->get_gateway_title() );
242
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
240
+				if ($invoice->is_paid()) {
241
+					$gateway = sanitize_text_field($invoice->get_gateway_title());
242
+					$gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), $gateway);
243 243
 
244 244
 					echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
245 245
 				} else {
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
 				}
248 248
 
249 249
 				// If it is not paid, display the overdue and view status.
250
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
250
+				if (!$invoice->is_paid() && !$invoice->is_refunded()) {
251 251
 
252 252
 					// Invoice view status.
253
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
254
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
253
+					if (wpinv_is_invoice_viewed($invoice->get_id())) {
254
+						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>';
255 255
 					} else {
256
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
256
+						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>';
257 257
 					}
258 258
 
259 259
 					// Display the overview status.
260
-					if ( wpinv_get_option( 'overdue_active' ) ) {
260
+					if (wpinv_get_option('overdue_active')) {
261 261
 						$due_date = $invoice->get_due_date();
262
-						$fomatted = getpaid_format_date( $due_date );
262
+						$fomatted = getpaid_format_date($due_date);
263 263
 
264
-						if ( ! empty( $fomatted ) ) {
265
-							$date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
264
+						if (!empty($fomatted)) {
265
+							$date = wp_sprintf(__('Due %s', 'invoicing'), $fomatted);
266 266
 							echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
267 267
 						}
268 268
 					}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 			case 'recurring':
275 275
 
276
-				if ( $invoice->is_recurring() ) {
276
+				if ($invoice->is_recurring()) {
277 277
 					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
278 278
 				} else {
279 279
 					echo '<i class="fa fa-times" style="color:#616161;"></i>';
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 
283 283
 			case 'number' :
284 284
 
285
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
286
-				$invoice_number  = sanitize_text_field( $invoice->get_number() );
287
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
285
+				$edit_link       = esc_url(get_edit_post_link($invoice->get_id()));
286
+				$invoice_number  = sanitize_text_field($invoice->get_number());
287
+				$invoice_details = esc_attr__('View Invoice Details', 'invoicing');
288 288
 
289 289
 				echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
290 290
 
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 	
295 295
 				$customer_name = $invoice->get_user_full_name();
296 296
 	
297
-				if ( empty( $customer_name ) ) {
297
+				if (empty($customer_name)) {
298 298
 					$customer_name = $invoice->get_email();
299 299
 				}
300 300
 	
301
-				if ( ! empty( $customer_name ) ) {
302
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
303
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
301
+				if (!empty($customer_name)) {
302
+					$customer_details = esc_attr__('View Customer Details', 'invoicing');
303
+					$view_link        = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php')));
304 304
 					echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
305 305
 				} else {
306 306
 					echo '<div>&mdash;</div>';
@@ -315,50 +315,50 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * Returns an array of payment forms table columns.
317 317
 	 */
318
-	public static function payment_form_columns( $columns ) {
318
+	public static function payment_form_columns($columns) {
319 319
 
320 320
 		$columns = array(
321 321
 			'cb'                => $columns['cb'],
322
-			'title'             => __( 'Name', 'invoicing' ),
323
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
324
-			'earnings'          => __( 'Revenue', 'invoicing' ),
325
-			'refunds'           => __( 'Refunded', 'invoicing' ),
326
-			'items'             => __( 'Items', 'invoicing' ),
327
-			'date'              => __( 'Date', 'invoicing' ),
322
+			'title'             => __('Name', 'invoicing'),
323
+			'shortcode'         => __('Shortcode', 'invoicing'),
324
+			'earnings'          => __('Revenue', 'invoicing'),
325
+			'refunds'           => __('Refunded', 'invoicing'),
326
+			'items'             => __('Items', 'invoicing'),
327
+			'date'              => __('Date', 'invoicing'),
328 328
 		);
329 329
 
330
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
330
+		return apply_filters('wpi_payment_form_table_columns', $columns);
331 331
 
332 332
 	}
333 333
 
334 334
 	/**
335 335
 	 * Displays payment form table columns.
336 336
 	 */
337
-	public static function display_payment_form_columns( $column_name, $post_id ) {
337
+	public static function display_payment_form_columns($column_name, $post_id) {
338 338
 
339 339
 		// Retrieve the payment form.
340
-		$form = new GetPaid_Payment_Form( $post_id );
340
+		$form = new GetPaid_Payment_Form($post_id);
341 341
 
342
-		switch ( $column_name ) {
342
+		switch ($column_name) {
343 343
 
344 344
 			case 'earnings' :
345
-				echo wpinv_price( $form->get_earned() );
345
+				echo wpinv_price($form->get_earned());
346 346
 				break;
347 347
 
348 348
 			case 'refunds' :
349
-				echo wpinv_price( $form->get_refunded() );
349
+				echo wpinv_price($form->get_refunded());
350 350
 				break;
351 351
 
352 352
 			case 'refunds' :
353
-				echo wpinv_price( $form->get_refunded() );
353
+				echo wpinv_price($form->get_refunded());
354 354
 				break;
355 355
 
356 356
 			case 'shortcode' :
357 357
 
358
-				if ( $form->is_default() ) {
358
+				if ($form->is_default()) {
359 359
 					echo '&mdash;';
360 360
 				} else {
361
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
361
+					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>';
362 362
 				}
363 363
 
364 364
 				break;
@@ -367,29 +367,29 @@  discard block
 block discarded – undo
367 367
 
368 368
 				$items = $form->get_items();
369 369
 
370
-				if ( $form->is_default() || empty( $items ) ) {
370
+				if ($form->is_default() || empty($items)) {
371 371
 					echo '&mdash;';
372 372
 					return;
373 373
 				}
374 374
 
375 375
 				$_items = array();
376 376
 
377
-				foreach ( $items as $item ) {
377
+				foreach ($items as $item) {
378 378
 					$url = $item->get_edit_url();
379 379
 
380
-					if ( empty( $url ) ) {
381
-						$_items[] = sanitize_text_field( $item->get_name() );
380
+					if (empty($url)) {
381
+						$_items[] = sanitize_text_field($item->get_name());
382 382
 					} else {
383 383
 						$_items[] = sprintf(
384 384
 							'<a href="%s">%s</a>',
385
-							esc_url( $url ),
386
-							sanitize_text_field( $item->get_name() )
385
+							esc_url($url),
386
+							sanitize_text_field($item->get_name())
387 387
 						);
388 388
 					}
389 389
 
390 390
 				}
391 391
 
392
-				echo implode( '<br>', $_items );
392
+				echo implode('<br>', $_items);
393 393
 
394 394
 				break;
395 395
 
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 	/**
401 401
 	 * Filters post states.
402 402
 	 */
403
-	public static function filter_payment_form_state( $post_states, $post ) {
403
+	public static function filter_payment_form_state($post_states, $post) {
404 404
 
405
-		if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
406
-			$post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
405
+		if ('wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID) {
406
+			$post_states['default_form'] = __('Default Payment Form', 'invoicing');
407 407
 		}
408 408
 	
409 409
 		return $post_states;
@@ -413,35 +413,35 @@  discard block
 block discarded – undo
413 413
 	/**
414 414
 	 * Returns an array of coupon table columns.
415 415
 	 */
416
-	public static function discount_columns( $columns ) {
416
+	public static function discount_columns($columns) {
417 417
 
418 418
 		$columns = array(
419 419
 			'cb'                => $columns['cb'],
420
-			'title'             => __( 'Name', 'invoicing' ),
421
-			'code'              => __( 'Code', 'invoicing' ),
422
-			'amount'            => __( 'Amount', 'invoicing' ),
423
-			'usage'             => __( 'Usage / Limit', 'invoicing' ),
424
-			'start_date'        => __( 'Start Date', 'invoicing' ),
425
-			'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
420
+			'title'             => __('Name', 'invoicing'),
421
+			'code'              => __('Code', 'invoicing'),
422
+			'amount'            => __('Amount', 'invoicing'),
423
+			'usage'             => __('Usage / Limit', 'invoicing'),
424
+			'start_date'        => __('Start Date', 'invoicing'),
425
+			'expiry_date'       => __('Expiry Date', 'invoicing'),
426 426
 		);
427 427
 
428
-		return apply_filters( 'wpi_discount_table_columns', $columns );
428
+		return apply_filters('wpi_discount_table_columns', $columns);
429 429
 	}
430 430
 
431 431
 	/**
432 432
 	 * Filters post states.
433 433
 	 */
434
-	public static function filter_discount_state( $post_states, $post ) {
434
+	public static function filter_discount_state($post_states, $post) {
435 435
 
436
-		if ( 'wpi_discount' == $post->post_type ) {
436
+		if ('wpi_discount' == $post->post_type) {
437 437
 
438
-			$discount = new WPInv_Discount( $post );
438
+			$discount = new WPInv_Discount($post);
439 439
 
440 440
 			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
441 441
 
442
-			if ( $status != 'publish' ) {
442
+			if ($status != 'publish') {
443 443
 				return array(
444
-					'discount_status' => wpinv_discount_status( $status ),
444
+					'discount_status' => wpinv_discount_status($status),
445 445
 				);
446 446
 			}
447 447
 
@@ -456,30 +456,30 @@  discard block
 block discarded – undo
456 456
 	/**
457 457
 	 * Returns an array of items table columns.
458 458
 	 */
459
-	public static function item_columns( $columns ) {
459
+	public static function item_columns($columns) {
460 460
 
461 461
 		$columns = array(
462 462
 			'cb'                => $columns['cb'],
463
-			'title'             => __( 'Name', 'invoicing' ),
464
-			'price'             => __( 'Price', 'invoicing' ),
465
-			'vat_rule'          => __( 'VAT rule', 'invoicing' ),
466
-			'vat_class'         => __( 'VAT class', 'invoicing' ),
467
-			'type'              => __( 'Type', 'invoicing' ),
468
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
463
+			'title'             => __('Name', 'invoicing'),
464
+			'price'             => __('Price', 'invoicing'),
465
+			'vat_rule'          => __('VAT rule', 'invoicing'),
466
+			'vat_class'         => __('VAT class', 'invoicing'),
467
+			'type'              => __('Type', 'invoicing'),
468
+			'shortcode'         => __('Shortcode', 'invoicing'),
469 469
 		);
470 470
 
471
-		if ( ! wpinv_use_taxes() ) {
472
-			unset( $columns['vat_rule'] );
473
-			unset( $columns['vat_class'] );
471
+		if (!wpinv_use_taxes()) {
472
+			unset($columns['vat_rule']);
473
+			unset($columns['vat_class']);
474 474
 		}
475 475
 
476
-		return apply_filters( 'wpi_item_table_columns', $columns );
476
+		return apply_filters('wpi_item_table_columns', $columns);
477 477
 	}
478 478
 
479 479
 	/**
480 480
 	 * Returns an array of sortable items table columns.
481 481
 	 */
482
-	public static function sortable_item_columns( $columns ) {
482
+	public static function sortable_item_columns($columns) {
483 483
 
484 484
 		return array_merge(
485 485
 			$columns,
@@ -496,49 +496,49 @@  discard block
 block discarded – undo
496 496
 	/**
497 497
 	 * Displays items table columns.
498 498
 	 */
499
-	public static function display_item_columns( $column_name, $post_id ) {
499
+	public static function display_item_columns($column_name, $post_id) {
500 500
  
501
-		$item = new WPInv_Item( $post_id );
501
+		$item = new WPInv_Item($post_id);
502 502
 
503
-		switch ( $column_name ) {
503
+		switch ($column_name) {
504 504
 
505 505
 			case 'price' :
506 506
 
507
-				if ( ! $item->is_recurring() ) {
507
+				if (!$item->is_recurring()) {
508 508
 					echo $item->get_the_price();
509 509
 					break;
510 510
 				}
511 511
 
512 512
 				$price = wp_sprintf(
513
-					__( '%s / %s', 'invoicing' ),
513
+					__('%s / %s', 'invoicing'),
514 514
 					$item->get_the_price(),
515
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
515
+					getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '')
516 516
 				);
517 517
 
518
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
518
+				if ($item->get_the_price() == $item->get_the_initial_price()) {
519 519
 					echo $price;
520 520
 					break;
521 521
 				}
522 522
 
523 523
 				echo $item->get_the_initial_price();
524 524
 
525
-				echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
525
+				echo '<span class="meta">' . wp_sprintf(__('then %s', 'invoicing'), $price) . '</span>';
526 526
 				break;
527 527
 
528 528
 			case 'vat_rule' :
529
-				echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
529
+				echo getpaid_get_tax_rule_label($item->get_vat_rule());
530 530
 				break;
531 531
 
532 532
 			case 'vat_class' :
533
-				echo getpaid_get_tax_class_label( $item->get_vat_class() );
533
+				echo getpaid_get_tax_class_label($item->get_vat_class());
534 534
 				break;
535 535
 
536 536
 			case 'shortcode' :
537
-				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
537
+				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
538 538
 				break;
539 539
 
540 540
 			case 'type' :
541
-				echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
541
+				echo wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
542 542
 				break;
543 543
 
544 544
 		}
@@ -548,21 +548,21 @@  discard block
 block discarded – undo
548 548
 	/**
549 549
 	 * Lets users filter items using taxes.
550 550
 	 */
551
-	public static function add_item_filters( $post_type ) {
551
+	public static function add_item_filters($post_type) {
552 552
 
553 553
 		// Abort if we're not dealing with items.
554
-		if ( $post_type != 'wpi_item' ) {
554
+		if ($post_type != 'wpi_item') {
555 555
 			return;
556 556
 		}
557 557
 
558 558
 		// Filter by vat rules.
559
-		if ( wpinv_use_taxes() ) {
559
+		if (wpinv_use_taxes()) {
560 560
 	
561 561
 			// Sanitize selected vat rule.
562 562
 			$vat_rule   = '';
563 563
 			$vat_rules  = getpaid_get_tax_rules();
564
-			if ( isset( $_GET['vat_rule'] ) ) {
565
-				$vat_rule   =  $_GET['vat_rule'];
564
+			if (isset($_GET['vat_rule'])) {
565
+				$vat_rule = $_GET['vat_rule'];
566 566
 			}
567 567
 
568 568
 			// Filter by VAT rule.
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 				array(
571 571
 					'options'          => array_merge(
572 572
 						array(
573
-							'' => __( 'All VAT rules', 'invoicing' )
573
+							'' => __('All VAT rules', 'invoicing')
574 574
 						),
575 575
 						$vat_rules
576 576
 					),
577 577
 					'name'             => 'vat_rule',
578 578
 					'id'               => 'vat_rule',
579
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
579
+					'selected'         => in_array($vat_rule, array_keys($vat_rules)) ? $vat_rule : '',
580 580
 					'show_option_all'  => false,
581 581
 					'show_option_none' => false,
582 582
 				)
@@ -587,21 +587,21 @@  discard block
 block discarded – undo
587 587
 			// Sanitize selected vat rule.
588 588
 			$vat_class   = '';
589 589
 			$vat_classes = getpaid_get_tax_classes();
590
-			if ( isset( $_GET['vat_class'] ) ) {
591
-				$vat_class   =  $_GET['vat_class'];
590
+			if (isset($_GET['vat_class'])) {
591
+				$vat_class = $_GET['vat_class'];
592 592
 			}
593 593
 
594 594
 			echo wpinv_html_select(
595 595
 				array(
596 596
 					'options'          => array_merge(
597 597
 						array(
598
-							'' => __( 'All VAT classes', 'invoicing' )
598
+							'' => __('All VAT classes', 'invoicing')
599 599
 						),
600 600
 						$vat_classes
601 601
 					),
602 602
 					'name'             => 'vat_class',
603 603
 					'id'               => 'vat_class',
604
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
604
+					'selected'         => in_array($vat_class, array_keys($vat_classes)) ? $vat_class : '',
605 605
 					'show_option_all'  => false,
606 606
 					'show_option_none' => false,
607 607
 				)
@@ -610,22 +610,22 @@  discard block
 block discarded – undo
610 610
 		}
611 611
 
612 612
 		// Filter by item type.
613
-		$type   = '';
614
-		if ( isset( $_GET['type'] ) ) {
615
-			$type   =  $_GET['type'];
613
+		$type = '';
614
+		if (isset($_GET['type'])) {
615
+			$type = $_GET['type'];
616 616
 		}
617 617
 
618 618
 		echo wpinv_html_select(
619 619
 			array(
620 620
 				'options'          => array_merge(
621 621
 					array(
622
-						'' => __( 'All item types', 'invoicing' )
622
+						'' => __('All item types', 'invoicing')
623 623
 					),
624 624
 					wpinv_get_item_types()
625 625
 				),
626 626
 				'name'             => 'type',
627 627
 				'id'               => 'type',
628
-				'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
628
+				'selected'         => in_array($type, wpinv_item_types()) ? $type : '',
629 629
 				'show_option_all'  => false,
630 630
 				'show_option_none' => false,
631 631
 			)
@@ -636,45 +636,45 @@  discard block
 block discarded – undo
636 636
 	/**
637 637
 	 * Filters the item query.
638 638
 	 */
639
-	public static function filter_item_query( $query ) {
639
+	public static function filter_item_query($query) {
640 640
 
641 641
 		// modify the query only if it admin and main query.
642
-		if ( ! ( is_admin() && $query->is_main_query() ) ){ 
642
+		if (!(is_admin() && $query->is_main_query())) { 
643 643
 			return $query;
644 644
 		}
645 645
 
646 646
 		// we want to modify the query for our items.
647
-		if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ){
647
+		if (empty($query->query['post_type']) || 'wpi_item' != $query->query['post_type']) {
648 648
 			return $query;
649 649
 		}
650 650
 
651
-		if ( empty( $query->query_vars['meta_query'] ) ) {
651
+		if (empty($query->query_vars['meta_query'])) {
652 652
 			$query->query_vars['meta_query'] = array();
653 653
 		}
654 654
 
655 655
 		// Filter vat rule type
656
-        if ( ! empty( $_GET['vat_rule'] ) ) {
656
+        if (!empty($_GET['vat_rule'])) {
657 657
             $query->query_vars['meta_query'][] = array(
658 658
                 'key'     => '_wpinv_vat_rule',
659
-                'value'   => sanitize_text_field( $_GET['vat_rule'] ),
659
+                'value'   => sanitize_text_field($_GET['vat_rule']),
660 660
                 'compare' => '='
661 661
             );
662 662
         }
663 663
 
664 664
         // Filter vat class
665
-        if ( ! empty( $_GET['vat_class'] ) ) {
665
+        if (!empty($_GET['vat_class'])) {
666 666
             $query->query_vars['meta_query'][] = array(
667 667
                 'key'     => '_wpinv_vat_class',
668
-                'value'   => sanitize_text_field( $_GET['vat_class'] ),
668
+                'value'   => sanitize_text_field($_GET['vat_class']),
669 669
                 'compare' => '='
670 670
             );
671 671
         }
672 672
 
673 673
         // Filter item type
674
-        if ( ! empty( $_GET['type'] ) ) {
674
+        if (!empty($_GET['type'])) {
675 675
             $query->query_vars['meta_query'][] = array(
676 676
                 'key'     => '_wpinv_type',
677
-                'value'   => sanitize_text_field( $_GET['type'] ),
677
+                'value'   => sanitize_text_field($_GET['type']),
678 678
                 'compare' => '='
679 679
             );
680 680
 		}
@@ -684,15 +684,15 @@  discard block
 block discarded – undo
684 684
 	/**
685 685
 	 * Reorders items.
686 686
 	 */
687
-	public static function reorder_items( $vars ) {
687
+	public static function reorder_items($vars) {
688 688
 		global $typenow;
689 689
 
690
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
690
+		if ('wpi_item' !== $typenow || empty($vars['orderby'])) {
691 691
 			return $vars;
692 692
 		}
693 693
 
694 694
 		// By item type.
695
-		if ( 'type' == $vars['orderby'] ) {
695
+		if ('type' == $vars['orderby']) {
696 696
 			return array_merge(
697 697
 				$vars,
698 698
 				array(
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 		}
704 704
 
705 705
 		// By vat class.
706
-		if ( 'vat_class' == $vars['orderby'] ) {
706
+		if ('vat_class' == $vars['orderby']) {
707 707
 			return array_merge(
708 708
 				$vars,
709 709
 				array(
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 		}
715 715
 
716 716
 		// By vat rule.
717
-		if ( 'vat_rule' == $vars['orderby'] ) {
717
+		if ('vat_rule' == $vars['orderby']) {
718 718
 			return array_merge(
719 719
 				$vars,
720 720
 				array(
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		}
726 726
 
727 727
 		// By price.
728
-		if ( 'price' == $vars['orderby'] ) {
728
+		if ('price' == $vars['orderby']) {
729 729
 			return array_merge(
730 730
 				$vars,
731 731
 				array(
@@ -742,27 +742,27 @@  discard block
 block discarded – undo
742 742
 	/**
743 743
 	 * Fired when deleting a post.
744 744
 	 */
745
-	public static function delete_post( $post_id ) {
745
+	public static function delete_post($post_id) {
746 746
 
747
-		switch ( get_post_type( $post_id ) ) {
747
+		switch (get_post_type($post_id)) {
748 748
 
749 749
 			case 'wpi_item' :
750
-				do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
750
+				do_action("getpaid_before_delete_item", new WPInv_Item($post_id));
751 751
 				break;
752 752
 
753 753
 			case 'wpi_payment_form' :
754
-				do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
754
+				do_action("getpaid_before_delete_payment_form", new GetPaid_Payment_Form($post_id));
755 755
 				break;
756 756
 
757 757
 			case 'wpi_discount' :
758
-				do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
758
+				do_action("getpaid_before_delete_discount", new WPInv_Discount($post_id));
759 759
 				break;
760 760
 
761 761
 			case 'wpi_invoice' :
762
-				$invoice = new WPInv_Invoice( $post_id );
763
-				do_action( "getpaid_before_delete_invoice", $invoice );
764
-				$invoice->get_data_store()->delete_items( $invoice );
765
-				$invoice->get_data_store()->delete_special_fields( $invoice );
762
+				$invoice = new WPInv_Invoice($post_id);
763
+				do_action("getpaid_before_delete_invoice", $invoice);
764
+				$invoice->get_data_store()->delete_items($invoice);
765
+				$invoice->get_data_store()->delete_special_fields($invoice);
766 766
 				break;
767 767
 		}
768 768
 	}
Please login to merge, or discard this patch.
includes/user-functions.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
36 36
 
37
-	if ( current_user_can( 'manage_options' ) ) {
38
-		return 'manage_options';
39
-	};
37
+    if ( current_user_can( 'manage_options' ) ) {
38
+        return 'manage_options';
39
+    };
40 40
 
41
-	return $capalibilty;
41
+    return $capalibilty;
42 42
 }
43 43
 
44 44
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     // Prepare user values.
63 63
     $prefix = preg_replace( '/\s+/', '', $prefix );
64 64
     $prefix = empty( $prefix ) ? $email : $prefix;
65
-	$args   = array(
66
-		'user_login' => wpinv_generate_user_name( $prefix ),
67
-		'user_pass'  => wp_generate_password(),
68
-		'user_email' => $email,
65
+    $args   = array(
66
+        'user_login' => wpinv_generate_user_name( $prefix ),
67
+        'user_pass'  => wp_generate_password(),
68
+        'user_email' => $email,
69 69
         'role'       => 'subscriber',
70 70
     );
71 71
 
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 function wpinv_generate_user_name( $prefix = '' ) {
83 83
 
84 84
     // If prefix is an email, retrieve the part before the email.
85
-	$prefix = strtok( $prefix, '@' );
85
+    $prefix = strtok( $prefix, '@' );
86 86
     $prefix = trim( $prefix, '.' );
87 87
 
88
-	// Sanitize the username.
89
-	$prefix = sanitize_user( $prefix, true );
88
+    // Sanitize the username.
89
+    $prefix = sanitize_user( $prefix, true );
90 90
 
91
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
-		$prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
94
-	}
91
+    $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
+    if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
+        $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
94
+    }
95 95
 
96 96
     $username = $prefix;
97 97
     $postfix  = 2;
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GetPaid
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  *  Generates a users select dropdown.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
  * @param array $args
17 17
  * @see wp_dropdown_users
18 18
  */
19
-function wpinv_dropdown_users( $args = '' ) {
19
+function wpinv_dropdown_users($args = '') {
20 20
 
21
-    if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) {
21
+    if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) {
22 22
         $args['show'] = 'display_name_with_login';
23 23
     }
24 24
 
25
-    return wp_dropdown_users( $args );
25
+    return wp_dropdown_users($args);
26 26
 }
27 27
 
28 28
 /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  * @return string capability to check against
33 33
  * @param string $capalibilty Optional. The alternative capability to check against.
34 34
  */
35
-function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
35
+function wpinv_get_capability($capalibilty = 'manage_invoicing') {
36 36
 
37
-	if ( current_user_can( 'manage_options' ) ) {
37
+	if (current_user_can('manage_options')) {
38 38
 		return 'manage_options';
39 39
 	};
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @return bool
49 49
  */
50 50
 function wpinv_current_user_can_manage_invoicing() {
51
-    return current_user_can( wpinv_get_capability() );
51
+    return current_user_can(wpinv_get_capability());
52 52
 }
53 53
 
54 54
 /**
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
  * @since 1.0.19
58 58
  * @return int|WP_Error
59 59
  */
60
-function wpinv_create_user( $email, $prefix = '' ) {
60
+function wpinv_create_user($email, $prefix = '') {
61 61
 
62 62
     // Prepare user values.
63
-    $prefix = preg_replace( '/\s+/', '', $prefix );
64
-    $prefix = empty( $prefix ) ? $email : $prefix;
65
-	$args   = array(
66
-		'user_login' => wpinv_generate_user_name( $prefix ),
63
+    $prefix = preg_replace('/\s+/', '', $prefix);
64
+    $prefix = empty($prefix) ? $email : $prefix;
65
+	$args = array(
66
+		'user_login' => wpinv_generate_user_name($prefix),
67 67
 		'user_pass'  => wp_generate_password(),
68 68
 		'user_email' => $email,
69 69
         'role'       => 'subscriber',
70 70
     );
71 71
 
72
-    return wp_insert_user( $args );
72
+    return wp_insert_user($args);
73 73
 
74 74
 }
75 75
 
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
  * @since 1.0.19
80 80
  * @return bool|WP_User
81 81
  */
82
-function wpinv_generate_user_name( $prefix = '' ) {
82
+function wpinv_generate_user_name($prefix = '') {
83 83
 
84 84
     // If prefix is an email, retrieve the part before the email.
85
-	$prefix = strtok( $prefix, '@' );
86
-    $prefix = trim( $prefix, '.' );
85
+	$prefix = strtok($prefix, '@');
86
+    $prefix = trim($prefix, '.');
87 87
 
88 88
 	// Sanitize the username.
89
-	$prefix = sanitize_user( $prefix, true );
89
+	$prefix = sanitize_user($prefix, true);
90 90
 
91
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
-		$prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
91
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
92
+	if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) {
93
+		$prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4);
94 94
 	}
95 95
 
96 96
     $username = $prefix;
97 97
     $postfix  = 2;
98 98
 
99
-    while ( username_exists( $username ) ) {
99
+    while (username_exists($username)) {
100 100
         $username = $prefix + $postfix;
101
-        $postfix ++;
101
+        $postfix++;
102 102
     }
103 103
 
104 104
     return $username;
@@ -115,31 +115,31 @@  discard block
 block discarded – undo
115 115
     $tabs = array(
116 116
 
117 117
         'gp-invoices'   => array(
118
-            'label'     => __( 'Invoices', 'invoicing' ), // Name of the tab.
118
+            'label'     => __('Invoices', 'invoicing'), // Name of the tab.
119 119
             'content'   => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead.
120 120
             'icon'      => 'fas fa-file-invoice', // Shown on some profile plugins.
121 121
         ),
122 122
 
123 123
         'gp-subscriptions' => array(
124
-            'label'        => __( 'Subscriptions', 'invoicing' ),
124
+            'label'        => __('Subscriptions', 'invoicing'),
125 125
             'content'      => '[wpinv_subscriptions]',
126 126
             'icon'         => 'fas fa-redo',
127 127
         ),
128 128
 
129 129
         'gp-edit-address'  => array(
130
-            'label'        => __( 'Billing Address', 'invoicing' ),
130
+            'label'        => __('Billing Address', 'invoicing'),
131 131
             'callback'     => 'getpaid_display_address_edit_tab',
132 132
             'icon'         => 'fas fa-credit-card',
133 133
         ),
134 134
 
135 135
     );
136 136
 
137
-    $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs );
137
+    $tabs = apply_filters('getpaid_user_content_tabs', $tabs);
138 138
 
139 139
     // Make sure address editing is last on the list.
140
-    if ( isset( $tabs['gp-edit-address'] ) ) {
140
+    if (isset($tabs['gp-edit-address'])) {
141 141
         $address = $tabs['gp-edit-address'];
142
-        unset( $tabs['gp-edit-address'] );
142
+        unset($tabs['gp-edit-address']);
143 143
         $tabs['gp-edit-address'] = $address;
144 144
     }
145 145
 
@@ -153,19 +153,19 @@  discard block
 block discarded – undo
153 153
  * @param array $tab
154 154
  * @return array
155 155
  */
156
-function getpaid_prepare_user_content_tab( $tab ) {
156
+function getpaid_prepare_user_content_tab($tab) {
157 157
 
158
-    if ( ! empty( $tab['callback'] ) ) {
159
-        return call_user_func( $tab['callback'] );
158
+    if (!empty($tab['callback'])) {
159
+        return call_user_func($tab['callback']);
160 160
     }
161 161
 
162
-    if ( ! empty( $tab['content'] ) ) {
163
-        return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) );
162
+    if (!empty($tab['content'])) {
163
+        return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content']))))))));
164 164
     }
165 165
 
166 166
     $notice = aui()->alert(
167 167
         array(
168
-            'content'     => __( 'This tab has no content or content callback.', 'invoicing' ),
168
+            'content'     => __('This tab has no content or content callback.', 'invoicing'),
169 169
             'type'        => 'error',
170 170
         )
171 171
     );
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
  * @param string $default
182 182
  * @return array
183 183
  */
184
-function getpaid_get_tab_url( $tab, $default ) {
184
+function getpaid_get_tab_url($tab, $default) {
185 185
     global $getpaid_tab_url;
186 186
 
187
-    if ( empty( $getpaid_tab_url ) ) {
187
+    if (empty($getpaid_tab_url)) {
188 188
         return $default;
189 189
     }
190 190
 
191
-    return sprintf( $getpaid_tab_url, $tab );
191
+    return sprintf($getpaid_tab_url, $tab);
192 192
 
193 193
 }
194 194
 
@@ -208,19 +208,19 @@  discard block
 block discarded – undo
208 208
 
209 209
                 <?php
210 210
 
211
-                    foreach ( getpaid_user_address_fields() as $key => $label ) {
211
+                    foreach (getpaid_user_address_fields() as $key => $label) {
212 212
 
213 213
                         // Display the country.
214
-                        if ( 'country' == $key ) {
214
+                        if ('country' == $key) {
215 215
 
216 216
                             echo aui()->select(
217 217
                                 array(
218 218
                                     'options'     => wpinv_get_country_list(),
219
-                                    'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
220
-                                    'id'          => 'wpinv-' . sanitize_html_class( $key ),
221
-                                    'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
219
+                                    'name'        => 'getpaid_address[' . esc_attr($key) . ']',
220
+                                    'id'          => 'wpinv-' . sanitize_html_class($key),
221
+                                    'value'       => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)),
222 222
                                     'placeholder' => $label,
223
-                                    'label'       => wp_kses_post( $label ),
223
+                                    'label'       => wp_kses_post($label),
224 224
                                     'label_type'  => 'vertical',
225 225
                                     'class'       => 'getpaid-address-field',
226 226
                                 )
@@ -229,30 +229,30 @@  discard block
 block discarded – undo
229 229
                         }
230 230
 
231 231
                         // Display the state.
232
-                        else if ( 'state' == $key ) {
232
+                        else if ('state' == $key) {
233 233
 
234
-                            echo getpaid_get_states_select_markup (
235
-                                getpaid_get_user_address_field( get_current_user_id(), 'country' ),
236
-                                getpaid_get_user_address_field( get_current_user_id(), 'state' ),
234
+                            echo getpaid_get_states_select_markup(
235
+                                getpaid_get_user_address_field(get_current_user_id(), 'country'),
236
+                                getpaid_get_user_address_field(get_current_user_id(), 'state'),
237 237
                                 $label,
238 238
                                 $label,
239 239
                                 '',
240 240
                                 false,
241 241
                                 '',
242
-                                'getpaid_address[' . esc_attr( $key ) . ']'
242
+                                'getpaid_address[' . esc_attr($key) . ']'
243 243
                             );
244 244
 
245 245
                         } else {
246 246
 
247 247
                             echo aui()->input(
248 248
                                 array(
249
-                                    'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
250
-                                    'id'          => 'wpinv-' . sanitize_html_class( $key ),
249
+                                    'name'        => 'getpaid_address[' . esc_attr($key) . ']',
250
+                                    'id'          => 'wpinv-' . sanitize_html_class($key),
251 251
                                     'placeholder' => $label,
252
-                                    'label'       => wp_kses_post( $label ),
252
+                                    'label'       => wp_kses_post($label),
253 253
                                     'label_type'  => 'vertical',
254 254
                                     'type'        => 'text',
255
-                                    'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
255
+                                    'value'       => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)),
256 256
                                     'class'       => 'getpaid-address-field',
257 257
                                 )
258 258
                             );
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 
262 262
                     }
263 263
 
264
-                    do_action( 'getpaid_display_address_edit_tab' );
264
+                    do_action('getpaid_display_address_edit_tab');
265 265
 
266 266
                     echo aui()->input(
267 267
                         array(
268 268
                             'name'             => 'getpaid_profile_edit_submit_button',
269 269
                             'id'               => 'getpaid_profile_edit_submit_button',
270
-                            'value'            => __( 'Save Address', 'invoicing' ),
271
-                            'help_text'        => __( 'New invoices will use this address as the billing address.', 'invoicing' ),
270
+                            'value'            => __('Save Address', 'invoicing'),
271
+                            'help_text'        => __('New invoices will use this address as the billing address.', 'invoicing'),
272 272
                             'type'             => 'submit',
273 273
                             'class'            => 'btn btn-primary btn-block submit-button',
274 274
                         )
275 275
                     );
276 276
 
277
-                    wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' );
278
-                    getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' );
277
+                    wp_nonce_field('getpaid-nonce', 'getpaid-nonce');
278
+                    getpaid_hidden_field('getpaid-action', 'edit_billing_details');
279 279
                 ?>
280 280
 
281 281
             </form>
@@ -292,27 +292,27 @@  discard block
 block discarded – undo
292 292
  * @since 2.1.4
293 293
  * @param array $data
294 294
  */
295
-function getpaid_save_address_edit_tab( $data ) {
295
+function getpaid_save_address_edit_tab($data) {
296 296
 
297
-    if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) {
297
+    if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) {
298 298
         return;
299 299
     }
300 300
 
301 301
     $data    = $data['getpaid_address'];
302 302
     $user_id = get_current_user_id();
303 303
 
304
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
304
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
305 305
 
306
-        if ( isset( $data[ $field ] ) ) {
307
-            $value = sanitize_text_field( $data[ $field ] );
308
-            update_user_meta( $user_id, '_wpinv_' . $field, $value );
306
+        if (isset($data[$field])) {
307
+            $value = sanitize_text_field($data[$field]);
308
+            update_user_meta($user_id, '_wpinv_' . $field, $value);
309 309
         }
310 310
 
311
-        wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success');
311
+        wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success');
312 312
     }
313 313
 
314 314
 }
315
-add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' );
315
+add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab');
316 316
 
317 317
 
318 318
 /*
@@ -330,27 +330,27 @@  discard block
 block discarded – undo
330 330
  * @param  array $tabs
331 331
  * @return array
332 332
  */
333
-function getpaid_filter_userswp_account_tabs( $tabs ) {
333
+function getpaid_filter_userswp_account_tabs($tabs) {
334 334
 
335 335
     // Abort if the integration is inactive.
336
-    if ( ! getpaid_is_userswp_integration_active() ) {
336
+    if (!getpaid_is_userswp_integration_active()) {
337 337
         return $tabs;
338 338
     }
339 339
 
340
-    $new_tabs   = array();
340
+    $new_tabs = array();
341 341
 
342
-    foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) {
342
+    foreach (getpaid_get_user_content_tabs() as $slug => $tab) {
343 343
 
344
-        $new_tabs[ $slug ] = array(
345
-            'title' => $tab[ 'label'],
346
-            'icon'  =>  $tab[ 'icon'],
344
+        $new_tabs[$slug] = array(
345
+            'title' => $tab['label'],
346
+            'icon'  =>  $tab['icon'],
347 347
         );
348 348
 
349 349
     }
350 350
 
351
-    return array_merge( $tabs, $new_tabs );
351
+    return array_merge($tabs, $new_tabs);
352 352
 }
353
-add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' );
353
+add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs');
354 354
 
355 355
 /**
356 356
  * Display our UsersWP account tabs.
@@ -359,18 +359,18 @@  discard block
 block discarded – undo
359 359
  * @param  array $tabs
360 360
  * @return array
361 361
  */
362
-function getpaid_display_userswp_account_tabs( $tab ) {
362
+function getpaid_display_userswp_account_tabs($tab) {
363 363
     global $getpaid_tab_url;
364 364
 
365 365
     $our_tabs = getpaid_get_user_content_tabs();
366 366
 
367
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
368
-        $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() );
369
-        echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] );
367
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
368
+        $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url());
369
+        echo getpaid_prepare_user_content_tab($our_tabs[$tab]);
370 370
     }
371 371
 
372 372
 }
373
-add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' );
373
+add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs');
374 374
 
375 375
 
376 376
 /**
@@ -381,17 +381,17 @@  discard block
 block discarded – undo
381 381
  * @param  string $tab   Current tab.
382 382
  * @return string Title.
383 383
  */
384
-function getpaid_filter_userswp_account_title( $title, $tab ) {
384
+function getpaid_filter_userswp_account_title($title, $tab) {
385 385
 
386
-    $our_tabs   = getpaid_get_user_content_tabs();
386
+    $our_tabs = getpaid_get_user_content_tabs();
387 387
 
388
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
389
-        return $our_tabs[ $tab ]['label'];
388
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
389
+        return $our_tabs[$tab]['label'];
390 390
     }
391 391
 
392 392
     return $title;
393 393
 }
394
-add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 );
394
+add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2);
395 395
 
396 396
 /**
397 397
  * Registers the UsersWP integration settings.
@@ -400,26 +400,26 @@  discard block
 block discarded – undo
400 400
  * @param  array $settings An array of integration settings.
401 401
  * @return array
402 402
  */
403
-function getpaid_register_userswp_settings( $settings ) {
403
+function getpaid_register_userswp_settings($settings) {
404 404
 
405
-    if ( defined( 'USERSWP_PLUGIN_FILE' ) ) {
405
+    if (defined('USERSWP_PLUGIN_FILE')) {
406 406
 
407 407
         $settings[] = array(
408 408
 
409 409
             'id'       => 'userswp',
410
-            'label'    => __( 'UsersWP', 'invoicing' ),
410
+            'label'    => __('UsersWP', 'invoicing'),
411 411
             'settings' => array(
412 412
 
413 413
                 'userswp_settings' => array(
414 414
                     'id'   => 'userswp_settings',
415
-                    'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>',
415
+                    'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>',
416 416
                     'type' => 'header',
417 417
                 ),
418 418
 
419 419
                 'enable_userswp' => array(
420 420
                     'id'         => 'enable_userswp',
421
-                    'name'       => __( 'Enable Integration', 'invoicing' ),
422
-                    'desc'       => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ),
421
+                    'name'       => __('Enable Integration', 'invoicing'),
422
+                    'desc'       => __('Display GetPaid items on UsersWP account page.', 'invoicing'),
423 423
                     'type'       => 'checkbox',
424 424
                     'std'        => 1,
425 425
                 )
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
     return $settings;
434 434
 }
435
-add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' );
435
+add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings');
436 436
 
437 437
 /**
438 438
  * Checks if the integration is enabled.
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
  * @return bool
442 442
  */
443 443
 function getpaid_is_userswp_integration_active() {
444
-    $enabled = wpinv_get_option( 'enable_userswp', 1 );
445
-    return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled );
444
+    $enabled = wpinv_get_option('enable_userswp', 1);
445
+    return defined('USERSWP_PLUGIN_FILE') && !empty($enabled);
446 446
 }
447 447
 
448 448
 /*
@@ -460,26 +460,26 @@  discard block
 block discarded – undo
460 460
  * @param  array $settings An array of integration settings.
461 461
  * @return array
462 462
  */
463
-function getpaid_register_buddypress_settings( $settings ) {
463
+function getpaid_register_buddypress_settings($settings) {
464 464
 
465
-    if ( class_exists( 'BuddyPress' ) ) {
465
+    if (class_exists('BuddyPress')) {
466 466
 
467 467
         $settings[] = array(
468 468
 
469 469
             'id'       => 'buddypress',
470
-            'label'    => __( 'BuddyPress', 'invoicing' ),
470
+            'label'    => __('BuddyPress', 'invoicing'),
471 471
             'settings' => array(
472 472
 
473 473
                 'buddypress_settings' => array(
474 474
                     'id'   => 'buddypress_settings',
475
-                    'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>',
475
+                    'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>',
476 476
                     'type' => 'header',
477 477
                 ),
478 478
 
479 479
                 'enable_buddypress' => array(
480 480
                     'id'         => 'enable_buddypress',
481
-                    'name'       => __( 'Enable Integration', 'invoicing' ),
482
-                    'desc'       => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ),
481
+                    'name'       => __('Enable Integration', 'invoicing'),
482
+                    'desc'       => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'),
483 483
                     'type'       => 'checkbox',
484 484
                     'std'        => 1,
485 485
                 )
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 
493 493
     return $settings;
494 494
 }
495
-add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' );
495
+add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings');
496 496
 
497 497
 /**
498 498
  * Checks if the integration is enabled.
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
  * @return bool
502 502
  */
503 503
 function getpaid_is_buddypress_integration_active() {
504
-    $enabled = wpinv_get_option( 'enable_buddypress', 1 );
505
-    return class_exists( 'BuddyPress' ) && ! empty( $enabled );
504
+    $enabled = wpinv_get_option('enable_buddypress', 1);
505
+    return class_exists('BuddyPress') && !empty($enabled);
506 506
 }
507 507
 
508 508
 /**
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
  */
514 514
 function getpaid_setup_buddypress_integration() {
515 515
 
516
-    if ( getpaid_is_buddypress_integration_active() ) {
517
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php' );
516
+    if (getpaid_is_buddypress_integration_active()) {
517
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php');
518 518
         buddypress()->getpaid = new BP_GetPaid_Component();
519 519
     }
520 520
 
521 521
 }
522
-add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' );
522
+add_action('bp_setup_components', 'getpaid_setup_buddypress_integration');
Please login to merge, or discard this patch.
includes/admin/class-wpinv-admin-menus.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Setup menus in WP admin.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * WC_Admin_Menus Class.
@@ -13,25 +13,25 @@  discard block
 block discarded – undo
13 13
      * Hook in tabs.
14 14
      */
15 15
     public function __construct() {
16
-        add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 );
17
-        add_action( 'admin_menu', array( $this, 'add_customers_menu' ), 18 );
18
-        add_action( 'admin_menu', array( $this, 'add_subscriptions_menu' ), 40 );
19
-        add_action( 'admin_menu', array( $this, 'add_addons_menu' ), 100 );
20
-        add_action( 'admin_menu', array( $this, 'add_settings_menu' ), 60 );
21
-        add_action( 'admin_menu', array( $this, 'remove_admin_submenus' ), 10 );
22
-        add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
16
+        add_action('admin_menu', array($this, 'admin_menu'), 10);
17
+        add_action('admin_menu', array($this, 'add_customers_menu'), 18);
18
+        add_action('admin_menu', array($this, 'add_subscriptions_menu'), 40);
19
+        add_action('admin_menu', array($this, 'add_addons_menu'), 100);
20
+        add_action('admin_menu', array($this, 'add_settings_menu'), 60);
21
+        add_action('admin_menu', array($this, 'remove_admin_submenus'), 10);
22
+        add_action('admin_head-nav-menus.php', array($this, 'add_nav_menu_meta_boxes'));
23 23
     }
24 24
 
25 25
     public function admin_menu() {
26 26
 
27
-        $capability = apply_filters( 'invoicing_capability', wpinv_get_capability() );
27
+        $capability = apply_filters('invoicing_capability', wpinv_get_capability());
28 28
         add_menu_page(
29
-            __( 'GetPaid', 'invoicing' ),
30
-            __( 'GetPaid', 'invoicing' ),
29
+            __('GetPaid', 'invoicing'),
30
+            __('GetPaid', 'invoicing'),
31 31
             $capability,
32 32
             'wpinv',
33 33
             null,
34
-            'data:image/svg+xml;base64,' . base64_encode( file_get_contents( WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg' ) ),
34
+            'data:image/svg+xml;base64,' . base64_encode(file_get_contents(WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg')),
35 35
             '54.123460'
36 36
         );
37 37
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
     public function add_customers_menu() {
44 44
         add_submenu_page(
45 45
             'wpinv',
46
-            __( 'Customers', 'invoicing' ),
47
-            __( 'Customers', 'invoicing' ),
46
+            __('Customers', 'invoicing'),
47
+            __('Customers', 'invoicing'),
48 48
             wpinv_get_capability(),
49 49
             'wpinv-customers',
50
-            array( $this, 'customers_page' )
50
+            array($this, 'customers_page')
51 51
         );
52 52
     }
53 53
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     public function add_subscriptions_menu() {
58 58
         add_submenu_page(
59 59
             'wpinv',
60
-            __( 'Subscriptions', 'invoicing' ),
61
-            __( 'Subscriptions', 'invoicing' ),
60
+            __('Subscriptions', 'invoicing'),
61
+            __('Subscriptions', 'invoicing'),
62 62
             wpinv_get_capability(),
63 63
             'wpinv-subscriptions',
64 64
             'wpinv_subscriptions_page'
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * Displays the customers page.
70 70
      */
71 71
     public function customers_page() {
72
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-customers-table.php' );
72
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-customers-table.php');
73 73
         ?>
74 74
         <div class="wrap wpi-customers-wrap">
75 75
             <style>
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
                     width: 30%;
78 78
                 }
79 79
             </style>
80
-            <h1><?php echo esc_html( __( 'Customers', 'invoicing' ) ); ?></h1>
80
+            <h1><?php echo esc_html(__('Customers', 'invoicing')); ?></h1>
81 81
             <form method="post">
82 82
             <?php
83 83
                 $table = new WPInv_Customers_Table();
84 84
                 $table->prepare_items();
85
-                $table->search_box( __( 'Search Customers', 'invoicing' ), 'search-customers' );
85
+                $table->search_box(__('Search Customers', 'invoicing'), 'search-customers');
86 86
                 $table->display();
87 87
             ?>
88 88
             </form>
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
     public function add_settings_menu() {
97 97
         add_submenu_page(
98 98
             'wpinv',
99
-            __( 'Invoice Settings', 'invoicing' ),
100
-            __( 'Settings', 'invoicing' ),
101
-            apply_filters( 'invoicing_capability', wpinv_get_capability() ),
99
+            __('Invoice Settings', 'invoicing'),
100
+            __('Settings', 'invoicing'),
101
+            apply_filters('invoicing_capability', wpinv_get_capability()),
102 102
             'wpinv-settings',
103
-            array( $this, 'options_page' )
103
+            array($this, 'options_page')
104 104
         );
105 105
     }
106 106
 
107
-    public function add_addons_menu(){
108
-        if ( !apply_filters( 'wpi_show_addons_page', true ) ) {
107
+    public function add_addons_menu() {
108
+        if (!apply_filters('wpi_show_addons_page', true)) {
109 109
             return;
110 110
         }
111 111
 
@@ -115,78 +115,78 @@  discard block
 block discarded – undo
115 115
             __('Extensions', 'invoicing'),
116 116
             'manage_options',
117 117
             'wpi-addons',
118
-            array( $this, 'addons_page' )
118
+            array($this, 'addons_page')
119 119
         );
120 120
     }
121 121
 
122
-    public function addons_page(){
122
+    public function addons_page() {
123 123
         $addon_obj = new WPInv_Admin_Addons();
124 124
         $addon_obj->output();
125 125
     }
126 126
 
127 127
     function options_page() {
128
-        $page       = isset( $_GET['page'] )                ? strtolower( $_GET['page'] )               : false;
128
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
129 129
 
130
-        if ( $page !== 'wpinv-settings' ) {
130
+        if ($page !== 'wpinv-settings') {
131 131
             return;
132 132
         }
133 133
 
134 134
         $settings_tabs = wpinv_get_settings_tabs();
135 135
         $settings_tabs = empty($settings_tabs) ? array() : $settings_tabs;
136
-        $active_tab    = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $settings_tabs ) ? sanitize_text_field( $_GET['tab'] ) : 'general';
137
-        $sections      = wpinv_get_settings_tab_sections( $active_tab );
136
+        $active_tab    = isset($_GET['tab']) && array_key_exists($_GET['tab'], $settings_tabs) ? sanitize_text_field($_GET['tab']) : 'general';
137
+        $sections      = wpinv_get_settings_tab_sections($active_tab);
138 138
         $key           = 'main';
139 139
 
140
-        if ( is_array( $sections ) ) {
141
-            $key = key( $sections );
140
+        if (is_array($sections)) {
141
+            $key = key($sections);
142 142
         }
143 143
 
144
-        $registered_sections = wpinv_get_settings_tab_sections( $active_tab );
145
-        $section             = isset( $_GET['section'] ) && ! empty( $registered_sections ) && array_key_exists( $_GET['section'], $registered_sections ) ? $_GET['section'] : $key;
144
+        $registered_sections = wpinv_get_settings_tab_sections($active_tab);
145
+        $section             = isset($_GET['section']) && !empty($registered_sections) && array_key_exists($_GET['section'], $registered_sections) ? $_GET['section'] : $key;
146 146
         ob_start();
147 147
         ?>
148 148
         <div class="wrap">
149 149
             <h1 class="nav-tab-wrapper">
150 150
                 <?php
151
-                foreach( wpinv_get_settings_tabs() as $tab_id => $tab_name ) {
152
-                    $tab_url = add_query_arg( array(
151
+                foreach (wpinv_get_settings_tabs() as $tab_id => $tab_name) {
152
+                    $tab_url = add_query_arg(array(
153 153
                         'settings-updated' => false,
154 154
                         'tab' => $tab_id,
155
-                    ) );
155
+                    ));
156 156
 
157 157
                     // Remove the section from the tabs so we always end up at the main section
158
-                    $tab_url = remove_query_arg( 'section', $tab_url );
159
-                    $tab_url = remove_query_arg( 'wpi_sub', $tab_url );
158
+                    $tab_url = remove_query_arg('section', $tab_url);
159
+                    $tab_url = remove_query_arg('wpi_sub', $tab_url);
160 160
 
161 161
                     $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
162 162
 
163
-                    echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">';
164
-                    echo esc_html( $tab_name );
163
+                    echo '<a href="' . esc_url($tab_url) . '" title="' . esc_attr($tab_name) . '" class="nav-tab' . $active . '">';
164
+                    echo esc_html($tab_name);
165 165
                     echo '</a>';
166 166
                 }
167 167
                 ?>
168 168
             </h1>
169 169
             <?php
170
-            $number_of_sections = count( $sections );
170
+            $number_of_sections = count($sections);
171 171
             $number = 0;
172
-            if ( $number_of_sections > 1 ) {
172
+            if ($number_of_sections > 1) {
173 173
                 echo '<div><ul class="subsubsub">';
174
-                foreach( $sections as $section_id => $section_name ) {
174
+                foreach ($sections as $section_id => $section_name) {
175 175
                     echo '<li>';
176 176
                     $number++;
177
-                    $tab_url = add_query_arg( array(
177
+                    $tab_url = add_query_arg(array(
178 178
                         'settings-updated' => false,
179 179
                         'tab' => $active_tab,
180 180
                         'section' => $section_id
181
-                    ) );
182
-                    $tab_url = remove_query_arg( 'wpi_sub', $tab_url );
181
+                    ));
182
+                    $tab_url = remove_query_arg('wpi_sub', $tab_url);
183 183
                     $class = '';
184
-                    if ( $section == $section_id ) {
184
+                    if ($section == $section_id) {
185 185
                         $class = 'current';
186 186
                     }
187
-                    echo '<a class="' . $class . '" href="' . esc_url( $tab_url ) . '">' . $section_name . '</a>';
187
+                    echo '<a class="' . $class . '" href="' . esc_url($tab_url) . '">' . $section_name . '</a>';
188 188
 
189
-                    if ( $number != $number_of_sections ) {
189
+                    if ($number != $number_of_sections) {
190 190
                         echo ' | ';
191 191
                     }
192 192
                     echo '</li>';
@@ -198,20 +198,20 @@  discard block
 block discarded – undo
198 198
                 <form method="post" action="options.php">
199 199
                     <table class="form-table">
200 200
                         <?php
201
-                        settings_fields( 'wpinv_settings' );
201
+                        settings_fields('wpinv_settings');
202 202
 
203
-                        if ( 'main' === $section ) {
204
-                            do_action( 'wpinv_settings_tab_top', $active_tab );
203
+                        if ('main' === $section) {
204
+                            do_action('wpinv_settings_tab_top', $active_tab);
205 205
                         }
206 206
 
207
-                        do_action( 'wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section );
208
-                        do_settings_sections( 'wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section );
209
-                        do_action( 'wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section );
210
-                        do_action( 'getpaid_settings_tab_bottom', $active_tab, $section );
207
+                        do_action('wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section);
208
+                        do_settings_sections('wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section);
209
+                        do_action('wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section);
210
+                        do_action('getpaid_settings_tab_bottom', $active_tab, $section);
211 211
 
212 212
                         // For backwards compatibility
213
-                        if ( 'main' === $section ) {
214
-                            do_action( 'wpinv_settings_tab_bottom', $active_tab );
213
+                        if ('main' === $section) {
214
+                            do_action('wpinv_settings_tab_bottom', $active_tab);
215 215
                         }
216 216
                         ?>
217 217
                     </table>
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     }
226 226
 
227 227
     public function remove_admin_submenus() {
228
-        remove_submenu_page( 'edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice' );
228
+        remove_submenu_page('edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice');
229 229
     }
230 230
 
231 231
     /**
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 
236 236
         add_meta_box(
237 237
             'wpinv_endpoints_nav_link',
238
-            __( 'GetPaid endpoints', 'invoicing' ),
239
-            array( $this, 'nav_menu_links' ),
238
+            __('GetPaid endpoints', 'invoicing'),
239
+            array($this, 'nav_menu_links'),
240 240
             'nav-menus',
241 241
             'side',
242 242
             'low'
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
         $endpoints = $this->get_menu_items();
252 252
         ?>
253 253
         <div id="invoicing-endpoints" class="posttypediv">
254
-            <?php if ( ! empty( $endpoints['pages'] ) ) : ?>
254
+            <?php if (!empty($endpoints['pages'])) : ?>
255 255
                 <div id="tabs-panel-invoicing-endpoints" class="tabs-panel tabs-panel-active">
256 256
                     <ul id="invoicing-endpoints-checklist" class="categorychecklist form-no-clear">
257 257
                         <?php
258
-                            $walker = new Walker_Nav_Menu_Checklist( array() );
259
-                            echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $endpoints['pages'] ), 0, (object) array( 'walker' => $walker ) );
258
+                            $walker = new Walker_Nav_Menu_Checklist(array());
259
+                            echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $endpoints['pages']), 0, (object) array('walker' => $walker));
260 260
                         ?>
261 261
                     </ul>
262 262
                 </div>
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
             <p class="button-controls wp-clearfix" data-items-type="invoicing-endpoints">
266 266
                 <span class="list-controls hide-if-no-js">
267 267
                     <input type="checkbox" id="invoicing-endpoints-tab" class="select-all">
268
-                    <label for="invoicing-endpoints-tab"><?php _e( 'Select all', 'invoicing' ); ?></label>
268
+                    <label for="invoicing-endpoints-tab"><?php _e('Select all', 'invoicing'); ?></label>
269 269
                 </span>
270 270
 
271 271
                 <span class="add-to-menu">
272
-                    <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'invoicing' ); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints">
272
+                    <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e('Add to menu', 'invoicing'); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints">
273 273
                     <span class="spinner"></span>
274 274
                 </span>
275 275
             </p>
@@ -282,35 +282,35 @@  discard block
 block discarded – undo
282 282
      *
283 283
      * @return array.
284 284
      */
285
-    public function get_menu_items(){
285
+    public function get_menu_items() {
286 286
         $items = array();
287 287
 
288 288
         $pages = array(
289 289
             array(
290
-                'id'    => wpinv_get_option( 'invoice_history_page' ),
291
-                'label' => __( 'My Invoices', 'invoicing' ),
290
+                'id'    => wpinv_get_option('invoice_history_page'),
291
+                'label' => __('My Invoices', 'invoicing'),
292 292
             ),
293 293
             array(
294
-                'id'    => wpinv_get_option( 'invoice_subscription_page' ),
295
-                'label' => __( 'My Subscriptions', 'invoicing' ),
294
+                'id'    => wpinv_get_option('invoice_subscription_page'),
295
+                'label' => __('My Subscriptions', 'invoicing'),
296 296
             )
297 297
         );
298 298
 
299
-        foreach ( apply_filters( 'getpaid_menu_pages', $pages ) as $page ) {
299
+        foreach (apply_filters('getpaid_menu_pages', $pages) as $page) {
300 300
 
301
-            if ( (int) $page['id'] > 0 ) {
301
+            if ((int) $page['id'] > 0) {
302 302
 
303 303
                 $item                   = new stdClass();
304 304
                 $item->object_id        = (int) $page['id'];
305 305
                 $item->db_id            = 0;
306
-                $item->object           =  'page';
306
+                $item->object           = 'page';
307 307
                 $item->menu_item_parent = 0;
308 308
                 $item->type             = 'post_type';
309
-                $item->title            = sanitize_text_field( $page['label'] );
310
-                $item->url              = get_permalink( (int) $page['id'] );
309
+                $item->title            = sanitize_text_field($page['label']);
310
+                $item->url              = get_permalink((int) $page['id']);
311 311
                 $item->target           = '';
312 312
                 $item->attr_title       = '';
313
-                $item->classes          = array( 'wpinv-menu-item' );
313
+                $item->classes          = array('wpinv-menu-item');
314 314
                 $item->xfn              = '';
315 315
 
316 316
                 $items['pages'][]       = $item;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
         }
321 321
 
322
-        return apply_filters( 'wpinv_menu_items', $items );
322
+        return apply_filters('wpinv_menu_items', $items);
323 323
     }
324 324
 
325 325
 }
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-bank-transfer-gateway.php 2 patches
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22
-	/**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	protected $supports = array( 'addons' );
22
+    /**
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27
+    protected $supports = array( 'addons' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 8;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 8;
35 35
 
36 36
     /**
37
-	 * Class constructor.
38
-	 */
39
-	public function __construct() {
37
+     * Class constructor.
38
+     */
39
+    public function __construct() {
40 40
         parent::__construct();
41 41
 
42 42
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45 45
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
47
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
+        add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51 51
 
52 52
     }
53 53
 
54 54
     /**
55
-	 * Process Payment.
56
-	 *
57
-	 *
58
-	 * @param WPInv_Invoice $invoice Invoice.
59
-	 * @param array $submission_data Posted checkout fields.
60
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61
-	 * @return array
62
-	 */
63
-	public function process_payment( $invoice, $submission_data, $submission ) {
55
+     * Process Payment.
56
+     *
57
+     *
58
+     * @param WPInv_Invoice $invoice Invoice.
59
+     * @param array $submission_data Posted checkout fields.
60
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61
+     * @return array
62
+     */
63
+    public function process_payment( $invoice, $submission_data, $submission ) {
64 64
 
65 65
         // Add a transaction id.
66 66
         $invoice->set_transaction_id( $invoice->generate_key('trans_') );
@@ -81,66 +81,66 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
     /**
84
-	 * Output for the order received page.
85
-	 *
86
-	 * @param WPInv_Invoice $invoice Invoice.
87
-	 */
88
-	public function thankyou_page( $invoice ) {
84
+     * Output for the order received page.
85
+     *
86
+     * @param WPInv_Invoice $invoice Invoice.
87
+     */
88
+    public function thankyou_page( $invoice ) {
89 89
 
90 90
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
91 91
 
92
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
92
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93 93
 
94 94
             if ( ! empty( $this->instructions ) ) {
95 95
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
96
-			}
96
+            }
97 97
 
98
-			$this->bank_details( $invoice );
98
+            $this->bank_details( $invoice );
99 99
 
100
-			echo '</div>';
100
+            echo '</div>';
101 101
 
102 102
         }
103 103
 
104
-	}
104
+    }
105 105
 
106 106
     /**
107
-	 * Add content to the WPI emails.
108
-	 *
109
-	 * @param WPInv_Invoice $invoice Invoice.
110
-	 * @param string     $email_type Email format: plain text or HTML.
111
-	 * @param bool     $sent_to_admin Sent to admin.
112
-	 */
113
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
107
+     * Add content to the WPI emails.
108
+     *
109
+     * @param WPInv_Invoice $invoice Invoice.
110
+     * @param string     $email_type Email format: plain text or HTML.
111
+     * @param bool     $sent_to_admin Sent to admin.
112
+     */
113
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
114 114
 
115
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
115
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116 116
 
117
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
117
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118 118
 
119
-			if ( $this->instructions ) {
120
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
119
+            if ( $this->instructions ) {
120
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
121 121
             }
122 122
 
123
-			$this->bank_details( $invoice );
123
+            $this->bank_details( $invoice );
124 124
 			
125
-			echo '</div>';
125
+            echo '</div>';
126 126
 
127
-		}
127
+        }
128 128
 
129 129
     }
130 130
     
131 131
     /**
132
-	 * Get bank details and place into a list format.
133
-	 *
134
-	 * @param WPInv_Invoice $invoice Invoice.
135
-	 */
136
-	protected function bank_details( $invoice ) {
132
+     * Get bank details and place into a list format.
133
+     *
134
+     * @param WPInv_Invoice $invoice Invoice.
135
+     */
136
+    protected function bank_details( $invoice ) {
137 137
 
138
-		// Get the invoice country and country $locale.
139
-		$country = $invoice->get_country();
140
-		$locale  = $this->get_country_locale();
138
+        // Get the invoice country and country $locale.
139
+        $country = $invoice->get_country();
140
+        $locale  = $this->get_country_locale();
141 141
 
142
-		// Get sortcode label in the $locale array and use appropriate one.
143
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
142
+        // Get sortcode label in the $locale array and use appropriate one.
143
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
144 144
 
145 145
         $bank_fields = array(
146 146
             'ac_name'     => __( 'Account Name', 'invoicing' ),
@@ -169,144 +169,144 @@  discard block
 block discarded – undo
169 169
             return;
170 170
         }
171 171
 
172
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
172
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
173 173
 
174
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
174
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
175 175
 
176
-		foreach ( $bank_info as $key => $data ) {
176
+        foreach ( $bank_info as $key => $data ) {
177 177
 
178
-			$key   = sanitize_html_class( $key );
179
-			$label = wp_kses_post( $data['label'] );
180
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
178
+            $key   = sanitize_html_class( $key );
179
+            $label = wp_kses_post( $data['label'] );
180
+            $value = wp_kses_post( wptexturize( $data['value'] ) );
181 181
 
182
-			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183
-		}
182
+            echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183
+        }
184 184
 
185
-		echo '</table>';
185
+        echo '</table>';
186 186
 
187 187
     }
188 188
     
189 189
     /**
190
-	 * Get country locale if localized.
191
-	 *
192
-	 * @return array
193
-	 */
194
-	public function get_country_locale() {
195
-
196
-		if ( empty( $this->locale ) ) {
197
-
198
-			// Locale information to be used - only those that are not 'Sort Code'.
199
-			$this->locale = apply_filters(
200
-				'getpaid_get_bank_transfer_locale',
201
-				array(
202
-					'AU' => array(
203
-						'sortcode' => array(
204
-							'label' => __( 'BSB', 'invoicing' ),
205
-						),
206
-					),
207
-					'CA' => array(
208
-						'sortcode' => array(
209
-							'label' => __( 'Bank transit number', 'invoicing' ),
210
-						),
211
-					),
212
-					'IN' => array(
213
-						'sortcode' => array(
214
-							'label' => __( 'IFSC', 'invoicing' ),
215
-						),
216
-					),
217
-					'IT' => array(
218
-						'sortcode' => array(
219
-							'label' => __( 'Branch sort', 'invoicing' ),
220
-						),
221
-					),
222
-					'NZ' => array(
223
-						'sortcode' => array(
224
-							'label' => __( 'Bank code', 'invoicing' ),
225
-						),
226
-					),
227
-					'SE' => array(
228
-						'sortcode' => array(
229
-							'label' => __( 'Bank code', 'invoicing' ),
230
-						),
231
-					),
232
-					'US' => array(
233
-						'sortcode' => array(
234
-							'label' => __( 'Routing number', 'invoicing' ),
235
-						),
236
-					),
237
-					'ZA' => array(
238
-						'sortcode' => array(
239
-							'label' => __( 'Branch code', 'invoicing' ),
240
-						),
241
-					),
242
-				)
243
-			);
244
-
245
-		}
246
-
247
-		return $this->locale;
248
-
249
-	}
250
-
251
-	/**
252
-	 * Filters the gateway settings.
253
-	 * 
254
-	 * @param array $admin_settings
255
-	 */
256
-	public function admin_settings( $admin_settings ) {
190
+     * Get country locale if localized.
191
+     *
192
+     * @return array
193
+     */
194
+    public function get_country_locale() {
195
+
196
+        if ( empty( $this->locale ) ) {
197
+
198
+            // Locale information to be used - only those that are not 'Sort Code'.
199
+            $this->locale = apply_filters(
200
+                'getpaid_get_bank_transfer_locale',
201
+                array(
202
+                    'AU' => array(
203
+                        'sortcode' => array(
204
+                            'label' => __( 'BSB', 'invoicing' ),
205
+                        ),
206
+                    ),
207
+                    'CA' => array(
208
+                        'sortcode' => array(
209
+                            'label' => __( 'Bank transit number', 'invoicing' ),
210
+                        ),
211
+                    ),
212
+                    'IN' => array(
213
+                        'sortcode' => array(
214
+                            'label' => __( 'IFSC', 'invoicing' ),
215
+                        ),
216
+                    ),
217
+                    'IT' => array(
218
+                        'sortcode' => array(
219
+                            'label' => __( 'Branch sort', 'invoicing' ),
220
+                        ),
221
+                    ),
222
+                    'NZ' => array(
223
+                        'sortcode' => array(
224
+                            'label' => __( 'Bank code', 'invoicing' ),
225
+                        ),
226
+                    ),
227
+                    'SE' => array(
228
+                        'sortcode' => array(
229
+                            'label' => __( 'Bank code', 'invoicing' ),
230
+                        ),
231
+                    ),
232
+                    'US' => array(
233
+                        'sortcode' => array(
234
+                            'label' => __( 'Routing number', 'invoicing' ),
235
+                        ),
236
+                    ),
237
+                    'ZA' => array(
238
+                        'sortcode' => array(
239
+                            'label' => __( 'Branch code', 'invoicing' ),
240
+                        ),
241
+                    ),
242
+                )
243
+            );
244
+
245
+        }
246
+
247
+        return $this->locale;
248
+
249
+    }
250
+
251
+    /**
252
+     * Filters the gateway settings.
253
+     * 
254
+     * @param array $admin_settings
255
+     */
256
+    public function admin_settings( $admin_settings ) {
257 257
 
258 258
         $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
259
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
259
+        $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
260 260
 
261
-		$locale  = $this->get_country_locale();
261
+        $locale  = $this->get_country_locale();
262 262
 
263
-		// Get sortcode label in the $locale array and use appropriate one.
264
-		$country  = wpinv_default_billing_country();
265
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
263
+        // Get sortcode label in the $locale array and use appropriate one.
264
+        $country  = wpinv_default_billing_country();
265
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
266 266
 
267
-		$admin_settings['bank_transfer_ac_name'] = array(
267
+        $admin_settings['bank_transfer_ac_name'] = array(
268 268
             'type' => 'text',
269 269
             'id'   => 'bank_transfer_ac_name',
270 270
             'name' => __( 'Account Name', 'invoicing' ),
271
-		);
271
+        );
272 272
 		
273
-		$admin_settings['bank_transfer_ac_no'] = array(
273
+        $admin_settings['bank_transfer_ac_no'] = array(
274 274
             'type' => 'text',
275 275
             'id'   => 'bank_transfer_ac_no',
276 276
             'name' => __( 'Account Number', 'invoicing' ),
277
-		);
277
+        );
278 278
 		
279
-		$admin_settings['bank_transfer_bank_name'] = array(
279
+        $admin_settings['bank_transfer_bank_name'] = array(
280 280
             'type' => 'text',
281 281
             'id'   => 'bank_transfer_bank_name',
282 282
             'name' => __( 'Bank Name', 'invoicing' ),
283
-		);
283
+        );
284 284
 
285
-		$admin_settings['bank_transfer_ifsc'] = array(
285
+        $admin_settings['bank_transfer_ifsc'] = array(
286 286
             'type' => 'text',
287 287
             'id'   => 'bank_transfer_ifsc',
288 288
             'name' => __( 'IFSC Code', 'invoicing' ),
289
-		);
289
+        );
290 290
 
291
-		$admin_settings['bank_transfer_iban'] = array(
291
+        $admin_settings['bank_transfer_iban'] = array(
292 292
             'type' => 'text',
293 293
             'id'   => 'bank_transfer_iban',
294 294
             'name' => __( 'IBAN', 'invoicing' ),
295
-		);
295
+        );
296 296
 
297
-		$admin_settings['bank_transfer_bic'] = array(
297
+        $admin_settings['bank_transfer_bic'] = array(
298 298
             'type' => 'text',
299 299
             'id'   => 'bank_transfer_bic',
300 300
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
301
-		);
301
+        );
302 302
 		
303
-		$admin_settings['bank_transfer_sort_code'] = array(
304
-			'type' => 'text',
305
-			'id'   => 'bank_transfer_sort_code',
306
-			'name' => $sortcode,
307
-		);
303
+        $admin_settings['bank_transfer_sort_code'] = array(
304
+            'type' => 'text',
305
+            'id'   => 'bank_transfer_sort_code',
306
+            'name' => $sortcode,
307
+        );
308 308
 
309
-		$admin_settings['bank_transfer_info'] = array(
309
+        $admin_settings['bank_transfer_info'] = array(
310 310
             'id'   => 'bank_transfer_info',
311 311
             'name' => __( 'Instructions', 'invoicing' ),
312 312
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -316,17 +316,17 @@  discard block
 block discarded – undo
316 316
             'rows' => 5
317 317
         );
318 318
 
319
-		return $admin_settings;
320
-	}
319
+        return $admin_settings;
320
+    }
321 321
 
322
-	/**
323
-	 * Processes invoice addons.
324
-	 *
325
-	 * @param WPInv_Invoice $invoice
326
-	 * @param GetPaid_Form_Item[] $items
327
-	 * @return WPInv_Invoice
328
-	 */
329
-	public function process_addons( $invoice, $items ) {
322
+    /**
323
+     * Processes invoice addons.
324
+     *
325
+     * @param WPInv_Invoice $invoice
326
+     * @param GetPaid_Form_Item[] $items
327
+     * @return WPInv_Invoice
328
+     */
329
+    public function process_addons( $invoice, $items ) {
330 330
 
331 331
         foreach ( $items as $item ) {
332 332
             $invoice->add_item( $item );
@@ -334,6 +334,6 @@  discard block
 block discarded – undo
334 334
 
335 335
         $invoice->recalculate_total();
336 336
         $invoice->save();
337
-	}
337
+    }
338 338
 
339 339
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Bank transfer Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-	protected $supports = array( 'addons' );
27
+	protected $supports = array('addons');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 	public function __construct() {
40 40
         parent::__construct();
41 41
 
42
-        $this->title                = __( 'Direct bank transfer', 'invoicing' );
43
-        $this->method_title         = __( 'Bank transfer', 'invoicing' );
44
-        $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45
-        $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
42
+        $this->title                = __('Direct bank transfer', 'invoicing');
43
+        $this->method_title         = __('Bank transfer', 'invoicing');
44
+        $this->checkout_button_text = __('Proceed', 'invoicing');
45
+        $this->instructions         = apply_filters('wpinv_bank_instructions', $this->get_option('info'));
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
47
+		add_action('wpinv_receipt_end', array($this, 'thankyou_page'));
48
+		add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40);
49
+		add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11);
50
+		add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3);
51 51
 
52 52
     }
53 53
 
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
61 61
 	 * @return array
62 62
 	 */
63
-	public function process_payment( $invoice, $submission_data, $submission ) {
63
+	public function process_payment($invoice, $submission_data, $submission) {
64 64
 
65 65
         // Add a transaction id.
66
-        $invoice->set_transaction_id( $invoice->generate_key('trans_') );
66
+        $invoice->set_transaction_id($invoice->generate_key('trans_'));
67 67
 
68 68
         // Set it as pending payment.
69
-        if ( ! $invoice->needs_payment() ) {
69
+        if (!$invoice->needs_payment()) {
70 70
             $invoice->mark_paid();
71
-        } else if ( ! $invoice->is_paid() ) {
72
-            $invoice->set_status( 'wpi-onhold' );
71
+        } else if (!$invoice->is_paid()) {
72
+            $invoice->set_status('wpi-onhold');
73 73
         }
74 74
 
75 75
         // Save it.
76 76
         $invoice->save();
77 77
 
78 78
         // Send to the success page.
79
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
79
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
80 80
 
81 81
     }
82 82
 
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param WPInv_Invoice $invoice Invoice.
87 87
 	 */
88
-	public function thankyou_page( $invoice ) {
88
+	public function thankyou_page($invoice) {
89 89
 
90
-        if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
90
+        if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
91 91
 
92 92
 			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93 93
 
94
-            if ( ! empty( $this->instructions ) ) {
95
-                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
94
+            if (!empty($this->instructions)) {
95
+                echo wp_kses_post(wpautop(wptexturize($this->instructions)));
96 96
 			}
97 97
 
98
-			$this->bank_details( $invoice );
98
+			$this->bank_details($invoice);
99 99
 
100 100
 			echo '</div>';
101 101
 
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 * @param string     $email_type Email format: plain text or HTML.
111 111
 	 * @param bool     $sent_to_admin Sent to admin.
112 112
 	 */
113
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
113
+	public function email_instructions($invoice, $email_type, $sent_to_admin) {
114 114
 
115
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
115
+		if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
116 116
 
117 117
 			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118 118
 
119
-			if ( $this->instructions ) {
120
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
119
+			if ($this->instructions) {
120
+				echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL);
121 121
             }
122 122
 
123
-			$this->bank_details( $invoice );
123
+			$this->bank_details($invoice);
124 124
 			
125 125
 			echo '</div>';
126 126
 
@@ -133,51 +133,51 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param WPInv_Invoice $invoice Invoice.
135 135
 	 */
136
-	protected function bank_details( $invoice ) {
136
+	protected function bank_details($invoice) {
137 137
 
138 138
 		// Get the invoice country and country $locale.
139 139
 		$country = $invoice->get_country();
140 140
 		$locale  = $this->get_country_locale();
141 141
 
142 142
 		// Get sortcode label in the $locale array and use appropriate one.
143
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
143
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
144 144
 
145 145
         $bank_fields = array(
146
-            'ac_name'     => __( 'Account Name', 'invoicing' ),
147
-            'ac_no'       => __( 'Account Number', 'invoicing' ),
148
-            'bank_name'   => __( 'Bank Name', 'invoicing' ),
149
-            'ifsc'        => __( 'IFSC code', 'invoicing' ),
150
-            'iban'        => __( 'IBAN', 'invoicing' ),
151
-            'bic'         => __( 'BIC/Swift code', 'invoicing' ),
146
+            'ac_name'     => __('Account Name', 'invoicing'),
147
+            'ac_no'       => __('Account Number', 'invoicing'),
148
+            'bank_name'   => __('Bank Name', 'invoicing'),
149
+            'ifsc'        => __('IFSC code', 'invoicing'),
150
+            'iban'        => __('IBAN', 'invoicing'),
151
+            'bic'         => __('BIC/Swift code', 'invoicing'),
152 152
             'sort_code'   => $sortcode,
153 153
         );
154 154
 
155 155
         $bank_info = array();
156 156
 
157
-        foreach ( $bank_fields as $field => $label ) {
158
-            $value = $this->get_option( $field );
157
+        foreach ($bank_fields as $field => $label) {
158
+            $value = $this->get_option($field);
159 159
 
160
-            if ( ! empty( $value ) ) {
161
-                $bank_info[$field] = array( 'label' => $label, 'value' => $value );
160
+            if (!empty($value)) {
161
+                $bank_info[$field] = array('label' => $label, 'value' => $value);
162 162
             }
163 163
 
164 164
         }
165 165
 
166
-        $bank_info = apply_filters( 'wpinv_bank_info', $bank_info );
166
+        $bank_info = apply_filters('wpinv_bank_info', $bank_info);
167 167
 
168
-        if ( empty( $bank_info ) ) {
168
+        if (empty($bank_info)) {
169 169
             return;
170 170
         }
171 171
 
172
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
172
+		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL;
173 173
 
174 174
 		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
175 175
 
176
-		foreach ( $bank_info as $key => $data ) {
176
+		foreach ($bank_info as $key => $data) {
177 177
 
178
-			$key   = sanitize_html_class( $key );
179
-			$label = wp_kses_post( $data['label'] );
180
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
178
+			$key   = sanitize_html_class($key);
179
+			$label = wp_kses_post($data['label']);
180
+			$value = wp_kses_post(wptexturize($data['value']));
181 181
 
182 182
 			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
183 183
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function get_country_locale() {
195 195
 
196
-		if ( empty( $this->locale ) ) {
196
+		if (empty($this->locale)) {
197 197
 
198 198
 			// Locale information to be used - only those that are not 'Sort Code'.
199 199
 			$this->locale = apply_filters(
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
 				array(
202 202
 					'AU' => array(
203 203
 						'sortcode' => array(
204
-							'label' => __( 'BSB', 'invoicing' ),
204
+							'label' => __('BSB', 'invoicing'),
205 205
 						),
206 206
 					),
207 207
 					'CA' => array(
208 208
 						'sortcode' => array(
209
-							'label' => __( 'Bank transit number', 'invoicing' ),
209
+							'label' => __('Bank transit number', 'invoicing'),
210 210
 						),
211 211
 					),
212 212
 					'IN' => array(
213 213
 						'sortcode' => array(
214
-							'label' => __( 'IFSC', 'invoicing' ),
214
+							'label' => __('IFSC', 'invoicing'),
215 215
 						),
216 216
 					),
217 217
 					'IT' => array(
218 218
 						'sortcode' => array(
219
-							'label' => __( 'Branch sort', 'invoicing' ),
219
+							'label' => __('Branch sort', 'invoicing'),
220 220
 						),
221 221
 					),
222 222
 					'NZ' => array(
223 223
 						'sortcode' => array(
224
-							'label' => __( 'Bank code', 'invoicing' ),
224
+							'label' => __('Bank code', 'invoicing'),
225 225
 						),
226 226
 					),
227 227
 					'SE' => array(
228 228
 						'sortcode' => array(
229
-							'label' => __( 'Bank code', 'invoicing' ),
229
+							'label' => __('Bank code', 'invoicing'),
230 230
 						),
231 231
 					),
232 232
 					'US' => array(
233 233
 						'sortcode' => array(
234
-							'label' => __( 'Routing number', 'invoicing' ),
234
+							'label' => __('Routing number', 'invoicing'),
235 235
 						),
236 236
 					),
237 237
 					'ZA' => array(
238 238
 						'sortcode' => array(
239
-							'label' => __( 'Branch code', 'invoicing' ),
239
+							'label' => __('Branch code', 'invoicing'),
240 240
 						),
241 241
 					),
242 242
 				)
@@ -253,51 +253,51 @@  discard block
 block discarded – undo
253 253
 	 * 
254 254
 	 * @param array $admin_settings
255 255
 	 */
256
-	public function admin_settings( $admin_settings ) {
256
+	public function admin_settings($admin_settings) {
257 257
 
258
-        $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
259
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
258
+        $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing');
259
+		$admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing');
260 260
 
261
-		$locale  = $this->get_country_locale();
261
+		$locale = $this->get_country_locale();
262 262
 
263 263
 		// Get sortcode label in the $locale array and use appropriate one.
264 264
 		$country  = wpinv_default_billing_country();
265
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
265
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
266 266
 
267 267
 		$admin_settings['bank_transfer_ac_name'] = array(
268 268
             'type' => 'text',
269 269
             'id'   => 'bank_transfer_ac_name',
270
-            'name' => __( 'Account Name', 'invoicing' ),
270
+            'name' => __('Account Name', 'invoicing'),
271 271
 		);
272 272
 		
273 273
 		$admin_settings['bank_transfer_ac_no'] = array(
274 274
             'type' => 'text',
275 275
             'id'   => 'bank_transfer_ac_no',
276
-            'name' => __( 'Account Number', 'invoicing' ),
276
+            'name' => __('Account Number', 'invoicing'),
277 277
 		);
278 278
 		
279 279
 		$admin_settings['bank_transfer_bank_name'] = array(
280 280
             'type' => 'text',
281 281
             'id'   => 'bank_transfer_bank_name',
282
-            'name' => __( 'Bank Name', 'invoicing' ),
282
+            'name' => __('Bank Name', 'invoicing'),
283 283
 		);
284 284
 
285 285
 		$admin_settings['bank_transfer_ifsc'] = array(
286 286
             'type' => 'text',
287 287
             'id'   => 'bank_transfer_ifsc',
288
-            'name' => __( 'IFSC Code', 'invoicing' ),
288
+            'name' => __('IFSC Code', 'invoicing'),
289 289
 		);
290 290
 
291 291
 		$admin_settings['bank_transfer_iban'] = array(
292 292
             'type' => 'text',
293 293
             'id'   => 'bank_transfer_iban',
294
-            'name' => __( 'IBAN', 'invoicing' ),
294
+            'name' => __('IBAN', 'invoicing'),
295 295
 		);
296 296
 
297 297
 		$admin_settings['bank_transfer_bic'] = array(
298 298
             'type' => 'text',
299 299
             'id'   => 'bank_transfer_bic',
300
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
300
+            'name' => __('BIC/Swift Code', 'invoicing'),
301 301
 		);
302 302
 		
303 303
 		$admin_settings['bank_transfer_sort_code'] = array(
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 
309 309
 		$admin_settings['bank_transfer_info'] = array(
310 310
             'id'   => 'bank_transfer_info',
311
-            'name' => __( 'Instructions', 'invoicing' ),
312
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
311
+            'name' => __('Instructions', 'invoicing'),
312
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
313 313
             'type' => 'textarea',
314
-            'std'  => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ),
314
+            'std'  => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'),
315 315
             'cols' => 50,
316 316
             'rows' => 5
317 317
         );
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 * @param GetPaid_Form_Item[] $items
327 327
 	 * @return WPInv_Invoice
328 328
 	 */
329
-	public function process_addons( $invoice, $items ) {
329
+	public function process_addons($invoice, $items) {
330 330
 
331
-        foreach ( $items as $item ) {
332
-            $invoice->add_item( $item );
331
+        foreach ($items as $item) {
332
+            $invoice->add_item($item);
333 333
         }
334 334
 
335 335
         $invoice->recalculate_total();
Please login to merge, or discard this patch.
templates/frontend-head.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
Please login to merge, or discard this patch.
templates/frontend-footer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		<div class="modal-dialog modal-dialog-centered modal-lg" role="checkout" style="max-width: 650px;">
17 17
 			<div class="modal-content">
18 18
 				<div class="modal-body">
19
-					<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__( 'Close', 'invoicing' ); ?>">
19
+					<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="<?php esc_attr__('Close', 'invoicing'); ?>">
20 20
 						<i class="fa fa-times" aria-hidden="true"></i>
21 21
 					</button>
22 22
 					<div class="modal-body-wrapper"></div>
Please login to merge, or discard this patch.
templates/invoice/company-address.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Prepare the company name.
13
-$company_name = wpinv_get_option( 'vat_company_name' );
13
+$company_name = wpinv_get_option('vat_company_name');
14 14
 
15
-if ( empty( $company_name ) ) {
15
+if (empty($company_name)) {
16 16
     $company_name = wpinv_get_business_name();
17 17
 }
18 18
 
19 19
 // Prepare the VAT number.
20
-$vat_number = wpinv_get_option( 'vat_number' );
20
+$vat_number = wpinv_get_option('vat_number');
21 21
 
22 22
 ?>
23 23
     <div class="getpaid-company-address form-group">
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
         <div class="row">
26 26
 
27 27
             <div class="invoice-company-address-label col-2">
28
-                <strong><?php _e( 'From:', 'invoicing' ) ?></strong>
28
+                <strong><?php _e('From:', 'invoicing') ?></strong>
29 29
             </div>
30 30
 
31 31
             <div class="invoice-company-address-value col-10">
32 32
 
33
-                <?php do_action( 'getpaid_company_address_top' ); ?>
33
+                <?php do_action('getpaid_company_address_top'); ?>
34 34
 
35 35
                 <div class="name">
36
-                    <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>">
37
-                        <?php echo esc_html( $company_name ); ?>
36
+                    <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>">
37
+                        <?php echo esc_html($company_name); ?>
38 38
                     </a>
39 39
                 </div>
40 40
 
41
-                <?php if ( $address = wpinv_get_business_address() ) { ?>
42
-                    <?php echo $address;?>
41
+                <?php if ($address = wpinv_get_business_address()) { ?>
42
+                    <?php echo $address; ?>
43 43
                 <?php } ?>
44 44
 
45
-                <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?>
45
+                <?php if ($email_from = wpinv_mail_get_from_address()) { ?>
46 46
                     <div class="email_from">
47
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), $email_from );?>
47
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), $email_from); ?>
48 48
                     </div>
49 49
                 <?php } ?>
50 50
 
51
-                <?php if ( ! empty( $vat_number ) ) { ?>
51
+                <?php if (!empty($vat_number)) { ?>
52 52
                     <div class="email_from">
53
-                        <?php echo wp_sprintf( __( 'VAT Number: %s', 'invoicing' ), sanitize_text_field( $vat_number ) );?>
53
+                        <?php echo wp_sprintf(__('VAT Number: %s', 'invoicing'), sanitize_text_field($vat_number)); ?>
54 54
                     </div>
55 55
                 <?php } ?>
56 56
 
57
-                <?php do_action( 'getpaid_company_address_bottom' ); ?>
57
+                <?php do_action('getpaid_company_address_bottom'); ?>
58 58
 
59 59
             </div>
60 60
 
Please login to merge, or discard this patch.
templates/invoice/billing-address.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$invoice     = new WPInv_Invoice( $invoice );
13
-$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() );
12
+$invoice     = new WPInv_Invoice($invoice);
13
+$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info());
14 14
 $phone       = $invoice->get_phone();
15 15
 $email       = $invoice->get_email();
16 16
 $vat_number  = $invoice->get_vat_number();
@@ -21,41 +21,41 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
             <div class="invoice-billing-address-label col-2">
24
-                <strong><?php _e( 'To:', 'invoicing' ) ?></strong>
24
+                <strong><?php _e('To:', 'invoicing') ?></strong>
25 25
             </div>
26 26
 
27 27
 
28 28
             <div class="invoice-billing-address-value col-10">
29 29
 
30
-                <?php do_action( 'getpaid_billing_address_top' ); ?>
30
+                <?php do_action('getpaid_billing_address_top'); ?>
31 31
 
32
-                <?php if ( ! empty( $address_row ) ) : ?>
32
+                <?php if (!empty($address_row)) : ?>
33 33
                     <div class="billing-address">
34 34
                         <?php echo $address_row; ?>
35 35
                     </div>
36 36
                 <?php endif; ?>
37 37
 
38 38
 
39
-                <?php if ( ! empty( $phone ) ) : ?>
39
+                <?php if (!empty($phone)) : ?>
40 40
                     <div class="billing-phone">
41
-                        <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?>
41
+                        <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?>
42 42
                     </div>
43 43
                 <?php endif; ?>
44 44
 
45 45
 
46
-                <?php if ( ! empty( $email ) ) : ?>
46
+                <?php if (!empty($email)) : ?>
47 47
                     <div class="billing-email">
48
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?>
48
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?>
49 49
                     </div>
50 50
                 <?php endif; ?>
51 51
 
52
-                <?php if ( ! empty( $vat_number ) ) : ?>
52
+                <?php if (!empty($vat_number)) : ?>
53 53
                     <div class="vat-number">
54
-                        <?php echo wp_sprintf( __( 'Vat Number: %s', 'invoicing' ), sanitize_text_field( $vat_number ) ); ?>
54
+                        <?php echo wp_sprintf(__('Vat Number: %s', 'invoicing'), sanitize_text_field($vat_number)); ?>
55 55
                     </div>
56 56
                 <?php endif; ?>
57 57
 
58
-                <?php do_action( 'getpaid_billing_address_bottom' ); ?>
58
+                <?php do_action('getpaid_billing_address_bottom'); ?>
59 59
 
60 60
             </div>
61 61
 
Please login to merge, or discard this patch.