@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param $args |
67 | 67 | */ |
68 | - public function __construct( $args ) { |
|
68 | + public function __construct($args) { |
|
69 | 69 | |
70 | 70 | // Only for admins. |
71 | - if ( ! is_admin() ) { |
|
71 | + if ( ! is_admin()) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | - foreach ( $args as $key => $arg ) { |
|
75 | + foreach ($args as $key => $arg) { |
|
76 | 76 | $this->$key = $arg; |
77 | 77 | } |
78 | 78 | |
79 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
79 | + add_action('admin_init', array($this, 'init')); |
|
80 | 80 | |
81 | 81 | |
82 | 82 | } |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | function init() { |
88 | 88 | |
89 | 89 | // First get user's locale (4.7+). |
90 | - $this->locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
90 | + $this->locale = function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
91 | 91 | |
92 | 92 | // This plugin is en_US native. |
93 | - if ( 'en_US' === $this->locale ) { |
|
93 | + if ('en_US' === $this->locale) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | 97 | if ( |
98 | 98 | ! $this->hide_promo() |
99 | - && ( ! empty( $_GET['post_type'] ) && 'give_forms' === $_GET['post_type'] ) |
|
100 | - && ( ! empty( $_GET['page'] ) && 'give-settings' === $_GET['page'] ) |
|
99 | + && ( ! empty($_GET['post_type']) && 'give_forms' === $_GET['post_type']) |
|
100 | + && ( ! empty($_GET['page']) && 'give-settings' === $_GET['page']) |
|
101 | 101 | ) { |
102 | - add_action( $this->hook, array( $this, 'promo' ) ); |
|
102 | + add_action($this->hook, array($this, 'promo')); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | * @return bool |
113 | 113 | */ |
114 | 114 | private function hide_promo() { |
115 | - $hide_promo = Give_Cache::get( 'give_i18n_give_promo_hide', true ); |
|
116 | - if ( ! $hide_promo ) { |
|
117 | - if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) { |
|
115 | + $hide_promo = Give_Cache::get('give_i18n_give_promo_hide', true); |
|
116 | + if ( ! $hide_promo) { |
|
117 | + if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) { |
|
118 | 118 | // No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc. |
119 | - Give_Cache::set( 'give_i18n_give_promo_hide', true, null, true ); |
|
119 | + Give_Cache::set('give_i18n_give_promo_hide', true, null, true); |
|
120 | 120 | $hide_promo = true; |
121 | 121 | } |
122 | 122 | } |
@@ -135,20 +135,20 @@ discard block |
||
135 | 135 | $message = false; |
136 | 136 | |
137 | 137 | // Using a translation less than 90% complete. |
138 | - if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) { |
|
139 | - $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' ); |
|
140 | - } elseif ( ! $this->translation_loaded && $this->translation_exists ) { |
|
141 | - $message = __( 'You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' ); |
|
142 | - } elseif ( ! $this->translation_exists ) { |
|
143 | - $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' ); |
|
138 | + if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) { |
|
139 | + $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'); |
|
140 | + } elseif ( ! $this->translation_loaded && $this->translation_exists) { |
|
141 | + $message = __('You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give'); |
|
142 | + } elseif ( ! $this->translation_exists) { |
|
143 | + $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'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | // Links. |
147 | - $registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) ); |
|
148 | - $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' ) ); |
|
147 | + $registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give')); |
|
148 | + $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')); |
|
149 | 149 | |
150 | 150 | // Message. |
151 | - $message = sprintf( $message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link ); |
|
151 | + $message = sprintf($message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link); |
|
152 | 152 | |
153 | 153 | return $message; |
154 | 154 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->translation_details(); |
163 | 163 | $message = $this->promo_message(); |
164 | 164 | |
165 | - if ( $message ) { ?> |
|
165 | + if ($message) { ?> |
|
166 | 166 | |
167 | 167 | <style> |
168 | 168 | /* Banner specific styles */ |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | style="font-size: 110px; text-decoration: none;"></span></a> |
228 | 228 | |
229 | 229 | <div class="give-i18n-notice-content"> |
230 | - <a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
230 | + <a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
231 | 231 | |
232 | - <h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2> |
|
232 | + <h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2> |
|
233 | 233 | <p><?php echo $message; ?></p> |
234 | 234 | <p> |
235 | - <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now »', 'give' ); ?></a> |
|
235 | + <a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now »', 'give'); ?></a> |
|
236 | 236 | </p> |
237 | 237 | </div> |
238 | 238 | </div> |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | */ |
250 | 250 | private function find_or_initialize_translation_details() { |
251 | 251 | |
252 | - $set = Give_Cache::get( "give_i18n_give_{$this->locale}", true ); |
|
252 | + $set = Give_Cache::get("give_i18n_give_{$this->locale}", true); |
|
253 | 253 | |
254 | - if ( ! $set ) { |
|
254 | + if ( ! $set) { |
|
255 | 255 | $set = $this->retrieve_translation_details(); |
256 | - Give_Cache::set( "give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true ); |
|
256 | + Give_Cache::set("give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $set; |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | private function translation_details() { |
268 | 268 | $set = $this->find_or_initialize_translation_details(); |
269 | 269 | |
270 | - $this->translation_exists = ! is_null( $set ); |
|
271 | - $this->translation_loaded = is_textdomain_loaded( 'give' ); |
|
270 | + $this->translation_exists = ! is_null($set); |
|
271 | + $this->translation_loaded = is_textdomain_loaded('give'); |
|
272 | 272 | |
273 | - $this->parse_translation_set( $set ); |
|
273 | + $this->parse_translation_set($set); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -282,26 +282,26 @@ discard block |
||
282 | 282 | */ |
283 | 283 | private function retrieve_translation_details() { |
284 | 284 | |
285 | - $api_url = trailingslashit( $this->glotpress_url ); |
|
285 | + $api_url = trailingslashit($this->glotpress_url); |
|
286 | 286 | |
287 | - $resp = wp_remote_get( $api_url ); |
|
287 | + $resp = wp_remote_get($api_url); |
|
288 | 288 | |
289 | - if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) { |
|
289 | + if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') { |
|
290 | 290 | return null; |
291 | 291 | } |
292 | 292 | |
293 | - $body = wp_remote_retrieve_body( $resp ); |
|
294 | - unset( $resp ); |
|
293 | + $body = wp_remote_retrieve_body($resp); |
|
294 | + unset($resp); |
|
295 | 295 | |
296 | - if ( $body ) { |
|
297 | - $body = json_decode( $body ); |
|
296 | + if ($body) { |
|
297 | + $body = json_decode($body); |
|
298 | 298 | |
299 | - foreach ( $body->translation_sets as $set ) { |
|
300 | - if ( ! property_exists( $set, 'wp_locale' ) ) { |
|
299 | + foreach ($body->translation_sets as $set) { |
|
300 | + if ( ! property_exists($set, 'wp_locale')) { |
|
301 | 301 | continue; |
302 | 302 | } |
303 | 303 | |
304 | - if ( $this->locale == $set->wp_locale ) { |
|
304 | + if ($this->locale == $set->wp_locale) { |
|
305 | 305 | return $set; |
306 | 306 | } |
307 | 307 | } |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @access private |
319 | 319 | */ |
320 | - private function parse_translation_set( $set ) { |
|
321 | - if ( $this->translation_exists && is_object( $set ) ) { |
|
320 | + private function parse_translation_set($set) { |
|
321 | + if ($this->translation_exists && is_object($set)) { |
|
322 | 322 | $this->locale_name = $set->name; |
323 | 323 | $this->percent_translated = $set->percent_translated; |
324 | 324 | } else { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | -$give_i18n = new Give_i18n_Banner( array( |
|
331 | +$give_i18n = new Give_i18n_Banner(array( |
|
332 | 332 | 'hook' => 'admin_notices', |
333 | 333 | 'glotpress_url' => 'https://translate.wordpress.org/api/projects/wp-plugins/give/stable/', |
334 | - ) ); |
|
334 | + )); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once. |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete. |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $payment_id The ID of the payment. |
60 | 60 | */ |
61 | - do_action( 'give_pre_complete_donation', $payment_id ); |
|
61 | + do_action('give_pre_complete_donation', $payment_id); |
|
62 | 62 | |
63 | 63 | // Ensure these actions only run once, ever. |
64 | - if ( empty( $completed_date ) ) { |
|
64 | + if (empty($completed_date)) { |
|
65 | 65 | |
66 | - give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
66 | + give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Fires after logging donation record. |
@@ -74,29 +74,29 @@ discard block |
||
74 | 74 | * @param int $payment_id The ID number of the payment. |
75 | 75 | * @param array $payment_meta The payment meta. |
76 | 76 | */ |
77 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
77 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Increase the earnings for this form ID. |
82 | - give_increase_earnings( $form_id, $amount ); |
|
83 | - give_increase_donation_count( $form_id ); |
|
82 | + give_increase_earnings($form_id, $amount); |
|
83 | + give_increase_donation_count($form_id); |
|
84 | 84 | |
85 | 85 | // @todo: Refresh only range related stat cache |
86 | 86 | give_delete_donation_stats(); |
87 | 87 | |
88 | 88 | // Increase the donor's donation stats. |
89 | - $donor = new Give_Donor( $donor_id ); |
|
89 | + $donor = new Give_Donor($donor_id); |
|
90 | 90 | $donor->increase_purchase_count(); |
91 | - $donor->increase_value( $amount ); |
|
91 | + $donor->increase_value($amount); |
|
92 | 92 | |
93 | - give_increase_total_earnings( $amount ); |
|
93 | + give_increase_total_earnings($amount); |
|
94 | 94 | |
95 | 95 | // Ensure this action only runs once ever. |
96 | - if ( empty( $completed_date ) ) { |
|
96 | + if (empty($completed_date)) { |
|
97 | 97 | |
98 | 98 | // Save the completed date. |
99 | - $payment->completed_date = current_time( 'mysql' ); |
|
99 | + $payment->completed_date = current_time('mysql'); |
|
100 | 100 | $payment->save(); |
101 | 101 | |
102 | 102 | /** |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param int $payment_id The ID of the payment. |
108 | 108 | */ |
109 | - do_action( 'give_complete_donation', $payment_id ); |
|
109 | + do_action('give_complete_donation', $payment_id); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
114 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
128 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
129 | 129 | |
130 | 130 | // Get the list of statuses so that status in the payment note can be translated. |
131 | 131 | $stati = give_get_payment_statuses(); |
132 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
133 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
132 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
133 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
134 | 134 | |
135 | 135 | // translators: 1: old status 2: new status. |
136 | - $status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status ); |
|
136 | + $status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status); |
|
137 | 137 | |
138 | - give_insert_payment_note( $payment_id, $status_change ); |
|
138 | + give_insert_payment_note($payment_id, $status_change); |
|
139 | 139 | } |
140 | 140 | |
141 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
141 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -154,25 +154,25 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return void |
156 | 156 | */ |
157 | -function give_update_old_payments_with_totals( $data ) { |
|
158 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
157 | +function give_update_old_payments_with_totals($data) { |
|
158 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
162 | + if (get_option('give_payment_totals_upgraded')) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $payments = give_get_payments( array( |
|
166 | + $payments = give_get_payments(array( |
|
167 | 167 | 'offset' => 0, |
168 | - 'number' => - 1, |
|
168 | + 'number' => -1, |
|
169 | 169 | 'mode' => 'all', |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | - if ( $payments ) { |
|
173 | - foreach ( $payments as $payment ) { |
|
172 | + if ($payments) { |
|
173 | + foreach ($payments as $payment) { |
|
174 | 174 | |
175 | - $payment = new Give_Payment( $payment->ID ); |
|
175 | + $payment = new Give_Payment($payment->ID); |
|
176 | 176 | $meta = $payment->get_meta(); |
177 | 177 | |
178 | 178 | $payment->total = $meta['amount']; |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
184 | + add_option('give_payment_totals_upgraded', 1); |
|
185 | 185 | } |
186 | 186 | |
187 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
187 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Mark Abandoned Donations |
@@ -198,17 +198,17 @@ discard block |
||
198 | 198 | function give_mark_abandoned_donations() { |
199 | 199 | $args = array( |
200 | 200 | 'status' => 'pending', |
201 | - 'number' => - 1, |
|
201 | + 'number' => -1, |
|
202 | 202 | 'output' => 'give_payments', |
203 | 203 | ); |
204 | 204 | |
205 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
205 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
206 | 206 | |
207 | - $payments = give_get_payments( $args ); |
|
207 | + $payments = give_get_payments($args); |
|
208 | 208 | |
209 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
209 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
210 | 210 | |
211 | - if ( $payments ) { |
|
211 | + if ($payments) { |
|
212 | 212 | /** |
213 | 213 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
214 | 214 | * |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param array $skip_payment_gateways Array of payment gateways |
218 | 218 | */ |
219 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
219 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
220 | 220 | |
221 | - foreach ( $payments as $payment ) { |
|
222 | - $gateway = give_get_payment_gateway( $payment ); |
|
221 | + foreach ($payments as $payment) { |
|
222 | + $gateway = give_get_payment_gateway($payment); |
|
223 | 223 | |
224 | 224 | // Skip payment gateways. |
225 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
225 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' ); |
|
235 | +Give_Cron::add_weekly_event('give_mark_abandoned_donations'); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return void |
246 | 246 | */ |
247 | -function give_refresh_thismonth_stat_transients( $payment_ID ) { |
|
247 | +function give_refresh_thismonth_stat_transients($payment_ID) { |
|
248 | 248 | // Monthly stats. |
249 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
249 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
250 | 250 | |
251 | 251 | // @todo: Refresh only range related stat cache |
252 | 252 | give_delete_donation_stats(); |
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' ); |
|
255 | +add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients'); |
|
256 | 256 | |
257 | 257 | /* |
258 | 258 | * Add meta in payment that store page id and page url. |
@@ -264,18 +264,18 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @param {integer} $payment_id Payment id for which the meta value should be updated. |
266 | 266 | */ |
267 | -function give_payment_save_page_data( $payment_id ) { |
|
268 | - $page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false ); |
|
267 | +function give_payment_save_page_data($payment_id) { |
|
268 | + $page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false); |
|
269 | 269 | // Check $page_url is not empty. |
270 | - if ( $page_url ) { |
|
271 | - update_post_meta( $payment_id, '_give_current_url', $page_url ); |
|
272 | - $page_id = url_to_postid( $page_url ); |
|
270 | + if ($page_url) { |
|
271 | + update_post_meta($payment_id, '_give_current_url', $page_url); |
|
272 | + $page_id = url_to_postid($page_url); |
|
273 | 273 | // Check $page_id is not empty. |
274 | - if ( $page_id ) { |
|
275 | - update_post_meta( $payment_id, '_give_current_page_id', $page_id ); |
|
274 | + if ($page_id) { |
|
275 | + update_post_meta($payment_id, '_give_current_page_id', $page_id); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | 280 | // Fire when payment is save. |
281 | -add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
282 | 281 | \ No newline at end of file |
282 | +add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
283 | 283 | \ 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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return static |
52 | 52 | */ |
53 | 53 | public static function get_instance() { |
54 | - if ( null === static::$instance ) { |
|
54 | + if (null === static::$instance) { |
|
55 | 55 | self::$instance = new static(); |
56 | 56 | self::$instance->setup(); |
57 | 57 | } |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @since 1.8.13 |
67 | 67 | */ |
68 | 68 | private function setup() { |
69 | - add_filter( 'cron_schedules', array( self::$instance, '__add_schedules' ) ); |
|
70 | - add_action( 'wp', array( self::$instance, '__schedule_events' ) ); |
|
69 | + add_filter('cron_schedules', array(self::$instance, '__add_schedules')); |
|
70 | + add_action('wp', array(self::$instance, '__schedule_events')); |
|
71 | 71 | |
72 | 72 | // Load async event only when cron is running. |
73 | - if( defined( 'DOING_CRON' ) && DOING_CRON ) { |
|
74 | - add_action( 'init', array( self::$instance, '__load_async_events' ) ); |
|
73 | + if (defined('DOING_CRON') && DOING_CRON) { |
|
74 | + add_action('init', array(self::$instance, '__load_async_events')); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -82,23 +82,23 @@ discard block |
||
82 | 82 | * @since 1.8.13 |
83 | 83 | */ |
84 | 84 | public function __load_async_events() { |
85 | - $async_events = get_option( 'give_async_events', array() ); |
|
85 | + $async_events = get_option('give_async_events', array()); |
|
86 | 86 | |
87 | 87 | // Bailout. |
88 | - if ( empty( $async_events ) ) { |
|
88 | + if (empty($async_events)) { |
|
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
92 | - foreach ( $async_events as $index => $event ) { |
|
92 | + foreach ($async_events as $index => $event) { |
|
93 | 93 | // Set cron name. |
94 | 94 | $cron_name = "give_async_scheduled_events_{$index}"; |
95 | 95 | |
96 | 96 | // Setup cron. |
97 | - wp_schedule_single_event( current_time( 'timestamp', 1 ), $cron_name, $event['params'] ); |
|
97 | + wp_schedule_single_event(current_time('timestamp', 1), $cron_name, $event['params']); |
|
98 | 98 | |
99 | 99 | // Add cron action. |
100 | - add_action( $cron_name, $event['callback'], 10, count( $event['params'] ) ); |
|
101 | - add_action( $cron_name, array( $this, '__delete_async_events' ), 9999, 0 ); |
|
100 | + add_action($cron_name, $event['callback'], 10, count($event['params'])); |
|
101 | + add_action($cron_name, array($this, '__delete_async_events'), 9999, 0); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | * @since 1.8.13 |
109 | 109 | */ |
110 | 110 | public function __delete_async_events() { |
111 | - $async_events = get_option( 'give_async_events', array() ); |
|
112 | - $cron_name_parts = explode( '_', current_action() ); |
|
113 | - $cron_id = end( $cron_name_parts ); |
|
111 | + $async_events = get_option('give_async_events', array()); |
|
112 | + $cron_name_parts = explode('_', current_action()); |
|
113 | + $cron_id = end($cron_name_parts); |
|
114 | 114 | |
115 | - if ( ! empty( $async_events[ $cron_id ] ) ) { |
|
116 | - unset( $async_events[ $cron_id ] ); |
|
117 | - update_option( 'give_async_events', $async_events ); |
|
115 | + if ( ! empty($async_events[$cron_id])) { |
|
116 | + unset($async_events[$cron_id]); |
|
117 | + update_option('give_async_events', $async_events); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return array An array of non-default cron schedules. |
130 | 130 | */ |
131 | - public function __add_schedules( $schedules = array() ) { |
|
131 | + public function __add_schedules($schedules = array()) { |
|
132 | 132 | // Adds once weekly to the existing schedules. |
133 | 133 | $schedules['weekly'] = array( |
134 | 134 | 'interval' => 604800, |
135 | - 'display' => __( 'Once Weekly', 'give' ), |
|
135 | + 'display' => __('Once Weekly', 'give'), |
|
136 | 136 | ); |
137 | 137 | |
138 | 138 | return $schedules; |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * @return void |
161 | 161 | */ |
162 | 162 | private function weekly_events() { |
163 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
164 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
163 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
164 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return void |
175 | 175 | */ |
176 | 176 | private function daily_events() { |
177 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
178 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
177 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
178 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return string |
191 | 191 | */ |
192 | - public static function get_cron_action( $type = 'weekly' ) { |
|
193 | - switch ( $type ) { |
|
192 | + public static function get_cron_action($type = 'weekly') { |
|
193 | + switch ($type) { |
|
194 | 194 | case 'daily': |
195 | 195 | $cron_action = 'give_daily_scheduled_events'; |
196 | 196 | break; |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | * @param $action |
213 | 213 | * @param string $type |
214 | 214 | */ |
215 | - private static function add_event( $action, $type = 'weekly' ) { |
|
216 | - $cron_event = self::get_cron_action( $type ); |
|
217 | - add_action( $cron_event, $action ); |
|
215 | + private static function add_event($action, $type = 'weekly') { |
|
216 | + $cron_event = self::get_cron_action($type); |
|
217 | + add_action($cron_event, $action); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @param $action |
227 | 227 | */ |
228 | - public static function add_weekly_event( $action ) { |
|
229 | - self::add_event( $action, 'weekly' ); |
|
228 | + public static function add_weekly_event($action) { |
|
229 | + self::add_event($action, 'weekly'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param $action |
239 | 239 | */ |
240 | - public static function add_daily_event( $action ) { |
|
241 | - self::add_event( $action, 'daily' ); |
|
240 | + public static function add_daily_event($action) { |
|
241 | + self::add_event($action, 'daily'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -251,17 +251,17 @@ discard block |
||
251 | 251 | * @param string $action |
252 | 252 | * @param array $args |
253 | 253 | */ |
254 | - public static function add_async_event( $action, $args = array() ) { |
|
254 | + public static function add_async_event($action, $args = array()) { |
|
255 | 255 | |
256 | 256 | // Cache async events. |
257 | - $async_events = get_option( 'give_async_events', array() ); |
|
258 | - $async_events[ uniqid() ] = array( |
|
257 | + $async_events = get_option('give_async_events', array()); |
|
258 | + $async_events[uniqid()] = array( |
|
259 | 259 | 'callback' => $action, |
260 | 260 | 'params' => $args, |
261 | 261 | ); |
262 | 262 | |
263 | 263 | |
264 | - update_option( 'give_async_events', $async_events ); |
|
264 | + update_option('give_async_events', $async_events); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 |
@@ -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,15 +26,15 @@ discard block |
||
26 | 26 | * @global $wpdb |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_install( $network_wide = false ) { |
|
29 | +function give_install($network_wide = false) { |
|
30 | 30 | |
31 | 31 | global $wpdb; |
32 | 32 | |
33 | - if ( is_multisite() && $network_wide ) { |
|
33 | + if (is_multisite() && $network_wide) { |
|
34 | 34 | |
35 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
35 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
36 | 36 | |
37 | - switch_to_blog( $blog_id ); |
|
37 | + switch_to_blog($blog_id); |
|
38 | 38 | give_run_install(); |
39 | 39 | restore_current_blog(); |
40 | 40 | |
@@ -61,31 +61,31 @@ discard block |
||
61 | 61 | give_setup_post_types(); |
62 | 62 | |
63 | 63 | // Add Upgraded From Option. |
64 | - $current_version = get_option( 'give_version' ); |
|
65 | - if ( $current_version ) { |
|
66 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
64 | + $current_version = get_option('give_version'); |
|
65 | + if ($current_version) { |
|
66 | + update_option('give_version_upgraded_from', $current_version); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // Setup some default options. |
70 | 70 | $options = array(); |
71 | 71 | |
72 | 72 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
73 | - if ( empty( $current_version ) ) { |
|
74 | - $options = array_merge( $options, give_get_default_settings() ); |
|
73 | + if (empty($current_version)) { |
|
74 | + $options = array_merge($options, give_get_default_settings()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Populate the default values. |
78 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
78 | + update_option('give_settings', array_merge($give_options, $options)); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Run plugin upgrades. |
82 | 82 | * |
83 | 83 | * @since 1.8 |
84 | 84 | */ |
85 | - do_action( 'give_upgrades' ); |
|
85 | + do_action('give_upgrades'); |
|
86 | 86 | |
87 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
88 | - update_option( 'give_version', GIVE_VERSION ); |
|
87 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
88 | + update_option('give_version', GIVE_VERSION); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // Create Give roles. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Set api version, end point and refresh permalink. |
97 | 97 | $api = new Give_API(); |
98 | 98 | $api->add_endpoint(); |
99 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
99 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
100 | 100 | |
101 | 101 | flush_rewrite_rules(); |
102 | 102 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | $give_sessions->use_php_sessions(); |
106 | 106 | |
107 | 107 | // Add a temporary option to note that Give pages have been created. |
108 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
108 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
109 | 109 | |
110 | - if ( ! $current_version ) { |
|
110 | + if ( ! $current_version) { |
|
111 | 111 | |
112 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
112 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
113 | 113 | |
114 | 114 | // When new upgrade routines are added, mark them as complete on fresh install. |
115 | 115 | $upgrade_routines = array( |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | 'v1813_update_donor_user_roles' |
126 | 126 | ); |
127 | 127 | |
128 | - foreach ( $upgrade_routines as $upgrade ) { |
|
129 | - give_set_upgrade_complete( $upgrade ); |
|
128 | + foreach ($upgrade_routines as $upgrade) { |
|
129 | + give_set_upgrade_complete($upgrade); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | 133 | // Bail if activating from network, or bulk. |
134 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
134 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Add the transient to redirect. |
139 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
139 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
140 | 140 | |
141 | 141 | // Set 'Donation Form' meta box enabled by default. |
142 | 142 | give_nav_donation_metabox_enabled(); |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param int $site_id The Site ID. |
157 | 157 | * @param array $meta Blog Meta. |
158 | 158 | */ |
159 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
159 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
160 | 160 | |
161 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
161 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
162 | 162 | |
163 | - switch_to_blog( $blog_id ); |
|
163 | + switch_to_blog($blog_id); |
|
164 | 164 | give_install(); |
165 | 165 | restore_current_blog(); |
166 | 166 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | } |
170 | 170 | |
171 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
171 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
172 | 172 | |
173 | 173 | |
174 | 174 | /** |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return array The tables to drop. |
183 | 183 | */ |
184 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
184 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
185 | 185 | |
186 | - switch_to_blog( $blog_id ); |
|
186 | + switch_to_blog($blog_id); |
|
187 | 187 | $donors_db = new Give_DB_Donors(); |
188 | 188 | $donor_meta_db = new Give_DB_Donor_Meta(); |
189 | 189 | |
190 | - if ( $donors_db->installed() ) { |
|
190 | + if ($donors_db->installed()) { |
|
191 | 191 | $tables[] = $donors_db->table_name; |
192 | 192 | $tables[] = $donor_meta_db->table_name; |
193 | 193 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
200 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Post-installation |
@@ -209,16 +209,16 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function give_after_install() { |
211 | 211 | |
212 | - if ( ! is_admin() ) { |
|
212 | + if ( ! is_admin()) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | |
216 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
217 | - $give_table_check = get_option( '_give_table_check', false ); |
|
216 | + $give_options = Give_Cache::get('_give_installed', true); |
|
217 | + $give_table_check = get_option('_give_table_check', false); |
|
218 | 218 | |
219 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
219 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
220 | 220 | |
221 | - if ( ! @Give()->donor_meta->installed() ) { |
|
221 | + if ( ! @Give()->donor_meta->installed()) { |
|
222 | 222 | |
223 | 223 | // Create the donor meta database. |
224 | 224 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | } |
228 | 228 | |
229 | - if ( ! @Give()->donors->installed() ) { |
|
229 | + if ( ! @Give()->donors->installed()) { |
|
230 | 230 | // Create the donor database. |
231 | 231 | // (this ensures it creates it on multisite instances where it is network activated). |
232 | 232 | @Give()->donors->create_table(); |
@@ -238,22 +238,22 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param array $give_options Give plugin options. |
240 | 240 | */ |
241 | - do_action( 'give_after_install', $give_options ); |
|
241 | + do_action('give_after_install', $give_options); |
|
242 | 242 | } |
243 | 243 | |
244 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
244 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Delete the transient |
249 | - if ( false !== $give_options ) { |
|
250 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
249 | + if (false !== $give_options) { |
|
250 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
254 | 254 | } |
255 | 255 | |
256 | -add_action( 'admin_init', 'give_after_install' ); |
|
256 | +add_action('admin_init', 'give_after_install'); |
|
257 | 257 | |
258 | 258 | |
259 | 259 | /** |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | |
269 | 269 | global $wp_roles; |
270 | 270 | |
271 | - if ( ! is_object( $wp_roles ) ) { |
|
271 | + if ( ! is_object($wp_roles)) { |
|
272 | 272 | return; |
273 | 273 | } |
274 | 274 | |
275 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
275 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
276 | 276 | |
277 | 277 | // Create Give plugin roles |
278 | 278 | $roles = new Give_Roles(); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | } |
285 | 285 | |
286 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
286 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Default core setting values. |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | 'uninstall_on_delete' => 'disabled', |
322 | 322 | 'the_content_filter' => 'enabled', |
323 | 323 | 'scripts_footer' => 'disabled', |
324 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
324 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
325 | 325 | 'agreement_text' => give_get_default_agreement_text(), |
326 | 326 | |
327 | 327 | // Paypal IPN verification. |
328 | 328 | 'paypal_verification' => 'enabled', |
329 | 329 | |
330 | 330 | // Default is manual gateway. |
331 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
331 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
332 | 332 | 'default_gateway' => 'manual', |
333 | 333 | |
334 | 334 | // Offline gateway setup. |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | function give_get_default_agreement_text() { |
358 | 358 | |
359 | - $org_name = get_bloginfo( 'name' ); |
|
359 | + $org_name = get_bloginfo('name'); |
|
360 | 360 | |
361 | 361 | $agreement = sprintf( |
362 | 362 | '<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the %1$s.</p> |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $org_name |
371 | 371 | ); |
372 | 372 | |
373 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
373 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | |
@@ -379,22 +379,22 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @since 1.8.11 |
381 | 381 | */ |
382 | -function give_create_pages(){ |
|
382 | +function give_create_pages() { |
|
383 | 383 | |
384 | 384 | // Bailout if pages already created. |
385 | - if( get_option( 'give_install_pages_created') ) { |
|
385 | + if (get_option('give_install_pages_created')) { |
|
386 | 386 | return false; |
387 | 387 | } |
388 | 388 | |
389 | 389 | $options = array(); |
390 | 390 | |
391 | 391 | // Checks if the Success Page option exists AND that the page exists. |
392 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
392 | + if ( ! get_post(give_get_option('success_page'))) { |
|
393 | 393 | |
394 | 394 | // Donation Confirmation (Success) Page |
395 | 395 | $success = wp_insert_post( |
396 | 396 | array( |
397 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
397 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
398 | 398 | 'post_content' => '[give_receipt]', |
399 | 399 | 'post_status' => 'publish', |
400 | 400 | 'post_author' => 1, |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | // Checks if the Failure Page option exists AND that the page exists. |
411 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
411 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
412 | 412 | |
413 | 413 | // Failed Donation Page |
414 | 414 | $failed = wp_insert_post( |
415 | 415 | array( |
416 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
417 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
416 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
417 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
418 | 418 | 'post_status' => 'publish', |
419 | 419 | 'post_author' => 1, |
420 | 420 | 'post_type' => 'page', |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // Checks if the History Page option exists AND that the page exists. |
429 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
429 | + if ( ! get_post(give_get_option('history_page'))) { |
|
430 | 430 | // Donation History Page |
431 | 431 | $history = wp_insert_post( |
432 | 432 | array( |
433 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
433 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
434 | 434 | 'post_content' => '[donation_history]', |
435 | 435 | 'post_status' => 'publish', |
436 | 436 | 'post_author' => 1, |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | $options['history_page'] = $history; |
443 | 443 | } |
444 | 444 | |
445 | - if( ! empty( $options ) ) { |
|
446 | - update_option( 'give_settings', array_merge( give_get_settings(), $options ) ); |
|
445 | + if ( ! empty($options)) { |
|
446 | + update_option('give_settings', array_merge(give_get_settings(), $options)); |
|
447 | 447 | } |
448 | 448 | |
449 | - add_option( 'give_install_pages_created', 1, '', 'no' ); |
|
449 | + add_option('give_install_pages_created', 1, '', 'no'); |
|
450 | 450 | } |
451 | -add_action( 'admin_init', 'give_create_pages', -1 ); |
|
451 | +add_action('admin_init', 'give_create_pages', -1); |
@@ -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,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
68 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -62,50 +62,50 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return bool If the gravatar exists or not |
64 | 64 | */ |
65 | - public function validate_gravatar( $id_or_email ) { |
|
65 | + public function validate_gravatar($id_or_email) { |
|
66 | 66 | //id or email code borrowed from wp-includes/pluggable.php |
67 | 67 | $email = ''; |
68 | - if ( is_numeric( $id_or_email ) ) { |
|
68 | + if (is_numeric($id_or_email)) { |
|
69 | 69 | $id = (int) $id_or_email; |
70 | - $user = get_userdata( $id ); |
|
71 | - if ( $user ) { |
|
70 | + $user = get_userdata($id); |
|
71 | + if ($user) { |
|
72 | 72 | $email = $user->user_email; |
73 | 73 | } |
74 | - } elseif ( is_object( $id_or_email ) ) { |
|
74 | + } elseif (is_object($id_or_email)) { |
|
75 | 75 | // No avatar for pingbacks or trackbacks |
76 | - $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); |
|
77 | - if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) { |
|
76 | + $allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment')); |
|
77 | + if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $id_or_email->user_id ) ) { |
|
81 | + if ( ! empty($id_or_email->user_id)) { |
|
82 | 82 | $id = (int) $id_or_email->user_id; |
83 | - $user = get_userdata( $id ); |
|
84 | - if ( $user ) { |
|
83 | + $user = get_userdata($id); |
|
84 | + if ($user) { |
|
85 | 85 | $email = $user->user_email; |
86 | 86 | } |
87 | - } elseif ( ! empty( $id_or_email->comment_author_email ) ) { |
|
87 | + } elseif ( ! empty($id_or_email->comment_author_email)) { |
|
88 | 88 | $email = $id_or_email->comment_author_email; |
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | $email = $id_or_email; |
92 | 92 | } |
93 | 93 | |
94 | - $hashkey = md5( strtolower( trim( $email ) ) ); |
|
95 | - $uri = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404'; |
|
94 | + $hashkey = md5(strtolower(trim($email))); |
|
95 | + $uri = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404'; |
|
96 | 96 | |
97 | - $data = wp_cache_get( $hashkey ); |
|
98 | - if ( false === $data ) { |
|
99 | - $response = wp_remote_head( $uri ); |
|
100 | - if ( is_wp_error( $response ) ) { |
|
97 | + $data = wp_cache_get($hashkey); |
|
98 | + if (false === $data) { |
|
99 | + $response = wp_remote_head($uri); |
|
100 | + if (is_wp_error($response)) { |
|
101 | 101 | $data = 'not200'; |
102 | 102 | } else { |
103 | 103 | $data = $response['response']['code']; |
104 | 104 | } |
105 | - wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 ); |
|
105 | + wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5); |
|
106 | 106 | |
107 | 107 | } |
108 | - if ( $data == '200' ) { |
|
108 | + if ($data == '200') { |
|
109 | 109 | return true; |
110 | 110 | } else { |
111 | 111 | return false; |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return array IDs if logs, false otherwise |
124 | 124 | */ |
125 | - public function get_log_ids( $form_id = '' ) { |
|
125 | + public function get_log_ids($form_id = '') { |
|
126 | 126 | |
127 | 127 | // get Give_Logging class |
128 | 128 | global $give_logs; |
129 | 129 | |
130 | 130 | // get log for this form |
131 | - $logs = $give_logs->get_logs( $form_id ); |
|
131 | + $logs = $give_logs->get_logs($form_id); |
|
132 | 132 | |
133 | - if ( $logs ) { |
|
133 | + if ($logs) { |
|
134 | 134 | $log_ids = array(); |
135 | 135 | |
136 | 136 | // make an array with all the donor IDs |
137 | - foreach ( $logs as $log ) { |
|
137 | + foreach ($logs as $log) { |
|
138 | 138 | $log_ids[] = $log->ID; |
139 | 139 | } |
140 | 140 | |
@@ -155,51 +155,51 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return mixed |
157 | 157 | */ |
158 | - public function get_payment_ids( $form_id = '' ) { |
|
158 | + public function get_payment_ids($form_id = '') { |
|
159 | 159 | |
160 | 160 | $give_options = give_get_settings(); |
161 | 161 | |
162 | - $log_ids = $this->get_log_ids( $form_id ); |
|
162 | + $log_ids = $this->get_log_ids($form_id); |
|
163 | 163 | |
164 | - if ( $log_ids ) { |
|
164 | + if ($log_ids) { |
|
165 | 165 | |
166 | 166 | $payment_ids = array(); |
167 | 167 | |
168 | - foreach ( $log_ids as $id ) { |
|
168 | + foreach ($log_ids as $id) { |
|
169 | 169 | // get the payment ID for each corresponding log ID |
170 | - $payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true ); |
|
170 | + $payment_ids[] = give_get_meta($id, '_give_log_payment_id', true); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // remove donors who have donated more than once so we can have unique avatars |
174 | 174 | $unique_emails = array(); |
175 | 175 | |
176 | - foreach ( $payment_ids as $key => $id ) { |
|
176 | + foreach ($payment_ids as $key => $id) { |
|
177 | 177 | |
178 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
178 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
179 | 179 | |
180 | - if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) { |
|
181 | - if ( ! $this->validate_gravatar( $email ) ) { |
|
180 | + if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) { |
|
181 | + if ( ! $this->validate_gravatar($email)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - $unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true ); |
|
186 | + $unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | 190 | $unique_ids = array(); |
191 | 191 | |
192 | 192 | // strip duplicate emails |
193 | - $unique_emails = array_unique( $unique_emails ); |
|
193 | + $unique_emails = array_unique($unique_emails); |
|
194 | 194 | |
195 | 195 | // convert the unique IDs back into simple array |
196 | - foreach ( $unique_emails as $id => $email ) { |
|
196 | + foreach ($unique_emails as $id => $email) { |
|
197 | 197 | $unique_ids[] = $id; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // randomize the payment IDs if enabled |
201 | - if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) { |
|
202 | - shuffle( $unique_ids ); |
|
201 | + if (isset($give_options['give_donors_gravatars_random_gravatars'])) { |
|
202 | + shuffle($unique_ids); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // return our unique IDs |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function gravatars( $form_id = false, $title = '' ) { |
|
223 | + public function gravatars($form_id = false, $title = '') { |
|
224 | 224 | |
225 | 225 | // unique $payment_ids |
226 | - $payment_ids = $this->get_payment_ids( $form_id ); |
|
226 | + $payment_ids = $this->get_payment_ids($form_id); |
|
227 | 227 | |
228 | 228 | $give_options = give_get_settings(); |
229 | 229 | |
230 | 230 | // return if no ID |
231 | - if ( ! $form_id ) { |
|
231 | + if ( ! $form_id) { |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | |
235 | 235 | // minimum amount of donations before showing gravatars |
236 | 236 | // if the number of items in array is not greater or equal to the number specified, then exit |
237 | - if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) { |
|
238 | - if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) { |
|
237 | + if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) { |
|
238 | + if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | } |
@@ -246,28 +246,28 @@ discard block |
||
246 | 246 | echo '<div id="give-purchase-gravatars">'; |
247 | 247 | |
248 | 248 | |
249 | - if ( isset ( $title ) ) { |
|
249 | + if (isset ($title)) { |
|
250 | 250 | |
251 | - if ( $title ) { |
|
252 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ); |
|
253 | - } elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) { |
|
254 | - echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ); |
|
251 | + if ($title) { |
|
252 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'); |
|
253 | + } elseif (isset($give_options['give_donors_gravatars_heading'])) { |
|
254 | + echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | } |
258 | 258 | echo '<ul class="give-purchase-gravatars-list">'; |
259 | 259 | $i = 0; |
260 | 260 | |
261 | - if ( $payment_ids ) { |
|
262 | - foreach ( $payment_ids as $id ) { |
|
261 | + if ($payment_ids) { |
|
262 | + foreach ($payment_ids as $id) { |
|
263 | 263 | |
264 | 264 | // Give saves a blank option even when the control is turned off, hence the extra check |
265 | - if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) { |
|
265 | + if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) { |
|
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | 269 | // get the payment meta |
270 | - $payment_meta = give_get_meta( $id, '_give_payment_meta', true ); |
|
270 | + $payment_meta = give_get_meta($id, '_give_payment_meta', true); |
|
271 | 271 | |
272 | 272 | $user_info = $payment_meta['user_info']; |
273 | 273 | |
@@ -275,21 +275,21 @@ discard block |
||
275 | 275 | $name = $user_info['first_name']; |
276 | 276 | |
277 | 277 | // get donor's email |
278 | - $email = give_get_meta( $id, '_give_payment_user_email', true ); |
|
278 | + $email = give_get_meta($id, '_give_payment_user_email', true); |
|
279 | 279 | |
280 | 280 | // set gravatar size and provide filter |
281 | - $size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : ''; |
|
281 | + $size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : ''; |
|
282 | 282 | |
283 | 283 | // default image |
284 | - $default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false ); |
|
284 | + $default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false); |
|
285 | 285 | |
286 | 286 | // assemble output |
287 | 287 | $output .= '<li>'; |
288 | 288 | |
289 | - $output .= get_avatar( $email, $size, $default_image, $name ); |
|
289 | + $output .= get_avatar($email, $size, $default_image, $name); |
|
290 | 290 | $output .= '</li>'; |
291 | 291 | |
292 | - $i ++; |
|
292 | + $i++; |
|
293 | 293 | |
294 | 294 | } // end foreach |
295 | 295 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | echo '</ul>'; |
299 | 299 | echo '</div>'; |
300 | 300 | |
301 | - return apply_filters( 'give_donors_gravatars', ob_get_clean() ); |
|
301 | + return apply_filters('give_donors_gravatars', ob_get_clean()); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @return void |
311 | 311 | */ |
312 | 312 | public function register_widget() { |
313 | - register_widget( 'Give_Donors_Gravatars_Widget' ); |
|
313 | + register_widget('Give_Donors_Gravatars_Widget'); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -324,19 +324,19 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @return string |
326 | 326 | */ |
327 | - public function shortcode( $atts, $content = null ) { |
|
327 | + public function shortcode($atts, $content = null) { |
|
328 | 328 | |
329 | - $atts = shortcode_atts( array( |
|
329 | + $atts = shortcode_atts(array( |
|
330 | 330 | 'id' => '', |
331 | 331 | 'title' => '' |
332 | - ), $atts, 'give_donors_gravatars' ); |
|
332 | + ), $atts, 'give_donors_gravatars'); |
|
333 | 333 | |
334 | 334 | // if no ID is passed on single give_forms pages, get the correct ID |
335 | - if ( is_singular( 'give_forms' ) ) { |
|
335 | + if (is_singular('give_forms')) { |
|
336 | 336 | $id = get_the_ID(); |
337 | 337 | } |
338 | 338 | |
339 | - $content = $this->gravatars( $atts['id'], $atts['title'] ); |
|
339 | + $content = $this->gravatars($atts['id'], $atts['title']); |
|
340 | 340 | |
341 | 341 | return $content; |
342 | 342 | |
@@ -352,56 +352,56 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return array Gravatar settings. |
354 | 354 | */ |
355 | - public function settings( $settings ) { |
|
355 | + public function settings($settings) { |
|
356 | 356 | |
357 | 357 | $give_gravatar_settings = array( |
358 | 358 | array( |
359 | - 'name' => esc_html__( 'Donator Gravatars', 'give' ), |
|
359 | + 'name' => esc_html__('Donator Gravatars', 'give'), |
|
360 | 360 | 'desc' => '<hr>', |
361 | 361 | 'id' => 'give_title', |
362 | 362 | 'type' => 'give_title' |
363 | 363 | ), |
364 | 364 | array( |
365 | - 'name' => esc_html__( 'Heading', 'give' ), |
|
366 | - 'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ), |
|
365 | + 'name' => esc_html__('Heading', 'give'), |
|
366 | + 'desc' => esc_html__('The heading to display above the Gravatars.', 'give'), |
|
367 | 367 | 'type' => 'text', |
368 | 368 | 'id' => 'give_donors_gravatars_heading' |
369 | 369 | ), |
370 | 370 | array( |
371 | - 'name' => esc_html__( 'Gravatar Size', 'give' ), |
|
372 | - 'desc' => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ), |
|
371 | + 'name' => esc_html__('Gravatar Size', 'give'), |
|
372 | + 'desc' => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'), |
|
373 | 373 | 'type' => 'text_small', |
374 | 374 | 'id' => 'give_donors_gravatars_gravatar_size', |
375 | 375 | 'default' => '64' |
376 | 376 | ), |
377 | 377 | array( |
378 | - 'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ), |
|
379 | - 'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), |
|
378 | + 'name' => esc_html__('Minimum Unique Donations Required', 'give'), |
|
379 | + 'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), |
|
380 | 380 | 'type' => 'text_small', |
381 | 381 | 'id' => 'give_donors_gravatars_min_purchases_required', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => esc_html__( 'Maximum Gravatars To Show', 'give' ), |
|
385 | - 'desc' => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ), |
|
384 | + 'name' => esc_html__('Maximum Gravatars To Show', 'give'), |
|
385 | + 'desc' => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'), |
|
386 | 386 | 'type' => 'text', |
387 | 387 | 'id' => 'give_donors_gravatars_maximum_number', |
388 | 388 | 'default' => '20', |
389 | 389 | ), |
390 | 390 | array( |
391 | - 'name' => esc_html__( 'Gravatar Visibility', 'give' ), |
|
392 | - 'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ), |
|
391 | + 'name' => esc_html__('Gravatar Visibility', 'give'), |
|
392 | + 'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'), |
|
393 | 393 | 'id' => 'give_donors_gravatars_has_gravatar_account', |
394 | 394 | 'type' => 'checkbox', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => esc_html__( 'Randomize Gravatars', 'give' ), |
|
398 | - 'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ), |
|
397 | + 'name' => esc_html__('Randomize Gravatars', 'give'), |
|
398 | + 'desc' => esc_html__('Randomize the Gravatars.', 'give'), |
|
399 | 399 | 'id' => 'give_donors_gravatars_random_gravatars', |
400 | 400 | 'type' => 'checkbox', |
401 | 401 | ), |
402 | 402 | ); |
403 | 403 | |
404 | - return array_merge( $settings, $give_gravatar_settings ); |
|
404 | + return array_merge($settings, $give_gravatar_settings); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | // widget settings |
428 | 428 | $widget_ops = array( |
429 | 429 | 'classname' => 'give-donors-gravatars', |
430 | - 'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ), |
|
430 | + 'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'), |
|
431 | 431 | ); |
432 | 432 | |
433 | 433 | // widget control settings |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | // create the widget |
441 | 441 | parent::__construct( |
442 | 442 | 'give_donors_gravatars_widget', |
443 | - esc_html__( 'Give Donors Gravatars', 'give' ), |
|
443 | + esc_html__('Give Donors Gravatars', 'give'), |
|
444 | 444 | $widget_ops, |
445 | 445 | $control_ops |
446 | 446 | ); |
@@ -460,29 +460,29 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @return void |
462 | 462 | */ |
463 | - public function widget( $args, $instance ) { |
|
463 | + public function widget($args, $instance) { |
|
464 | 464 | |
465 | 465 | //@TODO: Don't extract it!!! |
466 | - extract( $args ); |
|
466 | + extract($args); |
|
467 | 467 | |
468 | - if ( ! is_singular( 'give_forms' ) ) { |
|
468 | + if ( ! is_singular('give_forms')) { |
|
469 | 469 | return; |
470 | 470 | } |
471 | 471 | |
472 | 472 | // Variables from widget settings |
473 | - $title = apply_filters( 'widget_title', $instance['title'] ); |
|
473 | + $title = apply_filters('widget_title', $instance['title']); |
|
474 | 474 | |
475 | 475 | // Used by themes. Opens the widget |
476 | 476 | echo $before_widget; |
477 | 477 | |
478 | 478 | // Display the widget title |
479 | - if ( $title ) { |
|
480 | - echo $before_title . $title . $after_title; |
|
479 | + if ($title) { |
|
480 | + echo $before_title.$title.$after_title; |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | $gravatars = new Give_Donors_Gravatars(); |
484 | 484 | |
485 | - echo $gravatars->gravatars( get_the_ID(), null ); // remove title |
|
485 | + echo $gravatars->gravatars(get_the_ID(), null); // remove title |
|
486 | 486 | |
487 | 487 | // Used by themes. Closes the widget |
488 | 488 | echo $after_widget; |
@@ -502,11 +502,11 @@ discard block |
||
502 | 502 | * |
503 | 503 | * @return array Updated settings to save. |
504 | 504 | */ |
505 | - public function update( $new_instance, $old_instance ) { |
|
505 | + public function update($new_instance, $old_instance) { |
|
506 | 506 | |
507 | 507 | $instance = $old_instance; |
508 | 508 | |
509 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
509 | + $instance['title'] = strip_tags($new_instance['title']); |
|
510 | 510 | |
511 | 511 | return $instance; |
512 | 512 | |
@@ -524,19 +524,19 @@ discard block |
||
524 | 524 | * |
525 | 525 | * @return void |
526 | 526 | */ |
527 | - public function form( $instance ) { |
|
527 | + public function form($instance) { |
|
528 | 528 | |
529 | 529 | // Set up some default widget settings. |
530 | 530 | $defaults = array( |
531 | 531 | 'title' => '', |
532 | 532 | ); |
533 | 533 | |
534 | - $instance = wp_parse_args( (array) $instance, $defaults ); ?> |
|
534 | + $instance = wp_parse_args((array) $instance, $defaults); ?> |
|
535 | 535 | |
536 | 536 | <!-- Title --> |
537 | 537 | <p> |
538 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label> |
|
539 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
538 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label> |
|
539 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
540 | 540 | </p> |
541 | 541 | |
542 | 542 | <?php |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function add_roles() { |
52 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
52 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
53 | 53 | 'read' => true, |
54 | 54 | 'edit_posts' => true, |
55 | 55 | 'delete_posts' => true, |
@@ -78,25 +78,25 @@ discard block |
||
78 | 78 | 'publish_posts' => true, |
79 | 79 | 'read_private_pages' => true, |
80 | 80 | 'read_private_posts' => true, |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
83 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
84 | 84 | 'read' => true, |
85 | 85 | 'edit_posts' => false, |
86 | 86 | 'delete_posts' => false |
87 | - ) ); |
|
87 | + )); |
|
88 | 88 | |
89 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
89 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
90 | 90 | 'read' => true, |
91 | 91 | 'edit_posts' => true, |
92 | 92 | 'edit_pages' => true, |
93 | 93 | 'upload_files' => true, |
94 | 94 | 'delete_posts' => false, |
95 | - ) ); |
|
95 | + )); |
|
96 | 96 | |
97 | - add_role( 'give_donor', __( 'Give Donor', 'give' ), array( |
|
97 | + add_role('give_donor', __('Give Donor', 'give'), array( |
|
98 | 98 | 'read' => true, |
99 | - ) ); |
|
99 | + )); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -115,38 +115,38 @@ discard block |
||
115 | 115 | public function add_caps() { |
116 | 116 | global $wp_roles; |
117 | 117 | |
118 | - if ( class_exists( 'WP_Roles' ) ) { |
|
119 | - if ( ! isset( $wp_roles ) ) { |
|
118 | + if (class_exists('WP_Roles')) { |
|
119 | + if ( ! isset($wp_roles)) { |
|
120 | 120 | $wp_roles = new WP_Roles(); |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - if ( is_object( $wp_roles ) ) { |
|
125 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
126 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
127 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
124 | + if (is_object($wp_roles)) { |
|
125 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
126 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
127 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
128 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
129 | 129 | |
130 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
131 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
132 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
133 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
130 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
131 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
132 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
133 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
134 | 134 | |
135 | 135 | // Add the main post type capabilities. |
136 | 136 | $capabilities = $this->get_core_caps(); |
137 | - foreach ( $capabilities as $cap_group ) { |
|
138 | - foreach ( $cap_group as $cap ) { |
|
139 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
140 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
141 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
137 | + foreach ($capabilities as $cap_group) { |
|
138 | + foreach ($cap_group as $cap) { |
|
139 | + $wp_roles->add_cap('administrator', $cap); |
|
140 | + $wp_roles->add_cap('give_manager', $cap); |
|
141 | + $wp_roles->add_cap('give_worker', $cap); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
146 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
147 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
148 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
149 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
145 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
146 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
147 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
148 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
149 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | } |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | public function get_core_caps() { |
165 | 165 | $capabilities = array(); |
166 | 166 | |
167 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
167 | + $capability_types = array('give_form', 'give_payment'); |
|
168 | 168 | |
169 | - foreach ( $capability_types as $capability_type ) { |
|
170 | - $capabilities[ $capability_type ] = array( |
|
169 | + foreach ($capability_types as $capability_type) { |
|
170 | + $capabilities[$capability_type] = array( |
|
171 | 171 | // Post type. |
172 | 172 | "edit_{$capability_type}", |
173 | 173 | "read_{$capability_type}", |
@@ -213,22 +213,22 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @return array $caps Meta capabilities. |
215 | 215 | */ |
216 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
216 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
217 | 217 | |
218 | - switch ( $cap ) { |
|
218 | + switch ($cap) { |
|
219 | 219 | |
220 | 220 | case 'view_give_form_stats' : |
221 | 221 | |
222 | - if ( empty( $args[0] ) ) { |
|
222 | + if (empty($args[0])) { |
|
223 | 223 | break; |
224 | 224 | } |
225 | 225 | |
226 | - $form = get_post( $args[0] ); |
|
227 | - if ( empty( $form ) ) { |
|
226 | + $form = get_post($args[0]); |
|
227 | + if (empty($form)) { |
|
228 | 228 | break; |
229 | 229 | } |
230 | 230 | |
231 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
231 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
232 | 232 | $caps = array(); |
233 | 233 | } |
234 | 234 | |
@@ -255,41 +255,41 @@ discard block |
||
255 | 255 | |
256 | 256 | global $wp_roles; |
257 | 257 | |
258 | - if ( class_exists( 'WP_Roles' ) ) { |
|
259 | - if ( ! isset( $wp_roles ) ) { |
|
258 | + if (class_exists('WP_Roles')) { |
|
259 | + if ( ! isset($wp_roles)) { |
|
260 | 260 | $wp_roles = new WP_Roles(); |
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | - if ( is_object( $wp_roles ) ) { |
|
264 | + if (is_object($wp_roles)) { |
|
265 | 265 | // Give Manager Capabilities. |
266 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
267 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
268 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
269 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
266 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
267 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
268 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
269 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
270 | 270 | |
271 | 271 | // Site Administrator Capabilities. |
272 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
273 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
274 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
275 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
272 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
273 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
274 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
275 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
276 | 276 | |
277 | 277 | // Remove the Main Post Type Capabilities. |
278 | 278 | $capabilities = $this->get_core_caps(); |
279 | 279 | |
280 | - foreach ( $capabilities as $cap_group ) { |
|
281 | - foreach ( $cap_group as $cap ) { |
|
282 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
283 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
284 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
280 | + foreach ($capabilities as $cap_group) { |
|
281 | + foreach ($cap_group as $cap) { |
|
282 | + $wp_roles->remove_cap('give_manager', $cap); |
|
283 | + $wp_roles->remove_cap('administrator', $cap); |
|
284 | + $wp_roles->remove_cap('give_worker', $cap); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | 288 | /** Give Accountant Capabilities */ |
289 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
290 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
291 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
292 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
289 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
290 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
291 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
292 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
293 | 293 | |
294 | 294 | } |
295 | 295 | } |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /* @var WPDB $wpdb */ |
34 | 34 | global $wpdb; |
35 | 35 | |
36 | - $wpdb->customermeta = $this->table_name = $wpdb->prefix . 'give_customermeta'; |
|
36 | + $wpdb->customermeta = $this->table_name = $wpdb->prefix.'give_customermeta'; |
|
37 | 37 | $this->primary_key = 'meta_id'; |
38 | 38 | $this->version = '1.0'; |
39 | 39 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
73 | 73 | */ |
74 | - public function get_meta( $donor_id = 0, $meta_key = '', $single = false ) { |
|
75 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
76 | - if ( false === $donor_id ) { |
|
74 | + public function get_meta($donor_id = 0, $meta_key = '', $single = false) { |
|
75 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
76 | + if (false === $donor_id) { |
|
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
80 | - return get_metadata( 'customer', $donor_id, $meta_key, $single ); |
|
80 | + return get_metadata('customer', $donor_id, $meta_key, $single); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool False for failure. True for success. |
97 | 97 | */ |
98 | - public function add_meta( $donor_id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
99 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
100 | - if ( false === $donor_id ) { |
|
98 | + public function add_meta($donor_id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
99 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
100 | + if (false === $donor_id) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - return add_metadata( 'customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
104 | + return add_metadata('customer', $donor_id, $meta_key, $meta_value, $unique); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return bool False on failure, true if success. |
126 | 126 | */ |
127 | - public function update_meta( $donor_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
128 | - $donor_id = $this->sanitize_donor_id( $donor_id ); |
|
129 | - if ( false === $donor_id ) { |
|
127 | + public function update_meta($donor_id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
128 | + $donor_id = $this->sanitize_donor_id($donor_id); |
|
129 | + if (false === $donor_id) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | - return update_metadata( 'customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
133 | + return update_metadata('customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return bool False for failure. True for success. |
153 | 153 | */ |
154 | - public function delete_meta( $donor_id = 0, $meta_key = '', $meta_value = '' ) { |
|
155 | - return delete_metadata( 'customer', $donor_id, $meta_key, $meta_value ); |
|
154 | + public function delete_meta($donor_id = 0, $meta_key = '', $meta_value = '') { |
|
155 | + return delete_metadata('customer', $donor_id, $meta_key, $meta_value); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return bool False for failure. True for success. |
167 | 167 | */ |
168 | - public function delete_all_meta( $donor_id = 0 ) { |
|
168 | + public function delete_all_meta($donor_id = 0) { |
|
169 | 169 | global $wpdb; |
170 | - $wpdb->delete( $this->table_name, array( 'customer_id' => $donor_id ), array( '%d' ) ); |
|
170 | + $wpdb->delete($this->table_name, array('customer_id' => $donor_id), array('%d')); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function create_table() { |
182 | 182 | |
183 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
183 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
184 | 184 | |
185 | 185 | $sql = "CREATE TABLE {$this->table_name} ( |
186 | 186 | meta_id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | KEY meta_key (meta_key) |
193 | 193 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
194 | 194 | |
195 | - dbDelta( $sql ); |
|
195 | + dbDelta($sql); |
|
196 | 196 | |
197 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
197 | + update_option($this->table_name.'_db_version', $this->version); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -207,23 +207,23 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return int|bool The normalized donor ID or false if it's found to not be valid. |
209 | 209 | */ |
210 | - private function sanitize_donor_id( $donor_id ) { |
|
211 | - if ( ! is_numeric( $donor_id ) ) { |
|
210 | + private function sanitize_donor_id($donor_id) { |
|
211 | + if ( ! is_numeric($donor_id)) { |
|
212 | 212 | return false; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $donor_id = (int) $donor_id; |
216 | 216 | |
217 | 217 | // We were given a non positive number. |
218 | - if ( absint( $donor_id ) !== $donor_id ) { |
|
218 | + if (absint($donor_id) !== $donor_id) { |
|
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | |
222 | - if ( empty( $donor_id ) ) { |
|
222 | + if (empty($donor_id)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | |
226 | - return absint( $donor_id ); |
|
226 | + return absint($donor_id); |
|
227 | 227 | |
228 | 228 | } |
229 | 229 |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -44,24 +44,24 @@ discard block |
||
44 | 44 | * @param string $template_path Template file path. Default is empty. |
45 | 45 | * @param string $default_path Default path. Default is empty. |
46 | 46 | */ |
47 | -function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
|
48 | - if ( ! empty( $args ) && is_array( $args ) ) { |
|
49 | - extract( $args ); |
|
47 | +function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') { |
|
48 | + if ( ! empty($args) && is_array($args)) { |
|
49 | + extract($args); |
|
50 | 50 | } |
51 | 51 | |
52 | - $template_names = array( $template_name . '.php' ); |
|
52 | + $template_names = array($template_name.'.php'); |
|
53 | 53 | |
54 | - $located = give_locate_template( $template_names, $template_path, $default_path ); |
|
54 | + $located = give_locate_template($template_names, $template_path, $default_path); |
|
55 | 55 | |
56 | - if ( ! file_exists( $located ) ) { |
|
56 | + if ( ! file_exists($located)) { |
|
57 | 57 | /* translators: %s: the template */ |
58 | - Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true ); |
|
58 | + Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true); |
|
59 | 59 | |
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Allow 3rd party plugin filter template file from their plugin. |
64 | - $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path ); |
|
64 | + $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path); |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Fires in give template, before the file is included. |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * @param string $located Template file filter by 3rd party plugin. |
76 | 76 | * @param array $args Passed arguments. |
77 | 77 | */ |
78 | - do_action( 'give_before_template_part', $template_name, $template_path, $located, $args ); |
|
78 | + do_action('give_before_template_part', $template_name, $template_path, $located, $args); |
|
79 | 79 | |
80 | - include( $located ); |
|
80 | + include($located); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Fires in give template, after the file is included. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param string $located Template file filter by 3rd party plugin. |
92 | 92 | * @param array $args Passed arguments. |
93 | 93 | */ |
94 | - do_action( 'give_after_template_part', $template_name, $template_path, $located, $args ); |
|
94 | + do_action('give_after_template_part', $template_name, $template_path, $located, $args); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
110 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Fires in give template part, before the template part is retrieved. |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | * @param string $slug Template part file slug {slug}.php. |
120 | 120 | * @param string $name Template part file name {slug}-{name}.php. |
121 | 121 | */ |
122 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
122 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
123 | 123 | |
124 | 124 | // Setup possible parts |
125 | 125 | $templates = array(); |
126 | - if ( isset( $name ) ) { |
|
127 | - $templates[] = $slug . '-' . $name . '.php'; |
|
126 | + if (isset($name)) { |
|
127 | + $templates[] = $slug.'-'.$name.'.php'; |
|
128 | 128 | } |
129 | - $templates[] = $slug . '.php'; |
|
129 | + $templates[] = $slug.'.php'; |
|
130 | 130 | |
131 | 131 | // Allow template parts to be filtered |
132 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
132 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
133 | 133 | |
134 | 134 | // Return the part that is found |
135 | - return give_locate_template( $templates, $load, false ); |
|
135 | + return give_locate_template($templates, $load, false); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -153,37 +153,37 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @return string The template filename if one is located. |
155 | 155 | */ |
156 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
156 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
157 | 157 | // No file found yet |
158 | 158 | $located = false; |
159 | 159 | |
160 | 160 | // Try to find a template file |
161 | - foreach ( (array) $template_names as $template_name ) { |
|
161 | + foreach ((array) $template_names as $template_name) { |
|
162 | 162 | |
163 | 163 | // Continue if template is empty |
164 | - if ( empty( $template_name ) ) { |
|
164 | + if (empty($template_name)) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // Trim off any slashes from the template name |
169 | - $template_name = ltrim( $template_name, '/' ); |
|
169 | + $template_name = ltrim($template_name, '/'); |
|
170 | 170 | |
171 | 171 | // try locating this template file by looping through the template paths |
172 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
172 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
173 | 173 | |
174 | - if ( file_exists( $template_path . $template_name ) ) { |
|
175 | - $located = $template_path . $template_name; |
|
174 | + if (file_exists($template_path.$template_name)) { |
|
175 | + $located = $template_path.$template_name; |
|
176 | 176 | break; |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - if ( $located ) { |
|
180 | + if ($located) { |
|
181 | 181 | break; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
186 | - load_template( $located, $require_once ); |
|
185 | + if ((true == $load) && ! empty($located)) { |
|
186 | + load_template($located, $require_once); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $located; |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | $template_dir = give_get_theme_template_dir_name(); |
201 | 201 | |
202 | 202 | $file_paths = array( |
203 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
204 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
203 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
204 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
205 | 205 | 100 => give_get_templates_dir(), |
206 | 206 | ); |
207 | 207 | |
208 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
208 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
209 | 209 | |
210 | 210 | // sort the file paths based on priority |
211 | - ksort( $file_paths, SORT_NUMERIC ); |
|
211 | + ksort($file_paths, SORT_NUMERIC); |
|
212 | 212 | |
213 | - return array_map( 'trailingslashit', $file_paths ); |
|
213 | + return array_map('trailingslashit', $file_paths); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return string |
223 | 223 | */ |
224 | 224 | function give_get_theme_template_dir_name() { |
225 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
225 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | function give_version_in_header() { |
235 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
235 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
236 | 236 | } |
237 | 237 | |
238 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
238 | +add_action('wp_head', 'give_version_in_header'); |
|
239 | 239 | |
240 | 240 | /** |
241 | 241 | * Determines if we're currently on the Donations History page. |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function give_is_donation_history_page() { |
247 | 247 | |
248 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
248 | + $ret = is_page(give_get_option('history_page')); |
|
249 | 249 | |
250 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
250 | + return apply_filters('give_is_donation_history_page', $ret); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -259,25 +259,25 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return array Modified array of classes |
261 | 261 | */ |
262 | -function give_add_body_classes( $class ) { |
|
262 | +function give_add_body_classes($class) { |
|
263 | 263 | $classes = (array) $class; |
264 | 264 | |
265 | - if ( give_is_success_page() ) { |
|
265 | + if (give_is_success_page()) { |
|
266 | 266 | $classes[] = 'give-success'; |
267 | 267 | $classes[] = 'give-page'; |
268 | 268 | } |
269 | 269 | |
270 | - if ( give_is_failed_transaction_page() ) { |
|
270 | + if (give_is_failed_transaction_page()) { |
|
271 | 271 | $classes[] = 'give-failed-transaction'; |
272 | 272 | $classes[] = 'give-page'; |
273 | 273 | } |
274 | 274 | |
275 | - if ( give_is_donation_history_page() ) { |
|
275 | + if (give_is_donation_history_page()) { |
|
276 | 276 | $classes[] = 'give-donation-history'; |
277 | 277 | $classes[] = 'give-page'; |
278 | 278 | } |
279 | 279 | |
280 | - if ( give_is_test_mode() ) { |
|
280 | + if (give_is_test_mode()) { |
|
281 | 281 | $classes[] = 'give-test-mode'; |
282 | 282 | $classes[] = 'give-page'; |
283 | 283 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | /* @var WP_Theme $current_theme */ |
287 | 287 | $current_theme = wp_get_theme(); |
288 | 288 | |
289 | - switch ( $current_theme->get_template() ) { |
|
289 | + switch ($current_theme->get_template()) { |
|
290 | 290 | |
291 | 291 | case 'Divi': |
292 | 292 | $classes[] = 'give-divi'; |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | |
304 | 304 | } |
305 | 305 | |
306 | - return array_unique( $classes ); |
|
306 | + return array_unique($classes); |
|
307 | 307 | } |
308 | 308 | |
309 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
309 | +add_filter('body_class', 'give_add_body_classes'); |
|
310 | 310 | |
311 | 311 | |
312 | 312 | /** |
@@ -322,22 +322,22 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return array |
324 | 324 | */ |
325 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
326 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
325 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
326 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
327 | 327 | return $classes; |
328 | 328 | } |
329 | 329 | |
330 | 330 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
331 | 331 | |
332 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
333 | - unset( $classes[ $key ] ); |
|
332 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
333 | + unset($classes[$key]); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | return $classes; |
337 | 337 | } |
338 | 338 | |
339 | 339 | |
340 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
340 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Get the placeholder image URL for forms etc |
@@ -347,74 +347,74 @@ discard block |
||
347 | 347 | */ |
348 | 348 | function give_get_placeholder_img_src() { |
349 | 349 | |
350 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
350 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
351 | 351 | |
352 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
352 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Global |
358 | 358 | */ |
359 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
359 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
360 | 360 | |
361 | 361 | /** |
362 | 362 | * Output the start of the page wrapper. |
363 | 363 | */ |
364 | 364 | function give_output_content_wrapper() { |
365 | - give_get_template_part( 'global/wrapper-start' ); |
|
365 | + give_get_template_part('global/wrapper-start'); |
|
366 | 366 | } |
367 | 367 | } |
368 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
368 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
369 | 369 | |
370 | 370 | /** |
371 | 371 | * Output the end of the page wrapper. |
372 | 372 | */ |
373 | 373 | function give_output_content_wrapper_end() { |
374 | - give_get_template_part( 'global/wrapper-end' ); |
|
374 | + give_get_template_part('global/wrapper-end'); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | 379 | * Single Give Form |
380 | 380 | */ |
381 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
381 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
382 | 382 | function give_left_sidebar_pre_wrap() { |
383 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
383 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
387 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
388 | 388 | function give_left_sidebar_post_wrap() { |
389 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
389 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
393 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
394 | 394 | function give_get_forms_sidebar() { |
395 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
395 | + give_get_template_part('single-give-form/sidebar'); |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
399 | +if ( ! function_exists('give_show_form_images')) { |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Output the donation form featured image. |
403 | 403 | */ |
404 | 404 | function give_show_form_images() { |
405 | - if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
406 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
405 | + if (give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
406 | + give_get_template_part('single-give-form/featured-image'); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
411 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
411 | +if ( ! function_exists('give_template_single_title')) { |
|
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Output the form title. |
415 | 415 | */ |
416 | 416 | function give_template_single_title() { |
417 | - give_get_template_part( 'single-give-form/title' ); |
|
417 | + give_get_template_part('single-give-form/title'); |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * Conditional Functions |
423 | 423 | */ |
424 | 424 | |
425 | -if ( ! function_exists( 'is_give_form' ) ) { |
|
425 | +if ( ! function_exists('is_give_form')) { |
|
426 | 426 | |
427 | 427 | /** |
428 | 428 | * is_give_form |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | * @return bool |
435 | 435 | */ |
436 | 436 | function is_give_form() { |
437 | - return is_singular( array( 'give_form' ) ); |
|
437 | + return is_singular(array('give_form')); |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
441 | -if ( ! function_exists( 'is_give_category' ) ) { |
|
441 | +if ( ! function_exists('is_give_category')) { |
|
442 | 442 | |
443 | 443 | /** |
444 | 444 | * is_give_category |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @return bool |
455 | 455 | */ |
456 | - function is_give_category( $term = '' ) { |
|
457 | - return is_tax( 'give_forms_category', $term ); |
|
456 | + function is_give_category($term = '') { |
|
457 | + return is_tax('give_forms_category', $term); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
461 | -if ( ! function_exists( 'is_give_tag' ) ) { |
|
461 | +if ( ! function_exists('is_give_tag')) { |
|
462 | 462 | |
463 | 463 | /** |
464 | 464 | * is_give_tag |
@@ -473,12 +473,12 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @return bool |
475 | 475 | */ |
476 | - function is_give_tag( $term = '' ) { |
|
477 | - return is_tax( 'give_forms_tag', $term ); |
|
476 | + function is_give_tag($term = '') { |
|
477 | + return is_tax('give_forms_tag', $term); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | -if ( ! function_exists( 'is_give_taxonomy' ) ) { |
|
481 | +if ( ! function_exists('is_give_taxonomy')) { |
|
482 | 482 | |
483 | 483 | /** |
484 | 484 | * is_give_taxonomy |
@@ -490,6 +490,6 @@ discard block |
||
490 | 490 | * @return bool |
491 | 491 | */ |
492 | 492 | function is_give_taxonomy() { |
493 | - return is_tax( get_object_taxonomies( 'give_form' ) ); |
|
493 | + return is_tax(get_object_taxonomies('give_form')); |
|
494 | 494 | } |
495 | 495 | } |