Passed
Push — master ( fd79a2...e7ff90 )
by Brian
04:23
created
vendor/composer/InstalledVersions.php 1 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' => 'fd79a24e55f0631da78d93a08f1e52e91806a416',
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' => 'fd79a24e55f0631da78d93a08f1e52e91806a416',
44 44
     ),
45 45
     'ayecode/wp-ayecode-ui' => 
46
-    array (
46
+    array(
47 47
       'pretty_version' => '0.1.35',
48 48
       'version' => '0.1.35.0',
49 49
       'aliases' => 
50
-      array (
50
+      array(
51 51
       ),
52 52
       'reference' => 'e5d7955f648c6b350a8fe72e0110b8d78645c60f',
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.22',
66 66
       'version' => '1.0.22.0',
67 67
       'aliases' => 
68
-      array (
68
+      array(
69 69
       ),
70 70
       'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac',
71 71
     ),
72 72
     'composer/installers' => 
73
-    array (
73
+    array(
74 74
       'pretty_version' => 'v1.9.0',
75 75
       'version' => '1.9.0.0',
76 76
       'aliases' => 
77
-      array (
77
+      array(
78 78
       ),
79 79
       'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
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 1 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' => 'fd79a24e55f0631da78d93a08f1e52e91806a416',
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' => 'fd79a24e55f0631da78d93a08f1e52e91806a416',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33
-    array (
33
+    array(
34 34
       'pretty_version' => '0.1.35',
35 35
       'version' => '0.1.35.0',
36 36
       'aliases' => 
37
-      array (
37
+      array(
38 38
       ),
39 39
       'reference' => 'e5d7955f648c6b350a8fe72e0110b8d78645c60f',
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.22',
53 53
       'version' => '1.0.22.0',
54 54
       'aliases' => 
55
-      array (
55
+      array(
56 56
       ),
57 57
       'reference' => '42b638502c9e4be0877f27903df7c7ed2080bdac',
58 58
     ),
59 59
     'composer/installers' => 
60
-    array (
60
+    array(
61 61
       'pretty_version' => 'v1.9.0',
62 62
       'version' => '1.9.0.0',
63 63
       'aliases' => 
64
-      array (
64
+      array(
65 65
       ),
66 66
       'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
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/wpinv-gateway-functions.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Contains gateway functions.
4 4
  *
5 5
  */
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * Returns an array of payment gateways.
@@ -11,82 +11,82 @@  discard block
 block discarded – undo
11 11
  * @return array
12 12
  */
13 13
 function wpinv_get_payment_gateways() {
14
-    return apply_filters( 'wpinv_payment_gateways', array() );
14
+    return apply_filters('wpinv_payment_gateways', array());
15 15
 }
16 16
 
17
-function wpinv_payment_gateway_titles( $all_gateways ) {
17
+function wpinv_payment_gateway_titles($all_gateways) {
18 18
     global $wpinv_options;
19 19
 
20 20
     $gateways = array();
21
-    foreach ( $all_gateways as $key => $gateway ) {
22
-        if ( !empty( $wpinv_options[$key . '_title'] ) ) {
23
-            $all_gateways[$key]['checkout_label'] = __( $wpinv_options[$key . '_title'], 'invoicing' );
21
+    foreach ($all_gateways as $key => $gateway) {
22
+        if (!empty($wpinv_options[$key . '_title'])) {
23
+            $all_gateways[$key]['checkout_label'] = __($wpinv_options[$key . '_title'], 'invoicing');
24 24
         }
25 25
 
26
-        $gateways[$key] = isset( $wpinv_options[$key . '_ordering'] ) ? $wpinv_options[$key . '_ordering'] : ( isset( $gateway['ordering'] ) ? $gateway['ordering'] : '' );
26
+        $gateways[$key] = isset($wpinv_options[$key . '_ordering']) ? $wpinv_options[$key . '_ordering'] : (isset($gateway['ordering']) ? $gateway['ordering'] : '');
27 27
     }
28 28
 
29
-    asort( $gateways );
29
+    asort($gateways);
30 30
 
31
-    foreach ( $gateways as $gateway => $key ) {
31
+    foreach ($gateways as $gateway => $key) {
32 32
         $gateways[$gateway] = $all_gateways[$gateway];
33 33
     }
34 34
 
35 35
     return $gateways;
36 36
 }
37
-add_filter( 'wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1 );
37
+add_filter('wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1);
38 38
 
39
-function wpinv_get_enabled_payment_gateways( $sort = false ) {
39
+function wpinv_get_enabled_payment_gateways($sort = false) {
40 40
     $gateways = wpinv_get_payment_gateways();
41
-    $enabled  = wpinv_get_option( 'gateways', false );
41
+    $enabled  = wpinv_get_option('gateways', false);
42 42
 
43 43
     $gateway_list = array();
44 44
 
45
-    foreach ( $gateways as $key => $gateway ) {
46
-        if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
47
-            $gateway_list[ $key ] = $gateway;
45
+    foreach ($gateways as $key => $gateway) {
46
+        if (isset($enabled[$key]) && $enabled[$key] == 1) {
47
+            $gateway_list[$key] = $gateway;
48 48
         }
49 49
     }
50 50
 
51
-    if ( true === $sort ) {
52
-        uasort( $gateway_list, 'wpinv_sort_gateway_order' );
51
+    if (true === $sort) {
52
+        uasort($gateway_list, 'wpinv_sort_gateway_order');
53 53
         
54 54
         // Reorder our gateways so the default is first
55 55
         $default_gateway_id = wpinv_get_default_gateway();
56 56
 
57
-        if ( wpinv_is_gateway_active( $default_gateway_id ) ) {
58
-            $default_gateway    = array( $default_gateway_id => $gateway_list[ $default_gateway_id ] );
59
-            unset( $gateway_list[ $default_gateway_id ] );
57
+        if (wpinv_is_gateway_active($default_gateway_id)) {
58
+            $default_gateway = array($default_gateway_id => $gateway_list[$default_gateway_id]);
59
+            unset($gateway_list[$default_gateway_id]);
60 60
 
61
-            $gateway_list = array_merge( $default_gateway, $gateway_list );
61
+            $gateway_list = array_merge($default_gateway, $gateway_list);
62 62
         }
63 63
     }
64 64
 
65
-    return apply_filters( 'wpinv_enabled_payment_gateways', $gateway_list );
65
+    return apply_filters('wpinv_enabled_payment_gateways', $gateway_list);
66 66
 }
67 67
 
68
-function wpinv_sort_gateway_order( $a, $b ) {
68
+function wpinv_sort_gateway_order($a, $b) {
69 69
     return $a['ordering'] - $b['ordering'];
70 70
 }
71 71
 
72
-function wpinv_is_gateway_active( $gateway ) {
72
+function wpinv_is_gateway_active($gateway) {
73 73
     $gateways = wpinv_get_enabled_payment_gateways();
74 74
 
75
-    $ret = is_array($gateways) && $gateway ?  array_key_exists( $gateway, $gateways ) : false;
75
+    $ret = is_array($gateways) && $gateway ?  array_key_exists($gateway, $gateways) : false;
76 76
 
77
-    return apply_filters( 'wpinv_is_gateway_active', $ret, $gateway, $gateways );
77
+    return apply_filters('wpinv_is_gateway_active', $ret, $gateway, $gateways);
78 78
 }
79 79
 
80 80
 function wpinv_get_default_gateway() {
81
-    $default = wpinv_get_option( 'default_gateway', 'paypal' );
81
+    $default = wpinv_get_option('default_gateway', 'paypal');
82 82
 
83
-    if ( !wpinv_is_gateway_active( $default ) ) {
83
+    if (!wpinv_is_gateway_active($default)) {
84 84
         $gateways = wpinv_get_enabled_payment_gateways();
85
-        $gateways = array_keys( $gateways );
86
-        $default  = reset( $gateways );
85
+        $gateways = array_keys($gateways);
86
+        $default  = reset($gateways);
87 87
     }
88 88
 
89
-    return apply_filters( 'wpinv_default_gateway', $default );
89
+    return apply_filters('wpinv_default_gateway', $default);
90 90
 }
91 91
 
92 92
 /**
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
  * @param string $gateway The gateway to key.
96 96
  * @return string
97 97
  */
98
-function wpinv_get_gateway_admin_label( $gateway ) {
98
+function wpinv_get_gateway_admin_label($gateway) {
99 99
 
100
-    if ( empty( $gateway ) || 'none' == $gateway ) {
101
-        return esc_html__( 'No Gateway', 'invoicing' );
100
+    if (empty($gateway) || 'none' == $gateway) {
101
+        return esc_html__('No Gateway', 'invoicing');
102 102
     }
103 103
 
104 104
     $gateways = wpinv_get_payment_gateways();
105
-    $label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
106
-    $gateway  = apply_filters( 'wpinv_gateway_admin_label', $label, $gateway );
105
+    $label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
106
+    $gateway  = apply_filters('wpinv_gateway_admin_label', $label, $gateway);
107 107
 
108
-    return wpinv_clean( $gateway );
108
+    return wpinv_clean($gateway);
109 109
 }
110 110
 
111 111
 /**
@@ -113,49 +113,49 @@  discard block
 block discarded – undo
113 113
  * 
114 114
  * @param string $gateway
115 115
  */
116
-function wpinv_get_gateway_description( $gateway ) {
116
+function wpinv_get_gateway_description($gateway) {
117 117
     global $wpinv_options;
118 118
 
119
-    $description = ! empty( $wpinv_options[$gateway . '_desc'] ) ? $wpinv_options[$gateway . '_desc'] : '';
119
+    $description = !empty($wpinv_options[$gateway . '_desc']) ? $wpinv_options[$gateway . '_desc'] : '';
120 120
 
121
-    return apply_filters( 'wpinv_gateway_description', $description, $gateway );
121
+    return apply_filters('wpinv_gateway_description', $description, $gateway);
122 122
 }
123 123
 
124
-function wpinv_get_gateway_button_label( $gateway ) {
125
-    return apply_filters( 'wpinv_gateway_' . $gateway . '_button_label', '' );
124
+function wpinv_get_gateway_button_label($gateway) {
125
+    return apply_filters('wpinv_gateway_' . $gateway . '_button_label', '');
126 126
 }
127 127
 
128
-function wpinv_get_gateway_checkout_label( $gateway ) {
128
+function wpinv_get_gateway_checkout_label($gateway) {
129 129
     $gateways = wpinv_get_payment_gateways();
130
-    $label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
130
+    $label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
131 131
 
132
-    if ( $gateway == 'none' ) {
133
-        $label = __( 'None', 'invoicing' );
132
+    if ($gateway == 'none') {
133
+        $label = __('None', 'invoicing');
134 134
     }
135 135
 
136
-    return apply_filters( 'wpinv_gateway_checkout_label', ucfirst( $label ), $gateway );
136
+    return apply_filters('wpinv_gateway_checkout_label', ucfirst($label), $gateway);
137 137
 }
138 138
 
139
-function wpinv_settings_sections_gateways( $settings ) {
139
+function wpinv_settings_sections_gateways($settings) {
140 140
     $gateways = wpinv_get_payment_gateways();
141 141
     
142 142
     if (!empty($gateways)) {
143
-        foreach  ($gateways as $key => $gateway) {
143
+        foreach ($gateways as $key => $gateway) {
144 144
             $settings[$key] = $gateway['admin_label'];
145 145
         }
146 146
     }
147 147
     
148 148
     return $settings;    
149 149
 }
150
-add_filter( 'wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1 );
150
+add_filter('wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1);
151 151
 
152 152
 /**
153 153
  * Adds GateWay settings.
154 154
  */
155
-function wpinv_settings_gateways( $settings ) {
155
+function wpinv_settings_gateways($settings) {
156 156
 
157 157
     // Loop through each gateway.
158
-    foreach  ( wpinv_get_payment_gateways() as $key => $gateway ) {
158
+    foreach (wpinv_get_payment_gateways() as $key => $gateway) {
159 159
 
160 160
         $gateway_settings = array(
161 161
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             "{$key}_header" => array(
164 164
 
165 165
                 'id'     => "{$key}_gateway_header",
166
-                'name'   => '<h3>' . wp_sprintf( __( '%s Settings', 'invoicing' ), $gateway['admin_label'] ) . '</h3>',
166
+                'name'   => '<h3>' . wp_sprintf(__('%s Settings', 'invoicing'), $gateway['admin_label']) . '</h3>',
167 167
                 'custom' => $key,
168 168
                 'type'   => 'gateway_header',
169 169
 
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
             // Activate/Deactivate a gateway.
173 173
             "{$key}_active" => array(
174 174
                 'id'   => $key . '_active',
175
-                'name' => __( 'Activate', 'invoicing' ),
176
-                'desc' => wp_sprintf( __( 'Enable %s', 'invoicing' ), $gateway['admin_label'] ),
175
+                'name' => __('Activate', 'invoicing'),
176
+                'desc' => wp_sprintf(__('Enable %s', 'invoicing'), $gateway['admin_label']),
177 177
                 'type' => 'checkbox',
178 178
             ),
179 179
 
180 180
             // Activate/Deactivate sandbox.
181 181
             "{$key}_sandbox" => array(
182 182
                 'id'   => $key . '_sandbox',
183
-                'name' => __( 'Sandbox', 'invoicing' ),
184
-                'desc' => __( 'Enable sandbox to test payments', 'invoicing' ),
183
+                'name' => __('Sandbox', 'invoicing'),
184
+                'desc' => __('Enable sandbox to test payments', 'invoicing'),
185 185
                 'type' => 'checkbox',
186 186
                 'std'  => '1',
187 187
             ),
@@ -189,40 +189,40 @@  discard block
 block discarded – undo
189 189
             // Checkout title.
190 190
             "{$key}_title" => array(
191 191
                 'id'   => $key . '_title',
192
-                'name' => __( 'Checkout Title', 'invoicing' ),
193
-                'std'  => isset( $gateway['checkout_label'] ) ? $gateway['checkout_label'] : '',
192
+                'name' => __('Checkout Title', 'invoicing'),
193
+                'std'  => isset($gateway['checkout_label']) ? $gateway['checkout_label'] : '',
194 194
                 'type' => 'text',
195 195
             ),
196 196
 
197 197
             // Checkout description.
198 198
             "{$key}_desc" => array(
199 199
                 'id'   => $key . '_desc',
200
-                'name' => __( 'Checkout Description', 'invoicing' ),
201
-                'std'  => apply_filters( "getpaid_default_{$key}_checkout_description", '' ),
200
+                'name' => __('Checkout Description', 'invoicing'),
201
+                'std'  => apply_filters("getpaid_default_{$key}_checkout_description", ''),
202 202
                 'type' => 'text',
203 203
             ),
204 204
 
205 205
             // Checkout order.
206 206
             "{$key}_ordering" => array(
207 207
                 'id'   => $key . '_ordering',
208
-                'name' => __( 'Priority', 'invoicing' ),
209
-                'std'  => apply_filters( "getpaid_default_{$key}_checkout_description", '' ),
208
+                'name' => __('Priority', 'invoicing'),
209
+                'std'  => apply_filters("getpaid_default_{$key}_checkout_description", ''),
210 210
                 'type' => 'number',
211 211
                 'step' => '1',
212 212
                 'min'  => '-100000',
213 213
                 'max'  => '100000',
214
-                'std'  => isset( $gateway['ordering'] ) ? $gateway['ordering'] : '10',
214
+                'std'  => isset($gateway['ordering']) ? $gateway['ordering'] : '10',
215 215
             ),
216 216
 
217 217
         );
218 218
 
219 219
         // Maybe remove the sandbox.
220
-        if ( ! apply_filters( "wpinv_{$key}_supports_sandbox", false ) ) {
221
-            unset( $gateway_settings["{$key}_sandbox"] );
220
+        if (!apply_filters("wpinv_{$key}_supports_sandbox", false)) {
221
+            unset($gateway_settings["{$key}_sandbox"]);
222 222
         }
223 223
   
224
-        $gateway_settings = apply_filters( 'wpinv_gateway_settings', $gateway_settings, $key, $gateway );
225
-        $gateway_settings = apply_filters( 'wpinv_gateway_settings_' . $key, $gateway_settings, $gateway );
224
+        $gateway_settings = apply_filters('wpinv_gateway_settings', $gateway_settings, $key, $gateway);
225
+        $gateway_settings = apply_filters('wpinv_gateway_settings_' . $key, $gateway_settings, $gateway);
226 226
         
227 227
         $settings[$key] = $gateway_settings;
228 228
     }
@@ -230,57 +230,57 @@  discard block
 block discarded – undo
230 230
     return $settings;
231 231
 
232 232
 }
233
-add_filter( 'wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1 );
233
+add_filter('wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1);
234 234
 
235
-function wpinv_gateway_header_callback( $args ) {
236
-    echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr( $args['custom'] ) . '" />';
235
+function wpinv_gateway_header_callback($args) {
236
+    echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr($args['custom']) . '" />';
237 237
 }
238 238
 
239
-function wpinv_get_gateway_supports( $gateway ) {
239
+function wpinv_get_gateway_supports($gateway) {
240 240
     $gateways = wpinv_get_enabled_payment_gateways();
241
-    $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
242
-    return apply_filters( 'wpinv_gateway_supports', $supports, $gateway );
241
+    $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
242
+    return apply_filters('wpinv_gateway_supports', $supports, $gateway);
243 243
 }
244 244
 
245
-function wpinv_get_chosen_gateway( $invoice_id = 0 ) {
246
-	$gateways = array_keys( wpinv_get_enabled_payment_gateways() );
245
+function wpinv_get_chosen_gateway($invoice_id = 0) {
246
+	$gateways = array_keys(wpinv_get_enabled_payment_gateways());
247 247
 
248 248
     $chosen = false;
249
-    if ( $invoice_id > 0 && $invoice = wpinv_get_invoice( $invoice_id ) ) {
249
+    if ($invoice_id > 0 && $invoice = wpinv_get_invoice($invoice_id)) {
250 250
         $chosen = $invoice->get_gateway();
251 251
     }
252 252
 
253
-	$chosen   = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen;
253
+	$chosen = isset($_REQUEST['payment-mode']) ? sanitize_text_field($_REQUEST['payment-mode']) : $chosen;
254 254
 
255
-	if ( false !== $chosen ) {
256
-		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen );
255
+	if (false !== $chosen) {
256
+		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen);
257 257
 	}
258 258
 
259
-	if ( ! empty ( $chosen ) ) {
260
-		$enabled_gateway = urldecode( $chosen );
261
-	} else if (  !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) {
259
+	if (!empty ($chosen)) {
260
+		$enabled_gateway = urldecode($chosen);
261
+	} else if (!empty($invoice) && (float) $invoice->get_subtotal() <= 0) {
262 262
 		$enabled_gateway = 'manual';
263 263
 	} else {
264 264
 		$enabled_gateway = wpinv_get_default_gateway();
265 265
 	}
266 266
     
267
-    if ( !wpinv_is_gateway_active( $enabled_gateway ) && !empty( $gateways ) ) {
268
-        if(wpinv_is_gateway_active( wpinv_get_default_gateway()) ){
267
+    if (!wpinv_is_gateway_active($enabled_gateway) && !empty($gateways)) {
268
+        if (wpinv_is_gateway_active(wpinv_get_default_gateway())) {
269 269
             $enabled_gateway = wpinv_get_default_gateway();
270
-        }else{
270
+        } else {
271 271
             $enabled_gateway = $gateways[0];
272 272
         }
273 273
 
274 274
     }
275 275
 
276
-	return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway );
276
+	return apply_filters('wpinv_chosen_gateway', $enabled_gateway);
277 277
 }
278 278
 
279
-function wpinv_record_gateway_error( $title = '', $message = '' ) {
280
-    return wpinv_error_log( $message, $title );
279
+function wpinv_record_gateway_error($title = '', $message = '') {
280
+    return wpinv_error_log($message, $title);
281 281
 }
282 282
 
283
-function wpinv_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
283
+function wpinv_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
284 284
 	$ret  = 0;
285 285
 	$args = array(
286 286
 		'meta_key'    => '_wpinv_gateway',
@@ -291,48 +291,48 @@  discard block
 block discarded – undo
291 291
 		'fields'      => 'ids'
292 292
 	);
293 293
 
294
-	$payments = new WP_Query( $args );
294
+	$payments = new WP_Query($args);
295 295
 
296
-	if( $payments )
296
+	if ($payments)
297 297
 		$ret = $payments->post_count;
298 298
 	return $ret;
299 299
 }
300 300
 
301
-function wpinv_settings_update_gateways( $input ) {
301
+function wpinv_settings_update_gateways($input) {
302 302
     global $wpinv_options;
303 303
     
304
-    if ( !empty( $input['save_gateway'] ) ) {
305
-        $gateways = wpinv_get_option( 'gateways', false );
304
+    if (!empty($input['save_gateway'])) {
305
+        $gateways = wpinv_get_option('gateways', false);
306 306
         $gateways = !empty($gateways) ? $gateways : array();
307 307
         $gateway = $input['save_gateway'];
308 308
         
309
-        if ( !empty( $input[$gateway . '_active'] ) ) {
309
+        if (!empty($input[$gateway . '_active'])) {
310 310
             $gateways[$gateway] = 1;
311 311
         } else {
312
-            if ( isset( $gateways[$gateway] ) ) {
313
-                unset( $gateways[$gateway] );
312
+            if (isset($gateways[$gateway])) {
313
+                unset($gateways[$gateway]);
314 314
             }
315 315
         }
316 316
         
317 317
         $input['gateways'] = $gateways;
318 318
     }
319 319
     
320
-    if ( !empty( $input['default_gateway'] ) ) {
320
+    if (!empty($input['default_gateway'])) {
321 321
         $gateways = wpinv_get_payment_gateways();
322 322
         
323
-        foreach ( $gateways as $key => $gateway ) {
324
-            $active   = 0;
325
-            if ( !empty( $input['gateways'] ) && !empty( $input['gateways'][$key] ) ) {
323
+        foreach ($gateways as $key => $gateway) {
324
+            $active = 0;
325
+            if (!empty($input['gateways']) && !empty($input['gateways'][$key])) {
326 326
                 $active = 1;
327 327
             }
328 328
             
329 329
             $input[$key . '_active'] = $active;
330 330
             
331
-            if ( empty( $wpinv_options[$key . '_title'] ) ) {
331
+            if (empty($wpinv_options[$key . '_title'])) {
332 332
                 $input[$key . '_title'] = $gateway['checkout_label'];
333 333
             }
334 334
             
335
-            if ( !isset( $wpinv_options[$key . '_ordering'] ) && isset( $gateway['ordering'] ) ) {
335
+            if (!isset($wpinv_options[$key . '_ordering']) && isset($gateway['ordering'])) {
336 336
                 $input[$key . '_ordering'] = $gateway['ordering'];
337 337
             }
338 338
         }
@@ -340,27 +340,27 @@  discard block
 block discarded – undo
340 340
     
341 341
     return $input;
342 342
 }
343
-add_filter( 'wpinv_settings_tab_gateways_sanitize', 'wpinv_settings_update_gateways', 10, 1 );
343
+add_filter('wpinv_settings_tab_gateways_sanitize', 'wpinv_settings_update_gateways', 10, 1);
344 344
 
345 345
 // PayPal Standard settings
346
-function wpinv_gateway_settings_paypal( $setting ) {    
347
-    $setting['paypal_active']['desc'] = $setting['paypal_active']['desc'] . ' ' . __( '( Supported Currencies: AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, NOK, NZD, PHP, PLN, GBP, SGD, SEK, CHF, TWD, THB, USD )', 'invoicing' );
348
-    $setting['paypal_desc']['std'] = __( 'Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing' );
346
+function wpinv_gateway_settings_paypal($setting) {    
347
+    $setting['paypal_active']['desc'] = $setting['paypal_active']['desc'] . ' ' . __('( Supported Currencies: AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, NOK, NZD, PHP, PLN, GBP, SGD, SEK, CHF, TWD, THB, USD )', 'invoicing');
348
+    $setting['paypal_desc']['std'] = __('Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing');
349 349
     
350 350
     $setting['paypal_sandbox'] = array(
351 351
             'type' => 'checkbox',
352 352
             'id'   => 'paypal_sandbox',
353
-            'name' => __( 'PayPal Sandbox', 'invoicing' ),
354
-            'desc' => __( 'PayPal sandbox can be used to test payments.', 'invoicing' ),
353
+            'name' => __('PayPal Sandbox', 'invoicing'),
354
+            'desc' => __('PayPal sandbox can be used to test payments.', 'invoicing'),
355 355
             'std'  => 1
356 356
         );
357 357
         
358 358
     $setting['paypal_email'] = array(
359 359
             'type' => 'text',
360 360
             'id'   => 'paypal_email',
361
-            'name' => __( 'PayPal Email', 'invoicing' ),
362
-            'desc' => __( 'Please enter your PayPal account\'s email address. Ex: [email protected]', 'invoicing' ),
363
-            'std' => __( '[email protected]', 'invoicing' ),
361
+            'name' => __('PayPal Email', 'invoicing'),
362
+            'desc' => __('Please enter your PayPal account\'s email address. Ex: [email protected]', 'invoicing'),
363
+            'std' => __('[email protected]', 'invoicing'),
364 364
         );
365 365
     /*
366 366
     $setting['paypal_ipn_url'] = array(
@@ -374,18 +374,18 @@  discard block
 block discarded – undo
374 374
         
375 375
     return $setting;
376 376
 }
377
-add_filter( 'wpinv_gateway_settings_paypal', 'wpinv_gateway_settings_paypal', 10, 1 );
377
+add_filter('wpinv_gateway_settings_paypal', 'wpinv_gateway_settings_paypal', 10, 1);
378 378
 
379 379
 /**
380 380
  * Displays the ipn url field.
381 381
  */
382
-function wpinv_ipn_url_callback( $args ) {
383
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
382
+function wpinv_ipn_url_callback($args) {
383
+    $sanitize_id = wpinv_sanitize_key($args['id']);
384 384
     
385 385
     $attrs = $args['readonly'] ? ' readonly' : '';
386 386
 
387
-    $html = '<input class="regular-text" type="text" ' . $attrs . ' value="' . esc_attr( $args['std'] ) . '" name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . ']" onClick="this.select()">';
388
-    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']">'  . $args['desc'] . '</label>';
387
+    $html = '<input class="regular-text" type="text" ' . $attrs . ' value="' . esc_attr($args['std']) . '" name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . ']" onClick="this.select()">';
388
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']">' . $args['desc'] . '</label>';
389 389
 
390 390
     echo $html;
391 391
 }
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
  *
398 398
  * @return bool
399 399
  */
400
-function wpinv_is_test_mode( $gateway = '' ) {
401
-    $sandbox = empty( $gateway ) ? false : wpinv_get_option( "{$gateway}_sandbox", true );
402
-    return apply_filters( 'wpinv_is_test_mode', $sandbox, $gateway );
400
+function wpinv_is_test_mode($gateway = '') {
401
+    $sandbox = empty($gateway) ? false : wpinv_get_option("{$gateway}_sandbox", true);
402
+    return apply_filters('wpinv_is_test_mode', $sandbox, $gateway);
403 403
 }
404 404
 
405 405
 /**
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
  * 
411 411
  * @return string
412 412
  */
413
-function wpinv_get_ipn_url( $gateway = false, $args = array() ) {
413
+function wpinv_get_ipn_url($gateway = false, $args = array()) {
414 414
     $args = wp_parse_args(
415 415
         array(
416 416
             'wpi-listener' => 'IPN',
@@ -419,37 +419,37 @@  discard block
 block discarded – undo
419 419
         $args
420 420
     );
421 421
 
422
-    return apply_filters( 'wpinv_ipn_url', add_query_arg( $args,  home_url( 'index.php' ) ), $gateway, $args );
422
+    return apply_filters('wpinv_ipn_url', add_query_arg($args, home_url('index.php')), $gateway, $args);
423 423
 
424 424
 }
425 425
 
426 426
 /**
427 427
  * Retrieves request data with slashes removed slashes.
428 428
  */
429
-function wpinv_get_post_data( $method = 'request' ) {
429
+function wpinv_get_post_data($method = 'request') {
430 430
 
431
-    if ( $method == 'post' ) {
432
-        return wp_unslash( $_POST );
431
+    if ($method == 'post') {
432
+        return wp_unslash($_POST);
433 433
     }
434 434
 
435
-    if ( $method == 'get' ) {
436
-        return wp_unslash( $_GET );
435
+    if ($method == 'get') {
436
+        return wp_unslash($_GET);
437 437
     }
438 438
 
439
-    return wp_unslash( $_REQUEST );
439
+    return wp_unslash($_REQUEST);
440 440
   
441 441
 }
442 442
 
443 443
 /**
444 444
  * Checks if a given gateway supports subscription payments.
445 445
  */
446
-function wpinv_gateway_support_subscription( $gateway ) {
446
+function wpinv_gateway_support_subscription($gateway) {
447 447
     $supports = false;
448 448
 
449
-    if ( wpinv_is_gateway_active( $gateway ) ) {
450
-        $supports = apply_filters( 'wpinv_' . $gateway . '_support_subscription', $supports );
449
+    if (wpinv_is_gateway_active($gateway)) {
450
+        $supports = apply_filters('wpinv_' . $gateway . '_support_subscription', $supports);
451 451
 
452
-        $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $gateway );
452
+        $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $gateway);
453 453
     }
454 454
 
455 455
     return $supports;
@@ -461,14 +461,14 @@  discard block
 block discarded – undo
461 461
  * @param array $gateways an array of gateways.
462 462
  * @param GetPaid_Payment_Form $form payment form.
463 463
  */
464
-function wpinv_payment_gateways_on_cart( $gateways, $form ) {
464
+function wpinv_payment_gateways_on_cart($gateways, $form) {
465 465
 
466
-    if ( $form->is_recurring() ) {
466
+    if ($form->is_recurring()) {
467 467
 
468
-        foreach ( array_keys( $gateways ) as $gateway ) {
468
+        foreach (array_keys($gateways) as $gateway) {
469 469
 
470
-            if ( ! wpinv_gateway_support_subscription( $gateway ) ) {
471
-                unset( $gateways[$gateway] );
470
+            if (!wpinv_gateway_support_subscription($gateway)) {
471
+                unset($gateways[$gateway]);
472 472
             }
473 473
 
474 474
         }
@@ -477,4 +477,4 @@  discard block
 block discarded – undo
477 477
 
478 478
     return $gateways;
479 479
 }
480
-add_filter( 'getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2 );
480
+add_filter('getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2);
Please login to merge, or discard this patch.