@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param $url |
74 | 74 | * |
75 | - * @return mixed |
|
75 | + * @return string |
|
76 | 76 | */ |
77 | 77 | public function give_update_cmb_meta_box_url( $url ) { |
78 | 78 | // Path to Give's CMB |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | * @since 1.3.5 |
936 | 936 | * |
937 | 937 | * @param $array |
938 | - * @param $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
938 | + * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
939 | 939 | * @param $insert |array a valid array of options to insert |
940 | 940 | * |
941 | 941 | * @return array |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @since 1.0 |
975 | 975 | * |
976 | 976 | * @param array $field_arr |
977 | - * @param array $saved_values |
|
977 | + * @param string|boolean $saved_values |
|
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * @since 1.0 |
1010 | 1010 | * |
1011 | 1011 | * @param array $field_arr |
1012 | - * @param array $saved_value |
|
1012 | + * @param string|boolean $saved_value |
|
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @params $string text |
1164 | 1164 | * @params $filter array |
1165 | 1165 | * |
1166 | - * @return text $string |
|
1166 | + * @return string $string |
|
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ){ |
1169 | 1169 |
@@ -1167,12 +1167,12 @@ |
||
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ){ |
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1172 | - } |
|
1170 | + foreach( $filters as $filter_item ){ |
|
1171 | + $string = str_replace( $filter_item, ' ', $string ); |
|
1172 | + } |
|
1173 | 1173 | |
1174 | - // Return updated string after converting it to title case |
|
1175 | - return ucwords( $string ); |
|
1174 | + // Return updated string after converting it to title case |
|
1175 | + return ucwords( $string ); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | |
45 | 45 | // Custom CMB2 Settings Fields |
46 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
47 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
48 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
49 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
46 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
47 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
48 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
49 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
50 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
51 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
52 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
53 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 1.0 |
61 | 61 | */ |
62 | 62 | public function init() { |
63 | - register_setting( $this->key, $this->key ); |
|
63 | + register_setting($this->key, $this->key); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function give_update_cmb_meta_box_url( $url ) { |
|
77 | + public function give_update_cmb_meta_box_url($url) { |
|
78 | 78 | // Path to Give's CMB |
79 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
79 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function give_get_settings_tabs() { |
90 | 90 | |
91 | - $settings = $this->give_settings( null ); |
|
91 | + $settings = $this->give_settings(null); |
|
92 | 92 | |
93 | 93 | $tabs = array(); |
94 | - $tabs['general'] = __( 'General', 'give' ); |
|
95 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
96 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
97 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
94 | + $tabs['general'] = __('General', 'give'); |
|
95 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
96 | + $tabs['display'] = __('Display Options', 'give'); |
|
97 | + $tabs['emails'] = __('Emails', 'give'); |
|
98 | 98 | |
99 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
100 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
99 | + if ( ! empty($settings['addons']['fields'])) { |
|
100 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
104 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
103 | + if ( ! empty($settings['licenses']['fields'])) { |
|
104 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
108 | - $tabs['api'] = __( 'API', 'give' ); |
|
109 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
107 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
108 | + $tabs['api'] = __('API', 'give'); |
|
109 | + $tabs['system_info'] = __('System Info', 'give'); |
|
110 | 110 | |
111 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
111 | + return apply_filters('give_settings_tabs', $tabs); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function admin_page_display() { |
121 | 121 | |
122 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
122 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
123 | 123 | |
124 | 124 | ?> |
125 | 125 | |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | <h2 class="nav-tab-wrapper"> |
131 | 131 | <?php |
132 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
132 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
133 | 133 | |
134 | - $tab_url = esc_url( add_query_arg( array( |
|
134 | + $tab_url = esc_url(add_query_arg(array( |
|
135 | 135 | 'settings-updated' => false, |
136 | 136 | 'tab' => $tab_id, |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
140 | 140 | |
141 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
141 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | ?> |
145 | 145 | </h2> |
146 | 146 | |
147 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
147 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
148 | 148 | |
149 | 149 | </div><!-- .wrap --> |
150 | 150 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
169 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
170 | 170 | |
171 | 171 | // only modify the give settings form |
172 | - if ( 'give_settings' == $object_id ) { |
|
172 | + if ('give_settings' == $object_id) { |
|
173 | 173 | |
174 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
174 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - public function give_settings( $active_tab ) { |
|
191 | + public function give_settings($active_tab) { |
|
192 | 192 | |
193 | 193 | $give_settings = array( |
194 | 194 | /** |
@@ -196,99 +196,99 @@ discard block |
||
196 | 196 | */ |
197 | 197 | 'general' => array( |
198 | 198 | 'id' => 'general_settings', |
199 | - 'give_title' => __( 'General Settings', 'give' ), |
|
200 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
201 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
199 | + 'give_title' => __('General Settings', 'give'), |
|
200 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
201 | + 'fields' => apply_filters('give_settings_general', array( |
|
202 | 202 | array( |
203 | - 'name' => __( 'General Settings', 'give' ), |
|
203 | + 'name' => __('General Settings', 'give'), |
|
204 | 204 | 'desc' => '', |
205 | 205 | 'type' => 'give_title', |
206 | 206 | 'id' => 'give_title_general_settings_1', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Success Page', 'give' ), |
|
209 | + 'name' => __('Success Page', 'give'), |
|
210 | 210 | /* translators: %s: [give_receipt] */ |
211 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
211 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
212 | 212 | 'id' => 'success_page', |
213 | 213 | 'type' => 'select', |
214 | - 'options' => give_cmb2_get_post_options( array( |
|
214 | + 'options' => give_cmb2_get_post_options(array( |
|
215 | 215 | 'post_type' => 'page', |
216 | - 'numberposts' => - 1, |
|
217 | - ) ), |
|
216 | + 'numberposts' => -1, |
|
217 | + )), |
|
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
221 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
220 | + 'name' => __('Failed Donation Page', 'give'), |
|
221 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
222 | 222 | 'id' => 'failure_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1, |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1, |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Donation History Page', 'give' ), |
|
230 | + 'name' => __('Donation History Page', 'give'), |
|
231 | 231 | /* translators: %s: [donation_history] */ |
232 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
232 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
233 | 233 | 'id' => 'history_page', |
234 | 234 | 'type' => 'select', |
235 | - 'options' => give_cmb2_get_post_options( array( |
|
235 | + 'options' => give_cmb2_get_post_options(array( |
|
236 | 236 | 'post_type' => 'page', |
237 | - 'numberposts' => - 1, |
|
238 | - ) ), |
|
237 | + 'numberposts' => -1, |
|
238 | + )), |
|
239 | 239 | ), |
240 | 240 | array( |
241 | - 'name' => __( 'Base Country', 'give' ), |
|
242 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
241 | + 'name' => __('Base Country', 'give'), |
|
242 | + 'desc' => __('The country your site operates from.', 'give'), |
|
243 | 243 | 'id' => 'base_country', |
244 | 244 | 'type' => 'select', |
245 | 245 | 'options' => give_get_country_list(), |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => __( 'Currency Settings', 'give' ), |
|
248 | + 'name' => __('Currency Settings', 'give'), |
|
249 | 249 | 'desc' => '', |
250 | 250 | 'type' => 'give_title', |
251 | 251 | 'id' => 'give_title_general_settings_2', |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => __( 'Currency', 'give' ), |
|
255 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
254 | + 'name' => __('Currency', 'give'), |
|
255 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
256 | 256 | 'id' => 'currency', |
257 | 257 | 'type' => 'select', |
258 | 258 | 'options' => give_get_currencies(), |
259 | 259 | 'default' => 'USD', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Currency Position', 'give' ), |
|
263 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
262 | + 'name' => __('Currency Position', 'give'), |
|
263 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
264 | 264 | 'id' => 'currency_position', |
265 | 265 | 'type' => 'select', |
266 | 266 | 'options' => array( |
267 | 267 | /* translators: %s: currency symbol */ |
268 | - 'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
268 | + 'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'after' => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'after' => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | ), |
272 | 272 | 'default' => 'before', |
273 | 273 | ), |
274 | 274 | array( |
275 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
276 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
275 | + 'name' => __('Thousands Separator', 'give'), |
|
276 | + 'desc' => __('The symbol (usually , or .) to separate thousands.', 'give'), |
|
277 | 277 | 'id' => 'thousands_separator', |
278 | 278 | 'type' => 'text_small', |
279 | 279 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
280 | 280 | 'default' => ',', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
284 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
283 | + 'name' => __('Decimal Separator', 'give'), |
|
284 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
285 | 285 | 'id' => 'decimal_separator', |
286 | 286 | 'type' => 'text_small', |
287 | 287 | 'default' => '.', |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
291 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
290 | + 'name' => __('Number of Decimals', 'give'), |
|
291 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
292 | 292 | 'id' => 'number_decimals', |
293 | 293 | 'type' => 'text_small', |
294 | 294 | 'default' => 2, |
@@ -302,83 +302,83 @@ discard block |
||
302 | 302 | */ |
303 | 303 | 'gateways' => array( |
304 | 304 | 'id' => 'payment_gateways', |
305 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
306 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
307 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
305 | + 'give_title' => __('Payment Gateways', 'give'), |
|
306 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
307 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
308 | 308 | array( |
309 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
309 | + 'name' => __('Gateways Settings', 'give'), |
|
310 | 310 | 'desc' => '', |
311 | 311 | 'id' => 'give_title_gateway_settings_1', |
312 | 312 | 'type' => 'give_title', |
313 | 313 | ), |
314 | 314 | array( |
315 | - 'name' => __( 'Test Mode', 'give' ), |
|
316 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
315 | + 'name' => __('Test Mode', 'give'), |
|
316 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
317 | 317 | 'id' => 'test_mode', |
318 | 318 | 'type' => 'checkbox', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
322 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
321 | + 'name' => __('Enabled Gateways', 'give'), |
|
322 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
323 | 323 | 'id' => 'gateways', |
324 | 324 | 'type' => 'enabled_gateways', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Default Gateway', 'give' ), |
|
328 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
327 | + 'name' => __('Default Gateway', 'give'), |
|
328 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
329 | 329 | 'id' => 'default_gateway', |
330 | 330 | 'type' => 'default_gateway', |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
333 | + 'name' => __('PayPal Standard', 'give'), |
|
334 | 334 | 'desc' => '', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_2', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'PayPal Email', 'give' ), |
|
340 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
339 | + 'name' => __('PayPal Email', 'give'), |
|
340 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
341 | 341 | 'id' => 'paypal_email', |
342 | 342 | 'type' => 'text_email', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
346 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
345 | + 'name' => __('PayPal Page Style', 'give'), |
|
346 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
347 | 347 | 'id' => 'paypal_page_style', |
348 | 348 | 'type' => 'text', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
352 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
351 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
352 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
353 | 353 | 'id' => 'paypal_button_type', |
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'donation' => __( 'Donation', 'give' ), |
|
357 | - 'standard' => __( 'Standard Transaction', 'give' ), |
|
356 | + 'donation' => __('Donation', 'give'), |
|
357 | + 'standard' => __('Standard Transaction', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
363 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
362 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
363 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
364 | 364 | 'id' => 'disable_paypal_verification', |
365 | 365 | 'type' => 'checkbox', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Offline Donations', 'give' ), |
|
368 | + 'name' => __('Offline Donations', 'give'), |
|
369 | 369 | 'desc' => '', |
370 | 370 | 'type' => 'give_title', |
371 | 371 | 'id' => 'give_title_gateway_settings_3', |
372 | 372 | ), |
373 | 373 | array( |
374 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
375 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
374 | + 'name' => __('Collect Billing Details', 'give'), |
|
375 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
376 | 376 | 'id' => 'give_offline_donation_enable_billing_fields', |
377 | 377 | 'type' => 'checkbox', |
378 | 378 | ), |
379 | 379 | array( |
380 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
381 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
380 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
381 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
382 | 382 | 'id' => 'global_offline_donation_content', |
383 | 383 | 'default' => give_get_default_offline_donation_content(), |
384 | 384 | 'type' => 'wysiwyg', |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
391 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
390 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
391 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
392 | 392 | 'id' => 'offline_donation_subject', |
393 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
393 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
394 | 394 | 'type' => 'text', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
398 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
397 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
398 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
399 | 399 | 'id' => 'global_offline_donation_email', |
400 | 400 | 'default' => give_get_default_offline_donation_email_content(), |
401 | 401 | 'type' => 'wysiwyg', |
@@ -409,104 +409,104 @@ discard block |
||
409 | 409 | /** Display Settings */ |
410 | 410 | 'display' => array( |
411 | 411 | 'id' => 'display_settings', |
412 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
413 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
414 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
412 | + 'give_title' => __('Display Settings', 'give'), |
|
413 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
414 | + 'fields' => apply_filters('give_settings_display', array( |
|
415 | 415 | array( |
416 | - 'name' => __( 'Display Settings', 'give' ), |
|
416 | + 'name' => __('Display Settings', 'give'), |
|
417 | 417 | 'desc' => '', |
418 | 418 | 'id' => 'give_title_display_settings_1', |
419 | 419 | 'type' => 'give_title', |
420 | 420 | ), |
421 | 421 | array( |
422 | - 'name' => __( 'Disable CSS', 'give' ), |
|
423 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
422 | + 'name' => __('Disable CSS', 'give'), |
|
423 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
424 | 424 | 'id' => 'disable_css', |
425 | 425 | 'type' => 'checkbox', |
426 | 426 | ), |
427 | 427 | array( |
428 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
428 | + 'name' => __('Enable Floating Labels', 'give'), |
|
429 | 429 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
430 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
430 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
431 | 431 | 'a' => array( |
432 | 432 | 'href' => array(), |
433 | 433 | 'target' => array(), |
434 | 434 | ), |
435 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
435 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
436 | 436 | 'id' => 'floatlabels', |
437 | 437 | 'type' => 'checkbox', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
440 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
441 | 441 | /* translators: %s: about page URL */ |
442 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
442 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
443 | 443 | 'a' => array( |
444 | 444 | 'href' => array(), |
445 | 445 | 'target' => array(), |
446 | 446 | ), |
447 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox', |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => __( 'Post Types', 'give' ), |
|
452 | + 'name' => __('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title', |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => __('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox', |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => __('Disable Form Archives', 'give'), |
|
465 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox', |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
471 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
470 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
471 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox', |
474 | 474 | ), |
475 | 475 | array( |
476 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
477 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
476 | + 'name' => __('Featured Image Size', 'give'), |
|
477 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
478 | 478 | 'id' => 'featured_image_size', |
479 | 479 | 'type' => 'select', |
480 | 480 | 'default' => 'large', |
481 | 481 | 'options' => give_get_featured_image_sizes(), |
482 | 482 | ), |
483 | 483 | array( |
484 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
485 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
484 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
485 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
486 | 486 | 'id' => 'disable_form_featured_img', |
487 | 487 | 'type' => 'checkbox', |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
491 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
490 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
491 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_sidebar', |
493 | 493 | 'type' => 'checkbox', |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => __( 'Taxonomies', 'give' ), |
|
496 | + 'name' => __('Taxonomies', 'give'), |
|
497 | 497 | 'desc' => '', |
498 | 498 | 'id' => 'give_title_display_settings_3', |
499 | 499 | 'type' => 'give_title', |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
503 | - 'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
502 | + 'name' => __('Enable Form Categories', 'give'), |
|
503 | + 'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
504 | 504 | 'id' => 'categories', |
505 | 505 | 'type' => 'checkbox', |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
509 | - 'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
508 | + 'name' => __('Enable Form Tags', 'give'), |
|
509 | + 'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
510 | 510 | 'id' => 'tags', |
511 | 511 | 'type' => 'checkbox', |
512 | 512 | ), |
@@ -519,101 +519,101 @@ discard block |
||
519 | 519 | */ |
520 | 520 | 'emails' => array( |
521 | 521 | 'id' => 'email_settings', |
522 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
523 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
524 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
522 | + 'give_title' => __('Email Settings', 'give'), |
|
523 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
524 | + 'fields' => apply_filters('give_settings_emails', array( |
|
525 | 525 | array( |
526 | - 'name' => __( 'Email Settings', 'give' ), |
|
526 | + 'name' => __('Email Settings', 'give'), |
|
527 | 527 | 'desc' => '', |
528 | 528 | 'id' => 'give_title_email_settings_1', |
529 | 529 | 'type' => 'give_title', |
530 | 530 | ), |
531 | 531 | array( |
532 | 532 | 'id' => 'email_template', |
533 | - 'name' => __( 'Email Template', 'give' ), |
|
534 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
533 | + 'name' => __('Email Template', 'give'), |
|
534 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
535 | 535 | 'type' => 'select', |
536 | 536 | 'options' => give_get_email_templates(), |
537 | 537 | ), |
538 | 538 | array( |
539 | 539 | 'id' => 'email_logo', |
540 | - 'name' => __( 'Logo', 'give' ), |
|
541 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
540 | + 'name' => __('Logo', 'give'), |
|
541 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
542 | 542 | 'type' => 'file', |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'from_name', |
546 | - 'name' => __( 'From Name', 'give' ), |
|
547 | - 'desc' => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
548 | - 'default' => get_bloginfo( 'name' ), |
|
546 | + 'name' => __('From Name', 'give'), |
|
547 | + 'desc' => __('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
548 | + 'default' => get_bloginfo('name'), |
|
549 | 549 | 'type' => 'text', |
550 | 550 | ), |
551 | 551 | array( |
552 | 552 | 'id' => 'from_email', |
553 | - 'name' => __( 'From Email', 'give' ), |
|
554 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
555 | - 'default' => get_bloginfo( 'admin_email' ), |
|
553 | + 'name' => __('From Email', 'give'), |
|
554 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
555 | + 'default' => get_bloginfo('admin_email'), |
|
556 | 556 | 'type' => 'text', |
557 | 557 | ), |
558 | 558 | array( |
559 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
559 | + 'name' => __('Donation Receipt', 'give'), |
|
560 | 560 | 'desc' => '', |
561 | 561 | 'id' => 'give_title_email_settings_2', |
562 | 562 | 'type' => 'give_title', |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | 'id' => 'donation_subject', |
566 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
567 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
568 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
566 | + 'name' => __('Donation Email Subject', 'give'), |
|
567 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
568 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
569 | 569 | 'type' => 'text', |
570 | 570 | ), |
571 | 571 | array( |
572 | 572 | 'id' => 'donation_receipt', |
573 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
573 | + 'name' => __('Donation Receipt', 'give'), |
|
574 | 574 | 'desc' => sprintf( |
575 | 575 | /* translators: %s: emails tags list */ |
576 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
577 | - '<br/>' . give_get_emails_tags_list() |
|
576 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
577 | + '<br/>'.give_get_emails_tags_list() |
|
578 | 578 | ), |
579 | 579 | 'type' => 'wysiwyg', |
580 | 580 | 'default' => give_get_default_donation_receipt_email(), |
581 | 581 | ), |
582 | 582 | array( |
583 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
583 | + 'name' => __('New Donation Notification', 'give'), |
|
584 | 584 | 'desc' => '', |
585 | 585 | 'id' => 'give_title_email_settings_3', |
586 | 586 | 'type' => 'give_title', |
587 | 587 | ), |
588 | 588 | array( |
589 | 589 | 'id' => 'donation_notification_subject', |
590 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
591 | - 'desc' => __( 'Enter the subject line for the donation notification email.', 'give' ), |
|
590 | + 'name' => __('Donation Notification Subject', 'give'), |
|
591 | + 'desc' => __('Enter the subject line for the donation notification email.', 'give'), |
|
592 | 592 | 'type' => 'text', |
593 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
593 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'id' => 'donation_notification', |
597 | - 'name' => __( 'Donation Notification', 'give' ), |
|
597 | + 'name' => __('Donation Notification', 'give'), |
|
598 | 598 | 'desc' => sprintf( |
599 | 599 | /* translators: %s: emails tags list */ |
600 | - __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
601 | - '<br/>' . give_get_emails_tags_list() |
|
600 | + __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
601 | + '<br/>'.give_get_emails_tags_list() |
|
602 | 602 | ), |
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email(), |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
609 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
608 | + 'name' => __('Donation Notification Emails', 'give'), |
|
609 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ), |
|
611 | + 'default' => get_bloginfo('admin_email'), |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox', |
618 | 618 | ), |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ), |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => __('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ), |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => __('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => __( 'Access Control', 'give' ), |
|
645 | + 'name' => __('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title', |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
652 | + 'name' => __('Session Lifetime', 'give'), |
|
653 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => __( '24 Hours', 'give' ), |
|
657 | - '172800' => __( '48 Hours', 'give' ), |
|
658 | - '259200' => __( '72 Hours', 'give' ), |
|
659 | - '604800' => __( '1 Week', 'give' ), |
|
656 | + '86400' => __('24 Hours', 'give'), |
|
657 | + '172800' => __('48 Hours', 'give'), |
|
658 | + '259200' => __('72 Hours', 'give'), |
|
659 | + '604800' => __('1 Week', 'give'), |
|
660 | 660 | ), |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => __( 'Email Access', 'give' ), |
|
664 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => __('Email Access', 'give'), |
|
664 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text', |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text', |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => __( 'Data Control', 'give' ), |
|
684 | + 'name' => __('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title', |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
690 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox', |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => __( 'Filter Control', 'give' ), |
|
696 | + 'name' => __('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title', |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox', |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => __( 'Script Loading', 'give' ), |
|
710 | + 'name' => __('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title', |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox', |
720 | 720 | ), |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => __( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
727 | + 'give_title' => __('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => __( 'API', 'give' ), |
|
733 | + 'name' => __('API', 'give'), |
|
734 | 734 | 'type' => 'api', |
735 | 735 | ), |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => __( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => __('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system-info-textarea', |
747 | - 'name' => __( 'System Info', 'give' ), |
|
748 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => __('System Info', 'give'), |
|
748 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info', |
750 | 750 | ), |
751 | 751 | ) |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | ), |
754 | 754 | ); |
755 | 755 | |
756 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
756 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
757 | 757 | |
758 | 758 | // Return all settings array if no active tab |
759 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
759 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
760 | 760 | return $give_settings; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Add other tabs and settings fields as needed |
764 | - return $give_settings[ $active_tab ]; |
|
764 | + return $give_settings[$active_tab]; |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | */ |
771 | 771 | public function settings_notices() { |
772 | 772 | |
773 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
773 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
774 | 774 | return; |
775 | 775 | } |
776 | 776 | |
777 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
777 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | * @return mixed Field value or exception is thrown. |
790 | 790 | * @throws Exception Throws an exception if the field is invalid. |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | 798 | |
799 | - throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) ); |
|
799 | + throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return mixed Option value |
817 | 817 | */ |
818 | -function give_get_option( $key = '', $default = false ) { |
|
818 | +function give_get_option($key = '', $default = false) { |
|
819 | 819 | $give_options = give_get_settings(); |
820 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
821 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
820 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
821 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
822 | 822 | |
823 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
823 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -838,33 +838,33 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @return boolean True if updated, false if not. |
840 | 840 | */ |
841 | -function give_update_option( $key = '', $value = false ) { |
|
841 | +function give_update_option($key = '', $value = false) { |
|
842 | 842 | |
843 | 843 | // If no key, exit |
844 | - if ( empty( $key ) ) { |
|
844 | + if (empty($key)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
848 | - if ( empty( $value ) ) { |
|
849 | - $remove_option = give_delete_option( $key ); |
|
848 | + if (empty($value)) { |
|
849 | + $remove_option = give_delete_option($key); |
|
850 | 850 | |
851 | 851 | return $remove_option; |
852 | 852 | } |
853 | 853 | |
854 | 854 | // First let's grab the current settings |
855 | - $options = get_option( 'give_settings' ); |
|
855 | + $options = get_option('give_settings'); |
|
856 | 856 | |
857 | 857 | // Let's let devs alter that value coming in |
858 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
858 | + $value = apply_filters('give_update_option', $value, $key); |
|
859 | 859 | |
860 | 860 | // Next let's try to update the value |
861 | - $options[ $key ] = $value; |
|
862 | - $did_update = update_option( 'give_settings', $options ); |
|
861 | + $options[$key] = $value; |
|
862 | + $did_update = update_option('give_settings', $options); |
|
863 | 863 | |
864 | 864 | // If it updated, let's update the global variable |
865 | - if ( $did_update ) { |
|
865 | + if ($did_update) { |
|
866 | 866 | global $give_options; |
867 | - $give_options[ $key ] = $value; |
|
867 | + $give_options[$key] = $value; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $did_update; |
@@ -883,25 +883,25 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
898 | - unset( $options[ $key ] ); |
|
897 | + if (isset($options[$key])) { |
|
898 | + unset($options[$key]); |
|
899 | 899 | } |
900 | 900 | |
901 | - $did_update = update_option( 'give_settings', $options ); |
|
901 | + $did_update = update_option('give_settings', $options); |
|
902 | 902 | |
903 | 903 | // If it updated, let's update the global variable |
904 | - if ( $did_update ) { |
|
904 | + if ($did_update) { |
|
905 | 905 | global $give_options; |
906 | 906 | $give_options = $options; |
907 | 907 | } |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | */ |
921 | 921 | function give_get_settings() { |
922 | 922 | |
923 | - $settings = get_option( 'give_settings' ); |
|
923 | + $settings = get_option('give_settings'); |
|
924 | 924 | |
925 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
925 | + return (array) apply_filters('give_get_settings', $settings); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -940,25 +940,25 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return array |
942 | 942 | */ |
943 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
944 | - if ( is_int( $position ) ) { |
|
945 | - array_splice( $array, $position, 0, $insert ); |
|
943 | +function give_settings_array_insert($array, $position, $insert) { |
|
944 | + if (is_int($position)) { |
|
945 | + array_splice($array, $position, 0, $insert); |
|
946 | 946 | } else { |
947 | 947 | |
948 | - foreach ( $array as $index => $subarray ) { |
|
949 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
948 | + foreach ($array as $index => $subarray) { |
|
949 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
950 | 950 | $pos = $index; |
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | - if ( ! isset( $pos ) ) { |
|
954 | + if ( ! isset($pos)) { |
|
955 | 955 | return $array; |
956 | 956 | } |
957 | 957 | |
958 | 958 | $array = array_merge( |
959 | - array_slice( $array, 0, $pos ), |
|
959 | + array_slice($array, 0, $pos), |
|
960 | 960 | $insert, |
961 | - array_slice( $array, $pos ) |
|
961 | + array_slice($array, $pos) |
|
962 | 962 | ); |
963 | 963 | } |
964 | 964 | |
@@ -978,23 +978,23 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
981 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
982 | 982 | |
983 | 983 | $id = $field_arr['id']; |
984 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
984 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
985 | 985 | |
986 | 986 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
987 | 987 | |
988 | - foreach ( $gateways as $key => $option ) : |
|
988 | + foreach ($gateways as $key => $option) : |
|
989 | 989 | |
990 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
990 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
991 | 991 | $enabled = '1'; |
992 | 992 | } else { |
993 | 993 | $enabled = null; |
994 | 994 | } |
995 | 995 | |
996 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
997 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
996 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
997 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
998 | 998 | |
999 | 999 | endforeach; |
1000 | 1000 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
1016 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1016 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1017 | 1017 | $id = $field_arr['id']; |
1018 | 1018 | $gateways = give_get_enabled_payment_gateways(); |
1019 | - $saved_value = give_get_default_gateway( null ); |
|
1019 | + $saved_value = give_get_default_gateway(null); |
|
1020 | 1020 | |
1021 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1021 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1022 | 1022 | |
1023 | - foreach ( $gateways as $key => $option ) : |
|
1024 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1025 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1023 | + foreach ($gateways as $key => $option) : |
|
1024 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1025 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1026 | 1026 | endforeach; |
1027 | 1027 | |
1028 | 1028 | echo '</select>'; |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return void |
1042 | 1042 | */ |
1043 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1043 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1044 | 1044 | |
1045 | 1045 | $id = $field_type_object->field->args['id']; |
1046 | 1046 | $title = $field_type_object->field->args['name']; |
1047 | 1047 | $field_description = $field_type_object->field->args['desc']; |
1048 | 1048 | |
1049 | - echo '<hr>' . $field_description; |
|
1049 | + echo '<hr>'.$field_description; |
|
1050 | 1050 | |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return void |
1063 | 1063 | */ |
1064 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1064 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1065 | 1065 | |
1066 | 1066 | $id = $field_type_object->field->args['id']; |
1067 | 1067 | $title = $field_type_object->field->args['name']; |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1081 | 1081 | * @return array An array of options that matches the CMB2 options array |
1082 | 1082 | */ |
1083 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1083 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1084 | 1084 | |
1085 | - $post_options = array( '' => '' ); // Blank option |
|
1085 | + $post_options = array('' => ''); // Blank option |
|
1086 | 1086 | |
1087 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1087 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1088 | 1088 | return $post_options; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - $args = wp_parse_args( $query_args, array( |
|
1091 | + $args = wp_parse_args($query_args, array( |
|
1092 | 1092 | 'post_type' => 'page', |
1093 | 1093 | 'numberposts' => 10, |
1094 | - ) ); |
|
1094 | + )); |
|
1095 | 1095 | |
1096 | - $posts = get_posts( $args ); |
|
1096 | + $posts = get_posts($args); |
|
1097 | 1097 | |
1098 | - if ( $posts ) { |
|
1099 | - foreach ( $posts as $post ) { |
|
1098 | + if ($posts) { |
|
1099 | + foreach ($posts as $post) { |
|
1100 | 1100 | |
1101 | - $post_options[ $post->ID ] = $post->post_title; |
|
1101 | + $post_options[$post->ID] = $post->post_title; |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | } |
@@ -1123,33 +1123,33 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $sizes = array(); |
1125 | 1125 | $get_sizes = get_intermediate_image_sizes(); |
1126 | - $core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1126 | + $core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // This will help us to filter special characters from a string |
1130 | - $filter_slug_items = array( '_', '-' ); |
|
1130 | + $filter_slug_items = array('_', '-'); |
|
1131 | 1131 | |
1132 | - foreach ( $get_sizes as $_size ) { |
|
1132 | + foreach ($get_sizes as $_size) { |
|
1133 | 1133 | |
1134 | 1134 | // Converting image size slug to title case |
1135 | - $sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items ); |
|
1135 | + $sizes[$_size] = give_slug_to_title($_size, $filter_slug_items); |
|
1136 | 1136 | |
1137 | - if ( in_array( $_size, $core_image_sizes ) ) { |
|
1138 | - $sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1139 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1140 | - $sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}"; |
|
1137 | + if (in_array($_size, $core_image_sizes)) { |
|
1138 | + $sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1139 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1140 | + $sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}"; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Based on the above image height check, label the respective resolution as responsive |
1144 | - if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) { |
|
1145 | - $sizes[ $_size ] .= ' - responsive'; |
|
1144 | + if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) { |
|
1145 | + $sizes[$_size] .= ' - responsive'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $sizes[ $_size ] .= ')'; |
|
1148 | + $sizes[$_size] .= ')'; |
|
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1152 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return text $string |
1167 | 1167 | */ |
1168 | -function give_slug_to_title( $string, $filters = array() ){ |
|
1168 | +function give_slug_to_title($string, $filters = array()) { |
|
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1170 | + foreach ($filters as $filter_item) { |
|
1171 | + $string = str_replace($filter_item, ' ', $string); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Return updated string after converting it to title case |
1175 | - return ucwords( $string ); |
|
1175 | + return ucwords($string); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1188,18 +1188,18 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1191 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1192 | 1192 | /* @var CMB2_Types $field_type_object */ |
1193 | 1193 | |
1194 | 1194 | $id = $field_type_object->field->args['id']; |
1195 | 1195 | $field_description = $field_type_object->field->args['desc']; |
1196 | 1196 | $license = $field_type_object->field->args['options']['license']; |
1197 | 1197 | $license_key = $escaped_value; |
1198 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1199 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1198 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1199 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1200 | 1200 | $shortname = $field_type_object->field->args['options']['shortname']; |
1201 | 1201 | $field_classes = 'regular-text give-license-field'; |
1202 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1202 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1203 | 1203 | $custom_html = ''; |
1204 | 1204 | $messages = array(); |
1205 | 1205 | $class = ''; |
@@ -1211,135 +1211,135 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1213 | 1213 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1214 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1214 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1215 | 1215 | $is_license_key = false; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Check if current license is part of subscription or not. |
1219 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1219 | + $subscriptions = get_option('give_subscriptions'); |
|
1220 | 1220 | |
1221 | - if ( $is_license_key && $subscriptions ) { |
|
1222 | - foreach ( $subscriptions as $subscription ) { |
|
1223 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1221 | + if ($is_license_key && $subscriptions) { |
|
1222 | + foreach ($subscriptions as $subscription) { |
|
1223 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1224 | 1224 | $is_in_subscription = $subscription['id']; |
1225 | 1225 | break; |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $is_license_key ) { |
|
1231 | - if ( $is_in_subscription ) { |
|
1232 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1233 | - $subscription_status = __( 'renew', 'give' ); |
|
1230 | + if ($is_license_key) { |
|
1231 | + if ($is_in_subscription) { |
|
1232 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1233 | + $subscription_status = __('renew', 'give'); |
|
1234 | 1234 | |
1235 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1236 | - $subscription_status = __( 'expire', 'give' ); |
|
1235 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1236 | + $subscription_status = __('expire', 'give'); |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1240 | - $messages[] = sprintf( |
|
1241 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1242 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1243 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1244 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1239 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1240 | + $messages[] = sprintf( |
|
1241 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1242 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1243 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1244 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1245 | 1245 | ); |
1246 | 1246 | $license_status = 'license-expired'; |
1247 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1247 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1248 | 1248 | $messages[] = sprintf( |
1249 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ), |
|
1250 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1251 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1249 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'), |
|
1250 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1251 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1252 | 1252 | $subscription_status, |
1253 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1253 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1254 | 1254 | ); |
1255 | 1255 | $license_status = 'license-expires-soon'; |
1256 | 1256 | } else { |
1257 | 1257 | $messages[] = sprintf( |
1258 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ), |
|
1259 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1260 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1258 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'), |
|
1259 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1260 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1261 | 1261 | $subscription_status, |
1262 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1262 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1263 | 1263 | ); |
1264 | 1264 | $license_status = 'license-expiration-date'; |
1265 | 1265 | } |
1266 | - } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1266 | + } elseif (empty($license->success) && property_exists($license, 'error')) { |
|
1267 | 1267 | |
1268 | 1268 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1269 | - switch ( $license->error ) { |
|
1269 | + switch ($license->error) { |
|
1270 | 1270 | case 'expired' : |
1271 | 1271 | $class = $license->error; |
1272 | 1272 | $messages[] = sprintf( |
1273 | - __( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1274 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1275 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1273 | + __('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1274 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1275 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1276 | 1276 | ); |
1277 | - $license_status = 'license-' . $class; |
|
1277 | + $license_status = 'license-'.$class; |
|
1278 | 1278 | break; |
1279 | 1279 | |
1280 | 1280 | case 'missing' : |
1281 | 1281 | $class = $license->error; |
1282 | 1282 | $messages[] = sprintf( |
1283 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1284 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1283 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1284 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1285 | 1285 | ); |
1286 | - $license_status = 'license-' . $class; |
|
1286 | + $license_status = 'license-'.$class; |
|
1287 | 1287 | break; |
1288 | 1288 | |
1289 | 1289 | case 'invalid' : |
1290 | 1290 | $class = $license->error; |
1291 | 1291 | $messages[] = sprintf( |
1292 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1292 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1293 | 1293 | $addon_name, |
1294 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1294 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1295 | 1295 | ); |
1296 | - $license_status = 'license-' . $class; |
|
1296 | + $license_status = 'license-'.$class; |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | 1299 | case 'site_inactive' : |
1300 | 1300 | $class = $license->error; |
1301 | 1301 | $messages[] = sprintf( |
1302 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1302 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1303 | 1303 | $addon_name, |
1304 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1304 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1305 | 1305 | ); |
1306 | - $license_status = 'license-' . $class; |
|
1306 | + $license_status = 'license-'.$class; |
|
1307 | 1307 | break; |
1308 | 1308 | |
1309 | 1309 | case 'item_name_mismatch' : |
1310 | 1310 | $class = $license->error; |
1311 | - $messages[] = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name ); |
|
1312 | - $license_status = 'license-' . $class; |
|
1311 | + $messages[] = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name); |
|
1312 | + $license_status = 'license-'.$class; |
|
1313 | 1313 | break; |
1314 | 1314 | |
1315 | 1315 | case 'no_activations_left': |
1316 | 1316 | $class = $license->error; |
1317 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1318 | - $license_status = 'license-' . $class; |
|
1317 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1318 | + $license_status = 'license-'.$class; |
|
1319 | 1319 | break; |
1320 | 1320 | } |
1321 | 1321 | } else { |
1322 | - switch ( $license->license ) { |
|
1322 | + switch ($license->license) { |
|
1323 | 1323 | case 'valid' : |
1324 | 1324 | default: |
1325 | 1325 | $class = 'valid'; |
1326 | - $now = current_time( 'timestamp' ); |
|
1327 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1326 | + $now = current_time('timestamp'); |
|
1327 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1328 | 1328 | |
1329 | - if ( 'lifetime' === $license->expires ) { |
|
1330 | - $messages[] = __( 'License key never expires.', 'give' ); |
|
1329 | + if ('lifetime' === $license->expires) { |
|
1330 | + $messages[] = __('License key never expires.', 'give'); |
|
1331 | 1331 | $license_status = 'license-lifetime-notice'; |
1332 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1332 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1333 | 1333 | $messages[] = sprintf( |
1334 | - __( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1335 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1336 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1334 | + __('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1335 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1336 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1337 | 1337 | ); |
1338 | 1338 | $license_status = 'license-expires-soon'; |
1339 | 1339 | } else { |
1340 | 1340 | $messages[] = sprintf( |
1341 | - __( 'Your license key expires on %s.', 'give' ), |
|
1342 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1341 | + __('Your license key expires on %s.', 'give'), |
|
1342 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1343 | 1343 | ); |
1344 | 1344 | $license_status = 'license-expiration-date'; |
1345 | 1345 | } |
@@ -1347,15 +1347,15 @@ discard block |
||
1347 | 1347 | } |
1348 | 1348 | } |
1349 | 1349 | } else { |
1350 | - $messages[] = sprintf( |
|
1351 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1350 | + $messages[] = sprintf( |
|
1351 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1352 | 1352 | $addon_name |
1353 | 1353 | ); |
1354 | 1354 | $license_status = 'inactive'; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | // Add class for input field if license is active. |
1358 | - if ( $is_valid_license ) { |
|
1358 | + if ($is_valid_license) { |
|
1359 | 1359 | $field_classes .= ' give-license-active'; |
1360 | 1360 | } |
1361 | 1361 | |
@@ -1363,33 +1363,33 @@ discard block |
||
1363 | 1363 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1364 | 1364 | |
1365 | 1365 | // If license is active so show deactivate button. |
1366 | - if ( $is_valid_license ) { |
|
1366 | + if ($is_valid_license) { |
|
1367 | 1367 | // Get input field html. |
1368 | 1368 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1369 | 1369 | |
1370 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1370 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1371 | 1371 | |
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | // Field description. |
1375 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1375 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1376 | 1376 | |
1377 | 1377 | // If no messages found then inform user that to get updated in future register yourself. |
1378 | - if ( empty( $messages ) ) { |
|
1379 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1378 | + if (empty($messages)) { |
|
1379 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give')); |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | - foreach ( $messages as $message ) { |
|
1383 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1384 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1382 | + foreach ($messages as $message) { |
|
1383 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1384 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1385 | 1385 | $custom_html .= '</div>'; |
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | // Field html. |
1389 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1389 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1390 | 1390 | |
1391 | 1391 | // Nonce. |
1392 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1392 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1393 | 1393 | |
1394 | 1394 | // Print field html. |
1395 | 1395 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | */ |
1405 | 1405 | function give_api_callback() { |
1406 | 1406 | |
1407 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1407 | + if ( ! current_user_can('manage_give_settings')) { |
|
1408 | 1408 | return; |
1409 | 1409 | } |
1410 | 1410 | |
@@ -1413,9 +1413,9 @@ discard block |
||
1413 | 1413 | * |
1414 | 1414 | * @since 1.0 |
1415 | 1415 | */ |
1416 | - do_action( 'give_tools_api_keys_before' ); |
|
1416 | + do_action('give_tools_api_keys_before'); |
|
1417 | 1417 | |
1418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1419 | 1419 | |
1420 | 1420 | $api_keys_table = new Give_API_Keys_Table(); |
1421 | 1421 | $api_keys_table->prepare_items(); |
@@ -1424,9 +1424,9 @@ discard block |
||
1424 | 1424 | <span class="cmb2-metabox-description api-description"> |
1425 | 1425 | <?php echo sprintf( |
1426 | 1426 | /* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */ |
1427 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1428 | - esc_url( 'http://docs.givewp.com/api' ), |
|
1429 | - esc_url( 'http://docs.givewp.com/addon-zapier' ) |
|
1427 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1428 | + esc_url('http://docs.givewp.com/api'), |
|
1429 | + esc_url('http://docs.givewp.com/addon-zapier') |
|
1430 | 1430 | ); ?> |
1431 | 1431 | </span> |
1432 | 1432 | <?php |
@@ -1436,10 +1436,10 @@ discard block |
||
1436 | 1436 | * |
1437 | 1437 | * @since 1.0 |
1438 | 1438 | */ |
1439 | - do_action( 'give_tools_api_keys_after' ); |
|
1439 | + do_action('give_tools_api_keys_after'); |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1442 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1443 | 1443 | |
1444 | 1444 | /** |
1445 | 1445 | * Hook Callback |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | * |
1453 | 1453 | * @return void |
1454 | 1454 | */ |
1455 | -function give_hook_callback( $args ) { |
|
1455 | +function give_hook_callback($args) { |
|
1456 | 1456 | |
1457 | 1457 | $id = $args['id']; |
1458 | 1458 | |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | * |
1462 | 1462 | * @since 1.0 |
1463 | 1463 | */ |
1464 | - do_action( "give_{$id}" ); |
|
1464 | + do_action("give_{$id}"); |
|
1465 | 1465 | |
1466 | 1466 | } |
1467 | 1467 | |
@@ -1476,19 +1476,19 @@ discard block |
||
1476 | 1476 | * |
1477 | 1477 | * @return bool |
1478 | 1478 | */ |
1479 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1480 | - if ( ! is_null( $compare_with ) ) { |
|
1479 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1480 | + if ( ! is_null($compare_with)) { |
|
1481 | 1481 | |
1482 | - if ( is_array( $compare_with ) ) { |
|
1482 | + if (is_array($compare_with)) { |
|
1483 | 1483 | // Output. |
1484 | - return in_array( $value, $compare_with ); |
|
1484 | + return in_array($value, $compare_with); |
|
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | // Output. |
1488 | - return ( $value === $compare_with ); |
|
1488 | + return ($value === $compare_with); |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1492 | 1492 | // Output. |
1493 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1493 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1494 | 1494 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param array $args An array of form arguments. |
23 | 23 | * |
24 | - * @return string Donation form. |
|
24 | + * @return false|null Donation form. |
|
25 | 25 | */ |
26 | 26 | function give_get_donation_form( $args = array() ) { |
27 | 27 | |
@@ -1470,7 +1470,7 @@ discard block |
||
1470 | 1470 | * |
1471 | 1471 | * @param int $form_id The form ID. |
1472 | 1472 | * |
1473 | - * @return bool |
|
1473 | + * @return false|null |
|
1474 | 1474 | */ |
1475 | 1475 | function give_terms_agreement( $form_id ) { |
1476 | 1476 | $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | * @param int $form_id The form ID. |
1648 | 1648 | * @param array $args An array of form arguments. |
1649 | 1649 | * |
1650 | - * @return mixed |
|
1650 | + * @return boolean |
|
1651 | 1651 | */ |
1652 | 1652 | function give_show_goal_progress( $form_id, $args ) { |
1653 | 1653 | |
@@ -1667,7 +1667,7 @@ discard block |
||
1667 | 1667 | * |
1668 | 1668 | * @since 1.8 |
1669 | 1669 | * |
1670 | - * @param $form_id |
|
1670 | + * @param integer $form_id |
|
1671 | 1671 | * @param $args |
1672 | 1672 | * |
1673 | 1673 | * @return mixed|string |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | * @param int $form_id The form ID. |
1709 | 1709 | * @param array $args An array of form arguments. |
1710 | 1710 | * |
1711 | - * @return void|bool |
|
1711 | + * @return false|null |
|
1712 | 1712 | */ |
1713 | 1713 | function give_form_content( $form_id, $args ) { |
1714 | 1714 |
@@ -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,50 +23,50 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id, |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID. |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | 55 | ); |
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
58 | 58 | if ( |
59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
60 | - || ( 'trash' === $form->post_status ) |
|
59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
60 | + || ('trash' === $form->post_status) |
|
61 | 61 | ) { |
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
65 | 65 | //Get the form wrap CSS classes. |
66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
67 | 67 | |
68 | 68 | //Get the <form> tag wrap CSS classes. |
69 | - $form_classes = $form->get_form_classes( $args ); |
|
69 | + $form_classes = $form->get_form_classes($args); |
|
70 | 70 | |
71 | 71 | ob_start(); |
72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * @param int $form_id The form ID. |
79 | 79 | * @param array $args An array of form arguments. |
80 | 80 | */ |
81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
82 | 82 | |
83 | 83 | ?> |
84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
85 | 85 | |
86 | - <?php if ( $form->is_close_donation_form() ) { |
|
86 | + <?php if ($form->is_close_donation_form()) { |
|
87 | 87 | |
88 | 88 | // Get Goal thank you message. |
89 | - $goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
89 | + $goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
91 | 91 | |
92 | 92 | // Print thank you message. |
93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
94 | 94 | |
95 | 95 | } else { |
96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * 1. if show_title params set to true |
99 | 99 | * 2. if admin set form display_style to button |
100 | 100 | */ |
101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
102 | 102 | if ( |
103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
104 | - && ! doing_action( 'give_single_form_summary' ) |
|
103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
104 | + && ! doing_action('give_single_form_summary') |
|
105 | 105 | ) { |
106 | 106 | echo $form_title; |
107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
114 | 114 | * @param int $form_id The form ID. |
115 | 115 | * @param array $args An array of form arguments. |
116 | 116 | */ |
117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
117 | + do_action('give_pre_form', $form->ID, $args); |
|
118 | 118 | ?> |
119 | 119 | |
120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
124 | 124 | <input type="hidden" name="give-current-url" |
125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
126 | 126 | <input type="hidden" name="give-form-url" |
127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
128 | 128 | <input type="hidden" name="give-form-minimum" |
129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
130 | 130 | |
131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | <?php |
139 | 139 | |
140 | 140 | // Price ID hidden field for variable (mult-level) donation forms. |
141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
141 | + if (give_has_variable_prices($form_id)) { |
|
142 | 142 | // Get default selected price ID. |
143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
144 | 144 | $price_id = 0; |
145 | 145 | //loop through prices. |
146 | - foreach ( $prices as $price ) { |
|
147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
146 | + foreach ($prices as $price) { |
|
147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
148 | 148 | $price_id = $price['_give_id']['level_id']; |
149 | 149 | }; |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param int $form_id The form ID. |
161 | 161 | * @param array $args An array of form arguments. |
162 | 162 | */ |
163 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
163 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Fires while outputing donation form, for payment gatways fields. |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param int $form_id The form ID. |
171 | 171 | * @param array $args An array of form arguments. |
172 | 172 | */ |
173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Fires while outputing donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param int $form_id The form ID. |
181 | 181 | * @param array $args An array of form arguments. |
182 | 182 | */ |
183 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
183 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
184 | 184 | |
185 | 185 | ?> |
186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * @param int $form_id The form ID. |
195 | 195 | * @param array $args An array of form arguments. |
196 | 196 | */ |
197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
197 | + do_action('give_post_form', $form->ID, $args); |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | |
202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
203 | 203 | <?php |
204 | 204 | |
205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * @param int $form_id The form ID. |
211 | 211 | * @param array $args An array of form arguments. |
212 | 212 | */ |
213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
213 | + do_action('give_post_form_output', $form->ID, $args); |
|
214 | 214 | |
215 | 215 | $final_output = ob_get_clean(); |
216 | 216 | |
217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return string |
233 | 233 | */ |
234 | -function give_show_purchase_form( $form_id ) { |
|
234 | +function give_show_purchase_form($form_id) { |
|
235 | 235 | |
236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
237 | 237 | |
238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
239 | 239 | $form_id = $_POST['give_form_id']; |
240 | 240 | } |
241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @since 1.7 |
246 | 246 | */ |
247 | - do_action( 'give_donation_form_top', $form_id ); |
|
247 | + do_action('give_donation_form_top', $form_id); |
|
248 | 248 | |
249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
249 | + if (give_can_checkout() && isset($form_id)) { |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Fires while displaying donation form, before registration login. |
253 | 253 | * |
254 | 254 | * @since 1.7 |
255 | 255 | */ |
256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Fire when register/login form fields render. |
260 | 260 | * |
261 | 261 | * @since 1.7 |
262 | 262 | */ |
263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Fire when credit card form fields render. |
267 | 267 | * |
268 | 268 | * @since 1.7 |
269 | 269 | */ |
270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
271 | 271 | |
272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
274 | 274 | /** |
275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param int $form_id The form ID. |
280 | 280 | */ |
281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
282 | 282 | } else { |
283 | 283 | /** |
284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @param int $form_id The form ID. |
289 | 289 | */ |
290 | - do_action( 'give_cc_form', $form_id ); |
|
290 | + do_action('give_cc_form', $form_id); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @since 1.7 |
297 | 297 | */ |
298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
299 | 299 | |
300 | 300 | } else { |
301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @since 1.7 |
305 | 305 | */ |
306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
306 | + do_action('give_donation_form_no_access', $form_id); |
|
307 | 307 | |
308 | 308 | } |
309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @since 1.7 |
314 | 314 | */ |
315 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
315 | + do_action('give_donation_form_bottom', $form_id); |
|
316 | 316 | } |
317 | 317 | |
318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @return void |
328 | 328 | */ |
329 | -function give_show_register_login_fields( $form_id ) { |
|
329 | +function give_show_register_login_fields($form_id) { |
|
330 | 330 | |
331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
331 | + $show_register_form = give_show_login_register_option($form_id); |
|
332 | 332 | |
333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
334 | 334 | ?> |
335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @since 1.7 |
341 | 341 | */ |
342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
342 | + do_action('give_donation_form_register_fields', $form_id); |
|
343 | 343 | ?> |
344 | 344 | </div> |
345 | 345 | <?php |
346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
347 | 347 | ?> |
348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @since 1.7 |
354 | 354 | */ |
355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
355 | + do_action('give_donation_form_login_fields', $form_id); |
|
356 | 356 | ?> |
357 | 357 | </div> |
358 | 358 | <?php |
359 | 359 | endif; |
360 | 360 | |
361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
362 | 362 | /** |
363 | 363 | * Fire when user info render. |
364 | 364 | * |
365 | 365 | * @since 1.7 |
366 | 366 | */ |
367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return void |
385 | 385 | */ |
386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
387 | 387 | |
388 | 388 | $give_options = give_get_settings(); |
389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
390 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
395 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
390 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
395 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
402 | 402 | * @param int $form_id The form ID. |
403 | 403 | * @param array $args An array of form arguments. |
404 | 404 | */ |
405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
406 | 406 | |
407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
409 | 409 | ?> |
410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
414 | - <?php if ( $currency_position == 'before' ) { |
|
414 | + <?php if ($currency_position == 'before') { |
|
415 | 415 | echo $currency_output; |
416 | 416 | } ?> |
417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
418 | - <?php if ( $currency_position == 'after' ) { |
|
418 | + <?php if ($currency_position == 'after') { |
|
419 | 419 | echo $currency_output; |
420 | 420 | } ?> |
421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
425 | 425 | ?> |
426 | 426 | <div class="give-total-wrap"> |
427 | 427 | <div class="give-donation-amount form-row-wide"> |
428 | - <?php if ( $currency_position == 'before' ) { |
|
428 | + <?php if ($currency_position == 'before') { |
|
429 | 429 | echo $currency_output; |
430 | 430 | } ?> |
431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
434 | - <?php if ( $currency_position == 'after' ) { |
|
434 | + <?php if ($currency_position == 'after') { |
|
435 | 435 | echo $currency_output; |
436 | 436 | } ?> |
437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * @param int $form_id The form ID. |
447 | 447 | * @param array $args An array of form arguments. |
448 | 448 | */ |
449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
450 | 450 | |
451 | 451 | //Custom Amount Text |
452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
454 | 454 | <?php } |
455 | 455 | |
456 | 456 | //Output Variable Pricing Levels. |
457 | - if ( $variable_pricing ) { |
|
458 | - give_output_levels( $form_id ); |
|
457 | + if ($variable_pricing) { |
|
458 | + give_output_levels($form_id); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | * @param int $form_id The form ID. |
467 | 467 | * @param array $args An array of form arguments. |
468 | 468 | */ |
469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
470 | 470 | } |
471 | 471 | |
472 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
472 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
473 | 473 | |
474 | 474 | /** |
475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,30 +480,30 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @return string Donation levels. |
482 | 482 | */ |
483 | -function give_output_levels( $form_id ) { |
|
483 | +function give_output_levels($form_id) { |
|
484 | 484 | |
485 | 485 | //Get variable pricing. |
486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
487 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
488 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
489 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
490 | - if ( empty( $custom_amount_text ) ) { |
|
491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
487 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
488 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
489 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
490 | + if (empty($custom_amount_text)) { |
|
491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
492 | 492 | } |
493 | 493 | |
494 | - $output = ''; |
|
494 | + $output = ''; |
|
495 | 495 | |
496 | - switch ( $display_style ) { |
|
496 | + switch ($display_style) { |
|
497 | 497 | case 'buttons': |
498 | 498 | |
499 | 499 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
500 | 500 | |
501 | - foreach ( $prices as $price ) { |
|
502 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
503 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
501 | + foreach ($prices as $price) { |
|
502 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
503 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
504 | 504 | |
505 | 505 | $output .= '<li>'; |
506 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
506 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
507 | 507 | $output .= $level_text; |
508 | 508 | $output .= '</button>'; |
509 | 509 | $output .= '</li>'; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | } |
512 | 512 | |
513 | 513 | //Custom Amount. |
514 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
514 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
515 | 515 | $output .= '<li>'; |
516 | 516 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
517 | 517 | $output .= $custom_amount_text; |
@@ -527,22 +527,22 @@ discard block |
||
527 | 527 | |
528 | 528 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
529 | 529 | |
530 | - foreach ( $prices as $price ) { |
|
531 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
532 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
530 | + foreach ($prices as $price) { |
|
531 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
532 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
533 | 533 | |
534 | 534 | $output .= '<li>'; |
535 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
536 | - $output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>'; |
|
535 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
536 | + $output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>'; |
|
537 | 537 | $output .= '</li>'; |
538 | 538 | |
539 | 539 | } |
540 | 540 | |
541 | 541 | //Custom Amount. |
542 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
542 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
543 | 543 | $output .= '<li>'; |
544 | 544 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
545 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
545 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
546 | 546 | $output .= '</li>'; |
547 | 547 | } |
548 | 548 | |
@@ -552,23 +552,23 @@ discard block |
||
552 | 552 | |
553 | 553 | case 'dropdown': |
554 | 554 | |
555 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
556 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
555 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
556 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
557 | 557 | |
558 | 558 | //first loop through prices. |
559 | - foreach ( $prices as $price ) { |
|
560 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
561 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
559 | + foreach ($prices as $price) { |
|
560 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
561 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
562 | 562 | |
563 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
563 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
564 | 564 | $output .= $level_text; |
565 | 565 | $output .= '</option>'; |
566 | 566 | |
567 | 567 | } |
568 | 568 | |
569 | 569 | //Custom Amount. |
570 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
571 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
570 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
571 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | $output .= '</select>'; |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | break; |
577 | 577 | } |
578 | 578 | |
579 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
579 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | /** |
@@ -591,27 +591,27 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @return string Checkout button. |
593 | 593 | */ |
594 | -function give_display_checkout_button( $form_id, $args ) { |
|
594 | +function give_display_checkout_button($form_id, $args) { |
|
595 | 595 | |
596 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
596 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
597 | 597 | ? $args['display_style'] |
598 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
598 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
599 | 599 | |
600 | - if ( 'button' === $display_option ) { |
|
600 | + if ('button' === $display_option) { |
|
601 | 601 | $display_option = 'modal'; |
602 | - } elseif ( $display_option === 'onpage' ) { |
|
602 | + } elseif ($display_option === 'onpage') { |
|
603 | 603 | return ''; |
604 | 604 | } |
605 | 605 | |
606 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
607 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
606 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
607 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
608 | 608 | |
609 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
609 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
610 | 610 | |
611 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
611 | + echo apply_filters('give_display_checkout_button', $output); |
|
612 | 612 | } |
613 | 613 | |
614 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
614 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -622,57 +622,57 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @return void |
624 | 624 | */ |
625 | -function give_user_info_fields( $form_id ) { |
|
625 | +function give_user_info_fields($form_id) { |
|
626 | 626 | // Get user info. |
627 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
627 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
628 | 628 | |
629 | 629 | /** |
630 | 630 | * Fire before user personal information fields |
631 | 631 | * |
632 | 632 | * @since 1.7 |
633 | 633 | */ |
634 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
634 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
635 | 635 | ?> |
636 | 636 | <fieldset id="give_checkout_user_info"> |
637 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
637 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
638 | 638 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
639 | 639 | <label class="give-label" for="give-first"> |
640 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
641 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
640 | + <?php esc_html_e('First Name', 'give'); ?> |
|
641 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
642 | 642 | <span class="give-required-indicator">*</span> |
643 | 643 | <?php endif ?> |
644 | 644 | <span class="give-tooltip give-icon give-icon-question" |
645 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
645 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
646 | 646 | </label> |
647 | 647 | <input |
648 | 648 | class="give-input required" |
649 | 649 | type="text" |
650 | 650 | name="give_first" |
651 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
651 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
652 | 652 | id="give-first" |
653 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
654 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
653 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
654 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
655 | 655 | /> |
656 | 656 | </p> |
657 | 657 | |
658 | 658 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
659 | 659 | <label class="give-label" for="give-last"> |
660 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
661 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
660 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
661 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
662 | 662 | <span class="give-required-indicator">*</span> |
663 | 663 | <?php endif ?> |
664 | 664 | <span class="give-tooltip give-icon give-icon-question" |
665 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
665 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
666 | 666 | </label> |
667 | 667 | |
668 | 668 | <input |
669 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
669 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
670 | 670 | type="text" |
671 | 671 | name="give_last" |
672 | 672 | id="give-last" |
673 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
674 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
675 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
673 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
674 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
675 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
676 | 676 | /> |
677 | 677 | </p> |
678 | 678 | |
@@ -682,26 +682,26 @@ discard block |
||
682 | 682 | * |
683 | 683 | * @since 1.7 |
684 | 684 | */ |
685 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
685 | + do_action('give_donation_form_before_email', $form_id); |
|
686 | 686 | ?> |
687 | 687 | <p id="give-email-wrap" class="form-row form-row-wide"> |
688 | 688 | <label class="give-label" for="give-email"> |
689 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
690 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
689 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
690 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
691 | 691 | <span class="give-required-indicator">*</span> |
692 | 692 | <?php } ?> |
693 | 693 | <span class="give-tooltip give-icon give-icon-question" |
694 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
694 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
695 | 695 | </label> |
696 | 696 | |
697 | 697 | <input |
698 | 698 | class="give-input required" |
699 | 699 | type="email" |
700 | 700 | name="give_email" |
701 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
701 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
702 | 702 | id="give-email" |
703 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
704 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
703 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
704 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
705 | 705 | /> |
706 | 706 | |
707 | 707 | </p> |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | * |
712 | 712 | * @since 1.7 |
713 | 713 | */ |
714 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
714 | + do_action('give_donation_form_after_email', $form_id); |
|
715 | 715 | |
716 | 716 | /** |
717 | 717 | * Fire after personal email field |
718 | 718 | * |
719 | 719 | * @since 1.7 |
720 | 720 | */ |
721 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
721 | + do_action('give_donation_form_user_info', $form_id); |
|
722 | 722 | ?> |
723 | 723 | </fieldset> |
724 | 724 | <?php |
@@ -727,11 +727,11 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @since 1.7 |
729 | 729 | */ |
730 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
730 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
731 | 731 | } |
732 | 732 | |
733 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
734 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
733 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
734 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
735 | 735 | |
736 | 736 | /** |
737 | 737 | * Renders the credit card info form. |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | * |
743 | 743 | * @return void |
744 | 744 | */ |
745 | -function give_get_cc_form( $form_id ) { |
|
745 | +function give_get_cc_form($form_id) { |
|
746 | 746 | |
747 | 747 | ob_start(); |
748 | 748 | |
@@ -753,53 +753,53 @@ discard block |
||
753 | 753 | * |
754 | 754 | * @param int $form_id The form ID. |
755 | 755 | */ |
756 | - do_action( 'give_before_cc_fields', $form_id ); |
|
756 | + do_action('give_before_cc_fields', $form_id); |
|
757 | 757 | ?> |
758 | 758 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
759 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
760 | - <?php if ( is_ssl() ) : ?> |
|
759 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
760 | + <?php if (is_ssl()) : ?> |
|
761 | 761 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
762 | 762 | <span class="give-icon padlock"></span> |
763 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
763 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
764 | 764 | </div> |
765 | 765 | <?php endif; ?> |
766 | 766 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
767 | 767 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
768 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
768 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
769 | 769 | <span class="give-required-indicator">*</span> |
770 | 770 | <span class="give-tooltip give-icon give-icon-question" |
771 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
771 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
772 | 772 | <span class="card-type"></span> |
773 | 773 | </label> |
774 | 774 | |
775 | 775 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
776 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
776 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
777 | 777 | required aria-required="true"/> |
778 | 778 | </p> |
779 | 779 | |
780 | 780 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
781 | 781 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
782 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
782 | + <?php esc_html_e('CVC', 'give'); ?> |
|
783 | 783 | <span class="give-required-indicator">*</span> |
784 | 784 | <span class="give-tooltip give-icon give-icon-question" |
785 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
785 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
786 | 786 | </label> |
787 | 787 | |
788 | 788 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
789 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
789 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
790 | 790 | required aria-required="true"/> |
791 | 791 | </p> |
792 | 792 | |
793 | 793 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
794 | 794 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
795 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
795 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
796 | 796 | <span class="give-required-indicator">*</span> |
797 | 797 | <span class="give-tooltip give-icon give-icon-question" |
798 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
798 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
799 | 799 | </label> |
800 | 800 | |
801 | 801 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
802 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
802 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
803 | 803 | required aria-required="true"/> |
804 | 804 | </p> |
805 | 805 | <?php |
@@ -810,14 +810,14 @@ discard block |
||
810 | 810 | * |
811 | 811 | * @param int $form_id The form ID. |
812 | 812 | */ |
813 | - do_action( 'give_before_cc_expiration' ); |
|
813 | + do_action('give_before_cc_expiration'); |
|
814 | 814 | ?> |
815 | 815 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
816 | 816 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
817 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
817 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
818 | 818 | <span class="give-required-indicator">*</span> |
819 | 819 | <span class="give-tooltip give-icon give-icon-question" |
820 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
820 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
821 | 821 | </label> |
822 | 822 | |
823 | 823 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | class="card-expiry-year"/> |
827 | 827 | |
828 | 828 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
829 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
829 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
830 | 830 | required aria-required="true"/> |
831 | 831 | </p> |
832 | 832 | <?php |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @param int $form_id The form ID. |
839 | 839 | */ |
840 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
840 | + do_action('give_after_cc_expiration', $form_id); |
|
841 | 841 | ?> |
842 | 842 | </fieldset> |
843 | 843 | <?php |
@@ -848,12 +848,12 @@ discard block |
||
848 | 848 | * |
849 | 849 | * @param int $form_id The form ID. |
850 | 850 | */ |
851 | - do_action( 'give_after_cc_fields', $form_id ); |
|
851 | + do_action('give_after_cc_fields', $form_id); |
|
852 | 852 | |
853 | 853 | echo ob_get_clean(); |
854 | 854 | } |
855 | 855 | |
856 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
856 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
857 | 857 | |
858 | 858 | /** |
859 | 859 | * Outputs the default credit card address fields. |
@@ -864,24 +864,24 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return void |
866 | 866 | */ |
867 | -function give_default_cc_address_fields( $form_id ) { |
|
867 | +function give_default_cc_address_fields($form_id) { |
|
868 | 868 | // Get user info. |
869 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
869 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
870 | 870 | |
871 | 871 | $logged_in = is_user_logged_in(); |
872 | 872 | |
873 | - if ( $logged_in ) { |
|
874 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
873 | + if ($logged_in) { |
|
874 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
875 | 875 | } |
876 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
877 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
878 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
879 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
876 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
877 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
878 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
879 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
880 | 880 | |
881 | 881 | ob_start(); |
882 | 882 | ?> |
883 | 883 | <fieldset id="give_cc_address" class="cc-address"> |
884 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
884 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
885 | 885 | <?php |
886 | 886 | /** |
887 | 887 | * Fires while rendering credit card billing form, before address fields. |
@@ -890,79 +890,79 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @param int $form_id The form ID. |
892 | 892 | */ |
893 | - do_action( 'give_cc_billing_top' ); |
|
893 | + do_action('give_cc_billing_top'); |
|
894 | 894 | ?> |
895 | 895 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
896 | 896 | <label for="card_address" class="give-label"> |
897 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
897 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
898 | 898 | <?php |
899 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
899 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
900 | 900 | <span class="give-required-indicator">*</span> |
901 | 901 | <?php endif; ?> |
902 | 902 | <span class="give-tooltip give-icon give-icon-question" |
903 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
903 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
904 | 904 | </label> |
905 | 905 | |
906 | 906 | <input |
907 | 907 | type="text" |
908 | 908 | id="card_address" |
909 | 909 | name="card_address" |
910 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
911 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
912 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
913 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
910 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
911 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
912 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
913 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
914 | 914 | /> |
915 | 915 | </p> |
916 | 916 | |
917 | 917 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
918 | 918 | <label for="card_address_2" class="give-label"> |
919 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
920 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
919 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
920 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
921 | 921 | <span class="give-required-indicator">*</span> |
922 | 922 | <?php endif; ?> |
923 | 923 | <span class="give-tooltip give-icon give-icon-question" |
924 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
924 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
925 | 925 | </label> |
926 | 926 | |
927 | 927 | <input |
928 | 928 | type="text" |
929 | 929 | id="card_address_2" |
930 | 930 | name="card_address_2" |
931 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
932 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
933 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
934 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
931 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
932 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
933 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
934 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
935 | 935 | /> |
936 | 936 | </p> |
937 | 937 | |
938 | 938 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
939 | 939 | <label for="card_city" class="give-label"> |
940 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
941 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
940 | + <?php esc_html_e('City', 'give'); ?> |
|
941 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
942 | 942 | <span class="give-required-indicator">*</span> |
943 | 943 | <?php endif; ?> |
944 | 944 | <span class="give-tooltip give-icon give-icon-question" |
945 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
945 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
946 | 946 | </label> |
947 | 947 | <input |
948 | 948 | type="text" |
949 | 949 | id="card_city" |
950 | 950 | name="card_city" |
951 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
952 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
953 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
954 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
951 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
952 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
953 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
954 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
955 | 955 | /> |
956 | 956 | </p> |
957 | 957 | |
958 | 958 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
959 | 959 | <label for="card_zip" class="give-label"> |
960 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
961 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
960 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
961 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
962 | 962 | <span class="give-required-indicator">*</span> |
963 | 963 | <?php endif; ?> |
964 | 964 | <span class="give-tooltip give-icon give-icon-question" |
965 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
965 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
966 | 966 | </label> |
967 | 967 | |
968 | 968 | <input |
@@ -970,40 +970,40 @@ discard block |
||
970 | 970 | size="4" |
971 | 971 | id="card_zip" |
972 | 972 | name="card_zip" |
973 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
974 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
975 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
976 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
973 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
974 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
975 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
976 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
977 | 977 | /> |
978 | 978 | </p> |
979 | 979 | |
980 | 980 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
981 | 981 | <label for="billing_country" class="give-label"> |
982 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
983 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
982 | + <?php esc_html_e('Country', 'give'); ?> |
|
983 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
984 | 984 | <span class="give-required-indicator">*</span> |
985 | 985 | <?php endif; ?> |
986 | 986 | <span class="give-tooltip give-icon give-icon-question" |
987 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
987 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
988 | 988 | </label> |
989 | 989 | |
990 | 990 | <select |
991 | 991 | name="billing_country" |
992 | 992 | id="billing_country" |
993 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
994 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
993 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
994 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
995 | 995 | > |
996 | 996 | <?php |
997 | 997 | |
998 | 998 | $selected_country = give_get_country(); |
999 | 999 | |
1000 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1000 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1001 | 1001 | $selected_country = $give_user_info['billing_country']; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | $countries = give_get_country_list(); |
1005 | - foreach ( $countries as $country_code => $country ) { |
|
1006 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1005 | + foreach ($countries as $country_code => $country) { |
|
1006 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1007 | 1007 | } |
1008 | 1008 | ?> |
1009 | 1009 | </select> |
@@ -1011,37 +1011,37 @@ discard block |
||
1011 | 1011 | |
1012 | 1012 | <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive"> |
1013 | 1013 | <label for="card_state" class="give-label"> |
1014 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
1015 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
1014 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
1015 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
1016 | 1016 | <span class="give-required-indicator">*</span> |
1017 | 1017 | <?php endif; ?> |
1018 | 1018 | <span class="give-tooltip give-icon give-icon-question" |
1019 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
1019 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
1020 | 1020 | </label> |
1021 | 1021 | |
1022 | 1022 | <?php |
1023 | 1023 | $selected_state = give_get_state(); |
1024 | - $states = give_get_states( $selected_country ); |
|
1024 | + $states = give_get_states($selected_country); |
|
1025 | 1025 | |
1026 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
1026 | + if ( ! empty($give_user_info['card_state'])) { |
|
1027 | 1027 | $selected_state = $give_user_info['card_state']; |
1028 | 1028 | } |
1029 | 1029 | |
1030 | - if ( ! empty( $states ) ) : ?> |
|
1030 | + if ( ! empty($states)) : ?> |
|
1031 | 1031 | <select |
1032 | 1032 | name="card_state" |
1033 | 1033 | id="card_state" |
1034 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1035 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1034 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1035 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1036 | 1036 | <?php |
1037 | - foreach ( $states as $state_code => $state ) { |
|
1038 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1037 | + foreach ($states as $state_code => $state) { |
|
1038 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1039 | 1039 | } |
1040 | 1040 | ?> |
1041 | 1041 | </select> |
1042 | 1042 | <?php else : ?> |
1043 | 1043 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1044 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
1044 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
1045 | 1045 | <?php endif; ?> |
1046 | 1046 | </p> |
1047 | 1047 | <?php |
@@ -1052,14 +1052,14 @@ discard block |
||
1052 | 1052 | * |
1053 | 1053 | * @param int $form_id The form ID. |
1054 | 1054 | */ |
1055 | - do_action( 'give_cc_billing_bottom' ); |
|
1055 | + do_action('give_cc_billing_bottom'); |
|
1056 | 1056 | ?> |
1057 | 1057 | </fieldset> |
1058 | 1058 | <?php |
1059 | 1059 | echo ob_get_clean(); |
1060 | 1060 | } |
1061 | 1061 | |
1062 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1062 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1063 | 1063 | |
1064 | 1064 | |
1065 | 1065 | /** |
@@ -1072,24 +1072,24 @@ discard block |
||
1072 | 1072 | * |
1073 | 1073 | * @return string |
1074 | 1074 | */ |
1075 | -function give_get_register_fields( $form_id ) { |
|
1075 | +function give_get_register_fields($form_id) { |
|
1076 | 1076 | |
1077 | 1077 | global $user_ID; |
1078 | 1078 | |
1079 | - if ( is_user_logged_in() ) { |
|
1080 | - $user_data = get_userdata( $user_ID ); |
|
1079 | + if (is_user_logged_in()) { |
|
1080 | + $user_data = get_userdata($user_ID); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1083 | + $show_register_form = give_show_login_register_option($form_id); |
|
1084 | 1084 | |
1085 | 1085 | ob_start(); ?> |
1086 | 1086 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1087 | 1087 | |
1088 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1088 | + <?php if ($show_register_form == 'both') { ?> |
|
1089 | 1089 | <div class="give-login-account-wrap"> |
1090 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1091 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1092 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1090 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1091 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1092 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1093 | 1093 | </p> |
1094 | 1094 | <p class="give-loading-text"> |
1095 | 1095 | <span class="give-loading-animation"></span> |
@@ -1105,15 +1105,15 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @param int $form_id The form ID. |
1107 | 1107 | */ |
1108 | - do_action( 'give_register_fields_before', $form_id ); |
|
1108 | + do_action('give_register_fields_before', $form_id); |
|
1109 | 1109 | ?> |
1110 | 1110 | |
1111 | 1111 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1112 | 1112 | <legend> |
1113 | 1113 | <?php |
1114 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1115 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1116 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1114 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1115 | + if ( ! give_logged_in_only($form_id)) { |
|
1116 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1117 | 1117 | } |
1118 | 1118 | ?> |
1119 | 1119 | </legend> |
@@ -1125,54 +1125,54 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @param int $form_id The form ID. |
1127 | 1127 | */ |
1128 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1128 | + do_action('give_register_account_fields_before', $form_id); |
|
1129 | 1129 | ?> |
1130 | 1130 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
1131 | 1131 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
1132 | 1132 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1133 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1134 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1133 | + <?php esc_html_e('Username', 'give'); ?> |
|
1134 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1135 | 1135 | <span class="give-required-indicator">*</span> |
1136 | 1136 | <?php } ?> |
1137 | 1137 | <span class="give-tooltip give-icon give-icon-question" |
1138 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1138 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1139 | 1139 | </label> |
1140 | 1140 | |
1141 | 1141 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
1142 | 1142 | type="text" |
1143 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1143 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1144 | 1144 | </div> |
1145 | 1145 | |
1146 | 1146 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1147 | 1147 | class="form-row form-row-one-third form-row-responsive"> |
1148 | 1148 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1149 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1150 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1149 | + <?php esc_html_e('Password', 'give'); ?> |
|
1150 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1151 | 1151 | <span class="give-required-indicator">*</span> |
1152 | 1152 | <?php } ?> |
1153 | 1153 | <span class="give-tooltip give-icon give-icon-question" |
1154 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1154 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1155 | 1155 | </label> |
1156 | 1156 | |
1157 | 1157 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
1158 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
1159 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1158 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
1159 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1160 | 1160 | </div> |
1161 | 1161 | |
1162 | 1162 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
1163 | 1163 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
1164 | 1164 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1165 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1166 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1165 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1166 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1167 | 1167 | <span class="give-required-indicator">*</span> |
1168 | 1168 | <?php } ?> |
1169 | 1169 | <span class="give-tooltip give-icon give-icon-question" |
1170 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1170 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1171 | 1171 | </label> |
1172 | 1172 | |
1173 | 1173 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
1174 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
1175 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1174 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
1175 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1176 | 1176 | </div> |
1177 | 1177 | <?php |
1178 | 1178 | /** |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * |
1183 | 1183 | * @param int $form_id The form ID. |
1184 | 1184 | */ |
1185 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1185 | + do_action('give_register_account_fields_after', $form_id); |
|
1186 | 1186 | ?> |
1187 | 1187 | </fieldset> |
1188 | 1188 | |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | * |
1195 | 1195 | * @param int $form_id The form ID. |
1196 | 1196 | */ |
1197 | - do_action( 'give_register_fields_after', $form_id ); |
|
1197 | + do_action('give_register_fields_after', $form_id); |
|
1198 | 1198 | ?> |
1199 | 1199 | |
1200 | 1200 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | * |
1206 | 1206 | * @since 1.7 |
1207 | 1207 | */ |
1208 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1208 | + do_action('give_donation_form_user_info', $form_id); |
|
1209 | 1209 | ?> |
1210 | 1210 | |
1211 | 1211 | </fieldset> |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | echo ob_get_clean(); |
1214 | 1214 | } |
1215 | 1215 | |
1216 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1216 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1217 | 1217 | |
1218 | 1218 | /** |
1219 | 1219 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1226,27 +1226,27 @@ discard block |
||
1226 | 1226 | * |
1227 | 1227 | * @return string |
1228 | 1228 | */ |
1229 | -function give_get_login_fields( $form_id ) { |
|
1229 | +function give_get_login_fields($form_id) { |
|
1230 | 1230 | |
1231 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1232 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1231 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1232 | + $show_register_form = give_show_login_register_option($form_id); |
|
1233 | 1233 | |
1234 | 1234 | ob_start(); |
1235 | 1235 | ?> |
1236 | 1236 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1237 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1238 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1239 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1237 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1238 | + if ( ! give_logged_in_only($form_id)) { |
|
1239 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1240 | 1240 | } ?> |
1241 | 1241 | </legend> |
1242 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1242 | + <?php if ($show_register_form == 'both') { ?> |
|
1243 | 1243 | <p class="give-new-account-link"> |
1244 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1245 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1244 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1245 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1246 | 1246 | data-action="give_checkout_register"> |
1247 | - <?php esc_html_e( 'Register', 'give' ); |
|
1248 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1249 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
1247 | + <?php esc_html_e('Register', 'give'); |
|
1248 | + if ( ! give_logged_in_only($form_id)) { |
|
1249 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
1250 | 1250 | } ?> |
1251 | 1251 | </a> |
1252 | 1252 | </p> |
@@ -1262,49 +1262,49 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @param int $form_id The form ID. |
1264 | 1264 | */ |
1265 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1265 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1266 | 1266 | ?> |
1267 | 1267 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
1268 | 1268 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1269 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1270 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1269 | + <?php esc_html_e('Username', 'give'); ?> |
|
1270 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1271 | 1271 | <span class="give-required-indicator">*</span> |
1272 | 1272 | <?php } ?> |
1273 | 1273 | </label> |
1274 | 1274 | |
1275 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1275 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1276 | 1276 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1277 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1277 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1278 | 1278 | </div> |
1279 | 1279 | |
1280 | 1280 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
1281 | 1281 | class="give_login_password form-row form-row-last form-row-responsive"> |
1282 | 1282 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1283 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1284 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1283 | + <?php esc_html_e('Password', 'give'); ?> |
|
1284 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1285 | 1285 | <span class="give-required-indicator">*</span> |
1286 | 1286 | <?php } ?> |
1287 | 1287 | </label> |
1288 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1288 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1289 | 1289 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1290 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1290 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1291 | 1291 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1292 | 1292 | </div> |
1293 | 1293 | |
1294 | 1294 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1295 | 1295 | <span class="give-forgot-password "> |
1296 | 1296 | <a href="<?php echo wp_lostpassword_url() ?>" |
1297 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1297 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1298 | 1298 | </span> |
1299 | 1299 | </div> |
1300 | 1300 | |
1301 | 1301 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1302 | 1302 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1303 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1304 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1303 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1304 | + <?php if ($show_register_form !== 'login') { ?> |
|
1305 | 1305 | <input type="button" data-action="give_cancel_login" |
1306 | 1306 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1307 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1307 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1308 | 1308 | <?php } ?> |
1309 | 1309 | <span class="give-loading-animation"></span> |
1310 | 1310 | </div> |
@@ -1316,14 +1316,14 @@ discard block |
||
1316 | 1316 | * |
1317 | 1317 | * @param int $form_id The form ID. |
1318 | 1318 | */ |
1319 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1319 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1320 | 1320 | ?> |
1321 | 1321 | </fieldset><!--end #give-login-fields--> |
1322 | 1322 | <?php |
1323 | 1323 | echo ob_get_clean(); |
1324 | 1324 | } |
1325 | 1325 | |
1326 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1326 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1327 | 1327 | |
1328 | 1328 | /** |
1329 | 1329 | * Payment Mode Select. |
@@ -1339,9 +1339,9 @@ discard block |
||
1339 | 1339 | * |
1340 | 1340 | * @return void |
1341 | 1341 | */ |
1342 | -function give_payment_mode_select( $form_id ) { |
|
1342 | +function give_payment_mode_select($form_id) { |
|
1343 | 1343 | |
1344 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1344 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1345 | 1345 | |
1346 | 1346 | /** |
1347 | 1347 | * Fires while selecting payment gateways, before the fields. |
@@ -1350,10 +1350,10 @@ discard block |
||
1350 | 1350 | * |
1351 | 1351 | * @param int $form_id The form ID. |
1352 | 1352 | */ |
1353 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1353 | + do_action('give_payment_mode_top', $form_id); |
|
1354 | 1354 | ?> |
1355 | 1355 | |
1356 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1356 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1357 | 1357 | echo 'style="display: none;"'; |
1358 | 1358 | } ?>> |
1359 | 1359 | <?php |
@@ -1364,10 +1364,10 @@ discard block |
||
1364 | 1364 | * |
1365 | 1365 | * @param int $form_id The form ID. |
1366 | 1366 | */ |
1367 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1367 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1368 | 1368 | ?> |
1369 | 1369 | <legend |
1370 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1370 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1371 | 1371 | <span class="give-loading-text"><span |
1372 | 1372 | class="give-loading-animation"></span> |
1373 | 1373 | </span> |
@@ -1380,26 +1380,26 @@ discard block |
||
1380 | 1380 | * |
1381 | 1381 | * @since 1.7 |
1382 | 1382 | */ |
1383 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1383 | + do_action('give_payment_mode_before_gateways') |
|
1384 | 1384 | ?> |
1385 | 1385 | <ul id="give-gateway-radio-list"> |
1386 | 1386 | <?php |
1387 | 1387 | /** |
1388 | 1388 | * Loop through the active payment gateways. |
1389 | 1389 | */ |
1390 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1390 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1391 | 1391 | |
1392 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1392 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1393 | 1393 | //Determine the default gateway. |
1394 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1394 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1395 | 1395 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
1396 | 1396 | <li<?php echo $checked_class ?>> |
1397 | 1397 | <input type="radio" name="payment-mode" class="give-gateway" |
1398 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1399 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1400 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1398 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1399 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1400 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1401 | 1401 | class="give-gateway-option" |
1402 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
1402 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
1403 | 1403 | </li> |
1404 | 1404 | <?php |
1405 | 1405 | endforeach; |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | * |
1412 | 1412 | * @since 1.7 |
1413 | 1413 | */ |
1414 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1414 | + do_action('give_payment_mode_after_gateways'); |
|
1415 | 1415 | ?> |
1416 | 1416 | </div> |
1417 | 1417 | <?php |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | * |
1423 | 1423 | * @param int $form_id The form ID. |
1424 | 1424 | */ |
1425 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1425 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1426 | 1426 | ?> |
1427 | 1427 | </fieldset> |
1428 | 1428 | |
@@ -1434,7 +1434,7 @@ discard block |
||
1434 | 1434 | * |
1435 | 1435 | * @param int $form_id The form ID. |
1436 | 1436 | */ |
1437 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1437 | + do_action('give_payment_mode_bottom', $form_id); |
|
1438 | 1438 | ?> |
1439 | 1439 | |
1440 | 1440 | <div id="give_purchase_form_wrap"> |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | * |
1446 | 1446 | * @since 1.7 |
1447 | 1447 | */ |
1448 | - do_action( 'give_donation_form', $form_id ); |
|
1448 | + do_action('give_donation_form', $form_id); |
|
1449 | 1449 | ?> |
1450 | 1450 | |
1451 | 1451 | </div> |
@@ -1456,10 +1456,10 @@ discard block |
||
1456 | 1456 | * |
1457 | 1457 | * @since 1.7 |
1458 | 1458 | */ |
1459 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1459 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1462 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1463 | 1463 | |
1464 | 1464 | /** |
1465 | 1465 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1472,31 +1472,31 @@ discard block |
||
1472 | 1472 | * |
1473 | 1473 | * @return bool |
1474 | 1474 | */ |
1475 | -function give_terms_agreement( $form_id ) { |
|
1476 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1475 | +function give_terms_agreement($form_id) { |
|
1476 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1477 | 1477 | |
1478 | 1478 | // Bailout if per form and global term and conditions is not setup. |
1479 | 1479 | if ( |
1480 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1481 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1480 | + give_is_setting_enabled($form_option, 'global') |
|
1481 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1482 | 1482 | ) { |
1483 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1484 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
1485 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
1483 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1484 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
1485 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
1486 | 1486 | |
1487 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1488 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
1489 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
1490 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
1487 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1488 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
1489 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
1490 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
1491 | 1491 | |
1492 | 1492 | } else { |
1493 | 1493 | return false; |
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | // Bailout: Check if term and conditions text is empty or not. |
1497 | - if ( empty( $terms ) ) { |
|
1498 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
1499 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
1497 | + if (empty($terms)) { |
|
1498 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
1499 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
1500 | 1500 | } |
1501 | 1501 | |
1502 | 1502 | return false; |
@@ -1504,7 +1504,7 @@ discard block |
||
1504 | 1504 | |
1505 | 1505 | ?> |
1506 | 1506 | <fieldset id="give_terms_agreement"> |
1507 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1507 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1508 | 1508 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1509 | 1509 | <?php |
1510 | 1510 | /** |
@@ -1512,22 +1512,22 @@ discard block |
||
1512 | 1512 | * |
1513 | 1513 | * @since 1.0 |
1514 | 1514 | */ |
1515 | - do_action( 'give_before_terms' ); |
|
1515 | + do_action('give_before_terms'); |
|
1516 | 1516 | |
1517 | - echo wpautop( stripslashes( $terms ) ); |
|
1517 | + echo wpautop(stripslashes($terms)); |
|
1518 | 1518 | /** |
1519 | 1519 | * Fires while rendering terms of agreement, after the fields. |
1520 | 1520 | * |
1521 | 1521 | * @since 1.0 |
1522 | 1522 | */ |
1523 | - do_action( 'give_after_terms' ); |
|
1523 | + do_action('give_after_terms'); |
|
1524 | 1524 | ?> |
1525 | 1525 | </div> |
1526 | 1526 | <div id="give_show_terms"> |
1527 | 1527 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1528 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1528 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1529 | 1529 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1530 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1530 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1531 | 1531 | </div> |
1532 | 1532 | |
1533 | 1533 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | <?php |
1539 | 1539 | } |
1540 | 1540 | |
1541 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1541 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1542 | 1542 | |
1543 | 1543 | /** |
1544 | 1544 | * Checkout Final Total. |
@@ -1551,29 +1551,29 @@ discard block |
||
1551 | 1551 | * |
1552 | 1552 | * @return void |
1553 | 1553 | */ |
1554 | -function give_checkout_final_total( $form_id ) { |
|
1554 | +function give_checkout_final_total($form_id) { |
|
1555 | 1555 | |
1556 | - if ( isset( $_POST['give_total'] ) ) { |
|
1557 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1556 | + if (isset($_POST['give_total'])) { |
|
1557 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1558 | 1558 | } else { |
1559 | 1559 | //default total. |
1560 | - $total = give_get_default_form_amount( $form_id ); |
|
1560 | + $total = give_get_default_form_amount($form_id); |
|
1561 | 1561 | } |
1562 | 1562 | //Only proceed if give_total available. |
1563 | - if ( empty( $total ) ) { |
|
1563 | + if (empty($total)) { |
|
1564 | 1564 | return; |
1565 | 1565 | } |
1566 | 1566 | ?> |
1567 | 1567 | <p id="give-final-total-wrap" class="form-wrap "> |
1568 | 1568 | <span |
1569 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1569 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1570 | 1570 | <span class="give-final-total-amount" |
1571 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1571 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1572 | 1572 | </p> |
1573 | 1573 | <?php |
1574 | 1574 | } |
1575 | 1575 | |
1576 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1576 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1577 | 1577 | |
1578 | 1578 | /** |
1579 | 1579 | * Renders the Checkout Submit section. |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | * |
1585 | 1585 | * @return void |
1586 | 1586 | */ |
1587 | -function give_checkout_submit( $form_id ) { |
|
1587 | +function give_checkout_submit($form_id) { |
|
1588 | 1588 | ?> |
1589 | 1589 | <fieldset id="give_purchase_submit"> |
1590 | 1590 | <?php |
@@ -1593,24 +1593,24 @@ discard block |
||
1593 | 1593 | * |
1594 | 1594 | * @since 1.7 |
1595 | 1595 | */ |
1596 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1596 | + do_action('give_donation_form_before_submit', $form_id); |
|
1597 | 1597 | |
1598 | - give_checkout_hidden_fields( $form_id ); |
|
1598 | + give_checkout_hidden_fields($form_id); |
|
1599 | 1599 | |
1600 | - echo give_get_donation_form_submit_button( $form_id ); |
|
1600 | + echo give_get_donation_form_submit_button($form_id); |
|
1601 | 1601 | |
1602 | 1602 | /** |
1603 | 1603 | * Fire after donation form submit. |
1604 | 1604 | * |
1605 | 1605 | * @since 1.7 |
1606 | 1606 | */ |
1607 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1607 | + do_action('give_donation_form_after_submit', $form_id); |
|
1608 | 1608 | ?> |
1609 | 1609 | </fieldset> |
1610 | 1610 | <?php |
1611 | 1611 | } |
1612 | 1612 | |
1613 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1613 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1614 | 1614 | |
1615 | 1615 | /** |
1616 | 1616 | * Give Donation form submit button. |
@@ -1621,10 +1621,10 @@ discard block |
||
1621 | 1621 | * |
1622 | 1622 | * @return string |
1623 | 1623 | */ |
1624 | -function give_get_donation_form_submit_button( $form_id ) { |
|
1624 | +function give_get_donation_form_submit_button($form_id) { |
|
1625 | 1625 | |
1626 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
1627 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1626 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
1627 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1628 | 1628 | ob_start(); |
1629 | 1629 | ?> |
1630 | 1630 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | <span class="give-loading-animation"></span> |
1633 | 1633 | </div> |
1634 | 1634 | <?php |
1635 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
1635 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
1636 | 1636 | } |
1637 | 1637 | |
1638 | 1638 | /** |
@@ -1647,17 +1647,17 @@ discard block |
||
1647 | 1647 | * |
1648 | 1648 | * @return mixed |
1649 | 1649 | */ |
1650 | -function give_show_goal_progress( $form_id, $args ) { |
|
1650 | +function give_show_goal_progress($form_id, $args) { |
|
1651 | 1651 | |
1652 | 1652 | ob_start(); |
1653 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1653 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1654 | 1654 | |
1655 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1655 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1656 | 1656 | |
1657 | 1657 | return true; |
1658 | 1658 | } |
1659 | 1659 | |
1660 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1660 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1661 | 1661 | |
1662 | 1662 | |
1663 | 1663 | /** |
@@ -1670,10 +1670,10 @@ discard block |
||
1670 | 1670 | * |
1671 | 1671 | * @return mixed|string |
1672 | 1672 | */ |
1673 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1673 | +function give_get_form_content_placement($form_id, $args) { |
|
1674 | 1674 | $show_content = ''; |
1675 | 1675 | |
1676 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1676 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1677 | 1677 | // Content positions. |
1678 | 1678 | $content_placement = array( |
1679 | 1679 | 'above' => 'give_pre_form', |
@@ -1681,18 +1681,18 @@ discard block |
||
1681 | 1681 | ); |
1682 | 1682 | |
1683 | 1683 | // Check if content position already decoded. |
1684 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1684 | + if (in_array($args['show_content'], $content_placement)) { |
|
1685 | 1685 | return $args['show_content']; |
1686 | 1686 | } |
1687 | 1687 | |
1688 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1688 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1689 | 1689 | |
1690 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1691 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
1690 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
1691 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
1692 | 1692 | |
1693 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
1693 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
1694 | 1694 | // Backward compatibility for _give_content_option for v18. |
1695 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
1695 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | return $show_content; |
@@ -1708,20 +1708,20 @@ discard block |
||
1708 | 1708 | * |
1709 | 1709 | * @return void|bool |
1710 | 1710 | */ |
1711 | -function give_form_content( $form_id, $args ) { |
|
1711 | +function give_form_content($form_id, $args) { |
|
1712 | 1712 | |
1713 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1713 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1714 | 1714 | |
1715 | 1715 | // Bailout. |
1716 | - if ( empty( $show_content ) ) { |
|
1716 | + if (empty($show_content)) { |
|
1717 | 1717 | return false; |
1718 | 1718 | } |
1719 | 1719 | |
1720 | 1720 | // Add action according to value. |
1721 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1721 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1722 | 1722 | } |
1723 | 1723 | |
1724 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1724 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1725 | 1725 | |
1726 | 1726 | /** |
1727 | 1727 | * Renders Post Form Content. |
@@ -1735,22 +1735,22 @@ discard block |
||
1735 | 1735 | * |
1736 | 1736 | * @return void |
1737 | 1737 | */ |
1738 | -function give_form_display_content( $form_id, $args ) { |
|
1738 | +function give_form_display_content($form_id, $args) { |
|
1739 | 1739 | |
1740 | - $content = wpautop( give_get_meta( $form_id, '_give_form_content', true ) ); |
|
1741 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1740 | + $content = wpautop(give_get_meta($form_id, '_give_form_content', true)); |
|
1741 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1742 | 1742 | |
1743 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1744 | - $content = apply_filters( 'the_content', $content ); |
|
1743 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1744 | + $content = apply_filters('the_content', $content); |
|
1745 | 1745 | } |
1746 | 1746 | |
1747 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
1747 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
1748 | 1748 | |
1749 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1749 | + echo apply_filters('give_form_content_output', $output); |
|
1750 | 1750 | |
1751 | 1751 | //remove action to prevent content output on addition forms on page. |
1752 | 1752 | //@see: https://github.com/WordImpress/Give/issues/634. |
1753 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1753 | + remove_action($show_content, 'give_form_display_content'); |
|
1754 | 1754 | } |
1755 | 1755 | |
1756 | 1756 | /** |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | * |
1763 | 1763 | * @return void |
1764 | 1764 | */ |
1765 | -function give_checkout_hidden_fields( $form_id ) { |
|
1765 | +function give_checkout_hidden_fields($form_id) { |
|
1766 | 1766 | |
1767 | 1767 | /** |
1768 | 1768 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1771,13 +1771,13 @@ discard block |
||
1771 | 1771 | * |
1772 | 1772 | * @param int $form_id The form ID. |
1773 | 1773 | */ |
1774 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1774 | + do_action('give_hidden_fields_before', $form_id); |
|
1775 | 1775 | |
1776 | - if ( is_user_logged_in() ) { ?> |
|
1776 | + if (is_user_logged_in()) { ?> |
|
1777 | 1777 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1778 | 1778 | <?php } ?> |
1779 | 1779 | <input type="hidden" name="give_action" value="purchase"/> |
1780 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1780 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1781 | 1781 | <?php |
1782 | 1782 | /** |
1783 | 1783 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1786,7 +1786,7 @@ discard block |
||
1786 | 1786 | * |
1787 | 1787 | * @param int $form_id The form ID. |
1788 | 1788 | */ |
1789 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1789 | + do_action('give_hidden_fields_after', $form_id); |
|
1790 | 1790 | |
1791 | 1791 | } |
1792 | 1792 | |
@@ -1801,20 +1801,20 @@ discard block |
||
1801 | 1801 | * |
1802 | 1802 | * @return string $content Filtered content. |
1803 | 1803 | */ |
1804 | -function give_filter_success_page_content( $content ) { |
|
1804 | +function give_filter_success_page_content($content) { |
|
1805 | 1805 | |
1806 | 1806 | $give_options = give_get_settings(); |
1807 | 1807 | |
1808 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1809 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1810 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1808 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1809 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1810 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1811 | 1811 | } |
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | return $content; |
1815 | 1815 | } |
1816 | 1816 | |
1817 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1817 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1818 | 1818 | |
1819 | 1819 | /** |
1820 | 1820 | * Test Mode Frontend Warning. |
@@ -1825,12 +1825,12 @@ discard block |
||
1825 | 1825 | */ |
1826 | 1826 | function give_test_mode_frontend_warning() { |
1827 | 1827 | |
1828 | - if ( give_is_test_mode() ) { |
|
1829 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
1828 | + if (give_is_test_mode()) { |
|
1829 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
1830 | 1830 | } |
1831 | 1831 | } |
1832 | 1832 | |
1833 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1833 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1834 | 1834 | |
1835 | 1835 | /** |
1836 | 1836 | * Members-only Form. |
@@ -1844,21 +1844,21 @@ discard block |
||
1844 | 1844 | * |
1845 | 1845 | * @return string |
1846 | 1846 | */ |
1847 | -function give_members_only_form( $final_output, $args ) { |
|
1847 | +function give_members_only_form($final_output, $args) { |
|
1848 | 1848 | |
1849 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1849 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1850 | 1850 | |
1851 | 1851 | //Sanity Check: Must have form_id & not be logged in. |
1852 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1852 | + if (empty($form_id) || is_user_logged_in()) { |
|
1853 | 1853 | return $final_output; |
1854 | 1854 | } |
1855 | 1855 | |
1856 | 1856 | //Logged in only and Register / Login set to none. |
1857 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1857 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1858 | 1858 | |
1859 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1859 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1860 | 1860 | |
1861 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1861 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1862 | 1862 | |
1863 | 1863 | } |
1864 | 1864 | |
@@ -1866,4 +1866,4 @@ discard block |
||
1866 | 1866 | |
1867 | 1867 | } |
1868 | 1868 | |
1869 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1869 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 1.8.7 |
222 | 222 | */ |
223 | - do_action( 'give_init', self::$instance ); |
|
223 | + do_action('give_init', self::$instance); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function __clone() { |
242 | 242 | // Cloning instances of the class is forbidden |
243 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
243 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function __wakeup() { |
255 | 255 | // Unserializing instances of the class is forbidden. |
256 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
256 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -267,33 +267,33 @@ discard block |
||
267 | 267 | private function setup_constants() { |
268 | 268 | |
269 | 269 | // Plugin version |
270 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
271 | - define( 'GIVE_VERSION', '1.8.8' ); |
|
270 | + if ( ! defined('GIVE_VERSION')) { |
|
271 | + define('GIVE_VERSION', '1.8.8'); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | // Plugin Folder Path |
275 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
276 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
275 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
276 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // Plugin Folder URL |
280 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
281 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
280 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
281 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // Plugin Basename aka: "give/give.php" |
285 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
286 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
285 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
286 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Plugin Root File |
290 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
291 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
290 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
291 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Make sure CAL_GREGORIAN is defined |
295 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
296 | - define( 'CAL_GREGORIAN', 1 ); |
|
295 | + if ( ! defined('CAL_GREGORIAN')) { |
|
296 | + define('CAL_GREGORIAN', 1); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -308,127 +308,127 @@ discard block |
||
308 | 308 | private function includes() { |
309 | 309 | global $give_options; |
310 | 310 | |
311 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
313 | 313 | $give_options = give_get_settings(); |
314 | 314 | |
315 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
323 | - |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
338 | - |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
356 | - |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
362 | - |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
368 | - |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
374 | - |
|
375 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
323 | + |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
338 | + |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
356 | + |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
362 | + |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
368 | + |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
374 | + |
|
375 | + if (defined('WP_CLI') && WP_CLI) { |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
380 | - |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
393 | - |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
396 | - |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
400 | - |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
404 | - |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
409 | - |
|
410 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
412 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
413 | - |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
415 | - |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
420 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
421 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
423 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
424 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
425 | - |
|
426 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
427 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
379 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
380 | + |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
393 | + |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
396 | + |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
400 | + |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
404 | + |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
409 | + |
|
410 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
413 | + |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
415 | + |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
420 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
421 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
423 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
424 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
425 | + |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
427 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
428 | 428 | |
429 | 429 | } |
430 | 430 | |
431 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
431 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
432 | 432 | |
433 | 433 | } |
434 | 434 | |
@@ -442,26 +442,26 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function load_textdomain() { |
444 | 444 | // Set filter for Give's languages directory |
445 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
446 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
445 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
446 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
447 | 447 | |
448 | 448 | // Traditional WordPress plugin locale filter |
449 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
450 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
449 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
450 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
451 | 451 | |
452 | 452 | // Setup paths to current locale file |
453 | - $mofile_local = $give_lang_dir . $mofile; |
|
454 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
453 | + $mofile_local = $give_lang_dir.$mofile; |
|
454 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
455 | 455 | |
456 | - if ( file_exists( $mofile_global ) ) { |
|
456 | + if (file_exists($mofile_global)) { |
|
457 | 457 | // Look in global /wp-content/languages/give folder |
458 | - load_textdomain( 'give', $mofile_global ); |
|
459 | - } elseif ( file_exists( $mofile_local ) ) { |
|
458 | + load_textdomain('give', $mofile_global); |
|
459 | + } elseif (file_exists($mofile_local)) { |
|
460 | 460 | // Look in local location from filter `give_languages_directory` |
461 | - load_textdomain( 'give', $mofile_local ); |
|
461 | + load_textdomain('give', $mofile_local); |
|
462 | 462 | } else { |
463 | 463 | // Load the default language files packaged up w/ Give |
464 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
464 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 |
@@ -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 | |
@@ -62,50 +62,50 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return bool If the gravatar exists or not |
64 | 64 | */ |
65 | - public function validate_gravatar( $id_or_email ) { |
|
65 | + public function validate_gravatar($id_or_email) { |
|
66 | 66 | //id or email code borrowed from wp-includes/pluggable.php |
67 | 67 | $email = ''; |
68 | - if ( is_numeric( $id_or_email ) ) { |
|
68 | + if (is_numeric($id_or_email)) { |
|
69 | 69 | $id = (int) $id_or_email; |
70 | - $user = get_userdata( $id ); |
|
71 | - if ( $user ) { |
|
70 | + $user = get_userdata($id); |
|
71 | + if ($user) { |
|
72 | 72 | $email = $user->user_email; |
73 | 73 | } |
74 | - } elseif ( is_object( $id_or_email ) ) { |
|
74 | + } elseif (is_object($id_or_email)) { |
|
75 | 75 | // No avatar for pingbacks or trackbacks |
76 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
77 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
76 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
77 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
81 | + if ( ! empty($id_or_email->user_id)) { |
|
82 | 82 | $id = (int) $id_or_email->user_id; |
83 | - $user = get_userdata( $id ); |
|
84 | - if ( $user ) { |
|
83 | + $user = get_userdata($id); |
|
84 | + if ($user) { |
|
85 | 85 | $email = $user->user_email; |
86 | 86 | } |
87 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
87 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
88 | 88 | $email = $id_or_email->comment_author_email; |
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | $email = $id_or_email; |
92 | 92 | } |
93 | 93 | |
94 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
95 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
94 | + $hashkey = md5(strtolower(trim($email))); |
|
95 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
96 | 96 | |
97 | - $data = wp_cache_get( $hashkey ); |
|
98 | - if ( false === $data ) { |
|
99 | - $response = wp_remote_head( $uri ); |
|
100 | - if ( is_wp_error( $response ) ) { |
|
97 | + $data = wp_cache_get($hashkey); |
|
98 | + if (false === $data) { |
|
99 | + $response = wp_remote_head($uri); |
|
100 | + if (is_wp_error($response)) { |
|
101 | 101 | $data = 'not200'; |
102 | 102 | } else { |
103 | 103 | $data = $response['response']['code']; |
104 | 104 | } |
105 | - wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
105 | + wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5); |
|
106 | 106 | |
107 | 107 | } |
108 | - if ( $data == '200' ) { |
|
108 | + if ($data == '200') { |
|
109 | 109 | return true; |
110 | 110 | } else { |
111 | 111 | return false; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array IDs if logs, false otherwise |
124 | 124 | */ |
125 | - public function get_log_ids( $form_id = '' ) { |
|
125 | + public function get_log_ids($form_id = '') { |
|
126 | 126 | |
127 | 127 | // get Give_Logging class |
128 | 128 | global $give_logs; |
129 | 129 | |
130 | 130 | // get log for this form |
131 | - $logs = $give_logs->get_logs( $form_id ); |
|
131 | + $logs = $give_logs->get_logs($form_id); |
|
132 | 132 | |
133 | - if ( $logs ) { |
|
133 | + if ($logs) { |
|
134 | 134 | $log_ids = array(); |
135 | 135 | |
136 | 136 | // make an array with all the donor IDs |
137 | - foreach ( $logs as $log ) { |
|
137 | + foreach ($logs as $log) { |
|
138 | 138 | $log_ids[] = $log->ID; |
139 | 139 | } |
140 | 140 | |
@@ -155,51 +155,51 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return mixed |
157 | 157 | */ |
158 | - public function get_payment_ids( $form_id = '' ) { |
|
158 | + public function get_payment_ids($form_id = '') { |
|
159 | 159 | |
160 | 160 | $give_options = give_get_settings(); |
161 | 161 | |
162 | - $log_ids = $this->get_log_ids( $form_id ); |
|
162 | + $log_ids = $this->get_log_ids($form_id); |
|
163 | 163 | |
164 | - if ( $log_ids ) { |
|
164 | + if ($log_ids) { |
|
165 | 165 | |
166 | 166 | $payment_ids = array(); |
167 | 167 | |
168 | - foreach ( $log_ids as $id ) { |
|
168 | + foreach ($log_ids as $id) { |
|
169 | 169 | // get the payment ID for each corresponding log ID |
170 | - $payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true ); |
|
170 | + $payment_ids[] = give_get_meta($id, '_give_log_payment_id', true); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // remove donors who have donated more than once so we can have unique avatars |
174 | 174 | $unique_emails = array(); |
175 | 175 | |
176 | - foreach ( $payment_ids as $key => $id ) { |
|
176 | + foreach ($payment_ids as $key => $id) { |
|
177 | 177 | |
178 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
178 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
179 | 179 | |
180 | - if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) { |
|
181 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
180 | + if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) { |
|
181 | + if ( ! $this->validate_gravatar($email)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - $unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true ); |
|
186 | + $unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | 190 | $unique_ids = array(); |
191 | 191 | |
192 | 192 | // strip duplicate emails |
193 | - $unique_emails = array_unique( $unique_emails ); |
|
193 | + $unique_emails = array_unique($unique_emails); |
|
194 | 194 | |
195 | 195 | // convert the unique IDs back into simple array |
196 | - foreach ( $unique_emails as $id => $email ) { |
|
196 | + foreach ($unique_emails as $id => $email) { |
|
197 | 197 | $unique_ids[] = $id; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // randomize the payment IDs if enabled |
201 | - if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) { |
|
202 | - shuffle( $unique_ids ); |
|
201 | + if (isset($give_options['give_donors_gravatars_random_gravatars'])) { |
|
202 | + shuffle($unique_ids); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // return our unique IDs |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function gravatars( $form_id = false, $title = '' ) { |
|
223 | + public function gravatars($form_id = false, $title = '') { |
|
224 | 224 | |
225 | 225 | // unique $payment_ids |
226 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
226 | + $payment_ids = $this->get_payment_ids($form_id); |
|
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // return if no ID |
231 | - if ( ! $form_id ) { |
|
231 | + if ( ! $form_id) { |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | |
235 | 235 | // minimum amount of donations before showing gravatars |
236 | 236 | // if the number of items in array is not greater or equal to the number specified, then exit |
237 | - if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) { |
|
238 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) { |
|
237 | + if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) { |
|
238 | + if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | } |
@@ -246,51 +246,51 @@ discard block |
||
246 | 246 | echo '<div id="give-purchase-gravatars">'; |
247 | 247 | |
248 | 248 | |
249 | - if ( isset ( $title ) ) { |
|
249 | + if (isset ($title)) { |
|
250 | 250 | |
251 | - if ( $title ) { |
|
252 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
253 | - } elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) { |
|
254 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ); |
|
251 | + if ($title) { |
|
252 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
253 | + } elseif (isset($give_options['give_donors_gravatars_heading'])) { |
|
254 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | } |
258 | 258 | echo '<ul class="give-purchase-gravatars-list">'; |
259 | 259 | $i = 0; |
260 | 260 | |
261 | - if ( $payment_ids ) { |
|
262 | - foreach ( $payment_ids as $id ) { |
|
261 | + if ($payment_ids) { |
|
262 | + foreach ($payment_ids as $id) { |
|
263 | 263 | |
264 | 264 | // Give saves a blank option even when the control is turned off, hence the extra check |
265 | - if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) { |
|
265 | + if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // get the payment meta |
270 | - $payment_meta = give_get_meta( $id, '_give_payment_meta', true ); |
|
270 | + $payment_meta = give_get_meta($id, '_give_payment_meta', true); |
|
271 | 271 | |
272 | 272 | // unserialize the payment meta |
273 | - $user_info = maybe_unserialize( $payment_meta['user_info'] ); |
|
273 | + $user_info = maybe_unserialize($payment_meta['user_info']); |
|
274 | 274 | |
275 | 275 | // get donor's first name |
276 | 276 | $name = $user_info['first_name']; |
277 | 277 | |
278 | 278 | // get donor's email |
279 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
279 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
280 | 280 | |
281 | 281 | // set gravatar size and provide filter |
282 | - $size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : ''; |
|
282 | + $size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : ''; |
|
283 | 283 | |
284 | 284 | // default image |
285 | - $default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false ); |
|
285 | + $default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false); |
|
286 | 286 | |
287 | 287 | // assemble output |
288 | 288 | $output .= '<li>'; |
289 | 289 | |
290 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
290 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
291 | 291 | $output .= '</li>'; |
292 | 292 | |
293 | - $i ++; |
|
293 | + $i++; |
|
294 | 294 | |
295 | 295 | } // end foreach |
296 | 296 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | echo '</ul>'; |
300 | 300 | echo '</div>'; |
301 | 301 | |
302 | - return apply_filters( 'give_donors_gravatars', ob_get_clean() ); |
|
302 | + return apply_filters('give_donors_gravatars', ob_get_clean()); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @return void |
312 | 312 | */ |
313 | 313 | public function register_widget() { |
314 | - register_widget( 'Give_Donors_Gravatars_Widget' ); |
|
314 | + register_widget('Give_Donors_Gravatars_Widget'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -325,19 +325,19 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return string |
327 | 327 | */ |
328 | - public function shortcode( $atts, $content = null ) { |
|
328 | + public function shortcode($atts, $content = null) { |
|
329 | 329 | |
330 | - $atts = shortcode_atts( array( |
|
330 | + $atts = shortcode_atts(array( |
|
331 | 331 | 'id' => '', |
332 | 332 | 'title' => '' |
333 | - ), $atts, 'give_donors_gravatars' ); |
|
333 | + ), $atts, 'give_donors_gravatars'); |
|
334 | 334 | |
335 | 335 | // if no ID is passed on single give_forms pages, get the correct ID |
336 | - if ( is_singular( 'give_forms' ) ) { |
|
336 | + if (is_singular('give_forms')) { |
|
337 | 337 | $id = get_the_ID(); |
338 | 338 | } |
339 | 339 | |
340 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
340 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
341 | 341 | |
342 | 342 | return $content; |
343 | 343 | |
@@ -353,56 +353,56 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return array Gravatar settings. |
355 | 355 | */ |
356 | - public function settings( $settings ) { |
|
356 | + public function settings($settings) { |
|
357 | 357 | |
358 | 358 | $give_gravatar_settings = array( |
359 | 359 | array( |
360 | - 'name' => esc_html__( 'Donator Gravatars', 'give' ), |
|
360 | + 'name' => esc_html__('Donator Gravatars', 'give'), |
|
361 | 361 | 'desc' => '<hr>', |
362 | 362 | 'id' => 'give_title', |
363 | 363 | 'type' => 'give_title' |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => esc_html__( 'Heading', 'give' ), |
|
367 | - 'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ), |
|
366 | + 'name' => esc_html__('Heading', 'give'), |
|
367 | + 'desc' => esc_html__('The heading to display above the Gravatars.', 'give'), |
|
368 | 368 | 'type' => 'text', |
369 | 369 | 'id' => 'give_donors_gravatars_heading' |
370 | 370 | ), |
371 | 371 | array( |
372 | - 'name' => esc_html__( 'Gravatar Size', 'give' ), |
|
373 | - 'desc' => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ), |
|
372 | + 'name' => esc_html__('Gravatar Size', 'give'), |
|
373 | + 'desc' => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'), |
|
374 | 374 | 'type' => 'text_small', |
375 | 375 | 'id' => 'give_donors_gravatars_gravatar_size', |
376 | 376 | 'default' => '64' |
377 | 377 | ), |
378 | 378 | array( |
379 | - 'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ), |
|
380 | - 'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), |
|
379 | + 'name' => esc_html__('Minimum Unique Donations Required', 'give'), |
|
380 | + 'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), |
|
381 | 381 | 'type' => 'text_small', |
382 | 382 | 'id' => 'give_donors_gravatars_min_purchases_required', |
383 | 383 | ), |
384 | 384 | array( |
385 | - 'name' => esc_html__( 'Maximum Gravatars To Show', 'give' ), |
|
386 | - 'desc' => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
385 | + 'name' => esc_html__('Maximum Gravatars To Show', 'give'), |
|
386 | + 'desc' => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
387 | 387 | 'type' => 'text', |
388 | 388 | 'id' => 'give_donors_gravatars_maximum_number', |
389 | 389 | 'default' => '20', |
390 | 390 | ), |
391 | 391 | array( |
392 | - 'name' => esc_html__( 'Gravatar Visibility', 'give' ), |
|
393 | - 'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ), |
|
392 | + 'name' => esc_html__('Gravatar Visibility', 'give'), |
|
393 | + 'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'), |
|
394 | 394 | 'id' => 'give_donors_gravatars_has_gravatar_account', |
395 | 395 | 'type' => 'checkbox', |
396 | 396 | ), |
397 | 397 | array( |
398 | - 'name' => esc_html__( 'Randomize Gravatars', 'give' ), |
|
399 | - 'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ), |
|
398 | + 'name' => esc_html__('Randomize Gravatars', 'give'), |
|
399 | + 'desc' => esc_html__('Randomize the Gravatars.', 'give'), |
|
400 | 400 | 'id' => 'give_donors_gravatars_random_gravatars', |
401 | 401 | 'type' => 'checkbox', |
402 | 402 | ), |
403 | 403 | ); |
404 | 404 | |
405 | - return array_merge( $settings, $give_gravatar_settings ); |
|
405 | + return array_merge($settings, $give_gravatar_settings); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | // widget settings |
429 | 429 | $widget_ops = array( |
430 | 430 | 'classname' => 'give-donors-gravatars', |
431 | - 'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ), |
|
431 | + 'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | 434 | // widget control settings |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | // create the widget |
442 | 442 | parent::__construct( |
443 | 443 | 'give_donors_gravatars_widget', |
444 | - esc_html__( 'Give Donors Gravatars', 'give' ), |
|
444 | + esc_html__('Give Donors Gravatars', 'give'), |
|
445 | 445 | $widget_ops, |
446 | 446 | $control_ops |
447 | 447 | ); |
@@ -461,29 +461,29 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return void |
463 | 463 | */ |
464 | - public function widget( $args, $instance ) { |
|
464 | + public function widget($args, $instance) { |
|
465 | 465 | |
466 | 466 | //@TODO: Don't extract it!!! |
467 | - extract( $args ); |
|
467 | + extract($args); |
|
468 | 468 | |
469 | - if ( ! is_singular( 'give_forms' ) ) { |
|
469 | + if ( ! is_singular('give_forms')) { |
|
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
473 | 473 | // Variables from widget settings |
474 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
474 | + $title = apply_filters('widget_title', $instance['title']); |
|
475 | 475 | |
476 | 476 | // Used by themes. Opens the widget |
477 | 477 | echo $before_widget; |
478 | 478 | |
479 | 479 | // Display the widget title |
480 | - if ( $title ) { |
|
481 | - echo $before_title . $title . $after_title; |
|
480 | + if ($title) { |
|
481 | + echo $before_title.$title.$after_title; |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | $gravatars = new Give_Donors_Gravatars(); |
485 | 485 | |
486 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
486 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
487 | 487 | |
488 | 488 | // Used by themes. Closes the widget |
489 | 489 | echo $after_widget; |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return array Updated settings to save. |
505 | 505 | */ |
506 | - public function update( $new_instance, $old_instance ) { |
|
506 | + public function update($new_instance, $old_instance) { |
|
507 | 507 | |
508 | 508 | $instance = $old_instance; |
509 | 509 | |
510 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
510 | + $instance['title'] = strip_tags($new_instance['title']); |
|
511 | 511 | |
512 | 512 | return $instance; |
513 | 513 | |
@@ -525,19 +525,19 @@ discard block |
||
525 | 525 | * |
526 | 526 | * @return void |
527 | 527 | */ |
528 | - public function form( $instance ) { |
|
528 | + public function form($instance) { |
|
529 | 529 | |
530 | 530 | // Set up some default widget settings. |
531 | 531 | $defaults = array( |
532 | 532 | 'title' => '', |
533 | 533 | ); |
534 | 534 | |
535 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
535 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
536 | 536 | |
537 | 537 | <!-- Title --> |
538 | 538 | <p> |
539 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label> |
|
540 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
539 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label> |
|
540 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
541 | 541 | </p> |
542 | 542 | |
543 | 543 | <?php |
@@ -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 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param bool $_id Post id. Default is false. |
338 | 338 | * @param array $_args Arguments passed. |
339 | 339 | */ |
340 | - public function __construct( $_id = false, $_args = array() ) { |
|
340 | + public function __construct($_id = false, $_args = array()) { |
|
341 | 341 | |
342 | - $donation_form = WP_Post::get_instance( $_id ); |
|
342 | + $donation_form = WP_Post::get_instance($_id); |
|
343 | 343 | |
344 | - return $this->setup_donation_form( $donation_form ); |
|
344 | + return $this->setup_donation_form($donation_form); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -354,23 +354,23 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return bool If the setup was successful or not. |
356 | 356 | */ |
357 | - private function setup_donation_form( $donation_form ) { |
|
357 | + private function setup_donation_form($donation_form) { |
|
358 | 358 | |
359 | - if ( ! is_object( $donation_form ) ) { |
|
359 | + if ( ! is_object($donation_form)) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | |
363 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
363 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
367 | + if ('give_forms' !== $donation_form->post_type) { |
|
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | |
371 | - foreach ( $donation_form as $key => $value ) { |
|
371 | + foreach ($donation_form as $key => $value) { |
|
372 | 372 | |
373 | - switch ( $key ) { |
|
373 | + switch ($key) { |
|
374 | 374 | |
375 | 375 | default: |
376 | 376 | $this->$key = $value; |
@@ -394,16 +394,16 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return mixed |
396 | 396 | */ |
397 | - public function __get( $key ) { |
|
397 | + public function __get($key) { |
|
398 | 398 | |
399 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
399 | + if (method_exists($this, 'get_'.$key)) { |
|
400 | 400 | |
401 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
401 | + return call_user_func(array($this, 'get_'.$key)); |
|
402 | 402 | |
403 | 403 | } else { |
404 | 404 | |
405 | 405 | /* translators: %s: property key */ |
406 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
406 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -419,30 +419,30 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
421 | 421 | */ |
422 | - public function create( $data = array() ) { |
|
422 | + public function create($data = array()) { |
|
423 | 423 | |
424 | - if ( $this->id != 0 ) { |
|
424 | + if ($this->id != 0) { |
|
425 | 425 | return false; |
426 | 426 | } |
427 | 427 | |
428 | 428 | $defaults = array( |
429 | 429 | 'post_type' => 'give_forms', |
430 | 430 | 'post_status' => 'draft', |
431 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
431 | + 'post_title' => __('New Donation Form', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | - $args = wp_parse_args( $data, $defaults ); |
|
434 | + $args = wp_parse_args($data, $defaults); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Fired before a donation form is created |
438 | 438 | * |
439 | 439 | * @param array $args The post object arguments used for creation. |
440 | 440 | */ |
441 | - do_action( 'give_form_pre_create', $args ); |
|
441 | + do_action('give_form_pre_create', $args); |
|
442 | 442 | |
443 | - $id = wp_insert_post( $args, true ); |
|
443 | + $id = wp_insert_post($args, true); |
|
444 | 444 | |
445 | - $donation_form = WP_Post::get_instance( $id ); |
|
445 | + $donation_form = WP_Post::get_instance($id); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired after a donation form is created |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | * @param int $id The post ID of the created item. |
451 | 451 | * @param array $args The post object arguments used for creation. |
452 | 452 | */ |
453 | - do_action( 'give_form_post_create', $id, $args ); |
|
453 | + do_action('give_form_post_create', $id, $args); |
|
454 | 454 | |
455 | - return $this->setup_donation_form( $donation_form ); |
|
455 | + return $this->setup_donation_form($donation_form); |
|
456 | 456 | |
457 | 457 | } |
458 | 458 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return string Donation form name. |
478 | 478 | */ |
479 | 479 | public function get_name() { |
480 | - return get_the_title( $this->ID ); |
|
480 | + return get_the_title($this->ID); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -490,13 +490,13 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function get_price() { |
492 | 492 | |
493 | - if ( ! isset( $this->price ) ) { |
|
493 | + if ( ! isset($this->price)) { |
|
494 | 494 | |
495 | - $this->price = give_get_meta( $this->ID, '_give_set_price', true ); |
|
495 | + $this->price = give_get_meta($this->ID, '_give_set_price', true); |
|
496 | 496 | |
497 | - if ( $this->price ) { |
|
497 | + if ($this->price) { |
|
498 | 498 | |
499 | - $this->price = give_sanitize_amount( $this->price ); |
|
499 | + $this->price = give_sanitize_amount($this->price); |
|
500 | 500 | |
501 | 501 | } else { |
502 | 502 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param string $price The donation form price. |
515 | 515 | * @param string|int $id The form ID. |
516 | 516 | */ |
517 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
517 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function get_minimum_price() { |
529 | 529 | |
530 | - if ( ! isset( $this->minimum_price ) ) { |
|
530 | + if ( ! isset($this->minimum_price)) { |
|
531 | 531 | |
532 | - $allow_custom_amount = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
533 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
532 | + $allow_custom_amount = give_get_meta($this->ID, '_give_custom_amount', true); |
|
533 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
534 | 534 | |
535 | - if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) { |
|
535 | + if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) { |
|
536 | 536 | |
537 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
537 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
538 | 538 | |
539 | 539 | } else { |
540 | 540 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | } |
546 | 546 | |
547 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
547 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | */ |
558 | 558 | public function get_prices() { |
559 | 559 | |
560 | - if ( ! isset( $this->prices ) ) { |
|
560 | + if ( ! isset($this->prices)) { |
|
561 | 561 | |
562 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
562 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
563 | 563 | |
564 | 564 | } |
565 | 565 | |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @param array $prices The array of mulit-level prices. |
572 | 572 | * @param int|string $ID The ID of the form. |
573 | 573 | */ |
574 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
574 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
575 | 575 | |
576 | 576 | } |
577 | 577 | |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function get_goal() { |
587 | 587 | |
588 | - if ( ! isset( $this->goal ) ) { |
|
588 | + if ( ! isset($this->goal)) { |
|
589 | 589 | |
590 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
590 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
591 | 591 | |
592 | - if ( $this->goal ) { |
|
592 | + if ($this->goal) { |
|
593 | 593 | |
594 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
594 | + $this->goal = give_sanitize_amount($this->goal); |
|
595 | 595 | |
596 | 596 | } else { |
597 | 597 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | |
602 | 602 | } |
603 | 603 | |
604 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
604 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
605 | 605 | |
606 | 606 | } |
607 | 607 | |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | */ |
616 | 616 | public function is_single_price_mode() { |
617 | 617 | |
618 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
618 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
619 | 619 | $ret = 0; |
620 | 620 | |
621 | - if ( empty( $option ) || $option === 'set' ) { |
|
621 | + if (empty($option) || $option === 'set') { |
|
622 | 622 | $ret = 1; |
623 | 623 | } |
624 | 624 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * @param bool $ret Is donation form in single price mode? |
631 | 631 | * @param int|string $ID The ID of the donation form. |
632 | 632 | */ |
633 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
633 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
634 | 634 | |
635 | 635 | } |
636 | 636 | |
@@ -644,10 +644,10 @@ discard block |
||
644 | 644 | */ |
645 | 645 | public function is_custom_price_mode() { |
646 | 646 | |
647 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
647 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
648 | 648 | $ret = 0; |
649 | 649 | |
650 | - if ( give_is_setting_enabled( $option ) ) { |
|
650 | + if (give_is_setting_enabled($option)) { |
|
651 | 651 | $ret = 1; |
652 | 652 | } |
653 | 653 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * @param bool $ret Is donation form in custom price mode? |
660 | 660 | * @param int|string $ID The ID of the donation form. |
661 | 661 | */ |
662 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
662 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
663 | 663 | |
664 | 664 | } |
665 | 665 | |
@@ -675,10 +675,10 @@ discard block |
||
675 | 675 | */ |
676 | 676 | public function has_variable_prices() { |
677 | 677 | |
678 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
678 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
679 | 679 | $ret = 0; |
680 | 680 | |
681 | - if ( $option === 'multi' ) { |
|
681 | + if ($option === 'multi') { |
|
682 | 682 | $ret = 1; |
683 | 683 | } |
684 | 684 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | * @param bool $ret Does donation form have variable prices? |
689 | 689 | * @param int|string $ID The ID of the donation form. |
690 | 690 | */ |
691 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
691 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
692 | 692 | |
693 | 693 | } |
694 | 694 | |
@@ -702,17 +702,17 @@ discard block |
||
702 | 702 | */ |
703 | 703 | public function get_type() { |
704 | 704 | |
705 | - if ( ! isset( $this->type ) ) { |
|
705 | + if ( ! isset($this->type)) { |
|
706 | 706 | |
707 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
707 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
708 | 708 | |
709 | - if ( empty( $this->type ) ) { |
|
709 | + if (empty($this->type)) { |
|
710 | 710 | $this->type = 'set'; |
711 | 711 | } |
712 | 712 | |
713 | 713 | } |
714 | 714 | |
715 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
715 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
716 | 716 | |
717 | 717 | } |
718 | 718 | |
@@ -728,23 +728,23 @@ discard block |
||
728 | 728 | * |
729 | 729 | * @return string |
730 | 730 | */ |
731 | - public function get_form_classes( $args ) { |
|
731 | + public function get_form_classes($args) { |
|
732 | 732 | |
733 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
733 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
734 | 734 | ? 'float-labels-enabled' |
735 | 735 | : ''; |
736 | 736 | |
737 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
737 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
738 | 738 | 'give-form', |
739 | - 'give-form-' . $this->ID, |
|
740 | - 'give-form-type-' . $this->get_type(), |
|
739 | + 'give-form-'.$this->ID, |
|
740 | + 'give-form-type-'.$this->get_type(), |
|
741 | 741 | $float_labels_option, |
742 | - ), $this->ID, $args ); |
|
742 | + ), $this->ID, $args); |
|
743 | 743 | |
744 | 744 | // Remove empty class names. |
745 | - $form_classes_array = array_filter( $form_classes_array ); |
|
745 | + $form_classes_array = array_filter($form_classes_array); |
|
746 | 746 | |
747 | - return implode( ' ', $form_classes_array ); |
|
747 | + return implode(' ', $form_classes_array); |
|
748 | 748 | |
749 | 749 | } |
750 | 750 | |
@@ -759,24 +759,24 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @return string |
761 | 761 | */ |
762 | - public function get_form_wrap_classes( $args ) { |
|
762 | + public function get_form_wrap_classes($args) { |
|
763 | 763 | |
764 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
764 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
765 | 765 | ? $args['display_style'] |
766 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
766 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
767 | 767 | |
768 | 768 | // If admin want to show only button for form then user inbuilt modal functionality. |
769 | - if( 'button' === $display_option ) { |
|
769 | + if ('button' === $display_option) { |
|
770 | 770 | $display_option = 'modal give-display-button-only'; |
771 | 771 | } |
772 | 772 | |
773 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
773 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
774 | 774 | 'give-form-wrap', |
775 | - 'give-display-' . $display_option, |
|
776 | - ), $this->ID, $args ); |
|
775 | + 'give-display-'.$display_option, |
|
776 | + ), $this->ID, $args); |
|
777 | 777 | |
778 | 778 | |
779 | - return implode( ' ', $form_wrap_classes_array ); |
|
779 | + return implode(' ', $form_wrap_classes_array); |
|
780 | 780 | |
781 | 781 | } |
782 | 782 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | public function is_set_type_donation_form() { |
792 | 792 | $form_type = $this->get_type(); |
793 | 793 | |
794 | - return ( 'set' === $form_type ? true : false ); |
|
794 | + return ('set' === $form_type ? true : false); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | public function is_multi_type_donation_form() { |
806 | 806 | $form_type = $this->get_type(); |
807 | 807 | |
808 | - return ( 'multi' === $form_type ? true : false ); |
|
808 | + return ('multi' === $form_type ? true : false); |
|
809 | 809 | |
810 | 810 | } |
811 | 811 | |
@@ -819,15 +819,15 @@ discard block |
||
819 | 819 | */ |
820 | 820 | public function get_sales() { |
821 | 821 | |
822 | - if ( ! isset( $this->sales ) ) { |
|
822 | + if ( ! isset($this->sales)) { |
|
823 | 823 | |
824 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
825 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
824 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
825 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
826 | 826 | } // End if |
827 | 827 | |
828 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
828 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
829 | 829 | |
830 | - if ( $this->sales < 0 ) { |
|
830 | + if ($this->sales < 0) { |
|
831 | 831 | // Never let sales be less than zero |
832 | 832 | $this->sales = 0; |
833 | 833 | } |
@@ -848,13 +848,13 @@ discard block |
||
848 | 848 | * |
849 | 849 | * @return int|false New number of total sales. |
850 | 850 | */ |
851 | - public function increase_sales( $quantity = 1 ) { |
|
851 | + public function increase_sales($quantity = 1) { |
|
852 | 852 | |
853 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
854 | - $quantity = absint( $quantity ); |
|
853 | + $sales = give_get_form_sales_stats($this->ID); |
|
854 | + $quantity = absint($quantity); |
|
855 | 855 | $total_sales = $sales + $quantity; |
856 | 856 | |
857 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
857 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
858 | 858 | |
859 | 859 | $this->sales = $total_sales; |
860 | 860 | |
@@ -875,17 +875,17 @@ discard block |
||
875 | 875 | * |
876 | 876 | * @return int|false New number of total sales. |
877 | 877 | */ |
878 | - public function decrease_sales( $quantity = 1 ) { |
|
878 | + public function decrease_sales($quantity = 1) { |
|
879 | 879 | |
880 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
880 | + $sales = give_get_form_sales_stats($this->ID); |
|
881 | 881 | |
882 | 882 | // Only decrease if not already zero |
883 | - if ( $sales > 0 ) { |
|
883 | + if ($sales > 0) { |
|
884 | 884 | |
885 | - $quantity = absint( $quantity ); |
|
885 | + $quantity = absint($quantity); |
|
886 | 886 | $total_sales = $sales - $quantity; |
887 | 887 | |
888 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
888 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
889 | 889 | |
890 | 890 | $this->sales = $sales; |
891 | 891 | |
@@ -909,15 +909,15 @@ discard block |
||
909 | 909 | */ |
910 | 910 | public function get_earnings() { |
911 | 911 | |
912 | - if ( ! isset( $this->earnings ) ) { |
|
912 | + if ( ! isset($this->earnings)) { |
|
913 | 913 | |
914 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
915 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
914 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
915 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
916 | 916 | } |
917 | 917 | |
918 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
918 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
919 | 919 | |
920 | - if ( $this->earnings < 0 ) { |
|
920 | + if ($this->earnings < 0) { |
|
921 | 921 | // Never let earnings be less than zero |
922 | 922 | $this->earnings = 0; |
923 | 923 | } |
@@ -938,12 +938,12 @@ discard block |
||
938 | 938 | * |
939 | 939 | * @return float|false |
940 | 940 | */ |
941 | - public function increase_earnings( $amount = 0 ) { |
|
941 | + public function increase_earnings($amount = 0) { |
|
942 | 942 | |
943 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
943 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
944 | 944 | $new_amount = $earnings + (float) $amount; |
945 | 945 | |
946 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
946 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
947 | 947 | |
948 | 948 | $this->earnings = $new_amount; |
949 | 949 | |
@@ -965,16 +965,16 @@ discard block |
||
965 | 965 | * |
966 | 966 | * @return float|false |
967 | 967 | */ |
968 | - public function decrease_earnings( $amount ) { |
|
968 | + public function decrease_earnings($amount) { |
|
969 | 969 | |
970 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
970 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
971 | 971 | |
972 | - if ( $earnings > 0 ) { |
|
972 | + if ($earnings > 0) { |
|
973 | 973 | // Only decrease if greater than zero |
974 | 974 | $new_amount = $earnings - (float) $amount; |
975 | 975 | |
976 | 976 | |
977 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
977 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
978 | 978 | |
979 | 979 | $this->earnings = $new_amount; |
980 | 980 | |
@@ -998,22 +998,22 @@ discard block |
||
998 | 998 | * |
999 | 999 | * @return bool |
1000 | 1000 | */ |
1001 | - public function is_free( $price_id = false ) { |
|
1001 | + public function is_free($price_id = false) { |
|
1002 | 1002 | |
1003 | 1003 | $is_free = false; |
1004 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
1004 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
1005 | 1005 | |
1006 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
1007 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
1008 | - } elseif ( ! $variable_pricing ) { |
|
1009 | - $price = give_get_meta( $this->ID, '_give_set_price', true ); |
|
1006 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
1007 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
1008 | + } elseif ( ! $variable_pricing) { |
|
1009 | + $price = give_get_meta($this->ID, '_give_set_price', true); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1012 | + if (isset($price) && (float) $price == 0) { |
|
1013 | 1013 | $is_free = true; |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1016 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1017 | 1017 | |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1040,9 +1040,9 @@ discard block |
||
1040 | 1040 | $is_close_form = apply_filters( |
1041 | 1041 | 'give_is_close_donation_form', |
1042 | 1042 | ( |
1043 | - give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
1044 | - && give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1045 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1043 | + give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) ) |
|
1044 | + && give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1045 | + && ($this->get_goal() <= $this->get_earnings() |
|
1046 | 1046 | ), |
1047 | 1047 | $this->ID |
1048 | 1048 | ); |
@@ -1061,29 +1061,29 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return bool The result of the update query. |
1063 | 1063 | */ |
1064 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1064 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1065 | 1065 | |
1066 | 1066 | /* @var WPDB $wpdb */ |
1067 | 1067 | global $wpdb; |
1068 | 1068 | |
1069 | - if ( empty( $meta_key ) ) { |
|
1069 | + if (empty($meta_key)) { |
|
1070 | 1070 | return false; |
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | // Make sure if it needs to be serialized, we do |
1074 | - $meta_value = maybe_serialize( $meta_value ); |
|
1074 | + $meta_value = maybe_serialize($meta_value); |
|
1075 | 1075 | |
1076 | - if ( is_numeric( $meta_value ) ) { |
|
1077 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1076 | + if (is_numeric($meta_value)) { |
|
1077 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1078 | 1078 | } else { |
1079 | 1079 | $value_type = "'%s'"; |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1082 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1083 | 1083 | |
1084 | - if ( $wpdb->query( $sql ) ) { |
|
1084 | + if ($wpdb->query($sql)) { |
|
1085 | 1085 | |
1086 | - clean_post_cache( $this->ID ); |
|
1086 | + clean_post_cache($this->ID); |
|
1087 | 1087 | |
1088 | 1088 | return true; |
1089 | 1089 |
@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,42 +56,42 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50 ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50)); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | 68 | |
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())); |
|
70 | 70 | $receipt_link = sprintf( |
71 | 71 | '<a href="%1$s">%2$s</a>', |
72 | 72 | $receipt_link_url, |
73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
73 | + esc_html__('View the receipt in your browser »', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $user = wp_get_current_user(); |
77 | 77 | |
78 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
80 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
81 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
82 | - $message = str_replace( '{amount}', $price, $message ); |
|
83 | - $message = str_replace( '{price}', $price, $message ); |
|
84 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
85 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
86 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
87 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
88 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
89 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
90 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
91 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
92 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
93 | - |
|
94 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
78 | + $message = str_replace('{name}', $user->display_name, $message); |
|
79 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
80 | + $message = str_replace('{username}', $user->user_login, $message); |
|
81 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
82 | + $message = str_replace('{amount}', $price, $message); |
|
83 | + $message = str_replace('{price}', $price, $message); |
|
84 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
85 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
86 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
87 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
88 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
89 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
90 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
91 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
92 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
93 | + |
|
94 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | * @since 1.0 |
104 | 104 | * @return array|bool |
105 | 105 | */ |
106 | -function give_email_template_preview( $array ) { |
|
106 | +function give_email_template_preview($array) { |
|
107 | 107 | |
108 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
108 | + if ( ! current_user_can('manage_give_settings')) { |
|
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | $custom_field = array( |
112 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
113 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
112 | + 'name' => esc_html__('Preview Email', 'give'), |
|
113 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
114 | 114 | 'id' => 'give_email_preview_buttons', |
115 | 115 | 'type' => 'email_preview_buttons' |
116 | 116 | ); |
117 | 117 | |
118 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
118 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
119 | 119 | |
120 | 120 | } |
121 | 121 | |
122 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
122 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Output Email Template Preview Buttons. |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | function give_email_preview_buttons_callback() { |
132 | 132 | ob_start(); |
133 | 133 | ?> |
134 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
135 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
134 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
135 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
136 | 136 | 'give_action' => 'send_test_email', |
137 | 137 | 'give-message' => 'sent-test-email', |
138 | 138 | 'tag' => 'emails' |
139 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
139 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
140 | 140 | <?php |
141 | 141 | echo ob_get_clean(); |
142 | 142 | } |
@@ -149,46 +149,46 @@ discard block |
||
149 | 149 | */ |
150 | 150 | function give_display_email_template_preview() { |
151 | 151 | |
152 | - if ( empty( $_GET['give_action'] ) ) { |
|
152 | + if (empty($_GET['give_action'])) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
156 | + if ('preview_email' !== $_GET['give_action']) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
160 | + if ( ! current_user_can('manage_give_settings')) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
165 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
166 | 166 | |
167 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
167 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
168 | 168 | |
169 | 169 | echo give_get_preview_email_header(); |
170 | 170 | |
171 | 171 | //Are we previewing an actual payment? |
172 | - if ( ! empty( $payment_id ) ) { |
|
172 | + if ( ! empty($payment_id)) { |
|
173 | 173 | |
174 | - $content = give_get_email_body_content( $payment_id ); |
|
174 | + $content = give_get_email_body_content($payment_id); |
|
175 | 175 | |
176 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
176 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
177 | 177 | |
178 | 178 | } else { |
179 | 179 | |
180 | 180 | //No payment ID, use sample preview content |
181 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
181 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - echo Give()->emails->build_email( $preview_content ); |
|
185 | + echo Give()->emails->build_email($preview_content); |
|
186 | 186 | |
187 | 187 | exit; |
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
191 | +add_action('init', 'give_display_email_template_preview'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Email Template Body. |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string $email_body Body of the email |
202 | 202 | */ |
203 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
203 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
204 | 204 | |
205 | 205 | $default_email_body = give_get_default_donation_receipt_email(); |
206 | 206 | |
207 | - $email_content = give_get_option( 'donation_receipt' ); |
|
208 | - $email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
207 | + $email_content = give_get_option('donation_receipt'); |
|
208 | + $email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body; |
|
209 | 209 | |
210 | - $email_body = wpautop( $email_content ); |
|
210 | + $email_body = wpautop($email_content); |
|
211 | 211 | |
212 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
212 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
213 | 213 | |
214 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
214 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -224,36 +224,36 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return string $email_body Body of the email |
226 | 226 | */ |
227 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
227 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
228 | 228 | |
229 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
230 | - $email = give_get_payment_user_email( $payment_id ); |
|
229 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
230 | + $email = give_get_payment_user_email($payment_id); |
|
231 | 231 | |
232 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
233 | - $user_data = get_userdata( $user_info['id'] ); |
|
232 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
233 | + $user_data = get_userdata($user_info['id']); |
|
234 | 234 | $name = $user_data->display_name; |
235 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
236 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
235 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
236 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
237 | 237 | } else { |
238 | 238 | $name = $email; |
239 | 239 | } |
240 | 240 | |
241 | - $gateway = give_get_gateway_admin_label( give_get_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
241 | + $gateway = give_get_gateway_admin_label(give_get_meta($payment_id, '_give_payment_gateway', true)); |
|
242 | 242 | |
243 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
244 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
245 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
246 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
247 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
248 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
249 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
243 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
244 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
245 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
246 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
247 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n"; |
|
248 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
249 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
250 | 250 | |
251 | - $email = give_get_option( 'donation_notification' ); |
|
252 | - $email = isset( $email ) ? stripslashes( $email ) : $default_email_body; |
|
251 | + $email = give_get_option('donation_notification'); |
|
252 | + $email = isset($email) ? stripslashes($email) : $default_email_body; |
|
253 | 253 | |
254 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
254 | + $email_body = give_do_email_tags($email, $payment_id); |
|
255 | 255 | |
256 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
256 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | * @since 1.0 |
267 | 267 | */ |
268 | 268 | function give_render_receipt_in_browser() { |
269 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
270 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
269 | + if ( ! isset($_GET['payment_key'])) { |
|
270 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
271 | 271 | } |
272 | 272 | |
273 | - $key = urlencode( $_GET['payment_key'] ); |
|
273 | + $key = urlencode($_GET['payment_key']); |
|
274 | 274 | |
275 | 275 | ob_start(); |
276 | 276 | //Disallows caching of the page |
277 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
278 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
279 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
280 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
281 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
277 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
278 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
279 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
280 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
281 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
282 | 282 | ?> |
283 | 283 | <!DOCTYPE html> |
284 | 284 | <html lang="en"> |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @since 1.0 |
291 | 291 | */ |
292 | - do_action( 'give_receipt_head' ); |
|
292 | + do_action('give_receipt_head'); |
|
293 | 293 | ?> |
294 | 294 | </head> |
295 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
295 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
296 | 296 | |
297 | 297 | <div id="give_receipt_wrapper"> |
298 | 298 | <?php |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @since 1.0 |
303 | 303 | */ |
304 | - do_action( 'give_render_receipt_in_browser_before' ); |
|
304 | + do_action('give_render_receipt_in_browser_before'); |
|
305 | 305 | |
306 | - echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); |
|
306 | + echo do_shortcode('[give_receipt payment_key='.$key.']'); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Fires in the receipt template after the content. |
310 | 310 | * |
311 | 311 | * @since 1.0 |
312 | 312 | */ |
313 | - do_action( 'give_render_receipt_in_browser_after' ); |
|
313 | + do_action('give_render_receipt_in_browser_after'); |
|
314 | 314 | ?> |
315 | 315 | </div> |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @since 1.0 |
322 | 322 | */ |
323 | - do_action( 'give_receipt_footer' ); |
|
323 | + do_action('give_receipt_footer'); |
|
324 | 324 | ?> |
325 | 325 | </body> |
326 | 326 | </html> |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | die(); |
330 | 330 | } |
331 | 331 | |
332 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
332 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -344,29 +344,29 @@ discard block |
||
344 | 344 | |
345 | 345 | //Payment receipt switcher |
346 | 346 | $payment_count = give_count_payments()->publish; |
347 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
347 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
348 | 348 | |
349 | - if ( $payment_count <= 0 ) { |
|
349 | + if ($payment_count <= 0) { |
|
350 | 350 | return false; |
351 | 351 | } |
352 | 352 | |
353 | 353 | //Get payments. |
354 | - $payments = new Give_Payments_Query( array( |
|
354 | + $payments = new Give_Payments_Query(array( |
|
355 | 355 | 'number' => 100 |
356 | - ) ); |
|
356 | + )); |
|
357 | 357 | $payments = $payments->get_payments(); |
358 | 358 | $options = array(); |
359 | 359 | |
360 | 360 | //Provide nice human readable options. |
361 | - if ( $payments ) { |
|
362 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
363 | - foreach ( $payments as $payment ) { |
|
361 | + if ($payments) { |
|
362 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
363 | + foreach ($payments as $payment) { |
|
364 | 364 | |
365 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
365 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
366 | 366 | |
367 | 367 | } |
368 | 368 | } else { |
369 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
369 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | //Start constructing HTML output. |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | var selected_trans = transactions.options[transactions.selectedIndex]; |
380 | 380 | console.log(selected_trans); |
381 | 381 | if (selected_trans){ |
382 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
382 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
383 | 383 | window.location = url_string; |
384 | 384 | } |
385 | 385 | } |
386 | 386 | </script>'; |
387 | 387 | |
388 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
388 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
389 | 389 | |
390 | 390 | //The select field with 100 latest transactions |
391 | - $transaction_header .= Give()->html->select( array( |
|
391 | + $transaction_header .= Give()->html->select(array( |
|
392 | 392 | 'name' => 'preview_email_payment_id', |
393 | 393 | 'selected' => $payment_id, |
394 | 394 | 'id' => 'give_preview_email_payment_id', |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | 'select_atts' => 'onchange="change_preview()">', |
399 | 399 | 'show_option_all' => false, |
400 | 400 | 'show_option_none' => false |
401 | - ) ); |
|
401 | + )); |
|
402 | 402 | |
403 | 403 | //Closing tag |
404 | 404 | $transaction_header .= '</div>'; |
405 | 405 | |
406 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
406 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | function give_receipt_head_content() { |
418 | 418 | |
419 | 419 | //Title. |
420 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
420 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
421 | 421 | |
422 | 422 | //Meta. |
423 | 423 | $output .= '<meta charset="utf-8"/> |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | <meta name="robots" content="noindex, nofollow"/>'; |
432 | 432 | |
433 | 433 | //CSS |
434 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
434 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
435 | 435 | |
436 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
436 | + echo apply_filters('give_receipt_head_content', $output); |
|
437 | 437 | |
438 | 438 | } |
439 | 439 | |
440 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
441 | 440 | \ No newline at end of file |
441 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
442 | 442 | \ No newline at end of file |
@@ -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 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => __( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => __( 'PayPal', 'give' ), |
|
27 | + 'admin_label' => __('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => __('PayPal', 'give'), |
|
29 | 29 | ), |
30 | 30 | 'manual' => array( |
31 | - 'admin_label' => __( 'Test Donation', 'give' ), |
|
32 | - 'checkout_label' => __( 'Test Donation', 'give' ) |
|
31 | + 'admin_label' => __('Test Donation', 'give'), |
|
32 | + 'checkout_label' => __('Test Donation', 'give') |
|
33 | 33 | ), |
34 | 34 | ); |
35 | 35 | |
36 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
36 | + return apply_filters('give_payment_gateways', $gateways); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array $gateway_list All the available gateways |
48 | 48 | */ |
49 | -function give_get_enabled_payment_gateways( $form_id = 0 ) { |
|
49 | +function give_get_enabled_payment_gateways($form_id = 0) { |
|
50 | 50 | |
51 | 51 | $gateways = give_get_payment_gateways(); |
52 | 52 | |
53 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
53 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
54 | 54 | |
55 | 55 | $gateway_list = array(); |
56 | 56 | |
57 | - foreach ( $gateways as $key => $gateway ) { |
|
58 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
59 | - $gateway_list[ $key ] = $gateway; |
|
57 | + foreach ($gateways as $key => $gateway) { |
|
58 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
59 | + $gateway_list[$key] = $gateway; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Set order of payment gateway in list. |
64 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
64 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
65 | 65 | |
66 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id ); |
|
66 | + return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return boolean true if enabled, false otherwise |
77 | 77 | */ |
78 | -function give_is_gateway_active( $gateway ) { |
|
78 | +function give_is_gateway_active($gateway) { |
|
79 | 79 | $gateways = give_get_enabled_payment_gateways(); |
80 | 80 | |
81 | - $ret = array_key_exists( $gateway, $gateways ); |
|
81 | + $ret = array_key_exists($gateway, $gateways); |
|
82 | 82 | |
83 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
83 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,23 +92,23 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return string Gateway ID |
94 | 94 | */ |
95 | -function give_get_default_gateway( $form_id ) { |
|
95 | +function give_get_default_gateway($form_id) { |
|
96 | 96 | |
97 | 97 | $give_options = give_get_settings(); |
98 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | - $form_default = give_get_meta( $form_id, '_give_default_gateway', true ); |
|
98 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
99 | + $form_default = give_get_meta($form_id, '_give_default_gateway', true); |
|
100 | 100 | |
101 | 101 | // Single Form settings varies compared to the Global default settings. |
102 | - if ( ! empty( $form_default ) && |
|
102 | + if ( ! empty($form_default) && |
|
103 | 103 | $form_id !== null && |
104 | 104 | $default !== $form_default && |
105 | 105 | $form_default !== 'global' && |
106 | - give_is_gateway_active( $form_default ) |
|
106 | + give_is_gateway_active($form_default) |
|
107 | 107 | ) { |
108 | 108 | $default = $form_default; |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters( 'give_default_gateway', $default ); |
|
111 | + return apply_filters('give_default_gateway', $default); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,18 +120,18 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string Gateway admin label |
122 | 122 | */ |
123 | -function give_get_gateway_admin_label( $gateway ) { |
|
123 | +function give_get_gateway_admin_label($gateway) { |
|
124 | 124 | $gateways = give_get_payment_gateways(); |
125 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
126 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
125 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
126 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
127 | 127 | |
128 | - if ( $gateway == 'manual' && $payment ) { |
|
129 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
130 | - $label = __( 'Test Donation', 'give' ); |
|
128 | + if ($gateway == 'manual' && $payment) { |
|
129 | + if (give_get_payment_amount($payment) == 0) { |
|
130 | + $label = __('Test Donation', 'give'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
134 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return string Checkout label for the gateway |
145 | 145 | */ |
146 | -function give_get_gateway_checkout_label( $gateway ) { |
|
146 | +function give_get_gateway_checkout_label($gateway) { |
|
147 | 147 | $gateways = give_get_payment_gateways(); |
148 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
148 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
149 | 149 | |
150 | - if ( $gateway == 'manual' ) { |
|
151 | - $label = __( 'Test Donation', 'give' ); |
|
150 | + if ($gateway == 'manual') { |
|
151 | + $label = __('Test Donation', 'give'); |
|
152 | 152 | } |
153 | 153 | |
154 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
154 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array Options the gateway supports |
165 | 165 | */ |
166 | -function give_get_gateway_supports( $gateway ) { |
|
166 | +function give_get_gateway_supports($gateway) { |
|
167 | 167 | $gateways = give_get_enabled_payment_gateways(); |
168 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
168 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
169 | 169 | |
170 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
170 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return void |
182 | 182 | */ |
183 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
183 | +function give_send_to_gateway($gateway, $payment_data) { |
|
184 | 184 | |
185 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
185 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Fires while loading payment gateway via AJAX. |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param array $payment_data All the payment data to be sent to the gateway. |
195 | 195 | */ |
196 | - do_action( "give_gateway_{$gateway}", $payment_data ); |
|
196 | + do_action("give_gateway_{$gateway}", $payment_data); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -207,34 +207,34 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return string $enabled_gateway The slug of the gateway |
209 | 209 | */ |
210 | -function give_get_chosen_gateway( $form_id ) { |
|
210 | +function give_get_chosen_gateway($form_id) { |
|
211 | 211 | |
212 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
212 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
213 | 213 | |
214 | 214 | // Back to check if 'form-id' is present. |
215 | - if ( empty( $request_form_id ) ) { |
|
216 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
215 | + if (empty($request_form_id)) { |
|
216 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
217 | 217 | } |
218 | 218 | |
219 | - $request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : ''; |
|
219 | + $request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : ''; |
|
220 | 220 | $chosen = false; |
221 | 221 | |
222 | 222 | // If both 'payment-mode' and 'form-id' then set for only this form. |
223 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
223 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
224 | 224 | $chosen = $request_payment_mode; |
225 | - } elseif ( empty( $request_form_id ) && $request_payment_mode ) { |
|
225 | + } elseif (empty($request_form_id) && $request_payment_mode) { |
|
226 | 226 | // If no 'form-id' but there is 'payment-mode'. |
227 | 227 | $chosen = $request_payment_mode; |
228 | 228 | } |
229 | 229 | |
230 | 230 | // Get the enable gateway based of chosen var. |
231 | - if ( $chosen && give_is_gateway_active( $chosen ) ) { |
|
232 | - $enabled_gateway = urldecode( $chosen ); |
|
231 | + if ($chosen && give_is_gateway_active($chosen)) { |
|
232 | + $enabled_gateway = urldecode($chosen); |
|
233 | 233 | } else { |
234 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
234 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
235 | 235 | } |
236 | 236 | |
237 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
237 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return int ID of the new log entry |
254 | 254 | */ |
255 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
256 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
255 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
256 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @return int |
268 | 268 | */ |
269 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
269 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
270 | 270 | |
271 | 271 | $ret = 0; |
272 | 272 | $args = array( |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | 'fields' => 'ids', |
279 | 279 | ); |
280 | 280 | |
281 | - $payments = new WP_Query( $args ); |
|
281 | + $payments = new WP_Query($args); |
|
282 | 282 | |
283 | - if ( $payments ) { |
|
283 | + if ($payments) { |
|
284 | 284 | $ret = $payments->post_count; |
285 | 285 | } |
286 | 286 | |
@@ -297,27 +297,27 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return array $gateways All the available gateways |
299 | 299 | */ |
300 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
300 | +function give_get_ordered_payment_gateways($gateways) { |
|
301 | 301 | |
302 | 302 | // Get gateways setting. |
303 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
303 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
304 | 304 | |
305 | 305 | // Return from here if we do not have gateways setting. |
306 | - if ( empty( $gateways_setting ) ) { |
|
306 | + if (empty($gateways_setting)) { |
|
307 | 307 | return $gateways; |
308 | 308 | } |
309 | 309 | |
310 | 310 | // Reverse array to order payment gateways. |
311 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
311 | + $gateways_setting = array_reverse($gateways_setting); |
|
312 | 312 | |
313 | 313 | // Reorder gateways array |
314 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
314 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
315 | 315 | |
316 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
317 | - unset( $gateways[ $gateway_key ] ); |
|
316 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
317 | + unset($gateways[$gateway_key]); |
|
318 | 318 | |
319 | - if ( ! empty( $new_gateway_value ) ) { |
|
320 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
319 | + if ( ! empty($new_gateway_value)) { |
|
320 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -328,5 +328,5 @@ discard block |
||
328 | 328 | * |
329 | 329 | * @param array $gateways All the available gateways |
330 | 330 | */ |
331 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
331 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
332 | 332 | } |
333 | 333 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool |
24 | 24 | */ |
25 | -function give_paypal_standard_billing_fields( $form_id ) { |
|
25 | +function give_paypal_standard_billing_fields($form_id) { |
|
26 | 26 | |
27 | - if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) { |
|
28 | - give_default_cc_address_fields( $form_id ); |
|
27 | + if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) { |
|
28 | + give_default_cc_address_fields($form_id); |
|
29 | 29 | |
30 | 30 | return true; |
31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | -add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields'); |
|
37 | +add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Process PayPal Payment. |
@@ -45,34 +45,34 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return void |
47 | 47 | */ |
48 | -function give_process_paypal_payment( $payment_data ) { |
|
48 | +function give_process_paypal_payment($payment_data) { |
|
49 | 49 | |
50 | 50 | // Validate nonce. |
51 | - give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' ); |
|
52 | - $payment_id = give_create_payment( $payment_data ); |
|
51 | + give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway'); |
|
52 | + $payment_id = give_create_payment($payment_data); |
|
53 | 53 | |
54 | 54 | // Check payment. |
55 | - if ( empty( $payment_id ) ) { |
|
55 | + if (empty($payment_id)) { |
|
56 | 56 | // Record the error. |
57 | 57 | give_record_gateway_error( |
58 | - esc_html__( 'Payment Error', 'give' ), |
|
58 | + esc_html__('Payment Error', 'give'), |
|
59 | 59 | sprintf( |
60 | 60 | /* translators: %s: payment data */ |
61 | - esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), |
|
62 | - json_encode( $payment_data ) |
|
61 | + esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), |
|
62 | + json_encode($payment_data) |
|
63 | 63 | ), |
64 | 64 | $payment_id |
65 | 65 | ); |
66 | 66 | // Problems? Send back. |
67 | - give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] ); |
|
67 | + give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Redirect to PayPal. |
71 | - wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) ); |
|
71 | + wp_redirect(give_build_paypal_url($payment_id, $payment_data)); |
|
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
75 | -add_action( 'give_gateway_paypal', 'give_process_paypal_payment' ); |
|
75 | +add_action('give_gateway_paypal', 'give_process_paypal_payment'); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Listens for a PayPal IPN requests and then sends to the processing function |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function give_listen_for_paypal_ipn() { |
84 | 84 | // Regular PayPal IPN |
85 | - if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) { |
|
85 | + if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') { |
|
86 | 86 | /** |
87 | 87 | * Fires while verifying PayPal IPN |
88 | 88 | * |
89 | 89 | * @since 1.0 |
90 | 90 | */ |
91 | - do_action( 'give_verify_paypal_ipn' ); |
|
91 | + do_action('give_verify_paypal_ipn'); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
95 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Process PayPal IPN |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | function give_process_paypal_ipn() { |
104 | 104 | |
105 | 105 | // Check the request method is POST |
106 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
106 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | $post_data = ''; |
112 | 112 | |
113 | 113 | // Fallback just in case post_max_size is lower than needed |
114 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
115 | - $post_data = file_get_contents( 'php://input' ); |
|
114 | + if (ini_get('allow_url_fopen')) { |
|
115 | + $post_data = file_get_contents('php://input'); |
|
116 | 116 | } else { |
117 | 117 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
118 | - ini_set( 'post_max_size', '12M' ); |
|
118 | + ini_set('post_max_size', '12M'); |
|
119 | 119 | } |
120 | 120 | // Start the encoded data collection with notification command |
121 | 121 | $encoded_data = 'cmd=_notify-validate'; |
@@ -124,39 +124,39 @@ discard block |
||
124 | 124 | $arg_separator = give_get_php_arg_separator_output(); |
125 | 125 | |
126 | 126 | // Verify there is a post_data |
127 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
127 | + if ($post_data || strlen($post_data) > 0) { |
|
128 | 128 | // Append the data |
129 | - $encoded_data .= $arg_separator . $post_data; |
|
129 | + $encoded_data .= $arg_separator.$post_data; |
|
130 | 130 | } else { |
131 | 131 | // Check if POST is empty |
132 | - if ( empty( $_POST ) ) { |
|
132 | + if (empty($_POST)) { |
|
133 | 133 | // Nothing to do |
134 | 134 | return; |
135 | 135 | } else { |
136 | 136 | // Loop through each POST |
137 | - foreach ( $_POST as $key => $value ) { |
|
137 | + foreach ($_POST as $key => $value) { |
|
138 | 138 | // Encode the value and append the data. |
139 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
139 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | 144 | // Convert collected post data to an array. |
145 | - parse_str( $encoded_data, $encoded_data_array ); |
|
145 | + parse_str($encoded_data, $encoded_data_array); |
|
146 | 146 | |
147 | - foreach ( $encoded_data_array as $key => $value ) { |
|
147 | + foreach ($encoded_data_array as $key => $value) { |
|
148 | 148 | |
149 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
150 | - $new_key = str_replace( '&', '&', $key ); |
|
151 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
149 | + if (false !== strpos($key, 'amp;')) { |
|
150 | + $new_key = str_replace('&', '&', $key); |
|
151 | + $new_key = str_replace('amp;', '&', $new_key); |
|
152 | 152 | |
153 | - unset( $encoded_data_array[ $key ] ); |
|
154 | - $encoded_data_array[ $new_key ] = $value; |
|
153 | + unset($encoded_data_array[$key]); |
|
154 | + $encoded_data_array[$new_key] = $value; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Validate IPN request w/ PayPal if user hasn't disabled this security measure |
159 | - if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) { |
|
159 | + if (give_is_setting_enabled(give_get_option('paypal_verification'))) { |
|
160 | 160 | |
161 | 161 | $remote_post_vars = array( |
162 | 162 | 'method' => 'POST', |
@@ -176,28 +176,28 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | // Validate the IPN. |
179 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
179 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
180 | 180 | |
181 | - if ( is_wp_error( $api_response ) ) { |
|
181 | + if (is_wp_error($api_response)) { |
|
182 | 182 | give_record_gateway_error( |
183 | - esc_html__( 'IPN Error', 'give' ), |
|
183 | + esc_html__('IPN Error', 'give'), |
|
184 | 184 | sprintf( |
185 | 185 | /* translators: %s: Paypal IPN response */ |
186 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
187 | - json_encode( $api_response ) |
|
186 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
187 | + json_encode($api_response) |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | |
191 | 191 | return; // Something went wrong |
192 | 192 | } |
193 | 193 | |
194 | - if ( $api_response['body'] !== 'VERIFIED' ) { |
|
194 | + if ($api_response['body'] !== 'VERIFIED') { |
|
195 | 195 | give_record_gateway_error( |
196 | - esc_html__( 'IPN Error', 'give' ), |
|
196 | + esc_html__('IPN Error', 'give'), |
|
197 | 197 | sprintf( |
198 | 198 | /* translators: %s: Paypal IPN response */ |
199 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
200 | - json_encode( $api_response ) |
|
199 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
200 | + json_encode($api_response) |
|
201 | 201 | ) |
202 | 202 | ); |
203 | 203 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // Check if $post_data_array has been populated |
209 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
209 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
210 | 210 | return; |
211 | 211 | } |
212 | 212 | |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | 'payment_status' => '', |
216 | 216 | ); |
217 | 217 | |
218 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
218 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
219 | 219 | |
220 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
220 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
221 | 221 | $txn_type = $encoded_data_array['txn_type']; |
222 | 222 | |
223 | - if ( has_action( 'give_paypal_' . $txn_type ) ) { |
|
223 | + if (has_action('give_paypal_'.$txn_type)) { |
|
224 | 224 | /** |
225 | 225 | * Fires while processing PayPal IPN $txn_type. |
226 | 226 | * |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param array $encoded_data_array Encoded data. |
232 | 232 | * @param int $payment_id Payment id. |
233 | 233 | */ |
234 | - do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id ); |
|
234 | + do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id); |
|
235 | 235 | } else { |
236 | 236 | /** |
237 | 237 | * Fires while process PayPal IPN. |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | * @param array $encoded_data_array Encoded data. |
244 | 244 | * @param int $payment_id Payment id. |
245 | 245 | */ |
246 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
246 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
247 | 247 | } |
248 | 248 | exit; |
249 | 249 | } |
250 | 250 | |
251 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
251 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
252 | 252 | |
253 | 253 | /** |
254 | 254 | * Process web accept (one time) payment IPNs. |
@@ -260,128 +260,128 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return void |
262 | 262 | */ |
263 | -function give_process_paypal_web_accept_and_cart( $data, $payment_id ) { |
|
263 | +function give_process_paypal_web_accept_and_cart($data, $payment_id) { |
|
264 | 264 | |
265 | 265 | // Only allow through these transaction types. |
266 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) { |
|
266 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') { |
|
267 | 267 | return; |
268 | 268 | } |
269 | 269 | |
270 | 270 | // Need $payment_id to continue. |
271 | - if ( empty( $payment_id ) ) { |
|
271 | + if (empty($payment_id)) { |
|
272 | 272 | return; |
273 | 273 | } |
274 | 274 | |
275 | 275 | // Collect donation payment details. |
276 | 276 | $paypal_amount = $data['mc_gross']; |
277 | - $payment_status = strtolower( $data['payment_status'] ); |
|
278 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
279 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
280 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
277 | + $payment_status = strtolower($data['payment_status']); |
|
278 | + $currency_code = strtolower($data['mc_currency']); |
|
279 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
280 | + $payment_meta = give_get_payment_meta($payment_id); |
|
281 | 281 | |
282 | 282 | // Must be a PayPal standard IPN. |
283 | - if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) { |
|
283 | + if (give_get_payment_gateway($payment_id) != 'paypal') { |
|
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | 287 | // Verify payment recipient |
288 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) { |
|
288 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) { |
|
289 | 289 | |
290 | 290 | give_record_gateway_error( |
291 | - esc_html__( 'IPN Error', 'give' ), |
|
291 | + esc_html__('IPN Error', 'give'), |
|
292 | 292 | sprintf( |
293 | 293 | /* translators: %s: Paypal IPN response */ |
294 | - esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), |
|
295 | - json_encode( $data ) |
|
294 | + esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), |
|
295 | + json_encode($data) |
|
296 | 296 | ), |
297 | 297 | $payment_id |
298 | 298 | ); |
299 | - give_update_payment_status( $payment_id, 'failed' ); |
|
300 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
299 | + give_update_payment_status($payment_id, 'failed'); |
|
300 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give')); |
|
301 | 301 | |
302 | 302 | return; |
303 | 303 | } |
304 | 304 | |
305 | 305 | // Verify payment currency. |
306 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
306 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
307 | 307 | |
308 | 308 | give_record_gateway_error( |
309 | - esc_html__( 'IPN Error', 'give' ), |
|
309 | + esc_html__('IPN Error', 'give'), |
|
310 | 310 | sprintf( |
311 | 311 | /* translators: %s: Paypal IPN response */ |
312 | - esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), |
|
313 | - json_encode( $data ) |
|
312 | + esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), |
|
313 | + json_encode($data) |
|
314 | 314 | ), |
315 | 315 | $payment_id |
316 | 316 | ); |
317 | - give_update_payment_status( $payment_id, 'failed' ); |
|
318 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
317 | + give_update_payment_status($payment_id, 'failed'); |
|
318 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
319 | 319 | |
320 | 320 | return; |
321 | 321 | } |
322 | 322 | |
323 | 323 | // Process refunds & reversed. |
324 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
325 | - give_process_paypal_refund( $data, $payment_id ); |
|
324 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
325 | + give_process_paypal_refund($data, $payment_id); |
|
326 | 326 | |
327 | 327 | return; |
328 | 328 | } |
329 | 329 | |
330 | 330 | // Only complete payments once. |
331 | - if ( get_post_status( $payment_id ) == 'publish' ) { |
|
331 | + if (get_post_status($payment_id) == 'publish') { |
|
332 | 332 | return; |
333 | 333 | } |
334 | 334 | |
335 | 335 | // Retrieve the total donation amount (before PayPal). |
336 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
336 | + $payment_amount = give_get_payment_amount($payment_id); |
|
337 | 337 | |
338 | 338 | // Check that the donation PP and local db amounts match. |
339 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
339 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
340 | 340 | // The prices don't match |
341 | 341 | give_record_gateway_error( |
342 | - esc_html__( 'IPN Error', 'give' ), |
|
342 | + esc_html__('IPN Error', 'give'), |
|
343 | 343 | sprintf( |
344 | 344 | /* translators: %s: Paypal IPN response */ |
345 | - esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), |
|
346 | - json_encode( $data ) |
|
345 | + esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), |
|
346 | + json_encode($data) |
|
347 | 347 | ), |
348 | 348 | $payment_id |
349 | 349 | ); |
350 | - give_update_payment_status( $payment_id, 'failed' ); |
|
351 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
350 | + give_update_payment_status($payment_id, 'failed'); |
|
351 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
352 | 352 | |
353 | 353 | return; |
354 | 354 | } |
355 | 355 | |
356 | 356 | // Process completed donations. |
357 | - if ( $payment_status == 'completed' || give_is_test_mode() ) { |
|
357 | + if ($payment_status == 'completed' || give_is_test_mode()) { |
|
358 | 358 | |
359 | 359 | give_insert_payment_note( |
360 | 360 | $payment_id, |
361 | 361 | sprintf( |
362 | 362 | /* translators: %s: Paypal transaction ID */ |
363 | - esc_html__( 'PayPal Transaction ID: %s', 'give' ), |
|
363 | + esc_html__('PayPal Transaction ID: %s', 'give'), |
|
364 | 364 | $data['txn_id'] |
365 | 365 | ) |
366 | 366 | ); |
367 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
368 | - give_update_payment_status( $payment_id, 'publish' ); |
|
367 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
368 | + give_update_payment_status($payment_id, 'publish'); |
|
369 | 369 | |
370 | - } elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
370 | + } elseif ('pending' == $payment_status && isset($data['pending_reason'])) { |
|
371 | 371 | |
372 | 372 | // Look for possible pending reasons, such as an echeck. |
373 | - $note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) ); |
|
373 | + $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason'])); |
|
374 | 374 | |
375 | - if ( ! empty( $note ) ) { |
|
375 | + if ( ! empty($note)) { |
|
376 | 376 | |
377 | - give_insert_payment_note( $payment_id, $note ); |
|
377 | + give_insert_payment_note($payment_id, $note); |
|
378 | 378 | |
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | 382 | } |
383 | 383 | |
384 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 ); |
|
384 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2); |
|
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Process PayPal IPN Refunds |
@@ -393,27 +393,27 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return void |
395 | 395 | */ |
396 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
396 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
397 | 397 | |
398 | 398 | // Collect payment details |
399 | - if ( empty( $payment_id ) ) { |
|
399 | + if (empty($payment_id)) { |
|
400 | 400 | return; |
401 | 401 | } |
402 | 402 | |
403 | - if ( get_post_status( $payment_id ) == 'refunded' ) { |
|
403 | + if (get_post_status($payment_id) == 'refunded') { |
|
404 | 404 | return; // Only refund payments once |
405 | 405 | } |
406 | 406 | |
407 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
407 | + $payment_amount = give_get_payment_amount($payment_id); |
|
408 | 408 | $refund_amount = $data['payment_gross'] * - 1; |
409 | 409 | |
410 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
410 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
411 | 411 | |
412 | 412 | give_insert_payment_note( |
413 | 413 | $payment_id, |
414 | 414 | sprintf( |
415 | 415 | /* translators: %s: Paypal parent transaction ID */ |
416 | - esc_html__( 'Partial PayPal refund processed: %s', 'give' ), |
|
416 | + esc_html__('Partial PayPal refund processed: %s', 'give'), |
|
417 | 417 | $data['parent_txn_id'] |
418 | 418 | ) |
419 | 419 | ); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $payment_id, |
427 | 427 | sprintf( |
428 | 428 | /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
429 | - esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), |
|
429 | + esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), |
|
430 | 430 | $data['parent_txn_id'], |
431 | 431 | $data['reason_code'] |
432 | 432 | ) |
@@ -435,11 +435,11 @@ discard block |
||
435 | 435 | $payment_id, |
436 | 436 | sprintf( |
437 | 437 | /* translators: %s: Paypal transaction ID */ |
438 | - esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ), |
|
438 | + esc_html__('PayPal Refund Transaction ID: %s', 'give'), |
|
439 | 439 | $data['txn_id'] |
440 | 440 | ) |
441 | 441 | ); |
442 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
442 | + give_update_payment_status($payment_id, 'refunded'); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -451,24 +451,24 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @return string |
453 | 453 | */ |
454 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
454 | +function give_get_paypal_redirect($ssl_check = false) { |
|
455 | 455 | |
456 | - if ( is_ssl() || ! $ssl_check ) { |
|
456 | + if (is_ssl() || ! $ssl_check) { |
|
457 | 457 | $protocol = 'https://'; |
458 | 458 | } else { |
459 | 459 | $protocol = 'http://'; |
460 | 460 | } |
461 | 461 | |
462 | 462 | // Check the current payment mode |
463 | - if ( give_is_test_mode() ) { |
|
463 | + if (give_is_test_mode()) { |
|
464 | 464 | // Test mode |
465 | - $paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
465 | + $paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
466 | 466 | } else { |
467 | 467 | // Live mode |
468 | - $paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr'; |
|
468 | + $paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr'; |
|
469 | 469 | } |
470 | 470 | |
471 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
471 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -478,9 +478,9 @@ discard block |
||
478 | 478 | * @return string |
479 | 479 | */ |
480 | 480 | function give_get_paypal_page_style() { |
481 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
481 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
482 | 482 | |
483 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
483 | + return apply_filters('give_paypal_page_style', $page_style); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -494,26 +494,26 @@ discard block |
||
494 | 494 | * |
495 | 495 | * @return string |
496 | 496 | */ |
497 | -function give_paypal_success_page_content( $content ) { |
|
497 | +function give_paypal_success_page_content($content) { |
|
498 | 498 | |
499 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
499 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
500 | 500 | return $content; |
501 | 501 | } |
502 | 502 | |
503 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
503 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
504 | 504 | |
505 | - if ( ! $payment_id ) { |
|
505 | + if ( ! $payment_id) { |
|
506 | 506 | $session = give_get_purchase_session(); |
507 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
507 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
508 | 508 | } |
509 | 509 | |
510 | - $payment = get_post( $payment_id ); |
|
511 | - if ( $payment && 'pending' == $payment->post_status ) { |
|
510 | + $payment = get_post($payment_id); |
|
511 | + if ($payment && 'pending' == $payment->post_status) { |
|
512 | 512 | |
513 | 513 | // Payment is still pending so show processing indicator to fix the race condition. |
514 | 514 | ob_start(); |
515 | 515 | |
516 | - give_get_template_part( 'payment', 'processing' ); |
|
516 | + give_get_template_part('payment', 'processing'); |
|
517 | 517 | |
518 | 518 | $content = ob_get_clean(); |
519 | 519 | |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | |
524 | 524 | } |
525 | 525 | |
526 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
526 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
527 | 527 | |
528 | 528 | /** |
529 | 529 | * Given a Payment ID, extract the transaction ID |
@@ -534,22 +534,22 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @return string Transaction ID |
536 | 536 | */ |
537 | -function give_paypal_get_payment_transaction_id( $payment_id ) { |
|
537 | +function give_paypal_get_payment_transaction_id($payment_id) { |
|
538 | 538 | |
539 | 539 | $transaction_id = ''; |
540 | - $notes = give_get_payment_notes( $payment_id ); |
|
540 | + $notes = give_get_payment_notes($payment_id); |
|
541 | 541 | |
542 | - foreach ( $notes as $note ) { |
|
543 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
542 | + foreach ($notes as $note) { |
|
543 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
544 | 544 | $transaction_id = $match[1]; |
545 | 545 | continue; |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | - return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
549 | + return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); |
|
550 | 550 | } |
551 | 551 | |
552 | -add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 ); |
|
552 | +add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1); |
|
553 | 553 | |
554 | 554 | /** |
555 | 555 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | * |
562 | 562 | * @return string A link to the PayPal transaction details |
563 | 563 | */ |
564 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
564 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
565 | 565 | |
566 | 566 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
567 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
567 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
568 | 568 | |
569 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
569 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
570 | 570 | |
571 | 571 | } |
572 | 572 | |
573 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
573 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
574 | 574 | |
575 | 575 | |
576 | 576 | /** |
@@ -582,64 +582,64 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @return string |
584 | 584 | */ |
585 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
585 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
586 | 586 | |
587 | 587 | $note = ''; |
588 | 588 | |
589 | - switch ( $pending_reason ) { |
|
589 | + switch ($pending_reason) { |
|
590 | 590 | |
591 | 591 | case 'echeck' : |
592 | 592 | |
593 | - $note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
593 | + $note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
594 | 594 | |
595 | 595 | break; |
596 | 596 | |
597 | 597 | case 'address' : |
598 | 598 | |
599 | - $note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
599 | + $note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
600 | 600 | |
601 | 601 | break; |
602 | 602 | |
603 | 603 | case 'intl' : |
604 | 604 | |
605 | - $note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
605 | + $note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
606 | 606 | |
607 | 607 | break; |
608 | 608 | |
609 | 609 | case 'multi-currency' : |
610 | 610 | |
611 | - $note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
611 | + $note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
612 | 612 | |
613 | 613 | break; |
614 | 614 | |
615 | 615 | case 'paymentreview' : |
616 | 616 | case 'regulatory_review' : |
617 | 617 | |
618 | - $note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
618 | + $note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
619 | 619 | |
620 | 620 | break; |
621 | 621 | |
622 | 622 | case 'unilateral' : |
623 | 623 | |
624 | - $note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
624 | + $note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
625 | 625 | |
626 | 626 | break; |
627 | 627 | |
628 | 628 | case 'upgrade' : |
629 | 629 | |
630 | - $note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
630 | + $note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
631 | 631 | |
632 | 632 | break; |
633 | 633 | |
634 | 634 | case 'verify' : |
635 | 635 | |
636 | - $note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
636 | + $note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
637 | 637 | |
638 | 638 | break; |
639 | 639 | |
640 | 640 | case 'other' : |
641 | 641 | |
642 | - $note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
642 | + $note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
643 | 643 | |
644 | 644 | break; |
645 | 645 | |
@@ -657,49 +657,49 @@ discard block |
||
657 | 657 | * |
658 | 658 | * @return mixed|string |
659 | 659 | */ |
660 | -function give_build_paypal_url( $payment_id, $payment_data ) { |
|
660 | +function give_build_paypal_url($payment_id, $payment_data) { |
|
661 | 661 | // Only send to PayPal if the pending payment is created successfully. |
662 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
662 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
663 | 663 | |
664 | 664 | // Get the success url. |
665 | - $return_url = add_query_arg( array( |
|
665 | + $return_url = add_query_arg(array( |
|
666 | 666 | 'payment-confirmation' => 'paypal', |
667 | 667 | 'payment-id' => $payment_id, |
668 | 668 | |
669 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
669 | + ), get_permalink(give_get_option('success_page'))); |
|
670 | 670 | |
671 | 671 | // Get the PayPal redirect uri. |
672 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
672 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
673 | 673 | |
674 | 674 | // Item name. |
675 | - $item_name = give_build_paypal_item_title( $payment_data ); |
|
675 | + $item_name = give_build_paypal_item_title($payment_data); |
|
676 | 676 | |
677 | 677 | // Setup PayPal API params. |
678 | 678 | $paypal_args = array( |
679 | - 'business' => give_get_option( 'paypal_email', false ), |
|
679 | + 'business' => give_get_option('paypal_email', false), |
|
680 | 680 | 'first_name' => $payment_data['user_info']['first_name'], |
681 | 681 | 'last_name' => $payment_data['user_info']['last_name'], |
682 | 682 | 'email' => $payment_data['user_email'], |
683 | 683 | 'invoice' => $payment_data['purchase_key'], |
684 | 684 | 'amount' => $payment_data['price'], |
685 | - 'item_name' => stripslashes( $item_name ), |
|
685 | + 'item_name' => stripslashes($item_name), |
|
686 | 686 | 'no_shipping' => '1', |
687 | 687 | 'shipping' => '0', |
688 | 688 | 'no_note' => '1', |
689 | 689 | 'currency_code' => give_get_currency(), |
690 | - 'charset' => get_bloginfo( 'charset' ), |
|
690 | + 'charset' => get_bloginfo('charset'), |
|
691 | 691 | 'custom' => $payment_id, |
692 | 692 | 'rm' => '2', |
693 | 693 | 'return' => $return_url, |
694 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
694 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
695 | 695 | 'notify_url' => $listener_url, |
696 | 696 | 'page_style' => give_get_paypal_page_style(), |
697 | - 'cbt' => get_bloginfo( 'name' ), |
|
697 | + 'cbt' => get_bloginfo('name'), |
|
698 | 698 | 'bn' => 'givewp_SP', |
699 | 699 | ); |
700 | 700 | |
701 | 701 | // Add user address if present. |
702 | - if ( ! empty( $payment_data['user_info']['address'] ) ) { |
|
702 | + if ( ! empty($payment_data['user_info']['address'])) { |
|
703 | 703 | $default_address = array( |
704 | 704 | 'line1' => '', |
705 | 705 | 'line2' => '', |
@@ -709,13 +709,13 @@ discard block |
||
709 | 709 | 'country' => '', |
710 | 710 | ); |
711 | 711 | |
712 | - $address = wp_parse_args( $payment_data['user_info']['address'], $default_address ); |
|
712 | + $address = wp_parse_args($payment_data['user_info']['address'], $default_address); |
|
713 | 713 | |
714 | 714 | $paypal_args['address1'] = $address['line1']; |
715 | 715 | $paypal_args['address2'] = $address['line2']; |
716 | 716 | $paypal_args['city'] = $address['city']; |
717 | 717 | $paypal_args['state'] = $address['state']; |
718 | - $paypal_args['zip'] = $address['zip']; |
|
718 | + $paypal_args['zip'] = $address['zip']; |
|
719 | 719 | $paypal_args['country'] = $address['country']; |
720 | 720 | } |
721 | 721 | |
@@ -730,13 +730,13 @@ discard block |
||
730 | 730 | * @param array $paypal_args |
731 | 731 | * @param array $payment_data |
732 | 732 | */ |
733 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data ); |
|
733 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data); |
|
734 | 734 | |
735 | 735 | // Build query. |
736 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
736 | + $paypal_redirect .= http_build_query($paypal_args); |
|
737 | 737 | |
738 | 738 | // Fix for some sites that encode the entities. |
739 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
739 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
740 | 740 | |
741 | 741 | return $paypal_redirect; |
742 | 742 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | function give_get_paypal_button_type() { |
752 | 752 | // paypal_button_type can be donation or standard. |
753 | 753 | $paypal_button_type = '_donations'; |
754 | - if ( give_get_option( 'paypal_button_type' ) === 'standard' ) { |
|
754 | + if (give_get_option('paypal_button_type') === 'standard') { |
|
755 | 755 | $paypal_button_type = '_xclick'; |
756 | 756 | } |
757 | 757 | |
@@ -768,32 +768,32 @@ discard block |
||
768 | 768 | * |
769 | 769 | * @return string |
770 | 770 | */ |
771 | -function give_build_paypal_item_title( $payment_data ) { |
|
772 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
771 | +function give_build_paypal_item_title($payment_data) { |
|
772 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
773 | 773 | $item_name = $payment_data['post_data']['give-form-title']; |
774 | 774 | |
775 | 775 | // Verify has variable prices. |
776 | - if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) { |
|
776 | + if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) { |
|
777 | 777 | |
778 | - $item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
779 | - $price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
778 | + $item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']); |
|
779 | + $price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']); |
|
780 | 780 | |
781 | 781 | // Donation given doesn't match selected level (must be a custom amount). |
782 | - if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) { |
|
783 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
782 | + if ($price_level_amount != give_sanitize_amount($payment_data['price'])) { |
|
783 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
784 | 784 | // user custom amount text if any, fallback to default if not. |
785 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', esc_html__( 'Custom Amount', 'give' ) ); |
|
785 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', esc_html__('Custom Amount', 'give')); |
|
786 | 786 | |
787 | 787 | } //Is there any donation level text? |
788 | - elseif ( ! empty( $item_price_level_text ) ) { |
|
789 | - $item_name .= ' - ' . $item_price_level_text; |
|
788 | + elseif ( ! empty($item_price_level_text)) { |
|
789 | + $item_name .= ' - '.$item_price_level_text; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | } //Single donation: Custom Amount. |
793 | - elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) { |
|
794 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
793 | + elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) { |
|
794 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
795 | 795 | // user custom amount text if any, fallback to default if not. |
796 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', esc_html__( 'Custom Amount', 'give' ) ); |
|
796 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', esc_html__('Custom Amount', 'give')); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | return $item_name; |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
110 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
111 | 111 | |
112 | 112 | // setup the payment details |
113 | 113 | $payment_data = array( |
114 | 114 | 'price' => $purchase_data['price'], |
115 | 115 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
116 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
117 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
117 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
118 | 118 | 'date' => $purchase_data['date'], |
119 | 119 | 'user_email' => $purchase_data['user_email'], |
120 | 120 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | // record the pending payment |
129 | - $payment = give_insert_payment( $payment_data ); |
|
129 | + $payment = give_insert_payment($payment_data); |
|
130 | 130 | |
131 | - if ( $payment ) { |
|
132 | - give_offline_send_admin_notice( $payment ); |
|
133 | - give_offline_send_donor_instructions( $payment ); |
|
131 | + if ($payment) { |
|
132 | + give_offline_send_admin_notice($payment); |
|
133 | + give_offline_send_donor_instructions($payment); |
|
134 | 134 | give_send_to_success_page(); |
135 | 135 | } else { |
136 | 136 | // if errors are present, send the user back to the donation form so they can be corrected |
137 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
137 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
142 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** |
@@ -152,59 +152,59 @@ discard block |
||
152 | 152 | * @since 1.0 |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
155 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
156 | 156 | |
157 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
158 | - $post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
157 | + $payment_data = give_get_payment_meta($payment_id); |
|
158 | + $post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
159 | 159 | |
160 | 160 | //Customize email content depending on whether the single form has been customized |
161 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
161 | + $email_content = give_get_option('global_offline_donation_email'); |
|
162 | 162 | |
163 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
164 | - $email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
163 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
164 | + $email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
165 | 165 | } |
166 | 166 | |
167 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
167 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Filters the from name. |
171 | 171 | * |
172 | 172 | * @since 1.7 |
173 | 173 | */ |
174 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
174 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
175 | 175 | |
176 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
176 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Filters the from email. |
180 | 180 | * |
181 | 181 | * @since 1.7 |
182 | 182 | */ |
183 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
183 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
184 | 184 | |
185 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
185 | + $to_email = give_get_payment_user_email($payment_id); |
|
186 | 186 | |
187 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
188 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
189 | - $subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
187 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
188 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
189 | + $subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
193 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
192 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
193 | + $subject = give_do_email_tags($subject, $payment_id); |
|
194 | 194 | |
195 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
196 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
195 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
196 | + $message = give_do_email_tags($email_content, $payment_id); |
|
197 | 197 | |
198 | 198 | $emails = Give()->emails; |
199 | 199 | |
200 | - $emails->__set( 'from_name', $from_name ); |
|
201 | - $emails->__set( 'from_email', $from_email ); |
|
202 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
200 | + $emails->__set('from_name', $from_name); |
|
201 | + $emails->__set('from_email', $from_email); |
|
202 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
203 | 203 | |
204 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
205 | - $emails->__set( 'headers', $headers ); |
|
204 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
205 | + $emails->__set('headers', $headers); |
|
206 | 206 | |
207 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
207 | + $emails->send($to_email, $subject, $message, $attachments); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,54 +221,54 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | * |
223 | 223 | */ |
224 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
224 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
225 | 225 | |
226 | 226 | /* Send an email notification to the admin */ |
227 | 227 | $admin_email = give_get_admin_notice_emails(); |
228 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
228 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
229 | 229 | |
230 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
231 | - $user_data = get_userdata( $user_info['id'] ); |
|
230 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
231 | + $user_data = get_userdata($user_info['id']); |
|
232 | 232 | $name = $user_data->display_name; |
233 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
234 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
233 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
234 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
235 | 235 | } else { |
236 | 236 | $name = $user_info['email']; |
237 | 237 | } |
238 | 238 | |
239 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
239 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
240 | 240 | |
241 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
241 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
242 | 242 | |
243 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
244 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
245 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
243 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
244 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
245 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
246 | 246 | |
247 | 247 | |
248 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
249 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
248 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
249 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | 252 | '<a href="%1$s">%2$s</a>', |
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
253 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
254 | + __('View Donation Details »', 'give') |
|
255 | + )."\n\n"; |
|
256 | 256 | |
257 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
258 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
257 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
258 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
259 | 259 | |
260 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
261 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
260 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
261 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
262 | 262 | |
263 | 263 | //Send Email |
264 | 264 | $emails = Give()->emails; |
265 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
265 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
266 | 266 | |
267 | - if ( ! empty( $admin_headers ) ) { |
|
268 | - $emails->__set( 'headers', $admin_headers ); |
|
267 | + if ( ! empty($admin_headers)) { |
|
268 | + $emails->__set('headers', $admin_headers); |
|
269 | 269 | } |
270 | 270 | |
271 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
271 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return array |
282 | 282 | */ |
283 | -function give_offline_add_settings( $settings ) { |
|
283 | +function give_offline_add_settings($settings) { |
|
284 | 284 | |
285 | 285 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
286 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
286 | + if (in_array('offline', give_get_option('gateways'))) { |
|
287 | 287 | return $settings; |
288 | 288 | } |
289 | 289 | |
290 | 290 | //Vars |
291 | 291 | $prefix = '_give_'; |
292 | 292 | |
293 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
293 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
294 | 294 | |
295 | 295 | //this gateway isn't active |
296 | - if ( ! $is_gateway_active ) { |
|
296 | + if ( ! $is_gateway_active) { |
|
297 | 297 | //return settings and bounce |
298 | 298 | return $settings; |
299 | 299 | } |
@@ -302,34 +302,34 @@ discard block |
||
302 | 302 | $check_settings = array( |
303 | 303 | |
304 | 304 | array( |
305 | - 'name' => __( 'Offline Donations', 'give' ), |
|
306 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
307 | - 'id' => $prefix . 'customize_offline_donations', |
|
305 | + 'name' => __('Offline Donations', 'give'), |
|
306 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
307 | + 'id' => $prefix.'customize_offline_donations', |
|
308 | 308 | 'type' => 'radio_inline', |
309 | 309 | 'default' => 'global', |
310 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
311 | - 'global' => __( 'Global Option', 'give' ), |
|
312 | - 'enabled' => __( 'Customize', 'give' ), |
|
313 | - 'disabled' => __( 'Disable', 'give' ), |
|
310 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
311 | + 'global' => __('Global Option', 'give'), |
|
312 | + 'enabled' => __('Customize', 'give'), |
|
313 | + 'disabled' => __('Disable', 'give'), |
|
314 | 314 | ) |
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Billing Fields', 'give' ), |
|
319 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
320 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
318 | + 'name' => __('Billing Fields', 'give'), |
|
319 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
320 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
321 | 321 | 'row_classes' => 'give-subfield', |
322 | 322 | 'type' => 'radio_inline', |
323 | 323 | 'default' => 'disabled', |
324 | 324 | 'options' => array( |
325 | - 'enabled' => __( 'Enabled', 'give' ), |
|
326 | - 'disabled' => __( 'Disabled', 'give' ), |
|
325 | + 'enabled' => __('Enabled', 'give'), |
|
326 | + 'disabled' => __('Disabled', 'give'), |
|
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | array( |
330 | - 'id' => $prefix . 'offline_checkout_notes', |
|
331 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
332 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
330 | + 'id' => $prefix.'offline_checkout_notes', |
|
331 | + 'name' => __('Donation Instructions', 'give'), |
|
332 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
333 | 333 | 'default' => give_get_default_offline_donation_content(), |
334 | 334 | 'type' => 'wysiwyg', |
335 | 335 | 'row_classes' => 'give-subfield', |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | ) |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'id' => $prefix . 'offline_donation_subject', |
|
342 | - 'name' => __( 'Email Subject', 'give' ), |
|
343 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
344 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
341 | + 'id' => $prefix.'offline_donation_subject', |
|
342 | + 'name' => __('Email Subject', 'give'), |
|
343 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
344 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
345 | 345 | 'row_classes' => 'give-subfield', |
346 | 346 | 'type' => 'text' |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'id' => $prefix . 'offline_donation_email', |
|
350 | - 'name' => __( 'Email Instructions', 'give' ), |
|
351 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
349 | + 'id' => $prefix.'offline_donation_email', |
|
350 | + 'name' => __('Email Instructions', 'give'), |
|
351 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
352 | 352 | 'default' => give_get_default_offline_donation_email_content(), |
353 | 353 | 'type' => 'wysiwyg', |
354 | 354 | 'row_classes' => 'give-subfield', |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | 'name' => 'offline_docs', |
361 | 361 | 'type' => 'docs_link', |
362 | 362 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
363 | - 'title' => __( 'Offline Donations', 'give' ), |
|
363 | + 'title' => __('Offline Donations', 'give'), |
|
364 | 364 | ), |
365 | 365 | ); |
366 | 366 | |
367 | - return array_merge( $settings, $check_settings ); |
|
367 | + return array_merge($settings, $check_settings); |
|
368 | 368 | } |
369 | 369 | |
370 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
370 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -379,32 +379,32 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | 383 | |
384 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
384 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - __( 'Make a check payable to "%s"', 'give' ), |
|
389 | + __('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
404 | 404 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
405 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
405 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
406 | 406 | |
407 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
407 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -417,34 +417,34 @@ discard block |
||
417 | 417 | */ |
418 | 418 | function give_get_default_offline_donation_email_content() { |
419 | 419 | |
420 | - $sitename = get_bloginfo( 'sitename' ); |
|
421 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
422 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
420 | + $sitename = get_bloginfo('sitename'); |
|
421 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
422 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
423 | 423 | $default_text .= '<ol>'; |
424 | 424 | $default_text .= '<li>'; |
425 | 425 | $default_text .= sprintf( |
426 | 426 | /* translators: %s: site name */ |
427 | - __( 'Make a check payable to "%s"', 'give' ), |
|
427 | + __('Make a check payable to "%s"', 'give'), |
|
428 | 428 | $sitename |
429 | 429 | ); |
430 | 430 | $default_text .= '</li>'; |
431 | 431 | $default_text .= '<li>'; |
432 | 432 | $default_text .= sprintf( |
433 | 433 | /* translators: %s: site name */ |
434 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
434 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
435 | 435 | $sitename |
436 | 436 | ); |
437 | 437 | $default_text .= '</li>'; |
438 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
438 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
439 | 439 | $default_text .= '</ol>'; |
440 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
440 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
441 | 441 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
442 | 442 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
443 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
444 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
445 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
443 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
444 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
445 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
446 | 446 | |
447 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
447 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
448 | 448 | |
449 | 449 | } |
450 | 450 | |
@@ -458,17 +458,17 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string |
460 | 460 | */ |
461 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
462 | - $payment = new Give_Payment( $id ); |
|
461 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
462 | + $payment = new Give_Payment($id); |
|
463 | 463 | |
464 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
464 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
465 | 465 | return $notice; |
466 | 466 | } |
467 | 467 | |
468 | - return give_output_error( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
468 | + return give_output_error(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
469 | 469 | } |
470 | 470 | |
471 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
471 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Add offline payment instruction on payment receipt. |
@@ -479,26 +479,26 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return mixed |
481 | 481 | */ |
482 | -function give_offline_payment_receipt_after( $payment ) { |
|
482 | +function give_offline_payment_receipt_after($payment) { |
|
483 | 483 | // Get payment object. |
484 | - $payment = new Give_Payment( $payment->ID ); |
|
484 | + $payment = new Give_Payment($payment->ID); |
|
485 | 485 | |
486 | 486 | // Bailout. |
487 | - if ( 'offline' !== $payment->gateway ) { |
|
487 | + if ('offline' !== $payment->gateway) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | |
491 | 491 | ?> |
492 | 492 | <tr> |
493 | - <td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td> |
|
493 | + <td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td> |
|
494 | 494 | <td> |
495 | - <?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?> |
|
495 | + <?php echo give_get_offline_payment_instruction($payment->form_id, true); ?> |
|
496 | 496 | </td> |
497 | 497 | </tr> |
498 | 498 | <?php |
499 | 499 | } |
500 | 500 | |
501 | -add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' ); |
|
501 | +add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after'); |
|
502 | 502 | |
503 | 503 | /** |
504 | 504 | * Get offline payment instructions. |
@@ -510,27 +510,27 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
513 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
514 | 514 | // Bailout. |
515 | - if ( ! $form_id ) { |
|
515 | + if ( ! $form_id) { |
|
516 | 516 | return ''; |
517 | 517 | } |
518 | 518 | |
519 | - $post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
520 | - $post_offline_instructions = give_get_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
521 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
519 | + $post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
520 | + $post_offline_instructions = give_get_meta($form_id, '_give_offline_checkout_notes', true); |
|
521 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
522 | 522 | $offline_instructions = $global_offline_instruction; |
523 | 523 | |
524 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
524 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
525 | 525 | $offline_instructions = $post_offline_instructions; |
526 | 526 | } |
527 | 527 | |
528 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
528 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
529 | 529 | |
530 | 530 | /* translators: %s: form settings url */ |
531 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
531 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
532 | 532 | |
533 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
533 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -544,24 +544,24 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return array |
546 | 546 | */ |
547 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
547 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
548 | 548 | if ( |
549 | 549 | // Show offline payment gateway if enable for new donation form. |
550 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
550 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
551 | 551 | && $form_id |
552 | - && ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
552 | + && ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array( |
|
553 | 553 | 'enabled', |
554 | 554 | 'global', |
555 | - ) ) |
|
555 | + )) |
|
556 | 556 | ) { |
557 | - unset( $gateway_list['offline'] ); |
|
557 | + unset($gateway_list['offline']); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | // Output. |
561 | 561 | return $gateway_list; |
562 | 562 | } |
563 | 563 | |
564 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
564 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Set default gateway to global default payment gateway |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return void |
577 | 577 | */ |
578 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
579 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
580 | - give_update_meta( $postid, '_give_default_gateway', 'global' ); |
|
578 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
579 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) { |
|
580 | + give_update_meta($postid, '_give_default_gateway', 'global'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
584 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |