@@ -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 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return Give_Donation_form_Grid_Block |
50 | 50 | */ |
51 | 51 | public static function get_instance() { |
52 | - if ( null === static::$instance ) { |
|
52 | + if (null === static::$instance) { |
|
53 | 53 | self::$instance = new static(); |
54 | 54 | |
55 | 55 | self::$instance->init(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @access private |
68 | 68 | */ |
69 | 69 | private function init() { |
70 | - add_action( 'init', array( $this, 'register_block' ), 999 ); |
|
70 | + add_action('init', array($this, 'register_block'), 999); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function register_block() { |
80 | 80 | // Bailout. |
81 | - if( ! function_exists('register_block_type' ) ) { |
|
81 | + if ( ! function_exists('register_block_type')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Register block. |
86 | - register_block_type( 'give/donation-form-grid', array( |
|
87 | - 'render_callback' => array( $this, 'render_block' ), |
|
86 | + register_block_type('give/donation-form-grid', array( |
|
87 | + 'render_callback' => array($this, 'render_block'), |
|
88 | 88 | 'attributes' => array( |
89 | 89 | 'columns' => array( |
90 | 90 | 'type' => 'string', |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'default' => 'redirect', |
108 | 108 | ), |
109 | 109 | ), |
110 | - ) ); |
|
110 | + )); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -118,16 +118,16 @@ discard block |
||
118 | 118 | * @access public |
119 | 119 | * @return string; |
120 | 120 | */ |
121 | - public function render_block( $attributes ) { |
|
121 | + public function render_block($attributes) { |
|
122 | 122 | $parameters = array( |
123 | - 'columns' => absint( $attributes['columns'] ), |
|
123 | + 'columns' => absint($attributes['columns']), |
|
124 | 124 | 'show_goal' => $attributes['showGoal'], |
125 | 125 | 'show_excerpt' => $attributes['showExcerpt'], |
126 | 126 | 'show_featured_image' => $attributes['showFeaturedImage'], |
127 | 127 | 'display_type' => $attributes['displayType'], |
128 | 128 | ); |
129 | 129 | |
130 | - return give_form_grid_shortcode( $parameters ); |
|
130 | + return give_form_grid_shortcode($parameters); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 |
@@ -190,7 +190,8 @@ discard block |
||
190 | 190 | esc_html( $table_headings['details'] ) |
191 | 191 | ); |
192 | 192 | |
193 | - else : |
|
193 | + else { |
|
194 | + : |
|
194 | 195 | echo sprintf( |
195 | 196 | '<span class="title-for-mobile">%3$s</span><a href="%1$s">%2$s</a>', |
196 | 197 | esc_url( |
@@ -203,6 +204,7 @@ discard block |
||
203 | 204 | __( 'View Receipt »', 'give' ), |
204 | 205 | esc_html( $table_headings['details'] ) |
205 | 206 | ); |
207 | + } |
|
206 | 208 | |
207 | 209 | endif; |
208 | 210 | ?> |
@@ -247,6 +249,9 @@ discard block |
||
247 | 249 | </div> |
248 | 250 | </div> |
249 | 251 | <?php wp_reset_postdata(); ?> |
250 | -<?php else : ?> |
|
251 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
252 | +<?php else { |
|
253 | + : ?> |
|
254 | + <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); |
|
255 | +} |
|
256 | +?> |
|
252 | 257 | <?php endif; |
@@ -4,28 +4,28 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | $donations = array(); |
7 | -$donation_history_args = Give()->session->get( 'give_donation_history_args' ); |
|
7 | +$donation_history_args = Give()->session->get('give_donation_history_args'); |
|
8 | 8 | |
9 | 9 | // User's Donations. |
10 | -if ( is_user_logged_in() ) { |
|
11 | - $donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' ); |
|
12 | -} elseif ( Give()->email_access->token_exists ) { |
|
10 | +if (is_user_logged_in()) { |
|
11 | + $donations = give_get_users_donations(get_current_user_id(), 20, true, 'any'); |
|
12 | +} elseif (Give()->email_access->token_exists) { |
|
13 | 13 | // Email Access Token? |
14 | - $donations = give_get_users_donations( 0, 20, true, 'any' ); |
|
14 | + $donations = give_get_users_donations(0, 20, true, 'any'); |
|
15 | 15 | } elseif ( |
16 | 16 | false !== Give()->session->get_session_expiration() || |
17 | 17 | true === give_get_history_session() |
18 | 18 | ) { |
19 | 19 | // Session active? |
20 | - $email = Give()->session->get( 'give_email' ); |
|
21 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
22 | - $donations_count = count( explode( ',', $donor->payment_ids ) ); |
|
20 | + $email = Give()->session->get('give_email'); |
|
21 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
22 | + $donations_count = count(explode(',', $donor->payment_ids)); |
|
23 | 23 | |
24 | - if ( $donations_count > give_get_limit_display_donations() ) { |
|
24 | + if ($donations_count > give_get_limit_display_donations()) { |
|
25 | 25 | |
26 | 26 | // Restrict Security Email Access option, if donation count of a donor is less than or equal to limit. |
27 | - if ( true !== Give_Cache::get( "give_cache_email_throttle_limit_exhausted_{$donor->id}" ) ) { |
|
28 | - add_action( 'give_donation_history_table_end', 'give_donation_history_table_end' ); |
|
27 | + if (true !== Give_Cache::get("give_cache_email_throttle_limit_exhausted_{$donor->id}")) { |
|
28 | + add_action('give_donation_history_table_end', 'give_donation_history_table_end'); |
|
29 | 29 | } else { |
30 | 30 | $value = Give()->email_access->verify_throttle / 60; |
31 | 31 | |
@@ -42,35 +42,35 @@ discard block |
||
42 | 42 | $message = (string) apply_filters( |
43 | 43 | 'give_email_access_requests_exceed_notice', |
44 | 44 | sprintf( |
45 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
46 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
45 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
46 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
47 | 47 | ), |
48 | 48 | $value |
49 | 49 | ); |
50 | 50 | |
51 | - give_set_error( 'give-limited-throttle', |
|
51 | + give_set_error('give-limited-throttle', |
|
52 | 52 | $message |
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
56 | - $donations = give_get_users_donations( $email, give_get_limit_display_donations(), true, 'any' ); |
|
56 | + $donations = give_get_users_donations($email, give_get_limit_display_donations(), true, 'any'); |
|
57 | 57 | } else { |
58 | - $donations = give_get_users_donations( $email, 20, true, 'any' ); |
|
58 | + $donations = give_get_users_donations($email, 20, true, 'any'); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | -Give()->notices->render_frontend_notices( 0 ); |
|
62 | +Give()->notices->render_frontend_notices(0); |
|
63 | 63 | |
64 | -if ( $donations ) : ?> |
|
64 | +if ($donations) : ?> |
|
65 | 65 | <?php |
66 | 66 | $table_headings = array( |
67 | - 'id' => __( 'ID', 'give' ), |
|
68 | - 'date' => __( 'Date', 'give' ), |
|
69 | - 'donor' => __( 'Donor', 'give' ), |
|
70 | - 'amount' => __( 'Amount', 'give' ), |
|
71 | - 'status' => __( 'Status', 'give' ), |
|
72 | - 'payment_method' => __( 'Payment Method', 'give' ), |
|
73 | - 'details' => __( 'Details', 'give' ), |
|
67 | + 'id' => __('ID', 'give'), |
|
68 | + 'date' => __('Date', 'give'), |
|
69 | + 'donor' => __('Donor', 'give'), |
|
70 | + 'amount' => __('Amount', 'give'), |
|
71 | + 'status' => __('Status', 'give'), |
|
72 | + 'payment_method' => __('Payment Method', 'give'), |
|
73 | + 'details' => __('Details', 'give'), |
|
74 | 74 | ); |
75 | 75 | ?> |
76 | 76 | <div class="give_user_history_main" > |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @since 1.7 |
88 | 88 | */ |
89 | - do_action( 'give_donation_history_header_before' ); |
|
89 | + do_action('give_donation_history_header_before'); |
|
90 | 90 | |
91 | - foreach ( $donation_history_args as $index => $value ) { |
|
92 | - if ( filter_var( $donation_history_args[ $index ], FILTER_VALIDATE_BOOLEAN ) ) : |
|
91 | + foreach ($donation_history_args as $index => $value) { |
|
92 | + if (filter_var($donation_history_args[$index], FILTER_VALIDATE_BOOLEAN)) : |
|
93 | 93 | echo sprintf( |
94 | 94 | '<th scope="col" class="give-donation-%1$s>">%2$s</th>', |
95 | 95 | $index, |
96 | - $table_headings[ $index ] |
|
96 | + $table_headings[$index] |
|
97 | 97 | ); |
98 | 98 | endif; |
99 | 99 | } |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.7 |
107 | 107 | */ |
108 | - do_action( 'give_donation_history_header_after' ); |
|
108 | + do_action('give_donation_history_header_after'); |
|
109 | 109 | ?> |
110 | 110 | </tr> |
111 | 111 | </thead> |
112 | - <?php foreach ( $donations as $post ) : |
|
113 | - setup_postdata( $post ); |
|
114 | - $donation_data = give_get_payment_meta( $post->ID ); ?> |
|
112 | + <?php foreach ($donations as $post) : |
|
113 | + setup_postdata($post); |
|
114 | + $donation_data = give_get_payment_meta($post->ID); ?> |
|
115 | 115 | <tr class="give-donation-row"> |
116 | 116 | <?php |
117 | 117 | /** |
@@ -124,37 +124,37 @@ discard block |
||
124 | 124 | * @param int $post_id The ID of the post. |
125 | 125 | * @param mixed $donation_data Payment meta data. |
126 | 126 | */ |
127 | - do_action( 'give_donation_history_row_start', $post->ID, $donation_data ); |
|
127 | + do_action('give_donation_history_row_start', $post->ID, $donation_data); |
|
128 | 128 | |
129 | - if ( filter_var( $donation_history_args['id'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
129 | + if (filter_var($donation_history_args['id'], FILTER_VALIDATE_BOOLEAN)) : |
|
130 | 130 | echo sprintf( |
131 | 131 | '<td class="give-donation-id"><span class="title-for-mobile">%2$s</span>%1$s</td>', |
132 | - give_get_payment_number( $post->ID ), esc_html( $table_headings['id'] ) |
|
132 | + give_get_payment_number($post->ID), esc_html($table_headings['id']) |
|
133 | 133 | ); |
134 | 134 | endif; |
135 | 135 | |
136 | - if ( filter_var( $donation_history_args['date'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
136 | + if (filter_var($donation_history_args['date'], FILTER_VALIDATE_BOOLEAN)) : |
|
137 | 137 | echo sprintf( |
138 | 138 | '<td class="give-donation-date"><span class="title-for-mobile">%2$s</span>%1$s</td>', |
139 | - date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ), esc_html( $table_headings['date'] ) |
|
139 | + date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))), esc_html($table_headings['date']) |
|
140 | 140 | ); |
141 | 141 | endif; |
142 | 142 | |
143 | - if ( filter_var( $donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
143 | + if (filter_var($donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN)) : |
|
144 | 144 | echo sprintf( |
145 | 145 | '<td class="give-donation-donor"><span class="title-for-mobile">%2$s</span>%1$s</td>', |
146 | - give_get_donor_name_by( $post->ID ), $table_headings['donor'] |
|
146 | + give_get_donor_name_by($post->ID), $table_headings['donor'] |
|
147 | 147 | ); |
148 | 148 | endif; |
149 | 149 | ?> |
150 | 150 | |
151 | - <?php if ( filter_var( $donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
151 | + <?php if (filter_var($donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
152 | 152 | <td class="give-donation-amount"> |
153 | - <?php printf( '<span class="title-for-mobile">%1$s</span>', esc_html( $table_headings['amount'] ) ); ?> |
|
153 | + <?php printf('<span class="title-for-mobile">%1$s</span>', esc_html($table_headings['amount'])); ?> |
|
154 | 154 | <span class="give-donation-amount"> |
155 | 155 | <?php |
156 | - $currency_code = give_get_payment_currency_code( $post->ID ); |
|
157 | - $donation_amount = give_donation_amount( $post->ID, true ); |
|
156 | + $currency_code = give_get_payment_currency_code($post->ID); |
|
157 | + $donation_amount = give_donation_amount($post->ID, true); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Filters the donation amount on Donation History Page. |
@@ -166,45 +166,45 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return int |
168 | 168 | */ |
169 | - echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID ); |
|
169 | + echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID); |
|
170 | 170 | ?> |
171 | 171 | </span> |
172 | 172 | </td> |
173 | 173 | <?php endif; ?> |
174 | 174 | |
175 | 175 | <?php |
176 | - if ( filter_var( $donation_history_args['status'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
176 | + if (filter_var($donation_history_args['status'], FILTER_VALIDATE_BOOLEAN)) : |
|
177 | 177 | echo sprintf( |
178 | 178 | '<td class="give-donation-status"><span class="title-for-mobile">%2$s</span>%1$s</td>', |
179 | - give_get_payment_status( $post, true ), |
|
180 | - esc_html( $table_headings['status'] ) |
|
179 | + give_get_payment_status($post, true), |
|
180 | + esc_html($table_headings['status']) |
|
181 | 181 | ); |
182 | 182 | endif; |
183 | 183 | |
184 | - if ( filter_var( $donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
184 | + if (filter_var($donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN)) : |
|
185 | 185 | echo sprintf( |
186 | 186 | '<td class="give-donation-payment-method"><span class="title-for-mobile">%2$s</span>%1$s</td>', |
187 | - give_get_gateway_checkout_label( give_get_payment_gateway( $post->ID ) ), |
|
188 | - esc_html( $table_headings['payment_method'] ) |
|
187 | + give_get_gateway_checkout_label(give_get_payment_gateway($post->ID)), |
|
188 | + esc_html($table_headings['payment_method']) |
|
189 | 189 | ); |
190 | 190 | endif; |
191 | 191 | ?> |
192 | 192 | <td class="give-donation-details"> |
193 | 193 | <?php |
194 | 194 | // Display View Receipt or. |
195 | - if ( 'publish' !== $post->post_status && 'subscription' !== $post->post_status ) : |
|
195 | + if ('publish' !== $post->post_status && 'subscription' !== $post->post_status) : |
|
196 | 196 | echo sprintf( |
197 | 197 | '<span class="title-for-mobile">%4$s</span><a href="%1$s"><span class="give-donation-status %2$s">%3$s</span></a>', |
198 | 198 | esc_url( |
199 | 199 | add_query_arg( |
200 | 200 | 'payment_key', |
201 | - give_get_payment_key( $post->ID ), |
|
201 | + give_get_payment_key($post->ID), |
|
202 | 202 | give_get_history_page_uri() |
203 | 203 | ) |
204 | 204 | ), |
205 | 205 | $post->post_status, |
206 | - __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »', |
|
207 | - esc_html( $table_headings['details'] ) |
|
206 | + __('View', 'give').' '.give_get_payment_status($post, true).' »', |
|
207 | + esc_html($table_headings['details']) |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | else : |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | esc_url( |
214 | 214 | add_query_arg( |
215 | 215 | 'payment_key', |
216 | - give_get_payment_key( $post->ID ), |
|
216 | + give_get_payment_key($post->ID), |
|
217 | 217 | give_get_history_page_uri() |
218 | 218 | ) |
219 | 219 | ), |
220 | - __( 'View Receipt »', 'give' ), |
|
221 | - esc_html( $table_headings['details'] ) |
|
220 | + __('View Receipt »', 'give'), |
|
221 | + esc_html($table_headings['details']) |
|
222 | 222 | ); |
223 | 223 | |
224 | 224 | endif; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param int $post_id The ID of the post. |
236 | 236 | * @param mixed $donation_data Payment meta data. |
237 | 237 | */ |
238 | - do_action( 'give_donation_history_row_end', $post->ID, $donation_data ); |
|
238 | + do_action('give_donation_history_row_end', $post->ID, $donation_data); |
|
239 | 239 | ?> |
240 | 240 | </tr> |
241 | 241 | <?php endforeach; ?> |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @since 1.8.17 |
250 | 250 | */ |
251 | - do_action( 'give_donation_history_table_end' ); |
|
251 | + do_action('give_donation_history_table_end'); |
|
252 | 252 | ?> |
253 | 253 | </table> |
254 | 254 | <div id="give-donation-history-pagination" class="give_pagination navigation"> |
255 | 255 | <?php |
256 | 256 | $big = 999999; |
257 | - echo paginate_links( array( |
|
258 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
257 | + echo paginate_links(array( |
|
258 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
259 | 259 | 'format' => '?paged=%#%', |
260 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
261 | - 'total' => ceil( give_count_donations_of_donor() / 20 ), // 20 items per page |
|
262 | - ) ); |
|
260 | + 'current' => max(1, get_query_var('paged')), |
|
261 | + 'total' => ceil(give_count_donations_of_donor() / 20), // 20 items per page |
|
262 | + )); |
|
263 | 263 | ?> |
264 | 264 | </div> |
265 | 265 | </div> |
266 | 266 | <?php wp_reset_postdata(); ?> |
267 | 267 | <?php else : ?> |
268 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
268 | + <?php Give()->notices->print_frontend_notice(__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?> |
|
269 | 269 | <?php endif; |
@@ -4,26 +4,26 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // Bail out if total goal is empty. |
7 | -if ( empty( $total_goal ) ) { |
|
7 | +if (empty($total_goal)) { |
|
8 | 8 | return false; |
9 | 9 | } |
10 | 10 | |
11 | 11 | // Set Give total progress bar color. |
12 | -$color = apply_filters( 'give_totals_progress_color', '#2bc253' ); |
|
12 | +$color = apply_filters('give_totals_progress_color', '#2bc253'); |
|
13 | 13 | |
14 | 14 | // Give total. |
15 | -$total = ! empty( $total ) ? $total : 0; |
|
15 | +$total = ! empty($total) ? $total : 0; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Filter the goal progress output |
19 | 19 | * |
20 | 20 | * @since 2.1 |
21 | 21 | */ |
22 | -$progress = round( ( $total / $total_goal ) * 100, 2 ); |
|
22 | +$progress = round(($total / $total_goal) * 100, 2); |
|
23 | 23 | |
24 | 24 | // Set progress to 100 percentage if total > total_goal |
25 | 25 | $progress = $total >= $total_goal ? 100 : $progress; |
26 | -$progress = apply_filters( 'give_goal_totals_funded_percentage_output', $progress, $total, $total_goal ); |
|
26 | +$progress = apply_filters('give_goal_totals_funded_percentage_output', $progress, $total, $total_goal); |
|
27 | 27 | |
28 | 28 | ?> |
29 | 29 | <div class="give-goal-progress"> |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | <?php |
32 | 32 | echo sprintf( |
33 | 33 | /* translators: %s: percentage of the amount raised compared to the goal target */ |
34 | - __( '<span class="give-percentage">%s%%</span> funded', 'give' ), |
|
35 | - round( $progress ) |
|
34 | + __('<span class="give-percentage">%s%%</span> funded', 'give'), |
|
35 | + round($progress) |
|
36 | 36 | ); |
37 | 37 | ?> |
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" |
41 | - aria-valuenow="<?php echo esc_attr( $progress ); ?>"> |
|
42 | - <span style="width: <?php echo esc_attr( $progress ); ?>%;<?php if ( ! empty( $color ) ) { |
|
43 | - echo 'background-color:' . $color; |
|
41 | + aria-valuenow="<?php echo esc_attr($progress); ?>"> |
|
42 | + <span style="width: <?php echo esc_attr($progress); ?>%;<?php if ( ! empty($color)) { |
|
43 | + echo 'background-color:'.$color; |
|
44 | 44 | } ?>"></span> |
45 | 45 | </div><!-- /.give-progress-bar --> |
46 | 46 |
@@ -217,12 +217,14 @@ |
||
217 | 217 | ?> |
218 | 218 | |
219 | 219 | <?php |
220 | -else : |
|
220 | +else { |
|
221 | + : |
|
221 | 222 | if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
222 | 223 | if ( isset( $_GET['update_code'] ) ) { |
223 | 224 | switch ( $_GET['update_code'] ) { |
224 | 225 | case '2': |
225 | 226 | printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) ); |
227 | +} |
|
226 | 228 | _e( 'Login with your new credentials.', 'give' ); |
227 | 229 | echo give_login_form(); |
228 | 230 | break; |
@@ -10,25 +10,25 @@ discard block |
||
10 | 10 | |
11 | 11 | $current_user = wp_get_current_user(); |
12 | 12 | |
13 | -if ( is_user_logged_in() ) : |
|
13 | +if (is_user_logged_in()) : |
|
14 | 14 | $user_id = get_current_user_id(); |
15 | - $first_name = get_user_meta( $user_id, 'first_name', true ); |
|
16 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
17 | - $last_name = get_user_meta( $user_id, 'last_name', true ); |
|
15 | + $first_name = get_user_meta($user_id, 'first_name', true); |
|
16 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
17 | + $last_name = get_user_meta($user_id, 'last_name', true); |
|
18 | 18 | $display_name = $current_user->display_name; |
19 | - $donor = new Give_Donor( $user_id, true ); |
|
20 | - $address = $donor->get_donor_address( array( 'address_type' => 'personal' ) ); |
|
21 | - $company_name = $donor->get_meta( '_give_donor_company', true ); |
|
22 | - |
|
23 | - if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
|
24 | - if ( isset( $_GET['update_code'] ) ) { |
|
25 | - if ( 1 === absint( $_GET['update_code'] ) ) { |
|
26 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile has been updated.', 'give' ) ); |
|
19 | + $donor = new Give_Donor($user_id, true); |
|
20 | + $address = $donor->get_donor_address(array('address_type' => 'personal')); |
|
21 | + $company_name = $donor->get_meta('_give_donor_company', true); |
|
22 | + |
|
23 | + if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) { |
|
24 | + if (isset($_GET['update_code'])) { |
|
25 | + if (1 === absint($_GET['update_code'])) { |
|
26 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile has been updated.', 'give')); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - Give()->notices->render_frontend_notices( 0 ); |
|
31 | + Give()->notices->render_frontend_notices(0); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Fires in the profile editor shortcode, before the form. |
@@ -37,57 +37,57 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @since 1.0 |
39 | 39 | */ |
40 | - do_action( 'give_profile_editor_before' ); |
|
40 | + do_action('give_profile_editor_before'); |
|
41 | 41 | ?> |
42 | 42 | |
43 | 43 | <form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post"> |
44 | 44 | <fieldset> |
45 | - <legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend> |
|
45 | + <legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend> |
|
46 | 46 | |
47 | 47 | <h3 id="give_personal_information_label" |
48 | - class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3> |
|
48 | + class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3> |
|
49 | 49 | |
50 | 50 | <p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive"> |
51 | 51 | <label for="give_first_name"> |
52 | - <?php _e( 'First Name', 'give' ); ?> |
|
52 | + <?php _e('First Name', 'give'); ?> |
|
53 | 53 | <span class="give-required-indicator ">*</span> |
54 | 54 | </label> |
55 | 55 | <input name="give_first_name" id="give_first_name" class="text give-input" type="text" |
56 | - value="<?php echo esc_attr( $first_name ); ?>"/> |
|
56 | + value="<?php echo esc_attr($first_name); ?>"/> |
|
57 | 57 | </p> |
58 | 58 | |
59 | 59 | <p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive"> |
60 | - <label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label> |
|
60 | + <label for="give_last_name"><?php _e('Last Name', 'give'); ?></label> |
|
61 | 61 | <input name="give_last_name" id="give_last_name" class="text give-input" type="text" |
62 | - value="<?php echo esc_attr( $last_name ); ?>"/> |
|
62 | + value="<?php echo esc_attr($last_name); ?>"/> |
|
63 | 63 | </p> |
64 | 64 | |
65 | - <?php if ( ! empty( $company_name ) ) : ?> |
|
65 | + <?php if ( ! empty($company_name)) : ?> |
|
66 | 66 | <p id="give_profile_company_name_wrap" class="form-row form-row-wide"> |
67 | - <label for="give_company_name"><?php _e( 'Company Name', 'give' ); ?></label> |
|
67 | + <label for="give_company_name"><?php _e('Company Name', 'give'); ?></label> |
|
68 | 68 | <input name="give_company_name" id="give_company_name" class="text give-input" type="text" |
69 | - value="<?php echo esc_attr( $company_name ); ?>"/> |
|
69 | + value="<?php echo esc_attr($company_name); ?>"/> |
|
70 | 70 | </p> |
71 | 71 | <?php endif; ?> |
72 | 72 | |
73 | 73 | <p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive"> |
74 | - <label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label> |
|
74 | + <label for="give_display_name"><?php _e('Display Name', 'give'); ?></label> |
|
75 | 75 | <select name="give_display_name" id="give_display_name" class="select give-select"> |
76 | - <?php if ( ! empty( $current_user->first_name ) ): ?> |
|
77 | - <option <?php selected( $display_name, $current_user->first_name ); ?> |
|
78 | - value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option> |
|
76 | + <?php if ( ! empty($current_user->first_name)): ?> |
|
77 | + <option <?php selected($display_name, $current_user->first_name); ?> |
|
78 | + value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option> |
|
79 | 79 | <?php endif; ?> |
80 | - <option <?php selected( $display_name, $current_user->user_nicename ); ?> |
|
81 | - value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option> |
|
82 | - <?php if ( ! empty( $current_user->last_name ) ): ?> |
|
83 | - <option <?php selected( $display_name, $current_user->last_name ); ?> |
|
84 | - value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option> |
|
80 | + <option <?php selected($display_name, $current_user->user_nicename); ?> |
|
81 | + value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option> |
|
82 | + <?php if ( ! empty($current_user->last_name)): ?> |
|
83 | + <option <?php selected($display_name, $current_user->last_name); ?> |
|
84 | + value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option> |
|
85 | 85 | <?php endif; ?> |
86 | - <?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?> |
|
87 | - <option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> |
|
88 | - value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option> |
|
89 | - <option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> |
|
90 | - value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option> |
|
86 | + <?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?> |
|
87 | + <option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> |
|
88 | + value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option> |
|
89 | + <option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> |
|
90 | + value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option> |
|
91 | 91 | <?php endif; ?> |
92 | 92 | </select> |
93 | 93 | <?php |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @since 1.0 |
100 | 100 | */ |
101 | - do_action( 'give_profile_editor_name' ); |
|
101 | + do_action('give_profile_editor_name'); |
|
102 | 102 | ?> |
103 | 103 | </p> |
104 | 104 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @since 1.0 |
112 | 112 | */ |
113 | - do_action( 'give_profile_editor_after_name' ); |
|
113 | + do_action('give_profile_editor_after_name'); |
|
114 | 114 | ?> |
115 | 115 | |
116 | 116 | <p class="form-row form-row-last form-row-responsive"> |
117 | 117 | <label for="give_email"> |
118 | - <?php _e( 'Email Address', 'give' ); ?> |
|
118 | + <?php _e('Email Address', 'give'); ?> |
|
119 | 119 | <span class="give-required-indicator ">*</span> |
120 | 120 | </label> |
121 | 121 | <input name="give_email" id="give_email" class="text give-input required" type="email" |
122 | - value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/> |
|
122 | + value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/> |
|
123 | 123 | <?php |
124 | 124 | /** |
125 | 125 | * Fires in the profile editor shortcode, to the email section. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | - do_action( 'give_profile_editor_email' ); |
|
131 | + do_action('give_profile_editor_email'); |
|
132 | 132 | ?> |
133 | 133 | </p> |
134 | 134 | |
@@ -140,21 +140,21 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @since 1.0 |
142 | 142 | */ |
143 | - do_action( 'give_profile_editor_after_email' ); |
|
143 | + do_action('give_profile_editor_after_email'); |
|
144 | 144 | ?> |
145 | 145 | |
146 | 146 | <h3 id="give_profile_password_label" |
147 | - class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3> |
|
147 | + class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3> |
|
148 | 148 | |
149 | 149 | <div id="give_profile_password_wrap" class="give-clearfix"> |
150 | 150 | <p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive"> |
151 | - <label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label> |
|
151 | + <label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label> |
|
152 | 152 | <input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" |
153 | 153 | type="password"/> |
154 | 154 | </p> |
155 | 155 | |
156 | 156 | <p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive"> |
157 | - <label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label> |
|
157 | + <label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label> |
|
158 | 158 | <input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" |
159 | 159 | type="password"/> |
160 | 160 | <?php |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @since 1.0 |
167 | 167 | */ |
168 | - do_action( 'give_profile_editor_password' ); |
|
168 | + do_action('give_profile_editor_password'); |
|
169 | 169 | ?> |
170 | 170 | </p> |
171 | 171 | </div> |
172 | 172 | |
173 | - <p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p> |
|
173 | + <p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p> |
|
174 | 174 | |
175 | 175 | <?php |
176 | 176 | /** |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @since 1.0 |
182 | 182 | */ |
183 | - do_action( 'give_profile_editor_after_password' ); |
|
183 | + do_action('give_profile_editor_after_password'); |
|
184 | 184 | ?> |
185 | 185 | |
186 | 186 | <p id="give_profile_submit_wrap"> |
187 | 187 | <input type="hidden" name="give_profile_editor_nonce" |
188 | - value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/> |
|
188 | + value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/> |
|
189 | 189 | <input type="hidden" name="give_action" value="edit_user_profile"/> |
190 | 190 | <input type="hidden" name="give_redirect" |
191 | - value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
191 | + value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
192 | 192 | <input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" |
193 | - class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/> |
|
193 | + class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/> |
|
194 | 194 | </p> |
195 | 195 | |
196 | 196 | </fieldset> |
@@ -205,23 +205,23 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - do_action( 'give_profile_editor_after' ); |
|
208 | + do_action('give_profile_editor_after'); |
|
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <?php |
212 | 212 | else : |
213 | - if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) { |
|
214 | - if ( isset( $_GET['update_code'] ) ) { |
|
215 | - switch ( $_GET['update_code'] ) { |
|
213 | + if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) { |
|
214 | + if (isset($_GET['update_code'])) { |
|
215 | + switch ($_GET['update_code']) { |
|
216 | 216 | case '2': |
217 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) ); |
|
218 | - _e( 'Login with your new credentials.', 'give' ); |
|
217 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile and password has been updated.', 'give')); |
|
218 | + _e('Login with your new credentials.', 'give'); |
|
219 | 219 | echo give_login_form(); |
220 | 220 | break; |
221 | 221 | |
222 | 222 | case '3': |
223 | - printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your password has been updated.', 'give' ) ); |
|
224 | - _e( 'Login with your new credentials.', 'give' ); |
|
223 | + printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your password has been updated.', 'give')); |
|
224 | + _e('Login with your new credentials.', 'give'); |
|
225 | 225 | echo give_login_form(); |
226 | 226 | break; |
227 | 227 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | } |
232 | 232 | } else { |
233 | - _e( 'You need to login to edit your profile.', 'give' ); |
|
233 | + _e('You need to login to edit your profile.', 'give'); |
|
234 | 234 | echo give_login_form(); |
235 | 235 | } |
236 | 236 | endif; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | // Exit if accessed directly. |
7 | -if ( ! defined( 'ABSPATH' ) ) { |
|
7 | +if ( ! defined('ABSPATH')) { |
|
8 | 8 | exit; |
9 | 9 | } |
10 | 10 | |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | <div class="give-grid__item"> |
20 | 20 | <?php |
21 | 21 | // Print the opening anchor tag based on display style. |
22 | - if ( 'redirect' === $atts['display_style'] ) { |
|
22 | + if ('redirect' === $atts['display_style']) { |
|
23 | 23 | printf( |
24 | 24 | '<a id="give-card-%1$s" class="give-card" href="%2$s">', |
25 | - esc_attr( $form_id ), |
|
26 | - esc_attr( get_the_permalink() ) |
|
25 | + esc_attr($form_id), |
|
26 | + esc_attr(get_the_permalink()) |
|
27 | 27 | ); |
28 | - } elseif ( 'modal_reveal' === $atts['display_style'] ) { |
|
28 | + } elseif ('modal_reveal' === $atts['display_style']) { |
|
29 | 29 | printf( |
30 | 30 | '<a id="give-card-%1$s" class="give-card js-give-grid-modal-launcher" data-effect="mfp-zoom-out" href="#give-modal-form-%1$s">', |
31 | - esc_attr( $form_id ) |
|
31 | + esc_attr($form_id) |
|
32 | 32 | ); |
33 | 33 | } |
34 | 34 | ?> |
@@ -36,46 +36,46 @@ discard block |
||
36 | 36 | <div class="give-card__body"> |
37 | 37 | <?php |
38 | 38 | // Maybe display the form title. |
39 | - if ( true === $atts['show_title'] ) { |
|
40 | - the_title( '<h3 class="give-card__title">', '</h3>' ); |
|
39 | + if (true === $atts['show_title']) { |
|
40 | + the_title('<h3 class="give-card__title">', '</h3>'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // Maybe display the form excerpt. |
44 | - if ( true === $atts['show_excerpt'] ) { |
|
45 | - if ( has_excerpt( $form_id ) ) { |
|
44 | + if (true === $atts['show_excerpt']) { |
|
45 | + if (has_excerpt($form_id)) { |
|
46 | 46 | // Get excerpt from the form post's excerpt field. |
47 | - $raw_content = get_the_excerpt( $form_id ); |
|
47 | + $raw_content = get_the_excerpt($form_id); |
|
48 | 48 | $stripped_content = wp_strip_all_tags( |
49 | - strip_shortcodes( $raw_content ) |
|
49 | + strip_shortcodes($raw_content) |
|
50 | 50 | ); |
51 | 51 | } else { |
52 | 52 | // Get content from the form post's content field. |
53 | - $raw_content = give_get_meta( $form_id, '_give_form_content', true ); |
|
53 | + $raw_content = give_get_meta($form_id, '_give_form_content', true); |
|
54 | 54 | |
55 | - if ( ! empty( $raw_content ) ) { |
|
55 | + if ( ! empty($raw_content)) { |
|
56 | 56 | $stripped_content = wp_strip_all_tags( |
57 | - strip_shortcodes( $raw_content ) |
|
57 | + strip_shortcodes($raw_content) |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | 62 | // Maybe truncate excerpt. |
63 | - if ( 0 < $atts['excerpt_length'] ) { |
|
64 | - $excerpt = wp_trim_words( $stripped_content, $atts['excerpt_length'] ); |
|
63 | + if (0 < $atts['excerpt_length']) { |
|
64 | + $excerpt = wp_trim_words($stripped_content, $atts['excerpt_length']); |
|
65 | 65 | } else { |
66 | 66 | $excerpt = $stripped_content; |
67 | 67 | } |
68 | 68 | |
69 | - printf( '<p class="give-card__text">%s</p>', $excerpt ); |
|
69 | + printf('<p class="give-card__text">%s</p>', $excerpt); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Maybe display the goal progess bar. |
73 | 73 | if ( |
74 | - give_is_setting_enabled( get_post_meta( $form_id, '_give_goal_option', true ) ) |
|
74 | + give_is_setting_enabled(get_post_meta($form_id, '_give_goal_option', true)) |
|
75 | 75 | && true === $atts['show_goal'] |
76 | 76 | ) { |
77 | 77 | echo '<div class="give-card__progress">'; |
78 | - give_show_goal_progress( $form_id ); |
|
78 | + give_show_goal_progress($form_id); |
|
79 | 79 | echo '</div>'; |
80 | 80 | } |
81 | 81 | ?> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <?php |
85 | 85 | // Maybe display the featured image. |
86 | 86 | if ( |
87 | - give_is_setting_enabled( $give_settings['form_featured_img'] ) |
|
87 | + give_is_setting_enabled($give_settings['form_featured_img']) |
|
88 | 88 | && has_post_thumbnail() |
89 | 89 | && true === $atts['show_featured_image'] |
90 | 90 | ) { |
@@ -94,28 +94,28 @@ discard block |
||
94 | 94 | * @param string The image size. |
95 | 95 | * @param array Form grid attributes. |
96 | 96 | */ |
97 | - $image_size = apply_filters( 'give_form_grid_image_size', $atts['image_size'], $atts ); |
|
97 | + $image_size = apply_filters('give_form_grid_image_size', $atts['image_size'], $atts); |
|
98 | 98 | $image_attr = ''; |
99 | 99 | |
100 | 100 | echo '<div class="give-card__media">'; |
101 | - if ( 'auto' !== $atts['image_height'] ) { |
|
101 | + if ('auto' !== $atts['image_height']) { |
|
102 | 102 | $image_attr = array( |
103 | - 'style' => 'height: ' . $atts['image_height'], |
|
103 | + 'style' => 'height: '.$atts['image_height'], |
|
104 | 104 | ); |
105 | 105 | } |
106 | - the_post_thumbnail( $image_size, $image_attr ); |
|
106 | + the_post_thumbnail($image_size, $image_attr); |
|
107 | 107 | echo '</div>'; |
108 | 108 | } |
109 | 109 | ?> |
110 | 110 | </a> |
111 | 111 | <?php |
112 | 112 | // If modal, print form in hidden container until it is time to be revealed. |
113 | - if ( 'modal_reveal' === $atts['display_style'] ) { |
|
113 | + if ('modal_reveal' === $atts['display_style']) { |
|
114 | 114 | printf( |
115 | 115 | '<div id="give-modal-form-%1$s" class="give-donation-grid-item-form give-modal--slide mfp-hide">', |
116 | 116 | $form_id |
117 | 117 | ); |
118 | - give_get_donation_form( $form_id ); |
|
118 | + give_get_donation_form($form_id); |
|
119 | 119 | echo '</div>'; |
120 | 120 | } |
121 | 121 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( 'give_forms' === $typenow ) { |
|
30 | + if ('give_forms' === $typenow) { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -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 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
33 | 33 | |
34 | 34 | //Payments |
35 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
35 | + $give_payment = get_post_type_object('give_payment'); |
|
36 | 36 | $give_payments_page = add_submenu_page( |
37 | 37 | 'edit.php?post_type=give_forms', |
38 | 38 | $give_payment->labels->name, |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | //Donors |
46 | 46 | $give_donors_page = add_submenu_page( |
47 | 47 | 'edit.php?post_type=give_forms', |
48 | - esc_html__( 'Donors', 'give' ), |
|
49 | - esc_html__( 'Donors', 'give' ), |
|
48 | + esc_html__('Donors', 'give'), |
|
49 | + esc_html__('Donors', 'give'), |
|
50 | 50 | 'view_give_reports', |
51 | 51 | 'give-donors', |
52 | 52 | 'give_donors_page' |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | //Reports` |
56 | 56 | $give_reports_page = add_submenu_page( |
57 | 57 | 'edit.php?post_type=give_forms', |
58 | - esc_html__( 'Donation Reports', 'give' ), |
|
59 | - esc_html__( 'Reports', 'give' ), |
|
58 | + esc_html__('Donation Reports', 'give'), |
|
59 | + esc_html__('Reports', 'give'), |
|
60 | 60 | 'view_give_reports', |
61 | 61 | 'give-reports', |
62 | 62 | array( |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | //Settings |
69 | 69 | $give_settings_page = add_submenu_page( |
70 | 70 | 'edit.php?post_type=give_forms', |
71 | - esc_html__( 'Give Settings', 'give' ), |
|
72 | - esc_html__( 'Settings', 'give' ), |
|
71 | + esc_html__('Give Settings', 'give'), |
|
72 | + esc_html__('Settings', 'give'), |
|
73 | 73 | 'manage_give_settings', |
74 | 74 | 'give-settings', |
75 | 75 | array( |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | //Tools. |
82 | 82 | $give_tools_page = add_submenu_page( |
83 | 83 | 'edit.php?post_type=give_forms', |
84 | - esc_html__( 'Give Tools', 'give' ), |
|
85 | - esc_html__( 'Tools', 'give' ), |
|
84 | + esc_html__('Give Tools', 'give'), |
|
85 | + esc_html__('Tools', 'give'), |
|
86 | 86 | 'manage_give_settings', |
87 | 87 | 'give-tools', |
88 | 88 | array( |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | //Add-ons |
95 | 95 | $give_add_ons_page = add_submenu_page( |
96 | 96 | 'edit.php?post_type=give_forms', |
97 | - esc_html__( 'Give Add-ons', 'give' ), |
|
98 | - esc_html__( 'Add-ons', 'give' ), |
|
97 | + esc_html__('Give Add-ons', 'give'), |
|
98 | + esc_html__('Add-ons', 'give'), |
|
99 | 99 | 'install_plugins', |
100 | 100 | 'give-addons', |
101 | 101 | 'give_add_ons_page' |
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
105 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Determines whether the current admin page is a Give admin page. |
@@ -118,28 +118,28 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return bool True if Give admin page. |
120 | 120 | */ |
121 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
121 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
122 | 122 | global $pagenow, $typenow; |
123 | 123 | |
124 | 124 | $found = true; |
125 | - $get_query_args = ! empty( $_GET ) ? @array_map( 'strtolower', $_GET ) : array(); |
|
125 | + $get_query_args = ! empty($_GET) ? @array_map('strtolower', $_GET) : array(); |
|
126 | 126 | |
127 | 127 | // Set default argument, if not passed. |
128 | - $query_args = wp_parse_args( $get_query_args, array_fill_keys( array( 'post_type', 'action', 'taxonomy', 'page', 'view', 'tab' ), false ) ); |
|
128 | + $query_args = wp_parse_args($get_query_args, array_fill_keys(array('post_type', 'action', 'taxonomy', 'page', 'view', 'tab'), false)); |
|
129 | 129 | |
130 | - switch ( $passed_page ) { |
|
130 | + switch ($passed_page) { |
|
131 | 131 | case 'categories': |
132 | 132 | case 'tags': |
133 | - $has_view = in_array( $passed_view, array( 'list-table', 'edit', 'new' ), true ); |
|
133 | + $has_view = in_array($passed_view, array('list-table', 'edit', 'new'), true); |
|
134 | 134 | |
135 | 135 | if ( |
136 | - ! in_array( $query_args['taxonomy'], array( 'give_forms_category', 'give_forms_tag' ), true ) && |
|
136 | + ! in_array($query_args['taxonomy'], array('give_forms_category', 'give_forms_tag'), true) && |
|
137 | 137 | 'edit-tags.php' !== $pagenow && |
138 | 138 | ( |
139 | 139 | $has_view || |
140 | 140 | ( |
141 | - ( in_array( $passed_view, array( 'list-table', 'new' ), true ) && 'edit' === $query_args['action'] ) || |
|
142 | - ( 'edit' !== $passed_view && 'edit' !== $query_args['action'] ) && |
|
141 | + (in_array($passed_view, array('list-table', 'new'), true) && 'edit' === $query_args['action']) || |
|
142 | + ('edit' !== $passed_view && 'edit' !== $query_args['action']) && |
|
143 | 143 | ! $has_view |
144 | 144 | ) |
145 | 145 | ) |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | break; |
150 | 150 | // Give Donation form page. |
151 | 151 | case 'give_forms': |
152 | - $has_view = in_array( $passed_view, array( 'new', 'list-table', 'edit' ), true ); |
|
152 | + $has_view = in_array($passed_view, array('new', 'list-table', 'edit'), true); |
|
153 | 153 | |
154 | 154 | if ( |
155 | 155 | 'give_forms' !== $typenow && |
156 | 156 | ( |
157 | - ( 'list-table' !== $passed_view && 'edit.php' !== $pagenow ) && |
|
158 | - ( 'edit' !== $passed_view && 'post.php' !== $pagenow ) && |
|
159 | - ( 'new' !== $passed_view && 'post-new.php' !== $pagenow ) |
|
157 | + ('list-table' !== $passed_view && 'edit.php' !== $pagenow) && |
|
158 | + ('edit' !== $passed_view && 'post.php' !== $pagenow) && |
|
159 | + ('new' !== $passed_view && 'post-new.php' !== $pagenow) |
|
160 | 160 | ) || |
161 | 161 | ( |
162 | 162 | ! $has_view && |
163 | - ( 'post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type'] ) |
|
163 | + ('post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type']) |
|
164 | 164 | ) |
165 | 165 | ) { |
166 | 166 | $found = false; |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | break; |
169 | 169 | // Give Donors page. |
170 | 170 | case 'donors': |
171 | - $has_view = array_intersect( array( $passed_view, $query_args['view'] ), array( 'list-table', 'overview', 'notes' ) ); |
|
171 | + $has_view = array_intersect(array($passed_view, $query_args['view']), array('list-table', 'overview', 'notes')); |
|
172 | 172 | |
173 | 173 | if ( |
174 | - ( 'give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow ) && |
|
174 | + ('give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow) && |
|
175 | 175 | ( |
176 | - ( $passed_view !== $query_args['view'] || ! empty( $has_view ) ) || |
|
177 | - ( false !== $query_args['view'] && 'list-table' !== $passed_view ) |
|
176 | + ($passed_view !== $query_args['view'] || ! empty($has_view)) || |
|
177 | + (false !== $query_args['view'] && 'list-table' !== $passed_view) |
|
178 | 178 | ) |
179 | 179 | ) { |
180 | 180 | $found = false; |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | // Give Donations page. |
184 | 184 | case 'payments': |
185 | 185 | if ( |
186 | - ( 'give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow ) && |
|
186 | + ('give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow) && |
|
187 | 187 | ( |
188 | - ! in_array( $passed_view, array( 'list-table', 'edit' ), true ) || |
|
188 | + ! in_array($passed_view, array('list-table', 'edit'), true) || |
|
189 | 189 | ( |
190 | - ( 'list-table' !== $passed_view && false !== $query_args['view'] ) || |
|
191 | - ( 'edit' !== $passed_view && 'view-payment-details' !== $query_args['view'] ) |
|
190 | + ('list-table' !== $passed_view && false !== $query_args['view']) || |
|
191 | + ('edit' !== $passed_view && 'view-payment-details' !== $query_args['view']) |
|
192 | 192 | ) |
193 | 193 | ) |
194 | 194 | ) { |
@@ -199,20 +199,20 @@ discard block |
||
199 | 199 | case 'settings': |
200 | 200 | case 'addons': |
201 | 201 | // Get current tab. |
202 | - $current_tab = empty( $passed_view ) ? $query_args['tab'] : $passed_view; |
|
203 | - $give_setting_page = in_array( $query_args['page'], array( 'give-reports', 'give-settings', 'give-addons' ), true ); |
|
202 | + $current_tab = empty($passed_view) ? $query_args['tab'] : $passed_view; |
|
203 | + $give_setting_page = in_array($query_args['page'], array('give-reports', 'give-settings', 'give-addons'), true); |
|
204 | 204 | |
205 | 205 | // Check if it's Give Setting page or not. |
206 | 206 | if ( |
207 | - ( 'edit.php' !== $pagenow || ! $give_setting_page ) && |
|
208 | - ! Give_Admin_Settings::is_setting_page( $current_tab ) |
|
207 | + ('edit.php' !== $pagenow || ! $give_setting_page) && |
|
208 | + ! Give_Admin_Settings::is_setting_page($current_tab) |
|
209 | 209 | ) { |
210 | 210 | $found = false; |
211 | 211 | } |
212 | 212 | break; |
213 | 213 | default: |
214 | 214 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
215 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
215 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
216 | 216 | $give_payments_page, |
217 | 217 | $give_settings_page, |
218 | 218 | $give_reports_page, |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | $give_donors_page, |
223 | 223 | $give_tools_page, |
224 | 224 | 'widgets.php', |
225 | - ) ); |
|
225 | + )); |
|
226 | 226 | |
227 | - $found = ( 'give_forms' === $typenow || in_array( $pagenow, array_merge( $admin_pages, array( 'index.php', 'post-new.php', 'post.php' ) ), true ) ) ? true : false; |
|
227 | + $found = ('give_forms' === $typenow || in_array($pagenow, array_merge($admin_pages, array('index.php', 'post-new.php', 'post.php')), true)) ? true : false; |
|
228 | 228 | } |
229 | - return (bool) apply_filters( 'give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view ); |
|
229 | + return (bool) apply_filters('give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -236,37 +236,37 @@ discard block |
||
236 | 236 | * @param array $settings |
237 | 237 | * @return array |
238 | 238 | */ |
239 | -function give_settings_page_pages( $settings ) { |
|
240 | - include( 'abstract-admin-settings-page.php' ); |
|
241 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
239 | +function give_settings_page_pages($settings) { |
|
240 | + include('abstract-admin-settings-page.php'); |
|
241 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
242 | 242 | |
243 | 243 | $settings = array( |
244 | 244 | // General settings. |
245 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ), |
|
245 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-general.php'), |
|
246 | 246 | |
247 | 247 | // Payment Gateways Settings. |
248 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ), |
|
248 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-gateways.php'), |
|
249 | 249 | |
250 | 250 | // Display settings. |
251 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ), |
|
251 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-display.php'), |
|
252 | 252 | |
253 | 253 | // Emails settings. |
254 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ), |
|
254 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-email.php'), |
|
255 | 255 | |
256 | 256 | // Addons settings. |
257 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ), |
|
257 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-addon.php'), |
|
258 | 258 | |
259 | 259 | // License settings. |
260 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ), |
|
260 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-license.php'), |
|
261 | 261 | |
262 | 262 | // Advanced settings. |
263 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' ), |
|
263 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-advanced.php'), |
|
264 | 264 | ); |
265 | 265 | |
266 | 266 | // Output. |
267 | 267 | return $settings; |
268 | 268 | } |
269 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
269 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
@@ -276,25 +276,25 @@ discard block |
||
276 | 276 | * @param array $settings |
277 | 277 | * @return array |
278 | 278 | */ |
279 | -function give_reports_page_pages( $settings ) { |
|
280 | - include( 'abstract-admin-settings-page.php' ); |
|
279 | +function give_reports_page_pages($settings) { |
|
280 | + include('abstract-admin-settings-page.php'); |
|
281 | 281 | |
282 | 282 | $settings = array( |
283 | 283 | // Earnings. |
284 | - include( 'reports/class-earnings-report.php' ), |
|
284 | + include('reports/class-earnings-report.php'), |
|
285 | 285 | |
286 | 286 | // Forms. |
287 | - include( 'reports/class-forms-report.php' ), |
|
287 | + include('reports/class-forms-report.php'), |
|
288 | 288 | |
289 | 289 | // Gateways. |
290 | - include( 'reports/class-gateways-report.php' ), |
|
290 | + include('reports/class-gateways-report.php'), |
|
291 | 291 | |
292 | 292 | ); |
293 | 293 | |
294 | 294 | // Output. |
295 | 295 | return $settings; |
296 | 296 | } |
297 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
297 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
298 | 298 | |
299 | 299 | /** |
300 | 300 | * Add setting tab to give-settings page |
@@ -303,34 +303,34 @@ discard block |
||
303 | 303 | * @param array $settings |
304 | 304 | * @return array |
305 | 305 | */ |
306 | -function give_tools_page_pages( $settings ) { |
|
307 | - include( 'abstract-admin-settings-page.php' ); |
|
306 | +function give_tools_page_pages($settings) { |
|
307 | + include('abstract-admin-settings-page.php'); |
|
308 | 308 | |
309 | 309 | $settings = array( |
310 | 310 | |
311 | 311 | // Export. |
312 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ), |
|
312 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-export.php'), |
|
313 | 313 | |
314 | 314 | // Import |
315 | - include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ), |
|
315 | + include_once(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-import.php'), |
|
316 | 316 | |
317 | 317 | // Logs. |
318 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ), |
|
318 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-logs.php'), |
|
319 | 319 | |
320 | 320 | // API. |
321 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ), |
|
321 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-api.php'), |
|
322 | 322 | |
323 | 323 | // Data. |
324 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ), |
|
324 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-data.php'), |
|
325 | 325 | |
326 | 326 | // System Info. |
327 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ), |
|
327 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-system-info.php'), |
|
328 | 328 | ); |
329 | 329 | |
330 | 330 | // Output. |
331 | 331 | return $settings; |
332 | 332 | } |
333 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
333 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
334 | 334 | |
335 | 335 | /** |
336 | 336 | * Set default tools page tab. |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | * @param string $default_tab Default tab name. |
340 | 340 | * @return string |
341 | 341 | */ |
342 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
342 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
343 | 343 | return 'export'; |
344 | 344 | } |
345 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
345 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | /** |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | * @param string $default_tab Default tab name. |
353 | 353 | * @return string |
354 | 354 | */ |
355 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
355 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
356 | 356 | return 'earnings'; |
357 | 357 | } |
358 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
358 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
359 | 359 | |
360 | 360 | |
361 | 361 | /** |
@@ -368,19 +368,19 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return array |
370 | 370 | */ |
371 | -function give_add_display_page_states( $post_states, $post ) { |
|
371 | +function give_add_display_page_states($post_states, $post) { |
|
372 | 372 | |
373 | - switch ( $post->ID ) { |
|
374 | - case give_get_option( 'success_page' ): |
|
375 | - $post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' ); |
|
373 | + switch ($post->ID) { |
|
374 | + case give_get_option('success_page'): |
|
375 | + $post_states['give_successfully_page'] = __('Donation Success Page', 'give'); |
|
376 | 376 | break; |
377 | 377 | |
378 | - case give_get_option( 'failure_page' ): |
|
379 | - $post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' ); |
|
378 | + case give_get_option('failure_page'): |
|
379 | + $post_states['give_failure_page'] = __('Donation Failed Page', 'give'); |
|
380 | 380 | break; |
381 | 381 | |
382 | - case give_get_option( 'history_page' ): |
|
383 | - $post_states['give_history_page'] = __( 'Donation History Page', 'give' ); |
|
382 | + case give_get_option('history_page'): |
|
383 | + $post_states['give_history_page'] = __('Donation History Page', 'give'); |
|
384 | 384 | break; |
385 | 385 | } |
386 | 386 | |
@@ -388,4 +388,4 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | // Add a post display state for special Give pages. |
391 | -add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 ); |
|
391 | +add_filter('display_post_states', 'give_add_display_page_states', 10, 2); |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | global $status, $page; |
54 | 54 | |
55 | 55 | // Set parent defaults |
56 | - parent::__construct( array( |
|
57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records |
|
58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records |
|
56 | + parent::__construct(array( |
|
57 | + 'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records |
|
58 | + 'plural' => esc_html__('API Keys', 'give'), // Plural name of the listed records |
|
59 | 59 | 'ajax' => false, // Does this table support ajax? |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | $this->query(); |
63 | 63 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Column Name |
75 | 75 | */ |
76 | - public function column_default( $item, $column_name ) { |
|
77 | - return $item[ $column_name ]; |
|
76 | + public function column_default($item, $column_name) { |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string Column Name |
89 | 89 | */ |
90 | - public function column_key( $item ) { |
|
91 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
90 | + public function column_key($item) { |
|
91 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string Column Name |
103 | 103 | */ |
104 | - public function column_token( $item ) { |
|
105 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
104 | + public function column_token($item) { |
|
105 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( |
|
136 | + esc_url(add_query_arg(array( |
|
137 | 137 | 'section' => 'api_requests', |
138 | 138 | 'post_type' => 'give_forms', |
139 | 139 | 'page' => 'give-tools', |
140 | 140 | 'tab' => 'logs', |
141 | 141 | 's' => $item['email'], |
142 | - ), 'edit.php' ) ), |
|
143 | - esc_html__( 'View API Log', 'give' ) |
|
142 | + ), 'edit.php')), |
|
143 | + esc_html__('View API Log', 'give') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | 147 | $actions['reissue'] = sprintf( |
148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
150 | 150 | 'user_id' => $item['id'], |
151 | 151 | 'give_action' => 'process_api_key', |
152 | 152 | 'give_api_process' => 'regenerate', |
153 | - ) ), 'give-api-nonce' ) ), |
|
154 | - esc_html__( 'Reissue', 'give' ) |
|
153 | + )), 'give-api-nonce')), |
|
154 | + esc_html__('Reissue', 'give') |
|
155 | 155 | ); |
156 | - $actions['revoke'] = sprintf( |
|
156 | + $actions['revoke'] = sprintf( |
|
157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
159 | 159 | 'user_id' => $item['id'], |
160 | 160 | 'give_action' => 'process_api_key', |
161 | 161 | 'give_api_process' => 'revoke', |
162 | - ) ), 'give-api-nonce' ) ), |
|
163 | - esc_html__( 'Revoke', 'give' ) |
|
162 | + )), 'give-api-nonce')), |
|
163 | + esc_html__('Revoke', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
167 | 167 | |
168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | - 'user' => esc_html__( 'Username', 'give' ), |
|
193 | - 'key' => esc_html__( 'Public Key', 'give' ), |
|
194 | - 'token' => esc_html__( 'Token', 'give' ), |
|
195 | - 'secret' => esc_html__( 'Secret Key', 'give' ), |
|
192 | + 'user' => esc_html__('Username', 'give'), |
|
193 | + 'key' => esc_html__('Public Key', 'give'), |
|
194 | + 'token' => esc_html__('Token', 'give'), |
|
195 | + 'secret' => esc_html__('Secret Key', 'give'), |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | return $columns; |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param string $which |
208 | 208 | */ |
209 | - protected function display_tablenav( $which ) { |
|
210 | - if ( 'top' === $which ) { |
|
211 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
209 | + protected function display_tablenav($which) { |
|
210 | + if ('top' === $which) { |
|
211 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
212 | 212 | } |
213 | 213 | ?> |
214 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
214 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
215 | 215 | |
216 | 216 | <div class="alignleft actions bulkactions"> |
217 | - <?php $this->bulk_actions( $which ); ?> |
|
217 | + <?php $this->bulk_actions($which); ?> |
|
218 | 218 | </div> |
219 | 219 | |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -237,18 +237,18 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - function bulk_actions( $which = '' ) { |
|
240 | + function bulk_actions($which = '') { |
|
241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place. |
242 | 242 | static $give_api_is_bottom; |
243 | 243 | |
244 | - if ( $give_api_is_bottom ) { |
|
244 | + if ($give_api_is_bottom) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | ?> |
248 | 248 | <input type="hidden" name="give_action" value="process_api_key"/> |
249 | 249 | <input type="hidden" name="give_api_process" value="generate"/> |
250 | 250 | <?php |
251 | - wp_nonce_field( 'give-api-nonce' ); |
|
251 | + wp_nonce_field('give-api-nonce'); |
|
252 | 252 | /** |
253 | 253 | * API Key user search. |
254 | 254 | */ |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | 'name' => 'user_id', |
258 | 258 | ); |
259 | 259 | |
260 | - echo Give()->html->ajax_user_search( $args ); |
|
260 | + echo Give()->html->ajax_user_search($args); |
|
261 | 261 | |
262 | - submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); |
|
262 | + submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); |
|
263 | 263 | |
264 | 264 | $give_api_is_bottom = true; |
265 | 265 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return int Current page number |
273 | 273 | */ |
274 | 274 | public function get_paged() { |
275 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
275 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -283,21 +283,21 @@ discard block |
||
283 | 283 | * @return array |
284 | 284 | */ |
285 | 285 | public function query() { |
286 | - $users = get_users( array( |
|
286 | + $users = get_users(array( |
|
287 | 287 | 'meta_value' => 'give_user_secret_key', |
288 | 288 | 'number' => $this->per_page, |
289 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), |
|
290 | - ) ); |
|
291 | - $keys = array(); |
|
292 | - |
|
293 | - foreach ( $users as $user ) { |
|
294 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
295 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
296 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
297 | - |
|
298 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
299 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
300 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
289 | + 'offset' => $this->per_page * ($this->get_paged() - 1), |
|
290 | + )); |
|
291 | + $keys = array(); |
|
292 | + |
|
293 | + foreach ($users as $user) { |
|
294 | + $keys[$user->ID]['id'] = $user->ID; |
|
295 | + $keys[$user->ID]['email'] = $user->user_email; |
|
296 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
297 | + |
|
298 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
299 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
300 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | return $keys; |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | public function total_items() { |
315 | 315 | global $wpdb; |
316 | 316 | |
317 | - $total_items = Give_Cache::get( 'give_total_api_keys', true ); |
|
317 | + $total_items = Give_Cache::get('give_total_api_keys', true); |
|
318 | 318 | |
319 | - if ( ! $total_items ) { |
|
319 | + if ( ! $total_items) { |
|
320 | 320 | $total_items = $wpdb->get_var( |
321 | 321 | $wpdb->prepare( |
322 | 322 | "SELECT count(user_id) |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | |
328 | - Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true ); |
|
328 | + Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $total_items; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $hidden = array(); // No hidden columns |
345 | 345 | $sortable = array(); // Not sortable... for now |
346 | 346 | |
347 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
347 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
348 | 348 | |
349 | 349 | $data = $this->query(); |
350 | 350 | |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | |
353 | 353 | $this->items = $data; |
354 | 354 | |
355 | - $this->set_pagination_args( array( |
|
355 | + $this->set_pagination_args(array( |
|
356 | 356 | 'total_items' => $total_items, |
357 | 357 | 'per_page' => $this->per_page, |
358 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
359 | - ) ); |
|
358 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
359 | + )); |
|
360 | 360 | } |
361 | 361 | } |
@@ -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 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h1><?php echo esc_html( get_admin_page_title() ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h1><?php echo esc_html(get_admin_page_title()); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | 33 | <hr class="wp-header-end"> |
34 | 34 | |
35 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
35 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
36 | 36 | <?php give_add_ons_feed(); ?> |
37 | 37 | </div> |
38 | 38 | <?php |
@@ -49,27 +49,27 @@ discard block |
||
49 | 49 | function give_add_ons_feed() { |
50 | 50 | |
51 | 51 | $addons_debug = false; //set to true to debug |
52 | - $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
|
52 | + $cache = Give_Cache::get('give_add_ons_feed', true); |
|
53 | 53 | |
54 | - if ( false === $cache || ( true === $addons_debug && true === WP_DEBUG ) ) { |
|
55 | - if ( function_exists( 'vip_safe_wp_remote_get' ) ) { |
|
56 | - $feed = vip_safe_wp_remote_get( 'https://givewp.com/downloads/feed/', false, 3, 1, 20, array( 'sslverify' => false ) ); |
|
54 | + if (false === $cache || (true === $addons_debug && true === WP_DEBUG)) { |
|
55 | + if (function_exists('vip_safe_wp_remote_get')) { |
|
56 | + $feed = vip_safe_wp_remote_get('https://givewp.com/downloads/feed/', false, 3, 1, 20, array('sslverify' => false)); |
|
57 | 57 | } else { |
58 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
58 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
59 | 59 | } |
60 | 60 | |
61 | - if ( ! is_wp_error( $feed ) && ! empty( $feed ) ) { |
|
62 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
63 | - $cache = wp_remote_retrieve_body( $feed ); |
|
64 | - Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
|
61 | + if ( ! is_wp_error($feed) && ! empty($feed)) { |
|
62 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
63 | + $cache = wp_remote_retrieve_body($feed); |
|
64 | + Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true); |
|
65 | 65 | } |
66 | 66 | } else { |
67 | 67 | $cache = sprintf( |
68 | 68 | '<div class="error"><p>%s</p></div>', |
69 | - esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
|
69 | + esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give') |
|
70 | 70 | ); |
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | - echo wp_kses_post( $cache ); |
|
74 | + echo wp_kses_post($cache); |
|
75 | 75 | } |