Passed
Push — master ( 3a0618...5aee45 )
by Stiofan
05:13
created
templates/payment-forms-admin/edit/text.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,44 +7,44 @@
 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
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
-        <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <hr class='featurette-divider mt-4'>
42 42
 
43 43
 <div class='form-group'>
44 44
     <label class="d-block">
45
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
45
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
46 46
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
47
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
47
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
48 48
     </label>
49 49
 </div>
50 50
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/website.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,44 +7,44 @@
 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
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
-        <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <hr class='featurette-divider mt-4'>
42 42
 
43 43
 <div class='form-group'>
44 44
     <label class="d-block">
45
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
45
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
46 46
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
47
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
47
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
48 48
     </label>
49 49
 </div>
50 50
 
Please login to merge, or discard this patch.
includes/data/admin-settings.php 1 patch
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -8,211 +8,211 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 $getpaid_pages = GetPaid_Installer::get_pages();
14
-$pages         = wpinv_get_pages( true );
14
+$pages         = wpinv_get_pages(true);
15 15
     
16 16
 $currencies = wpinv_get_currencies();
17 17
     
18 18
 $currency_code_options = array();
19
-foreach ( $currencies as $code => $name ) {
20
-    $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
19
+foreach ($currencies as $code => $name) {
20
+    $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
21 21
 }
22 22
 
23 23
 $invoice_number_padd_options = array();
24
-for ( $i = 0; $i <= 20; $i++ ) {
24
+for ($i = 0; $i <= 20; $i++) {
25 25
     $invoice_number_padd_options[$i] = $i;
26 26
 }
27 27
     
28 28
 $currency_symbol = wpinv_currency_symbol();
29 29
     
30 30
 $last_number = $reset_number = '';
31
-if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
32
-    $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number );
31
+if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
32
+    $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number);
33 33
 
34
-    if ( !empty( $last_invoice_number ) ) {
35
-        $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
34
+    if (!empty($last_invoice_number)) {
35
+        $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
36 36
     }
37 37
 
38 38
     $nonce = wp_create_nonce('reset_invoice_count');
39
-    $reset_number = '<a href="'.add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)).'" class="btn button">'.__('Force Reset Sequence', 'invoicing' ). '</a>';
39
+    $reset_number = '<a href="' . add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>';
40 40
 }
41 41
     
42 42
 $alert_wrapper_start = '<p style="color: #F00">';
43 43
 $alert_wrapper_close = '</p>';
44 44
 
45 45
 return array(
46
-    'general' => apply_filters( 'wpinv_settings_general',
46
+    'general' => apply_filters('wpinv_settings_general',
47 47
         array(
48 48
             'main' => array(
49 49
                 'location_settings' => array(
50 50
                     'id'   => 'location_settings',
51
-                    'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
51
+                    'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
52 52
                     'desc' => '',
53 53
                     'type' => 'header',
54 54
                 ),
55 55
                 'default_country' => array(
56 56
                     'id'      => 'default_country',
57
-                    'name'    => __( 'Default Country', 'invoicing' ),
58
-                    'desc'    => __( 'Where does your store operate from?', 'invoicing' ),
57
+                    'name'    => __('Default Country', 'invoicing'),
58
+                    'desc'    => __('Where does your store operate from?', 'invoicing'),
59 59
                     'type'    => 'select',
60 60
                     'options' => wpinv_get_country_list(),
61 61
                     'std'     => 'GB',
62 62
                     'class'   => 'wpi_select2',
63
-                    'placeholder' => __( 'Select a country', 'invoicing' ),
63
+                    'placeholder' => __('Select a country', 'invoicing'),
64 64
                 ),
65 65
                 'default_state' => array(
66 66
                     'id'      => 'default_state',
67
-                    'name'    => __( 'Default State / Province', 'invoicing' ),
68
-                    'desc'    => __( 'What state / province does your store operate from?', 'invoicing' ),
67
+                    'name'    => __('Default State / Province', 'invoicing'),
68
+                    'desc'    => __('What state / province does your store operate from?', 'invoicing'),
69 69
                     'type'    => 'country_states',
70 70
                     'class'   => 'wpi_select2',
71
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
71
+                    'placeholder' => __('Select a state', 'invoicing'),
72 72
                 ),
73 73
                 'store_name' => array(
74 74
                     'id'   => 'store_name',
75
-                    'name' => __( 'Store Name', 'invoicing' ),
76
-                    'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
75
+                    'name' => __('Store Name', 'invoicing'),
76
+                    'desc' => __('Store name to print on invoices.', 'invoicing'),
77 77
                     'std'     => get_option('blogname'),
78 78
                     'type' => 'text',
79 79
                 ),
80 80
                 'logo' => array(
81 81
                     'id'   => 'logo',
82
-                    'name' => __( 'Logo URL', 'invoicing' ),
83
-                    'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
82
+                    'name' => __('Logo URL', 'invoicing'),
83
+                    'desc' => __('Store logo to print on invoices.', 'invoicing'),
84 84
                     'type' => 'text',
85 85
                 ),
86 86
                 'logo_width'      => array(
87 87
                     'id'          => 'logo_width',
88
-                    'name'        => __( 'Logo width', 'invoicing' ),
89
-                    'desc'        => __( 'Logo width to use in invoice image.', 'invoicing' ),
88
+                    'name'        => __('Logo width', 'invoicing'),
89
+                    'desc'        => __('Logo width to use in invoice image.', 'invoicing'),
90 90
                     'type'        => 'number',
91
-                    'placeholder' => __( 'Auto', 'invoicing' ),
91
+                    'placeholder' => __('Auto', 'invoicing'),
92 92
                 ),
93 93
                 'logo_height'     => array(
94 94
                     'id'          => 'logo_height',
95
-                    'name'        => __( 'Logo height', 'invoicing' ),
96
-                    'desc'        => __( 'Logo height to use in invoice image.', 'invoicing' ),
95
+                    'name'        => __('Logo height', 'invoicing'),
96
+                    'desc'        => __('Logo height to use in invoice image.', 'invoicing'),
97 97
                     'type'        => 'number',
98
-                    'placeholder' => __( 'Auto', 'invoicing' ),
98
+                    'placeholder' => __('Auto', 'invoicing'),
99 99
                 ),
100 100
                 'store_address' => array(
101 101
                     'id'   => 'store_address',
102
-                    'name' => __( 'Store Address', 'invoicing' ),
103
-                    'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
102
+                    'name' => __('Store Address', 'invoicing'),
103
+                    'desc' => __('Enter the store address to display on invoice', 'invoicing'),
104 104
                     'type' => 'textarea',
105 105
                 ),
106 106
                 'page_settings' => array(
107 107
                     'id'   => 'page_settings',
108
-                    'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
108
+                    'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
109 109
                     'desc' => '',
110 110
                     'type' => 'header',
111 111
                 ),
112 112
                 'checkout_page' => array(
113 113
                     'id'          => 'checkout_page',
114
-                    'name'        => __( 'Checkout Page', 'invoicing' ),
115
-                    'desc'        => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ),
114
+                    'name'        => __('Checkout Page', 'invoicing'),
115
+                    'desc'        => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'),
116 116
                     'type'        => 'select',
117 117
                     'options'     => $pages,
118 118
                     'class'       => 'wpi_select2',
119
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
120
-                    'default_content' => empty( $getpaid_pages['checkout_page'] ) ? '' : $getpaid_pages['checkout_page']['content'],
119
+                    'placeholder' => __('Select a page', 'invoicing'),
120
+                    'default_content' => empty($getpaid_pages['checkout_page']) ? '' : $getpaid_pages['checkout_page']['content'],
121 121
                     'help-tip'    => true,
122 122
                 ),
123 123
                 'success_page' => array(
124 124
                     'id'          => 'success_page',
125
-                    'name'        => __( 'Success Page', 'invoicing' ),
126
-                    'desc'        => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ),
125
+                    'name'        => __('Success Page', 'invoicing'),
126
+                    'desc'        => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'),
127 127
                     'type'        => 'select',
128 128
                     'options'     => $pages,
129 129
                     'class'       => 'wpi_select2',
130
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
131
-                    'default_content' => empty( $getpaid_pages['success_page'] ) ? '' : $getpaid_pages['success_page']['content'],
130
+                    'placeholder' => __('Select a page', 'invoicing'),
131
+                    'default_content' => empty($getpaid_pages['success_page']) ? '' : $getpaid_pages['success_page']['content'],
132 132
                     'help-tip'    => true,
133 133
                 ),
134 134
                 'failure_page' => array(
135 135
                     'id'          => 'failure_page',
136
-                    'name'        => __( 'Failed Transaction Page', 'invoicing' ),
137
-                    'desc'        => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ),
136
+                    'name'        => __('Failed Transaction Page', 'invoicing'),
137
+                    'desc'        => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'),
138 138
                     'type'        => 'select',
139 139
                     'options'     => $pages,
140 140
                     'class'       => 'wpi_select2',
141
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
142
-                    'default_content' => empty( $getpaid_pages['failure_page'] ) ? '' : $getpaid_pages['failure_page']['content'],
141
+                    'placeholder' => __('Select a page', 'invoicing'),
142
+                    'default_content' => empty($getpaid_pages['failure_page']) ? '' : $getpaid_pages['failure_page']['content'],
143 143
                     'help-tip'    => true,
144 144
                 ),
145 145
                 'invoice_history_page' => array(
146 146
                     'id'          => 'invoice_history_page',
147
-                    'name'        => __( 'Invoice History Page', 'invoicing' ),
148
-                    'desc'        => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ),
147
+                    'name'        => __('Invoice History Page', 'invoicing'),
148
+                    'desc'        => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'),
149 149
                     'type'        => 'select',
150 150
                     'options'     => $pages,
151 151
                     'class'       => 'wpi_select2',
152
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
153
-                    'default_content' => empty( $getpaid_pages['invoice_history_page'] ) ? '' : $getpaid_pages['invoice_history_page']['content'],
152
+                    'placeholder' => __('Select a page', 'invoicing'),
153
+                    'default_content' => empty($getpaid_pages['invoice_history_page']) ? '' : $getpaid_pages['invoice_history_page']['content'],
154 154
                     'help-tip'    => true,
155 155
                 ),
156 156
                 'invoice_subscription_page' => array(
157 157
                     'id'          => 'invoice_subscription_page',
158
-                    'name'        => __( 'Invoice Subscriptions Page', 'invoicing' ),
159
-                    'desc'        => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ),
158
+                    'name'        => __('Invoice Subscriptions Page', 'invoicing'),
159
+                    'desc'        => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'),
160 160
                     'type'        => 'select',
161 161
                     'options'     => $pages,
162 162
                     'class'       => 'wpi_select2',
163
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
164
-                    'default_content' => empty( $getpaid_pages['invoice_subscription_page'] ) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
163
+                    'placeholder' => __('Select a page', 'invoicing'),
164
+                    'default_content' => empty($getpaid_pages['invoice_subscription_page']) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
165 165
                     'help-tip'    => true,
166 166
                 ),
167 167
             ),
168 168
             'currency_section' => array(
169 169
                 'currency_settings' => array(
170 170
                     'id'   => 'currency_settings',
171
-                    'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
171
+                    'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
172 172
                     'desc' => '',
173 173
                     'type' => 'header',
174 174
                 ),
175 175
                 'currency' => array(
176 176
                     'id'      => 'currency',
177
-                    'name'    => __( 'Currency', 'invoicing' ),
178
-                    'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
177
+                    'name'    => __('Currency', 'invoicing'),
178
+                    'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
179 179
                     'type'    => 'select',
180 180
                     'class'       => 'wpi_select2',
181 181
                     'options' => $currency_code_options,
182 182
                 ),
183 183
                 'currency_position' => array(
184 184
                     'id'      => 'currency_position',
185
-                    'name'    => __( 'Currency Position', 'invoicing' ),
186
-                    'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
185
+                    'name'    => __('Currency Position', 'invoicing'),
186
+                    'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
187 187
                     'type'    => 'select',
188 188
                     'class'   => 'wpi_select2',
189 189
                     'options'  => array(
190
-                        'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
191
-                        'right'       => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
192
-                        'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
193
-                        'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')'
190
+                        'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
191
+                        'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
192
+                        'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
193
+                        'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')'
194 194
                     )
195 195
                 ),
196 196
                 'thousands_separator' => array(
197 197
                     'id'   => 'thousands_separator',
198
-                    'name' => __( 'Thousands Separator', 'invoicing' ),
199
-                    'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
198
+                    'name' => __('Thousands Separator', 'invoicing'),
199
+                    'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
200 200
                     'type' => 'text',
201 201
                     'size' => 'small',
202 202
                     'std'  => ',',
203 203
                 ),
204 204
                 'decimal_separator' => array(
205 205
                     'id'   => 'decimal_separator',
206
-                    'name' => __( 'Decimal Separator', 'invoicing' ),
207
-                    'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
206
+                    'name' => __('Decimal Separator', 'invoicing'),
207
+                    'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
208 208
                     'type' => 'text',
209 209
                     'size' => 'small',
210 210
                     'std'  => '.',
211 211
                 ),
212 212
                 'decimals' => array(
213 213
                     'id'   => 'decimals',
214
-                    'name' => __( 'Number of Decimals', 'invoicing' ),
215
-                    'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
214
+                    'name' => __('Number of Decimals', 'invoicing'),
215
+                    'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
216 216
                     'type' => 'number',
217 217
                     'size' => 'small',
218 218
                     'std'  => '2',
@@ -224,21 +224,21 @@  discard block
 block discarded – undo
224 224
             'labels' => array(
225 225
                 'labels' => array(
226 226
                     'id'   => 'labels_settings',
227
-                    'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
227
+                    'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
228 228
                     'desc' => '',
229 229
                     'type' => 'header',
230 230
                 ),
231 231
                 'vat_invoice_notice_label' => array(
232 232
                     'id' => 'vat_invoice_notice_label',
233
-                    'name' => __( 'Invoice Notice Label', 'invoicing' ),
234
-                    'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
233
+                    'name' => __('Invoice Notice Label', 'invoicing'),
234
+                    'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
235 235
                     'type' => 'text',
236 236
                     'size' => 'regular',
237 237
                 ),
238 238
                 'vat_invoice_notice' => array(
239 239
                     'id' => 'vat_invoice_notice',
240
-                    'name' => __( 'Invoice notice', 'invoicing' ),
241
-                    'desc' =>   __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
240
+                    'name' => __('Invoice notice', 'invoicing'),
241
+                    'desc' =>   __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
242 242
                     'type' => 'text',
243 243
                     'size' => 'regular',
244 244
                 ),
@@ -250,22 +250,22 @@  discard block
 block discarded – undo
250 250
             'main' => array(
251 251
                 'gateway_settings' => array(
252 252
                     'id'   => 'api_header',
253
-                    'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
253
+                    'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
254 254
                     'desc' => '',
255 255
                     'type' => 'header',
256 256
                 ),
257 257
                 'gateways' => array(
258 258
                     'id'      => 'gateways',
259
-                    'name'    => __( 'Payment Gateways', 'invoicing' ),
260
-                    'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
259
+                    'name'    => __('Payment Gateways', 'invoicing'),
260
+                    'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
261 261
                     'type'    => 'gateways',
262
-                    'std'     => array( 'manual'=>1 ),
262
+                    'std'     => array('manual'=>1),
263 263
                     'options' => wpinv_get_payment_gateways(),
264 264
                 ),
265 265
                 'default_gateway' => array(
266 266
                     'id'      => 'default_gateway',
267
-                    'name'    => __( 'Default Gateway', 'invoicing' ),
268
-                    'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
267
+                    'name'    => __('Default Gateway', 'invoicing'),
268
+                    'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
269 269
                     'type'    => 'gateway_select',
270 270
                     'std'     => 'manual',
271 271
                     'class'   => 'wpi_select2',
@@ -280,32 +280,32 @@  discard block
 block discarded – undo
280 280
             'main' => array(
281 281
                 'tax_settings' => array(
282 282
                     'id'   => 'tax_settings',
283
-                    'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
283
+                    'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
284 284
                     'type' => 'header',
285 285
                 ),
286 286
 
287 287
                 'enable_taxes' => array(
288 288
                     'id'       => 'enable_taxes',
289
-                    'name'     => __( 'Enable Taxes', 'invoicing' ),
290
-                    'desc'     => __( 'Enable tax rates and calculations.', 'invoicing' ),
289
+                    'name'     => __('Enable Taxes', 'invoicing'),
290
+                    'desc'     => __('Enable tax rates and calculations.', 'invoicing'),
291 291
                     'type'     => 'checkbox',
292 292
                     'std'      => 0,
293 293
                 ),
294 294
 
295 295
                 'tax_subtotal_rounding' => array(
296 296
                     'id'                => 'tax_subtotal_rounding',
297
-                    'name'              => __( 'Rounding', 'invoicing' ),
298
-                    'desc'              => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ),
297
+                    'name'              => __('Rounding', 'invoicing'),
298
+                    'desc'              => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'),
299 299
                     'type'              => 'checkbox',
300 300
                     'std'               => 1,
301 301
                 ),
302 302
 
303 303
                 'prices_include_tax' => array(
304 304
                     'id'      => 'prices_include_tax',
305
-                    'name'    => __( 'Prices entered with tax', 'invoicing' ),
305
+                    'name'    => __('Prices entered with tax', 'invoicing'),
306 306
                     'options' => array(
307
-                        'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ),
308
-                        'no'  => __( 'No, I will enter prices exclusive of tax', 'invoicing' ),
307
+                        'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'),
308
+                        'no'  => __('No, I will enter prices exclusive of tax', 'invoicing'),
309 309
                     ),
310 310
                     'type'    => 'select',
311 311
                     'std'     => 'no',
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 
314 314
                 'tax_base'              => array(
315 315
                     'id'                => 'tax_base',
316
-                    'name'              => __( 'Calculate tax based on', 'invoicing' ),
316
+                    'name'              => __('Calculate tax based on', 'invoicing'),
317 317
                     'options'           => array(
318
-                        'billing'       => __( 'Customer billing address', 'invoicing' ),
319
-                        'base'          => __( 'Shop base address', 'invoicing' ),
318
+                        'billing'       => __('Customer billing address', 'invoicing'),
319
+                        'base'          => __('Shop base address', 'invoicing'),
320 320
                     ),
321 321
                     'type'              => 'select',
322 322
                     'std'               => 'billing',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 
325 325
                 'tax_display_totals'    => array(
326 326
                     'id'                => 'tax_display_totals',
327
-                    'name'              => __( 'Display tax totals', 'invoicing' ),
327
+                    'name'              => __('Display tax totals', 'invoicing'),
328 328
                     'options'           => array(
329
-                        'single'        => __( 'As a single total', 'invoicing' ),
330
-                        'individual'    => __( 'As individual tax rates', 'invoicing' ),
329
+                        'single'        => __('As a single total', 'invoicing'),
330
+                        'individual'    => __('As individual tax rates', 'invoicing'),
331 331
                     ),
332 332
                     'type'              => 'select',
333 333
                     'std'               => 'individual',
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 
336 336
                 'tax_rate' => array(
337 337
                     'id'   => 'tax_rate',
338
-                    'name' => __( 'Fallback Tax Rate', 'invoicing' ),
339
-                    'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
338
+                    'name' => __('Fallback Tax Rate', 'invoicing'),
339
+                    'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
340 340
                     'type' => 'number',
341 341
                     'size' => 'small',
342 342
                     'min'  => '0',
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
             'rates' => array(
349 349
                 'tax_rates' => array(
350 350
                     'id'   => 'tax_rates',
351
-                    'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
352
-                    'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
351
+                    'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
352
+                    'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
353 353
                     'type' => 'tax_rates',
354 354
                 ),
355 355
             ),
@@ -358,45 +358,45 @@  discard block
 block discarded – undo
358 358
 
359 359
                 'vat_company_name' => array(
360 360
                     'id' => 'vat_company_name',
361
-                    'name' => __( 'Company Name', 'invoicing' ),
362
-                    'desc' => wp_sprintf(__( 'Verify your company name and  VAT number on the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
361
+                    'name' => __('Company Name', 'invoicing'),
362
+                    'desc' => wp_sprintf(__('Verify your company name and  VAT number on the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
363 363
                     'type' => 'text',
364 364
                     'size' => 'regular',
365 365
                 ),
366 366
 
367 367
                 'vat_number' => array(
368 368
                     'id'   => 'vat_number',
369
-                    'name' => __( 'VAT Number', 'invoicing' ),
370
-                    'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ),
369
+                    'name' => __('VAT Number', 'invoicing'),
370
+                    'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'),
371 371
                     'type' => 'text',
372 372
                     'size' => 'regular',
373 373
                 ),
374 374
 
375 375
                 'vat_prevent_b2c_purchase' => array(
376 376
                     'id' => 'vat_prevent_b2c_purchase',
377
-                    'name' => __( 'Prevent B2C Sales', 'invoicing' ),
378
-                    'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ),
377
+                    'name' => __('Prevent B2C Sales', 'invoicing'),
378
+                    'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'),
379 379
                     'type' => 'checkbox'
380 380
                 ),
381 381
 
382 382
                 'validate_vat_number' => array(
383 383
                     'id'   => 'validate_vat_number',
384
-                    'name' => __( 'Validate VAT Number', 'invoicing' ),
385
-                    'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ),
384
+                    'name' => __('Validate VAT Number', 'invoicing'),
385
+                    'desc' => __('Validate VAT numbers with VIES.', 'invoicing'),
386 386
                     'type' => 'checkbox'
387 387
                 ),
388 388
 
389 389
                 'vat_same_country_rule' => array(
390 390
                     'id'          => 'vat_same_country_rule',
391
-                    'name'        => __( 'Same Country Rule', 'invoicing' ),
392
-                    'desc'        => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ),
391
+                    'name'        => __('Same Country Rule', 'invoicing'),
392
+                    'desc'        => __('What should happen if a customer is from the same country as your business?', 'invoicing'),
393 393
                     'type'        => 'select',
394 394
                     'options'     => array(
395
-                        'no'        => __( 'Do not charge tax', 'invoicing' ),
396
-                        'always'    => __( 'Charge tax unless vat number is validated', 'invoicing' ),
397
-                        'vat_too'   => __( 'Charge tax even if vat number is validated', 'invoicing' )
395
+                        'no'        => __('Do not charge tax', 'invoicing'),
396
+                        'always'    => __('Charge tax unless vat number is validated', 'invoicing'),
397
+                        'vat_too'   => __('Charge tax even if vat number is validated', 'invoicing')
398 398
                     ),
399
-                    'placeholder' => __( 'Select an option', 'invoicing' ),
399
+                    'placeholder' => __('Select an option', 'invoicing'),
400 400
                     'std'         => 'vat_too',
401 401
                 ),
402 402
 
@@ -410,59 +410,59 @@  discard block
 block discarded – undo
410 410
             'main' => array(
411 411
                 'email_settings_header' => array(
412 412
                     'id'   => 'email_settings_header',
413
-                    'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
413
+                    'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
414 414
                     'type' => 'header',
415 415
                 ),
416 416
                 'email_from_name' => array(
417 417
                     'id'   => 'email_from_name',
418
-                    'name' => __( 'From Name', 'invoicing' ),
419
-                    'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
420
-                    'std' => esc_attr( get_bloginfo( 'name', 'display' ) ),
418
+                    'name' => __('From Name', 'invoicing'),
419
+                    'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
420
+                    'std' => esc_attr(get_bloginfo('name', 'display')),
421 421
                     'type' => 'text',
422 422
                 ),
423 423
                 'email_from' => array(
424 424
                     'id'   => 'email_from',
425
-                    'name' => __( 'From Email', 'invoicing' ),
426
-                    'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close),
427
-                    'std' => get_option( 'admin_email' ),
425
+                    'name' => __('From Email', 'invoicing'),
426
+                    'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close),
427
+                    'std' => get_option('admin_email'),
428 428
                     'type' => 'text',
429 429
                 ),
430 430
                 'admin_email' => array(
431 431
                     'id'   => 'admin_email',
432
-                    'name' => __( 'Admin Email', 'invoicing' ),
433
-                    'desc' => __( 'Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing' ),
434
-                    'std' => get_option( 'admin_email' ),
432
+                    'name' => __('Admin Email', 'invoicing'),
433
+                    'desc' => __('Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing'),
434
+                    'std' => get_option('admin_email'),
435 435
                     'type' => 'text',
436 436
                 ),
437 437
                 'overdue_settings_header' => array(
438 438
                     'id'   => 'overdue_settings_header',
439
-                    'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
439
+                    'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
440 440
                     'type' => 'header',
441 441
                 ),
442 442
                 'overdue_active' => array(
443 443
                     'id'   => 'overdue_active',
444
-                    'name' => __( 'Enable Due Date', 'invoicing' ),
445
-                    'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
444
+                    'name' => __('Enable Due Date', 'invoicing'),
445
+                    'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
446 446
                     'type' => 'checkbox',
447 447
                     'std'  => false,
448 448
                 ),
449 449
                 'email_template_header' => array(
450 450
                     'id'   => 'email_template_header',
451
-                    'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
451
+                    'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
452 452
                     'type' => 'header',
453 453
                 ),
454 454
                 'email_header_image' => array(
455 455
                     'id'   => 'email_header_image',
456
-                    'name' => __( 'Header Image', 'invoicing' ),
457
-                    'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
456
+                    'name' => __('Header Image', 'invoicing'),
457
+                    'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
458 458
                     'std' => '',
459 459
                     'type' => 'text',
460 460
                 ),
461 461
                 'email_footer_text' => array(
462 462
                     'id'   => 'email_footer_text',
463
-                    'name' => __( 'Footer Text', 'invoicing' ),
464
-                    'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
465
-                    'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ),
463
+                    'name' => __('Footer Text', 'invoicing'),
464
+                    'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
465
+                    'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'),
466 466
                     'type' => 'textarea',
467 467
                     'class' => 'regular-text',
468 468
                     'rows' => 2,
@@ -470,29 +470,29 @@  discard block
 block discarded – undo
470 470
                 ),
471 471
                 'email_base_color' => array(
472 472
                     'id'   => 'email_base_color',
473
-                    'name' => __( 'Base Color', 'invoicing' ),
474
-                    'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
473
+                    'name' => __('Base Color', 'invoicing'),
474
+                    'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
475 475
                     'std' => '#557da2',
476 476
                     'type' => 'color',
477 477
                 ),
478 478
                 'email_background_color' => array(
479 479
                     'id'   => 'email_background_color',
480
-                    'name' => __( 'Background Color', 'invoicing' ),
481
-                    'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
480
+                    'name' => __('Background Color', 'invoicing'),
481
+                    'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
482 482
                     'std' => '#f5f5f5',
483 483
                     'type' => 'color',
484 484
                 ),
485 485
                 'email_body_background_color' => array(
486 486
                     'id'   => 'email_body_background_color',
487
-                    'name' => __( 'Body Background Color', 'invoicing' ),
488
-                    'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
487
+                    'name' => __('Body Background Color', 'invoicing'),
488
+                    'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
489 489
                     'std' => '#fdfdfd',
490 490
                     'type' => 'color',
491 491
                 ),
492 492
                 'email_text_color' => array(
493 493
                     'id'   => 'email_text_color',
494
-                    'name' => __( 'Body Text Color', 'invoicing' ),
495
-                    'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
494
+                    'name' => __('Body Text Color', 'invoicing'),
495
+                    'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
496 496
                     'std' => '#505050',
497 497
                     'type' => 'color',
498 498
                 ),
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
     ),
508 508
 
509 509
     // Integrations.
510
-    'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ),
510
+    'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'),
511 511
 
512 512
     /** Privacy Settings */
513 513
     'privacy' => apply_filters('wpinv_settings_privacy',
@@ -515,17 +515,17 @@  discard block
 block discarded – undo
515 515
             'main' => array(
516 516
                 'invoicing_privacy_policy_settings' => array(
517 517
                     'id'   => 'invoicing_privacy_policy_settings',
518
-                    'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>',
518
+                    'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>',
519 519
                     'type' => 'header',
520 520
                 ),
521 521
                 'privacy_page' => array(
522 522
                     'id'          => 'privacy_page',
523
-                    'name'        => __( 'Privacy Page', 'invoicing' ),
524
-                    'desc'        => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ),
523
+                    'name'        => __('Privacy Page', 'invoicing'),
524
+                    'desc'        => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'),
525 525
                     'type'        => 'select',
526
-                    'options'     => wpinv_get_pages( true,  __( 'Select a page', 'invoicing' )),
526
+                    'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
527 527
                     'class'       => 'wpi_select2',
528
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
528
+                    'placeholder' => __('Select a page', 'invoicing'),
529 529
                 ),
530 530
             ),
531 531
         )
@@ -536,19 +536,19 @@  discard block
 block discarded – undo
536 536
             'main' => array(
537 537
                 'invoice_number_format_settings' => array(
538 538
                     'id'   => 'invoice_number_format_settings',
539
-                    'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
539
+                    'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
540 540
                     'type' => 'header',
541 541
                 ),
542 542
                 'sequential_invoice_number' => array(
543 543
                     'id'   => 'sequential_invoice_number',
544
-                    'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
545
-                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number,
544
+                    'name' => __('Sequential Invoice Numbers', 'invoicing'),
545
+                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number,
546 546
                     'type' => 'checkbox',
547 547
                 ),
548 548
                 'invoice_sequence_start' => array(
549 549
                     'id'   => 'invoice_sequence_start',
550
-                    'name' => __( 'Sequential Starting Number', 'invoicing' ),
551
-                    'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
550
+                    'name' => __('Sequential Starting Number', 'invoicing'),
551
+                    'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
552 552
                     'type' => 'number',
553 553
                     'size' => 'small',
554 554
                     'std'  => '1',
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
                 ),
557 557
                 'invoice_number_padd' => array(
558 558
                     'id'      => 'invoice_number_padd',
559
-                    'name'    => __( 'Minimum Digits', 'invoicing' ),
560
-                    'desc'    => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ),
559
+                    'name'    => __('Minimum Digits', 'invoicing'),
560
+                    'desc'    => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'),
561 561
                     'type'    => 'select',
562 562
                     'options' => $invoice_number_padd_options,
563 563
                     'std'     => 5,
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
                 ),
566 566
                 'invoice_number_prefix' => array(
567 567
                     'id' => 'invoice_number_prefix',
568
-                    'name' => __( 'Invoice Number Prefix', 'invoicing' ),
569
-                    'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ),
568
+                    'name' => __('Invoice Number Prefix', 'invoicing'),
569
+                    'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'),
570 570
                     'type' => 'text',
571 571
                     'size' => 'regular',
572 572
                     'std' => 'INV-',
@@ -574,46 +574,46 @@  discard block
 block discarded – undo
574 574
                 ),
575 575
                 'invoice_number_postfix' => array(
576 576
                     'id' => 'invoice_number_postfix',
577
-                    'name' => __( 'Invoice Number Postfix', 'invoicing' ),
578
-                    'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
577
+                    'name' => __('Invoice Number Postfix', 'invoicing'),
578
+                    'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
579 579
                     'type' => 'text',
580 580
                     'size' => 'regular',
581 581
                     'std' => ''
582 582
                 ),
583 583
                 'checkout_settings' => array(
584 584
                     'id'   => 'checkout_settings',
585
-                    'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
585
+                    'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
586 586
                     'type' => 'header',
587 587
                 ),
588 588
                 'disable_new_user_emails' => array(
589 589
                     'id'   => 'disable_new_user_emails',
590
-                    'name' => __( 'Disable new user emails', 'invoicing' ),
591
-                    'desc' => __( 'Do not send an email to customers when a new user account is created for them.', 'invoicing' ),
590
+                    'name' => __('Disable new user emails', 'invoicing'),
591
+                    'desc' => __('Do not send an email to customers when a new user account is created for them.', 'invoicing'),
592 592
                     'type' => 'checkbox',
593 593
                 ),
594 594
                 'login_to_checkout' => array(
595 595
                     'id'   => 'login_to_checkout',
596
-                    'name' => __( 'Require Login To Checkout', 'invoicing' ),
597
-                    'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ),
596
+                    'name' => __('Require Login To Checkout', 'invoicing'),
597
+                    'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'),
598 598
                     'type' => 'checkbox',
599 599
                 ),
600 600
                 'maxmind_license_key' => array(
601 601
                     'id'   => 'maxmind_license_key',
602
-                    'name' => __( 'MaxMind License Key', 'invoicing' ),
602
+                    'name' => __('MaxMind License Key', 'invoicing'),
603 603
                     'type' => 'text',
604 604
                     'size' => 'regular',
605
-                    'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>',
605
+                    'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __('How to generate a free license key.', 'invoicing') . '</a>',
606 606
                 ),
607 607
 
608 608
                 'uninstall_settings' => array(
609 609
                     'id'   => 'uninstall_settings',
610
-                    'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
610
+                    'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
611 611
                     'type' => 'header',
612 612
                 ),
613 613
                 'remove_data_on_unistall' => array(
614 614
                     'id'   => 'remove_data_on_unistall',
615
-                    'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
616
-                    'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
615
+                    'name' => __('Remove Data on Uninstall?', 'invoicing'),
616
+                    'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
617 617
                     'type' => 'checkbox',
618 618
                     'std'  => ''
619 619
                 ),
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
             'custom-css' => array(
623 623
                 'css_settings' => array(
624 624
                     'id'   => 'css_settings',
625
-                    'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>',
625
+                    'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>',
626 626
                     'type' => 'header',
627 627
                 ),
628 628
                 'template_custom_css' => array(
629 629
                     'id' => 'template_custom_css',
630
-                    'name' => __( 'Invoice Template CSS', 'invoicing' ),
631
-                    'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ),
630
+                    'name' => __('Invoice Template CSS', 'invoicing'),
631
+                    'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'),
632 632
                     'type' => 'textarea',
633 633
                     'class'=> 'regular-text',
634 634
                     'rows' => 10,
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
             'main' => array(
643 643
                 'tool_settings' => array(
644 644
                     'id'   => 'tool_settings',
645
-                    'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
646
-                    'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
645
+                    'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
646
+                    'desc' => __('Invoicing diagnostic tools', 'invoicing'),
647 647
                     'type' => 'tools',
648 648
                 ),
649 649
             ),
Please login to merge, or discard this patch.
includes/admin/class-getpaid-installer.php 2 patches
Indentation   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -20,222 +20,222 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class GetPaid_Installer {
22 22
 
23
-	/**
24
-	 * Upgrades the install.
25
-	 *
26
-	 * @param string $upgrade_from The current invoicing version.
27
-	 */
28
-	public function upgrade_db( $upgrade_from ) {
29
-
30
-		// Save the current invoicing version.
31
-		update_option( 'wpinv_version', WPINV_VERSION );
32
-
33
-		// Setup the invoice Custom Post Type.
34
-		GetPaid_Post_Types::register_post_types();
35
-
36
-		// Clear the permalinks
37
-		flush_rewrite_rules();
38
-
39
-		// Maybe create new/missing pages.
40
-		$this->create_pages();
41
-
42
-		// Maybe re(add) admin capabilities.
43
-		$this->add_capabilities();
44
-
45
-		// Maybe create the default payment form.
46
-		wpinv_get_default_payment_form();
47
-
48
-		// Create any missing database tables.
49
-		$method = "upgrade_from_$upgrade_from";
50
-
51
-		if ( method_exists( $this, $method ) ) {
52
-			$this->$method();
53
-		}
54
-
55
-	}
56
-
57
-	/**
58
-	 * Do a fresh install.
59
-	 *
60
-	 */
61
-	public function upgrade_from_0() {
62
-		$this->create_subscriptions_table();
63
-		$this->create_invoices_table();
64
-		$this->create_invoice_items_table();
65
-
66
-		// Save default tax rates.
67
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
68
-	}
69
-
70
-	/**
71
-	 * Upgrade to 0.0.5
72
-	 *
73
-	 */
74
-	public function upgrade_from_004() {
75
-		global $wpdb;
76
-
77
-		// Invoices.
78
-		$results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
79
-		if ( ! empty( $results ) ) {
80
-			$wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
81
-
82
-			// Clean post cache
83
-			foreach ( $results as $row ) {
84
-				clean_post_cache( $row->ID );
85
-			}
86
-
87
-		}
88
-
89
-		// Item meta key changes
90
-		$query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
91
-		$results = $wpdb->get_results( $query );
92
-
93
-		if ( ! empty( $results ) ) {
94
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
95
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
96
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
97
-
98
-			foreach ( $results as $row ) {
99
-				clean_post_cache( $row->post_id );
100
-			}
101
-
102
-		}
103
-
104
-		$this->upgrade_from_102();
105
-	}
106
-
107
-	/**
108
-	 * Upgrade to 1.0.3
109
-	 *
110
-	 */
111
-	public function upgrade_from_102() {
112
-		$this->create_subscriptions_table();
113
-		$this->upgrade_from_118();
114
-	}
115
-
116
-	/**
117
-	 * Upgrade to version 2.0.0.
118
-	 *
119
-	 */
120
-	public function upgrade_from_118() {
121
-		$this->create_invoices_table();
122
-		$this->create_invoice_items_table();
123
-		$this->migrate_old_invoices();
124
-	}
125
-
126
-	/**
127
-	 * Upgrade to version 2.0.8.
128
-	 *
129
-	 */
130
-	public function upgrade_from_207() {
131
-		global $wpdb;
132
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
133
-	}
134
-
135
-	/**
136
-	 * Give administrators the capability to manage GetPaid.
137
-	 *
138
-	 */
139
-	public function add_capabilities() {
140
-		$GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
141
-	}
142
-
143
-	/**
144
-	 * Retreives GetPaid pages.
145
-	 *
146
-	 */
147
-	public static function get_pages() {
148
-
149
-		return apply_filters(
150
-			'wpinv_create_pages',
151
-			array(
152
-
153
-				// Checkout page.
154
-				'checkout_page' => array(
155
-					'name'      => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
156
-					'title'     => _x( 'Checkout', 'Page title', 'invoicing' ),
157
-					'content'   => '
23
+    /**
24
+     * Upgrades the install.
25
+     *
26
+     * @param string $upgrade_from The current invoicing version.
27
+     */
28
+    public function upgrade_db( $upgrade_from ) {
29
+
30
+        // Save the current invoicing version.
31
+        update_option( 'wpinv_version', WPINV_VERSION );
32
+
33
+        // Setup the invoice Custom Post Type.
34
+        GetPaid_Post_Types::register_post_types();
35
+
36
+        // Clear the permalinks
37
+        flush_rewrite_rules();
38
+
39
+        // Maybe create new/missing pages.
40
+        $this->create_pages();
41
+
42
+        // Maybe re(add) admin capabilities.
43
+        $this->add_capabilities();
44
+
45
+        // Maybe create the default payment form.
46
+        wpinv_get_default_payment_form();
47
+
48
+        // Create any missing database tables.
49
+        $method = "upgrade_from_$upgrade_from";
50
+
51
+        if ( method_exists( $this, $method ) ) {
52
+            $this->$method();
53
+        }
54
+
55
+    }
56
+
57
+    /**
58
+     * Do a fresh install.
59
+     *
60
+     */
61
+    public function upgrade_from_0() {
62
+        $this->create_subscriptions_table();
63
+        $this->create_invoices_table();
64
+        $this->create_invoice_items_table();
65
+
66
+        // Save default tax rates.
67
+        update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
68
+    }
69
+
70
+    /**
71
+     * Upgrade to 0.0.5
72
+     *
73
+     */
74
+    public function upgrade_from_004() {
75
+        global $wpdb;
76
+
77
+        // Invoices.
78
+        $results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
79
+        if ( ! empty( $results ) ) {
80
+            $wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
81
+
82
+            // Clean post cache
83
+            foreach ( $results as $row ) {
84
+                clean_post_cache( $row->ID );
85
+            }
86
+
87
+        }
88
+
89
+        // Item meta key changes
90
+        $query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
91
+        $results = $wpdb->get_results( $query );
92
+
93
+        if ( ! empty( $results ) ) {
94
+            $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
95
+            $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
96
+            $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
97
+
98
+            foreach ( $results as $row ) {
99
+                clean_post_cache( $row->post_id );
100
+            }
101
+
102
+        }
103
+
104
+        $this->upgrade_from_102();
105
+    }
106
+
107
+    /**
108
+     * Upgrade to 1.0.3
109
+     *
110
+     */
111
+    public function upgrade_from_102() {
112
+        $this->create_subscriptions_table();
113
+        $this->upgrade_from_118();
114
+    }
115
+
116
+    /**
117
+     * Upgrade to version 2.0.0.
118
+     *
119
+     */
120
+    public function upgrade_from_118() {
121
+        $this->create_invoices_table();
122
+        $this->create_invoice_items_table();
123
+        $this->migrate_old_invoices();
124
+    }
125
+
126
+    /**
127
+     * Upgrade to version 2.0.8.
128
+     *
129
+     */
130
+    public function upgrade_from_207() {
131
+        global $wpdb;
132
+        $wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
133
+    }
134
+
135
+    /**
136
+     * Give administrators the capability to manage GetPaid.
137
+     *
138
+     */
139
+    public function add_capabilities() {
140
+        $GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
141
+    }
142
+
143
+    /**
144
+     * Retreives GetPaid pages.
145
+     *
146
+     */
147
+    public static function get_pages() {
148
+
149
+        return apply_filters(
150
+            'wpinv_create_pages',
151
+            array(
152
+
153
+                // Checkout page.
154
+                'checkout_page' => array(
155
+                    'name'      => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
156
+                    'title'     => _x( 'Checkout', 'Page title', 'invoicing' ),
157
+                    'content'   => '
158 158
 						<!-- wp:shortcode -->
159 159
 						[wpinv_checkout]
160 160
 						<!-- /wp:shortcode -->
161 161
 					',
162
-					'parent'    => '',
163
-				),
164
-
165
-				// Invoice history page.
166
-				'invoice_history_page' => array(
167
-					'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
168
-					'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
169
-					'content' => '
162
+                    'parent'    => '',
163
+                ),
164
+
165
+                // Invoice history page.
166
+                'invoice_history_page' => array(
167
+                    'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
168
+                    'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
169
+                    'content' => '
170 170
 					<!-- wp:shortcode -->
171 171
 					[wpinv_history]
172 172
 					<!-- /wp:shortcode -->
173 173
 				',
174
-					'parent'  => '',
175
-				),
176
-
177
-				// Success page content.
178
-				'success_page' => array(
179
-					'name'     => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
180
-					'title'    => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
181
-					'content'  => '
174
+                    'parent'  => '',
175
+                ),
176
+
177
+                // Success page content.
178
+                'success_page' => array(
179
+                    'name'     => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
180
+                    'title'    => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
181
+                    'content'  => '
182 182
 					<!-- wp:shortcode -->
183 183
 					[wpinv_receipt]
184 184
 					<!-- /wp:shortcode -->
185 185
 				',
186
-					'parent'   => 'gp-checkout',
187
-				),
188
-
189
-				// Failure page content.
190
-				'failure_page' => array(
191
-					'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
192
-					'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
193
-					'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
194
-					'parent'  => 'gp-checkout',
195
-				),
196
-
197
-				// Subscriptions history page.
198
-				'invoice_subscription_page' => array(
199
-					'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
200
-					'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
201
-					'content' => '
186
+                    'parent'   => 'gp-checkout',
187
+                ),
188
+
189
+                // Failure page content.
190
+                'failure_page' => array(
191
+                    'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
192
+                    'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
193
+                    'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
194
+                    'parent'  => 'gp-checkout',
195
+                ),
196
+
197
+                // Subscriptions history page.
198
+                'invoice_subscription_page' => array(
199
+                    'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
200
+                    'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
201
+                    'content' => '
202 202
 					<!-- wp:shortcode -->
203 203
 					[wpinv_subscriptions]
204 204
 					<!-- /wp:shortcode -->
205 205
 				',
206
-					'parent' => '',
207
-				),
206
+                    'parent' => '',
207
+                ),
208 208
 
209
-			)
210
-		);
209
+            )
210
+        );
211 211
 
212
-	}
212
+    }
213 213
 
214
-	/**
215
-	 * Re-create GetPaid pages.
216
-	 *
217
-	 */
218
-	public function create_pages() {
214
+    /**
215
+     * Re-create GetPaid pages.
216
+     *
217
+     */
218
+    public function create_pages() {
219 219
 
220
-		foreach ( self::get_pages() as $key => $page ) {
221
-			wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
222
-		}
220
+        foreach ( self::get_pages() as $key => $page ) {
221
+            wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
222
+        }
223 223
 
224
-	}
224
+    }
225 225
 
226
-	/**
227
-	 * Create subscriptions table.
228
-	 *
229
-	 */
230
-	public function create_subscriptions_table() {
226
+    /**
227
+     * Create subscriptions table.
228
+     *
229
+     */
230
+    public function create_subscriptions_table() {
231 231
 
232
-		global $wpdb;
232
+        global $wpdb;
233 233
 
234
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
234
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
235 235
 
236
-		// Create tables.
237
-		$charset_collate = $wpdb->get_charset_collate();
238
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpinv_subscriptions (
236
+        // Create tables.
237
+        $charset_collate = $wpdb->get_charset_collate();
238
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}wpinv_subscriptions (
239 239
 			id bigint(20) unsigned NOT NULL auto_increment,
240 240
 			customer_id bigint(20) NOT NULL,
241 241
 			frequency int(11) NOT NULL DEFAULT '1',
@@ -258,22 +258,22 @@  discard block
 block discarded – undo
258 258
 			KEY customer_and_status (customer_id, status)
259 259
 		  ) $charset_collate;";
260 260
 
261
-		dbDelta( $sql );
261
+        dbDelta( $sql );
262 262
 
263
-	}
263
+    }
264 264
 
265
-	/**
266
-	 * Create invoices table.
267
-	 *
268
-	 */
269
-	public function create_invoices_table() {
270
-		global $wpdb;
265
+    /**
266
+     * Create invoices table.
267
+     *
268
+     */
269
+    public function create_invoices_table() {
270
+        global $wpdb;
271 271
 
272
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
272
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
273 273
 
274
-		// Create tables.
275
-		$charset_collate = $wpdb->get_charset_collate();
276
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoices (
274
+        // Create tables.
275
+        $charset_collate = $wpdb->get_charset_collate();
276
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoices (
277 277
 			post_id BIGINT(20) NOT NULL,
278 278
             `number` VARCHAR(100),
279 279
             `key` VARCHAR(100),
@@ -309,22 +309,22 @@  discard block
 block discarded – undo
309 309
 			KEY `key` (`key`)
310 310
 		  ) $charset_collate;";
311 311
 
312
-		dbDelta( $sql );
312
+        dbDelta( $sql );
313 313
 
314
-	}
314
+    }
315 315
 
316
-	/**
317
-	 * Create invoice items table.
318
-	 *
319
-	 */
320
-	public function create_invoice_items_table() {
321
-		global $wpdb;
316
+    /**
317
+     * Create invoice items table.
318
+     *
319
+     */
320
+    public function create_invoice_items_table() {
321
+        global $wpdb;
322 322
 
323
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
323
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
324 324
 
325
-		// Create tables.
326
-		$charset_collate = $wpdb->get_charset_collate();
327
-		$sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoice_items (
325
+        // Create tables.
326
+        $charset_collate = $wpdb->get_charset_collate();
327
+        $sql             = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}getpaid_invoice_items (
328 328
 			ID BIGINT(20) NOT NULL AUTO_INCREMENT,
329 329
             post_id BIGINT(20) NOT NULL,
330 330
             item_id BIGINT(20) NOT NULL,
@@ -346,159 +346,159 @@  discard block
 block discarded – undo
346 346
 			KEY post_id (post_id)
347 347
 		  ) $charset_collate;";
348 348
 
349
-		dbDelta( $sql );
350
-
351
-	}
352
-
353
-	/**
354
-	 * Migrates old invoices to new invoices.
355
-	 *
356
-	 */
357
-	public function migrate_old_invoices() {
358
-		global $wpdb;
359
-
360
-		$invoices_table      = $wpdb->prefix . 'getpaid_invoices';
361
-		$invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
362
-		$migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
363
-		$invoices            = array_unique(
364
-			get_posts(
365
-				array(
366
-					'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
367
-					'posts_per_page' => -1,
368
-					'fields'         => 'ids',
369
-					'post_status'    => array_keys( get_post_stati() ),
370
-					'exclude'        => (array) $migrated,
371
-				)
372
-			)
373
-		);
374
-
375
-		// Abort if we do not have any invoices.
376
-		if ( empty( $invoices ) ) {
377
-			return;
378
-		}
379
-
380
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php' );
381
-
382
-		$invoice_rows = array();
383
-		foreach ( $invoices as $invoice ) {
384
-
385
-			$invoice = new WPInv_Legacy_Invoice( $invoice );
386
-
387
-			if ( empty( $invoice->ID ) ) {
388
-				return;
389
-			}
390
-
391
-			$fields = array (
392
-				'post_id'        => $invoice->ID,
393
-				'number'         => $invoice->get_number(),
394
-				'key'            => $invoice->get_key(),
395
-				'type'           => str_replace( 'wpi_', '', $invoice->post_type ),
396
-				'mode'           => $invoice->mode,
397
-				'user_ip'        => $invoice->get_ip(),
398
-				'first_name'     => $invoice->get_first_name(),
399
-				'last_name'      => $invoice->get_last_name(),
400
-				'address'        => $invoice->get_address(),
401
-				'city'           => $invoice->city,
402
-				'state'          => $invoice->state,
403
-				'country'        => $invoice->country,
404
-				'zip'            => $invoice->zip,
405
-				'adddress_confirmed' => (int) $invoice->adddress_confirmed,
406
-				'gateway'        => $invoice->get_gateway(),
407
-				'transaction_id' => $invoice->get_transaction_id(),
408
-				'currency'       => $invoice->get_currency(),
409
-				'subtotal'       => $invoice->get_subtotal(),
410
-				'tax'            => $invoice->get_tax(),
411
-				'fees_total'     => $invoice->get_fees_total(),
412
-				'total'          => $invoice->get_total(),
413
-				'discount'       => $invoice->get_discount(),
414
-				'discount_code'  => $invoice->get_discount_code(),
415
-				'disable_taxes'  => $invoice->disable_taxes,
416
-				'due_date'       => $invoice->get_due_date(),
417
-				'completed_date' => $invoice->get_completed_date(),
418
-				'company'        => $invoice->company,
419
-				'vat_number'     => $invoice->vat_number,
420
-				'vat_rate'       => $invoice->vat_rate,
421
-				'custom_meta'    => $invoice->payment_meta
422
-			);
423
-
424
-			foreach ( $fields as $key => $val ) {
425
-				if ( is_null( $val ) ) {
426
-					$val = '';
427
-				}
428
-				$val = maybe_serialize( $val );
429
-				$fields[ $key ] = $wpdb->prepare( '%s', $val );
430
-			}
431
-
432
-			$fields = implode( ', ', $fields );
433
-			$invoice_rows[] = "($fields)";
434
-
435
-			$item_rows    = array();
436
-			$item_columns = array();
437
-			foreach ( $invoice->get_cart_details() as $details ) {
438
-				$fields = array(
439
-					'post_id'          => $invoice->ID,
440
-					'item_id'          => $details['id'],
441
-					'item_name'        => $details['name'],
442
-					'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
443
-					'vat_rate'         => $details['vat_rate'],
444
-					'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
445
-					'tax'              => $details['tax'],
446
-					'item_price'       => $details['item_price'],
447
-					'custom_price'     => $details['custom_price'],
448
-					'quantity'         => $details['quantity'],
449
-					'discount'         => $details['discount'],
450
-					'subtotal'         => $details['subtotal'],
451
-					'price'            => $details['price'],
452
-					'meta'             => $details['meta'],
453
-					'fees'             => $details['fees'],
454
-				);
455
-
456
-				$item_columns = array_keys ( $fields );
457
-
458
-				foreach ( $fields as $key => $val ) {
459
-					if ( is_null( $val ) ) {
460
-						$val = '';
461
-					}
462
-					$val = maybe_serialize( $val );
463
-					$fields[ $key ] = $wpdb->prepare( '%s', $val );
464
-				}
465
-
466
-				$fields = implode( ', ', $fields );
467
-				$item_rows[] = "($fields)";
468
-			}
469
-
470
-			$item_rows    = implode( ', ', $item_rows );
471
-			$item_columns = implode( ', ', $item_columns );
472
-			$wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
473
-		}
474
-
475
-		if ( empty( $invoice_rows ) ) {
476
-			return;
477
-		}
478
-
479
-		$invoice_rows = implode( ', ', $invoice_rows );
480
-		$wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
481
-
482
-	}
483
-
484
-	/**
485
-	 * Migrates old invoices to new invoices.
486
-	 *
487
-	 */
488
-	public static function rename_gateways_label() {
489
-		global $wpdb;
490
-
491
-		foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
492
-
493
-			$wpdb->update(
494
-				$wpdb->prefix . 'getpaid_invoices',
495
-				array( 'gateway' => $gateway ),
496
-				array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
497
-				'%s',
498
-				'%s'
499
-			);
500
-
501
-		}
502
-	}
349
+        dbDelta( $sql );
350
+
351
+    }
352
+
353
+    /**
354
+     * Migrates old invoices to new invoices.
355
+     *
356
+     */
357
+    public function migrate_old_invoices() {
358
+        global $wpdb;
359
+
360
+        $invoices_table      = $wpdb->prefix . 'getpaid_invoices';
361
+        $invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
362
+        $migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
363
+        $invoices            = array_unique(
364
+            get_posts(
365
+                array(
366
+                    'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
367
+                    'posts_per_page' => -1,
368
+                    'fields'         => 'ids',
369
+                    'post_status'    => array_keys( get_post_stati() ),
370
+                    'exclude'        => (array) $migrated,
371
+                )
372
+            )
373
+        );
374
+
375
+        // Abort if we do not have any invoices.
376
+        if ( empty( $invoices ) ) {
377
+            return;
378
+        }
379
+
380
+        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php' );
381
+
382
+        $invoice_rows = array();
383
+        foreach ( $invoices as $invoice ) {
384
+
385
+            $invoice = new WPInv_Legacy_Invoice( $invoice );
386
+
387
+            if ( empty( $invoice->ID ) ) {
388
+                return;
389
+            }
390
+
391
+            $fields = array (
392
+                'post_id'        => $invoice->ID,
393
+                'number'         => $invoice->get_number(),
394
+                'key'            => $invoice->get_key(),
395
+                'type'           => str_replace( 'wpi_', '', $invoice->post_type ),
396
+                'mode'           => $invoice->mode,
397
+                'user_ip'        => $invoice->get_ip(),
398
+                'first_name'     => $invoice->get_first_name(),
399
+                'last_name'      => $invoice->get_last_name(),
400
+                'address'        => $invoice->get_address(),
401
+                'city'           => $invoice->city,
402
+                'state'          => $invoice->state,
403
+                'country'        => $invoice->country,
404
+                'zip'            => $invoice->zip,
405
+                'adddress_confirmed' => (int) $invoice->adddress_confirmed,
406
+                'gateway'        => $invoice->get_gateway(),
407
+                'transaction_id' => $invoice->get_transaction_id(),
408
+                'currency'       => $invoice->get_currency(),
409
+                'subtotal'       => $invoice->get_subtotal(),
410
+                'tax'            => $invoice->get_tax(),
411
+                'fees_total'     => $invoice->get_fees_total(),
412
+                'total'          => $invoice->get_total(),
413
+                'discount'       => $invoice->get_discount(),
414
+                'discount_code'  => $invoice->get_discount_code(),
415
+                'disable_taxes'  => $invoice->disable_taxes,
416
+                'due_date'       => $invoice->get_due_date(),
417
+                'completed_date' => $invoice->get_completed_date(),
418
+                'company'        => $invoice->company,
419
+                'vat_number'     => $invoice->vat_number,
420
+                'vat_rate'       => $invoice->vat_rate,
421
+                'custom_meta'    => $invoice->payment_meta
422
+            );
423
+
424
+            foreach ( $fields as $key => $val ) {
425
+                if ( is_null( $val ) ) {
426
+                    $val = '';
427
+                }
428
+                $val = maybe_serialize( $val );
429
+                $fields[ $key ] = $wpdb->prepare( '%s', $val );
430
+            }
431
+
432
+            $fields = implode( ', ', $fields );
433
+            $invoice_rows[] = "($fields)";
434
+
435
+            $item_rows    = array();
436
+            $item_columns = array();
437
+            foreach ( $invoice->get_cart_details() as $details ) {
438
+                $fields = array(
439
+                    'post_id'          => $invoice->ID,
440
+                    'item_id'          => $details['id'],
441
+                    'item_name'        => $details['name'],
442
+                    'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
443
+                    'vat_rate'         => $details['vat_rate'],
444
+                    'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
445
+                    'tax'              => $details['tax'],
446
+                    'item_price'       => $details['item_price'],
447
+                    'custom_price'     => $details['custom_price'],
448
+                    'quantity'         => $details['quantity'],
449
+                    'discount'         => $details['discount'],
450
+                    'subtotal'         => $details['subtotal'],
451
+                    'price'            => $details['price'],
452
+                    'meta'             => $details['meta'],
453
+                    'fees'             => $details['fees'],
454
+                );
455
+
456
+                $item_columns = array_keys ( $fields );
457
+
458
+                foreach ( $fields as $key => $val ) {
459
+                    if ( is_null( $val ) ) {
460
+                        $val = '';
461
+                    }
462
+                    $val = maybe_serialize( $val );
463
+                    $fields[ $key ] = $wpdb->prepare( '%s', $val );
464
+                }
465
+
466
+                $fields = implode( ', ', $fields );
467
+                $item_rows[] = "($fields)";
468
+            }
469
+
470
+            $item_rows    = implode( ', ', $item_rows );
471
+            $item_columns = implode( ', ', $item_columns );
472
+            $wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
473
+        }
474
+
475
+        if ( empty( $invoice_rows ) ) {
476
+            return;
477
+        }
478
+
479
+        $invoice_rows = implode( ', ', $invoice_rows );
480
+        $wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
481
+
482
+    }
483
+
484
+    /**
485
+     * Migrates old invoices to new invoices.
486
+     *
487
+     */
488
+    public static function rename_gateways_label() {
489
+        global $wpdb;
490
+
491
+        foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
492
+
493
+            $wpdb->update(
494
+                $wpdb->prefix . 'getpaid_invoices',
495
+                array( 'gateway' => $gateway ),
496
+                array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
497
+                '%s',
498
+                '%s'
499
+            );
500
+
501
+        }
502
+    }
503 503
 
504 504
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since   2.0.2
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 /**
14 14
  * The main installer/updater class.
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @param string $upgrade_from The current invoicing version.
27 27
 	 */
28
-	public function upgrade_db( $upgrade_from ) {
28
+	public function upgrade_db($upgrade_from) {
29 29
 
30 30
 		// Save the current invoicing version.
31
-		update_option( 'wpinv_version', WPINV_VERSION );
31
+		update_option('wpinv_version', WPINV_VERSION);
32 32
 
33 33
 		// Setup the invoice Custom Post Type.
34 34
 		GetPaid_Post_Types::register_post_types();
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		// Create any missing database tables.
49 49
 		$method = "upgrade_from_$upgrade_from";
50 50
 
51
-		if ( method_exists( $this, $method ) ) {
51
+		if (method_exists($this, $method)) {
52 52
 			$this->$method();
53 53
 		}
54 54
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		$this->create_invoice_items_table();
65 65
 
66 66
 		// Save default tax rates.
67
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
67
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
68 68
 	}
69 69
 
70 70
 	/**
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
 		global $wpdb;
76 76
 
77 77
 		// Invoices.
78
-		$results = $wpdb->get_results( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
79
-		if ( ! empty( $results ) ) {
80
-			$wpdb->query( "UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
78
+		$results = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
79
+		if (!empty($results)) {
80
+			$wpdb->query("UPDATE {$wpdb->posts} SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
81 81
 
82 82
 			// Clean post cache
83
-			foreach ( $results as $row ) {
84
-				clean_post_cache( $row->ID );
83
+			foreach ($results as $row) {
84
+				clean_post_cache($row->ID);
85 85
 			}
86 86
 
87 87
 		}
88 88
 
89 89
 		// Item meta key changes
90 90
 		$query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
91
-		$results = $wpdb->get_results( $query );
91
+		$results = $wpdb->get_results($query);
92 92
 
93
-		if ( ! empty( $results ) ) {
94
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
95
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
96
-			$wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
93
+		if (!empty($results)) {
94
+			$wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )");
95
+			$wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'");
96
+			$wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'");
97 97
 
98
-			foreach ( $results as $row ) {
99
-				clean_post_cache( $row->post_id );
98
+			foreach ($results as $row) {
99
+				clean_post_cache($row->post_id);
100 100
 			}
101 101
 
102 102
 		}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function upgrade_from_207() {
131 131
 		global $wpdb;
132
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);" );
132
+		$wpdb->query("ALTER TABLE {$wpdb->prefix}getpaid_invoice_items MODIFY COLUMN quantity FLOAT(20);");
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 */
139 139
 	public function add_capabilities() {
140
-		$GLOBALS['wp_roles']->add_cap( 'administrator', 'manage_invoicing' );
140
+		$GLOBALS['wp_roles']->add_cap('administrator', 'manage_invoicing');
141 141
 	}
142 142
 
143 143
 	/**
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 
153 153
 				// Checkout page.
154 154
 				'checkout_page' => array(
155
-					'name'      => _x( 'gp-checkout', 'Page slug', 'invoicing' ),
156
-					'title'     => _x( 'Checkout', 'Page title', 'invoicing' ),
155
+					'name'      => _x('gp-checkout', 'Page slug', 'invoicing'),
156
+					'title'     => _x('Checkout', 'Page title', 'invoicing'),
157 157
 					'content'   => '
158 158
 						<!-- wp:shortcode -->
159 159
 						[wpinv_checkout]
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 
165 165
 				// Invoice history page.
166 166
 				'invoice_history_page' => array(
167
-					'name'    => _x( 'gp-invoices', 'Page slug', 'invoicing' ),
168
-					'title'   => _x( 'My Invoices', 'Page title', 'invoicing' ),
167
+					'name'    => _x('gp-invoices', 'Page slug', 'invoicing'),
168
+					'title'   => _x('My Invoices', 'Page title', 'invoicing'),
169 169
 					'content' => '
170 170
 					<!-- wp:shortcode -->
171 171
 					[wpinv_history]
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
 				// Success page content.
178 178
 				'success_page' => array(
179
-					'name'     => _x( 'gp-receipt', 'Page slug', 'invoicing' ),
180
-					'title'    => _x( 'Payment Confirmation', 'Page title', 'invoicing' ),
179
+					'name'     => _x('gp-receipt', 'Page slug', 'invoicing'),
180
+					'title'    => _x('Payment Confirmation', 'Page title', 'invoicing'),
181 181
 					'content'  => '
182 182
 					<!-- wp:shortcode -->
183 183
 					[wpinv_receipt]
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
 
189 189
 				// Failure page content.
190 190
 				'failure_page' => array(
191
-					'name'    => _x( 'gp-transaction-failed', 'Page slug', 'invoicing' ),
192
-					'title'   => _x( 'Transaction Failed', 'Page title', 'invoicing' ),
193
-					'content' => __( 'Your transaction failed, please try again or contact site support.', 'invoicing' ),
191
+					'name'    => _x('gp-transaction-failed', 'Page slug', 'invoicing'),
192
+					'title'   => _x('Transaction Failed', 'Page title', 'invoicing'),
193
+					'content' => __('Your transaction failed, please try again or contact site support.', 'invoicing'),
194 194
 					'parent'  => 'gp-checkout',
195 195
 				),
196 196
 
197 197
 				// Subscriptions history page.
198 198
 				'invoice_subscription_page' => array(
199
-					'name'    => _x( 'gp-subscriptions', 'Page slug', 'invoicing' ),
200
-					'title'   => _x( 'My Subscriptions', 'Page title', 'invoicing' ),
199
+					'name'    => _x('gp-subscriptions', 'Page slug', 'invoicing'),
200
+					'title'   => _x('My Subscriptions', 'Page title', 'invoicing'),
201 201
 					'content' => '
202 202
 					<!-- wp:shortcode -->
203 203
 					[wpinv_subscriptions]
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function create_pages() {
219 219
 
220
-		foreach ( self::get_pages() as $key => $page ) {
221
-			wpinv_create_page( esc_sql( $page['name'] ), $key, $page['title'], $page['content'], $page['parent'] );
220
+		foreach (self::get_pages() as $key => $page) {
221
+			wpinv_create_page(esc_sql($page['name']), $key, $page['title'], $page['content'], $page['parent']);
222 222
 		}
223 223
 
224 224
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		global $wpdb;
233 233
 
234
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
234
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
235 235
 
236 236
 		// Create tables.
237 237
 		$charset_collate = $wpdb->get_charset_collate();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			KEY customer_and_status (customer_id, status)
259 259
 		  ) $charset_collate;";
260 260
 
261
-		dbDelta( $sql );
261
+		dbDelta($sql);
262 262
 
263 263
 	}
264 264
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	public function create_invoices_table() {
270 270
 		global $wpdb;
271 271
 
272
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
272
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
273 273
 
274 274
 		// Create tables.
275 275
 		$charset_collate = $wpdb->get_charset_collate();
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 			KEY `key` (`key`)
310 310
 		  ) $charset_collate;";
311 311
 
312
-		dbDelta( $sql );
312
+		dbDelta($sql);
313 313
 
314 314
 	}
315 315
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	public function create_invoice_items_table() {
321 321
 		global $wpdb;
322 322
 
323
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
323
+		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
324 324
 
325 325
 		// Create tables.
326 326
 		$charset_collate = $wpdb->get_charset_collate();
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 			KEY post_id (post_id)
347 347
 		  ) $charset_collate;";
348 348
 
349
-		dbDelta( $sql );
349
+		dbDelta($sql);
350 350
 
351 351
 	}
352 352
 
@@ -359,40 +359,40 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$invoices_table      = $wpdb->prefix . 'getpaid_invoices';
361 361
 		$invoice_items_table = $wpdb->prefix . 'getpaid_invoice_items';
362
-		$migrated            = $wpdb->get_col( "SELECT post_id FROM $invoices_table" );
362
+		$migrated            = $wpdb->get_col("SELECT post_id FROM $invoices_table");
363 363
 		$invoices            = array_unique(
364 364
 			get_posts(
365 365
 				array(
366
-					'post_type'      => array( 'wpi_invoice', 'wpi_quote' ),
366
+					'post_type'      => array('wpi_invoice', 'wpi_quote'),
367 367
 					'posts_per_page' => -1,
368 368
 					'fields'         => 'ids',
369
-					'post_status'    => array_keys( get_post_stati() ),
369
+					'post_status'    => array_keys(get_post_stati()),
370 370
 					'exclude'        => (array) $migrated,
371 371
 				)
372 372
 			)
373 373
 		);
374 374
 
375 375
 		// Abort if we do not have any invoices.
376
-		if ( empty( $invoices ) ) {
376
+		if (empty($invoices)) {
377 377
 			return;
378 378
 		}
379 379
 
380
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php' );
380
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-legacy-invoice.php');
381 381
 
382 382
 		$invoice_rows = array();
383
-		foreach ( $invoices as $invoice ) {
383
+		foreach ($invoices as $invoice) {
384 384
 
385
-			$invoice = new WPInv_Legacy_Invoice( $invoice );
385
+			$invoice = new WPInv_Legacy_Invoice($invoice);
386 386
 
387
-			if ( empty( $invoice->ID ) ) {
387
+			if (empty($invoice->ID)) {
388 388
 				return;
389 389
 			}
390 390
 
391
-			$fields = array (
391
+			$fields = array(
392 392
 				'post_id'        => $invoice->ID,
393 393
 				'number'         => $invoice->get_number(),
394 394
 				'key'            => $invoice->get_key(),
395
-				'type'           => str_replace( 'wpi_', '', $invoice->post_type ),
395
+				'type'           => str_replace('wpi_', '', $invoice->post_type),
396 396
 				'mode'           => $invoice->mode,
397 397
 				'user_ip'        => $invoice->get_ip(),
398 398
 				'first_name'     => $invoice->get_first_name(),
@@ -421,27 +421,27 @@  discard block
 block discarded – undo
421 421
 				'custom_meta'    => $invoice->payment_meta
422 422
 			);
423 423
 
424
-			foreach ( $fields as $key => $val ) {
425
-				if ( is_null( $val ) ) {
424
+			foreach ($fields as $key => $val) {
425
+				if (is_null($val)) {
426 426
 					$val = '';
427 427
 				}
428
-				$val = maybe_serialize( $val );
429
-				$fields[ $key ] = $wpdb->prepare( '%s', $val );
428
+				$val = maybe_serialize($val);
429
+				$fields[$key] = $wpdb->prepare('%s', $val);
430 430
 			}
431 431
 
432
-			$fields = implode( ', ', $fields );
432
+			$fields = implode(', ', $fields);
433 433
 			$invoice_rows[] = "($fields)";
434 434
 
435 435
 			$item_rows    = array();
436 436
 			$item_columns = array();
437
-			foreach ( $invoice->get_cart_details() as $details ) {
437
+			foreach ($invoice->get_cart_details() as $details) {
438 438
 				$fields = array(
439 439
 					'post_id'          => $invoice->ID,
440 440
 					'item_id'          => $details['id'],
441 441
 					'item_name'        => $details['name'],
442
-					'item_description' => empty( $details['meta']['description'] ) ? '' : $details['meta']['description'],
442
+					'item_description' => empty($details['meta']['description']) ? '' : $details['meta']['description'],
443 443
 					'vat_rate'         => $details['vat_rate'],
444
-					'vat_class'        => empty( $details['vat_class'] ) ? '_standard' : $details['vat_class'],
444
+					'vat_class'        => empty($details['vat_class']) ? '_standard' : $details['vat_class'],
445 445
 					'tax'              => $details['tax'],
446 446
 					'item_price'       => $details['item_price'],
447 447
 					'custom_price'     => $details['custom_price'],
@@ -453,31 +453,31 @@  discard block
 block discarded – undo
453 453
 					'fees'             => $details['fees'],
454 454
 				);
455 455
 
456
-				$item_columns = array_keys ( $fields );
456
+				$item_columns = array_keys($fields);
457 457
 
458
-				foreach ( $fields as $key => $val ) {
459
-					if ( is_null( $val ) ) {
458
+				foreach ($fields as $key => $val) {
459
+					if (is_null($val)) {
460 460
 						$val = '';
461 461
 					}
462
-					$val = maybe_serialize( $val );
463
-					$fields[ $key ] = $wpdb->prepare( '%s', $val );
462
+					$val = maybe_serialize($val);
463
+					$fields[$key] = $wpdb->prepare('%s', $val);
464 464
 				}
465 465
 
466
-				$fields = implode( ', ', $fields );
466
+				$fields = implode(', ', $fields);
467 467
 				$item_rows[] = "($fields)";
468 468
 			}
469 469
 
470
-			$item_rows    = implode( ', ', $item_rows );
471
-			$item_columns = implode( ', ', $item_columns );
472
-			$wpdb->query( "INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows" );
470
+			$item_rows    = implode(', ', $item_rows);
471
+			$item_columns = implode(', ', $item_columns);
472
+			$wpdb->query("INSERT INTO $invoice_items_table ($item_columns) VALUES $item_rows");
473 473
 		}
474 474
 
475
-		if ( empty( $invoice_rows ) ) {
475
+		if (empty($invoice_rows)) {
476 476
 			return;
477 477
 		}
478 478
 
479
-		$invoice_rows = implode( ', ', $invoice_rows );
480
-		$wpdb->query( "INSERT INTO $invoices_table VALUES $invoice_rows" );
479
+		$invoice_rows = implode(', ', $invoice_rows);
480
+		$wpdb->query("INSERT INTO $invoices_table VALUES $invoice_rows");
481 481
 
482 482
 	}
483 483
 
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
 	public static function rename_gateways_label() {
489 489
 		global $wpdb;
490 490
 
491
-		foreach ( array_keys( wpinv_get_payment_gateways() ) as $gateway ) {
491
+		foreach (array_keys(wpinv_get_payment_gateways()) as $gateway) {
492 492
 
493 493
 			$wpdb->update(
494 494
 				$wpdb->prefix . 'getpaid_invoices',
495
-				array( 'gateway' => $gateway ),
496
-				array( 'gateway' => wpinv_get_gateway_admin_label( $gateway ) ),
495
+				array('gateway' => $gateway),
496
+				array('gateway' => wpinv_get_gateway_admin_label($gateway)),
497 497
 				'%s',
498 498
 				'%s'
499 499
 			);
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * Bail if we are not in WP.
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16 16
 add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
18
-	$this_version = "0.1.49";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
22
-	}
17
+    global $ayecode_ui_version,$ayecode_ui_file_key;
18
+    $this_version = "0.1.49";
19
+    if(version_compare($this_version , $ayecode_ui_version, '>')){
20
+        $ayecode_ui_version = $this_version ;
21
+        $ayecode_ui_file_key = wp_hash( __FILE__ );
22
+    }
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28 28
 add_action('after_setup_theme', function () {
29
-	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
-	}
29
+    global $ayecode_ui_file_key;
30
+    if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
+        include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
+        include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
+    }
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39 39
 if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
42
-			return false;
43
-		}
44
-		return AUI::instance();
45
-	}
40
+    function aui(){
41
+        if(!class_exists("AUI",false)){
42
+            return false;
43
+        }
44
+        return AUI::instance();
45
+    }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.49";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.
vendor/composer/InstalledVersions.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 class InstalledVersions
13 13
 {
14 14
 private static $installed = array (
15
-  'root' => 
16
-  array (
15
+    'root' => 
16
+    array (
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
@@ -21,87 +21,87 @@  discard block
 block discarded – undo
21 21
     ),
22 22
     'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
23 23
     'name' => 'ayecode/invoicing',
24
-  ),
25
-  'versions' => 
26
-  array (
24
+    ),
25
+    'versions' => 
26
+    array (
27 27
     'ayecode/ayecode-connect-helper' => 
28 28
     array (
29
-      'pretty_version' => '1.0.3',
30
-      'version' => '1.0.3.0',
31
-      'aliases' => 
32
-      array (
33
-      ),
34
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
29
+        'pretty_version' => '1.0.3',
30
+        'version' => '1.0.3.0',
31
+        'aliases' => 
32
+        array (
33
+        ),
34
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37 37
     array (
38
-      'pretty_version' => 'dev-master',
39
-      'version' => 'dev-master',
40
-      'aliases' => 
41
-      array (
42
-      ),
43
-      'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
38
+        'pretty_version' => 'dev-master',
39
+        'version' => 'dev-master',
40
+        'aliases' => 
41
+        array (
42
+        ),
43
+        'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46 46
     array (
47
-      'pretty_version' => '0.1.49',
48
-      'version' => '0.1.49.0',
49
-      'aliases' => 
50
-      array (
51
-      ),
52
-      'reference' => '00082d05acd50d4ce103e054f483ca24f106f93c',
47
+        'pretty_version' => '0.1.49',
48
+        'version' => '0.1.49.0',
49
+        'aliases' => 
50
+        array (
51
+        ),
52
+        'reference' => '00082d05acd50d4ce103e054f483ca24f106f93c',
53 53
     ),
54 54
     'ayecode/wp-font-awesome-settings' => 
55 55
     array (
56
-      'pretty_version' => '1.0.12',
57
-      'version' => '1.0.12.0',
58
-      'aliases' => 
59
-      array (
60
-      ),
61
-      'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
56
+        'pretty_version' => '1.0.12',
57
+        'version' => '1.0.12.0',
58
+        'aliases' => 
59
+        array (
60
+        ),
61
+        'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
62 62
     ),
63 63
     'ayecode/wp-super-duper' => 
64 64
     array (
65
-      'pretty_version' => '1.0.26',
66
-      'version' => '1.0.26.0',
67
-      'aliases' => 
68
-      array (
69
-      ),
70
-      'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
65
+        'pretty_version' => '1.0.26',
66
+        'version' => '1.0.26.0',
67
+        'aliases' => 
68
+        array (
69
+        ),
70
+        'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
71 71
     ),
72 72
     'composer/installers' => 
73 73
     array (
74
-      'pretty_version' => 'v1.11.0',
75
-      'version' => '1.11.0.0',
76
-      'aliases' => 
77
-      array (
78
-      ),
79
-      'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
74
+        'pretty_version' => 'v1.11.0',
75
+        'version' => '1.11.0.0',
76
+        'aliases' => 
77
+        array (
78
+        ),
79
+        'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
80 80
     ),
81 81
     'maxmind-db/reader' => 
82 82
     array (
83
-      'pretty_version' => 'v1.6.0',
84
-      'version' => '1.6.0.0',
85
-      'aliases' => 
86
-      array (
87
-      ),
88
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
83
+        'pretty_version' => 'v1.6.0',
84
+        'version' => '1.6.0.0',
85
+        'aliases' => 
86
+        array (
87
+        ),
88
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
89 89
     ),
90 90
     'roundcube/plugin-installer' => 
91 91
     array (
92
-      'replaced' => 
93
-      array (
92
+        'replaced' => 
93
+        array (
94 94
         0 => '*',
95
-      ),
95
+        ),
96 96
     ),
97 97
     'shama/baton' => 
98 98
     array (
99
-      'replaced' => 
100
-      array (
99
+        'replaced' => 
100
+        array (
101 101
         0 => '*',
102
-      ),
102
+        ),
103
+    ),
103 104
     ),
104
-  ),
105 105
 );
106 106
 
107 107
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,93 +11,93 @@
 block discarded – undo
11 11
 
12 12
 class InstalledVersions
13 13
 {
14
-private static $installed = array (
14
+private static $installed = array(
15 15
   'root' => 
16
-  array (
16
+  array(
17 17
     'pretty_version' => 'dev-master',
18 18
     'version' => 'dev-master',
19 19
     'aliases' => 
20
-    array (
20
+    array(
21 21
     ),
22 22
     'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
23 23
     'name' => 'ayecode/invoicing',
24 24
   ),
25 25
   'versions' => 
26
-  array (
26
+  array(
27 27
     'ayecode/ayecode-connect-helper' => 
28
-    array (
28
+    array(
29 29
       'pretty_version' => '1.0.3',
30 30
       'version' => '1.0.3.0',
31 31
       'aliases' => 
32
-      array (
32
+      array(
33 33
       ),
34 34
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
35 35
     ),
36 36
     'ayecode/invoicing' => 
37
-    array (
37
+    array(
38 38
       'pretty_version' => 'dev-master',
39 39
       'version' => 'dev-master',
40 40
       'aliases' => 
41
-      array (
41
+      array(
42 42
       ),
43 43
       'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46
-    array (
46
+    array(
47 47
       'pretty_version' => '0.1.49',
48 48
       'version' => '0.1.49.0',
49 49
       'aliases' => 
50
-      array (
50
+      array(
51 51
       ),
52 52
       'reference' => '00082d05acd50d4ce103e054f483ca24f106f93c',
53 53
     ),
54 54
     'ayecode/wp-font-awesome-settings' => 
55
-    array (
55
+    array(
56 56
       'pretty_version' => '1.0.12',
57 57
       'version' => '1.0.12.0',
58 58
       'aliases' => 
59
-      array (
59
+      array(
60 60
       ),
61 61
       'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
62 62
     ),
63 63
     'ayecode/wp-super-duper' => 
64
-    array (
64
+    array(
65 65
       'pretty_version' => '1.0.26',
66 66
       'version' => '1.0.26.0',
67 67
       'aliases' => 
68
-      array (
68
+      array(
69 69
       ),
70 70
       'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
71 71
     ),
72 72
     'composer/installers' => 
73
-    array (
73
+    array(
74 74
       'pretty_version' => 'v1.11.0',
75 75
       'version' => '1.11.0.0',
76 76
       'aliases' => 
77
-      array (
77
+      array(
78 78
       ),
79 79
       'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
80 80
     ),
81 81
     'maxmind-db/reader' => 
82
-    array (
82
+    array(
83 83
       'pretty_version' => 'v1.6.0',
84 84
       'version' => '1.6.0.0',
85 85
       'aliases' => 
86
-      array (
86
+      array(
87 87
       ),
88 88
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
89 89
     ),
90 90
     'roundcube/plugin-installer' => 
91
-    array (
91
+    array(
92 92
       'replaced' => 
93
-      array (
93
+      array(
94 94
         0 => '*',
95 95
       ),
96 96
     ),
97 97
     'shama/baton' => 
98
-    array (
98
+    array(
99 99
       'replaced' => 
100
-      array (
100
+      array(
101 101
         0 => '*',
102 102
       ),
103 103
     ),
Please login to merge, or discard this patch.
vendor/composer/installed.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php return array (
2
-  'root' => 
3
-  array (
2
+    'root' => 
3
+    array (
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
@@ -8,85 +8,85 @@  discard block
 block discarded – undo
8 8
     ),
9 9
     'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
10 10
     'name' => 'ayecode/invoicing',
11
-  ),
12
-  'versions' => 
13
-  array (
11
+    ),
12
+    'versions' => 
13
+    array (
14 14
     'ayecode/ayecode-connect-helper' => 
15 15
     array (
16
-      'pretty_version' => '1.0.3',
17
-      'version' => '1.0.3.0',
18
-      'aliases' => 
19
-      array (
20
-      ),
21
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
16
+        'pretty_version' => '1.0.3',
17
+        'version' => '1.0.3.0',
18
+        'aliases' => 
19
+        array (
20
+        ),
21
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24 24
     array (
25
-      'pretty_version' => 'dev-master',
26
-      'version' => 'dev-master',
27
-      'aliases' => 
28
-      array (
29
-      ),
30
-      'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
25
+        'pretty_version' => 'dev-master',
26
+        'version' => 'dev-master',
27
+        'aliases' => 
28
+        array (
29
+        ),
30
+        'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33 33
     array (
34
-      'pretty_version' => '0.1.49',
35
-      'version' => '0.1.49.0',
36
-      'aliases' => 
37
-      array (
38
-      ),
39
-      'reference' => '00082d05acd50d4ce103e054f483ca24f106f93c',
34
+        'pretty_version' => '0.1.49',
35
+        'version' => '0.1.49.0',
36
+        'aliases' => 
37
+        array (
38
+        ),
39
+        'reference' => '00082d05acd50d4ce103e054f483ca24f106f93c',
40 40
     ),
41 41
     'ayecode/wp-font-awesome-settings' => 
42 42
     array (
43
-      'pretty_version' => '1.0.12',
44
-      'version' => '1.0.12.0',
45
-      'aliases' => 
46
-      array (
47
-      ),
48
-      'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
43
+        'pretty_version' => '1.0.12',
44
+        'version' => '1.0.12.0',
45
+        'aliases' => 
46
+        array (
47
+        ),
48
+        'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
49 49
     ),
50 50
     'ayecode/wp-super-duper' => 
51 51
     array (
52
-      'pretty_version' => '1.0.26',
53
-      'version' => '1.0.26.0',
54
-      'aliases' => 
55
-      array (
56
-      ),
57
-      'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
52
+        'pretty_version' => '1.0.26',
53
+        'version' => '1.0.26.0',
54
+        'aliases' => 
55
+        array (
56
+        ),
57
+        'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
58 58
     ),
59 59
     'composer/installers' => 
60 60
     array (
61
-      'pretty_version' => 'v1.11.0',
62
-      'version' => '1.11.0.0',
63
-      'aliases' => 
64
-      array (
65
-      ),
66
-      'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
61
+        'pretty_version' => 'v1.11.0',
62
+        'version' => '1.11.0.0',
63
+        'aliases' => 
64
+        array (
65
+        ),
66
+        'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
67 67
     ),
68 68
     'maxmind-db/reader' => 
69 69
     array (
70
-      'pretty_version' => 'v1.6.0',
71
-      'version' => '1.6.0.0',
72
-      'aliases' => 
73
-      array (
74
-      ),
75
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
70
+        'pretty_version' => 'v1.6.0',
71
+        'version' => '1.6.0.0',
72
+        'aliases' => 
73
+        array (
74
+        ),
75
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
76 76
     ),
77 77
     'roundcube/plugin-installer' => 
78 78
     array (
79
-      'replaced' => 
80
-      array (
79
+        'replaced' => 
80
+        array (
81 81
         0 => '*',
82
-      ),
82
+        ),
83 83
     ),
84 84
     'shama/baton' => 
85 85
     array (
86
-      'replaced' => 
87
-      array (
86
+        'replaced' => 
87
+        array (
88 88
         0 => '*',
89
-      ),
89
+        ),
90
+    ),
90 91
     ),
91
-  ),
92 92
 );
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,90 +1,90 @@
 block discarded – undo
1
-<?php return array (
1
+<?php return array(
2 2
   'root' => 
3
-  array (
3
+  array(
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
7
-    array (
7
+    array(
8 8
     ),
9 9
     'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
10 10
     'name' => 'ayecode/invoicing',
11 11
   ),
12 12
   'versions' => 
13
-  array (
13
+  array(
14 14
     'ayecode/ayecode-connect-helper' => 
15
-    array (
15
+    array(
16 16
       'pretty_version' => '1.0.3',
17 17
       'version' => '1.0.3.0',
18 18
       'aliases' => 
19
-      array (
19
+      array(
20 20
       ),
21 21
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24
-    array (
24
+    array(
25 25
       'pretty_version' => 'dev-master',
26 26
       'version' => 'dev-master',
27 27
       'aliases' => 
28
-      array (
28
+      array(
29 29
       ),
30 30
       'reference' => '7382ee9010a937feb1a5f52ade4e45a6b171565e',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33
-    array (
33
+    array(
34 34
       'pretty_version' => '0.1.49',
35 35
       'version' => '0.1.49.0',
36 36
       'aliases' => 
37
-      array (
37
+      array(
38 38
       ),
39 39
       'reference' => '00082d05acd50d4ce103e054f483ca24f106f93c',
40 40
     ),
41 41
     'ayecode/wp-font-awesome-settings' => 
42
-    array (
42
+    array(
43 43
       'pretty_version' => '1.0.12',
44 44
       'version' => '1.0.12.0',
45 45
       'aliases' => 
46
-      array (
46
+      array(
47 47
       ),
48 48
       'reference' => '754cca6fda775f3e0b56b90a810dfcaea62ea288',
49 49
     ),
50 50
     'ayecode/wp-super-duper' => 
51
-    array (
51
+    array(
52 52
       'pretty_version' => '1.0.26',
53 53
       'version' => '1.0.26.0',
54 54
       'aliases' => 
55
-      array (
55
+      array(
56 56
       ),
57 57
       'reference' => '9f0c4fc4ff5fc3ffbe3346ae9964ae11b7032131',
58 58
     ),
59 59
     'composer/installers' => 
60
-    array (
60
+    array(
61 61
       'pretty_version' => 'v1.11.0',
62 62
       'version' => '1.11.0.0',
63 63
       'aliases' => 
64
-      array (
64
+      array(
65 65
       ),
66 66
       'reference' => 'ae03311f45dfe194412081526be2e003960df74b',
67 67
     ),
68 68
     'maxmind-db/reader' => 
69
-    array (
69
+    array(
70 70
       'pretty_version' => 'v1.6.0',
71 71
       'version' => '1.6.0.0',
72 72
       'aliases' => 
73
-      array (
73
+      array(
74 74
       ),
75 75
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
76 76
     ),
77 77
     'roundcube/plugin-installer' => 
78
-    array (
78
+    array(
79 79
       'replaced' => 
80
-      array (
80
+      array(
81 81
         0 => '*',
82 82
       ),
83 83
     ),
84 84
     'shama/baton' => 
85
-    array (
85
+    array(
86 86
       'replaced' => 
87
-      array (
87
+      array(
88 88
         0 => '*',
89 89
       ),
90 90
     ),
Please login to merge, or discard this patch.
includes/admin/views/html-gateways-edit.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 $gateways = wpinv_get_payment_gateways();
10
-ksort( $gateways );
10
+ksort($gateways);
11 11
 
12 12
 ?>
13 13
 <div class="table-responsive">
14 14
     <table id="wpinv_gateways_select" class="table border bg-white form-table">
15
-        <caption><?php echo esc_html_e( 'This table displays installed payment methods.', 'invoicing' ); ?></caption>
15
+        <caption><?php echo esc_html_e('This table displays installed payment methods.', 'invoicing'); ?></caption>
16 16
 
17 17
         <thead>
18 18
             <tr class="table-light">
19 19
 
20 20
                 <th scope="col" class="border-bottom border-top text-left">
21
-                    <?php _e( 'Payment Method', 'invoicing' ); ?>
21
+                    <?php _e('Payment Method', 'invoicing'); ?>
22 22
                 </th>
23 23
 
24 24
                 <th scope="col" class="border-bottom border-top text-center">
25
-                    <?php _e( 'Enabled', 'invoicing' ); ?>
25
+                    <?php _e('Enabled', 'invoicing'); ?>
26 26
                 </th>
27 27
 
28 28
                 <th scope="col" class="border-bottom border-top text-center">
29
-                    <?php _e( 'Supports Subscriptions', 'invoicing' ); ?>
29
+                    <?php _e('Supports Subscriptions', 'invoicing'); ?>
30 30
                 </th>
31 31
 
32 32
                 <th scope="col" class="border-bottom border-top text-right" style="width:32px">&nbsp;</th>
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
         </thead>
36 36
 
37 37
         <tbody>
38
-            <?php foreach ( $gateways as $id => $gateway ) : ?>
38
+            <?php foreach ($gateways as $id => $gateway) : ?>
39 39
                 <tr>
40 40
                     <td class="getpaid-payment-method text-left">
41
-                        <a style="color: #0073aa;" href="<?php echo esc_url( add_query_arg( 'section', $id ) ); ?>" class="font-weight-bold"><?php echo sanitize_text_field( $gateway['admin_label'] ); ?></a>
41
+                        <a style="color: #0073aa;" href="<?php echo esc_url(add_query_arg('section', $id)); ?>" class="font-weight-bold"><?php echo sanitize_text_field($gateway['admin_label']); ?></a>
42 42
                     </td>
43 43
                     <td class="getpaid-payment-method-enabled text-center">
44 44
                         <?php
45 45
 
46
-                            if ( wpinv_is_gateway_active( $id ) ) {
46
+                            if (wpinv_is_gateway_active($id)) {
47 47
                                 echo "<i class='text-success fa fa-check'></i>";
48 48
                             } else {
49 49
                                 echo "<i class='text-dark fa fa-times'></i>";
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
                     <td class="getpaid-payment-method-subscription text-center">
55 55
                         <?php
56 56
 
57
-                            $supports = apply_filters( "wpinv_{$id}_support_subscription", false );
58
-                            $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $id );
57
+                            $supports = apply_filters("wpinv_{$id}_support_subscription", false);
58
+                            $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $id);
59 59
 
60
-                            if ( $supports ) {
60
+                            if ($supports) {
61 61
                                 echo "<i class='text-success fa fa-check'></i>";
62 62
                             } else {
63 63
                                 echo "<i class='text-dark fa fa-times'></i>";
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                     </td>
68 68
 
69 69
                     <td class="getpaid-payment-method-action text-right">
70
-                        <a class="button button-secondary" href="<?php echo esc_url( add_query_arg( 'section', $id ) ); ?>"><?php _e( 'Manage', 'invoicing' ); ?></a>
70
+                        <a class="button button-secondary" href="<?php echo esc_url(add_query_arg('section', $id)); ?>"><?php _e('Manage', 'invoicing'); ?></a>
71 71
                     </td>
72 72
 
73 73
                 </tr>
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
         <tfoot>
78 78
             <tr class="table-light">
79 79
                 <td colspan="4" class="border-top">
80
-                    <a class="button button-secondary getpaid-install-gateways" href="<?php echo esc_url( admin_url( 'admin.php?page=wpi-addons&tab=gateways' ) ); ?>">
81
-                        <span><?php _e( 'Add Payment Methods', 'invoicing' ); ?></span>
80
+                    <a class="button button-secondary getpaid-install-gateways" href="<?php echo esc_url(admin_url('admin.php?page=wpi-addons&tab=gateways')); ?>">
81
+                        <span><?php _e('Add Payment Methods', 'invoicing'); ?></span>
82 82
                     </a>
83 83
                 </td>
84 84
             </tr>
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-paypal-gateway.php 2 patches
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -13,94 +13,94 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Paypal_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 = 'paypal';
21 21
 
22 22
     /**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27 27
     protected $supports = array( 'subscription', 'sandbox', 'single_subscription_group' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34 34
     public $order = 1;
35 35
 
36 36
     /**
37
-	 * Stores line items to send to PayPal.
38
-	 *
39
-	 * @var array
40
-	 */
37
+     * Stores line items to send to PayPal.
38
+     *
39
+     * @var array
40
+     */
41 41
     protected $line_items = array();
42 42
 
43 43
     /**
44
-	 * Endpoint for requests from PayPal.
45
-	 *
46
-	 * @var string
47
-	 */
48
-	protected $notify_url;
49
-
50
-	/**
51
-	 * Endpoint for requests to PayPal.
52
-	 *
53
-	 * @var string
54
-	 */
44
+     * Endpoint for requests from PayPal.
45
+     *
46
+     * @var string
47
+     */
48
+    protected $notify_url;
49
+
50
+    /**
51
+     * Endpoint for requests to PayPal.
52
+     *
53
+     * @var string
54
+     */
55 55
     protected $endpoint;
56 56
 
57 57
     /**
58
-	 * Currencies this gateway is allowed for.
59
-	 *
60
-	 * @var array
61
-	 */
62
-	public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' );
58
+     * Currencies this gateway is allowed for.
59
+     *
60
+     * @var array
61
+     */
62
+    public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' );
63 63
 
64 64
     /**
65
-	 * URL to view a transaction.
66
-	 *
67
-	 * @var string
68
-	 */
65
+     * URL to view a transaction.
66
+     *
67
+     * @var string
68
+     */
69 69
     public $view_transaction_url = 'https://www.{sandbox}paypal.com/activity/payment/%s';
70 70
 
71 71
     /**
72
-	 * URL to view a subscription.
73
-	 *
74
-	 * @var string
75
-	 */
76
-	public $view_subscription_url = 'https://www.{sandbox}paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=%s';
72
+     * URL to view a subscription.
73
+     *
74
+     * @var string
75
+     */
76
+    public $view_subscription_url = 'https://www.{sandbox}paypal.com/cgi-bin/webscr?cmd=_profile-recurring-payments&encrypted_profile_id=%s';
77 77
 
78 78
     /**
79
-	 * Class constructor.
80
-	 */
81
-	public function __construct() {
79
+     * Class constructor.
80
+     */
81
+    public function __construct() {
82 82
 
83 83
         $this->title                = __( 'PayPal Standard', 'invoicing' );
84 84
         $this->method_title         = __( 'PayPal Standard', 'invoicing' );
85 85
         $this->checkout_button_text = __( 'Proceed to PayPal', 'invoicing' );
86 86
         $this->notify_url           = wpinv_get_ipn_url( $this->id );
87 87
 
88
-		add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 );
88
+        add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 );
89 89
         add_filter( 'getpaid_paypal_sandbox_notice', array( $this, 'sandbox_notice' ) );
90 90
 
91 91
         parent::__construct();
92 92
     }
93 93
 
94 94
     /**
95
-	 * Process Payment.
96
-	 *
97
-	 *
98
-	 * @param WPInv_Invoice $invoice Invoice.
99
-	 * @param array $submission_data Posted checkout fields.
100
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
101
-	 * @return array
102
-	 */
103
-	public function process_payment( $invoice, $submission_data, $submission ) {
95
+     * Process Payment.
96
+     *
97
+     *
98
+     * @param WPInv_Invoice $invoice Invoice.
99
+     * @param array $submission_data Posted checkout fields.
100
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
101
+     * @return array
102
+     */
103
+    public function process_payment( $invoice, $submission_data, $submission ) {
104 104
 
105 105
         // Get redirect url.
106 106
         $paypal_redirect = $this->get_request_url( $invoice );
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
     }
124 124
 
125 125
     /**
126
-	 * Get the PayPal request URL for an invoice.
127
-	 *
128
-	 * @param  WPInv_Invoice $invoice Invoice object.
129
-	 * @return string
130
-	 */
131
-	public function get_request_url( $invoice ) {
126
+     * Get the PayPal request URL for an invoice.
127
+     *
128
+     * @param  WPInv_Invoice $invoice Invoice object.
129
+     * @return string
130
+     */
131
+    public function get_request_url( $invoice ) {
132 132
 
133 133
         // Endpoint for this request
134
-		$this->endpoint    = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?';
134
+        $this->endpoint    = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?';
135 135
 
136 136
         // Retrieve paypal args.
137 137
         $paypal_args       = map_deep( $this->get_paypal_args( $invoice ), 'urlencode' );
@@ -144,44 +144,44 @@  discard block
 block discarded – undo
144 144
 
145 145
         return add_query_arg( $paypal_args, $this->endpoint );
146 146
 
147
-	}
147
+    }
148 148
 
149 149
     /**
150
-	 * Get PayPal Args for passing to PP.
151
-	 *
152
-	 * @param  WPInv_Invoice $invoice Invoice object.
153
-	 * @return array
154
-	 */
155
-	protected function get_paypal_args( $invoice ) {
150
+     * Get PayPal Args for passing to PP.
151
+     *
152
+     * @param  WPInv_Invoice $invoice Invoice object.
153
+     * @return array
154
+     */
155
+    protected function get_paypal_args( $invoice ) {
156 156
 
157 157
         // Whether or not to send the line items as one item.
158
-		$force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', true, $invoice );
159
-
160
-		if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) {
161
-			$force_one_line_item = true;
162
-		}
163
-
164
-		$paypal_args = apply_filters(
165
-			'getpaid_paypal_args',
166
-			array_merge(
167
-				$this->get_transaction_args( $invoice ),
168
-				$this->get_line_item_args( $invoice, $force_one_line_item )
169
-			),
170
-			$invoice
171
-		);
172
-
173
-		return $this->fix_request_length( $invoice, $paypal_args );
158
+        $force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', true, $invoice );
159
+
160
+        if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) {
161
+            $force_one_line_item = true;
162
+        }
163
+
164
+        $paypal_args = apply_filters(
165
+            'getpaid_paypal_args',
166
+            array_merge(
167
+                $this->get_transaction_args( $invoice ),
168
+                $this->get_line_item_args( $invoice, $force_one_line_item )
169
+            ),
170
+            $invoice
171
+        );
172
+
173
+        return $this->fix_request_length( $invoice, $paypal_args );
174 174
     }
175 175
 
176 176
     /**
177
-	 * Get transaction args for paypal request.
178
-	 *
179
-	 * @param WPInv_Invoice $invoice Invoice object.
180
-	 * @return array
181
-	 */
182
-	protected function get_transaction_args( $invoice ) {
183
-
184
-		return array(
177
+     * Get transaction args for paypal request.
178
+     *
179
+     * @param WPInv_Invoice $invoice Invoice object.
180
+     * @return array
181
+     */
182
+    protected function get_transaction_args( $invoice ) {
183
+
184
+        return array(
185 185
             'cmd'           => '_cart',
186 186
             'business'      => wpinv_get_option( 'paypal_email', false ),
187 187
             'no_shipping'   => '1',
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
     }
207 207
 
208 208
     /**
209
-	 * Get line item args for paypal request.
210
-	 *
211
-	 * @param  WPInv_Invoice $invoice Invoice object.
212
-	 * @param  bool     $force_one_line_item Create only one item for this invoice.
213
-	 * @return array
214
-	 */
215
-	protected function get_line_item_args( $invoice, $force_one_line_item = false ) {
209
+     * Get line item args for paypal request.
210
+     *
211
+     * @param  WPInv_Invoice $invoice Invoice object.
212
+     * @param  bool     $force_one_line_item Create only one item for this invoice.
213
+     * @return array
214
+     */
215
+    protected function get_line_item_args( $invoice, $force_one_line_item = false ) {
216 216
 
217 217
         // Maybe send invoice as a single item.
218
-		if ( $force_one_line_item ) {
218
+        if ( $force_one_line_item ) {
219 219
             return $this->get_line_item_args_single_item( $invoice );
220 220
         }
221 221
 
@@ -235,129 +235,129 @@  discard block
 block discarded – undo
235 235
             $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_discount(), 2 );
236 236
         }
237 237
 
238
-		return array_merge( $line_item_args, $this->get_line_items() );
238
+        return array_merge( $line_item_args, $this->get_line_items() );
239 239
 
240 240
     }
241 241
 
242 242
     /**
243
-	 * Get line item args for paypal request as a single line item.
244
-	 *
245
-	 * @param  WPInv_Invoice $invoice Invoice object.
246
-	 * @return array
247
-	 */
248
-	protected function get_line_item_args_single_item( $invoice ) {
249
-		$this->delete_line_items();
243
+     * Get line item args for paypal request as a single line item.
244
+     *
245
+     * @param  WPInv_Invoice $invoice Invoice object.
246
+     * @return array
247
+     */
248
+    protected function get_line_item_args_single_item( $invoice ) {
249
+        $this->delete_line_items();
250 250
 
251 251
         $item_name = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() );
252
-		$this->add_line_item( $item_name, 1, wpinv_round_amount( (float) $invoice->get_total(), 2, true ), $invoice->get_id() );
252
+        $this->add_line_item( $item_name, 1, wpinv_round_amount( (float) $invoice->get_total(), 2, true ), $invoice->get_id() );
253 253
 
254
-		return $this->get_line_items();
254
+        return $this->get_line_items();
255 255
     }
256 256
 
257 257
     /**
258
-	 * Return all line items.
259
-	 */
260
-	protected function get_line_items() {
261
-		return $this->line_items;
262
-	}
258
+     * Return all line items.
259
+     */
260
+    protected function get_line_items() {
261
+        return $this->line_items;
262
+    }
263 263
 
264 264
     /**
265
-	 * Remove all line items.
266
-	 */
267
-	protected function delete_line_items() {
268
-		$this->line_items = array();
265
+     * Remove all line items.
266
+     */
267
+    protected function delete_line_items() {
268
+        $this->line_items = array();
269 269
     }
270 270
 
271 271
     /**
272
-	 * Prepare line items to send to paypal.
273
-	 *
274
-	 * @param  WPInv_Invoice $invoice Invoice object.
275
-	 */
276
-	protected function prepare_line_items( $invoice ) {
277
-		$this->delete_line_items();
278
-
279
-		// Items.
280
-		foreach ( $invoice->get_items() as $item ) {
281
-			$amount   = $item->get_price();
282
-			$quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity();
283
-			$this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() );
272
+     * Prepare line items to send to paypal.
273
+     *
274
+     * @param  WPInv_Invoice $invoice Invoice object.
275
+     */
276
+    protected function prepare_line_items( $invoice ) {
277
+        $this->delete_line_items();
278
+
279
+        // Items.
280
+        foreach ( $invoice->get_items() as $item ) {
281
+            $amount   = $item->get_price();
282
+            $quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity();
283
+            $this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() );
284 284
         }
285 285
 
286 286
         // Fees.
287
-		foreach ( $invoice->get_fees() as $fee => $data ) {
287
+        foreach ( $invoice->get_fees() as $fee => $data ) {
288 288
             $this->add_line_item( $fee, 1, wpinv_sanitize_amount( $data['initial_fee'] ) );
289 289
         }
290 290
 
291 291
     }
292 292
 
293 293
     /**
294
-	 * Add PayPal Line Item.
295
-	 *
296
-	 * @param  string $item_name Item name.
297
-	 * @param  float    $quantity Item quantity.
298
-	 * @param  float  $amount Amount.
299
-	 * @param  string $item_number Item number.
300
-	 */
301
-	protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) {
302
-		$index = ( count( $this->line_items ) / 4 ) + 1;
303
-
304
-		$item = apply_filters(
305
-			'getpaid_paypal_line_item',
306
-			array(
307
-				'item_name'   => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ),
308
-				'quantity'    => (float) $quantity,
309
-				'amount'      => wpinv_sanitize_amount( (float) $amount, 2 ),
310
-				'item_number' => $item_number,
311
-			),
312
-			$item_name,
313
-			$quantity,
314
-			$amount,
315
-			$item_number
316
-		);
317
-
318
-		$this->line_items[ 'item_name_' . $index ]   = getpaid_limit_length( $item['item_name'], 127 );
294
+     * Add PayPal Line Item.
295
+     *
296
+     * @param  string $item_name Item name.
297
+     * @param  float    $quantity Item quantity.
298
+     * @param  float  $amount Amount.
299
+     * @param  string $item_number Item number.
300
+     */
301
+    protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) {
302
+        $index = ( count( $this->line_items ) / 4 ) + 1;
303
+
304
+        $item = apply_filters(
305
+            'getpaid_paypal_line_item',
306
+            array(
307
+                'item_name'   => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ),
308
+                'quantity'    => (float) $quantity,
309
+                'amount'      => wpinv_sanitize_amount( (float) $amount, 2 ),
310
+                'item_number' => $item_number,
311
+            ),
312
+            $item_name,
313
+            $quantity,
314
+            $amount,
315
+            $item_number
316
+        );
317
+
318
+        $this->line_items[ 'item_name_' . $index ]   = getpaid_limit_length( $item['item_name'], 127 );
319 319
         $this->line_items[ 'quantity_' . $index ]    = $item['quantity'];
320 320
 
321 321
         // The price or amount of the product, service, or contribution, not including shipping, handling, or tax.
322
-		$this->line_items[ 'amount_' . $index ]      = $item['amount'] * $item['quantity'];
323
-		$this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 );
322
+        $this->line_items[ 'amount_' . $index ]      = $item['amount'] * $item['quantity'];
323
+        $this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 );
324 324
     }
325 325
 
326 326
     /**
327
-	 * If the default request with line items is too long, generate a new one with only one line item.
328
-	 *
329
-	 * https://support.microsoft.com/en-us/help/208427/maximum-url-length-is-2-083-characters-in-internet-explorer.
330
-	 *
331
-	 * @param WPInv_Invoice $invoice Invoice to be sent to Paypal.
332
-	 * @param array    $paypal_args Arguments sent to Paypal in the request.
333
-	 * @return array
334
-	 */
335
-	protected function fix_request_length( $invoice, $paypal_args ) {
336
-		$max_paypal_length = 2083;
337
-		$query_candidate   = http_build_query( $paypal_args, '', '&' );
338
-
339
-		if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) {
340
-			return $paypal_args;
341
-		}
342
-
343
-		return apply_filters(
344
-			'getpaid_paypal_args',
345
-			array_merge(
346
-				$this->get_transaction_args( $invoice ),
347
-				$this->get_line_item_args( $invoice, true )
348
-			),
349
-			$invoice
350
-		);
327
+     * If the default request with line items is too long, generate a new one with only one line item.
328
+     *
329
+     * https://support.microsoft.com/en-us/help/208427/maximum-url-length-is-2-083-characters-in-internet-explorer.
330
+     *
331
+     * @param WPInv_Invoice $invoice Invoice to be sent to Paypal.
332
+     * @param array    $paypal_args Arguments sent to Paypal in the request.
333
+     * @return array
334
+     */
335
+    protected function fix_request_length( $invoice, $paypal_args ) {
336
+        $max_paypal_length = 2083;
337
+        $query_candidate   = http_build_query( $paypal_args, '', '&' );
338
+
339
+        if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) {
340
+            return $paypal_args;
341
+        }
342
+
343
+        return apply_filters(
344
+            'getpaid_paypal_args',
345
+            array_merge(
346
+                $this->get_transaction_args( $invoice ),
347
+                $this->get_line_item_args( $invoice, true )
348
+            ),
349
+            $invoice
350
+        );
351 351
 
352 352
     }
353 353
 
354 354
     /**
355
-	 * Processes recurring invoices.
356
-	 *
357
-	 * @param  array $paypal_args PayPal args.
358
-	 * @param  WPInv_Invoice    $invoice Invoice object.
359
-	 */
360
-	public function process_subscription( $paypal_args, $invoice ) {
355
+     * Processes recurring invoices.
356
+     *
357
+     * @param  array $paypal_args PayPal args.
358
+     * @param  WPInv_Invoice    $invoice Invoice object.
359
+     */
360
+    public function process_subscription( $paypal_args, $invoice ) {
361 361
 
362 362
         // Make sure this is a subscription.
363 363
         if ( ! $invoice->is_recurring() || ! $subscription = getpaid_get_invoice_subscription( $invoice ) ) {
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
 
383 383
             $paypal_args['a1'] = 0 == $initial_amount ? 0 : $initial_amount;
384 384
 
385
-			// Trial period length.
386
-			$paypal_args['p1'] = $subscription_item->get_trial_interval();
385
+            // Trial period length.
386
+            $paypal_args['p1'] = $subscription_item->get_trial_interval();
387 387
 
388
-			// Trial period.
389
-			$paypal_args['t1'] = $subscription_item->get_trial_period();
388
+            // Trial period.
389
+            $paypal_args['t1'] = $subscription_item->get_trial_period();
390 390
 
391 391
         } else if ( $initial_amount != $recurring_amount ) {
392 392
 
@@ -409,40 +409,40 @@  discard block
 block discarded – undo
409 409
         }
410 410
 
411 411
         // We have a recurring payment
412
-		if ( ! isset( $param_number ) || 1 == $param_number ) {
412
+        if ( ! isset( $param_number ) || 1 == $param_number ) {
413 413
 
414
-			// Subscription price
415
-			$paypal_args['a3'] = $recurring_amount;
414
+            // Subscription price
415
+            $paypal_args['a3'] = $recurring_amount;
416 416
 
417
-			// Subscription duration
418
-			$paypal_args['p3'] = $interval;
417
+            // Subscription duration
418
+            $paypal_args['p3'] = $interval;
419 419
 
420
-			// Subscription period
421
-			$paypal_args['t3'] = $period;
420
+            // Subscription period
421
+            $paypal_args['t3'] = $period;
422 422
 
423 423
         }
424 424
 
425 425
         // Recurring payments
426
-		if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) {
426
+        if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) {
427 427
 
428
-			// Non-recurring payments
429
-			$paypal_args['src'] = 0;
428
+            // Non-recurring payments
429
+            $paypal_args['src'] = 0;
430 430
 
431
-		} else {
431
+        } else {
432 432
 
433
-			$paypal_args['src'] = 1;
433
+            $paypal_args['src'] = 1;
434 434
 
435
-			if ( $bill_times > 0 ) {
435
+            if ( $bill_times > 0 ) {
436 436
 
437
-				// An initial period is being used to charge a sign-up fee
438
-				if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) {
439
-					$bill_times--;
440
-				}
437
+                // An initial period is being used to charge a sign-up fee
438
+                if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) {
439
+                    $bill_times--;
440
+                }
441 441
 
442 442
                 // Make sure it's not over the max of 52
443 443
                 $paypal_args['srt'] = ( $bill_times <= 52 ? absint( $bill_times ) : 52 );
444 444
 
445
-			}
445
+            }
446 446
         }
447 447
 
448 448
         // Force return URL so that order description & instructions display
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
         }
459 459
 
460 460
         return apply_filters(
461
-			'getpaid_paypal_subscription_args',
462
-			$paypal_args,
463
-			$invoice
461
+            'getpaid_paypal_subscription_args',
462
+            $paypal_args,
463
+            $invoice
464 464
         );
465 465
 
466 466
     }
467 467
 
468 468
     /**
469
-	 * Processes ipns and marks payments as complete.
470
-	 *
471
-	 * @return void
472
-	 */
473
-	public function verify_ipn() {
469
+     * Processes ipns and marks payments as complete.
470
+     *
471
+     * @return void
472
+     */
473
+    public function verify_ipn() {
474 474
         new GetPaid_Paypal_Gateway_IPN_Handler( $this );
475 475
     }
476 476
 
@@ -480,19 +480,19 @@  discard block
 block discarded – undo
480 480
     public function sandbox_notice() {
481 481
 
482 482
         return sprintf(
483
-			__( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing' ),
484
-			'<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">',
485
-			'</a>'
486
-		);
483
+            __( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing' ),
484
+            '<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">',
485
+            '</a>'
486
+        );
487 487
 
488 488
     }
489 489
 
490
-	/**
491
-	 * Filters the gateway settings.
492
-	 *
493
-	 * @param array $admin_settings
494
-	 */
495
-	public function admin_settings( $admin_settings ) {
490
+    /**
491
+     * Filters the gateway settings.
492
+     *
493
+     * @param array $admin_settings
494
+     */
495
+    public function admin_settings( $admin_settings ) {
496 496
 
497 497
         $currencies = sprintf(
498 498
             __( 'Supported Currencies: %s', 'invoicing' ),
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
             'readonly' => true,
519 519
         );
520 520
 
521
-		return $admin_settings;
522
-	}
521
+        return $admin_settings;
522
+    }
523 523
 
524 524
 }
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 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
  * Paypal Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-    protected $supports = array( 'subscription', 'sandbox', 'single_subscription_group' );
27
+    protected $supports = array('subscription', 'sandbox', 'single_subscription_group');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @var array
61 61
 	 */
62
-	public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' );
62
+	public $currencies = array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR');
63 63
 
64 64
     /**
65 65
 	 * URL to view a transaction.
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function __construct() {
82 82
 
83
-        $this->title                = __( 'PayPal Standard', 'invoicing' );
84
-        $this->method_title         = __( 'PayPal Standard', 'invoicing' );
85
-        $this->checkout_button_text = __( 'Proceed to PayPal', 'invoicing' );
86
-        $this->notify_url           = wpinv_get_ipn_url( $this->id );
83
+        $this->title                = __('PayPal Standard', 'invoicing');
84
+        $this->method_title         = __('PayPal Standard', 'invoicing');
85
+        $this->checkout_button_text = __('Proceed to PayPal', 'invoicing');
86
+        $this->notify_url           = wpinv_get_ipn_url($this->id);
87 87
 
88
-		add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 );
89
-        add_filter( 'getpaid_paypal_sandbox_notice', array( $this, 'sandbox_notice' ) );
88
+		add_filter('getpaid_paypal_args', array($this, 'process_subscription'), 10, 2);
89
+        add_filter('getpaid_paypal_sandbox_notice', array($this, 'sandbox_notice'));
90 90
 
91 91
         parent::__construct();
92 92
     }
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
101 101
 	 * @return array
102 102
 	 */
103
-	public function process_payment( $invoice, $submission_data, $submission ) {
103
+	public function process_payment($invoice, $submission_data, $submission) {
104 104
 
105 105
         // Get redirect url.
106
-        $paypal_redirect = $this->get_request_url( $invoice );
106
+        $paypal_redirect = $this->get_request_url($invoice);
107 107
 
108 108
         // Add a note about the request url.
109 109
         $invoice->add_note(
110 110
             sprintf(
111
-                __( 'Redirecting to PayPal: %s', 'invoicing' ),
112
-                esc_url( $paypal_redirect )
111
+                __('Redirecting to PayPal: %s', 'invoicing'),
112
+                esc_url($paypal_redirect)
113 113
             ),
114 114
             false,
115 115
             false,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         );
118 118
 
119 119
         // Redirect to PayPal
120
-        wp_redirect( $paypal_redirect );
120
+        wp_redirect($paypal_redirect);
121 121
         exit;
122 122
 
123 123
     }
@@ -128,21 +128,21 @@  discard block
 block discarded – undo
128 128
 	 * @param  WPInv_Invoice $invoice Invoice object.
129 129
 	 * @return string
130 130
 	 */
131
-	public function get_request_url( $invoice ) {
131
+	public function get_request_url($invoice) {
132 132
 
133 133
         // Endpoint for this request
134
-		$this->endpoint    = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?';
134
+		$this->endpoint = $this->is_sandbox($invoice) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?';
135 135
 
136 136
         // Retrieve paypal args.
137
-        $paypal_args       = map_deep( $this->get_paypal_args( $invoice ), 'urlencode' );
137
+        $paypal_args = map_deep($this->get_paypal_args($invoice), 'urlencode');
138 138
 
139
-        if ( $invoice->is_recurring() ) {
139
+        if ($invoice->is_recurring()) {
140 140
             $paypal_args['bn'] = 'GetPaid_Subscribe_WPS_US';
141 141
         } else {
142 142
             $paypal_args['bn'] = 'GetPaid_ShoppingCart_WPS_US';
143 143
         }
144 144
 
145
-        return add_query_arg( $paypal_args, $this->endpoint );
145
+        return add_query_arg($paypal_args, $this->endpoint);
146 146
 
147 147
 	}
148 148
 
@@ -152,25 +152,25 @@  discard block
 block discarded – undo
152 152
 	 * @param  WPInv_Invoice $invoice Invoice object.
153 153
 	 * @return array
154 154
 	 */
155
-	protected function get_paypal_args( $invoice ) {
155
+	protected function get_paypal_args($invoice) {
156 156
 
157 157
         // Whether or not to send the line items as one item.
158
-		$force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', true, $invoice );
158
+		$force_one_line_item = apply_filters('getpaid_paypal_force_one_line_item', true, $invoice);
159 159
 
160
-		if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) {
160
+		if ($invoice->is_recurring() || (wpinv_use_taxes() && wpinv_prices_include_tax())) {
161 161
 			$force_one_line_item = true;
162 162
 		}
163 163
 
164 164
 		$paypal_args = apply_filters(
165 165
 			'getpaid_paypal_args',
166 166
 			array_merge(
167
-				$this->get_transaction_args( $invoice ),
168
-				$this->get_line_item_args( $invoice, $force_one_line_item )
167
+				$this->get_transaction_args($invoice),
168
+				$this->get_line_item_args($invoice, $force_one_line_item)
169 169
 			),
170 170
 			$invoice
171 171
 		);
172 172
 
173
-		return $this->fix_request_length( $invoice, $paypal_args );
173
+		return $this->fix_request_length($invoice, $paypal_args);
174 174
     }
175 175
 
176 176
     /**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 	 * @param WPInv_Invoice $invoice Invoice object.
180 180
 	 * @return array
181 181
 	 */
182
-	protected function get_transaction_args( $invoice ) {
182
+	protected function get_transaction_args($invoice) {
183 183
 
184 184
 		return array(
185 185
             'cmd'           => '_cart',
186
-            'business'      => wpinv_get_option( 'paypal_email', false ),
186
+            'business'      => wpinv_get_option('paypal_email', false),
187 187
             'no_shipping'   => '1',
188 188
             'shipping'      => '0',
189 189
             'no_note'       => '1',
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
             'rm'            => is_ssl() ? 2 : 1,
192 192
             'upload'        => 1,
193 193
             'currency_code' => $invoice->get_currency(), // https://developer.paypal.com/docs/nvp-soap-api/currency-codes/#paypal
194
-            'return'        => esc_url_raw( $this->get_return_url( $invoice ) ),
195
-            'cancel_return' => esc_url_raw( $invoice->get_checkout_payment_url() ),
196
-            'notify_url'    => getpaid_limit_length( $this->notify_url, 255 ),
197
-            'invoice'       => getpaid_limit_length( $invoice->get_number(), 127 ),
194
+            'return'        => esc_url_raw($this->get_return_url($invoice)),
195
+            'cancel_return' => esc_url_raw($invoice->get_checkout_payment_url()),
196
+            'notify_url'    => getpaid_limit_length($this->notify_url, 255),
197
+            'invoice'       => getpaid_limit_length($invoice->get_number(), 127),
198 198
             'custom'        => $invoice->get_id(),
199
-            'first_name'    => getpaid_limit_length( $invoice->get_first_name(), 32 ),
200
-            'last_name'     => getpaid_limit_length( $invoice->get_last_name(), 64 ),
201
-            'country'       => getpaid_limit_length( $invoice->get_country(), 2 ),
202
-            'email'         => getpaid_limit_length( $invoice->get_email(), 127 ),
203
-            'cbt'           => get_bloginfo( 'name' )
199
+            'first_name'    => getpaid_limit_length($invoice->get_first_name(), 32),
200
+            'last_name'     => getpaid_limit_length($invoice->get_last_name(), 64),
201
+            'country'       => getpaid_limit_length($invoice->get_country(), 2),
202
+            'email'         => getpaid_limit_length($invoice->get_email(), 127),
203
+            'cbt'           => get_bloginfo('name')
204 204
         );
205 205
 
206 206
     }
@@ -212,30 +212,30 @@  discard block
 block discarded – undo
212 212
 	 * @param  bool     $force_one_line_item Create only one item for this invoice.
213 213
 	 * @return array
214 214
 	 */
215
-	protected function get_line_item_args( $invoice, $force_one_line_item = false ) {
215
+	protected function get_line_item_args($invoice, $force_one_line_item = false) {
216 216
 
217 217
         // Maybe send invoice as a single item.
218
-		if ( $force_one_line_item ) {
219
-            return $this->get_line_item_args_single_item( $invoice );
218
+		if ($force_one_line_item) {
219
+            return $this->get_line_item_args_single_item($invoice);
220 220
         }
221 221
 
222 222
         // Send each line item individually.
223 223
         $line_item_args = array();
224 224
 
225 225
         // Prepare line items.
226
-        $this->prepare_line_items( $invoice );
226
+        $this->prepare_line_items($invoice);
227 227
 
228 228
         // Add taxes to the cart
229
-        if ( wpinv_use_taxes() && $invoice->is_taxable() ) {
230
-            $line_item_args['tax_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_tax(), 2 );
229
+        if (wpinv_use_taxes() && $invoice->is_taxable()) {
230
+            $line_item_args['tax_cart'] = wpinv_sanitize_amount((float) $invoice->get_total_tax(), 2);
231 231
         }
232 232
 
233 233
         // Add discount.
234
-        if ( $invoice->get_total_discount() > 0 ) {
235
-            $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_discount(), 2 );
234
+        if ($invoice->get_total_discount() > 0) {
235
+            $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount((float) $invoice->get_total_discount(), 2);
236 236
         }
237 237
 
238
-		return array_merge( $line_item_args, $this->get_line_items() );
238
+		return array_merge($line_item_args, $this->get_line_items());
239 239
 
240 240
     }
241 241
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	 * @param  WPInv_Invoice $invoice Invoice object.
246 246
 	 * @return array
247 247
 	 */
248
-	protected function get_line_item_args_single_item( $invoice ) {
248
+	protected function get_line_item_args_single_item($invoice) {
249 249
 		$this->delete_line_items();
250 250
 
251
-        $item_name = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() );
252
-		$this->add_line_item( $item_name, 1, wpinv_round_amount( (float) $invoice->get_total(), 2, true ), $invoice->get_id() );
251
+        $item_name = sprintf(__('Invoice #%s', 'invoicing'), $invoice->get_number());
252
+		$this->add_line_item($item_name, 1, wpinv_round_amount((float) $invoice->get_total(), 2, true), $invoice->get_id());
253 253
 
254 254
 		return $this->get_line_items();
255 255
     }
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @param  WPInv_Invoice $invoice Invoice object.
275 275
 	 */
276
-	protected function prepare_line_items( $invoice ) {
276
+	protected function prepare_line_items($invoice) {
277 277
 		$this->delete_line_items();
278 278
 
279 279
 		// Items.
280
-		foreach ( $invoice->get_items() as $item ) {
280
+		foreach ($invoice->get_items() as $item) {
281 281
 			$amount   = $item->get_price();
282 282
 			$quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity();
283
-			$this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() );
283
+			$this->add_line_item($item->get_raw_name(), $quantity, $amount, $item->get_id());
284 284
         }
285 285
 
286 286
         // Fees.
287
-		foreach ( $invoice->get_fees() as $fee => $data ) {
288
-            $this->add_line_item( $fee, 1, wpinv_sanitize_amount( $data['initial_fee'] ) );
287
+		foreach ($invoice->get_fees() as $fee => $data) {
288
+            $this->add_line_item($fee, 1, wpinv_sanitize_amount($data['initial_fee']));
289 289
         }
290 290
 
291 291
     }
@@ -298,15 +298,15 @@  discard block
 block discarded – undo
298 298
 	 * @param  float  $amount Amount.
299 299
 	 * @param  string $item_number Item number.
300 300
 	 */
301
-	protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) {
302
-		$index = ( count( $this->line_items ) / 4 ) + 1;
301
+	protected function add_line_item($item_name, $quantity = 1, $amount = 0.0, $item_number = '') {
302
+		$index = (count($this->line_items) / 4) + 1;
303 303
 
304 304
 		$item = apply_filters(
305 305
 			'getpaid_paypal_line_item',
306 306
 			array(
307
-				'item_name'   => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ),
307
+				'item_name'   => html_entity_decode(getpaid_limit_length($item_name ? wp_strip_all_tags($item_name) : __('Item', 'invoicing'), 127), ENT_NOQUOTES, 'UTF-8'),
308 308
 				'quantity'    => (float) $quantity,
309
-				'amount'      => wpinv_sanitize_amount( (float) $amount, 2 ),
309
+				'amount'      => wpinv_sanitize_amount((float) $amount, 2),
310 310
 				'item_number' => $item_number,
311 311
 			),
312 312
 			$item_name,
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
 			$item_number
316 316
 		);
317 317
 
318
-		$this->line_items[ 'item_name_' . $index ]   = getpaid_limit_length( $item['item_name'], 127 );
319
-        $this->line_items[ 'quantity_' . $index ]    = $item['quantity'];
318
+		$this->line_items['item_name_' . $index] = getpaid_limit_length($item['item_name'], 127);
319
+        $this->line_items['quantity_' . $index] = $item['quantity'];
320 320
 
321 321
         // The price or amount of the product, service, or contribution, not including shipping, handling, or tax.
322
-		$this->line_items[ 'amount_' . $index ]      = $item['amount'] * $item['quantity'];
323
-		$this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 );
322
+		$this->line_items['amount_' . $index]      = $item['amount'] * $item['quantity'];
323
+		$this->line_items['item_number_' . $index] = getpaid_limit_length($item['item_number'], 127);
324 324
     }
325 325
 
326 326
     /**
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 	 * @param array    $paypal_args Arguments sent to Paypal in the request.
333 333
 	 * @return array
334 334
 	 */
335
-	protected function fix_request_length( $invoice, $paypal_args ) {
335
+	protected function fix_request_length($invoice, $paypal_args) {
336 336
 		$max_paypal_length = 2083;
337
-		$query_candidate   = http_build_query( $paypal_args, '', '&' );
337
+		$query_candidate   = http_build_query($paypal_args, '', '&');
338 338
 
339
-		if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) {
339
+		if (strlen($this->endpoint . $query_candidate) <= $max_paypal_length) {
340 340
 			return $paypal_args;
341 341
 		}
342 342
 
343 343
 		return apply_filters(
344 344
 			'getpaid_paypal_args',
345 345
 			array_merge(
346
-				$this->get_transaction_args( $invoice ),
347
-				$this->get_line_item_args( $invoice, true )
346
+				$this->get_transaction_args($invoice),
347
+				$this->get_line_item_args($invoice, true)
348 348
 			),
349 349
 			$invoice
350 350
 		);
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * @param  array $paypal_args PayPal args.
358 358
 	 * @param  WPInv_Invoice    $invoice Invoice object.
359 359
 	 */
360
-	public function process_subscription( $paypal_args, $invoice ) {
360
+	public function process_subscription($paypal_args, $invoice) {
361 361
 
362 362
         // Make sure this is a subscription.
363
-        if ( ! $invoice->is_recurring() || ! $subscription = getpaid_get_invoice_subscription( $invoice ) ) {
363
+        if (!$invoice->is_recurring() || !$subscription = getpaid_get_invoice_subscription($invoice)) {
364 364
             return $paypal_args;
365 365
         }
366 366
 
@@ -368,17 +368,17 @@  discard block
 block discarded – undo
368 368
         $paypal_args['cmd'] = '_xclick-subscriptions';
369 369
 
370 370
         // Subscription name.
371
-        $paypal_args['item_name'] = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() );
371
+        $paypal_args['item_name'] = sprintf(__('Invoice #%s', 'invoicing'), $invoice->get_number());
372 372
 
373 373
         // Get subscription args.
374
-        $period                 = strtoupper( substr( $subscription->get_period(), 0, 1) );
374
+        $period                 = strtoupper(substr($subscription->get_period(), 0, 1));
375 375
         $interval               = (int) $subscription->get_frequency();
376 376
         $bill_times             = (int) $subscription->get_bill_times();
377
-        $initial_amount         = (float) wpinv_sanitize_amount( $invoice->get_initial_total(), 2 );
378
-        $recurring_amount       = (float) wpinv_sanitize_amount( $invoice->get_recurring_total(), 2 );
379
-        $subscription_item      = $invoice->get_recurring( true );
377
+        $initial_amount         = (float) wpinv_sanitize_amount($invoice->get_initial_total(), 2);
378
+        $recurring_amount       = (float) wpinv_sanitize_amount($invoice->get_recurring_total(), 2);
379
+        $subscription_item      = $invoice->get_recurring(true);
380 380
 
381
-        if ( $subscription_item->has_free_trial() ) {
381
+        if ($subscription_item->has_free_trial()) {
382 382
 
383 383
             $paypal_args['a1'] = 0 == $initial_amount ? 0 : $initial_amount;
384 384
 
@@ -388,28 +388,28 @@  discard block
 block discarded – undo
388 388
 			// Trial period.
389 389
 			$paypal_args['t1'] = $subscription_item->get_trial_period();
390 390
 
391
-        } else if ( $initial_amount != $recurring_amount ) {
391
+        } else if ($initial_amount != $recurring_amount) {
392 392
 
393 393
             // No trial period, but initial amount includes a sign-up fee and/or other items, so charge it as a separate period.
394 394
 
395
-            if ( 1 == $bill_times ) {
395
+            if (1 == $bill_times) {
396 396
                 $param_number = 3;
397 397
             } else {
398 398
                 $param_number = 1;
399 399
             }
400 400
 
401
-            $paypal_args[ 'a' . $param_number ] = $initial_amount ? $initial_amount : 0;
401
+            $paypal_args['a' . $param_number] = $initial_amount ? $initial_amount : 0;
402 402
 
403 403
             // Sign Up interval
404
-            $paypal_args[ 'p' . $param_number ] = $interval;
404
+            $paypal_args['p' . $param_number] = $interval;
405 405
 
406 406
             // Sign Up unit of duration
407
-            $paypal_args[ 't' . $param_number ] = $period;
407
+            $paypal_args['t' . $param_number] = $period;
408 408
 
409 409
         }
410 410
 
411 411
         // We have a recurring payment
412
-		if ( ! isset( $param_number ) || 1 == $param_number ) {
412
+		if (!isset($param_number) || 1 == $param_number) {
413 413
 
414 414
 			// Subscription price
415 415
 			$paypal_args['a3'] = $recurring_amount;
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         }
424 424
 
425 425
         // Recurring payments
426
-		if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) {
426
+		if (1 == $bill_times || ($initial_amount != $recurring_amount && !$subscription_item->has_free_trial() && 2 == $bill_times)) {
427 427
 
428 428
 			// Non-recurring payments
429 429
 			$paypal_args['src'] = 0;
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
 
433 433
 			$paypal_args['src'] = 1;
434 434
 
435
-			if ( $bill_times > 0 ) {
435
+			if ($bill_times > 0) {
436 436
 
437 437
 				// An initial period is being used to charge a sign-up fee
438
-				if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) {
438
+				if ($initial_amount != $recurring_amount && !$subscription_item->has_free_trial()) {
439 439
 					$bill_times--;
440 440
 				}
441 441
 
442 442
                 // Make sure it's not over the max of 52
443
-                $paypal_args['srt'] = ( $bill_times <= 52 ? absint( $bill_times ) : 52 );
443
+                $paypal_args['srt'] = ($bill_times <= 52 ? absint($bill_times) : 52);
444 444
 
445 445
 			}
446 446
         }
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
         $paypal_args['rm'] = 2;
450 450
 
451 451
         // Get rid of redudant items.
452
-        foreach ( array( 'item_name_1', 'quantity_1', 'amount_1', 'item_number_1' ) as $arg ) {
452
+        foreach (array('item_name_1', 'quantity_1', 'amount_1', 'item_number_1') as $arg) {
453 453
 
454
-            if ( isset( $paypal_args[ $arg ] ) ) {
455
-                unset( $paypal_args[ $arg ] );
454
+            if (isset($paypal_args[$arg])) {
455
+                unset($paypal_args[$arg]);
456 456
             }
457 457
 
458 458
         }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @return void
472 472
 	 */
473 473
 	public function verify_ipn() {
474
-        new GetPaid_Paypal_Gateway_IPN_Handler( $this );
474
+        new GetPaid_Paypal_Gateway_IPN_Handler($this);
475 475
     }
476 476
 
477 477
     /**
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     public function sandbox_notice() {
481 481
 
482 482
         return sprintf(
483
-			__( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing' ),
483
+			__('SANDBOX ENABLED. You can use sandbox testing accounts only. See the %sPayPal Sandbox Testing Guide%s for more details.', 'invoicing'),
484 484
 			'<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">',
485 485
 			'</a>'
486 486
 		);
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	 *
493 493
 	 * @param array $admin_settings
494 494
 	 */
495
-	public function admin_settings( $admin_settings ) {
495
+	public function admin_settings($admin_settings) {
496 496
 
497 497
         $currencies = sprintf(
498
-            __( 'Supported Currencies: %s', 'invoicing' ),
499
-            implode( ', ', $this->currencies )
498
+            __('Supported Currencies: %s', 'invoicing'),
499
+            implode(', ', $this->currencies)
500 500
         );
501 501
 
502 502
         $admin_settings['paypal_active']['desc'] .= " ($currencies)";
503
-        $admin_settings['paypal_desc']['std']     = __( 'Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing' );
503
+        $admin_settings['paypal_desc']['std']     = __('Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing');
504 504
 
505 505
         $admin_settings['paypal_email'] = array(
506 506
             'type' => 'text',
507 507
             'id'   => 'paypal_email',
508
-            'name' => __( 'PayPal Email', 'invoicing' ),
509
-            'desc' => __( "Please enter your PayPal account's email address. Use your sandbox email address in case you've enabled sandbox above.", 'invoicing' ),
508
+            'name' => __('PayPal Email', 'invoicing'),
509
+            'desc' => __("Please enter your PayPal account's email address. Use your sandbox email address in case you've enabled sandbox above.", 'invoicing'),
510 510
         );
511 511
 
512 512
         $admin_settings['paypal_ipn_url'] = array(
513 513
             'type'     => 'ipn_url',
514 514
             'id'       => 'paypal_ipn_url',
515
-            'name'     => __( 'IPN Url', 'invoicing' ),
515
+            'name'     => __('IPN Url', 'invoicing'),
516 516
             'std'      => $this->notify_url,
517
-            'desc'     => __( "If you've not enabled IPNs in your paypal account, use the above URL to enable them.", 'invoicing' ) . ' <a href="https://developer.paypal.com/docs/api-basics/notifications/ipn/"><em>' . __( 'Learn more.', 'invoicing' ) . '</em></a>',
517
+            'desc'     => __("If you've not enabled IPNs in your paypal account, use the above URL to enable them.", 'invoicing') . ' <a href="https://developer.paypal.com/docs/api-basics/notifications/ipn/"><em>' . __('Learn more.', 'invoicing') . '</em></a>',
518 518
             'readonly' => true,
519 519
         );
520 520
 
Please login to merge, or discard this patch.