@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | * @param $args |
67 | 67 | * |
68 | 68 | */ |
69 | - public function __construct( $args ) { |
|
69 | + public function __construct($args) { |
|
70 | 70 | |
71 | 71 | //Only for admins. |
72 | - if ( ! is_admin() ) { |
|
72 | + if ( ! is_admin()) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | 76 | //This plugin is en_US native. |
77 | 77 | $this->locale = get_locale(); |
78 | - if ( 'en_US' === $this->locale ) { |
|
78 | + if ('en_US' === $this->locale) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - $this->init( $args ); |
|
82 | + $this->init($args); |
|
83 | 83 | |
84 | - if ( ! $this->hide_promo() ) { |
|
85 | - add_action( $this->hook, array( $this, 'promo' ) ); |
|
84 | + if ( ! $this->hide_promo()) { |
|
85 | + add_action($this->hook, array($this, 'promo')); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @param array $args |
95 | 95 | */ |
96 | - private function init( $args ) { |
|
97 | - foreach ( $args as $key => $arg ) { |
|
96 | + private function init($args) { |
|
97 | + foreach ($args as $key => $arg) { |
|
98 | 98 | $this->$key = $arg; |
99 | 99 | } |
100 | 100 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | * @return bool |
109 | 109 | */ |
110 | 110 | private function hide_promo() { |
111 | - $hide_promo = get_transient( 'give_i18n_give_promo_hide' ); |
|
112 | - if ( ! $hide_promo ) { |
|
113 | - if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) { |
|
111 | + $hide_promo = get_transient('give_i18n_give_promo_hide'); |
|
112 | + if ( ! $hide_promo) { |
|
113 | + if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) { |
|
114 | 114 | // No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc. |
115 | - set_transient( 'give_i18n_give_promo_hide', true ); |
|
115 | + set_transient('give_i18n_give_promo_hide', true); |
|
116 | 116 | $hide_promo = true; |
117 | 117 | } |
118 | 118 | } |
@@ -131,20 +131,20 @@ discard block |
||
131 | 131 | $message = false; |
132 | 132 | |
133 | 133 | //Using a translation less than 90% complete. |
134 | - if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) { |
|
135 | - $message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' ); |
|
136 | - } elseif ( ! $this->translation_loaded && $this->translation_exists ) { |
|
137 | - $message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' ); |
|
138 | - } elseif ( ! $this->translation_exists ) { |
|
139 | - $message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' ); |
|
134 | + if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) { |
|
135 | + $message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give'); |
|
136 | + } elseif ( ! $this->translation_loaded && $this->translation_exists) { |
|
137 | + $message = __('You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give'); |
|
138 | + } elseif ( ! $this->translation_exists) { |
|
139 | + $message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | //Links. |
143 | - $registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) ); |
|
144 | - $translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) ); |
|
143 | + $registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give')); |
|
144 | + $translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give')); |
|
145 | 145 | |
146 | 146 | //Message. |
147 | - $message = sprintf( $message, esc_html( $this->locale_name ), esc_html( 'Give' ), $this->percent_translated, $registration_link, $translations_link ); |
|
147 | + $message = sprintf($message, esc_html($this->locale_name), esc_html('Give'), $this->percent_translated, $registration_link, $translations_link); |
|
148 | 148 | |
149 | 149 | |
150 | 150 | return $message; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->translation_details(); |
160 | 160 | $message = $this->promo_message(); |
161 | 161 | |
162 | - if ( $message ) { ?> |
|
162 | + if ($message) { ?> |
|
163 | 163 | |
164 | 164 | <style> |
165 | 165 | /* Banner specific styles */ |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | <a href="https://wordpress.org/support/register.php" class="alignleft give-i18n-icon" style="margin:0" target="_blank"><span class="dashicons dashicons-translation" style="font-size: 110px; text-decoration: none;"></span></a> |
212 | 212 | |
213 | 213 | <div class="give-i18n-notice-content"> |
214 | - <a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
214 | + <a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
215 | 215 | |
216 | - <h2 style="margin: 10px 0;"><?php printf( __( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2> |
|
216 | + <h2 style="margin: 10px 0;"><?php printf(__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2> |
|
217 | 217 | <p><?php echo $message; ?></p> |
218 | 218 | <p> |
219 | - <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now »', 'give' ); ?></a> |
|
219 | + <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now »', 'give'); ?></a> |
|
220 | 220 | </p> |
221 | 221 | </div> |
222 | 222 | </div> |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | */ |
234 | 234 | private function find_or_initialize_translation_details() { |
235 | 235 | |
236 | - $set = get_transient( 'give_i18n_give_' . $this->locale ); |
|
236 | + $set = get_transient('give_i18n_give_'.$this->locale); |
|
237 | 237 | |
238 | - if ( ! $set ) { |
|
238 | + if ( ! $set) { |
|
239 | 239 | $set = $this->retrieve_translation_details(); |
240 | - set_transient( 'give_i18n_give_' . $this->locale, $set, DAY_IN_SECONDS ); |
|
240 | + set_transient('give_i18n_give_'.$this->locale, $set, DAY_IN_SECONDS); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | return $set; |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | private function translation_details() { |
252 | 252 | $set = $this->find_or_initialize_translation_details(); |
253 | 253 | |
254 | - $this->translation_exists = ! is_null( $set ); |
|
255 | - $this->translation_loaded = is_textdomain_loaded( 'give' ); |
|
254 | + $this->translation_exists = ! is_null($set); |
|
255 | + $this->translation_loaded = is_textdomain_loaded('give'); |
|
256 | 256 | |
257 | - $this->parse_translation_set( $set ); |
|
257 | + $this->parse_translation_set($set); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -266,26 +266,26 @@ discard block |
||
266 | 266 | */ |
267 | 267 | private function retrieve_translation_details() { |
268 | 268 | |
269 | - $api_url = trailingslashit( $this->glotpress_url ); |
|
269 | + $api_url = trailingslashit($this->glotpress_url); |
|
270 | 270 | |
271 | - $resp = wp_remote_get( $api_url ); |
|
271 | + $resp = wp_remote_get($api_url); |
|
272 | 272 | |
273 | - if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) { |
|
273 | + if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') { |
|
274 | 274 | return null; |
275 | 275 | } |
276 | 276 | |
277 | - $body = wp_remote_retrieve_body( $resp ); |
|
278 | - unset( $resp ); |
|
277 | + $body = wp_remote_retrieve_body($resp); |
|
278 | + unset($resp); |
|
279 | 279 | |
280 | - if ( $body ) { |
|
281 | - $body = json_decode( $body ); |
|
280 | + if ($body) { |
|
281 | + $body = json_decode($body); |
|
282 | 282 | |
283 | - foreach ( $body->translation_sets as $set ) { |
|
284 | - if ( ! property_exists( $set, 'wp_locale' ) ) { |
|
283 | + foreach ($body->translation_sets as $set) { |
|
284 | + if ( ! property_exists($set, 'wp_locale')) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | - if ( $this->locale == $set->wp_locale ) { |
|
288 | + if ($this->locale == $set->wp_locale) { |
|
289 | 289 | return $set; |
290 | 290 | } |
291 | 291 | } |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @access private |
303 | 303 | */ |
304 | - private function parse_translation_set( $set ) { |
|
305 | - if ( $this->translation_exists && is_object( $set ) ) { |
|
304 | + private function parse_translation_set($set) { |
|
305 | + if ($this->translation_exists && is_object($set)) { |
|
306 | 306 | $this->locale_name = $set->name; |
307 | 307 | $this->percent_translated = $set->percent_translated; |
308 | 308 | } else { |
@@ -661,7 +661,7 @@ |
||
661 | 661 | * |
662 | 662 | * @since 1.6.3 |
663 | 663 | * |
664 | - * @param $pending_reason |
|
664 | + * @param string $pending_reason |
|
665 | 665 | * |
666 | 666 | * @return string |
667 | 667 | */ |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @access private |
22 | 22 | * @since 1.0 |
23 | 23 | */ |
24 | -add_action( 'give_paypal_cc_form', '__return_false' ); |
|
24 | +add_action('give_paypal_cc_form', '__return_false'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Process PayPal Purchase. |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_process_paypal_purchase( $purchase_data ) { |
|
35 | +function give_process_paypal_purchase($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | - $form_id = intval( $purchase_data['post_data']['give-form-id'] ); |
|
42 | - $price_id = isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : ''; |
|
41 | + $form_id = intval($purchase_data['post_data']['give-form-id']); |
|
42 | + $price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : ''; |
|
43 | 43 | |
44 | 44 | // Collect payment data. |
45 | 45 | $payment_data = array( |
@@ -57,101 +57,101 @@ discard block |
||
57 | 57 | ); |
58 | 58 | |
59 | 59 | // Record the pending payment. |
60 | - $payment_id = give_insert_payment( $payment_data ); |
|
60 | + $payment_id = give_insert_payment($payment_data); |
|
61 | 61 | |
62 | 62 | // Check payment. |
63 | - if ( ! $payment_id ) { |
|
63 | + if ( ! $payment_id) { |
|
64 | 64 | // Record the error. |
65 | 65 | give_record_gateway_error( |
66 | - esc_html__( 'Payment Error', 'give' ), |
|
66 | + esc_html__('Payment Error', 'give'), |
|
67 | 67 | sprintf( |
68 | 68 | /* translators: %s: payment data */ |
69 | - esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), |
|
70 | - json_encode( $payment_data ) |
|
69 | + esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), |
|
70 | + json_encode($payment_data) |
|
71 | 71 | ), |
72 | 72 | $payment_id |
73 | 73 | ); |
74 | 74 | // Problems? Send back. |
75 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
75 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
76 | 76 | |
77 | 77 | } else { |
78 | 78 | |
79 | 79 | // Only send to PayPal if the pending payment is created successfully. |
80 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
80 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
81 | 81 | |
82 | 82 | // Get the success url. |
83 | - $return_url = add_query_arg( array( |
|
83 | + $return_url = add_query_arg(array( |
|
84 | 84 | 'payment-confirmation' => 'paypal', |
85 | 85 | 'payment-id' => $payment_id |
86 | 86 | |
87 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
87 | + ), get_permalink(give_get_option('success_page'))); |
|
88 | 88 | |
89 | 89 | // Get the PayPal redirect uri. |
90 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
90 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
91 | 91 | |
92 | 92 | //Item name - pass level name if variable priced. |
93 | 93 | $item_name = $purchase_data['post_data']['give-form-title']; |
94 | 94 | |
95 | 95 | //Verify has variable prices. |
96 | - if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) { |
|
96 | + if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) { |
|
97 | 97 | |
98 | - $item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
98 | + $item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']); |
|
99 | 99 | |
100 | - $price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
100 | + $price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']); |
|
101 | 101 | |
102 | 102 | //Donation given doesn't match selected level (must be a custom amount). |
103 | - if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) { |
|
104 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
103 | + if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) { |
|
104 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
105 | 105 | //user custom amount text if any, fallback to default if not. |
106 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
106 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
107 | 107 | |
108 | 108 | } //Is there any donation level text? |
109 | - elseif ( ! empty( $item_price_level_text ) ) { |
|
110 | - $item_name .= ' - ' . $item_price_level_text; |
|
109 | + elseif ( ! empty($item_price_level_text)) { |
|
110 | + $item_name .= ' - '.$item_price_level_text; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | } //Single donation: Custom Amount. |
114 | - elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) { |
|
115 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
114 | + elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) { |
|
115 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
116 | 116 | //user custom amount text if any, fallback to default if not. |
117 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
117 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Setup PayPal API params. |
121 | 121 | $paypal_args = array( |
122 | - 'business' => give_get_option( 'paypal_email', false ), |
|
122 | + 'business' => give_get_option('paypal_email', false), |
|
123 | 123 | 'first_name' => $purchase_data['user_info']['first_name'], |
124 | 124 | 'last_name' => $purchase_data['user_info']['last_name'], |
125 | 125 | 'email' => $purchase_data['user_email'], |
126 | 126 | 'invoice' => $purchase_data['purchase_key'], |
127 | 127 | 'amount' => $purchase_data['price'], |
128 | - 'item_name' => stripslashes( $item_name ), |
|
128 | + 'item_name' => stripslashes($item_name), |
|
129 | 129 | 'no_shipping' => '1', |
130 | 130 | 'shipping' => '0', |
131 | 131 | 'no_note' => '1', |
132 | 132 | 'currency_code' => give_get_currency(), |
133 | - 'charset' => get_bloginfo( 'charset' ), |
|
133 | + 'charset' => get_bloginfo('charset'), |
|
134 | 134 | 'custom' => $payment_id, |
135 | 135 | 'rm' => '2', |
136 | 136 | 'return' => $return_url, |
137 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
137 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
138 | 138 | 'notify_url' => $listener_url, |
139 | 139 | 'page_style' => give_get_paypal_page_style(), |
140 | - 'cbt' => get_bloginfo( 'name' ), |
|
140 | + 'cbt' => get_bloginfo('name'), |
|
141 | 141 | 'bn' => 'givewp_SP' |
142 | 142 | ); |
143 | 143 | |
144 | 144 | //Add user address if present. |
145 | - if ( ! empty( $purchase_data['user_info']['address'] ) ) { |
|
146 | - $paypal_args['address1'] = isset( $purchase_data['user_info']['address']['line1'] ) ? $purchase_data['user_info']['address']['line1'] : ''; |
|
147 | - $paypal_args['address2'] = isset( $purchase_data['user_info']['address']['line2'] ) ? $purchase_data['user_info']['address']['line2'] : ''; |
|
148 | - $paypal_args['city'] = isset( $purchase_data['user_info']['address']['city'] ) ? $purchase_data['user_info']['address']['city'] : ''; |
|
149 | - $paypal_args['state'] = isset( $purchase_data['user_info']['address']['state'] ) ? $purchase_data['user_info']['address']['state'] : ''; |
|
150 | - $paypal_args['country'] = isset( $purchase_data['user_info']['address']['country'] ) ? $purchase_data['user_info']['address']['country'] : ''; |
|
145 | + if ( ! empty($purchase_data['user_info']['address'])) { |
|
146 | + $paypal_args['address1'] = isset($purchase_data['user_info']['address']['line1']) ? $purchase_data['user_info']['address']['line1'] : ''; |
|
147 | + $paypal_args['address2'] = isset($purchase_data['user_info']['address']['line2']) ? $purchase_data['user_info']['address']['line2'] : ''; |
|
148 | + $paypal_args['city'] = isset($purchase_data['user_info']['address']['city']) ? $purchase_data['user_info']['address']['city'] : ''; |
|
149 | + $paypal_args['state'] = isset($purchase_data['user_info']['address']['state']) ? $purchase_data['user_info']['address']['state'] : ''; |
|
150 | + $paypal_args['country'] = isset($purchase_data['user_info']['address']['country']) ? $purchase_data['user_info']['address']['country'] : ''; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | //Donations or regular transactions? |
154 | - if ( give_get_option( 'paypal_button_type' ) === 'standard' ) { |
|
154 | + if (give_get_option('paypal_button_type') === 'standard') { |
|
155 | 155 | $paypal_extra_args = array( |
156 | 156 | 'cmd' => '_xclick', |
157 | 157 | ); |
@@ -161,23 +161,23 @@ discard block |
||
161 | 161 | ); |
162 | 162 | } |
163 | 163 | |
164 | - $paypal_args = array_merge( $paypal_extra_args, $paypal_args ); |
|
165 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data ); |
|
164 | + $paypal_args = array_merge($paypal_extra_args, $paypal_args); |
|
165 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data); |
|
166 | 166 | |
167 | 167 | // Build query. |
168 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
168 | + $paypal_redirect .= http_build_query($paypal_args); |
|
169 | 169 | |
170 | 170 | // Fix for some sites that encode the entities. |
171 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
171 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
172 | 172 | |
173 | 173 | // Redirect to PayPal. |
174 | - wp_redirect( $paypal_redirect ); |
|
174 | + wp_redirect($paypal_redirect); |
|
175 | 175 | exit; |
176 | 176 | } |
177 | 177 | |
178 | 178 | } |
179 | 179 | |
180 | -add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' ); |
|
180 | +add_action('give_gateway_paypal', 'give_process_paypal_purchase'); |
|
181 | 181 | |
182 | 182 | /** |
183 | 183 | * Listens for a PayPal IPN requests and then sends to the processing function |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function give_listen_for_paypal_ipn() { |
189 | 189 | // Regular PayPal IPN |
190 | - if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) { |
|
191 | - do_action( 'give_verify_paypal_ipn' ); |
|
190 | + if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') { |
|
191 | + do_action('give_verify_paypal_ipn'); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
195 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Process PayPal IPN |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | function give_process_paypal_ipn() { |
204 | 204 | |
205 | 205 | // Check the request method is POST |
206 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
206 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | $post_data = ''; |
212 | 212 | |
213 | 213 | // Fallback just in case post_max_size is lower than needed |
214 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
215 | - $post_data = file_get_contents( 'php://input' ); |
|
214 | + if (ini_get('allow_url_fopen')) { |
|
215 | + $post_data = file_get_contents('php://input'); |
|
216 | 216 | } else { |
217 | 217 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
218 | - ini_set( 'post_max_size', '12M' ); |
|
218 | + ini_set('post_max_size', '12M'); |
|
219 | 219 | } |
220 | 220 | // Start the encoded data collection with notification command |
221 | 221 | $encoded_data = 'cmd=_notify-validate'; |
@@ -224,40 +224,40 @@ discard block |
||
224 | 224 | $arg_separator = give_get_php_arg_separator_output(); |
225 | 225 | |
226 | 226 | // Verify there is a post_data |
227 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
227 | + if ($post_data || strlen($post_data) > 0) { |
|
228 | 228 | // Append the data |
229 | - $encoded_data .= $arg_separator . $post_data; |
|
229 | + $encoded_data .= $arg_separator.$post_data; |
|
230 | 230 | } else { |
231 | 231 | // Check if POST is empty |
232 | - if ( empty( $_POST ) ) { |
|
232 | + if (empty($_POST)) { |
|
233 | 233 | // Nothing to do |
234 | 234 | return; |
235 | 235 | } else { |
236 | 236 | // Loop through each POST |
237 | - foreach ( $_POST as $key => $value ) { |
|
237 | + foreach ($_POST as $key => $value) { |
|
238 | 238 | // Encode the value and append the data. |
239 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
239 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | 244 | // Convert collected post data to an array. |
245 | - parse_str( $encoded_data, $encoded_data_array ); |
|
245 | + parse_str($encoded_data, $encoded_data_array); |
|
246 | 246 | |
247 | - foreach ( $encoded_data_array as $key => $value ) { |
|
247 | + foreach ($encoded_data_array as $key => $value) { |
|
248 | 248 | |
249 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
250 | - $new_key = str_replace( '&', '&', $key ); |
|
251 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
249 | + if (false !== strpos($key, 'amp;')) { |
|
250 | + $new_key = str_replace('&', '&', $key); |
|
251 | + $new_key = str_replace('amp;', '&', $new_key); |
|
252 | 252 | |
253 | - unset( $encoded_data_array[ $key ] ); |
|
254 | - $encoded_data_array[ $new_key ] = $value; |
|
253 | + unset($encoded_data_array[$key]); |
|
254 | + $encoded_data_array[$new_key] = $value; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | } |
258 | 258 | |
259 | 259 | //Validate IPN request w/ PayPal if user hasn't disabled this security measure. |
260 | - if ( ! give_get_option( 'disable_paypal_verification' ) ) { |
|
260 | + if ( ! give_get_option('disable_paypal_verification')) { |
|
261 | 261 | |
262 | 262 | $remote_post_vars = array( |
263 | 263 | 'method' => 'POST', |
@@ -277,28 +277,28 @@ discard block |
||
277 | 277 | ); |
278 | 278 | |
279 | 279 | // Validate the IPN. |
280 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
280 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
281 | 281 | |
282 | - if ( is_wp_error( $api_response ) ) { |
|
282 | + if (is_wp_error($api_response)) { |
|
283 | 283 | give_record_gateway_error( |
284 | - esc_html__( 'IPN Error', 'give' ), |
|
284 | + esc_html__('IPN Error', 'give'), |
|
285 | 285 | sprintf( |
286 | 286 | /* translators: %s: Paypal IPN response */ |
287 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
288 | - json_encode( $api_response ) |
|
287 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
288 | + json_encode($api_response) |
|
289 | 289 | ) |
290 | 290 | ); |
291 | 291 | |
292 | 292 | return; // Something went wrong |
293 | 293 | } |
294 | 294 | |
295 | - if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) { |
|
295 | + if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) { |
|
296 | 296 | give_record_gateway_error( |
297 | - esc_html__( 'IPN Error', 'give' ), |
|
297 | + esc_html__('IPN Error', 'give'), |
|
298 | 298 | sprintf( |
299 | 299 | /* translators: %s: Paypal IPN response */ |
300 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
301 | - json_encode( $api_response ) |
|
300 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
301 | + json_encode($api_response) |
|
302 | 302 | ) |
303 | 303 | ); |
304 | 304 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | // Check if $post_data_array has been populated |
311 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
311 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
312 | 312 | return; |
313 | 313 | } |
314 | 314 | |
@@ -317,21 +317,21 @@ discard block |
||
317 | 317 | 'payment_status' => '' |
318 | 318 | ); |
319 | 319 | |
320 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
320 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
321 | 321 | |
322 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
322 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
323 | 323 | |
324 | - if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) { |
|
324 | + if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) { |
|
325 | 325 | // Allow PayPal IPN types to be processed separately. |
326 | - do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id ); |
|
326 | + do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id); |
|
327 | 327 | } else { |
328 | 328 | // Fallback to web accept just in case the txn_type isn't present. |
329 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
329 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
330 | 330 | } |
331 | 331 | exit; |
332 | 332 | } |
333 | 333 | |
334 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
334 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Process web accept (one time) payment IPNs. |
@@ -343,127 +343,127 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return void |
345 | 345 | */ |
346 | -function give_process_paypal_web_accept_and_cart( $data, $payment_id ) { |
|
346 | +function give_process_paypal_web_accept_and_cart($data, $payment_id) { |
|
347 | 347 | |
348 | 348 | //Only allow through these transaction types. |
349 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) { |
|
349 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') { |
|
350 | 350 | return; |
351 | 351 | } |
352 | 352 | |
353 | 353 | //Need $payment_id to continue. |
354 | - if ( empty( $payment_id ) ) { |
|
354 | + if (empty($payment_id)) { |
|
355 | 355 | return; |
356 | 356 | } |
357 | 357 | |
358 | 358 | // Collect donation payment details. |
359 | 359 | $paypal_amount = $data['mc_gross']; |
360 | - $payment_status = strtolower( $data['payment_status'] ); |
|
361 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
362 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
363 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
360 | + $payment_status = strtolower($data['payment_status']); |
|
361 | + $currency_code = strtolower($data['mc_currency']); |
|
362 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
363 | + $payment_meta = give_get_payment_meta($payment_id); |
|
364 | 364 | |
365 | 365 | // Must be a PayPal standard IPN. |
366 | - if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) { |
|
366 | + if (give_get_payment_gateway($payment_id) != 'paypal') { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
370 | 370 | // Verify payment recipient |
371 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) { |
|
371 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) { |
|
372 | 372 | |
373 | 373 | give_record_gateway_error( |
374 | - esc_html__( 'IPN Error', 'give' ), |
|
374 | + esc_html__('IPN Error', 'give'), |
|
375 | 375 | sprintf( |
376 | 376 | /* translators: %s: Paypal IPN response */ |
377 | - esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), |
|
378 | - json_encode( $data ) |
|
377 | + esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), |
|
378 | + json_encode($data) |
|
379 | 379 | ), |
380 | 380 | $payment_id |
381 | 381 | ); |
382 | - give_update_payment_status( $payment_id, 'failed' ); |
|
383 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
382 | + give_update_payment_status($payment_id, 'failed'); |
|
383 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give')); |
|
384 | 384 | |
385 | 385 | return; |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Verify payment currency. |
389 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
389 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
390 | 390 | |
391 | 391 | give_record_gateway_error( |
392 | - esc_html__( 'IPN Error', 'give' ), |
|
392 | + esc_html__('IPN Error', 'give'), |
|
393 | 393 | sprintf( |
394 | 394 | /* translators: %s: Paypal IPN response */ |
395 | - esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), |
|
396 | - json_encode( $data ) |
|
395 | + esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), |
|
396 | + json_encode($data) |
|
397 | 397 | ), |
398 | 398 | $payment_id |
399 | 399 | ); |
400 | - give_update_payment_status( $payment_id, 'failed' ); |
|
401 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
400 | + give_update_payment_status($payment_id, 'failed'); |
|
401 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
402 | 402 | |
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | 406 | //Process refunds & reversed. |
407 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
408 | - give_process_paypal_refund( $data, $payment_id ); |
|
407 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
408 | + give_process_paypal_refund($data, $payment_id); |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | 412 | // Only complete payments once. |
413 | - if ( get_post_status( $payment_id ) == 'publish' ) { |
|
413 | + if (get_post_status($payment_id) == 'publish') { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
417 | 417 | // Retrieve the total donation amount (before PayPal). |
418 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
418 | + $payment_amount = give_get_payment_amount($payment_id); |
|
419 | 419 | |
420 | 420 | //Check that the donation PP and local db amounts match. |
421 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
421 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
422 | 422 | // The prices don't match |
423 | 423 | give_record_gateway_error( |
424 | - esc_html__( 'IPN Error', 'give' ), |
|
424 | + esc_html__('IPN Error', 'give'), |
|
425 | 425 | sprintf( |
426 | 426 | /* translators: %s: Paypal IPN response */ |
427 | - esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), |
|
428 | - json_encode( $data ) |
|
427 | + esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), |
|
428 | + json_encode($data) |
|
429 | 429 | ), |
430 | 430 | $payment_id |
431 | 431 | ); |
432 | - give_update_payment_status( $payment_id, 'failed' ); |
|
433 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
432 | + give_update_payment_status($payment_id, 'failed'); |
|
433 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
434 | 434 | |
435 | 435 | return; |
436 | 436 | } |
437 | 437 | |
438 | 438 | //Process completed donations. |
439 | - if ( $payment_status == 'completed' || give_is_test_mode() ) { |
|
439 | + if ($payment_status == 'completed' || give_is_test_mode()) { |
|
440 | 440 | |
441 | 441 | give_insert_payment_note( |
442 | 442 | $payment_id, |
443 | 443 | sprintf( |
444 | 444 | /* translators: %s: Paypal transaction ID */ |
445 | - esc_html__( 'PayPal Transaction ID: %s', 'give' ), |
|
445 | + esc_html__('PayPal Transaction ID: %s', 'give'), |
|
446 | 446 | $data['txn_id'] |
447 | 447 | ) |
448 | 448 | ); |
449 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
450 | - give_update_payment_status( $payment_id, 'publish' ); |
|
449 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
450 | + give_update_payment_status($payment_id, 'publish'); |
|
451 | 451 | |
452 | - } elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
452 | + } elseif ('pending' == $payment_status && isset($data['pending_reason'])) { |
|
453 | 453 | |
454 | 454 | // Look for possible pending reasons, such as an echeck. |
455 | - $note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) ); |
|
455 | + $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason'])); |
|
456 | 456 | |
457 | - if ( ! empty( $note ) ) { |
|
457 | + if ( ! empty($note)) { |
|
458 | 458 | |
459 | - give_insert_payment_note( $payment_id, $note ); |
|
459 | + give_insert_payment_note($payment_id, $note); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
464 | 464 | } |
465 | 465 | |
466 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 ); |
|
466 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2); |
|
467 | 467 | |
468 | 468 | /** |
469 | 469 | * Process PayPal IPN Refunds |
@@ -475,28 +475,28 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return void |
477 | 477 | */ |
478 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
478 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
479 | 479 | |
480 | 480 | // Collect payment details |
481 | 481 | |
482 | - if ( empty( $payment_id ) ) { |
|
482 | + if (empty($payment_id)) { |
|
483 | 483 | return; |
484 | 484 | } |
485 | 485 | |
486 | - if ( get_post_status( $payment_id ) == 'refunded' ) { |
|
486 | + if (get_post_status($payment_id) == 'refunded') { |
|
487 | 487 | return; // Only refund payments once |
488 | 488 | } |
489 | 489 | |
490 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
490 | + $payment_amount = give_get_payment_amount($payment_id); |
|
491 | 491 | $refund_amount = $data['payment_gross'] * - 1; |
492 | 492 | |
493 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
493 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
494 | 494 | |
495 | 495 | give_insert_payment_note( |
496 | 496 | $payment_id, |
497 | 497 | sprintf( |
498 | 498 | /* translators: %s: Paypal parent transaction ID */ |
499 | - esc_html__( 'Partial PayPal refund processed: %s', 'give' ), |
|
499 | + esc_html__('Partial PayPal refund processed: %s', 'give'), |
|
500 | 500 | $data['parent_txn_id'] |
501 | 501 | ) |
502 | 502 | ); |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | $payment_id, |
510 | 510 | sprintf( |
511 | 511 | /* translators: %s: Paypal parent transaction ID */ |
512 | - esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ), |
|
512 | + esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'), |
|
513 | 513 | $data['parent_txn_id'], $data['reason_code'] |
514 | 514 | ) |
515 | 515 | ); |
@@ -517,11 +517,11 @@ discard block |
||
517 | 517 | $payment_id, |
518 | 518 | sprintf( |
519 | 519 | /* translators: %s: Paypal transaction ID */ |
520 | - esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ), |
|
520 | + esc_html__('PayPal Refund Transaction ID: %s', 'give'), |
|
521 | 521 | $data['txn_id'] |
522 | 522 | ) |
523 | 523 | ); |
524 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
524 | + give_update_payment_status($payment_id, 'refunded'); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
@@ -533,24 +533,24 @@ discard block |
||
533 | 533 | * |
534 | 534 | * @return string |
535 | 535 | */ |
536 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
536 | +function give_get_paypal_redirect($ssl_check = false) { |
|
537 | 537 | |
538 | - if ( is_ssl() || ! $ssl_check ) { |
|
538 | + if (is_ssl() || ! $ssl_check) { |
|
539 | 539 | $protocal = 'https://'; |
540 | 540 | } else { |
541 | 541 | $protocal = 'http://'; |
542 | 542 | } |
543 | 543 | |
544 | 544 | // Check the current payment mode |
545 | - if ( give_is_test_mode() ) { |
|
545 | + if (give_is_test_mode()) { |
|
546 | 546 | // Test mode |
547 | - $paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
547 | + $paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
548 | 548 | } else { |
549 | 549 | // Live mode |
550 | - $paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr'; |
|
550 | + $paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr'; |
|
551 | 551 | } |
552 | 552 | |
553 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
553 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | * @return string |
561 | 561 | */ |
562 | 562 | function give_get_paypal_page_style() { |
563 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
563 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
564 | 564 | |
565 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
565 | + return apply_filters('give_paypal_page_style', $page_style); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -577,26 +577,26 @@ discard block |
||
577 | 577 | * @return string |
578 | 578 | * |
579 | 579 | */ |
580 | -function give_paypal_success_page_content( $content ) { |
|
580 | +function give_paypal_success_page_content($content) { |
|
581 | 581 | |
582 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
582 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
583 | 583 | return $content; |
584 | 584 | } |
585 | 585 | |
586 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
586 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
587 | 587 | |
588 | - if ( ! $payment_id ) { |
|
588 | + if ( ! $payment_id) { |
|
589 | 589 | $session = give_get_purchase_session(); |
590 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
590 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
591 | 591 | } |
592 | 592 | |
593 | - $payment = get_post( $payment_id ); |
|
594 | - if ( $payment && 'pending' == $payment->post_status ) { |
|
593 | + $payment = get_post($payment_id); |
|
594 | + if ($payment && 'pending' == $payment->post_status) { |
|
595 | 595 | |
596 | 596 | // Payment is still pending so show processing indicator to fix the race condition. |
597 | 597 | ob_start(); |
598 | 598 | |
599 | - give_get_template_part( 'payment', 'processing' ); |
|
599 | + give_get_template_part('payment', 'processing'); |
|
600 | 600 | |
601 | 601 | $content = ob_get_clean(); |
602 | 602 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | |
607 | 607 | } |
608 | 608 | |
609 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
609 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
610 | 610 | |
611 | 611 | /** |
612 | 612 | * Given a Payment ID, extract the transaction ID |
@@ -617,22 +617,22 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @return string Transaction ID |
619 | 619 | */ |
620 | -function give_paypal_get_payment_transaction_id( $payment_id ) { |
|
620 | +function give_paypal_get_payment_transaction_id($payment_id) { |
|
621 | 621 | |
622 | 622 | $transaction_id = ''; |
623 | - $notes = give_get_payment_notes( $payment_id ); |
|
623 | + $notes = give_get_payment_notes($payment_id); |
|
624 | 624 | |
625 | - foreach ( $notes as $note ) { |
|
626 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
625 | + foreach ($notes as $note) { |
|
626 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
627 | 627 | $transaction_id = $match[1]; |
628 | 628 | continue; |
629 | 629 | } |
630 | 630 | } |
631 | 631 | |
632 | - return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
632 | + return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); |
|
633 | 633 | } |
634 | 634 | |
635 | -add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 ); |
|
635 | +add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1); |
|
636 | 636 | |
637 | 637 | /** |
638 | 638 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -644,16 +644,16 @@ discard block |
||
644 | 644 | * |
645 | 645 | * @return string A link to the PayPal transaction details |
646 | 646 | */ |
647 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
647 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
648 | 648 | |
649 | 649 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
650 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
650 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
651 | 651 | |
652 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
652 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
653 | 653 | |
654 | 654 | } |
655 | 655 | |
656 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
656 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
657 | 657 | |
658 | 658 | |
659 | 659 | /** |
@@ -665,62 +665,62 @@ discard block |
||
665 | 665 | * |
666 | 666 | * @return string |
667 | 667 | */ |
668 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
668 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
669 | 669 | |
670 | - switch ( $pending_reason ) { |
|
670 | + switch ($pending_reason) { |
|
671 | 671 | |
672 | 672 | case 'echeck' : |
673 | 673 | |
674 | - $note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
674 | + $note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
675 | 675 | |
676 | 676 | break; |
677 | 677 | |
678 | 678 | case 'address' : |
679 | 679 | |
680 | - $note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
680 | + $note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
681 | 681 | |
682 | 682 | break; |
683 | 683 | |
684 | 684 | case 'intl' : |
685 | 685 | |
686 | - $note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
686 | + $note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
687 | 687 | |
688 | 688 | break; |
689 | 689 | |
690 | 690 | case 'multi-currency' : |
691 | 691 | |
692 | - $note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
692 | + $note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
693 | 693 | |
694 | 694 | break; |
695 | 695 | |
696 | 696 | case 'paymentreview' : |
697 | 697 | case 'regulatory_review' : |
698 | 698 | |
699 | - $note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
699 | + $note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
700 | 700 | |
701 | 701 | break; |
702 | 702 | |
703 | 703 | case 'unilateral' : |
704 | 704 | |
705 | - $note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
705 | + $note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
706 | 706 | |
707 | 707 | break; |
708 | 708 | |
709 | 709 | case 'upgrade' : |
710 | 710 | |
711 | - $note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
711 | + $note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
712 | 712 | |
713 | 713 | break; |
714 | 714 | |
715 | 715 | case 'verify' : |
716 | 716 | |
717 | - $note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
717 | + $note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
718 | 718 | |
719 | 719 | break; |
720 | 720 | |
721 | 721 | case 'other' : |
722 | 722 | |
723 | - $note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
723 | + $note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
724 | 724 | |
725 | 725 | break; |
726 | 726 |
@@ -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(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function __clone() { |
234 | 234 | // Cloning instances of the class is forbidden |
235 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
235 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function __wakeup() { |
247 | 247 | // Unserializing instances of the class is forbidden. |
248 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
248 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | private function setup_constants() { |
260 | 260 | |
261 | 261 | // Plugin version |
262 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
263 | - define( 'GIVE_VERSION', '1.6.4' ); |
|
262 | + if ( ! defined('GIVE_VERSION')) { |
|
263 | + define('GIVE_VERSION', '1.6.4'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | // Plugin Folder Path |
267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
267 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | // Plugin Folder URL |
272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
272 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // Plugin Basename aka: "give/give.php" |
277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // Plugin Root File |
282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
282 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
283 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | // Make sure CAL_GREGORIAN is defined |
287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
288 | - define( 'CAL_GREGORIAN', 1 ); |
|
287 | + if ( ! defined('CAL_GREGORIAN')) { |
|
288 | + define('CAL_GREGORIAN', 1); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,111 +300,111 @@ discard block |
||
300 | 300 | private function includes() { |
301 | 301 | global $give_options; |
302 | 302 | |
303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
304 | 304 | $give_options = give_get_settings(); |
305 | 305 | |
306 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
311 | - |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
314 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
326 | - |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
342 | - |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
348 | - |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
354 | - |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
360 | - |
|
361 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
362 | - |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
374 | - |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
377 | - |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
383 | - |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
391 | - |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
401 | - |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
311 | + |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
326 | + |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
342 | + |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
348 | + |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
354 | + |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
360 | + |
|
361 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
362 | + |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
374 | + |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
377 | + |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
383 | + |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
391 | + |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
401 | + |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
404 | 404 | |
405 | 405 | } |
406 | 406 | |
407 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -418,26 +418,26 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function load_textdomain() { |
420 | 420 | // Set filter for Give's languages directory |
421 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
422 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
421 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
422 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
423 | 423 | |
424 | 424 | // Traditional WordPress plugin locale filter |
425 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
426 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
425 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
426 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
427 | 427 | |
428 | 428 | // Setup paths to current locale file |
429 | - $mofile_local = $give_lang_dir . $mofile; |
|
430 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
429 | + $mofile_local = $give_lang_dir.$mofile; |
|
430 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
431 | 431 | |
432 | - if ( file_exists( $mofile_global ) ) { |
|
432 | + if (file_exists($mofile_global)) { |
|
433 | 433 | // Look in global /wp-content/languages/give folder |
434 | - load_textdomain( 'give', $mofile_global ); |
|
435 | - } elseif ( file_exists( $mofile_local ) ) { |
|
434 | + load_textdomain('give', $mofile_global); |
|
435 | + } elseif (file_exists($mofile_local)) { |
|
436 | 436 | // Look in local location from filter `give_languages_directory` |
437 | - load_textdomain( 'give', $mofile_local ); |
|
437 | + load_textdomain('give', $mofile_local); |
|
438 | 438 | } else { |
439 | 439 | // Load the default language files packaged up w/ Give |
440 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
440 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 |
@@ -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,56 +40,56 @@ 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 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | 60 | /* translators: %s: form settings url */ |
61 | - $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 ); |
|
62 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
61 | + $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); |
|
62 | + echo wpautop(stripslashes($offline_instructions)); |
|
63 | 63 | ?> |
64 | 64 | </fieldset> |
65 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
65 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
66 | 66 | <?php |
67 | 67 | echo ob_get_clean(); |
68 | 68 | } |
69 | 69 | |
70 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
70 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Give Offline Billing Field |
74 | 74 | * |
75 | 75 | * @param $form_id |
76 | 76 | */ |
77 | -function give_offline_billing_fields( $form_id ) { |
|
77 | +function give_offline_billing_fields($form_id) { |
|
78 | 78 | //Enable Default CC fields (billing info) |
79 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
80 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
79 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
80 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
81 | 81 | |
82 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
82 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
83 | 83 | |
84 | 84 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
85 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
86 | - give_default_cc_address_fields( $form_id ); |
|
87 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | - give_default_cc_address_fields( $form_id ); |
|
85 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
86 | + give_default_cc_address_fields($form_id); |
|
87 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
88 | + give_default_cc_address_fields($form_id); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
92 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Process the payment |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return void |
102 | 102 | */ |
103 | -function give_offline_process_payment( $purchase_data ) { |
|
103 | +function give_offline_process_payment($purchase_data) { |
|
104 | 104 | |
105 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
105 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
106 | 106 | |
107 | 107 | // setup the payment details |
108 | 108 | $payment_data = array( |
109 | 109 | 'price' => $purchase_data['price'], |
110 | 110 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
111 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
112 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
111 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
112 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
113 | 113 | 'date' => $purchase_data['date'], |
114 | 114 | 'user_email' => $purchase_data['user_email'], |
115 | 115 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // record the pending payment |
124 | - $payment = give_insert_payment( $payment_data ); |
|
124 | + $payment = give_insert_payment($payment_data); |
|
125 | 125 | |
126 | - if ( $payment ) { |
|
127 | - give_offline_send_admin_notice( $payment ); |
|
128 | - give_offline_send_donor_instructions( $payment ); |
|
126 | + if ($payment) { |
|
127 | + give_offline_send_admin_notice($payment); |
|
128 | + give_offline_send_donor_instructions($payment); |
|
129 | 129 | give_send_to_success_page(); |
130 | 130 | } else { |
131 | 131 | // if errors are present, send the user back to the donation form so they can be corrected |
132 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
132 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
137 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -147,47 +147,47 @@ discard block |
||
147 | 147 | * @since 1.0 |
148 | 148 | * @return void |
149 | 149 | */ |
150 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
150 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
151 | 151 | |
152 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
153 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
152 | + $payment_data = give_get_payment_meta($payment_id); |
|
153 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
154 | 154 | |
155 | 155 | //Customize email content depending on whether the single form has been customized |
156 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
156 | + $email_content = give_get_option('global_offline_donation_email'); |
|
157 | 157 | |
158 | - if ( $post_offline_customization_option === 'yes' ) { |
|
159 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
158 | + if ($post_offline_customization_option === 'yes') { |
|
159 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
160 | 160 | } |
161 | 161 | |
162 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
163 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
162 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
163 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
164 | 164 | |
165 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
166 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
165 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
166 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
167 | 167 | |
168 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
168 | + $to_email = give_get_payment_user_email($payment_id); |
|
169 | 169 | |
170 | - $subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
171 | - if ( $post_offline_customization_option === 'yes' ) { |
|
172 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
170 | + $subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give')); |
|
171 | + if ($post_offline_customization_option === 'yes') { |
|
172 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
173 | 173 | } |
174 | 174 | |
175 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
176 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
175 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
176 | + $subject = give_do_email_tags($subject, $payment_id); |
|
177 | 177 | |
178 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
179 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
178 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
179 | + $message = give_do_email_tags($email_content, $payment_id); |
|
180 | 180 | |
181 | 181 | $emails = Give()->emails; |
182 | 182 | |
183 | - $emails->__set( 'from_name', $from_name ); |
|
184 | - $emails->__set( 'from_email', $from_email ); |
|
185 | - $emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) ); |
|
183 | + $emails->__set('from_name', $from_name); |
|
184 | + $emails->__set('from_email', $from_email); |
|
185 | + $emails->__set('heading', esc_html__('Offline Donation Instructions', 'give')); |
|
186 | 186 | |
187 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
188 | - $emails->__set( 'headers', $headers ); |
|
187 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
188 | + $emails->__set('headers', $headers); |
|
189 | 189 | |
190 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
190 | + $emails->send($to_email, $subject, $message, $attachments); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -204,52 +204,52 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | * |
206 | 206 | */ |
207 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
207 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
208 | 208 | |
209 | 209 | /* Send an email notification to the admin */ |
210 | 210 | $admin_email = give_get_admin_notice_emails(); |
211 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
211 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
212 | 212 | |
213 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
214 | - $user_data = get_userdata( $user_info['id'] ); |
|
213 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
214 | + $user_data = get_userdata($user_info['id']); |
|
215 | 215 | $name = $user_data->display_name; |
216 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
217 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
216 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
217 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
218 | 218 | } else { |
219 | 219 | $name = $user_info['email']; |
220 | 220 | } |
221 | 221 | |
222 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
222 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
223 | 223 | |
224 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
224 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
225 | 225 | |
226 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
227 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
228 | - $admin_message .= esc_attr__( 'Hooray! 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"; |
|
226 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
227 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
228 | + $admin_message .= esc_attr__('Hooray! 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"; |
|
229 | 229 | |
230 | 230 | |
231 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . '{fullname}' . "\n"; |
|
232 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . '{amount}' . "\n\n"; |
|
231 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.'{fullname}'."\n"; |
|
232 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.'{amount}'."\n\n"; |
|
233 | 233 | |
234 | 234 | $admin_message .= sprintf( |
235 | 235 | '<a href="%1$s">%2$s</a>', |
236 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
237 | - esc_html__( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
238 | - ) . "\n\n"; |
|
236 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
237 | + esc_html__('Click Here to View and/or Update Donation Details', 'give') |
|
238 | + )."\n\n"; |
|
239 | 239 | |
240 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
241 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
240 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
241 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
242 | 242 | |
243 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
244 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
243 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
244 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
245 | 245 | |
246 | 246 | //Send Email |
247 | 247 | $emails = Give()->emails; |
248 | - if ( ! empty( $admin_headers ) ) { |
|
249 | - $emails->__set( 'headers', $admin_headers ); |
|
248 | + if ( ! empty($admin_headers)) { |
|
249 | + $emails->__set('headers', $admin_headers); |
|
250 | 250 | } |
251 | 251 | |
252 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
252 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | |
@@ -260,15 +260,15 @@ discard block |
||
260 | 260 | * @since 1.0 |
261 | 261 | * @return array |
262 | 262 | */ |
263 | -function give_offline_add_settings( $settings ) { |
|
263 | +function give_offline_add_settings($settings) { |
|
264 | 264 | |
265 | 265 | //Vars |
266 | 266 | $prefix = '_give_'; |
267 | 267 | |
268 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
268 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
269 | 269 | |
270 | 270 | //this gateway isn't active |
271 | - if ( ! $is_gateway_active ) { |
|
271 | + if ( ! $is_gateway_active) { |
|
272 | 272 | //return settings and bounce |
273 | 273 | return $settings; |
274 | 274 | } |
@@ -277,27 +277,27 @@ discard block |
||
277 | 277 | $check_settings = array( |
278 | 278 | |
279 | 279 | array( |
280 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
281 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
282 | - 'id' => $prefix . 'customize_offline_donations', |
|
280 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
281 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
282 | + 'id' => $prefix.'customize_offline_donations', |
|
283 | 283 | 'type' => 'radio_inline', |
284 | 284 | 'default' => 'no', |
285 | 285 | 'options' => array( |
286 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
287 | - 'no' => esc_attr__( 'No', 'give' ), |
|
286 | + 'yes' => esc_attr__('Yes', 'give'), |
|
287 | + 'no' => esc_attr__('No', 'give'), |
|
288 | 288 | ), |
289 | 289 | ), |
290 | 290 | array( |
291 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
292 | - 'desc' => esc_attr__( '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' ), |
|
293 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
291 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
292 | + 'desc' => esc_attr__('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'), |
|
293 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
294 | 294 | 'row_classes' => 'give-subfield', |
295 | 295 | 'type' => 'checkbox' |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'id' => $prefix . 'offline_checkout_notes', |
|
299 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
300 | - 'desc' => esc_attr__( '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' ), |
|
298 | + 'id' => $prefix.'offline_checkout_notes', |
|
299 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
300 | + 'desc' => esc_attr__('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'), |
|
301 | 301 | 'default' => give_get_default_offline_donation_content(), |
302 | 302 | 'type' => 'wysiwyg', |
303 | 303 | 'row_classes' => 'give-subfield', |
@@ -306,17 +306,17 @@ discard block |
||
306 | 306 | ) |
307 | 307 | ), |
308 | 308 | array( |
309 | - 'id' => $prefix . 'offline_donation_subject', |
|
310 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
311 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
312 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
309 | + 'id' => $prefix.'offline_donation_subject', |
|
310 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
311 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
312 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
313 | 313 | 'row_classes' => 'give-subfield', |
314 | 314 | 'type' => 'text' |
315 | 315 | ), |
316 | 316 | array( |
317 | - 'id' => $prefix . 'offline_donation_email', |
|
318 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
319 | - 'desc' => esc_attr__( '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' ), |
|
317 | + 'id' => $prefix.'offline_donation_email', |
|
318 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
319 | + 'desc' => esc_attr__('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'), |
|
320 | 320 | 'default' => give_get_default_offline_donation_email_content(), |
321 | 321 | 'type' => 'wysiwyg', |
322 | 322 | 'row_classes' => 'give-subfield', |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | ) |
327 | 327 | ); |
328 | 328 | |
329 | - return array_merge( $settings, $check_settings ); |
|
329 | + return array_merge($settings, $check_settings); |
|
330 | 330 | } |
331 | 331 | |
332 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
332 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
333 | 333 | |
334 | 334 | |
335 | 335 | /** |
@@ -341,32 +341,32 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function give_get_default_offline_donation_content() { |
343 | 343 | |
344 | - $sitename = get_bloginfo( 'sitename' ); |
|
344 | + $sitename = get_bloginfo('sitename'); |
|
345 | 345 | |
346 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
346 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
347 | 347 | $default_text .= '<ol>'; |
348 | 348 | $default_text .= '<li>'; |
349 | 349 | $default_text .= sprintf( |
350 | 350 | /* translators: %s: site name */ |
351 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
351 | + esc_html__('Make a check payable to "%s"', 'give'), |
|
352 | 352 | $sitename |
353 | 353 | ); |
354 | 354 | $default_text .= '</li>'; |
355 | 355 | $default_text .= '<li>'; |
356 | 356 | $default_text .= sprintf( |
357 | 357 | /* translators: %s: site name */ |
358 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
358 | + esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
359 | 359 | $sitename |
360 | 360 | ); |
361 | 361 | $default_text .= '</li>'; |
362 | - $default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
362 | + $default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>'; |
|
363 | 363 | $default_text .= '</ol>'; |
364 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
364 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
365 | 365 | $default_text .= ' <em>123 G Street </em><br>'; |
366 | 366 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
367 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
367 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
368 | 368 | |
369 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
369 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | |
@@ -379,33 +379,33 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_email_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
383 | - $default_text = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>'; |
|
384 | - $default_text .= '<p>' . esc_html__( '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>'; |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | + $default_text = '<p>'.esc_html__('Dear {name},', 'give').'</p>'; |
|
384 | + $default_text .= '<p>'.esc_html__('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>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - esc_html__( 'Make a check payable to "%s"', 'give' ), |
|
389 | + esc_html__('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 | - esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + esc_html__('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>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.esc_html__('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>123 G Street </em><br>'; |
404 | 404 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
405 | - $default_text .= '<p>' . esc_html__( '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>'; |
|
406 | - $default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>'; |
|
407 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
405 | + $default_text .= '<p>'.esc_html__('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>'; |
|
406 | + $default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>'; |
|
407 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
408 | 408 | |
409 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
409 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
410 | 410 | |
411 | 411 | } |
@@ -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 | |
@@ -26,38 +26,38 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
55 | - $emails->__set( 'headers', $headers ); |
|
54 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
55 | + $emails->__set('headers', $headers); |
|
56 | 56 | |
57 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
57 | + $emails->send($to_email, $subject, $message, $attachments); |
|
58 | 58 | |
59 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
60 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
59 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
60 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -70,29 +70,29 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function give_email_test_donation_receipt() { |
72 | 72 | |
73 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
74 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
73 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
74 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
75 | 75 | |
76 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
77 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
76 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
77 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
78 | 78 | |
79 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
80 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
81 | - $subject = give_do_email_tags( $subject, 0 ); |
|
79 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
80 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
81 | + $subject = give_do_email_tags($subject, 0); |
|
82 | 82 | |
83 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
83 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
84 | 84 | |
85 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
85 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
86 | 86 | |
87 | 87 | $emails = Give()->emails; |
88 | - $emails->__set( 'from_name', $from_name ); |
|
89 | - $emails->__set( 'from_email', $from_email ); |
|
90 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
88 | + $emails->__set('from_name', $from_name); |
|
89 | + $emails->__set('from_email', $from_email); |
|
90 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
91 | 91 | |
92 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
93 | - $emails->__set( 'headers', $headers ); |
|
92 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
93 | + $emails->__set('headers', $headers); |
|
94 | 94 | |
95 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
95 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -106,50 +106,50 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
109 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
110 | 110 | |
111 | - $payment_id = absint( $payment_id ); |
|
111 | + $payment_id = absint($payment_id); |
|
112 | 112 | |
113 | - if ( empty( $payment_id ) ) { |
|
113 | + if (empty($payment_id)) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
117 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
118 | 118 | return; |
119 | 119 | } |
120 | 120 | |
121 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
122 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
121 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
122 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
123 | 123 | |
124 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
125 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
124 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
125 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
126 | 126 | |
127 | 127 | /* translators: %s: payment id */ |
128 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
129 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
130 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
128 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
129 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
130 | + $subject = give_do_email_tags($subject, $payment_id); |
|
131 | 131 | |
132 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
133 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
132 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
133 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
134 | 134 | //$headers .= "MIME-Version: 1.0\r\n"; |
135 | 135 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
136 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
136 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
137 | 137 | |
138 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
138 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
139 | 139 | |
140 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
140 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
141 | 141 | |
142 | 142 | $emails = Give()->emails; |
143 | - $emails->__set( 'from_name', $from_name ); |
|
144 | - $emails->__set( 'from_email', $from_email ); |
|
145 | - $emails->__set( 'headers', $headers ); |
|
146 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
143 | + $emails->__set('from_name', $from_name); |
|
144 | + $emails->__set('from_email', $from_email); |
|
145 | + $emails->__set('headers', $headers); |
|
146 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
147 | 147 | |
148 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
148 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
152 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | |
162 | 162 | $email_option = give_get_option('admin_notice_emails'); |
163 | 163 | |
164 | - $emails = !empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
165 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
164 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
165 | + $emails = array_map('trim', explode("\n", $emails)); |
|
166 | 166 | |
167 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
167 | + return apply_filters('give_admin_notice_emails', $emails); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return mixed |
178 | 178 | */ |
179 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
179 | +function give_admin_notices_disabled($payment_id = 0) { |
|
180 | 180 | |
181 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
181 | + $retval = give_get_option('disable_admin_notices'); |
|
182 | 182 | |
183 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
183 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -193,19 +193,19 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function give_get_default_donation_notification_email() { |
195 | 195 | |
196 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
197 | - $default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
198 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
199 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
202 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
203 | - $default_email_body .= '{sitename}' . "\n"; |
|
196 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
197 | + $default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website: ', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
198 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
199 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
202 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
203 | + $default_email_body .= '{sitename}'."\n"; |
|
204 | 204 | |
205 | - $custom_message = give_get_option( 'donation_notification' ); |
|
206 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
205 | + $custom_message = give_get_option('donation_notification'); |
|
206 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
207 | 207 | |
208 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
208 | + return apply_filters('give_default_donation_notification_email', $message); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | */ |
220 | 220 | function give_get_default_donation_receipt_email() { |
221 | 221 | |
222 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
223 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
224 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
231 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
222 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
223 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
224 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
231 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
232 | 232 | $default_email_body .= "\n\n"; |
233 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
234 | - $default_email_body .= '{sitename}' . "\n"; |
|
233 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
234 | + $default_email_body .= '{sitename}'."\n"; |
|
235 | 235 | |
236 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
236 | + $custom_message = give_get_option('donation_receipt'); |
|
237 | 237 | |
238 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
238 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
239 | 239 | |
240 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
240 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -249,19 +249,19 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return array $email_names |
251 | 251 | */ |
252 | -function give_get_email_names( $user_info ) { |
|
252 | +function give_get_email_names($user_info) { |
|
253 | 253 | $email_names = array(); |
254 | - $user_info = maybe_unserialize( $user_info ); |
|
254 | + $user_info = maybe_unserialize($user_info); |
|
255 | 255 | |
256 | 256 | $email_names['fullname'] = ''; |
257 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
258 | - $user_data = get_userdata( $user_info['id'] ); |
|
257 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
258 | + $user_data = get_userdata($user_info['id']); |
|
259 | 259 | $email_names['name'] = $user_info['first_name']; |
260 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
260 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
261 | 261 | $email_names['username'] = $user_data->user_login; |
262 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
262 | + } elseif (isset($user_info['first_name'])) { |
|
263 | 263 | $email_names['name'] = $user_info['first_name']; |
264 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
264 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
265 | 265 | $email_names['username'] = $user_info['first_name']; |
266 | 266 | } else { |
267 | 267 | $email_names['name'] = $user_info['email']; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -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,38 +56,38 @@ 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 | 69 | $receipt_link = sprintf( |
70 | 70 | '<a href="%1$s">%2$s</a>', |
71 | - esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ), |
|
72 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
71 | + esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())), |
|
72 | + esc_html__('View the receipt in your browser »', 'give') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $user = wp_get_current_user(); |
76 | 76 | |
77 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
78 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
79 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
80 | - $message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message ); |
|
81 | - $message = str_replace( '{amount}', $price, $message ); |
|
82 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
83 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
84 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
85 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
86 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
87 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
88 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
89 | - |
|
90 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
77 | + $message = str_replace('{name}', $user->display_name, $message); |
|
78 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
79 | + $message = str_replace('{username}', $user->user_login, $message); |
|
80 | + $message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message); |
|
81 | + $message = str_replace('{amount}', $price, $message); |
|
82 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
83 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
84 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
85 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
86 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
87 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
88 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
89 | + |
|
90 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,23 +99,23 @@ discard block |
||
99 | 99 | * @since 1.0 |
100 | 100 | * @return array|bool |
101 | 101 | */ |
102 | -function give_email_template_preview( $array ) { |
|
102 | +function give_email_template_preview($array) { |
|
103 | 103 | |
104 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
104 | + if ( ! current_user_can('manage_give_settings')) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | $custom_field = array( |
108 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
109 | - 'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ), |
|
108 | + 'name' => esc_html__('Preview Email', 'give'), |
|
109 | + 'desc' => esc_html__('Click the buttons to preview emails.', 'give'), |
|
110 | 110 | 'id' => 'give_email_preview_buttons', |
111 | 111 | 'type' => 'email_preview_buttons' |
112 | 112 | ); |
113 | 113 | |
114 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
114 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
118 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Output Email Template Preview Buttons. |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | function give_email_preview_buttons_callback() { |
128 | 128 | ob_start(); |
129 | 129 | ?> |
130 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e( 'Donation Receipt Preview', 'give' ); ?> "><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
131 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
130 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php esc_attr_e('Donation Receipt Preview', 'give'); ?> "><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
131 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
132 | 132 | 'give_action' => 'send_test_email', |
133 | 133 | 'give-message' => 'sent-test-email', |
134 | 134 | 'tag' => 'emails' |
135 | - ) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
135 | + )), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
136 | 136 | <?php |
137 | 137 | echo ob_get_clean(); |
138 | 138 | } |
@@ -145,46 +145,46 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function give_display_email_template_preview() { |
147 | 147 | |
148 | - if ( empty( $_GET['give_action'] ) ) { |
|
148 | + if (empty($_GET['give_action'])) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
152 | + if ('preview_email' !== $_GET['give_action']) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | |
156 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
156 | + if ( ! current_user_can('manage_give_settings')) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
161 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
162 | 162 | |
163 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
163 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
164 | 164 | |
165 | 165 | echo give_get_preview_email_header(); |
166 | 166 | |
167 | 167 | //Are we previewing an actual payment? |
168 | - if ( ! empty( $payment_id ) ) { |
|
168 | + if ( ! empty($payment_id)) { |
|
169 | 169 | |
170 | - $content = give_get_email_body_content( $payment_id ); |
|
170 | + $content = give_get_email_body_content($payment_id); |
|
171 | 171 | |
172 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
172 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
173 | 173 | |
174 | 174 | } else { |
175 | 175 | |
176 | 176 | //No payment ID, use sample preview content |
177 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
177 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | - echo Give()->emails->build_email( $preview_content ); |
|
181 | + echo Give()->emails->build_email($preview_content); |
|
182 | 182 | |
183 | 183 | exit; |
184 | 184 | |
185 | 185 | } |
186 | 186 | |
187 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
187 | +add_action('init', 'give_display_email_template_preview'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Email Template Body. |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return string $email_body Body of the email |
198 | 198 | */ |
199 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
199 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
200 | 200 | |
201 | 201 | $default_email_body = give_get_default_donation_receipt_email(); |
202 | 202 | |
203 | - $email_content = give_get_option( 'donation_receipt' ); |
|
204 | - $email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
203 | + $email_content = give_get_option('donation_receipt'); |
|
204 | + $email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body; |
|
205 | 205 | |
206 | - $email_body = wpautop( $email_content ); |
|
206 | + $email_body = wpautop($email_content); |
|
207 | 207 | |
208 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
208 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
209 | 209 | |
210 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
210 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -220,37 +220,37 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string $email_body Body of the email |
222 | 222 | */ |
223 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
223 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
224 | 224 | |
225 | - $user_info = maybe_unserialize( $payment_data['user_info'] ); |
|
226 | - $email = give_get_payment_user_email( $payment_id ); |
|
225 | + $user_info = maybe_unserialize($payment_data['user_info']); |
|
226 | + $email = give_get_payment_user_email($payment_id); |
|
227 | 227 | |
228 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
229 | - $user_data = get_userdata( $user_info['id'] ); |
|
228 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
229 | + $user_data = get_userdata($user_info['id']); |
|
230 | 230 | $name = $user_data->display_name; |
231 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
232 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
231 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
232 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
233 | 233 | } else { |
234 | 234 | $name = $email; |
235 | 235 | } |
236 | 236 | |
237 | - $gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) ); |
|
237 | + $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true)); |
|
238 | 238 | |
239 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
240 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
239 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
240 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
241 | 241 | /* translators: %s: form plural label */ |
242 | - $default_email_body .= sprintf( esc_html__( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n"; |
|
243 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
244 | - $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"; |
|
245 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
246 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
242 | + $default_email_body .= sprintf(esc_html__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n"; |
|
243 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
244 | + $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"; |
|
245 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
246 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
247 | 247 | |
248 | - $email = give_get_option( 'donation_notification' ); |
|
249 | - $email = isset( $email ) ? stripslashes( $email ) : $default_email_body; |
|
248 | + $email = give_get_option('donation_notification'); |
|
249 | + $email = isset($email) ? stripslashes($email) : $default_email_body; |
|
250 | 250 | |
251 | - $email_body = give_do_email_tags( $email, $payment_id ); |
|
251 | + $email_body = give_do_email_tags($email, $payment_id); |
|
252 | 252 | |
253 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
253 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -263,34 +263,34 @@ discard block |
||
263 | 263 | * @since 1.0 |
264 | 264 | */ |
265 | 265 | function give_render_receipt_in_browser() { |
266 | - if ( ! isset( $_GET['payment_key'] ) ) { |
|
267 | - wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
266 | + if ( ! isset($_GET['payment_key'])) { |
|
267 | + wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
268 | 268 | } |
269 | 269 | |
270 | - $key = urlencode( $_GET['payment_key'] ); |
|
270 | + $key = urlencode($_GET['payment_key']); |
|
271 | 271 | |
272 | 272 | ob_start(); |
273 | 273 | //Disallows caching of the page |
274 | - header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); |
|
275 | - header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 |
|
276 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
277 | - header( "Pragma: no-cache" ); // HTTP/1.0 |
|
278 | - header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past |
|
274 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
275 | + header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 |
|
276 | + header("Cache-Control: post-check=0, pre-check=0", false); |
|
277 | + header("Pragma: no-cache"); // HTTP/1.0 |
|
278 | + header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past |
|
279 | 279 | ?> |
280 | 280 | <!DOCTYPE html> |
281 | 281 | <html lang="en"> |
282 | 282 | <head> |
283 | - <?php do_action( 'give_receipt_head' ); ?> |
|
283 | + <?php do_action('give_receipt_head'); ?> |
|
284 | 284 | </head> |
285 | - <body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>"> |
|
285 | + <body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>"> |
|
286 | 286 | |
287 | 287 | <div id="give_receipt_wrapper"> |
288 | - <?php do_action( 'give_render_receipt_in_browser_before' ); ?> |
|
289 | - <?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?> |
|
290 | - <?php do_action( 'give_render_receipt_in_browser_after' ); ?> |
|
288 | + <?php do_action('give_render_receipt_in_browser_before'); ?> |
|
289 | + <?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?> |
|
290 | + <?php do_action('give_render_receipt_in_browser_after'); ?> |
|
291 | 291 | </div> |
292 | 292 | |
293 | - <?php do_action( 'give_receipt_footer' ); ?> |
|
293 | + <?php do_action('give_receipt_footer'); ?> |
|
294 | 294 | </body> |
295 | 295 | </html> |
296 | 296 | <?php |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | die(); |
299 | 299 | } |
300 | 300 | |
301 | -add_action( 'give_view_receipt', 'give_render_receipt_in_browser' ); |
|
301 | +add_action('give_view_receipt', 'give_render_receipt_in_browser'); |
|
302 | 302 | |
303 | 303 | |
304 | 304 | /** |
@@ -313,31 +313,31 @@ discard block |
||
313 | 313 | |
314 | 314 | //Payment receipt switcher |
315 | 315 | $payment_count = give_count_payments()->publish; |
316 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
316 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
317 | 317 | |
318 | - if ( $payment_count <= 0 ) { |
|
318 | + if ($payment_count <= 0) { |
|
319 | 319 | return false; |
320 | 320 | } |
321 | 321 | |
322 | 322 | //Get payments. |
323 | - $payments = new Give_Payments_Query( array( |
|
323 | + $payments = new Give_Payments_Query(array( |
|
324 | 324 | 'number' => 100 |
325 | - ) ); |
|
325 | + )); |
|
326 | 326 | $payments = $payments->get_payments(); |
327 | 327 | $options = array(); |
328 | 328 | |
329 | 329 | //Provide nice human readable options. |
330 | - if ( $payments ) { |
|
330 | + if ($payments) { |
|
331 | 331 | $options[0] = |
332 | 332 | /* translators: %s: transaction singular label */ |
333 | - esc_html__( '- Select a transaction -', 'give' ); |
|
334 | - foreach ( $payments as $payment ) { |
|
333 | + esc_html__('- Select a transaction -', 'give'); |
|
334 | + foreach ($payments as $payment) { |
|
335 | 335 | |
336 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
336 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
337 | 337 | |
338 | 338 | } |
339 | 339 | } else { |
340 | - $options[0] = esc_html__( 'No Transactions Found', 'give' ); |
|
340 | + $options[0] = esc_html__('No Transactions Found', 'give'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | //Start constructing HTML output. |
@@ -350,16 +350,16 @@ discard block |
||
350 | 350 | var selected_trans = transactions.options[transactions.selectedIndex]; |
351 | 351 | console.log(selected_trans); |
352 | 352 | if (selected_trans){ |
353 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
353 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
354 | 354 | window.location = url_string; |
355 | 355 | } |
356 | 356 | } |
357 | 357 | </script>'; |
358 | 358 | |
359 | - $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 transaction:', 'give' ) . '</label>'; |
|
359 | + $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 transaction:', 'give').'</label>'; |
|
360 | 360 | |
361 | 361 | //The select field with 100 latest transactions |
362 | - $transaction_header .= Give()->html->select( array( |
|
362 | + $transaction_header .= Give()->html->select(array( |
|
363 | 363 | 'name' => 'preview_email_payment_id', |
364 | 364 | 'selected' => $payment_id, |
365 | 365 | 'id' => 'give_preview_email_payment_id', |
@@ -369,12 +369,12 @@ discard block |
||
369 | 369 | 'select_atts' => 'onchange="change_preview()">', |
370 | 370 | 'show_option_all' => false, |
371 | 371 | 'show_option_none' => false |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | |
374 | 374 | //Closing tag |
375 | 375 | $transaction_header .= '</div>'; |
376 | 376 | |
377 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
377 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
378 | 378 | |
379 | 379 | } |
380 | 380 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | function give_receipt_head_content() { |
389 | 389 | |
390 | 390 | //Title. |
391 | - $output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>'; |
|
391 | + $output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>'; |
|
392 | 392 | |
393 | 393 | //Meta. |
394 | 394 | $output .= '<meta charset="utf-8"/> |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | <meta name="robots" content="noindex, nofollow"/>'; |
403 | 403 | |
404 | 404 | //CSS |
405 | - $output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">'; |
|
405 | + $output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">'; |
|
406 | 406 | |
407 | - echo apply_filters( 'give_receipt_head_content', $output ); |
|
407 | + echo apply_filters('give_receipt_head_content', $output); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
411 | -add_action( 'give_receipt_head', 'give_receipt_head_content' ); |
|
412 | 411 | \ No newline at end of file |
412 | +add_action('give_receipt_head', 'give_receipt_head_content'); |
|
413 | 413 | \ 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 | |
@@ -26,94 +26,94 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_load_scripts() { |
28 | 28 | |
29 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
30 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
31 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
29 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
30 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
31 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
32 | 32 | |
33 | 33 | // Use minified libraries if SCRIPT_DEBUG is turned off |
34 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
34 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
35 | 35 | |
36 | 36 | //Localize / PHP to AJAX vars |
37 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
37 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
38 | 38 | 'ajaxurl' => give_get_ajax_url(), |
39 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
40 | - 'currency_sign' => give_currency_filter( '' ), |
|
39 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
40 | + 'currency_sign' => give_currency_filter(''), |
|
41 | 41 | 'currency_pos' => give_get_currency_position(), |
42 | 42 | 'thousands_separator' => give_get_price_thousand_separator(), |
43 | 43 | 'decimal_separator' => give_get_price_decimal_separator(), |
44 | - 'no_gateway' => esc_html__( 'Please select a payment method.', 'give' ), |
|
45 | - 'bad_minimum' => esc_html__( 'The minimum donation amount for this form is', 'give' ), |
|
46 | - 'general_loading' => esc_html__( 'Loading...', 'give' ), |
|
47 | - 'purchase_loading' => esc_html__( 'Please Wait...', 'give' ), |
|
44 | + 'no_gateway' => esc_html__('Please select a payment method.', 'give'), |
|
45 | + 'bad_minimum' => esc_html__('The minimum donation amount for this form is', 'give'), |
|
46 | + 'general_loading' => esc_html__('Loading...', 'give'), |
|
47 | + 'purchase_loading' => esc_html__('Please Wait...', 'give'), |
|
48 | 48 | 'number_decimals' => give_get_price_decimals(), |
49 | 49 | 'give_version' => GIVE_VERSION |
50 | - ) ); |
|
51 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
50 | + )); |
|
51 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
52 | 52 | 'ajaxurl' => give_get_ajax_url(), |
53 | - 'loading' => esc_html__( 'Loading', 'give' ), |
|
53 | + 'loading' => esc_html__('Loading', 'give'), |
|
54 | 54 | // General loading message |
55 | - 'select_option' => esc_html__( 'Please select an option', 'give' ), |
|
55 | + 'select_option' => esc_html__('Please select an option', 'give'), |
|
56 | 56 | // Variable pricing error with multi-purchase option enabled |
57 | - 'default_gateway' => give_get_default_gateway( null ), |
|
58 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
57 | + 'default_gateway' => give_get_default_gateway(null), |
|
58 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
59 | 59 | 'number_decimals' => give_get_price_decimals() |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | //DEBUG is On |
63 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
63 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
64 | 64 | |
65 | - if ( give_is_cc_verify_enabled() ) { |
|
66 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
67 | - wp_enqueue_script( 'give-cc-validator' ); |
|
65 | + if (give_is_cc_verify_enabled()) { |
|
66 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
67 | + wp_enqueue_script('give-cc-validator'); |
|
68 | 68 | } |
69 | 69 | |
70 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
71 | - wp_enqueue_script( 'give-float-labels' ); |
|
70 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
71 | + wp_enqueue_script('give-float-labels'); |
|
72 | 72 | |
73 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
74 | - wp_enqueue_script( 'give-blockui' ); |
|
73 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
74 | + wp_enqueue_script('give-blockui'); |
|
75 | 75 | |
76 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
77 | - wp_enqueue_script( 'give-qtip' ); |
|
76 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
77 | + wp_enqueue_script('give-qtip'); |
|
78 | 78 | |
79 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
80 | - wp_enqueue_script( 'give-accounting' ); |
|
79 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
80 | + wp_enqueue_script('give-accounting'); |
|
81 | 81 | |
82 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
83 | - wp_enqueue_script( 'give-magnific' ); |
|
82 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
83 | + wp_enqueue_script('give-magnific'); |
|
84 | 84 | |
85 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
86 | - wp_enqueue_script( 'give-checkout-global' ); |
|
85 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
86 | + wp_enqueue_script('give-checkout-global'); |
|
87 | 87 | |
88 | 88 | //General scripts |
89 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
90 | - wp_enqueue_script( 'give-scripts' ); |
|
89 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
90 | + wp_enqueue_script('give-scripts'); |
|
91 | 91 | |
92 | 92 | // Load AJAX scripts, if enabled |
93 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
94 | - wp_enqueue_script( 'give-ajax' ); |
|
93 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
94 | + wp_enqueue_script('give-ajax'); |
|
95 | 95 | |
96 | 96 | //Localize / Pass AJAX vars from PHP |
97 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
98 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
97 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
98 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
99 | 99 | |
100 | 100 | |
101 | 101 | } else { |
102 | 102 | |
103 | 103 | //DEBUG is OFF (one JS file to rule them all!) |
104 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
105 | - wp_enqueue_script( 'give' ); |
|
104 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
105 | + wp_enqueue_script('give'); |
|
106 | 106 | |
107 | 107 | //Localize / Pass AJAX vars from PHP |
108 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
109 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
108 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
109 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
116 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Register styles. |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function give_register_styles() { |
127 | 127 | |
128 | - if ( give_get_option( 'disable_css', false ) ) { |
|
128 | + if (give_get_option('disable_css', false)) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | - wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' ); |
|
133 | - wp_enqueue_style( 'give-styles' ); |
|
132 | + wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all'); |
|
133 | + wp_enqueue_style('give-styles'); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
137 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
138 | 138 | |
139 | 139 | |
140 | 140 | /** |
@@ -146,39 +146,39 @@ discard block |
||
146 | 146 | function give_get_stylesheet_uri() { |
147 | 147 | |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - $file = 'give' . $suffix . '.css'; |
|
151 | + $file = 'give'.$suffix.'.css'; |
|
152 | 152 | $templates_dir = give_get_theme_template_dir_name(); |
153 | 153 | |
154 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
155 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
156 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
157 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
158 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
154 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
155 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
156 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
157 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
158 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
159 | 159 | |
160 | 160 | $uri = false; |
161 | 161 | |
162 | 162 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
163 | 163 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
164 | 164 | // This allows users to copy just give.css to their theme |
165 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
166 | - if ( ! empty( $nonmin ) ) { |
|
167 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
165 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
166 | + if ( ! empty($nonmin)) { |
|
167 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
168 | 168 | } else { |
169 | - $uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
169 | + $uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
170 | 170 | } |
171 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
172 | - if ( ! empty( $nonmin ) ) { |
|
173 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
171 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
172 | + if ( ! empty($nonmin)) { |
|
173 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
174 | 174 | } else { |
175 | - $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
175 | + $uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
176 | 176 | } |
177 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
178 | - $uri = trailingslashit( give_get_templates_url() ) . $file; |
|
177 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
178 | + $uri = trailingslashit(give_get_templates_url()).$file; |
|
179 | 179 | } |
180 | 180 | |
181 | - return apply_filters( 'give_get_stylesheet_uri', $uri ); |
|
181 | + return apply_filters('give_get_stylesheet_uri', $uri); |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
@@ -196,65 +196,65 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return void |
198 | 198 | */ |
199 | -function give_load_admin_scripts( $hook ) { |
|
199 | +function give_load_admin_scripts($hook) { |
|
200 | 200 | |
201 | 201 | global $wp_version, $post, $post_type, $give_options; |
202 | 202 | |
203 | 203 | //Directories of assets |
204 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
205 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
206 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
204 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
205 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
206 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
207 | 207 | |
208 | 208 | // Use minified libraries if SCRIPT_DEBUG is turned off |
209 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
209 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
210 | 210 | |
211 | 211 | //Global Admin: |
212 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
213 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
212 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
213 | + wp_enqueue_style('give-admin-bar-notification'); |
|
214 | 214 | |
215 | 215 | //Give Admin Only: |
216 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
216 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | 220 | //CSS |
221 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
222 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
223 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
224 | - wp_enqueue_style( 'give-admin' ); |
|
225 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
226 | - wp_enqueue_style( 'jquery-chosen' ); |
|
227 | - wp_enqueue_style( 'thickbox' ); |
|
221 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
222 | + wp_enqueue_style('jquery-ui-css'); |
|
223 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
224 | + wp_enqueue_style('give-admin'); |
|
225 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
226 | + wp_enqueue_style('jquery-chosen'); |
|
227 | + wp_enqueue_style('thickbox'); |
|
228 | 228 | |
229 | 229 | //JS |
230 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
231 | - wp_enqueue_script( 'jquery-chosen' ); |
|
230 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
231 | + wp_enqueue_script('jquery-chosen'); |
|
232 | 232 | |
233 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
234 | - wp_enqueue_script( 'give-accounting' ); |
|
233 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
234 | + wp_enqueue_script('give-accounting'); |
|
235 | 235 | |
236 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
237 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
236 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
237 | + wp_enqueue_script('give-admin-scripts'); |
|
238 | 238 | |
239 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
240 | - wp_enqueue_script( 'jquery-flot' ); |
|
239 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
240 | + wp_enqueue_script('jquery-flot'); |
|
241 | 241 | |
242 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
243 | - wp_enqueue_script( 'give-qtip' ); |
|
242 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
243 | + wp_enqueue_script('give-qtip'); |
|
244 | 244 | |
245 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
246 | - wp_enqueue_script( 'thickbox' ); |
|
245 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
246 | + wp_enqueue_script('thickbox'); |
|
247 | 247 | |
248 | 248 | // Forms CPT Script. |
249 | - if ( $post_type === 'give_forms' ) { |
|
250 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
251 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
249 | + if ($post_type === 'give_forms') { |
|
250 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
251 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | //Settings Scripts |
255 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) { |
|
256 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
257 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
255 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
256 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
257 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Price Separators. |
@@ -262,50 +262,50 @@ discard block |
||
262 | 262 | $decimal_separator = give_get_price_decimal_separator(); |
263 | 263 | |
264 | 264 | //Localize strings & variables for JS |
265 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
266 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
265 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
266 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
267 | 267 | 'give_version' => GIVE_VERSION, |
268 | 268 | 'thousands_separator' => $thousand_separator, |
269 | 269 | 'decimal_separator' => $decimal_separator, |
270 | - 'quick_edit_warning' => esc_html__( 'Sorry, not available for variable priced forms.', 'give' ), |
|
271 | - 'delete_payment' => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ), |
|
272 | - 'delete_payment_note' => esc_html__( 'Are you sure you wish to delete this note?', 'give' ), |
|
273 | - 'revoke_api_key' => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
274 | - 'regenerate_api_key' => esc_html__( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
275 | - 'resend_receipt' => esc_html__( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
276 | - 'copy_download_link_text' => esc_html__( 'Copy these links to your clipboard and give them to your donor.', 'give' ), |
|
270 | + 'quick_edit_warning' => esc_html__('Sorry, not available for variable priced forms.', 'give'), |
|
271 | + 'delete_payment' => esc_html__('Are you sure you wish to delete this payment?', 'give'), |
|
272 | + 'delete_payment_note' => esc_html__('Are you sure you wish to delete this note?', 'give'), |
|
273 | + 'revoke_api_key' => esc_html__('Are you sure you wish to revoke this API key?', 'give'), |
|
274 | + 'regenerate_api_key' => esc_html__('Are you sure you wish to regenerate this API key?', 'give'), |
|
275 | + 'resend_receipt' => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'), |
|
276 | + 'copy_download_link_text' => esc_html__('Copy these links to your clipboard and give them to your donor.', 'give'), |
|
277 | 277 | /* translators: %s: form singular label */ |
278 | - 'delete_payment_download' => sprintf( esc_html__( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
279 | - 'one_price_min' => esc_html__( 'You must have at least one price.', 'give' ), |
|
280 | - 'one_file_min' => esc_html__( 'You must have at least one file.', 'give' ), |
|
281 | - 'one_field_min' => esc_html__( 'You must have at least one field.', 'give' ), |
|
278 | + 'delete_payment_download' => sprintf(esc_html__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
279 | + 'one_price_min' => esc_html__('You must have at least one price.', 'give'), |
|
280 | + 'one_file_min' => esc_html__('You must have at least one file.', 'give'), |
|
281 | + 'one_field_min' => esc_html__('You must have at least one field.', 'give'), |
|
282 | 282 | /* translators: %s: form singular label */ |
283 | - 'one_option' => sprintf( esc_html__( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
283 | + 'one_option' => sprintf(esc_html__('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
284 | 284 | /* translators: %s: form plural label */ |
285 | - 'one_or_more_option' => sprintf( esc_html__( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
286 | - 'numeric_item_price' => esc_html__( 'Item price must be numeric.', 'give' ), |
|
287 | - 'numeric_quantity' => esc_html__( 'Quantity must be numeric.', 'give' ), |
|
288 | - 'currency_sign' => give_currency_filter( '' ), |
|
289 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
290 | - 'currency_decimals' => give_currency_decimal_filter( give_get_price_decimals() ), |
|
291 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
292 | - 'remove_text' => esc_html__( 'Remove', 'give' ), |
|
285 | + 'one_or_more_option' => sprintf(esc_html__('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
286 | + 'numeric_item_price' => esc_html__('Item price must be numeric.', 'give'), |
|
287 | + 'numeric_quantity' => esc_html__('Quantity must be numeric.', 'give'), |
|
288 | + 'currency_sign' => give_currency_filter(''), |
|
289 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
290 | + 'currency_decimals' => give_currency_decimal_filter(give_get_price_decimals()), |
|
291 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
292 | + 'remove_text' => esc_html__('Remove', 'give'), |
|
293 | 293 | /* translators: %s: form plural label */ |
294 | - 'type_to_search' => sprintf( esc_html__( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
295 | - 'batch_export_no_class' => esc_html__( 'You must choose a method.', 'give' ), |
|
296 | - 'batch_export_no_reqs' => esc_html__( 'Required fields not completed.', 'give' ), |
|
297 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
298 | - 'price_format_guide' => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ) |
|
299 | - ) ); |
|
300 | - |
|
301 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
294 | + 'type_to_search' => sprintf(esc_html__('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
295 | + 'batch_export_no_class' => esc_html__('You must choose a method.', 'give'), |
|
296 | + 'batch_export_no_reqs' => esc_html__('Required fields not completed.', 'give'), |
|
297 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
298 | + 'price_format_guide' => sprintf(esc_html__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator) |
|
299 | + )); |
|
300 | + |
|
301 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
302 | 302 | //call for new media manager |
303 | 303 | wp_enqueue_media(); |
304 | 304 | } |
305 | 305 | |
306 | 306 | } |
307 | 307 | |
308 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
308 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
309 | 309 | |
310 | 310 | /** |
311 | 311 | * Admin Give Icon |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | ?> |
323 | 323 | <style type="text/css" media="screen"> |
324 | 324 | |
325 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
325 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
326 | 326 | @font-face { |
327 | 327 | font-family: 'give-icomoon'; |
328 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
329 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
330 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
331 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
328 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
329 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
330 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
331 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
332 | 332 | font-weight: normal; |
333 | 333 | font-style: normal; |
334 | 334 | } |
@@ -347,4 +347,4 @@ discard block |
||
347 | 347 | <?php |
348 | 348 | } |
349 | 349 | |
350 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
350 | +add_action('admin_head', 'give_admin_icon'); |