@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly. |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @param $_banner_details |
27 | 27 | */ |
28 | - function __construct( $_banner_details ) { |
|
28 | + function __construct($_banner_details) { |
|
29 | 29 | |
30 | 30 | $current_user = wp_get_current_user(); |
31 | 31 | |
32 | 32 | $this->banner_details = $_banner_details; |
33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
35 | 35 | |
36 | 36 | //Get current user |
37 | 37 | $this->user_id = $current_user->ID; |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | public function init() { |
52 | 52 | |
53 | 53 | //Testing? |
54 | - if ( $this->test_mode ) { |
|
55 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
54 | + if ($this->test_mode) { |
|
55 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | //Get the current page to add the notice to |
59 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
60 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
59 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
60 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
61 | 61 | |
62 | 62 | } |
63 | 63 | |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | $screen = get_current_screen(); |
72 | 72 | |
73 | 73 | //Make sure we're on the plugins page. |
74 | - if ( $screen->parent_file !== 'plugins.php' ) { |
|
74 | + if ($screen->parent_file !== 'plugins.php') { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // If the user hasn't already dismissed the alert, output activation banner. |
79 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { |
|
79 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { |
|
80 | 80 | |
81 | 81 | // Output inline styles here because there's no reason |
82 | 82 | // to enqueued them after the alert is dismissed. |
@@ -158,43 +158,43 @@ discard block |
||
158 | 158 | <h3><?php |
159 | 159 | printf( |
160 | 160 | /* translators: %s: Add-on name */ |
161 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
162 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
161 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
162 | + '<span>'.$this->banner_details['name'].'</span>' |
|
163 | 163 | ); |
164 | 164 | ?></h3> |
165 | 165 | |
166 | 166 | <a href="<?php |
167 | 167 | //The Dismiss Button. |
168 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
169 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span |
|
168 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
169 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span |
|
170 | 170 | class="dashicons dashicons-dismiss"></span></a> |
171 | 171 | |
172 | 172 | <div class="alert-actions"> |
173 | 173 | |
174 | 174 | <?php //Point them to your settings page. |
175 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
175 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
176 | 176 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
177 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?></a> |
|
177 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?></a> |
|
178 | 178 | <?php } ?> |
179 | 179 | |
180 | 180 | <?php |
181 | 181 | // Show them how to configure the Addon. |
182 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
182 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
183 | 183 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
184 | 184 | <span class="dashicons dashicons-media-text"></span><?php |
185 | 185 | printf( |
186 | 186 | /* translators: %s: Add-on name */ |
187 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
187 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
188 | 188 | $this->banner_details['name'] |
189 | 189 | ); |
190 | 190 | ?></a> |
191 | 191 | <?php } ?> |
192 | 192 | <?php |
193 | 193 | //Let them signup for plugin updates |
194 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
194 | + if (isset($this->banner_details['support_url'])) { ?> |
|
195 | 195 | |
196 | 196 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
197 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
197 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
198 | 198 | </a> |
199 | 199 | |
200 | 200 | <?php } ?> |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
222 | 222 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
223 | 223 | */ |
224 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
224 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
225 | 225 | |
226 | 226 | //Get the global user |
227 | 227 | $current_user = wp_get_current_user(); |
228 | 228 | $user_id = $current_user->ID; |
229 | 229 | |
230 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
230 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_get_country() { |
25 | 25 | $give_options = give_get_settings(); |
26 | - $country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US'; |
|
26 | + $country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US'; |
|
27 | 27 | |
28 | - return apply_filters( 'give_give_country', $country ); |
|
28 | + return apply_filters('give_give_country', $country); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function give_get_state() { |
38 | 38 | $give_options = give_get_settings(); |
39 | - $state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false; |
|
39 | + $state = isset($give_options['base_state']) ? $give_options['base_state'] : false; |
|
40 | 40 | |
41 | - return apply_filters( 'give_give_state', $state ); |
|
41 | + return apply_filters('give_give_state', $state); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return mixed|void A list of states for the shop's base country |
52 | 52 | */ |
53 | -function give_get_states( $country = null ) { |
|
53 | +function give_get_states($country = null) { |
|
54 | 54 | |
55 | - if ( empty( $country ) ) { |
|
55 | + if (empty($country)) { |
|
56 | 56 | $country = give_get_country(); |
57 | 57 | } |
58 | 58 | |
59 | - switch ( $country ) : |
|
59 | + switch ($country) : |
|
60 | 60 | |
61 | 61 | case 'US' : |
62 | 62 | $states = give_get_states_list(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | endswitch; |
108 | 108 | |
109 | - return apply_filters( 'give_give_states', $states ); |
|
109 | + return apply_filters('give_give_states', $states); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,253 +119,253 @@ discard block |
||
119 | 119 | function give_get_country_list() { |
120 | 120 | $countries = array( |
121 | 121 | '' => '', |
122 | - 'US' => esc_html__( 'United States', 'give' ), |
|
123 | - 'CA' => esc_html__( 'Canada', 'give' ), |
|
124 | - 'GB' => esc_html__( 'United Kingdom', 'give' ), |
|
125 | - 'AF' => esc_html__( 'Afghanistan', 'give' ), |
|
126 | - 'AL' => esc_html__( 'Albania', 'give' ), |
|
127 | - 'DZ' => esc_html__( 'Algeria', 'give' ), |
|
128 | - 'AS' => esc_html__( 'American Samoa', 'give' ), |
|
129 | - 'AD' => esc_html__( 'Andorra', 'give' ), |
|
130 | - 'AO' => esc_html__( 'Angola', 'give' ), |
|
131 | - 'AI' => esc_html__( 'Anguilla', 'give' ), |
|
132 | - 'AQ' => esc_html__( 'Antarctica', 'give' ), |
|
133 | - 'AG' => esc_html__( 'Antigua and Barbuda', 'give' ), |
|
134 | - 'AR' => esc_html__( 'Argentina', 'give' ), |
|
135 | - 'AM' => esc_html__( 'Armenia', 'give' ), |
|
136 | - 'AW' => esc_html__( 'Aruba', 'give' ), |
|
137 | - 'AU' => esc_html__( 'Australia', 'give' ), |
|
138 | - 'AT' => esc_html__( 'Austria', 'give' ), |
|
139 | - 'AZ' => esc_html__( 'Azerbaijan', 'give' ), |
|
140 | - 'BS' => esc_html__( 'Bahamas', 'give'), |
|
141 | - 'BH' => esc_html__( 'Bahrain', 'give' ), |
|
142 | - 'BD' => esc_html__( 'Bangladesh', 'give' ), |
|
143 | - 'BB' => esc_html__( 'Barbados', 'give' ), |
|
144 | - 'BY' => esc_html__( 'Belarus', 'give' ), |
|
145 | - 'BE' => esc_html__( 'Belgium', 'give' ), |
|
146 | - 'BZ' => esc_html__( 'Belize', 'give' ), |
|
147 | - 'BJ' => esc_html__( 'Benin', 'give' ), |
|
148 | - 'BM' => esc_html__( 'Bermuda', 'give' ), |
|
149 | - 'BT' => esc_html__( 'Bhutan', 'give' ), |
|
150 | - 'BO' => esc_html__( 'Bolivia', 'give' ), |
|
151 | - 'BA' => esc_html__( 'Bosnia and Herzegovina', 'give' ), |
|
152 | - 'BW' => esc_html__( 'Botswana', 'give' ), |
|
153 | - 'BV' => esc_html__( 'Bouvet Island', 'give' ), |
|
154 | - 'BR' => esc_html__( 'Brazil', 'give' ), |
|
155 | - 'IO' => esc_html__( 'British Indian Ocean Territory', 'give' ), |
|
156 | - 'BN' => esc_html__( 'Brunei Darrussalam', 'give' ), |
|
157 | - 'BG' => esc_html__( 'Bulgaria', 'give' ), |
|
158 | - 'BF' => esc_html__( 'Burkina Faso', 'give' ), |
|
159 | - 'BI' => esc_html__( 'Burundi', 'give' ), |
|
160 | - 'KH' => esc_html__( 'Cambodia', 'give' ), |
|
161 | - 'CM' => esc_html__( 'Cameroon', 'give' ), |
|
162 | - 'CV' => esc_html__( 'Cape Verde', 'give' ), |
|
163 | - 'KY' => esc_html__( 'Cayman Islands', 'give' ), |
|
164 | - 'CF' => esc_html__( 'Central African Republic', 'give' ), |
|
165 | - 'TD' => esc_html__( 'Chad', 'give' ), |
|
166 | - 'CL' => esc_html__( 'Chile', 'give' ), |
|
167 | - 'CN' => esc_html__( 'China', 'give' ), |
|
168 | - 'CX' => esc_html__( 'Christmas Island', 'give' ), |
|
169 | - 'CC' => esc_html__( 'Cocos Islands', 'give' ), |
|
170 | - 'CO' => esc_html__( 'Colombia', 'give' ), |
|
171 | - 'KM' => esc_html__( 'Comoros', 'give' ), |
|
172 | - 'CD' => esc_html__( 'Congo, Democratic People\'s Republic', 'give' ), |
|
173 | - 'CG' => esc_html__( 'Congo, Republic of', 'give' ), |
|
174 | - 'CK' => esc_html__( 'Cook Islands', 'give' ), |
|
175 | - 'CR' => esc_html__( 'Costa Rica', 'give' ), |
|
176 | - 'CI' => esc_html__( 'Cote d\'Ivoire', 'give' ), |
|
177 | - 'HR' => esc_html__( 'Croatia/Hrvatska', 'give' ), |
|
178 | - 'CU' => esc_html__( 'Cuba', 'give' ), |
|
179 | - 'CY' => esc_html__( 'Cyprus Island', 'give' ), |
|
180 | - 'CZ' => esc_html__( 'Czech Republic', 'give' ), |
|
181 | - 'DK' => esc_html__( 'Denmark', 'give' ), |
|
182 | - 'DJ' => esc_html__( 'Djibouti', 'give' ), |
|
183 | - 'DM' => esc_html__( 'Dominica', 'give' ), |
|
184 | - 'DO' => esc_html__( 'Dominican Republic', 'give' ), |
|
185 | - 'TP' => esc_html__( 'East Timor', 'give' ), |
|
186 | - 'EC' => esc_html__( 'Ecuador', 'give' ), |
|
187 | - 'EG' => esc_html__( 'Egypt', 'give' ), |
|
188 | - 'GQ' => esc_html__( 'Equatorial Guinea', 'give' ), |
|
189 | - 'SV' => esc_html__( 'El Salvador', 'give' ), |
|
190 | - 'ER' => esc_html__( 'Eritrea', 'give' ), |
|
191 | - 'EE' => esc_html__( 'Estonia', 'give' ), |
|
192 | - 'ET' => esc_html__( 'Ethiopia', 'give' ), |
|
193 | - 'FK' => esc_html__( 'Falkland Islands', 'give' ), |
|
194 | - 'FO' => esc_html__( 'Faroe Islands', 'give' ), |
|
195 | - 'FJ' => esc_html__( 'Fiji', 'give' ), |
|
196 | - 'FI' => esc_html__( 'Finland', 'give' ), |
|
197 | - 'FR' => esc_html__( 'France', 'give' ), |
|
198 | - 'GF' => esc_html__( 'French Guiana', 'give' ), |
|
199 | - 'PF' => esc_html__( 'French Polynesia', 'give' ), |
|
200 | - 'TF' => esc_html__( 'French Southern Territories', 'give' ), |
|
201 | - 'GA' => esc_html__( 'Gabon', 'give' ), |
|
202 | - 'GM' => esc_html__( 'Gambia', 'give' ), |
|
203 | - 'GE' => esc_html__( 'Georgia', 'give' ), |
|
204 | - 'DE' => esc_html__( 'Germany', 'give' ), |
|
205 | - 'GR' => esc_html__( 'Greece', 'give' ), |
|
206 | - 'GH' => esc_html__( 'Ghana', 'give' ), |
|
207 | - 'GI' => esc_html__( 'Gibraltar', 'give' ), |
|
208 | - 'GL' => esc_html__( 'Greenland', 'give' ), |
|
209 | - 'GD' => esc_html__( 'Grenada', 'give' ), |
|
210 | - 'GP' => esc_html__( 'Guadeloupe', 'give' ), |
|
211 | - 'GU' => esc_html__( 'Guam', 'give' ), |
|
212 | - 'GT' => esc_html__( 'Guatemala', 'give' ), |
|
213 | - 'GG' => esc_html__( 'Guernsey', 'give' ), |
|
214 | - 'GN' => esc_html__( 'Guinea', 'give' ), |
|
215 | - 'GW' => esc_html__( 'Guinea-Bissau', 'give' ), |
|
216 | - 'GY' => esc_html__( 'Guyana', 'give' ), |
|
217 | - 'HT' => esc_html__( 'Haiti', 'give' ), |
|
218 | - 'HM' => esc_html__( 'Heard and McDonald Islands', 'give' ), |
|
219 | - 'VA' => esc_html__( 'Holy See (City Vatican State)', 'give' ), |
|
220 | - 'HN' => esc_html__( 'Honduras', 'give' ), |
|
221 | - 'HK' => esc_html__( 'Hong Kong', 'give' ), |
|
222 | - 'HU' => esc_html__( 'Hungary', 'give' ), |
|
223 | - 'IS' => esc_html__( 'Iceland', 'give' ), |
|
224 | - 'IN' => esc_html__( 'India', 'give' ), |
|
225 | - 'ID' => esc_html__( 'Indonesia', 'give' ), |
|
226 | - 'IR' => esc_html__( 'Iran', 'give' ), |
|
227 | - 'IQ' => esc_html__( 'Iraq', 'give' ), |
|
228 | - 'IE' => esc_html__( 'Ireland', 'give' ), |
|
229 | - 'IM' => esc_html__( 'Isle of Man', 'give' ), |
|
230 | - 'IL' => esc_html__( 'Israel', 'give' ), |
|
231 | - 'IT' => esc_html__( 'Italy', 'give' ), |
|
232 | - 'JM' => esc_html__( 'Jamaica', 'give' ), |
|
233 | - 'JP' => esc_html__( 'Japan', 'give' ), |
|
234 | - 'JE' => esc_html__( 'Jersey', 'give' ), |
|
235 | - 'JO' => esc_html__( 'Jordan', 'give' ), |
|
236 | - 'KZ' => esc_html__( 'Kazakhstan', 'give' ), |
|
237 | - 'KE' => esc_html__( 'Kenya', 'give' ), |
|
238 | - 'KI' => esc_html__( 'Kiribati', 'give' ), |
|
239 | - 'KW' => esc_html__( 'Kuwait', 'give' ), |
|
240 | - 'KG' => esc_html__( 'Kyrgyzstan', 'give' ), |
|
241 | - 'LA' => esc_html__( 'Lao People\'s Democratic Republic', 'give' ), |
|
242 | - 'LV' => esc_html__( 'Latvia', 'give' ), |
|
243 | - 'LB' => esc_html__( 'Lebanon', 'give' ), |
|
244 | - 'LS' => esc_html__( 'Lesotho', 'give' ), |
|
245 | - 'LR' => esc_html__( 'Liberia', 'give' ), |
|
246 | - 'LY' => esc_html__( 'Libyan Arab Jamahiriya', 'give' ), |
|
247 | - 'LI' => esc_html__( 'Liechtenstein', 'give' ), |
|
248 | - 'LT' => esc_html__( 'Lithuania', 'give' ), |
|
249 | - 'LU' => esc_html__( 'Luxembourg', 'give' ), |
|
250 | - 'MO' => esc_html__( 'Macau', 'give' ), |
|
251 | - 'MK' => esc_html__( 'Macedonia', 'give' ), |
|
252 | - 'MG' => esc_html__( 'Madagascar', 'give' ), |
|
253 | - 'MW' => esc_html__( 'Malawi', 'give' ), |
|
254 | - 'MY' => esc_html__( 'Malaysia', 'give' ), |
|
255 | - 'MV' => esc_html__( 'Maldives', 'give' ), |
|
256 | - 'ML' => esc_html__( 'Mali', 'give' ), |
|
257 | - 'MT' => esc_html__( 'Malta', 'give' ), |
|
258 | - 'MH' => esc_html__( 'Marshall Islands', 'give' ), |
|
259 | - 'MQ' => esc_html__( 'Martinique', 'give' ), |
|
260 | - 'MR' => esc_html__( 'Mauritania', 'give' ), |
|
261 | - 'MU' => esc_html__( 'Mauritius', 'give' ), |
|
262 | - 'YT' => esc_html__( 'Mayotte', 'give' ), |
|
263 | - 'MX' => esc_html__( 'Mexico', 'give' ), |
|
264 | - 'FM' => esc_html__( 'Micronesia', 'give' ), |
|
265 | - 'MD' => esc_html__( 'Moldova, Republic of', 'give' ), |
|
266 | - 'MC' => esc_html__( 'Monaco', 'give' ), |
|
267 | - 'MN' => esc_html__( 'Mongolia', 'give' ), |
|
268 | - 'ME' => esc_html__( 'Montenegro', 'give' ), |
|
269 | - 'MS' => esc_html__( 'Montserrat', 'give' ), |
|
270 | - 'MA' => esc_html__( 'Morocco', 'give' ), |
|
271 | - 'MZ' => esc_html__( 'Mozambique', 'give' ), |
|
272 | - 'MM' => esc_html__( 'Myanmar', 'give' ), |
|
273 | - 'NA' => esc_html__( 'Namibia', 'give' ), |
|
274 | - 'NR' => esc_html__( 'Nauru', 'give' ), |
|
275 | - 'NP' => esc_html__( 'Nepal', 'give' ), |
|
276 | - 'NL' => esc_html__( 'Netherlands', 'give' ), |
|
277 | - 'AN' => esc_html__( 'Netherlands Antilles', 'give' ), |
|
278 | - 'NC' => esc_html__( 'New Caledonia', 'give' ), |
|
279 | - 'NZ' => esc_html__( 'New Zealand', 'give' ), |
|
280 | - 'NI' => esc_html__( 'Nicaragua', 'give' ), |
|
281 | - 'NE' => esc_html__( 'Niger', 'give' ), |
|
282 | - 'NG' => esc_html__( 'Nigeria', 'give' ), |
|
283 | - 'NU' => esc_html__( 'Niue', 'give' ), |
|
284 | - 'NF' => esc_html__( 'Norfolk Island', 'give' ), |
|
285 | - 'KP' => esc_html__( 'North Korea', 'give' ), |
|
286 | - 'MP' => esc_html__( 'Northern Mariana Islands', 'give' ), |
|
287 | - 'NO' => esc_html__( 'Norway', 'give' ), |
|
288 | - 'OM' => esc_html__( 'Oman', 'give' ), |
|
289 | - 'PK' => esc_html__( 'Pakistan', 'give' ), |
|
290 | - 'PW' => esc_html__( 'Palau', 'give' ), |
|
291 | - 'PS' => esc_html__( 'Palestinian Territories', 'give' ), |
|
292 | - 'PA' => esc_html__( 'Panama', 'give' ), |
|
293 | - 'PG' => esc_html__( 'Papua New Guinea', 'give' ), |
|
294 | - 'PY' => esc_html__( 'Paraguay', 'give' ), |
|
295 | - 'PE' => esc_html__( 'Peru', 'give' ), |
|
296 | - 'PH' => esc_html__( 'Phillipines', 'give' ), |
|
297 | - 'PN' => esc_html__( 'Pitcairn Island', 'give' ), |
|
298 | - 'PL' => esc_html__( 'Poland', 'give' ), |
|
299 | - 'PT' => esc_html__( 'Portugal', 'give' ), |
|
300 | - 'PR' => esc_html__( 'Puerto Rico', 'give' ), |
|
301 | - 'QA' => esc_html__( 'Qatar', 'give' ), |
|
302 | - 'RE' => esc_html__( 'Reunion Island', 'give' ), |
|
303 | - 'RO' => esc_html__( 'Romania', 'give' ), |
|
304 | - 'RU' => esc_html__( 'Russian Federation', 'give' ), |
|
305 | - 'RW' => esc_html__( 'Rwanda', 'give' ), |
|
306 | - 'SH' => esc_html__( 'Saint Helena', 'give' ), |
|
307 | - 'KN' => esc_html__( 'Saint Kitts and Nevis', 'give' ), |
|
308 | - 'LC' => esc_html__( 'Saint Lucia', 'give' ), |
|
309 | - 'PM' => esc_html__( 'Saint Pierre and Miquelon', 'give' ), |
|
310 | - 'VC' => esc_html__( 'Saint Vincent and the Grenadines', 'give' ), |
|
311 | - 'SM' => esc_html__( 'San Marino', 'give' ), |
|
312 | - 'ST' => esc_html__( 'Sao Tome and Principe', 'give' ), |
|
313 | - 'SA' => esc_html__( 'Saudi Arabia', 'give' ), |
|
314 | - 'SN' => esc_html__( 'Senegal', 'give' ), |
|
315 | - 'RS' => esc_html__( 'Serbia', 'give' ), |
|
316 | - 'SC' => esc_html__( 'Seychelles', 'give' ), |
|
317 | - 'SL' => esc_html__( 'Sierra Leone', 'give' ), |
|
318 | - 'SG' => esc_html__( 'Singapore', 'give' ), |
|
319 | - 'SK' => esc_html__( 'Slovak Republic', 'give' ), |
|
320 | - 'SI' => esc_html__( 'Slovenia', 'give' ), |
|
321 | - 'SB' => esc_html__( 'Solomon Islands', 'give' ), |
|
322 | - 'SO' => esc_html__( 'Somalia', 'give' ), |
|
323 | - 'ZA' => esc_html__( 'South Africa', 'give' ), |
|
324 | - 'GS' => esc_html__( 'South Georgia', 'give' ), |
|
325 | - 'KR' => esc_html__( 'South Korea', 'give' ), |
|
326 | - 'ES' => esc_html__( 'Spain', 'give' ), |
|
327 | - 'LK' => esc_html__( 'Sri Lanka', 'give' ), |
|
328 | - 'SD' => esc_html__( 'Sudan', 'give' ), |
|
329 | - 'SR' => esc_html__( 'Suriname', 'give' ), |
|
330 | - 'SJ' => esc_html__( 'Svalbard and Jan Mayen Islands', 'give' ), |
|
331 | - 'SZ' => esc_html__( 'Swaziland', 'give' ), |
|
332 | - 'SE' => esc_html__( 'Sweden', 'give' ), |
|
333 | - 'CH' => esc_html__( 'Switzerland', 'give' ), |
|
334 | - 'SY' => esc_html__( 'Syrian Arab Republic', 'give' ), |
|
335 | - 'TW' => esc_html__( 'Taiwan', 'give' ), |
|
336 | - 'TJ' => esc_html__( 'Tajikistan', 'give' ), |
|
337 | - 'TZ' => esc_html__( 'Tanzania', 'give' ), |
|
338 | - 'TG' => esc_html__( 'Togo', 'give' ), |
|
339 | - 'TK' => esc_html__( 'Tokelau', 'give' ), |
|
340 | - 'TO' => esc_html__( 'Tonga', 'give' ), |
|
341 | - 'TH' => esc_html__( 'Thailand', 'give' ), |
|
342 | - 'TT' => esc_html__( 'Trinidad and Tobago', 'give' ), |
|
343 | - 'TN' => esc_html__( 'Tunisia', 'give' ), |
|
344 | - 'TR' => esc_html__( 'Turkey', 'give' ), |
|
345 | - 'TM' => esc_html__( 'Turkmenistan', 'give' ), |
|
346 | - 'TC' => esc_html__( 'Turks and Caicos Islands', 'give' ), |
|
347 | - 'TV' => esc_html__( 'Tuvalu', 'give' ), |
|
348 | - 'UG' => esc_html__( 'Uganda', 'give' ), |
|
349 | - 'UA' => esc_html__( 'Ukraine', 'give' ), |
|
350 | - 'AE' => esc_html__( 'United Arab Emirates', 'give' ), |
|
351 | - 'UY' => esc_html__( 'Uruguay', 'give' ), |
|
352 | - 'UM' => esc_html__( 'US Minor Outlying Islands', 'give' ), |
|
353 | - 'UZ' => esc_html__( 'Uzbekistan', 'give' ), |
|
354 | - 'VU' => esc_html__( 'Vanuatu', 'give' ), |
|
355 | - 'VE' => esc_html__( 'Venezuela', 'give' ), |
|
356 | - 'VN' => esc_html__( 'Vietnam', 'give' ), |
|
357 | - 'VG' => esc_html__( 'Virgin Islands (British)', 'give' ), |
|
358 | - 'VI' => esc_html__( 'Virgin Islands (USA)', 'give' ), |
|
359 | - 'WF' => esc_html__( 'Wallis and Futuna Islands', 'give' ), |
|
360 | - 'EH' => esc_html__( 'Western Sahara', 'give' ), |
|
361 | - 'WS' => esc_html__( 'Western Samoa', 'give' ), |
|
362 | - 'YE' => esc_html__( 'Yemen', 'give' ), |
|
363 | - 'YU' => esc_html__( 'Yugoslavia', 'give' ), |
|
364 | - 'ZM' => esc_html__( 'Zambia', 'give' ), |
|
365 | - 'ZW' => esc_html__( 'Zimbabwe', 'give' ) |
|
122 | + 'US' => esc_html__('United States', 'give'), |
|
123 | + 'CA' => esc_html__('Canada', 'give'), |
|
124 | + 'GB' => esc_html__('United Kingdom', 'give'), |
|
125 | + 'AF' => esc_html__('Afghanistan', 'give'), |
|
126 | + 'AL' => esc_html__('Albania', 'give'), |
|
127 | + 'DZ' => esc_html__('Algeria', 'give'), |
|
128 | + 'AS' => esc_html__('American Samoa', 'give'), |
|
129 | + 'AD' => esc_html__('Andorra', 'give'), |
|
130 | + 'AO' => esc_html__('Angola', 'give'), |
|
131 | + 'AI' => esc_html__('Anguilla', 'give'), |
|
132 | + 'AQ' => esc_html__('Antarctica', 'give'), |
|
133 | + 'AG' => esc_html__('Antigua and Barbuda', 'give'), |
|
134 | + 'AR' => esc_html__('Argentina', 'give'), |
|
135 | + 'AM' => esc_html__('Armenia', 'give'), |
|
136 | + 'AW' => esc_html__('Aruba', 'give'), |
|
137 | + 'AU' => esc_html__('Australia', 'give'), |
|
138 | + 'AT' => esc_html__('Austria', 'give'), |
|
139 | + 'AZ' => esc_html__('Azerbaijan', 'give'), |
|
140 | + 'BS' => esc_html__('Bahamas', 'give'), |
|
141 | + 'BH' => esc_html__('Bahrain', 'give'), |
|
142 | + 'BD' => esc_html__('Bangladesh', 'give'), |
|
143 | + 'BB' => esc_html__('Barbados', 'give'), |
|
144 | + 'BY' => esc_html__('Belarus', 'give'), |
|
145 | + 'BE' => esc_html__('Belgium', 'give'), |
|
146 | + 'BZ' => esc_html__('Belize', 'give'), |
|
147 | + 'BJ' => esc_html__('Benin', 'give'), |
|
148 | + 'BM' => esc_html__('Bermuda', 'give'), |
|
149 | + 'BT' => esc_html__('Bhutan', 'give'), |
|
150 | + 'BO' => esc_html__('Bolivia', 'give'), |
|
151 | + 'BA' => esc_html__('Bosnia and Herzegovina', 'give'), |
|
152 | + 'BW' => esc_html__('Botswana', 'give'), |
|
153 | + 'BV' => esc_html__('Bouvet Island', 'give'), |
|
154 | + 'BR' => esc_html__('Brazil', 'give'), |
|
155 | + 'IO' => esc_html__('British Indian Ocean Territory', 'give'), |
|
156 | + 'BN' => esc_html__('Brunei Darrussalam', 'give'), |
|
157 | + 'BG' => esc_html__('Bulgaria', 'give'), |
|
158 | + 'BF' => esc_html__('Burkina Faso', 'give'), |
|
159 | + 'BI' => esc_html__('Burundi', 'give'), |
|
160 | + 'KH' => esc_html__('Cambodia', 'give'), |
|
161 | + 'CM' => esc_html__('Cameroon', 'give'), |
|
162 | + 'CV' => esc_html__('Cape Verde', 'give'), |
|
163 | + 'KY' => esc_html__('Cayman Islands', 'give'), |
|
164 | + 'CF' => esc_html__('Central African Republic', 'give'), |
|
165 | + 'TD' => esc_html__('Chad', 'give'), |
|
166 | + 'CL' => esc_html__('Chile', 'give'), |
|
167 | + 'CN' => esc_html__('China', 'give'), |
|
168 | + 'CX' => esc_html__('Christmas Island', 'give'), |
|
169 | + 'CC' => esc_html__('Cocos Islands', 'give'), |
|
170 | + 'CO' => esc_html__('Colombia', 'give'), |
|
171 | + 'KM' => esc_html__('Comoros', 'give'), |
|
172 | + 'CD' => esc_html__('Congo, Democratic People\'s Republic', 'give'), |
|
173 | + 'CG' => esc_html__('Congo, Republic of', 'give'), |
|
174 | + 'CK' => esc_html__('Cook Islands', 'give'), |
|
175 | + 'CR' => esc_html__('Costa Rica', 'give'), |
|
176 | + 'CI' => esc_html__('Cote d\'Ivoire', 'give'), |
|
177 | + 'HR' => esc_html__('Croatia/Hrvatska', 'give'), |
|
178 | + 'CU' => esc_html__('Cuba', 'give'), |
|
179 | + 'CY' => esc_html__('Cyprus Island', 'give'), |
|
180 | + 'CZ' => esc_html__('Czech Republic', 'give'), |
|
181 | + 'DK' => esc_html__('Denmark', 'give'), |
|
182 | + 'DJ' => esc_html__('Djibouti', 'give'), |
|
183 | + 'DM' => esc_html__('Dominica', 'give'), |
|
184 | + 'DO' => esc_html__('Dominican Republic', 'give'), |
|
185 | + 'TP' => esc_html__('East Timor', 'give'), |
|
186 | + 'EC' => esc_html__('Ecuador', 'give'), |
|
187 | + 'EG' => esc_html__('Egypt', 'give'), |
|
188 | + 'GQ' => esc_html__('Equatorial Guinea', 'give'), |
|
189 | + 'SV' => esc_html__('El Salvador', 'give'), |
|
190 | + 'ER' => esc_html__('Eritrea', 'give'), |
|
191 | + 'EE' => esc_html__('Estonia', 'give'), |
|
192 | + 'ET' => esc_html__('Ethiopia', 'give'), |
|
193 | + 'FK' => esc_html__('Falkland Islands', 'give'), |
|
194 | + 'FO' => esc_html__('Faroe Islands', 'give'), |
|
195 | + 'FJ' => esc_html__('Fiji', 'give'), |
|
196 | + 'FI' => esc_html__('Finland', 'give'), |
|
197 | + 'FR' => esc_html__('France', 'give'), |
|
198 | + 'GF' => esc_html__('French Guiana', 'give'), |
|
199 | + 'PF' => esc_html__('French Polynesia', 'give'), |
|
200 | + 'TF' => esc_html__('French Southern Territories', 'give'), |
|
201 | + 'GA' => esc_html__('Gabon', 'give'), |
|
202 | + 'GM' => esc_html__('Gambia', 'give'), |
|
203 | + 'GE' => esc_html__('Georgia', 'give'), |
|
204 | + 'DE' => esc_html__('Germany', 'give'), |
|
205 | + 'GR' => esc_html__('Greece', 'give'), |
|
206 | + 'GH' => esc_html__('Ghana', 'give'), |
|
207 | + 'GI' => esc_html__('Gibraltar', 'give'), |
|
208 | + 'GL' => esc_html__('Greenland', 'give'), |
|
209 | + 'GD' => esc_html__('Grenada', 'give'), |
|
210 | + 'GP' => esc_html__('Guadeloupe', 'give'), |
|
211 | + 'GU' => esc_html__('Guam', 'give'), |
|
212 | + 'GT' => esc_html__('Guatemala', 'give'), |
|
213 | + 'GG' => esc_html__('Guernsey', 'give'), |
|
214 | + 'GN' => esc_html__('Guinea', 'give'), |
|
215 | + 'GW' => esc_html__('Guinea-Bissau', 'give'), |
|
216 | + 'GY' => esc_html__('Guyana', 'give'), |
|
217 | + 'HT' => esc_html__('Haiti', 'give'), |
|
218 | + 'HM' => esc_html__('Heard and McDonald Islands', 'give'), |
|
219 | + 'VA' => esc_html__('Holy See (City Vatican State)', 'give'), |
|
220 | + 'HN' => esc_html__('Honduras', 'give'), |
|
221 | + 'HK' => esc_html__('Hong Kong', 'give'), |
|
222 | + 'HU' => esc_html__('Hungary', 'give'), |
|
223 | + 'IS' => esc_html__('Iceland', 'give'), |
|
224 | + 'IN' => esc_html__('India', 'give'), |
|
225 | + 'ID' => esc_html__('Indonesia', 'give'), |
|
226 | + 'IR' => esc_html__('Iran', 'give'), |
|
227 | + 'IQ' => esc_html__('Iraq', 'give'), |
|
228 | + 'IE' => esc_html__('Ireland', 'give'), |
|
229 | + 'IM' => esc_html__('Isle of Man', 'give'), |
|
230 | + 'IL' => esc_html__('Israel', 'give'), |
|
231 | + 'IT' => esc_html__('Italy', 'give'), |
|
232 | + 'JM' => esc_html__('Jamaica', 'give'), |
|
233 | + 'JP' => esc_html__('Japan', 'give'), |
|
234 | + 'JE' => esc_html__('Jersey', 'give'), |
|
235 | + 'JO' => esc_html__('Jordan', 'give'), |
|
236 | + 'KZ' => esc_html__('Kazakhstan', 'give'), |
|
237 | + 'KE' => esc_html__('Kenya', 'give'), |
|
238 | + 'KI' => esc_html__('Kiribati', 'give'), |
|
239 | + 'KW' => esc_html__('Kuwait', 'give'), |
|
240 | + 'KG' => esc_html__('Kyrgyzstan', 'give'), |
|
241 | + 'LA' => esc_html__('Lao People\'s Democratic Republic', 'give'), |
|
242 | + 'LV' => esc_html__('Latvia', 'give'), |
|
243 | + 'LB' => esc_html__('Lebanon', 'give'), |
|
244 | + 'LS' => esc_html__('Lesotho', 'give'), |
|
245 | + 'LR' => esc_html__('Liberia', 'give'), |
|
246 | + 'LY' => esc_html__('Libyan Arab Jamahiriya', 'give'), |
|
247 | + 'LI' => esc_html__('Liechtenstein', 'give'), |
|
248 | + 'LT' => esc_html__('Lithuania', 'give'), |
|
249 | + 'LU' => esc_html__('Luxembourg', 'give'), |
|
250 | + 'MO' => esc_html__('Macau', 'give'), |
|
251 | + 'MK' => esc_html__('Macedonia', 'give'), |
|
252 | + 'MG' => esc_html__('Madagascar', 'give'), |
|
253 | + 'MW' => esc_html__('Malawi', 'give'), |
|
254 | + 'MY' => esc_html__('Malaysia', 'give'), |
|
255 | + 'MV' => esc_html__('Maldives', 'give'), |
|
256 | + 'ML' => esc_html__('Mali', 'give'), |
|
257 | + 'MT' => esc_html__('Malta', 'give'), |
|
258 | + 'MH' => esc_html__('Marshall Islands', 'give'), |
|
259 | + 'MQ' => esc_html__('Martinique', 'give'), |
|
260 | + 'MR' => esc_html__('Mauritania', 'give'), |
|
261 | + 'MU' => esc_html__('Mauritius', 'give'), |
|
262 | + 'YT' => esc_html__('Mayotte', 'give'), |
|
263 | + 'MX' => esc_html__('Mexico', 'give'), |
|
264 | + 'FM' => esc_html__('Micronesia', 'give'), |
|
265 | + 'MD' => esc_html__('Moldova, Republic of', 'give'), |
|
266 | + 'MC' => esc_html__('Monaco', 'give'), |
|
267 | + 'MN' => esc_html__('Mongolia', 'give'), |
|
268 | + 'ME' => esc_html__('Montenegro', 'give'), |
|
269 | + 'MS' => esc_html__('Montserrat', 'give'), |
|
270 | + 'MA' => esc_html__('Morocco', 'give'), |
|
271 | + 'MZ' => esc_html__('Mozambique', 'give'), |
|
272 | + 'MM' => esc_html__('Myanmar', 'give'), |
|
273 | + 'NA' => esc_html__('Namibia', 'give'), |
|
274 | + 'NR' => esc_html__('Nauru', 'give'), |
|
275 | + 'NP' => esc_html__('Nepal', 'give'), |
|
276 | + 'NL' => esc_html__('Netherlands', 'give'), |
|
277 | + 'AN' => esc_html__('Netherlands Antilles', 'give'), |
|
278 | + 'NC' => esc_html__('New Caledonia', 'give'), |
|
279 | + 'NZ' => esc_html__('New Zealand', 'give'), |
|
280 | + 'NI' => esc_html__('Nicaragua', 'give'), |
|
281 | + 'NE' => esc_html__('Niger', 'give'), |
|
282 | + 'NG' => esc_html__('Nigeria', 'give'), |
|
283 | + 'NU' => esc_html__('Niue', 'give'), |
|
284 | + 'NF' => esc_html__('Norfolk Island', 'give'), |
|
285 | + 'KP' => esc_html__('North Korea', 'give'), |
|
286 | + 'MP' => esc_html__('Northern Mariana Islands', 'give'), |
|
287 | + 'NO' => esc_html__('Norway', 'give'), |
|
288 | + 'OM' => esc_html__('Oman', 'give'), |
|
289 | + 'PK' => esc_html__('Pakistan', 'give'), |
|
290 | + 'PW' => esc_html__('Palau', 'give'), |
|
291 | + 'PS' => esc_html__('Palestinian Territories', 'give'), |
|
292 | + 'PA' => esc_html__('Panama', 'give'), |
|
293 | + 'PG' => esc_html__('Papua New Guinea', 'give'), |
|
294 | + 'PY' => esc_html__('Paraguay', 'give'), |
|
295 | + 'PE' => esc_html__('Peru', 'give'), |
|
296 | + 'PH' => esc_html__('Phillipines', 'give'), |
|
297 | + 'PN' => esc_html__('Pitcairn Island', 'give'), |
|
298 | + 'PL' => esc_html__('Poland', 'give'), |
|
299 | + 'PT' => esc_html__('Portugal', 'give'), |
|
300 | + 'PR' => esc_html__('Puerto Rico', 'give'), |
|
301 | + 'QA' => esc_html__('Qatar', 'give'), |
|
302 | + 'RE' => esc_html__('Reunion Island', 'give'), |
|
303 | + 'RO' => esc_html__('Romania', 'give'), |
|
304 | + 'RU' => esc_html__('Russian Federation', 'give'), |
|
305 | + 'RW' => esc_html__('Rwanda', 'give'), |
|
306 | + 'SH' => esc_html__('Saint Helena', 'give'), |
|
307 | + 'KN' => esc_html__('Saint Kitts and Nevis', 'give'), |
|
308 | + 'LC' => esc_html__('Saint Lucia', 'give'), |
|
309 | + 'PM' => esc_html__('Saint Pierre and Miquelon', 'give'), |
|
310 | + 'VC' => esc_html__('Saint Vincent and the Grenadines', 'give'), |
|
311 | + 'SM' => esc_html__('San Marino', 'give'), |
|
312 | + 'ST' => esc_html__('Sao Tome and Principe', 'give'), |
|
313 | + 'SA' => esc_html__('Saudi Arabia', 'give'), |
|
314 | + 'SN' => esc_html__('Senegal', 'give'), |
|
315 | + 'RS' => esc_html__('Serbia', 'give'), |
|
316 | + 'SC' => esc_html__('Seychelles', 'give'), |
|
317 | + 'SL' => esc_html__('Sierra Leone', 'give'), |
|
318 | + 'SG' => esc_html__('Singapore', 'give'), |
|
319 | + 'SK' => esc_html__('Slovak Republic', 'give'), |
|
320 | + 'SI' => esc_html__('Slovenia', 'give'), |
|
321 | + 'SB' => esc_html__('Solomon Islands', 'give'), |
|
322 | + 'SO' => esc_html__('Somalia', 'give'), |
|
323 | + 'ZA' => esc_html__('South Africa', 'give'), |
|
324 | + 'GS' => esc_html__('South Georgia', 'give'), |
|
325 | + 'KR' => esc_html__('South Korea', 'give'), |
|
326 | + 'ES' => esc_html__('Spain', 'give'), |
|
327 | + 'LK' => esc_html__('Sri Lanka', 'give'), |
|
328 | + 'SD' => esc_html__('Sudan', 'give'), |
|
329 | + 'SR' => esc_html__('Suriname', 'give'), |
|
330 | + 'SJ' => esc_html__('Svalbard and Jan Mayen Islands', 'give'), |
|
331 | + 'SZ' => esc_html__('Swaziland', 'give'), |
|
332 | + 'SE' => esc_html__('Sweden', 'give'), |
|
333 | + 'CH' => esc_html__('Switzerland', 'give'), |
|
334 | + 'SY' => esc_html__('Syrian Arab Republic', 'give'), |
|
335 | + 'TW' => esc_html__('Taiwan', 'give'), |
|
336 | + 'TJ' => esc_html__('Tajikistan', 'give'), |
|
337 | + 'TZ' => esc_html__('Tanzania', 'give'), |
|
338 | + 'TG' => esc_html__('Togo', 'give'), |
|
339 | + 'TK' => esc_html__('Tokelau', 'give'), |
|
340 | + 'TO' => esc_html__('Tonga', 'give'), |
|
341 | + 'TH' => esc_html__('Thailand', 'give'), |
|
342 | + 'TT' => esc_html__('Trinidad and Tobago', 'give'), |
|
343 | + 'TN' => esc_html__('Tunisia', 'give'), |
|
344 | + 'TR' => esc_html__('Turkey', 'give'), |
|
345 | + 'TM' => esc_html__('Turkmenistan', 'give'), |
|
346 | + 'TC' => esc_html__('Turks and Caicos Islands', 'give'), |
|
347 | + 'TV' => esc_html__('Tuvalu', 'give'), |
|
348 | + 'UG' => esc_html__('Uganda', 'give'), |
|
349 | + 'UA' => esc_html__('Ukraine', 'give'), |
|
350 | + 'AE' => esc_html__('United Arab Emirates', 'give'), |
|
351 | + 'UY' => esc_html__('Uruguay', 'give'), |
|
352 | + 'UM' => esc_html__('US Minor Outlying Islands', 'give'), |
|
353 | + 'UZ' => esc_html__('Uzbekistan', 'give'), |
|
354 | + 'VU' => esc_html__('Vanuatu', 'give'), |
|
355 | + 'VE' => esc_html__('Venezuela', 'give'), |
|
356 | + 'VN' => esc_html__('Vietnam', 'give'), |
|
357 | + 'VG' => esc_html__('Virgin Islands (British)', 'give'), |
|
358 | + 'VI' => esc_html__('Virgin Islands (USA)', 'give'), |
|
359 | + 'WF' => esc_html__('Wallis and Futuna Islands', 'give'), |
|
360 | + 'EH' => esc_html__('Western Sahara', 'give'), |
|
361 | + 'WS' => esc_html__('Western Samoa', 'give'), |
|
362 | + 'YE' => esc_html__('Yemen', 'give'), |
|
363 | + 'YU' => esc_html__('Yugoslavia', 'give'), |
|
364 | + 'ZM' => esc_html__('Zambia', 'give'), |
|
365 | + 'ZW' => esc_html__('Zimbabwe', 'give') |
|
366 | 366 | ); |
367 | 367 | |
368 | - return apply_filters( 'give_countries', $countries ); |
|
368 | + return apply_filters('give_countries', $countries); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | 'AP' => 'Armed Forces - Pacific' |
447 | 447 | ); |
448 | 448 | |
449 | - return apply_filters( 'give_us_states', $states ); |
|
449 | + return apply_filters('give_us_states', $states); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -459,22 +459,22 @@ discard block |
||
459 | 459 | function give_get_provinces_list() { |
460 | 460 | $provinces = array( |
461 | 461 | '' => '', |
462 | - 'AB' => esc_html__('Alberta', 'give' ), |
|
463 | - 'BC' => esc_html__('British Columbia', 'give' ), |
|
464 | - 'MB' => esc_html__('Manitoba', 'give' ), |
|
465 | - 'NB' => esc_html__('New Brunswick', 'give' ), |
|
466 | - 'NL' => esc_html__('Newfoundland and Labrador', 'give' ), |
|
467 | - 'NS' => esc_html__('Nova Scotia', 'give' ), |
|
468 | - 'NT' => esc_html__('Northwest Territories', 'give' ), |
|
469 | - 'NU' => esc_html__('Nunavut', 'give' ), |
|
470 | - 'ON' => esc_html__('Ontario', 'give' ), |
|
471 | - 'PE' => esc_html__('Prince Edward Island', 'give' ), |
|
472 | - 'QC' => esc_html__('Quebec', 'give' ), |
|
473 | - 'SK' => esc_html__('Saskatchewan', 'give' ), |
|
474 | - 'YT' => esc_html__('Yukon', 'give' ) |
|
462 | + 'AB' => esc_html__('Alberta', 'give'), |
|
463 | + 'BC' => esc_html__('British Columbia', 'give'), |
|
464 | + 'MB' => esc_html__('Manitoba', 'give'), |
|
465 | + 'NB' => esc_html__('New Brunswick', 'give'), |
|
466 | + 'NL' => esc_html__('Newfoundland and Labrador', 'give'), |
|
467 | + 'NS' => esc_html__('Nova Scotia', 'give'), |
|
468 | + 'NT' => esc_html__('Northwest Territories', 'give'), |
|
469 | + 'NU' => esc_html__('Nunavut', 'give'), |
|
470 | + 'ON' => esc_html__('Ontario', 'give'), |
|
471 | + 'PE' => esc_html__('Prince Edward Island', 'give'), |
|
472 | + 'QC' => esc_html__('Quebec', 'give'), |
|
473 | + 'SK' => esc_html__('Saskatchewan', 'give'), |
|
474 | + 'YT' => esc_html__('Yukon', 'give') |
|
475 | 475 | ); |
476 | 476 | |
477 | - return apply_filters( 'give_canada_provinces', $provinces ); |
|
477 | + return apply_filters('give_canada_provinces', $provinces); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | 'WA' => 'Western Australia' |
497 | 497 | ); |
498 | 498 | |
499 | - return apply_filters( 'give_australian_states', $states ); |
|
499 | + return apply_filters('give_australian_states', $states); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | 'TO' => 'Tocantins' |
538 | 538 | ); |
539 | 539 | |
540 | - return apply_filters( 'give_brazil_states', $states ); |
|
540 | + return apply_filters('give_brazil_states', $states); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | 'NEW TERRITORIES' => 'New Territories' |
555 | 555 | ); |
556 | 556 | |
557 | - return apply_filters( 'give_hong_kong_states', $states ); |
|
557 | + return apply_filters('give_hong_kong_states', $states); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | 'ZA' => 'Zala' |
589 | 589 | ); |
590 | 590 | |
591 | - return apply_filters( 'give_hungary_states', $states ); |
|
591 | + return apply_filters('give_hungary_states', $states); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | 'CN32' => 'Xinjiang / 新疆' |
635 | 635 | ); |
636 | 636 | |
637 | - return apply_filters( 'give_chinese_states', $states ); |
|
637 | + return apply_filters('give_chinese_states', $states); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | /** |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | 'WC' => 'West Coast' |
664 | 664 | ); |
665 | 665 | |
666 | - return apply_filters( 'give_new_zealand_states', $states ); |
|
666 | + return apply_filters('give_new_zealand_states', $states); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | 'PB' => 'Papua Barat' |
712 | 712 | ); |
713 | 713 | |
714 | - return apply_filters( 'give_indonesia_states', $states ); |
|
714 | + return apply_filters('give_indonesia_states', $states); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | 'PY' => 'Pondicherry (Puducherry)' |
762 | 762 | ); |
763 | 763 | |
764 | - return apply_filters( 'give_indian_states', $states ); |
|
764 | + return apply_filters('give_indian_states', $states); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | 'PJY' => 'W.P. Putrajaya' |
792 | 792 | ); |
793 | 793 | |
794 | - return apply_filters( 'give_malaysian_states', $states ); |
|
794 | + return apply_filters('give_malaysian_states', $states); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | 'WC' => 'Western Cape' |
815 | 815 | ); |
816 | 816 | |
817 | - return apply_filters( 'give_south_african_states', $states ); |
|
817 | + return apply_filters('give_south_african_states', $states); |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | /** |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | 'TH-35' => 'Yasothon (ยโสธร)' |
906 | 906 | ); |
907 | 907 | |
908 | - return apply_filters( 'give_thailand_states', $states ); |
|
908 | + return apply_filters('give_thailand_states', $states); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -917,59 +917,59 @@ discard block |
||
917 | 917 | function give_get_spain_states_list() { |
918 | 918 | $states = array( |
919 | 919 | '' => '', |
920 | - 'C' => esc_html__( 'A Coruña', 'give' ), |
|
921 | - 'VI' => esc_html__( 'Álava', 'give' ), |
|
922 | - 'AB' => esc_html__( 'Albacete', 'give' ), |
|
923 | - 'A' => esc_html__( 'Alicante', 'give' ), |
|
924 | - 'AL' => esc_html__( 'Almería', 'give' ), |
|
925 | - 'O' => esc_html__( 'Asturias', 'give' ), |
|
926 | - 'AV' => esc_html__( 'Ávila', 'give' ), |
|
927 | - 'BA' => esc_html__( 'Badajoz', 'give' ), |
|
928 | - 'PM' => esc_html__( 'Baleares', 'give' ), |
|
929 | - 'B' => esc_html__( 'Barcelona', 'give' ), |
|
930 | - 'BU' => esc_html__( 'Burgos', 'give' ), |
|
931 | - 'CC' => esc_html__( 'Cáceres', 'give' ), |
|
932 | - 'CA' => esc_html__( 'Cádiz', 'give' ), |
|
933 | - 'S' => esc_html__( 'Cantabria', 'give' ), |
|
934 | - 'CS' => esc_html__( 'Castellón', 'give' ), |
|
935 | - 'CE' => esc_html__( 'Ceuta', 'give' ), |
|
936 | - 'CR' => esc_html__( 'Ciudad Real', 'give' ), |
|
937 | - 'CO' => esc_html__( 'Córdoba', 'give' ), |
|
938 | - 'CU' => esc_html__( 'Cuenca', 'give' ), |
|
939 | - 'GI' => esc_html__( 'Girona', 'give' ), |
|
940 | - 'GR' => esc_html__( 'Granada', 'give' ), |
|
941 | - 'GU' => esc_html__( 'Guadalajara', 'give' ), |
|
942 | - 'SS' => esc_html__( 'Gipuzkoa', 'give' ), |
|
943 | - 'H' => esc_html__( 'Huelva', 'give' ), |
|
944 | - 'HU' => esc_html__( 'Huesca', 'give' ), |
|
945 | - 'J' => esc_html__( 'Jaén', 'give' ), |
|
946 | - 'LO' => esc_html__( 'La Rioja', 'give' ), |
|
947 | - 'GC' => esc_html__( 'Las Palmas', 'give' ), |
|
948 | - 'LE' => esc_html__( 'León', 'give' ), |
|
949 | - 'L' => esc_html__( 'Lleida', 'give' ), |
|
950 | - 'LU' => esc_html__( 'Lugo', 'give' ), |
|
951 | - 'M' => esc_html__( 'Madrid', 'give' ), |
|
952 | - 'MA' => esc_html__( 'Málaga', 'give' ), |
|
953 | - 'ML' => esc_html__( 'Melilla', 'give' ), |
|
954 | - 'MU' => esc_html__( 'Murcia', 'give' ), |
|
955 | - 'NA' => esc_html__( 'Navarra', 'give' ), |
|
956 | - 'OR' => esc_html__( 'Ourense', 'give' ), |
|
957 | - 'P' => esc_html__( 'Palencia', 'give' ), |
|
958 | - 'PO' => esc_html__( 'Pontevedra', 'give' ), |
|
959 | - 'SA' => esc_html__( 'Salamanca', 'give' ), |
|
960 | - 'TF' => esc_html__( 'Santa Cruz de Tenerife', 'give' ), |
|
961 | - 'SG' => esc_html__( 'Segovia', 'give' ), |
|
962 | - 'SE' => esc_html__( 'Sevilla', 'give' ), |
|
963 | - 'SO' => esc_html__( 'Soria', 'give' ), |
|
964 | - 'T' => esc_html__( 'Tarragona', 'give' ), |
|
965 | - 'TE' => esc_html__( 'Teruel', 'give' ), |
|
966 | - 'TO' => esc_html__( 'Toledo', 'give' ), |
|
967 | - 'V' => esc_html__( 'Valencia', 'give' ), |
|
968 | - 'VA' => esc_html__( 'Valladolid', 'give' ), |
|
969 | - 'BI' => esc_html__( 'Bizkaia', 'give' ), |
|
970 | - 'ZA' => esc_html__( 'Zamora', 'give' ), |
|
971 | - 'Z' => esc_html__( 'Zaragoza', 'give' ) |
|
920 | + 'C' => esc_html__('A Coruña', 'give'), |
|
921 | + 'VI' => esc_html__('Álava', 'give'), |
|
922 | + 'AB' => esc_html__('Albacete', 'give'), |
|
923 | + 'A' => esc_html__('Alicante', 'give'), |
|
924 | + 'AL' => esc_html__('Almería', 'give'), |
|
925 | + 'O' => esc_html__('Asturias', 'give'), |
|
926 | + 'AV' => esc_html__('Ávila', 'give'), |
|
927 | + 'BA' => esc_html__('Badajoz', 'give'), |
|
928 | + 'PM' => esc_html__('Baleares', 'give'), |
|
929 | + 'B' => esc_html__('Barcelona', 'give'), |
|
930 | + 'BU' => esc_html__('Burgos', 'give'), |
|
931 | + 'CC' => esc_html__('Cáceres', 'give'), |
|
932 | + 'CA' => esc_html__('Cádiz', 'give'), |
|
933 | + 'S' => esc_html__('Cantabria', 'give'), |
|
934 | + 'CS' => esc_html__('Castellón', 'give'), |
|
935 | + 'CE' => esc_html__('Ceuta', 'give'), |
|
936 | + 'CR' => esc_html__('Ciudad Real', 'give'), |
|
937 | + 'CO' => esc_html__('Córdoba', 'give'), |
|
938 | + 'CU' => esc_html__('Cuenca', 'give'), |
|
939 | + 'GI' => esc_html__('Girona', 'give'), |
|
940 | + 'GR' => esc_html__('Granada', 'give'), |
|
941 | + 'GU' => esc_html__('Guadalajara', 'give'), |
|
942 | + 'SS' => esc_html__('Gipuzkoa', 'give'), |
|
943 | + 'H' => esc_html__('Huelva', 'give'), |
|
944 | + 'HU' => esc_html__('Huesca', 'give'), |
|
945 | + 'J' => esc_html__('Jaén', 'give'), |
|
946 | + 'LO' => esc_html__('La Rioja', 'give'), |
|
947 | + 'GC' => esc_html__('Las Palmas', 'give'), |
|
948 | + 'LE' => esc_html__('León', 'give'), |
|
949 | + 'L' => esc_html__('Lleida', 'give'), |
|
950 | + 'LU' => esc_html__('Lugo', 'give'), |
|
951 | + 'M' => esc_html__('Madrid', 'give'), |
|
952 | + 'MA' => esc_html__('Málaga', 'give'), |
|
953 | + 'ML' => esc_html__('Melilla', 'give'), |
|
954 | + 'MU' => esc_html__('Murcia', 'give'), |
|
955 | + 'NA' => esc_html__('Navarra', 'give'), |
|
956 | + 'OR' => esc_html__('Ourense', 'give'), |
|
957 | + 'P' => esc_html__('Palencia', 'give'), |
|
958 | + 'PO' => esc_html__('Pontevedra', 'give'), |
|
959 | + 'SA' => esc_html__('Salamanca', 'give'), |
|
960 | + 'TF' => esc_html__('Santa Cruz de Tenerife', 'give'), |
|
961 | + 'SG' => esc_html__('Segovia', 'give'), |
|
962 | + 'SE' => esc_html__('Sevilla', 'give'), |
|
963 | + 'SO' => esc_html__('Soria', 'give'), |
|
964 | + 'T' => esc_html__('Tarragona', 'give'), |
|
965 | + 'TE' => esc_html__('Teruel', 'give'), |
|
966 | + 'TO' => esc_html__('Toledo', 'give'), |
|
967 | + 'V' => esc_html__('Valencia', 'give'), |
|
968 | + 'VA' => esc_html__('Valladolid', 'give'), |
|
969 | + 'BI' => esc_html__('Bizkaia', 'give'), |
|
970 | + 'ZA' => esc_html__('Zamora', 'give'), |
|
971 | + 'Z' => esc_html__('Zaragoza', 'give') |
|
972 | 972 | ); |
973 | 973 | |
974 | - return apply_filters( 'give_spain_states', $states ); |
|
974 | + return apply_filters('give_spain_states', $states); |
|
975 | 975 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | */ |
5 | 5 | $give_map_deprecated_actions = give_deprecated_actions(); |
6 | 6 | |
7 | -foreach ( $give_map_deprecated_actions as $new => $old ) { |
|
8 | - add_action( $new, 'give_deprecated_action_mapping', 10, 4 ); |
|
7 | +foreach ($give_map_deprecated_actions as $new => $old) { |
|
8 | + add_action($new, 'give_deprecated_action_mapping', 10, 4); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | /** |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return mixed|void |
61 | 61 | */ |
62 | -function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
62 | +function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
63 | 63 | $give_map_deprecated_actions = give_deprecated_actions(); |
64 | 64 | $action = current_filter(); |
65 | 65 | |
66 | - if ( isset( $give_map_deprecated_actions[ $action ] ) ) { |
|
67 | - if ( has_action( $give_map_deprecated_actions[ $action ] ) ) { |
|
68 | - do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 ); |
|
66 | + if (isset($give_map_deprecated_actions[$action])) { |
|
67 | + if (has_action($give_map_deprecated_actions[$action])) { |
|
68 | + do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3); |
|
69 | 69 | |
70 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
70 | + if ( ! defined('DOING_AJAX')) { |
|
71 | 71 | // translators: %s: action name. |
72 | 72 | _give_deprecated_function( |
73 | 73 | sprintf( |
74 | - __( 'The %s action' ), |
|
75 | - $give_map_deprecated_actions[ $action ] |
|
74 | + __('The %s action'), |
|
75 | + $give_map_deprecated_actions[$action] |
|
76 | 76 | ), |
77 | 77 | '1.7', |
78 | 78 | $action |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | */ |
5 | 5 | $give_map_deprecated_filters = give_deprecated_filters(); |
6 | 6 | |
7 | -foreach ( $give_map_deprecated_filters as $new => $old ) { |
|
8 | - add_filter( $new, 'give_deprecated_filter_mapping', 10, 4 ); |
|
7 | +foreach ($give_map_deprecated_filters as $new => $old) { |
|
8 | + add_filter($new, 'give_deprecated_filter_mapping', 10, 4); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | ); |
29 | 29 | |
30 | 30 | // Dynamic filters. |
31 | - switch ( true ) { |
|
32 | - case ( ! empty( $_GET['payment-confirmation'] ) ) : |
|
31 | + switch (true) { |
|
32 | + case ( ! empty($_GET['payment-confirmation'])) : |
|
33 | 33 | $give_deprecated_filters["give_donation_confirm_{$_GET['payment-confirmation']}"] = "give_payment_confirm_{$_GET['payment-confirmation']}"; |
34 | 34 | } |
35 | 35 | |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return mixed|void |
48 | 48 | */ |
49 | -function give_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
49 | +function give_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
50 | 50 | $give_map_deprecated_filters = give_deprecated_filters(); |
51 | 51 | $filter = current_filter(); |
52 | 52 | |
53 | - if ( isset( $give_map_deprecated_filters[ $filter ] ) ) { |
|
54 | - if ( has_filter( $give_map_deprecated_filters[ $filter ] ) ) { |
|
55 | - $data = apply_filters( $give_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 ); |
|
53 | + if (isset($give_map_deprecated_filters[$filter])) { |
|
54 | + if (has_filter($give_map_deprecated_filters[$filter])) { |
|
55 | + $data = apply_filters($give_map_deprecated_filters[$filter], $data, $arg_1, $arg_2, $arg_3); |
|
56 | 56 | |
57 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
57 | + if ( ! defined('DOING_AJAX')) { |
|
58 | 58 | _give_deprecated_function( |
59 | 59 | sprintf( |
60 | 60 | /* translators: %s: filter name */ |
61 | - __( 'The %s filter' ), |
|
62 | - $give_map_deprecated_filters[ $filter ] |
|
61 | + __('The %s filter'), |
|
62 | + $give_map_deprecated_filters[$filter] |
|
63 | 63 | ), |
64 | 64 | '1.7', |
65 | 65 | $filter |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -74,53 +74,53 @@ discard block |
||
74 | 74 | public function __construct() { |
75 | 75 | |
76 | 76 | $this->use_php_sessions = $this->use_php_sessions(); |
77 | - $this->exp_option = give_get_option( 'session_lifetime' ); |
|
77 | + $this->exp_option = give_get_option('session_lifetime'); |
|
78 | 78 | |
79 | 79 | // PHP Sessions. |
80 | - if ( $this->use_php_sessions ) { |
|
80 | + if ($this->use_php_sessions) { |
|
81 | 81 | |
82 | - if ( is_multisite() ) { |
|
82 | + if (is_multisite()) { |
|
83 | 83 | |
84 | - $this->prefix = '_' . get_current_blog_id(); |
|
84 | + $this->prefix = '_'.get_current_blog_id(); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
88 | - add_action( 'init', array( $this, 'maybe_start_session' ), - 2 ); |
|
88 | + add_action('init', array($this, 'maybe_start_session'), - 2); |
|
89 | 89 | |
90 | 90 | } else { |
91 | 91 | |
92 | - if ( ! $this->should_start_session() ) { |
|
92 | + if ( ! $this->should_start_session()) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // Use WP_Session. |
97 | - if ( ! defined( 'WP_SESSION_COOKIE' ) ) { |
|
98 | - define( 'WP_SESSION_COOKIE', 'give_wp_session' ); |
|
97 | + if ( ! defined('WP_SESSION_COOKIE')) { |
|
98 | + define('WP_SESSION_COOKIE', 'give_wp_session'); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( ! class_exists( 'Recursive_ArrayAccess' ) ) { |
|
102 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
101 | + if ( ! class_exists('Recursive_ArrayAccess')) { |
|
102 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( ! class_exists( 'WP_Session' ) ) { |
|
106 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php'; |
|
107 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php'; |
|
105 | + if ( ! class_exists('WP_Session')) { |
|
106 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php'; |
|
107 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php'; |
|
108 | 108 | } |
109 | 109 | |
110 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 ); |
|
111 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 ); |
|
110 | + add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); |
|
111 | + add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Init Session. |
116 | - if ( empty( $this->session ) && ! $this->use_php_sessions ) { |
|
117 | - add_action( 'plugins_loaded', array( $this, 'init' ), - 1 ); |
|
116 | + if (empty($this->session) && ! $this->use_php_sessions) { |
|
117 | + add_action('plugins_loaded', array($this, 'init'), - 1); |
|
118 | 118 | } else { |
119 | - add_action( 'init', array( $this, 'init' ), - 1 ); |
|
119 | + add_action('init', array($this, 'init'), - 1); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Set cookie on Donation Completion page. |
123 | - add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) ); |
|
123 | + add_action('give_pre_process_donation', array($this, 'set_session_cookies')); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function init() { |
138 | 138 | |
139 | - if ( $this->use_php_sessions ) { |
|
140 | - $this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array(); |
|
139 | + if ($this->use_php_sessions) { |
|
140 | + $this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array(); |
|
141 | 141 | } else { |
142 | 142 | $this->session = WP_Session::get_instance(); |
143 | 143 | } |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string Session variable. |
174 | 174 | */ |
175 | - public function get( $key ) { |
|
176 | - $key = sanitize_key( $key ); |
|
175 | + public function get($key) { |
|
176 | + $key = sanitize_key($key); |
|
177 | 177 | |
178 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false; |
|
178 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false; |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
@@ -192,21 +192,21 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return string Session variable. |
194 | 194 | */ |
195 | - public function set( $key, $value ) { |
|
195 | + public function set($key, $value) { |
|
196 | 196 | |
197 | - $key = sanitize_key( $key ); |
|
197 | + $key = sanitize_key($key); |
|
198 | 198 | |
199 | - if ( is_array( $value ) ) { |
|
200 | - $this->session[ $key ] = serialize( $value ); |
|
199 | + if (is_array($value)) { |
|
200 | + $this->session[$key] = serialize($value); |
|
201 | 201 | } else { |
202 | - $this->session[ $key ] = $value; |
|
202 | + $this->session[$key] = $value; |
|
203 | 203 | } |
204 | 204 | |
205 | - if ( $this->use_php_sessions ) { |
|
206 | - $_SESSION[ 'give' . $this->prefix ] = $this->session; |
|
205 | + if ($this->use_php_sessions) { |
|
206 | + $_SESSION['give'.$this->prefix] = $this->session; |
|
207 | 207 | } |
208 | 208 | |
209 | - return $this->session[ $key ]; |
|
209 | + return $this->session[$key]; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | * @hook |
221 | 221 | */ |
222 | 222 | public function set_session_cookies() { |
223 | - if ( ! headers_sent() ) { |
|
224 | - $lifetime = current_time( 'timestamp' ) + $this->set_expiration_time(); |
|
225 | - @setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
226 | - @setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
223 | + if ( ! headers_sent()) { |
|
224 | + $lifetime = current_time('timestamp') + $this->set_expiration_time(); |
|
225 | + @setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
226 | + @setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function set_expiration_variant_time() { |
241 | 241 | |
242 | - return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 ); |
|
242 | + return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function set_expiration_time() { |
256 | 256 | |
257 | - return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 ); |
|
257 | + return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -272,21 +272,21 @@ discard block |
||
272 | 272 | $ret = false; |
273 | 273 | |
274 | 274 | // If the database variable is already set, no need to run auto detection. |
275 | - $give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' ); |
|
275 | + $give_use_php_sessions = (bool) get_option('give_use_php_sessions'); |
|
276 | 276 | |
277 | - if ( ! $give_use_php_sessions ) { |
|
277 | + if ( ! $give_use_php_sessions) { |
|
278 | 278 | |
279 | 279 | // Attempt to detect if the server supports PHP sessions. |
280 | - if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { |
|
280 | + if (function_exists('session_start') && ! ini_get('safe_mode')) { |
|
281 | 281 | |
282 | - $this->set( 'give_use_php_sessions', 1 ); |
|
282 | + $this->set('give_use_php_sessions', 1); |
|
283 | 283 | |
284 | - if ( $this->get( 'give_use_php_sessions' ) ) { |
|
284 | + if ($this->get('give_use_php_sessions')) { |
|
285 | 285 | |
286 | 286 | $ret = true; |
287 | 287 | |
288 | 288 | // Set the database option. |
289 | - update_option( 'give_use_php_sessions', true ); |
|
289 | + update_option('give_use_php_sessions', true); |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | } |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | // Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant. |
299 | - if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) { |
|
299 | + if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) { |
|
300 | 300 | $ret = true; |
301 | - } elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) { |
|
301 | + } elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) { |
|
302 | 302 | $ret = false; |
303 | 303 | } |
304 | 304 | |
305 | - return (bool) apply_filters( 'give_use_php_sessions', $ret ); |
|
305 | + return (bool) apply_filters('give_use_php_sessions', $ret); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | |
320 | 320 | $start_session = true; |
321 | 321 | |
322 | - if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
|
322 | + if ( ! empty($_SERVER['REQUEST_URI'])) { |
|
323 | 323 | |
324 | - $blacklist = apply_filters( 'give_session_start_uri_blacklist', array( |
|
324 | + $blacklist = apply_filters('give_session_start_uri_blacklist', array( |
|
325 | 325 | 'feed', |
326 | 326 | 'feed', |
327 | 327 | 'feed/rss', |
@@ -329,21 +329,21 @@ discard block |
||
329 | 329 | 'feed/rdf', |
330 | 330 | 'feed/atom', |
331 | 331 | 'comments/feed/', |
332 | - ) ); |
|
333 | - $uri = ltrim( $_SERVER['REQUEST_URI'], '/' ); |
|
334 | - $uri = untrailingslashit( $uri ); |
|
335 | - if ( in_array( $uri, $blacklist ) ) { |
|
332 | + )); |
|
333 | + $uri = ltrim($_SERVER['REQUEST_URI'], '/'); |
|
334 | + $uri = untrailingslashit($uri); |
|
335 | + if (in_array($uri, $blacklist)) { |
|
336 | 336 | $start_session = false; |
337 | 337 | } |
338 | - if ( false !== strpos( $uri, 'feed=' ) ) { |
|
338 | + if (false !== strpos($uri, 'feed=')) { |
|
339 | 339 | $start_session = false; |
340 | 340 | } |
341 | - if ( is_admin() ) { |
|
341 | + if (is_admin()) { |
|
342 | 342 | $start_session = false; |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - return apply_filters( 'give_start_session', $start_session ); |
|
346 | + return apply_filters('give_start_session', $start_session); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | */ |
360 | 360 | public function maybe_start_session() { |
361 | 361 | |
362 | - if ( ! $this->should_start_session() ) { |
|
362 | + if ( ! $this->should_start_session()) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! session_id() && ! headers_sent() ) { |
|
366 | + if ( ! session_id() && ! headers_sent()) { |
|
367 | 367 | session_start(); |
368 | 368 | } |
369 | 369 | |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | |
383 | 383 | $expiration = false; |
384 | 384 | |
385 | - if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) { |
|
385 | + if (session_id() && isset($_COOKIE[session_name().'_expiration'])) { |
|
386 | 386 | |
387 | - $expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) ); |
|
387 | + $expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration'])); |
|
388 | 388 | |
389 | 389 | } |
390 | 390 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a receipt while editing a donation. |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email. |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 ); |
|
36 | +add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Resend the Email Donation Receipt. (This can be done from the Donation History Page) |
@@ -44,29 +44,29 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -function give_resend_donation_receipt( $data ) { |
|
47 | +function give_resend_donation_receipt($data) { |
|
48 | 48 | |
49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
49 | + $purchase_id = absint($data['purchase_id']); |
|
50 | 50 | |
51 | - if ( empty( $purchase_id ) ) { |
|
51 | + if (empty($purchase_id)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
56 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
56 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
57 | 57 | } |
58 | 58 | |
59 | - give_email_donation_receipt( $purchase_id, false ); |
|
59 | + give_email_donation_receipt($purchase_id, false); |
|
60 | 60 | |
61 | - wp_redirect( add_query_arg( array( |
|
61 | + wp_redirect(add_query_arg(array( |
|
62 | 62 | 'give-message' => 'email_sent', |
63 | 63 | 'give-action' => false, |
64 | 64 | 'purchase_id' => false |
65 | - ) ) ); |
|
65 | + ))); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
80 | -function give_send_test_email( $data ) { |
|
81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
80 | +function give_send_test_email($data) { |
|
81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | give_email_test_donation_receipt(); |
87 | 87 | |
88 | 88 | // Remove the test email query arg. |
89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
89 | + wp_redirect(remove_query_arg('give_action')); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
93 | +add_action('give_send_test_email', 'give_send_test_email'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once. |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete. |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $payment_id The ID of the payment. |
60 | 60 | */ |
61 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
61 | + do_action('give_pre_complete_purchase', $payment_id); |
|
62 | 62 | |
63 | 63 | // Ensure these actions only run once, ever. |
64 | - if ( empty( $completed_date ) ) { |
|
64 | + if (empty($completed_date)) { |
|
65 | 65 | |
66 | - give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
66 | + give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Fires after logging donation record. |
@@ -74,32 +74,32 @@ discard block |
||
74 | 74 | * @param int $payment_id The ID number of the payment. |
75 | 75 | * @param array $payment_meta The payment meta. |
76 | 76 | */ |
77 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
77 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Increase the earnings for this form ID. |
82 | - give_increase_earnings( $form_id, $amount ); |
|
83 | - give_increase_purchase_count( $form_id ); |
|
82 | + give_increase_earnings($form_id, $amount); |
|
83 | + give_increase_purchase_count($form_id); |
|
84 | 84 | |
85 | 85 | // Clear the total earnings cache. |
86 | - delete_transient( 'give_earnings_total' ); |
|
86 | + delete_transient('give_earnings_total'); |
|
87 | 87 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
88 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
89 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
88 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
89 | + delete_transient(md5('give_earnings_todaytoday')); |
|
90 | 90 | |
91 | 91 | // Increase the donor's donation stats. |
92 | - $customer = new Give_Customer( $customer_id ); |
|
92 | + $customer = new Give_Customer($customer_id); |
|
93 | 93 | $customer->increase_purchase_count(); |
94 | - $customer->increase_value( $amount ); |
|
94 | + $customer->increase_value($amount); |
|
95 | 95 | |
96 | - give_increase_total_earnings( $amount ); |
|
96 | + give_increase_total_earnings($amount); |
|
97 | 97 | |
98 | 98 | // Ensure this action only runs once ever. |
99 | - if ( empty( $completed_date ) ) { |
|
99 | + if (empty($completed_date)) { |
|
100 | 100 | |
101 | 101 | // Save the completed date. |
102 | - $payment->completed_date = current_time( 'mysql' ); |
|
102 | + $payment->completed_date = current_time('mysql'); |
|
103 | 103 | $payment->save(); |
104 | 104 | |
105 | 105 | /** |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param int $payment_id The ID of the payment. |
111 | 111 | */ |
112 | - do_action( 'give_complete_donation', $payment_id ); |
|
112 | + do_action('give_complete_donation', $payment_id); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
117 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
118 | 118 | |
119 | 119 | |
120 | 120 | /** |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return void |
130 | 130 | */ |
131 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
131 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
132 | 132 | |
133 | 133 | // Get the list of statuses so that status in the payment note can be translated. |
134 | 134 | $stati = give_get_payment_statuses(); |
135 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
136 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
135 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
136 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
137 | 137 | |
138 | 138 | // translators: 1: old status 2: new status. |
139 | 139 | $status_change = sprintf( |
140 | - esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), |
|
140 | + esc_html__('Status changed from %1$s to %2$s.', 'give'), |
|
141 | 141 | $old_status, |
142 | 142 | $new_status |
143 | 143 | ); |
144 | 144 | |
145 | - give_insert_payment_note( $payment_id, $status_change ); |
|
145 | + give_insert_payment_note($payment_id, $status_change); |
|
146 | 146 | } |
147 | 147 | |
148 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
148 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | /** |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return void |
164 | 164 | */ |
165 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
165 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
166 | 166 | |
167 | - $payment = new Give_Payment( $payment_id ); |
|
167 | + $payment = new Give_Payment($payment_id); |
|
168 | 168 | |
169 | - if ( ! empty( $payment->user_id ) ) { |
|
170 | - delete_transient( 'give_user_' . $payment->user_id . '_purchases' ); |
|
169 | + if ( ! empty($payment->user_id)) { |
|
170 | + delete_transient('give_user_'.$payment->user_id.'_purchases'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
174 | 174 | |
175 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
175 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Update Old Payments Totals |
@@ -187,25 +187,25 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return void |
189 | 189 | */ |
190 | -function give_update_old_payments_with_totals( $data ) { |
|
191 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
190 | +function give_update_old_payments_with_totals($data) { |
|
191 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | |
195 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
195 | + if (get_option('give_payment_totals_upgraded')) { |
|
196 | 196 | return; |
197 | 197 | } |
198 | 198 | |
199 | - $payments = give_get_payments( array( |
|
199 | + $payments = give_get_payments(array( |
|
200 | 200 | 'offset' => 0, |
201 | - 'number' => - 1, |
|
201 | + 'number' => -1, |
|
202 | 202 | 'mode' => 'all', |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | |
205 | - if ( $payments ) { |
|
206 | - foreach ( $payments as $payment ) { |
|
205 | + if ($payments) { |
|
206 | + foreach ($payments as $payment) { |
|
207 | 207 | |
208 | - $payment = new Give_Payment( $payment->ID ); |
|
208 | + $payment = new Give_Payment($payment->ID); |
|
209 | 209 | $meta = $payment->get_meta(); |
210 | 210 | |
211 | 211 | $payment->total = $meta['amount']; |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
217 | + add_option('give_payment_totals_upgraded', 1); |
|
218 | 218 | } |
219 | 219 | |
220 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
220 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Mark Abandoned Donations |
@@ -231,17 +231,17 @@ discard block |
||
231 | 231 | function give_mark_abandoned_donations() { |
232 | 232 | $args = array( |
233 | 233 | 'status' => 'pending', |
234 | - 'number' => - 1, |
|
234 | + 'number' => -1, |
|
235 | 235 | 'output' => 'give_payments', |
236 | 236 | ); |
237 | 237 | |
238 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
238 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
239 | 239 | |
240 | - $payments = give_get_payments( $args ); |
|
240 | + $payments = give_get_payments($args); |
|
241 | 241 | |
242 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
242 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
243 | 243 | |
244 | - if ( $payments ) { |
|
244 | + if ($payments) { |
|
245 | 245 | /** |
246 | 246 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
247 | 247 | * |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param array $skip_payment_gateways Array of payment gateways |
251 | 251 | */ |
252 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
252 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
253 | 253 | |
254 | - foreach ( $payments as $payment ) { |
|
255 | - $gateway = give_get_payment_gateway( $payment ); |
|
254 | + foreach ($payments as $payment) { |
|
255 | + $gateway = give_get_payment_gateway($payment); |
|
256 | 256 | |
257 | 257 | // Skip payment gateways. |
258 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
258 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
268 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return void |
279 | 279 | */ |
280 | -function give_refresh_thismonth_stat_transients( $payment_ID ) { |
|
280 | +function give_refresh_thismonth_stat_transients($payment_ID) { |
|
281 | 281 | |
282 | 282 | /* @var Give_Payment_Stats $stats Give_Payment_Stats class object. */ |
283 | 283 | $stats = new Give_Payment_Stats(); |
284 | 284 | |
285 | 285 | // Delete transients. |
286 | - delete_transient( 'give_estimated_monthly_stats' ); |
|
287 | - delete_transient( 'give_earnings_total' ); |
|
288 | - delete_transient( $stats->get_earnings_cache_key( 0, 'this_month' ) ); |
|
286 | + delete_transient('give_estimated_monthly_stats'); |
|
287 | + delete_transient('give_earnings_total'); |
|
288 | + delete_transient($stats->get_earnings_cache_key(0, 'this_month')); |
|
289 | 289 | } |
290 | 290 | |
291 | -add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' ); |
|
291 | +add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
58 | 58 | */ |
59 | - public function __construct( $args = array() ) { |
|
59 | + public function __construct($args = array()) { |
|
60 | 60 | $defaults = array( |
61 | 61 | 'output' => 'payments', // Use 'posts' to get standard post objects |
62 | - 'post_type' => array( 'give_payment' ), |
|
62 | + 'post_type' => array('give_payment'), |
|
63 | 63 | 'start_date' => false, |
64 | 64 | 'end_date' => false, |
65 | 65 | 'number' => 20, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'give_forms' => null |
80 | 80 | ); |
81 | 81 | |
82 | - $this->args = wp_parse_args( $args, $defaults ); |
|
82 | + $this->args = wp_parse_args($args, $defaults); |
|
83 | 83 | |
84 | 84 | $this->init(); |
85 | 85 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | * @since 1.0 |
91 | 91 | * @access public |
92 | 92 | */ |
93 | - public function __set( $query_var, $value ) { |
|
94 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
95 | - $this->args[ $query_var ][] = $value; |
|
93 | + public function __set($query_var, $value) { |
|
94 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
95 | + $this->args[$query_var][] = $value; |
|
96 | 96 | } else { |
97 | - $this->args[ $query_var ] = $value; |
|
97 | + $this->args[$query_var] = $value; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @since 1.0 |
105 | 105 | * @access public |
106 | 106 | */ |
107 | - public function __unset( $query_var ) { |
|
108 | - unset( $this->args[ $query_var ] ); |
|
107 | + public function __unset($query_var) { |
|
108 | + unset($this->args[$query_var]); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -118,19 +118,19 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function init() { |
120 | 120 | |
121 | - add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) ); |
|
122 | - add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) ); |
|
123 | - |
|
124 | - add_action( 'give_pre_get_payments', array( $this, 'orderby' ) ); |
|
125 | - add_action( 'give_pre_get_payments', array( $this, 'status' ) ); |
|
126 | - add_action( 'give_pre_get_payments', array( $this, 'month' ) ); |
|
127 | - add_action( 'give_pre_get_payments', array( $this, 'per_page' ) ); |
|
128 | - add_action( 'give_pre_get_payments', array( $this, 'page' ) ); |
|
129 | - add_action( 'give_pre_get_payments', array( $this, 'user' ) ); |
|
130 | - add_action( 'give_pre_get_payments', array( $this, 'search' ) ); |
|
131 | - add_action( 'give_pre_get_payments', array( $this, 'mode' ) ); |
|
132 | - add_action( 'give_pre_get_payments', array( $this, 'children' ) ); |
|
133 | - add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) ); |
|
121 | + add_action('give_pre_get_payments', array($this, 'date_filter_pre')); |
|
122 | + add_action('give_post_get_payments', array($this, 'date_filter_post')); |
|
123 | + |
|
124 | + add_action('give_pre_get_payments', array($this, 'orderby')); |
|
125 | + add_action('give_pre_get_payments', array($this, 'status')); |
|
126 | + add_action('give_pre_get_payments', array($this, 'month')); |
|
127 | + add_action('give_pre_get_payments', array($this, 'per_page')); |
|
128 | + add_action('give_pre_get_payments', array($this, 'page')); |
|
129 | + add_action('give_pre_get_payments', array($this, 'user')); |
|
130 | + add_action('give_pre_get_payments', array($this, 'search')); |
|
131 | + add_action('give_pre_get_payments', array($this, 'mode')); |
|
132 | + add_action('give_pre_get_payments', array($this, 'children')); |
|
133 | + add_action('give_pre_get_payments', array($this, 'give_forms')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @param Give_Payments_Query $this Payments query object. |
156 | 156 | */ |
157 | - do_action( 'give_pre_get_payments', $this ); |
|
157 | + do_action('give_pre_get_payments', $this); |
|
158 | 158 | |
159 | - $query = new WP_Query( $this->args ); |
|
159 | + $query = new WP_Query($this->args); |
|
160 | 160 | |
161 | 161 | $custom_output = array( |
162 | 162 | 'payments', |
163 | 163 | 'give_payments', |
164 | 164 | ); |
165 | 165 | |
166 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
166 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
167 | 167 | return $query->posts; |
168 | 168 | } |
169 | 169 | |
170 | - if ( $query->have_posts() ) { |
|
171 | - while ( $query->have_posts() ) { |
|
170 | + if ($query->have_posts()) { |
|
171 | + while ($query->have_posts()) { |
|
172 | 172 | $query->the_post(); |
173 | 173 | |
174 | 174 | $payment_id = get_post()->ID; |
175 | - $payment = new Give_Payment( $payment_id ); |
|
175 | + $payment = new Give_Payment($payment_id); |
|
176 | 176 | |
177 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
177 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | wp_reset_postdata(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @param Give_Payments_Query $this Payments query object. |
189 | 189 | */ |
190 | - do_action( 'give_post_get_payments', $this ); |
|
190 | + do_action('give_post_get_payments', $this); |
|
191 | 191 | |
192 | 192 | return $this->payments; |
193 | 193 | } |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | * @return void |
202 | 202 | */ |
203 | 203 | public function date_filter_pre() { |
204 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
204 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
208 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
208 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
209 | 209 | |
210 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
210 | + add_filter('posts_where', array($this, 'payments_where')); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | * @return void |
221 | 221 | */ |
222 | 222 | public function date_filter_post() { |
223 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
223 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
227 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
227 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | * @return void |
237 | 237 | */ |
238 | 238 | public function status() { |
239 | - if ( ! isset ( $this->args['status'] ) ) { |
|
239 | + if ( ! isset ($this->args['status'])) { |
|
240 | 240 | return; |
241 | 241 | } |
242 | 242 | |
243 | - $this->__set( 'post_status', $this->args['status'] ); |
|
244 | - $this->__unset( 'status' ); |
|
243 | + $this->__set('post_status', $this->args['status']); |
|
244 | + $this->__unset('status'); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | * @return void |
254 | 254 | */ |
255 | 255 | public function page() { |
256 | - if ( ! isset ( $this->args['page'] ) ) { |
|
256 | + if ( ! isset ($this->args['page'])) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
260 | - $this->__set( 'paged', $this->args['page'] ); |
|
261 | - $this->__unset( 'page' ); |
|
260 | + $this->__set('paged', $this->args['page']); |
|
261 | + $this->__unset('page'); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function per_page() { |
273 | 273 | |
274 | - if ( ! isset( $this->args['number'] ) ) { |
|
274 | + if ( ! isset($this->args['number'])) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
278 | - if ( $this->args['number'] == - 1 ) { |
|
279 | - $this->__set( 'nopaging', true ); |
|
278 | + if ($this->args['number'] == - 1) { |
|
279 | + $this->__set('nopaging', true); |
|
280 | 280 | } else { |
281 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
281 | + $this->__set('posts_per_page', $this->args['number']); |
|
282 | 282 | } |
283 | 283 | |
284 | - $this->__unset( 'number' ); |
|
284 | + $this->__unset('number'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | * @return void |
294 | 294 | */ |
295 | 295 | public function month() { |
296 | - if ( ! isset ( $this->args['month'] ) ) { |
|
296 | + if ( ! isset ($this->args['month'])) { |
|
297 | 297 | return; |
298 | 298 | } |
299 | 299 | |
300 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
301 | - $this->__unset( 'month' ); |
|
300 | + $this->__set('monthnum', $this->args['month']); |
|
301 | + $this->__unset('month'); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -310,13 +310,13 @@ discard block |
||
310 | 310 | * @return void |
311 | 311 | */ |
312 | 312 | public function orderby() { |
313 | - switch ( $this->args['orderby'] ) { |
|
313 | + switch ($this->args['orderby']) { |
|
314 | 314 | case 'amount' : |
315 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
316 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
315 | + $this->__set('orderby', 'meta_value_num'); |
|
316 | + $this->__set('meta_key', '_give_payment_total'); |
|
317 | 317 | break; |
318 | 318 | default : |
319 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
319 | + $this->__set('orderby', $this->args['orderby']); |
|
320 | 320 | break; |
321 | 321 | } |
322 | 322 | } |
@@ -330,20 +330,20 @@ discard block |
||
330 | 330 | * @return void |
331 | 331 | */ |
332 | 332 | public function user() { |
333 | - if ( is_null( $this->args['user'] ) ) { |
|
333 | + if (is_null($this->args['user'])) { |
|
334 | 334 | return; |
335 | 335 | } |
336 | 336 | |
337 | - if ( is_numeric( $this->args['user'] ) ) { |
|
337 | + if (is_numeric($this->args['user'])) { |
|
338 | 338 | $user_key = '_give_payment_user_id'; |
339 | 339 | } else { |
340 | 340 | $user_key = '_give_payment_user_email'; |
341 | 341 | } |
342 | 342 | |
343 | - $this->__set( 'meta_query', array( |
|
343 | + $this->__set('meta_query', array( |
|
344 | 344 | 'key' => $user_key, |
345 | 345 | 'value' => $this->args['user'] |
346 | - ) ); |
|
346 | + )); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -356,33 +356,33 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function search() { |
358 | 358 | |
359 | - if ( ! isset( $this->args['s'] ) ) { |
|
359 | + if ( ! isset($this->args['s'])) { |
|
360 | 360 | return; |
361 | 361 | } |
362 | 362 | |
363 | - $search = trim( $this->args['s'] ); |
|
363 | + $search = trim($this->args['s']); |
|
364 | 364 | |
365 | - if ( empty( $search ) ) { |
|
365 | + if (empty($search)) { |
|
366 | 366 | return; |
367 | 367 | } |
368 | 368 | |
369 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
370 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
369 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
370 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
371 | 371 | |
372 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
372 | + if ( ! empty($this->args['search_in_notes'])) { |
|
373 | 373 | |
374 | - $notes = give_get_payment_notes( 0, $search ); |
|
374 | + $notes = give_get_payment_notes(0, $search); |
|
375 | 375 | |
376 | - if ( ! empty( $notes ) ) { |
|
376 | + if ( ! empty($notes)) { |
|
377 | 377 | |
378 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
378 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
379 | 379 | |
380 | - $this->__set( 'post__in', $payment_ids ); |
|
380 | + $this->__set('post__in', $payment_ids); |
|
381 | 381 | } |
382 | 382 | |
383 | - $this->__unset( 's' ); |
|
383 | + $this->__unset('s'); |
|
384 | 384 | |
385 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
385 | + } elseif ($is_email || strlen($search) == 32) { |
|
386 | 386 | |
387 | 387 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
388 | 388 | $search_meta = array( |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | 'compare' => 'LIKE' |
392 | 392 | ); |
393 | 393 | |
394 | - $this->__set( 'meta_query', $search_meta ); |
|
395 | - $this->__unset( 's' ); |
|
394 | + $this->__set('meta_query', $search_meta); |
|
395 | + $this->__unset('s'); |
|
396 | 396 | |
397 | - } elseif ( $is_user ) { |
|
397 | + } elseif ($is_user) { |
|
398 | 398 | |
399 | 399 | $search_meta = array( |
400 | 400 | 'key' => '_give_payment_user_id', |
401 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ) |
|
401 | + 'value' => trim(str_replace('user:', '', strtolower($search))) |
|
402 | 402 | ); |
403 | 403 | |
404 | - $this->__set( 'meta_query', $search_meta ); |
|
404 | + $this->__set('meta_query', $search_meta); |
|
405 | 405 | |
406 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
406 | + if (give_get_option('enable_sequential')) { |
|
407 | 407 | |
408 | 408 | $search_meta = array( |
409 | 409 | 'key' => '_give_payment_number', |
@@ -411,19 +411,19 @@ discard block |
||
411 | 411 | 'compare' => 'LIKE' |
412 | 412 | ); |
413 | 413 | |
414 | - $this->__set( 'meta_query', $search_meta ); |
|
414 | + $this->__set('meta_query', $search_meta); |
|
415 | 415 | |
416 | 416 | $this->args['meta_query']['relation'] = 'OR'; |
417 | 417 | |
418 | 418 | } |
419 | 419 | |
420 | - $this->__unset( 's' ); |
|
420 | + $this->__unset('s'); |
|
421 | 421 | |
422 | 422 | } elseif ( |
423 | - give_get_option( 'enable_sequential' ) && |
|
423 | + give_get_option('enable_sequential') && |
|
424 | 424 | ( |
425 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
426 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
425 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
426 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
427 | 427 | ) |
428 | 428 | ) { |
429 | 429 | |
@@ -433,30 +433,30 @@ discard block |
||
433 | 433 | 'compare' => 'LIKE' |
434 | 434 | ); |
435 | 435 | |
436 | - $this->__set( 'meta_query', $search_meta ); |
|
437 | - $this->__unset( 's' ); |
|
436 | + $this->__set('meta_query', $search_meta); |
|
437 | + $this->__unset('s'); |
|
438 | 438 | |
439 | - } elseif ( is_numeric( $search ) ) { |
|
439 | + } elseif (is_numeric($search)) { |
|
440 | 440 | |
441 | - $post = get_post( $search ); |
|
441 | + $post = get_post($search); |
|
442 | 442 | |
443 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
443 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
444 | 444 | |
445 | 445 | $arr = array(); |
446 | 446 | $arr[] = $search; |
447 | - $this->__set( 'post__in', $arr ); |
|
448 | - $this->__unset( 's' ); |
|
447 | + $this->__set('post__in', $arr); |
|
448 | + $this->__unset('s'); |
|
449 | 449 | } |
450 | 450 | |
451 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
451 | + } elseif ('#' == substr($search, 0, 1)) { |
|
452 | 452 | |
453 | - $search = str_replace( '#:', '', $search ); |
|
454 | - $search = str_replace( '#', '', $search ); |
|
455 | - $this->__set( 'give_forms', $search ); |
|
456 | - $this->__unset( 's' ); |
|
453 | + $search = str_replace('#:', '', $search); |
|
454 | + $search = str_replace('#', '', $search); |
|
455 | + $this->__set('give_forms', $search); |
|
456 | + $this->__unset('s'); |
|
457 | 457 | |
458 | 458 | } else { |
459 | - $this->__set( 's', $search ); |
|
459 | + $this->__set('s', $search); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
@@ -471,16 +471,16 @@ discard block |
||
471 | 471 | * @return void |
472 | 472 | */ |
473 | 473 | public function mode() { |
474 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
475 | - $this->__unset( 'mode' ); |
|
474 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
475 | + $this->__unset('mode'); |
|
476 | 476 | |
477 | 477 | return; |
478 | 478 | } |
479 | 479 | |
480 | - $this->__set( 'meta_query', array( |
|
480 | + $this->__set('meta_query', array( |
|
481 | 481 | 'key' => '_give_payment_mode', |
482 | 482 | 'value' => $this->args['mode'] |
483 | - ) ); |
|
483 | + )); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -492,10 +492,10 @@ discard block |
||
492 | 492 | * @return void |
493 | 493 | */ |
494 | 494 | public function children() { |
495 | - if ( empty( $this->args['children'] ) ) { |
|
496 | - $this->__set( 'post_parent', 0 ); |
|
495 | + if (empty($this->args['children'])) { |
|
496 | + $this->__set('post_parent', 0); |
|
497 | 497 | } |
498 | - $this->__unset( 'children' ); |
|
498 | + $this->__unset('children'); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | /** |
@@ -508,25 +508,25 @@ discard block |
||
508 | 508 | */ |
509 | 509 | public function give_forms() { |
510 | 510 | |
511 | - if ( empty( $this->args['give_forms'] ) ) { |
|
511 | + if (empty($this->args['give_forms'])) { |
|
512 | 512 | return; |
513 | 513 | } |
514 | 514 | |
515 | 515 | $compare = '='; |
516 | 516 | |
517 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
517 | + if (is_array($this->args['give_forms'])) { |
|
518 | 518 | $compare = 'IN'; |
519 | 519 | } |
520 | 520 | |
521 | - $this->__set( 'meta_query', array( |
|
521 | + $this->__set('meta_query', array( |
|
522 | 522 | array( |
523 | 523 | 'key' => '_give_payment_form_id', |
524 | 524 | 'value' => $this->args['give_forms'], |
525 | 525 | 'compare' => $compare |
526 | 526 | ) |
527 | - ) ); |
|
527 | + )); |
|
528 | 528 | |
529 | - $this->__unset( 'give_forms' ); |
|
529 | + $this->__unset('give_forms'); |
|
530 | 530 | |
531 | 531 | } |
532 | 532 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * |
38 | 38 | * Display admin bar when active |
39 | 39 | * |
40 | - * @return bool |
|
40 | + * @return false|null |
|
41 | 41 | */ |
42 | 42 | public function give_admin_bar_menu() { |
43 | 43 | global $wp_admin_bar; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __setup_hooks() { |
45 | 45 | // Create the log post type |
46 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
46 | + add_action('init', array($this, 'register_post_type'), 1); |
|
47 | 47 | |
48 | 48 | // Create types taxonomy and default types |
49 | - add_action( 'init', array( $this, 'register_taxonomy' ), 1 ); |
|
49 | + add_action('init', array($this, 'register_taxonomy'), 1); |
|
50 | 50 | |
51 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache') ); |
|
52 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache') ); |
|
53 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache') ); |
|
54 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache') ); |
|
51 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
52 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
53 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
54 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function register_post_type() { |
68 | 68 | /* Logs post type */ |
69 | 69 | $log_args = array( |
70 | - 'labels' => array( 'name' => esc_html__( 'Logs', 'give' ) ), |
|
70 | + 'labels' => array('name' => esc_html__('Logs', 'give')), |
|
71 | 71 | 'public' => false, |
72 | 72 | 'exclude_from_search' => true, |
73 | 73 | 'publicly_queryable' => false, |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | 'query_var' => false, |
76 | 76 | 'rewrite' => false, |
77 | 77 | 'capability_type' => 'post', |
78 | - 'supports' => array( 'title', 'editor' ), |
|
78 | + 'supports' => array('title', 'editor'), |
|
79 | 79 | 'can_export' => true, |
80 | 80 | ); |
81 | 81 | |
82 | - register_post_type( 'give_log', $log_args ); |
|
82 | + register_post_type('give_log', $log_args); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public function register_taxonomy() { |
96 | - register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) ); |
|
96 | + register_taxonomy('give_log_type', 'give_log', array('public' => false)); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'api_request', |
114 | 114 | ); |
115 | 115 | |
116 | - return apply_filters( 'give_log_types', $terms ); |
|
116 | + return apply_filters('give_log_types', $terms); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return bool Whether log type is valid. |
130 | 130 | */ |
131 | - public function valid_type( $type ) { |
|
132 | - return in_array( $type, $this->log_types() ); |
|
131 | + public function valid_type($type) { |
|
132 | + return in_array($type, $this->log_types()); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return int Log ID. |
150 | 150 | */ |
151 | - public function add( $title = '', $message = '', $parent = 0, $type = null ) { |
|
151 | + public function add($title = '', $message = '', $parent = 0, $type = null) { |
|
152 | 152 | $log_data = array( |
153 | 153 | 'post_title' => $title, |
154 | 154 | 'post_content' => $message, |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'log_type' => $type, |
157 | 157 | ); |
158 | 158 | |
159 | - return $this->insert_log( $log_data ); |
|
159 | + return $this->insert_log($log_data); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return array An array of the connected logs. |
175 | 175 | */ |
176 | - public function get_logs( $object_id = 0, $type = null, $paged = null ) { |
|
177 | - return $this->get_connected_logs( array( |
|
176 | + public function get_logs($object_id = 0, $type = null, $paged = null) { |
|
177 | + return $this->get_connected_logs(array( |
|
178 | 178 | 'post_parent' => $object_id, |
179 | 179 | 'paged' => $paged, |
180 | 180 | 'log_type' => $type, |
181 | - ) ); |
|
181 | + )); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return int The ID of the newly created log item. |
194 | 194 | */ |
195 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
195 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
196 | 196 | $defaults = array( |
197 | 197 | 'post_type' => 'give_log', |
198 | 198 | 'post_status' => 'publish', |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | 'log_type' => false, |
202 | 202 | ); |
203 | 203 | |
204 | - $args = wp_parse_args( $log_data, $defaults ); |
|
204 | + $args = wp_parse_args($log_data, $defaults); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Fires before inserting log entry. |
@@ -211,20 +211,20 @@ discard block |
||
211 | 211 | * @param array $log_data Log entry data. |
212 | 212 | * @param array $log_meta Log entry meta. |
213 | 213 | */ |
214 | - do_action( 'give_pre_insert_log', $log_data, $log_meta ); |
|
214 | + do_action('give_pre_insert_log', $log_data, $log_meta); |
|
215 | 215 | |
216 | 216 | // Store the log entry |
217 | - $log_id = wp_insert_post( $args ); |
|
217 | + $log_id = wp_insert_post($args); |
|
218 | 218 | |
219 | 219 | // Set the log type, if any |
220 | - if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) { |
|
221 | - wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false ); |
|
220 | + if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) { |
|
221 | + wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | // Set log meta, if any |
225 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
226 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
227 | - update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
225 | + if ($log_id && ! empty($log_meta)) { |
|
226 | + foreach ((array) $log_meta as $key => $meta) { |
|
227 | + update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @param array $log_data Log entry data. |
238 | 238 | * @param array $log_meta Log entry meta. |
239 | 239 | */ |
240 | - do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta ); |
|
240 | + do_action('give_post_insert_log', $log_id, $log_data, $log_meta); |
|
241 | 241 | |
242 | 242 | return $log_id; |
243 | 243 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return bool|null True if successful, false otherwise. |
255 | 255 | */ |
256 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
256 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Fires before updating log entry. |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param array $log_data Log entry data. |
264 | 264 | * @param array $log_meta Log entry meta. |
265 | 265 | */ |
266 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
266 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
267 | 267 | |
268 | 268 | $defaults = array( |
269 | 269 | 'post_type' => 'give_log', |
@@ -271,15 +271,15 @@ discard block |
||
271 | 271 | 'post_parent' => 0, |
272 | 272 | ); |
273 | 273 | |
274 | - $args = wp_parse_args( $log_data, $defaults ); |
|
274 | + $args = wp_parse_args($log_data, $defaults); |
|
275 | 275 | |
276 | 276 | // Store the log entry |
277 | - $log_id = wp_update_post( $args ); |
|
277 | + $log_id = wp_update_post($args); |
|
278 | 278 | |
279 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
280 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
281 | - if ( ! empty( $meta ) ) { |
|
282 | - update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
279 | + if ($log_id && ! empty($log_meta)) { |
|
280 | + foreach ((array) $log_meta as $key => $meta) { |
|
281 | + if ( ! empty($meta)) { |
|
282 | + update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param array $log_data Log entry data. |
294 | 294 | * @param array $log_meta Log entry meta. |
295 | 295 | */ |
296 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
296 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -308,19 +308,19 @@ discard block |
||
308 | 308 | * |
309 | 309 | * @return array|false Array if logs were found, false otherwise. |
310 | 310 | */ |
311 | - public function get_connected_logs( $args = array() ) { |
|
311 | + public function get_connected_logs($args = array()) { |
|
312 | 312 | |
313 | 313 | $defaults = array( |
314 | 314 | 'post_type' => 'give_log', |
315 | 315 | 'posts_per_page' => 20, |
316 | 316 | 'post_status' => 'publish', |
317 | - 'paged' => get_query_var( 'paged' ), |
|
317 | + 'paged' => get_query_var('paged'), |
|
318 | 318 | 'log_type' => false, |
319 | 319 | ); |
320 | 320 | |
321 | - $query_args = wp_parse_args( $args, $defaults ); |
|
321 | + $query_args = wp_parse_args($args, $defaults); |
|
322 | 322 | |
323 | - if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) { |
|
323 | + if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) { |
|
324 | 324 | $query_args['tax_query'] = array( |
325 | 325 | array( |
326 | 326 | 'taxonomy' => 'give_log_type', |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | ); |
331 | 331 | } |
332 | 332 | |
333 | - $logs = get_posts( $query_args ); |
|
333 | + $logs = get_posts($query_args); |
|
334 | 334 | |
335 | - if ( $logs ) { |
|
335 | + if ($logs) { |
|
336 | 336 | return $logs; |
337 | 337 | } |
338 | 338 | |
@@ -355,17 +355,17 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return int Log count. |
357 | 357 | */ |
358 | - public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) { |
|
358 | + public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) { |
|
359 | 359 | |
360 | 360 | $query_args = array( |
361 | 361 | 'post_parent' => $object_id, |
362 | 362 | 'post_type' => 'give_log', |
363 | - 'posts_per_page' => - 1, |
|
363 | + 'posts_per_page' => -1, |
|
364 | 364 | 'post_status' => 'publish', |
365 | 365 | 'fields' => 'ids', |
366 | 366 | ); |
367 | 367 | |
368 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
368 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
369 | 369 | $query_args['tax_query'] = array( |
370 | 370 | array( |
371 | 371 | 'taxonomy' => 'give_log_type', |
@@ -375,25 +375,25 @@ discard block |
||
375 | 375 | ); |
376 | 376 | } |
377 | 377 | |
378 | - if ( ! empty( $meta_query ) ) { |
|
378 | + if ( ! empty($meta_query)) { |
|
379 | 379 | $query_args['meta_query'] = $meta_query; |
380 | 380 | } |
381 | 381 | |
382 | - if ( ! empty( $date_query ) ) { |
|
382 | + if ( ! empty($date_query)) { |
|
383 | 383 | $query_args['date_query'] = $date_query; |
384 | 384 | } |
385 | 385 | |
386 | 386 | |
387 | 387 | // Get cache key for current query. |
388 | - $cache_key = give_get_cache_key( 'get_log_count', $query_args ); |
|
388 | + $cache_key = give_get_cache_key('get_log_count', $query_args); |
|
389 | 389 | |
390 | 390 | // check if cache already exist or not. |
391 | - if( ! ( $logs_count = get_option( $cache_key ) ) ) { |
|
392 | - $logs = new WP_Query( $query_args ); |
|
391 | + if ( ! ($logs_count = get_option($cache_key))) { |
|
392 | + $logs = new WP_Query($query_args); |
|
393 | 393 | $logs_count = (int) $logs->post_count; |
394 | 394 | |
395 | 395 | // Cache results. |
396 | - add_option( $cache_key, $logs_count, '', 'no' ); |
|
396 | + add_option($cache_key, $logs_count, '', 'no'); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | return $logs_count; |
@@ -413,16 +413,16 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @return void |
415 | 415 | */ |
416 | - public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) { |
|
416 | + public function delete_logs($object_id = 0, $type = null, $meta_query = null) { |
|
417 | 417 | $query_args = array( |
418 | 418 | 'post_parent' => $object_id, |
419 | 419 | 'post_type' => 'give_log', |
420 | - 'posts_per_page' => - 1, |
|
420 | + 'posts_per_page' => -1, |
|
421 | 421 | 'post_status' => 'publish', |
422 | 422 | 'fields' => 'ids', |
423 | 423 | ); |
424 | 424 | |
425 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
425 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
426 | 426 | $query_args['tax_query'] = array( |
427 | 427 | array( |
428 | 428 | 'taxonomy' => 'give_log_type', |
@@ -432,15 +432,15 @@ discard block |
||
432 | 432 | ); |
433 | 433 | } |
434 | 434 | |
435 | - if ( ! empty( $meta_query ) ) { |
|
435 | + if ( ! empty($meta_query)) { |
|
436 | 436 | $query_args['meta_query'] = $meta_query; |
437 | 437 | } |
438 | 438 | |
439 | - $logs = get_posts( $query_args ); |
|
439 | + $logs = get_posts($query_args); |
|
440 | 440 | |
441 | - if ( $logs ) { |
|
442 | - foreach ( $logs as $log ) { |
|
443 | - wp_delete_post( $log, true ); |
|
441 | + if ($logs) { |
|
442 | + foreach ($logs as $log) { |
|
443 | + wp_delete_post($log, true); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | } |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @param int $post_id |
455 | 455 | */ |
456 | - public function background_process_delete_cache( $post_id ) { |
|
457 | - wp_schedule_single_event( time(), 'give_delete_log_cache' ); |
|
456 | + public function background_process_delete_cache($post_id) { |
|
457 | + wp_schedule_single_event(time(), 'give_delete_log_cache'); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -476,14 +476,14 @@ discard block |
||
476 | 476 | ); |
477 | 477 | |
478 | 478 | // Bailout. |
479 | - if( empty( $cache_option_names ) ) { |
|
479 | + if (empty($cache_option_names)) { |
|
480 | 480 | return false; |
481 | 481 | } |
482 | 482 | |
483 | 483 | |
484 | 484 | // Delete log cache. |
485 | - foreach ( $cache_option_names as $option_name ) { |
|
486 | - delete_option( $option_name['option_name'] ); |
|
485 | + foreach ($cache_option_names as $option_name) { |
|
486 | + delete_option($option_name['option_name']); |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | } |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @return int ID of the new log entry. |
508 | 508 | */ |
509 | -function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) { |
|
509 | +function give_record_log($title = '', $message = '', $parent = 0, $type = null) { |
|
510 | 510 | /* @var Give_Logging $give_logs */ |
511 | 511 | global $give_logs; |
512 | - $log = $give_logs->add( $title, $message, $parent, $type ); |
|
512 | + $log = $give_logs->add($title, $message, $parent, $type); |
|
513 | 513 | |
514 | 514 | return $log; |
515 | 515 | } |