@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return static |
47 | 47 | */ |
48 | 48 | static function get_instance() { |
49 | - if ( null === static::$instance ) { |
|
49 | + if (null === static::$instance) { |
|
50 | 50 | self::$instance = new static(); |
51 | 51 | } |
52 | 52 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - public static function has_preview( Give_Email_Notification $email ) { |
|
67 | + public static function has_preview(Give_Email_Notification $email) { |
|
68 | 68 | return $email->config['has_preview']; |
69 | 69 | } |
70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return bool |
80 | 80 | */ |
81 | - public static function has_recipient_field( Give_Email_Notification $email ) { |
|
81 | + public static function has_recipient_field(Give_Email_Notification $email) { |
|
82 | 82 | return $email->config['has_recipient_field']; |
83 | 83 | } |
84 | 84 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public static function is_notification_status_editable( Give_Email_Notification $email ) { |
|
95 | + public static function is_notification_status_editable(Give_Email_Notification $email) { |
|
96 | 96 | $user_can_edit = $email->config['notification_status_editable']; |
97 | 97 | |
98 | 98 | return (bool) $user_can_edit; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public static function is_content_type_editable( Give_Email_Notification $email ) { |
|
111 | + public static function is_content_type_editable(Give_Email_Notification $email) { |
|
112 | 112 | return $email->config['content_type_editable']; |
113 | 113 | } |
114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return bool |
124 | 124 | */ |
125 | - public static function is_email_preview_has_header( Give_Email_Notification $email ) { |
|
125 | + public static function is_email_preview_has_header(Give_Email_Notification $email) { |
|
126 | 126 | return $email->config['has_preview_header']; |
127 | 127 | } |
128 | 128 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return bool |
138 | 138 | */ |
139 | - public static function is_email_preview( Give_Email_Notification $email ) { |
|
139 | + public static function is_email_preview(Give_Email_Notification $email) { |
|
140 | 140 | return $email->config['has_preview']; |
141 | 141 | } |
142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | - public static function is_show_on_emails_setting_page( Give_Email_Notification $email ){ |
|
153 | + public static function is_show_on_emails_setting_page(Give_Email_Notification $email) { |
|
154 | 154 | return $email->config['show_on_emails_setting_page']; |
155 | 155 | } |
156 | 156 | |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return bool |
167 | 167 | */ |
168 | - public static function can_use_form_email_options( Give_Email_Notification $email, $form_id = null ){ |
|
169 | - return give_is_setting_enabled( give_get_meta( $form_id, '_give_email_options', true ) ); |
|
168 | + public static function can_use_form_email_options(Give_Email_Notification $email, $form_id = null) { |
|
169 | + return give_is_setting_enabled(give_get_meta($form_id, '_give_email_options', true)); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public static function is_email_notification_active( Give_Email_Notification $email, $form_id = null ) { |
|
184 | - $notification_status = $email->get_notification_status( $form_id ); |
|
183 | + public static function is_email_notification_active(Give_Email_Notification $email, $form_id = null) { |
|
184 | + $notification_status = $email->get_notification_status($form_id); |
|
185 | 185 | |
186 | 186 | |
187 | - $notification_status = empty( $form_id ) |
|
188 | - ? give_is_setting_enabled( $notification_status ) |
|
189 | - : give_is_setting_enabled( give_get_option( "{$email->config['id']}_notification", $email->config['notification_status'] ) ) && give_is_setting_enabled( $notification_status, array( 'enabled', 'global' ) ); |
|
187 | + $notification_status = empty($form_id) |
|
188 | + ? give_is_setting_enabled($notification_status) |
|
189 | + : give_is_setting_enabled(give_get_option("{$email->config['id']}_notification", $email->config['notification_status'])) && give_is_setting_enabled($notification_status, array('enabled', 'global')); |
|
190 | 190 | // To check if email notification is active or not on a per-form basis, email notification must be globally active—otherwise it will be considered disabled. |
191 | 191 | |
192 | 192 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param bool $notification_status True if notification is enable and false when disable |
202 | 202 | */ |
203 | - return apply_filters( "give_{$email->config['id']}_is_email_notification_active", $notification_status, $email, $form_id ); |
|
203 | + return apply_filters("give_{$email->config['id']}_is_email_notification_active", $notification_status, $email, $form_id); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | $is_preview = false; |
215 | 215 | |
216 | 216 | if ( |
217 | - current_user_can( 'manage_give_settings' ) |
|
218 | - && ! empty( $_GET['give_action'] ) |
|
217 | + current_user_can('manage_give_settings') |
|
218 | + && ! empty($_GET['give_action']) |
|
219 | 219 | && 'preview_email' === $_GET['give_action'] |
220 | 220 | ) { |
221 | 221 | $is_preview = true; |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | $is_preview = false; |
236 | 236 | |
237 | 237 | if ( |
238 | - current_user_can( 'manage_give_settings' ) |
|
239 | - && ! empty( $_GET['give_action'] ) |
|
238 | + current_user_can('manage_give_settings') |
|
239 | + && ! empty($_GET['give_action']) |
|
240 | 240 | && 'send_preview_email' === $_GET['give_action'] |
241 | 241 | ) { |
242 | 242 | $is_preview = true; |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return string |
258 | 258 | */ |
259 | - public static function get_formatted_email_type( $content_type ) { |
|
259 | + public static function get_formatted_email_type($content_type) { |
|
260 | 260 | $email_contents = array( |
261 | - 'text/html' => __( 'HTML', 'give' ), |
|
262 | - 'text/plain' => __( 'Plain', 'give' ), |
|
261 | + 'text/html' => __('HTML', 'give'), |
|
262 | + 'text/plain' => __('Plain', 'give'), |
|
263 | 263 | ); |
264 | 264 | |
265 | - return $email_contents[ $content_type ]; |
|
265 | + return $email_contents[$content_type]; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -279,40 +279,40 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return mixed |
281 | 281 | */ |
282 | - public static function get_value( Give_Email_Notification $email, $option_name, $form_id = null, $default = false ) { |
|
282 | + public static function get_value(Give_Email_Notification $email, $option_name, $form_id = null, $default = false) { |
|
283 | 283 | // If form id set then option name can be contain _give_ prefix which is only used for meta key, |
284 | 284 | // So make sure you are using correct option name. |
285 | - $global_option_name = ( 0 === strpos( $option_name, '_give_' ) |
|
286 | - ? str_replace( '_give_', '', $option_name ) |
|
287 | - : $option_name ); |
|
288 | - $option_value = give_get_option( $global_option_name, $default ); |
|
285 | + $global_option_name = (0 === strpos($option_name, '_give_') |
|
286 | + ? str_replace('_give_', '', $option_name) |
|
287 | + : $option_name); |
|
288 | + $option_value = give_get_option($global_option_name, $default); |
|
289 | 289 | |
290 | 290 | if ( |
291 | - ! empty( $form_id ) |
|
291 | + ! empty($form_id) |
|
292 | 292 | && give_is_setting_enabled( |
293 | 293 | give_get_meta( |
294 | 294 | $form_id, |
295 | - Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'notification', |
|
295 | + Give_Email_Setting_Field::get_prefix($email, $form_id).'notification', |
|
296 | 296 | true, |
297 | 297 | 'global' |
298 | 298 | ) |
299 | 299 | ) |
300 | 300 | ) { |
301 | - $option_value = get_post_meta( $form_id, $option_name, true ); |
|
301 | + $option_value = get_post_meta($form_id, $option_name, true); |
|
302 | 302 | |
303 | 303 | // Get only email field value from recipients setting. |
304 | - if( Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'recipient' === $option_name ) { |
|
305 | - $option_value = wp_list_pluck( $option_value, 'email' ); |
|
304 | + if (Give_Email_Setting_Field::get_prefix($email, $form_id).'recipient' === $option_name) { |
|
305 | + $option_value = wp_list_pluck($option_value, 'email'); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - $option_value = empty( $option_value ) ? $default : $option_value; |
|
309 | + $option_value = empty($option_value) ? $default : $option_value; |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Filter the setting value |
313 | 313 | * |
314 | 314 | * @since 2.0 |
315 | 315 | */ |
316 | - return apply_filters( 'give_email_setting_value', $option_value, $option_name, $email, $form_id, $default ); |
|
316 | + return apply_filters('give_email_setting_value', $option_value, $option_name, $email, $form_id, $default); |
|
317 | 317 | } |
318 | 318 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | default: |
83 | 83 | |
84 | 84 | if ( |
85 | - array_key_exists( 'callback', $field ) |
|
86 | - && ! empty( $field['callback'] ) |
|
85 | + array_key_exists('callback', $field) |
|
86 | + && ! empty($field['callback']) |
|
87 | 87 | ) { |
88 | 88 | $func_name = $field['callback']; |
89 | 89 | } else { |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @since 1.8 |
98 | 98 | */ |
99 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
99 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
100 | 100 | |
101 | 101 | // Exit if not any function exist. |
102 | 102 | // Check if render callback exist or not. |
103 | - if ( empty( $func_name ) ) { |
|
103 | + if (empty($func_name)) { |
|
104 | 104 | return false; |
105 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
105 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
106 | 106 | return false; |
107 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
107 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | |
@@ -120,35 +120,35 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | -function give_render_field( $field ) { |
|
123 | +function give_render_field($field) { |
|
124 | 124 | |
125 | 125 | // Check if render callback exist or not. |
126 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
126 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // CMB2 compatibility: Push all classes to attributes's class key |
131 | - if ( empty( $field['class'] ) ) { |
|
131 | + if (empty($field['class'])) { |
|
132 | 132 | $field['class'] = ''; |
133 | 133 | } |
134 | 134 | |
135 | - if ( empty( $field['attributes']['class'] ) ) { |
|
135 | + if (empty($field['attributes']['class'])) { |
|
136 | 136 | $field['attributes']['class'] = ''; |
137 | 137 | } |
138 | 138 | |
139 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
140 | - unset( $field['class'] ); |
|
139 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
140 | + unset($field['class']); |
|
141 | 141 | |
142 | 142 | // CMB2 compatibility: Set wrapper class if any. |
143 | - if ( ! empty( $field['row_classes'] ) ) { |
|
143 | + if ( ! empty($field['row_classes'])) { |
|
144 | 144 | $field['wrapper_class'] = $field['row_classes']; |
145 | - unset( $field['row_classes'] ); |
|
145 | + unset($field['row_classes']); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Set field params on basis of cmb2 field name. |
149 | - switch ( $field['type'] ) { |
|
149 | + switch ($field['type']) { |
|
150 | 150 | case 'radio_inline': |
151 | - if ( empty( $field['wrapper_class'] ) ) { |
|
151 | + if (empty($field['wrapper_class'])) { |
|
152 | 152 | $field['wrapper_class'] = ''; |
153 | 153 | } |
154 | 154 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | case 'text-small' : |
162 | 162 | case 'text_small' : |
163 | 163 | // CMB2 compatibility: Set field type to text. |
164 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
164 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
165 | 165 | |
166 | 166 | // CMB2 compatibility: Set data type to price. |
167 | 167 | if ( |
168 | - empty( $field['data_type'] ) |
|
169 | - && ! empty( $field['attributes']['class'] ) |
|
168 | + empty($field['data_type']) |
|
169 | + && ! empty($field['attributes']['class']) |
|
170 | 170 | && ( |
171 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
172 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
171 | + false !== strpos($field['attributes']['class'], 'money') |
|
172 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
173 | 173 | ) |
174 | 174 | ) { |
175 | 175 | $field['data_type'] = 'decimal'; |
@@ -188,26 +188,26 @@ discard block |
||
188 | 188 | case 'give_default_radio_inline': |
189 | 189 | $field['type'] = 'radio'; |
190 | 190 | $field['options'] = array( |
191 | - 'default' => __( 'Default' ), |
|
191 | + 'default' => __('Default'), |
|
192 | 192 | ); |
193 | 193 | break; |
194 | 194 | |
195 | 195 | case 'donation_limit': |
196 | - $field['type'] = 'donation_limit'; |
|
196 | + $field['type'] = 'donation_limit'; |
|
197 | 197 | break; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // CMB2 compatibility: Add support to define field description by desc & description param. |
201 | 201 | // We encourage you to use description param. |
202 | - $field['description'] = ( ! empty( $field['description'] ) |
|
202 | + $field['description'] = ( ! empty($field['description']) |
|
203 | 203 | ? $field['description'] |
204 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
204 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
205 | 205 | |
206 | 206 | // Call render function. |
207 | - if ( is_array( $func_name ) ) { |
|
208 | - $func_name[0]->{$func_name[1]}( $field ); |
|
207 | + if (is_array($func_name)) { |
|
208 | + $func_name[0]->{$func_name[1]}($field); |
|
209 | 209 | } else { |
210 | - $func_name( $field ); |
|
210 | + $func_name($field); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return true; |
@@ -237,29 +237,29 @@ discard block |
||
237 | 237 | * } |
238 | 238 | * @return void |
239 | 239 | */ |
240 | -function give_text_input( $field ) { |
|
240 | +function give_text_input($field) { |
|
241 | 241 | global $thepostid, $post; |
242 | 242 | |
243 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
244 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
245 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
246 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
247 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
243 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
244 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
245 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
246 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
247 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
248 | 248 | $field['before_field'] = ''; |
249 | 249 | $field['after_field'] = ''; |
250 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
250 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
251 | 251 | |
252 | - switch ( $data_type ) { |
|
252 | + switch ($data_type) { |
|
253 | 253 | case 'price' : |
254 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( give_maybe_sanitize_amount( $field['value'] ), array( 'sanitize' => false ) ) : $field['value'] ); |
|
254 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount(give_maybe_sanitize_amount($field['value']), array('sanitize' => false)) : $field['value']); |
|
255 | 255 | |
256 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
257 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
256 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
257 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
258 | 258 | break; |
259 | 259 | |
260 | 260 | case 'decimal' : |
261 | 261 | $field['attributes']['class'] .= ' give_input_decimal'; |
262 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
262 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
263 | 263 | break; |
264 | 264 | |
265 | 265 | default : |
@@ -267,20 +267,20 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | ?> |
270 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
271 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
270 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
271 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
272 | 272 | <?php echo $field['before_field']; ?> |
273 | 273 | <input |
274 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
275 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
276 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
277 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
278 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
279 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
274 | + type="<?php echo esc_attr($field['type']); ?>" |
|
275 | + style="<?php echo esc_attr($field['style']); ?>" |
|
276 | + name="<?php echo give_get_field_name($field); ?>" |
|
277 | + id="<?php echo esc_attr($field['id']); ?>" |
|
278 | + value="<?php echo esc_attr($field['value']); ?>" |
|
279 | + <?php echo give_get_custom_attributes($field); ?> |
|
280 | 280 | /> |
281 | 281 | <?php echo $field['after_field']; ?> |
282 | 282 | <?php |
283 | - echo give_get_field_description( $field ); |
|
283 | + echo give_get_field_description($field); |
|
284 | 284 | echo '</p>'; |
285 | 285 | } |
286 | 286 | |
@@ -310,27 +310,27 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @return void |
312 | 312 | */ |
313 | -function give_donation_limit( $field ) { |
|
313 | +function give_donation_limit($field) { |
|
314 | 314 | global $thepostid, $post; |
315 | 315 | |
316 | 316 | // Get Give donation form ID. |
317 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
317 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
318 | 318 | |
319 | 319 | // Default arguments. |
320 | 320 | $default_options = array( |
321 | 321 | 'style' => '', |
322 | 322 | 'wrapper_class' => '', |
323 | - 'value' => give_get_field_value( $field, $thepostid ), |
|
323 | + 'value' => give_get_field_value($field, $thepostid), |
|
324 | 324 | 'data_type' => 'decimal', |
325 | 325 | 'before_field' => '', |
326 | 326 | 'after_field' => '', |
327 | 327 | ); |
328 | 328 | |
329 | 329 | // Field options. |
330 | - $field['options'] = ! empty( $field['options'] ) ? $field['options'] : array(); |
|
330 | + $field['options'] = ! empty($field['options']) ? $field['options'] : array(); |
|
331 | 331 | |
332 | 332 | // Default field option arguments. |
333 | - $field['options'] = wp_parse_args( $field['options'], array( |
|
333 | + $field['options'] = wp_parse_args($field['options'], array( |
|
334 | 334 | 'display_label' => '', |
335 | 335 | 'minimum' => 1.00, |
336 | 336 | 'maximum' => 999999.99, |
@@ -338,78 +338,78 @@ discard block |
||
338 | 338 | ); |
339 | 339 | |
340 | 340 | // Set default field options. |
341 | - $field_options = wp_parse_args( $field, $default_options ); |
|
341 | + $field_options = wp_parse_args($field, $default_options); |
|
342 | 342 | |
343 | 343 | // Get default minimum value, if empty. |
344 | - $field_options['value']['minimum'] = ! empty( $field_options['value']['minimum'] ) |
|
344 | + $field_options['value']['minimum'] = ! empty($field_options['value']['minimum']) |
|
345 | 345 | ? $field_options['value']['minimum'] |
346 | 346 | : $field_options['options']['minimum']; |
347 | 347 | |
348 | 348 | // Get default maximum value, if empty. |
349 | - $field_options['value']['maximum'] = ! empty( $field_options['value']['maximum'] ) |
|
349 | + $field_options['value']['maximum'] = ! empty($field_options['value']['maximum']) |
|
350 | 350 | ? $field_options['value']['maximum'] |
351 | 351 | : $field_options['options']['maximum']; |
352 | 352 | ?> |
353 | - <p class="give-field-wrap <?php echo esc_attr( $field_options['id'] ); ?>_field <?php echo esc_attr( $field_options['wrapper_class'] ); ?>"> |
|
354 | - <label for="<?php echo give_get_field_name( $field_options ); ?>"><?php echo wp_kses_post( $field_options['name'] ); ?></label> |
|
353 | + <p class="give-field-wrap <?php echo esc_attr($field_options['id']); ?>_field <?php echo esc_attr($field_options['wrapper_class']); ?>"> |
|
354 | + <label for="<?php echo give_get_field_name($field_options); ?>"><?php echo wp_kses_post($field_options['name']); ?></label> |
|
355 | 355 | <span class="give_donation_limit_display"> |
356 | 356 | <?php |
357 | - foreach ( $field_options['value'] as $amount_range => $amount_value ) { |
|
357 | + foreach ($field_options['value'] as $amount_range => $amount_value) { |
|
358 | 358 | |
359 | - switch ( $field_options['data_type'] ) { |
|
359 | + switch ($field_options['data_type']) { |
|
360 | 360 | case 'price' : |
361 | - $currency_position = give_get_option( 'currency_position', 'before' ); |
|
362 | - $price_field_labels = 'minimum' === $amount_range ? __( 'Minimum amount', 'give' ) : __( 'Maximum amount', 'give' ); |
|
361 | + $currency_position = give_get_option('currency_position', 'before'); |
|
362 | + $price_field_labels = 'minimum' === $amount_range ? __('Minimum amount', 'give') : __('Maximum amount', 'give'); |
|
363 | 363 | |
364 | 364 | $tooltip_html = array( |
365 | - 'before' => Give()->tooltips->render_span( array( |
|
365 | + 'before' => Give()->tooltips->render_span(array( |
|
366 | 366 | 'label' => $price_field_labels, |
367 | - 'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol() ), |
|
368 | - ) ), |
|
369 | - 'after' => Give()->tooltips->render_span( array( |
|
367 | + 'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol()), |
|
368 | + )), |
|
369 | + 'after' => Give()->tooltips->render_span(array( |
|
370 | 370 | 'label' => $price_field_labels, |
371 | - 'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol() ), |
|
372 | - ) ), |
|
371 | + 'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol()), |
|
372 | + )), |
|
373 | 373 | ); |
374 | 374 | |
375 | - $before_html = ! empty( $field_options['before_field'] ) |
|
375 | + $before_html = ! empty($field_options['before_field']) |
|
376 | 376 | ? $field_options['before_field'] |
377 | - : ( 'before' === $currency_position ? $tooltip_html['before'] : '' ); |
|
377 | + : ('before' === $currency_position ? $tooltip_html['before'] : ''); |
|
378 | 378 | |
379 | - $after_html = ! empty( $field_options['after_field'] ) |
|
379 | + $after_html = ! empty($field_options['after_field']) |
|
380 | 380 | ? $field_options['after_field'] |
381 | - : ( 'after' === $currency_position ? $tooltip_html['after'] : '' ); |
|
381 | + : ('after' === $currency_position ? $tooltip_html['after'] : ''); |
|
382 | 382 | |
383 | - $field_options['attributes']['class'] .= ' give-text_small'; |
|
384 | - $field_options['value'][ $amount_range ] = give_maybe_sanitize_amount( $amount_value ); |
|
383 | + $field_options['attributes']['class'] .= ' give-text_small'; |
|
384 | + $field_options['value'][$amount_range] = give_maybe_sanitize_amount($amount_value); |
|
385 | 385 | break; |
386 | 386 | case 'decimal' : |
387 | - $field_options['attributes']['class'] .= ' give_input_decimal give-text_small'; |
|
388 | - $field_options['value'][ $amount_range ] = $amount_value; |
|
387 | + $field_options['attributes']['class'] .= ' give_input_decimal give-text_small'; |
|
388 | + $field_options['value'][$amount_range] = $amount_value; |
|
389 | 389 | break; |
390 | 390 | } |
391 | 391 | |
392 | 392 | echo '<span class=give-minmax-wrap>'; |
393 | - printf( '<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr( $field_options['id'] ), esc_attr( $amount_range ), esc_html( $price_field_labels ) ); |
|
393 | + printf('<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr($field_options['id']), esc_attr($amount_range), esc_html($price_field_labels)); |
|
394 | 394 | |
395 | - echo isset( $before_html ) ? $before_html : ''; |
|
395 | + echo isset($before_html) ? $before_html : ''; |
|
396 | 396 | ?> |
397 | 397 | <input |
398 | - name="<?php echo give_get_field_name( $field_options ); ?>[<?php echo esc_attr( $amount_range ); ?>]" |
|
398 | + name="<?php echo give_get_field_name($field_options); ?>[<?php echo esc_attr($amount_range); ?>]" |
|
399 | 399 | type="text" |
400 | 400 | id="<?php echo $field_options['id']; ?>_give_donation_limit_<?php echo $amount_range; ?>" |
401 | - data-range_type="<?php echo esc_attr( $amount_range ); ?>" |
|
402 | - value="<?php echo give_format_decimal( esc_attr( $field_options['value'][ $amount_range ] ) ); ?>" |
|
403 | - placeholder="<?php echo give_format_decimal( $field_options['options'][ $amount_range ] ); ?>" |
|
404 | - <?php echo give_get_custom_attributes( $field_options ); ?> |
|
401 | + data-range_type="<?php echo esc_attr($amount_range); ?>" |
|
402 | + value="<?php echo give_format_decimal(esc_attr($field_options['value'][$amount_range])); ?>" |
|
403 | + placeholder="<?php echo give_format_decimal($field_options['options'][$amount_range]); ?>" |
|
404 | + <?php echo give_get_custom_attributes($field_options); ?> |
|
405 | 405 | /> |
406 | 406 | <?php |
407 | - echo isset( $after_html ) ? $after_html : ''; |
|
407 | + echo isset($after_html) ? $after_html : ''; |
|
408 | 408 | echo '</span>'; |
409 | 409 | } |
410 | 410 | ?> |
411 | 411 | </span> |
412 | - <?php echo give_get_field_description( $field_options ); ?> |
|
412 | + <?php echo give_get_field_description($field_options); ?> |
|
413 | 413 | </p> |
414 | 414 | <?php |
415 | 415 | } |
@@ -432,29 +432,29 @@ discard block |
||
432 | 432 | * } |
433 | 433 | * @return void |
434 | 434 | */ |
435 | -function give_hidden_input( $field ) { |
|
435 | +function give_hidden_input($field) { |
|
436 | 436 | global $thepostid, $post; |
437 | 437 | |
438 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
439 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
438 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
439 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
440 | 440 | |
441 | 441 | // Custom attribute handling |
442 | 442 | $custom_attributes = array(); |
443 | 443 | |
444 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
444 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
445 | 445 | |
446 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
447 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
446 | + foreach ($field['attributes'] as $attribute => $value) { |
|
447 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | ?> |
451 | 451 | |
452 | 452 | <input |
453 | 453 | type="hidden" |
454 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
455 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
456 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
457 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
454 | + name="<?php echo give_get_field_name($field); ?>" |
|
455 | + id="<?php echo esc_attr($field['id']); ?>" |
|
456 | + value="<?php echo esc_attr($field['value']); ?>" |
|
457 | + <?php echo give_get_custom_attributes($field); ?> |
|
458 | 458 | /> |
459 | 459 | <?php |
460 | 460 | } |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | * } |
481 | 481 | * @return void |
482 | 482 | */ |
483 | -function give_textarea_input( $field ) { |
|
483 | +function give_textarea_input($field) { |
|
484 | 484 | global $thepostid, $post; |
485 | 485 | |
486 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
487 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
488 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
489 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
486 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
487 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
488 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
489 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
490 | 490 | |
491 | 491 | ?> |
492 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
493 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
492 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
493 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
494 | 494 | <textarea |
495 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
496 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
497 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
495 | + style="<?php echo esc_attr($field['style']); ?>" |
|
496 | + name="<?php echo give_get_field_name($field); ?>" |
|
497 | + id="<?php echo esc_attr($field['id']); ?>" |
|
498 | 498 | rows="10" |
499 | 499 | cols="20" |
500 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
501 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
500 | + <?php echo give_get_custom_attributes($field); ?> |
|
501 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
502 | 502 | <?php |
503 | - echo give_get_field_description( $field ); |
|
503 | + echo give_get_field_description($field); |
|
504 | 504 | echo '</p>'; |
505 | 505 | } |
506 | 506 | |
@@ -524,29 +524,29 @@ discard block |
||
524 | 524 | * } |
525 | 525 | * @return void |
526 | 526 | */ |
527 | -function give_wysiwyg( $field ) { |
|
527 | +function give_wysiwyg($field) { |
|
528 | 528 | global $thepostid, $post; |
529 | 529 | |
530 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
531 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
532 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
533 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
530 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
531 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
532 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
533 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
534 | 534 | |
535 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
535 | + $field['unique_field_id'] = give_get_field_name($field); |
|
536 | 536 | $editor_attributes = array( |
537 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
537 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
538 | 538 | 'textarea_rows' => '10', |
539 | - 'editor_css' => esc_attr( $field['style'] ), |
|
539 | + 'editor_css' => esc_attr($field['style']), |
|
540 | 540 | 'editor_class' => $field['attributes']['class'], |
541 | 541 | ); |
542 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
542 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
543 | 543 | $field['value'], |
544 | 544 | $field['unique_field_id'], |
545 | 545 | $editor_attributes, |
546 | - ) ) ) . '"'; |
|
547 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
546 | + ))).'"'; |
|
547 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
548 | 548 | |
549 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
549 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
550 | 550 | |
551 | 551 | wp_editor( |
552 | 552 | $field['value'], |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $editor_attributes |
555 | 555 | ); |
556 | 556 | |
557 | - echo give_get_field_description( $field ); |
|
557 | + echo give_get_field_description($field); |
|
558 | 558 | echo '</div>'; |
559 | 559 | } |
560 | 560 | |
@@ -579,29 +579,29 @@ discard block |
||
579 | 579 | * } |
580 | 580 | * @return void |
581 | 581 | */ |
582 | -function give_checkbox( $field ) { |
|
582 | +function give_checkbox($field) { |
|
583 | 583 | global $thepostid, $post; |
584 | 584 | |
585 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
586 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
587 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
588 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
589 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
590 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
585 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
586 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
587 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
588 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
589 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
590 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
591 | 591 | ?> |
592 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
593 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
592 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
593 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
594 | 594 | <input |
595 | 595 | type="checkbox" |
596 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
597 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
598 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
599 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
600 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
601 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
596 | + style="<?php echo esc_attr($field['style']); ?>" |
|
597 | + name="<?php echo give_get_field_name($field); ?>" |
|
598 | + id="<?php echo esc_attr($field['id']); ?>" |
|
599 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
600 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
601 | + <?php echo give_get_custom_attributes($field); ?> |
|
602 | 602 | /> |
603 | 603 | <?php |
604 | - echo give_get_field_description( $field ); |
|
604 | + echo give_get_field_description($field); |
|
605 | 605 | echo '</p>'; |
606 | 606 | } |
607 | 607 | |
@@ -627,29 +627,29 @@ discard block |
||
627 | 627 | * } |
628 | 628 | * @return void |
629 | 629 | */ |
630 | -function give_select( $field ) { |
|
630 | +function give_select($field) { |
|
631 | 631 | global $thepostid, $post; |
632 | 632 | |
633 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
634 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
635 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
636 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
637 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
633 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
634 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
635 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
636 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
637 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
638 | 638 | ?> |
639 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
640 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
639 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
640 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
641 | 641 | <select |
642 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
643 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
644 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
645 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
642 | + id="<?php echo esc_attr($field['id']); ?>" |
|
643 | + name="<?php echo give_get_field_name($field); ?>" |
|
644 | + style="<?php echo esc_attr($field['style']) ?>" |
|
645 | + <?php echo give_get_custom_attributes($field); ?> |
|
646 | 646 | > |
647 | 647 | <?php |
648 | - foreach ( $field['options'] as $key => $value ) { |
|
649 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
648 | + foreach ($field['options'] as $key => $value) { |
|
649 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
650 | 650 | } |
651 | 651 | echo '</select>'; |
652 | - echo give_get_field_description( $field ); |
|
652 | + echo give_get_field_description($field); |
|
653 | 653 | echo '</p>'; |
654 | 654 | } |
655 | 655 | |
@@ -676,32 +676,32 @@ discard block |
||
676 | 676 | * } |
677 | 677 | * @return void |
678 | 678 | */ |
679 | -function give_radio( $field ) { |
|
679 | +function give_radio($field) { |
|
680 | 680 | global $thepostid, $post; |
681 | 681 | |
682 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
683 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
684 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
685 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
686 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
682 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
683 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
684 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
685 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
686 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
687 | 687 | |
688 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
688 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
689 | 689 | |
690 | - foreach ( $field['options'] as $key => $value ) { |
|
690 | + foreach ($field['options'] as $key => $value) { |
|
691 | 691 | |
692 | 692 | echo '<li><label><input |
693 | - name="' . give_get_field_name( $field ) . '" |
|
694 | - value="' . esc_attr( $key ) . '" |
|
693 | + name="' . give_get_field_name($field).'" |
|
694 | + value="' . esc_attr($key).'" |
|
695 | 695 | type="radio" |
696 | - style="' . esc_attr( $field['style'] ) . '" |
|
697 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
698 | - . give_get_custom_attributes( $field ) . ' |
|
699 | - /> ' . esc_html( $value ) . '</label> |
|
696 | + style="' . esc_attr($field['style']).'" |
|
697 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
698 | + . give_get_custom_attributes($field).' |
|
699 | + /> ' . esc_html($value).'</label> |
|
700 | 700 | </li>'; |
701 | 701 | } |
702 | 702 | echo '</ul>'; |
703 | 703 | |
704 | - echo give_get_field_description( $field ); |
|
704 | + echo give_get_field_description($field); |
|
705 | 705 | echo '</fieldset>'; |
706 | 706 | } |
707 | 707 | |
@@ -725,27 +725,27 @@ discard block |
||
725 | 725 | * } |
726 | 726 | * @return void |
727 | 727 | */ |
728 | -function give_colorpicker( $field ) { |
|
728 | +function give_colorpicker($field) { |
|
729 | 729 | global $thepostid, $post; |
730 | 730 | |
731 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
732 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
733 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
734 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
735 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
731 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
732 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
733 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
734 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
735 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
736 | 736 | $field['type'] = 'text'; |
737 | 737 | ?> |
738 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
739 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
738 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
739 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
740 | 740 | <input |
741 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
742 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
743 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
744 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
745 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
741 | + type="<?php echo esc_attr($field['type']); ?>" |
|
742 | + style="<?php echo esc_attr($field['style']); ?>" |
|
743 | + name="<?php echo give_get_field_name($field); ?>" |
|
744 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
745 | + <?php echo give_get_custom_attributes($field); ?> |
|
746 | 746 | /> |
747 | 747 | <?php |
748 | - echo give_get_field_description( $field ); |
|
748 | + echo give_get_field_description($field); |
|
749 | 749 | echo '</p>'; |
750 | 750 | } |
751 | 751 | |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @param array $field |
758 | 758 | */ |
759 | -function give_file( $field ) { |
|
760 | - give_media( $field ); |
|
759 | +function give_file($field) { |
|
760 | + give_media($field); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | |
@@ -768,37 +768,37 @@ discard block |
||
768 | 768 | * |
769 | 769 | * @param array $field |
770 | 770 | */ |
771 | -function give_media( $field ) { |
|
771 | +function give_media($field) { |
|
772 | 772 | global $thepostid, $post; |
773 | 773 | |
774 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
775 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $field['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
774 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
775 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $field['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
776 | 776 | |
777 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
778 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
779 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
780 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
777 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
778 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
779 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
780 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
781 | 781 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
782 | 782 | |
783 | 783 | // Allow developer to save attachment ID or attachment url as metadata. |
784 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
784 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
785 | 785 | |
786 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
787 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#'; |
|
788 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
789 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
786 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
787 | + $preview_image_src = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; |
|
788 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
789 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
790 | 790 | ?> |
791 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
792 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
791 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
792 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
793 | 793 | <input |
794 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
795 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
794 | + name="<?php echo give_get_field_name($field); ?>" |
|
795 | + id="<?php echo esc_attr($field['id']); ?>" |
|
796 | 796 | type="text" |
797 | 797 | value="<?php echo $field['value']; ?>" |
798 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
799 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
798 | + style="<?php echo esc_attr($field['style']); ?>" |
|
799 | + <?php echo give_get_custom_attributes($field); ?> |
|
800 | 800 | /> <input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>"> |
801 | - <?php echo give_get_field_description( $field ); ?> |
|
801 | + <?php echo give_get_field_description($field); ?> |
|
802 | 802 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
803 | 803 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
804 | 804 | <img src="<?php echo $preview_image_src; ?>" alt=""> |
@@ -816,27 +816,27 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @return void |
818 | 818 | */ |
819 | -function give_default_gateway( $field ) { |
|
819 | +function give_default_gateway($field) { |
|
820 | 820 | global $thepostid, $post; |
821 | 821 | |
822 | 822 | // get all active payment gateways. |
823 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
823 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
824 | 824 | $field['options'] = array(); |
825 | 825 | |
826 | 826 | // Set field option value. |
827 | - if ( ! empty( $gateways ) ) { |
|
828 | - foreach ( $gateways as $key => $option ) { |
|
829 | - $field['options'][ $key ] = $option['admin_label']; |
|
827 | + if ( ! empty($gateways)) { |
|
828 | + foreach ($gateways as $key => $option) { |
|
829 | + $field['options'][$key] = $option['admin_label']; |
|
830 | 830 | } |
831 | 831 | } |
832 | 832 | |
833 | 833 | // Add a field to the Give Form admin single post view of this field |
834 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
835 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
834 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
835 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | // Render select field. |
839 | - give_select( $field ); |
|
839 | + give_select($field); |
|
840 | 840 | } |
841 | 841 | |
842 | 842 | /** |
@@ -858,13 +858,13 @@ discard block |
||
858 | 858 | * @return void |
859 | 859 | */ |
860 | 860 | |
861 | -function give_docs_link( $field ) { |
|
862 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
863 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
861 | +function give_docs_link($field) { |
|
862 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
863 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
864 | 864 | |
865 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
865 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
866 | 866 | . '" target="_blank">' |
867 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
867 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
868 | 868 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
869 | 869 | } |
870 | 870 | |
@@ -876,15 +876,15 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @param $field |
878 | 878 | */ |
879 | -function give_email_preview_buttons( $field ) { |
|
879 | +function give_email_preview_buttons($field) { |
|
880 | 880 | /* @var WP_Post $post */ |
881 | 881 | global $post; |
882 | 882 | |
883 | - $field_id = str_replace( array( '_give_', '_preview_buttons' ), '', $field['id'] ); |
|
883 | + $field_id = str_replace(array('_give_', '_preview_buttons'), '', $field['id']); |
|
884 | 884 | |
885 | 885 | ob_start(); |
886 | 886 | |
887 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
887 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'; |
|
888 | 888 | |
889 | 889 | echo sprintf( |
890 | 890 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
@@ -912,12 +912,12 @@ discard block |
||
912 | 912 | 'form_id' => $post->ID, |
913 | 913 | ) |
914 | 914 | ), 'give-send-preview-email' ), |
915 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
916 | - esc_html__( 'Send Test Email', 'give' ) |
|
915 | + esc_attr__('Send Test Email.', 'give'), |
|
916 | + esc_html__('Send Test Email', 'give') |
|
917 | 917 | ); |
918 | 918 | |
919 | - if ( ! empty( $field['description'] ) ) { |
|
920 | - echo '<span class="give-field-description">' . wp_kses_post( $field['desc'] ) . '</span>'; |
|
919 | + if ( ! empty($field['description'])) { |
|
920 | + echo '<span class="give-field-description">'.wp_kses_post($field['desc']).'</span>'; |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | echo '</p>'; |
@@ -938,29 +938,29 @@ discard block |
||
938 | 938 | * |
939 | 939 | * @return mixed |
940 | 940 | */ |
941 | -function give_get_field_value( $field, $postid ) { |
|
942 | - if ( isset( $field['attributes']['value'] ) ) { |
|
941 | +function give_get_field_value($field, $postid) { |
|
942 | + if (isset($field['attributes']['value'])) { |
|
943 | 943 | return $field['attributes']['value']; |
944 | 944 | } |
945 | 945 | |
946 | 946 | // If field is range slider. |
947 | - if ( 'donation_limit' === $field['type'] ) { |
|
947 | + if ('donation_limit' === $field['type']) { |
|
948 | 948 | |
949 | 949 | // Get minimum value. |
950 | - $minimum = give_get_meta( $postid, $field['id'] . '_minimum', true ); |
|
950 | + $minimum = give_get_meta($postid, $field['id'].'_minimum', true); |
|
951 | 951 | |
952 | 952 | // Give < 2.1 |
953 | - if ( '_give_custom_amount_range' === $field['id'] && empty( $minimum ) ) { |
|
954 | - $minimum = give_get_meta( $postid, '_give_custom_amount_minimum', true ); |
|
953 | + if ('_give_custom_amount_range' === $field['id'] && empty($minimum)) { |
|
954 | + $minimum = give_get_meta($postid, '_give_custom_amount_minimum', true); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | $field_value = array( |
958 | 958 | 'minimum' => $minimum, |
959 | - 'maximum' => give_get_meta( $postid, $field['id'] . '_maximum', true ), |
|
959 | + 'maximum' => give_get_meta($postid, $field['id'].'_maximum', true), |
|
960 | 960 | ); |
961 | 961 | } else { |
962 | 962 | // Get value from db. |
963 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
963 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | /** |
@@ -970,10 +970,10 @@ discard block |
||
970 | 970 | * |
971 | 971 | * @param mixed $field_value Field value. |
972 | 972 | */ |
973 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
973 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
974 | 974 | |
975 | 975 | // Set default value if no any data saved to db. |
976 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
976 | + if ( ! $field_value && isset($field['default'])) { |
|
977 | 977 | $field_value = $field['default']; |
978 | 978 | } |
979 | 979 | |
@@ -990,20 +990,20 @@ discard block |
||
990 | 990 | * |
991 | 991 | * @return string |
992 | 992 | */ |
993 | -function give_get_field_description( $field ) { |
|
993 | +function give_get_field_description($field) { |
|
994 | 994 | $field_desc_html = ''; |
995 | 995 | $description = ''; |
996 | 996 | |
997 | 997 | // Check for both `description` and `desc`. |
998 | - if ( isset( $field['description'] ) ) { |
|
998 | + if (isset($field['description'])) { |
|
999 | 999 | $description = $field['description']; |
1000 | - } elseif ( isset( $field['desc'] ) ) { |
|
1000 | + } elseif (isset($field['desc'])) { |
|
1001 | 1001 | $description = $field['desc']; |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | // Set if there is a description. |
1005 | - if ( ! empty( $description ) ) { |
|
1006 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
1005 | + if ( ! empty($description)) { |
|
1006 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | return $field_desc_html; |
@@ -1023,8 +1023,8 @@ discard block |
||
1023 | 1023 | * |
1024 | 1024 | * @return string |
1025 | 1025 | */ |
1026 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
1027 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
1026 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
1027 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
1028 | 1028 | |
1029 | 1029 | /** |
1030 | 1030 | * Filter the specific repeater field value |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | * |
1034 | 1034 | * @param string $field_id |
1035 | 1035 | */ |
1036 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
1036 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
1037 | 1037 | |
1038 | 1038 | /** |
1039 | 1039 | * Filter the repeater field value |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | * |
1043 | 1043 | * @param string $field_id |
1044 | 1044 | */ |
1045 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
1045 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
1046 | 1046 | |
1047 | 1047 | return $field_value; |
1048 | 1048 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return string |
1062 | 1062 | */ |
1063 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
1063 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
1064 | 1064 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1065 | 1065 | |
1066 | 1066 | // Get field id. |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | * |
1074 | 1074 | * @param string $field_id |
1075 | 1075 | */ |
1076 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
1076 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
1077 | 1077 | |
1078 | 1078 | /** |
1079 | 1079 | * Filter the repeater field id |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | * |
1083 | 1083 | * @param string $field_id |
1084 | 1084 | */ |
1085 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
1085 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
1086 | 1086 | |
1087 | 1087 | return $field_id; |
1088 | 1088 | } |
@@ -1097,8 +1097,8 @@ discard block |
||
1097 | 1097 | * |
1098 | 1098 | * @return string |
1099 | 1099 | */ |
1100 | -function give_get_field_name( $field ) { |
|
1101 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
1100 | +function give_get_field_name($field) { |
|
1101 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
1102 | 1102 | |
1103 | 1103 | /** |
1104 | 1104 | * Filter the field name. |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | * |
1108 | 1108 | * @param string $field_name |
1109 | 1109 | */ |
1110 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
1110 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
1111 | 1111 | |
1112 | 1112 | return $field_name; |
1113 | 1113 | } |
@@ -1124,40 +1124,40 @@ discard block |
||
1124 | 1124 | * |
1125 | 1125 | * @return void |
1126 | 1126 | */ |
1127 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
1127 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
1128 | 1128 | global $thepostid, $post; |
1129 | 1129 | |
1130 | 1130 | // Bailout. |
1131 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
1131 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
1132 | 1132 | return; |
1133 | 1133 | } |
1134 | 1134 | |
1135 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
1136 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
1137 | - $wrapper_class = isset( $fields['wrapper_class'] ) ? $fields['wrapper_class'] : ''; |
|
1135 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
1136 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
1137 | + $wrapper_class = isset($fields['wrapper_class']) ? $fields['wrapper_class'] : ''; |
|
1138 | 1138 | ?> |
1139 | - <div class="give-repeatable-field-section <?php echo esc_attr( $wrapper_class ); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
1139 | + <div class="give-repeatable-field-section <?php echo esc_attr($wrapper_class); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
1140 | 1140 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
1141 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
1141 | + <?php if ( ! empty($fields['name'])) : ?> |
|
1142 | 1142 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
1143 | 1143 | <?php endif; ?> |
1144 | 1144 | |
1145 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
1145 | + <?php if ( ! empty($fields['description'])) : ?> |
|
1146 | 1146 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
1147 | 1147 | <?php endif; ?> |
1148 | 1148 | |
1149 | 1149 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
1150 | 1150 | <?php |
1151 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
1152 | - $header_title = isset( $fields['options']['header_title'] ) |
|
1151 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
1152 | + $header_title = isset($fields['options']['header_title']) |
|
1153 | 1153 | ? $fields['options']['header_title'] |
1154 | - : esc_attr__( 'Group', 'give' ); |
|
1154 | + : esc_attr__('Group', 'give'); |
|
1155 | 1155 | |
1156 | 1156 | $add_default_donation_field = false; |
1157 | 1157 | |
1158 | 1158 | // Check if level is not created or we have to add default level. |
1159 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
1160 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
1159 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
1160 | + $repeater_field_values = array_values($repeater_field_values); |
|
1161 | 1161 | } else { |
1162 | 1162 | $fields_count = 1; |
1163 | 1163 | $add_default_donation_field = true; |
@@ -1170,77 +1170,77 @@ discard block |
||
1170 | 1170 | <div class="give-row-head give-move"> |
1171 | 1171 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
1172 | 1172 | </button> |
1173 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
1173 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
1174 | 1174 | <h2> |
1175 | 1175 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1176 | 1176 | </h2> |
1177 | 1177 | </div> |
1178 | 1178 | <div class="give-row-body"> |
1179 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1179 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1180 | 1180 | <?php |
1181 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1181 | + if ( ! give_is_field_callback_exist($field)) { |
|
1182 | 1182 | continue; |
1183 | 1183 | } |
1184 | 1184 | ?> |
1185 | 1185 | <?php |
1186 | 1186 | $field['repeat'] = true; |
1187 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
1187 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
1188 | 1188 | $field['id'] = str_replace( |
1189 | - array( '[', ']' ), |
|
1190 | - array( '_', '', ), |
|
1189 | + array('[', ']'), |
|
1190 | + array('_', '',), |
|
1191 | 1191 | $field['repeatable_field_id'] |
1192 | 1192 | ); |
1193 | 1193 | ?> |
1194 | - <?php give_render_field( $field ); ?> |
|
1194 | + <?php give_render_field($field); ?> |
|
1195 | 1195 | <?php endforeach; ?> |
1196 | 1196 | </div> |
1197 | 1197 | </td> |
1198 | 1198 | </tr> |
1199 | 1199 | |
1200 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
1200 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
1201 | 1201 | <!--Stored repeater field group--> |
1202 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
1202 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
1203 | 1203 | <tr class="give-row"> |
1204 | 1204 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1205 | 1205 | <div class="give-row-head give-move"> |
1206 | 1206 | <button type="button" class="handlediv button-link"> |
1207 | 1207 | <span class="toggle-indicator"></span></button> |
1208 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1208 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1209 | 1209 | </span> |
1210 | 1210 | <h2> |
1211 | 1211 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1212 | 1212 | </h2> |
1213 | 1213 | </div> |
1214 | 1214 | <div class="give-row-body"> |
1215 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1216 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
1215 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1216 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
1217 | 1217 | continue; |
1218 | 1218 | } ?> |
1219 | 1219 | <?php |
1220 | 1220 | $field['repeat'] = true; |
1221 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
1222 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
1221 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
1222 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
1223 | 1223 | $field['id'] = str_replace( |
1224 | - array( '[', ']' ), |
|
1225 | - array( '_', '', ), |
|
1224 | + array('[', ']'), |
|
1225 | + array('_', '',), |
|
1226 | 1226 | $field['repeatable_field_id'] |
1227 | 1227 | ); |
1228 | 1228 | ?> |
1229 | - <?php give_render_field( $field ); ?> |
|
1229 | + <?php give_render_field($field); ?> |
|
1230 | 1230 | <?php endforeach; ?> |
1231 | 1231 | </div> |
1232 | 1232 | </td> |
1233 | 1233 | </tr> |
1234 | - <?php endforeach;; ?> |
|
1234 | + <?php endforeach; ; ?> |
|
1235 | 1235 | |
1236 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1236 | + <?php elseif ($add_default_donation_field) : ?> |
|
1237 | 1237 | <!--Default repeater field group--> |
1238 | 1238 | <tr class="give-row"> |
1239 | 1239 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1240 | 1240 | <div class="give-row-head give-move"> |
1241 | 1241 | <button type="button" class="handlediv button-link"> |
1242 | 1242 | <span class="toggle-indicator"></span></button> |
1243 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1243 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1244 | 1244 | </span> |
1245 | 1245 | <h2> |
1246 | 1246 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1248,25 +1248,25 @@ discard block |
||
1248 | 1248 | </div> |
1249 | 1249 | <div class="give-row-body"> |
1250 | 1250 | <?php |
1251 | - foreach ( $fields['fields'] as $field ) : |
|
1252 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1251 | + foreach ($fields['fields'] as $field) : |
|
1252 | + if ( ! give_is_field_callback_exist($field)) { |
|
1253 | 1253 | continue; |
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | $field['repeat'] = true; |
1257 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1257 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1258 | 1258 | $field['attributes']['value'] = apply_filters( |
1259 | 1259 | "give_default_field_group_field_{$field['id']}_value", |
1260 | - ( ! empty( $field['default'] ) ? $field['default'] : '' ), |
|
1260 | + ( ! empty($field['default']) ? $field['default'] : ''), |
|
1261 | 1261 | $field, |
1262 | 1262 | $fields |
1263 | 1263 | ); |
1264 | - $field['id'] = str_replace( |
|
1265 | - array( '[', ']' ), |
|
1266 | - array( '_', '', ), |
|
1264 | + $field['id'] = str_replace( |
|
1265 | + array('[', ']'), |
|
1266 | + array('_', '',), |
|
1267 | 1267 | $field['repeatable_field_id'] |
1268 | 1268 | ); |
1269 | - give_render_field( $field ); |
|
1269 | + give_render_field($field); |
|
1270 | 1270 | |
1271 | 1271 | endforeach; |
1272 | 1272 | ?> |
@@ -1278,9 +1278,9 @@ discard block |
||
1278 | 1278 | <tfoot> |
1279 | 1279 | <tr> |
1280 | 1280 | <?php |
1281 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1281 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1282 | 1282 | ? $add_row_btn_title = $fields['options']['add_button'] |
1283 | - : esc_html__( 'Add Row', 'give' ); |
|
1283 | + : esc_html__('Add Row', 'give'); |
|
1284 | 1284 | ?> |
1285 | 1285 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1286 | 1286 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1310,10 +1310,10 @@ discard block |
||
1310 | 1310 | * |
1311 | 1311 | * @param string |
1312 | 1312 | */ |
1313 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1313 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1314 | 1314 | |
1315 | 1315 | // Get current tab. |
1316 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1316 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1317 | 1317 | |
1318 | 1318 | // Output. |
1319 | 1319 | return $current_tab; |
@@ -1337,10 +1337,10 @@ discard block |
||
1337 | 1337 | * |
1338 | 1338 | * @param string |
1339 | 1339 | */ |
1340 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1340 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1341 | 1341 | |
1342 | 1342 | // Get current section. |
1343 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1343 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1344 | 1344 | |
1345 | 1345 | // Output. |
1346 | 1346 | return $current_section; |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | */ |
1355 | 1355 | function give_get_current_setting_page() { |
1356 | 1356 | // Get current page. |
1357 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1357 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1358 | 1358 | |
1359 | 1359 | // Output. |
1360 | 1360 | return $setting_page; |
@@ -1374,13 +1374,13 @@ discard block |
||
1374 | 1374 | * |
1375 | 1375 | * @return string |
1376 | 1376 | */ |
1377 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1378 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1377 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1378 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1379 | 1379 | |
1380 | 1380 | if ( |
1381 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
1381 | + ! give_get_meta($postid, '_give_display_content', true) |
|
1382 | 1382 | && $show_content |
1383 | - && ( 'none' !== $show_content ) |
|
1383 | + && ('none' !== $show_content) |
|
1384 | 1384 | ) { |
1385 | 1385 | $field_value = 'enabled'; |
1386 | 1386 | } |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | return $field_value; |
1389 | 1389 | } |
1390 | 1390 | |
1391 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1391 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1392 | 1392 | |
1393 | 1393 | |
1394 | 1394 | /** |
@@ -1405,12 +1405,12 @@ discard block |
||
1405 | 1405 | * |
1406 | 1406 | * @return string |
1407 | 1407 | */ |
1408 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1409 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1408 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1409 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1410 | 1410 | |
1411 | 1411 | if ( |
1412 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
1413 | - && ( 'none' !== $show_content ) |
|
1412 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
1413 | + && ('none' !== $show_content) |
|
1414 | 1414 | ) { |
1415 | 1415 | $field_value = $show_content; |
1416 | 1416 | } |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | return $field_value; |
1419 | 1419 | } |
1420 | 1420 | |
1421 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1421 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1422 | 1422 | |
1423 | 1423 | |
1424 | 1424 | /** |
@@ -1434,17 +1434,17 @@ discard block |
||
1434 | 1434 | * |
1435 | 1435 | * @return string |
1436 | 1436 | */ |
1437 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1438 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
1437 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1438 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
1439 | 1439 | |
1440 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1441 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1440 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1441 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | return $field_value; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1447 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1448 | 1448 | |
1449 | 1449 | |
1450 | 1450 | /** |
@@ -1461,17 +1461,17 @@ discard block |
||
1461 | 1461 | * |
1462 | 1462 | * @return string |
1463 | 1463 | */ |
1464 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1465 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1464 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1465 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1466 | 1466 | |
1467 | - if ( 'on' === $offline_donation ) { |
|
1467 | + if ('on' === $offline_donation) { |
|
1468 | 1468 | $field_value = 'enabled'; |
1469 | 1469 | } |
1470 | 1470 | |
1471 | 1471 | return $field_value; |
1472 | 1472 | } |
1473 | 1473 | |
1474 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1474 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1475 | 1475 | |
1476 | 1476 | |
1477 | 1477 | /** |
@@ -1487,17 +1487,17 @@ discard block |
||
1487 | 1487 | * |
1488 | 1488 | * @return string |
1489 | 1489 | */ |
1490 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1491 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
1490 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1491 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
1492 | 1492 | |
1493 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1494 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1493 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1494 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | return $field_value; |
1498 | 1498 | } |
1499 | 1499 | |
1500 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1500 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1501 | 1501 | |
1502 | 1502 | |
1503 | 1503 | /** |
@@ -1513,17 +1513,17 @@ discard block |
||
1513 | 1513 | * |
1514 | 1514 | * @return string |
1515 | 1515 | */ |
1516 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1517 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
1516 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1517 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
1518 | 1518 | |
1519 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1520 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1519 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1520 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | return $field_value; |
1524 | 1524 | } |
1525 | 1525 | |
1526 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1526 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1527 | 1527 | |
1528 | 1528 | /** |
1529 | 1529 | * Set value for Donation Goal --> close Form. |
@@ -1539,17 +1539,17 @@ discard block |
||
1539 | 1539 | * |
1540 | 1540 | * @return string |
1541 | 1541 | */ |
1542 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1543 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1542 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1543 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1544 | 1544 | |
1545 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1546 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1545 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1546 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | return $field_value; |
1550 | 1550 | } |
1551 | 1551 | |
1552 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1552 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1553 | 1553 | |
1554 | 1554 | |
1555 | 1555 | /** |
@@ -1565,17 +1565,17 @@ discard block |
||
1565 | 1565 | * |
1566 | 1566 | * @return string |
1567 | 1567 | */ |
1568 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1569 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
1568 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1569 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
1570 | 1570 | |
1571 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1572 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1571 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1572 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1573 | 1573 | } |
1574 | 1574 | |
1575 | 1575 | return $field_value; |
1576 | 1576 | } |
1577 | 1577 | |
1578 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1578 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1579 | 1579 | |
1580 | 1580 | /** |
1581 | 1581 | * Set value for Offline Donations --> Offline Donations. |
@@ -1591,17 +1591,17 @@ discard block |
||
1591 | 1591 | * |
1592 | 1592 | * @return string |
1593 | 1593 | */ |
1594 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1595 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
1594 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1595 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
1596 | 1596 | |
1597 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1598 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1597 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1598 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1599 | 1599 | } |
1600 | 1600 | |
1601 | 1601 | return $field_value; |
1602 | 1602 | } |
1603 | 1603 | |
1604 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1604 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1605 | 1605 | |
1606 | 1606 | |
1607 | 1607 | /** |
@@ -1616,14 +1616,14 @@ discard block |
||
1616 | 1616 | * |
1617 | 1617 | * @return mixed |
1618 | 1618 | */ |
1619 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1619 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1620 | 1620 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1621 | 1621 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1622 | 1622 | |
1623 | 1623 | return $field_id; |
1624 | 1624 | } |
1625 | 1625 | |
1626 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1626 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1627 | 1627 | |
1628 | 1628 | /** |
1629 | 1629 | * Set repeater field value for multi donation form. |
@@ -1637,13 +1637,13 @@ discard block |
||
1637 | 1637 | * |
1638 | 1638 | * @return mixed |
1639 | 1639 | */ |
1640 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1641 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1640 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1641 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1642 | 1642 | |
1643 | 1643 | return $field_value; |
1644 | 1644 | } |
1645 | 1645 | |
1646 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1646 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1647 | 1647 | |
1648 | 1648 | /** |
1649 | 1649 | * Set default value for _give_id field. |
@@ -1654,11 +1654,11 @@ discard block |
||
1654 | 1654 | * |
1655 | 1655 | * @return string |
1656 | 1656 | */ |
1657 | -function _give_set_field_give_id_default_value( $field ) { |
|
1657 | +function _give_set_field_give_id_default_value($field) { |
|
1658 | 1658 | return 0; |
1659 | 1659 | } |
1660 | 1660 | |
1661 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1661 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1662 | 1662 | |
1663 | 1663 | /** |
1664 | 1664 | * Set default value for _give_default field. |
@@ -1669,11 +1669,11 @@ discard block |
||
1669 | 1669 | * |
1670 | 1670 | * @return string |
1671 | 1671 | */ |
1672 | -function _give_set_field_give_default_default_value( $field ) { |
|
1672 | +function _give_set_field_give_default_default_value($field) { |
|
1673 | 1673 | return 'default'; |
1674 | 1674 | } |
1675 | 1675 | |
1676 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1676 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1677 | 1677 | |
1678 | 1678 | /** |
1679 | 1679 | * Set repeater field editor id for field type wysiwyg. |
@@ -1685,15 +1685,15 @@ discard block |
||
1685 | 1685 | * |
1686 | 1686 | * @return string |
1687 | 1687 | */ |
1688 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1689 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1690 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1688 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1689 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1690 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1691 | 1691 | } |
1692 | 1692 | |
1693 | 1693 | return $field_name; |
1694 | 1694 | } |
1695 | 1695 | |
1696 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1696 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
1697 | 1697 | |
1698 | 1698 | /** |
1699 | 1699 | * Output Donation form radio input box. |
@@ -1718,45 +1718,45 @@ discard block |
||
1718 | 1718 | * } |
1719 | 1719 | * @return void |
1720 | 1720 | */ |
1721 | -function give_donation_form_goal( $field ) { |
|
1721 | +function give_donation_form_goal($field) { |
|
1722 | 1722 | global $thepostid, $post; |
1723 | 1723 | |
1724 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
1725 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
1726 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
1727 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
1728 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
1724 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
1725 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
1726 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
1727 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
1728 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
1729 | 1729 | |
1730 | 1730 | |
1731 | 1731 | printf( |
1732 | 1732 | '<fieldset class="give-field-wrap %s_field %s">', |
1733 | - esc_attr( $field['id'] ), |
|
1734 | - esc_attr( $field['wrapper_class'] ) |
|
1733 | + esc_attr($field['id']), |
|
1734 | + esc_attr($field['wrapper_class']) |
|
1735 | 1735 | ); |
1736 | 1736 | |
1737 | 1737 | printf( |
1738 | 1738 | '<span class="give-field-label">%s</span>', |
1739 | - esc_html( $field['name'] ) |
|
1739 | + esc_html($field['name']) |
|
1740 | 1740 | ); |
1741 | 1741 | |
1742 | 1742 | printf( |
1743 | 1743 | '<legend class="screen-reader-text">%s</legend>', |
1744 | - esc_html( $field['name'] ) |
|
1744 | + esc_html($field['name']) |
|
1745 | 1745 | ); |
1746 | 1746 | ?> |
1747 | 1747 | |
1748 | 1748 | <ul class="give-radios"> |
1749 | 1749 | <?php |
1750 | - foreach ( $field['options'] as $key => $value ) { |
|
1751 | - $attributes = empty( $field['attributes'] ) ? '' : give_get_attribute_str( $field['attributes'] ); |
|
1750 | + foreach ($field['options'] as $key => $value) { |
|
1751 | + $attributes = empty($field['attributes']) ? '' : give_get_attribute_str($field['attributes']); |
|
1752 | 1752 | printf( |
1753 | 1753 | '<li><label><input name="%s" value="%s" type="radio" style="%s" %s %s /> %s </label></li>', |
1754 | - give_get_field_name( $field ), |
|
1755 | - esc_attr( $key ), |
|
1756 | - esc_attr( $field['style'] ), |
|
1757 | - checked( esc_attr( $field['value'] ), esc_attr( $key ), false ), |
|
1754 | + give_get_field_name($field), |
|
1755 | + esc_attr($key), |
|
1756 | + esc_attr($field['style']), |
|
1757 | + checked(esc_attr($field['value']), esc_attr($key), false), |
|
1758 | 1758 | $attributes, |
1759 | - esc_html( $value ) |
|
1759 | + esc_html($value) |
|
1760 | 1760 | ); |
1761 | 1761 | } |
1762 | 1762 | ?> |
@@ -1770,9 +1770,9 @@ discard block |
||
1770 | 1770 | * |
1771 | 1771 | * @param array $field Array of radio field arguments. |
1772 | 1772 | */ |
1773 | - do_action( 'give_donation_form_goal_before_description', $field ); |
|
1773 | + do_action('give_donation_form_goal_before_description', $field); |
|
1774 | 1774 | |
1775 | - echo give_get_field_description( $field ); |
|
1775 | + echo give_get_field_description($field); |
|
1776 | 1776 | |
1777 | 1777 | echo '</fieldset>'; |
1778 | 1778 | } |
1779 | 1779 | \ 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 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string $message Fully formatted message |
44 | 44 | */ |
45 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
46 | - return give_do_email_tags( $message, $payment_id ); |
|
45 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
46 | + return give_do_email_tags($message, $payment_id); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -57,45 +57,45 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return string $message Fully formatted message |
59 | 59 | */ |
60 | -function give_email_preview_template_tags( $message ) { |
|
60 | +function give_email_preview_template_tags($message) { |
|
61 | 61 | |
62 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
62 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
63 | 63 | |
64 | 64 | $gateway = 'PayPal'; |
65 | 65 | |
66 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
66 | + $receipt_id = strtolower(md5(uniqid())); |
|
67 | 67 | |
68 | - $payment_id = rand( 1, 100 ); |
|
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) ); |
|
68 | + $payment_id = rand(1, 100); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri())); |
|
70 | 70 | |
71 | 71 | $receipt_link = sprintf( |
72 | 72 | '<a href="%1$s">%2$s</a>', |
73 | 73 | $receipt_link_url, |
74 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
74 | + esc_html__('View the receipt in your browser »', 'give') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Set user. |
78 | 78 | $user = wp_get_current_user(); |
79 | 79 | |
80 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
82 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
83 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
84 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
85 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
86 | - $message = str_replace( '{amount}', $price, $message ); |
|
87 | - $message = str_replace( '{price}', $price, $message ); |
|
88 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
89 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
90 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
91 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
92 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
93 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
94 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
95 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
96 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
97 | - |
|
98 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
80 | + $message = str_replace('{name}', $user->display_name, $message); |
|
81 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
82 | + $message = str_replace('{username}', $user->user_login, $message); |
|
83 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
84 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
85 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
86 | + $message = str_replace('{amount}', $price, $message); |
|
87 | + $message = str_replace('{price}', $price, $message); |
|
88 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
89 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
90 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
91 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
92 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
93 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
94 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
95 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
96 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
97 | + |
|
98 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array |
113 | 113 | */ |
114 | -function give_email_preview_buttons_callback( $field ) { |
|
115 | - $field_id = str_replace( '_preview_buttons', '', $field['id'] ); |
|
114 | +function give_email_preview_buttons_callback($field) { |
|
115 | + $field_id = str_replace('_preview_buttons', '', $field['id']); |
|
116 | 116 | |
117 | 117 | ob_start(); |
118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
121 | 121 | wp_nonce_url( |
122 | 122 | add_query_arg( |
123 | - array( 'give_action' => 'preview_email', 'email_type' => $field_id ), |
|
123 | + array('give_action' => 'preview_email', 'email_type' => $field_id), |
|
124 | 124 | home_url() |
125 | 125 | ), 'give-preview-email' |
126 | 126 | ), |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | echo sprintf( |
131 | 131 | ' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>', |
132 | 132 | wp_nonce_url( |
133 | - add_query_arg( array( |
|
133 | + add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_preview_email', |
135 | 135 | 'email_type' => $field_id, |
136 | 136 | 'give-message' => 'sent-test-email', |
137 | - ) ), 'give-send-preview-email' ), |
|
138 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
139 | - esc_html__( 'Send Test Email', 'give' ) |
|
137 | + )), 'give-send-preview-email' ), |
|
138 | + esc_attr__('Send Test Email.', 'give'), |
|
139 | + esc_html__('Send Test Email', 'give') |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | echo ob_get_clean(); |
@@ -155,34 +155,34 @@ discard block |
||
155 | 155 | |
156 | 156 | //Payment receipt switcher |
157 | 157 | $payment_count = give_count_payments()->publish; |
158 | - $payment_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ); |
|
158 | + $payment_id = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id'); |
|
159 | 159 | |
160 | - if ( $payment_count <= 0 ) { |
|
160 | + if ($payment_count <= 0) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
164 | 164 | //Get payments. |
165 | - $donations = new Give_Payments_Query( array( |
|
165 | + $donations = new Give_Payments_Query(array( |
|
166 | 166 | 'number' => 100, |
167 | 167 | 'output' => '', |
168 | 168 | 'fields' => 'ids' |
169 | - ) ); |
|
169 | + )); |
|
170 | 170 | $donations = $donations->get_payments(); |
171 | - $options = array(); |
|
171 | + $options = array(); |
|
172 | 172 | |
173 | 173 | // Default option. |
174 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
174 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
175 | 175 | |
176 | 176 | //Provide nice human readable options. |
177 | - if ( $donations ) { |
|
178 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
179 | - foreach ( $donations as $donation_id ) { |
|
177 | + if ($donations) { |
|
178 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
179 | + foreach ($donations as $donation_id) { |
|
180 | 180 | |
181 | - $options[ $donation_id ] = sprintf( |
|
181 | + $options[$donation_id] = sprintf( |
|
182 | 182 | '#%1$s - %2$s - %3$s', |
183 | 183 | $donation_id, |
184 | - give_get_donation_donor_email( $donation_id ), |
|
185 | - get_the_title( $donation_id ) |
|
184 | + give_get_donation_donor_email($donation_id), |
|
185 | + get_the_title($donation_id) |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | } |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | $transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">'; |
192 | 192 | |
193 | 193 | // Remove payment id query param if set from request url. |
194 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
194 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
195 | 195 | $query = $request_url_data['query']; |
196 | - $query = remove_query_arg( array( 'preview_id' ), $query ); |
|
196 | + $query = remove_query_arg(array('preview_id'), $query); |
|
197 | 197 | |
198 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
198 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
199 | 199 | |
200 | 200 | $transaction_header .= '<script> |
201 | 201 | function change_preview(){ |
202 | 202 | var transactions = document.getElementById("give_preview_email_payment_id"); |
203 | 203 | var selected_trans = transactions.options[transactions.selectedIndex]; |
204 | 204 | if (selected_trans){ |
205 | - var url_string = "' . $request_url . '&preview_id=" + selected_trans.value; |
|
205 | + var url_string = "' . $request_url.'&preview_id=" + selected_trans.value; |
|
206 | 206 | window.location = url_string; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | </script>'; |
210 | 210 | |
211 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
211 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
212 | 212 | |
213 | 213 | //The select field with 100 latest transactions |
214 | - $transaction_header .= Give()->html->select( array( |
|
214 | + $transaction_header .= Give()->html->select(array( |
|
215 | 215 | 'name' => 'preview_email_payment_id', |
216 | 216 | 'selected' => $payment_id, |
217 | 217 | 'id' => 'give_preview_email_payment_id', |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | 'select_atts' => 'onchange="change_preview()"', |
222 | 222 | 'show_option_all' => false, |
223 | 223 | 'show_option_none' => false, |
224 | - ) ); |
|
224 | + )); |
|
225 | 225 | |
226 | 226 | //Closing tag |
227 | 227 | $transaction_header .= '</div>'; |
228 | 228 | |
229 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
229 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
230 | 230 | |
231 | 231 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | * @param string $context Email tag category |
58 | 58 | */ |
59 | - public function add( $tag, $description, $func, $context = '' ) { |
|
60 | - if ( is_callable( $func ) ) { |
|
61 | - $this->tags[ $tag ] = array( |
|
59 | + public function add($tag, $description, $func, $context = '') { |
|
60 | + if (is_callable($func)) { |
|
61 | + $this->tags[$tag] = array( |
|
62 | 62 | 'tag' => $tag, |
63 | 63 | 'description' => $description, |
64 | 64 | 'func' => $func, |
65 | - 'context' => give_check_variable( $context, 'empty', 'general' ), |
|
65 | + 'context' => give_check_variable($context, 'empty', 'general'), |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $tag Email tag to remove hook from |
76 | 76 | */ |
77 | - public function remove( $tag ) { |
|
78 | - unset( $this->tags[ $tag ] ); |
|
77 | + public function remove($tag) { |
|
78 | + unset($this->tags[$tag]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - public function email_tag_exists( $tag ) { |
|
91 | - return array_key_exists( $tag, $this->tags ); |
|
90 | + public function email_tag_exists($tag) { |
|
91 | + return array_key_exists($tag, $this->tags); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
105 | + public function get_tags($context_type = 'all', $field = '') { |
|
106 | 106 | $tags = $this->tags; |
107 | 107 | |
108 | - if ( 'all' !== $context_type ) { |
|
108 | + if ('all' !== $context_type) { |
|
109 | 109 | $tags = array(); |
110 | 110 | |
111 | - foreach ( $this->tags as $tag ) { |
|
112 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
111 | + foreach ($this->tags as $tag) { |
|
112 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $tags[ $tag['tag'] ] = $tag; |
|
116 | + $tags[$tag['tag']] = $tag; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
121 | - $tags = wp_list_pluck( $tags, $field ); |
|
120 | + if ( ! empty($tags) && ! empty($field)) { |
|
121 | + $tags = wp_list_pluck($tags, $field); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $tags; |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return string Content with email tags filtered out. |
138 | 138 | */ |
139 | - public function do_tags( $content, $tag_args ) { |
|
139 | + public function do_tags($content, $tag_args) { |
|
140 | 140 | |
141 | 141 | // Check if there is at least one tag added. |
142 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
142 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->tag_args = $tag_args; |
147 | 147 | |
148 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
148 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
149 | 149 | |
150 | 150 | $this->tag_args = null; |
151 | 151 | |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return mixed |
163 | 163 | */ |
164 | - public function do_tag( $m ) { |
|
164 | + public function do_tag($m) { |
|
165 | 165 | |
166 | 166 | // Get tag |
167 | 167 | $tag = $m[1]; |
168 | 168 | |
169 | 169 | // Return tag if tag not set |
170 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
170 | + if ( ! $this->email_tag_exists($tag)) { |
|
171 | 171 | return $m[0]; |
172 | 172 | } |
173 | 173 | |
174 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
174 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param callable $func Hook to run when email tag is found |
187 | 187 | * @param string $context Email tag category |
188 | 188 | */ |
189 | -function give_add_email_tag( $tag, $description, $func, $context = '' ) { |
|
190 | - Give()->email_tags->add( $tag, $description, $func, $context ); |
|
189 | +function give_add_email_tag($tag, $description, $func, $context = '') { |
|
190 | + Give()->email_tags->add($tag, $description, $func, $context); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string $tag Email tag to remove hook from |
199 | 199 | */ |
200 | -function give_remove_email_tag( $tag ) { |
|
201 | - Give()->email_tags->remove( $tag ); |
|
200 | +function give_remove_email_tag($tag) { |
|
201 | + Give()->email_tags->remove($tag); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return bool |
212 | 212 | */ |
213 | -function give_email_tag_exists( $tag ) { |
|
214 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
213 | +function give_email_tag_exists($tag) { |
|
214 | + return Give()->email_tags->email_tag_exists($tag); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $email_tags = give_get_email_tags(); |
239 | 239 | |
240 | 240 | ob_start(); |
241 | - if ( count( $email_tags ) > 0 ) : ?> |
|
241 | + if (count($email_tags) > 0) : ?> |
|
242 | 242 | <div class="give-email-tags-wrap"> |
243 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
243 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
244 | 244 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
245 | 245 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
246 | 246 | </span> |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string Content with email tags filtered out. |
266 | 266 | */ |
267 | -function give_do_email_tags( $content, $tag_args ) { |
|
267 | +function give_do_email_tags($content, $tag_args) { |
|
268 | 268 | // Backward compatibility < 2.0 |
269 | - if ( ! is_array( $tag_args ) ) { |
|
270 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
269 | + if ( ! is_array($tag_args)) { |
|
270 | + $tag_args = array('payment_id' => $tag_args); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Replace all tags |
274 | - $content = Give()->email_tags->do_tags( $content, $tag_args ); |
|
274 | + $content = Give()->email_tags->do_tags($content, $tag_args); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Filter the filtered content text. |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
281 | 281 | */ |
282 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
282 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
283 | 283 | |
284 | 284 | // Return content |
285 | 285 | return $content; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.0 |
300 | 300 | */ |
301 | - do_action( 'give_add_email_tags' ); |
|
301 | + do_action('give_add_email_tags'); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
304 | +add_action('init', 'give_load_email_tags', - 999); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -316,67 +316,67 @@ discard block |
||
316 | 316 | /* Donation Payment */ |
317 | 317 | array( |
318 | 318 | 'tag' => 'donation', |
319 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
319 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
320 | 320 | 'function' => 'give_email_tag_donation', |
321 | 321 | 'context' => 'donation', |
322 | 322 | ), |
323 | 323 | array( |
324 | 324 | 'tag' => 'amount', |
325 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
325 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
326 | 326 | 'function' => 'give_email_tag_amount', |
327 | 327 | 'context' => 'donation', |
328 | 328 | ), |
329 | 329 | array( |
330 | 330 | 'tag' => 'price', |
331 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
331 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
332 | 332 | 'function' => 'give_email_tag_price', |
333 | 333 | 'context' => 'donation', |
334 | 334 | ), |
335 | 335 | array( |
336 | 336 | 'tag' => 'billing_address', |
337 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
337 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
338 | 338 | 'function' => 'give_email_tag_billing_address', |
339 | 339 | 'context' => 'donation', |
340 | 340 | ), |
341 | 341 | array( |
342 | 342 | 'tag' => 'date', |
343 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
343 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
344 | 344 | 'function' => 'give_email_tag_date', |
345 | 345 | 'context' => 'donation', |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'tag' => 'payment_id', |
349 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
349 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
350 | 350 | 'function' => 'give_email_tag_payment_id', |
351 | 351 | 'context' => 'donation', |
352 | 352 | ), |
353 | 353 | array( |
354 | 354 | 'tag' => 'payment_method', |
355 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
355 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
356 | 356 | 'function' => 'give_email_tag_payment_method', |
357 | 357 | 'context' => 'donation', |
358 | 358 | ), |
359 | 359 | array( |
360 | 360 | 'tag' => 'payment_total', |
361 | - 'description' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
361 | + 'description' => esc_html__('The payment total for this donation.', 'give'), |
|
362 | 362 | 'function' => 'give_email_tag_payment_total', |
363 | 363 | 'context' => 'donation', |
364 | 364 | ), |
365 | 365 | array( |
366 | 366 | 'tag' => 'receipt_id', |
367 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
367 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
368 | 368 | 'function' => 'give_email_tag_receipt_id', |
369 | 369 | 'context' => 'donation', |
370 | 370 | ), |
371 | 371 | array( |
372 | 372 | 'tag' => 'receipt_link', |
373 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
373 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
374 | 374 | 'function' => 'give_email_tag_receipt_link', |
375 | 375 | 'context' => 'donation', |
376 | 376 | ), |
377 | 377 | array( |
378 | 378 | 'tag' => 'receipt_link_url', |
379 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
379 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
380 | 380 | 'function' => 'give_email_tag_receipt_link_url', |
381 | 381 | 'context' => 'donation', |
382 | 382 | ), |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | /* Donation Form */ |
385 | 385 | array( |
386 | 386 | 'tag' => 'form_title', |
387 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
387 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
388 | 388 | 'function' => 'give_email_tag_form_title', |
389 | 389 | 'context' => 'form', |
390 | 390 | ), |
@@ -392,37 +392,37 @@ discard block |
||
392 | 392 | /* Donor */ |
393 | 393 | array( |
394 | 394 | 'tag' => 'name', |
395 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
395 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
396 | 396 | 'function' => 'give_email_tag_first_name', |
397 | 397 | 'context' => 'donor', |
398 | 398 | ), |
399 | 399 | array( |
400 | 400 | 'tag' => 'fullname', |
401 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
401 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
402 | 402 | 'function' => 'give_email_tag_fullname', |
403 | 403 | 'context' => 'donor', |
404 | 404 | ), |
405 | 405 | array( |
406 | 406 | 'tag' => 'username', |
407 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
407 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
408 | 408 | 'function' => 'give_email_tag_username', |
409 | 409 | 'context' => 'donor', |
410 | 410 | ), |
411 | 411 | array( |
412 | 412 | 'tag' => 'company_name', |
413 | - 'description' => esc_html__( 'Company name.', 'give' ), |
|
413 | + 'description' => esc_html__('Company name.', 'give'), |
|
414 | 414 | 'function' => 'give_email_tag_company_name', |
415 | 415 | 'context' => 'donation', |
416 | 416 | ), |
417 | 417 | array( |
418 | 418 | 'tag' => 'user_email', |
419 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
419 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
420 | 420 | 'function' => 'give_email_tag_user_email', |
421 | 421 | 'context' => 'donor', |
422 | 422 | ), |
423 | 423 | array( |
424 | 424 | 'tag' => 'email_access_link', |
425 | - 'description' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
425 | + 'description' => esc_html__('The donor\'s email access link.', 'give'), |
|
426 | 426 | 'function' => 'give_email_tag_email_access_link', |
427 | 427 | 'context' => 'donor', |
428 | 428 | ), |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | /* General */ |
431 | 431 | array( |
432 | 432 | 'tag' => 'sitename', |
433 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
433 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
434 | 434 | 'function' => 'give_email_tag_sitename', |
435 | 435 | 'context' => 'general', |
436 | 436 | ), |
437 | 437 | |
438 | 438 | array( |
439 | 439 | 'tag' => 'reset_password_link', |
440 | - 'description' => esc_html__( 'The reset password link for user.', 'give' ), |
|
440 | + 'description' => esc_html__('The reset password link for user.', 'give'), |
|
441 | 441 | 'function' => 'give_email_tag_reset_password_link', |
442 | 442 | 'context' => 'general', |
443 | 443 | ), |
@@ -445,21 +445,21 @@ discard block |
||
445 | 445 | ); |
446 | 446 | |
447 | 447 | // Apply give_email_tags filter |
448 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
448 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
449 | 449 | |
450 | 450 | // Add email tags |
451 | - foreach ( $email_tags as $email_tag ) { |
|
451 | + foreach ($email_tags as $email_tag) { |
|
452 | 452 | give_add_email_tag( |
453 | 453 | $email_tag['tag'], |
454 | 454 | $email_tag['description'], |
455 | 455 | $email_tag['function'], |
456 | - ( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' ) |
|
456 | + ( ! empty($email_tag['context']) ? $email_tag['context'] : '') |
|
457 | 457 | ); |
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
462 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @return string $firstname |
473 | 473 | */ |
474 | -function give_email_tag_first_name( $tag_args ) { |
|
474 | +function give_email_tag_first_name($tag_args) { |
|
475 | 475 | $user_info = array(); |
476 | 476 | $firstname = ''; |
477 | 477 | |
478 | 478 | // Backward compatibility. |
479 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
479 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
480 | 480 | |
481 | - switch ( true ) { |
|
482 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
483 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
484 | - $email_names = give_get_email_names( $donor_info ); |
|
481 | + switch (true) { |
|
482 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
483 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
484 | + $email_names = give_get_email_names($donor_info); |
|
485 | 485 | $firstname = $email_names['name']; |
486 | 486 | |
487 | 487 | break; |
488 | 488 | |
489 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
489 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
490 | 490 | $firstname = Give()->donor_meta->get_meta( |
491 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
491 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
492 | 492 | '_give_donor_first_name', |
493 | 493 | true |
494 | 494 | ); |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @since 2.0 |
501 | 501 | */ |
502 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
503 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
502 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
503 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
504 | 504 | break; |
505 | 505 | } |
506 | 506 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param string $firstname |
513 | 513 | * @param array $tag_args |
514 | 514 | */ |
515 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
515 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
516 | 516 | |
517 | 517 | return $firstname; |
518 | 518 | } |
@@ -526,21 +526,21 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @return string $fullname |
528 | 528 | */ |
529 | -function give_email_tag_fullname( $tag_args ) { |
|
529 | +function give_email_tag_fullname($tag_args) { |
|
530 | 530 | $fullname = ''; |
531 | 531 | |
532 | 532 | // Backward compatibility. |
533 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
533 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
534 | 534 | |
535 | - switch ( true ) { |
|
536 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
537 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
538 | - $email_names = give_get_email_names( $donor_info ); |
|
535 | + switch (true) { |
|
536 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
537 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
538 | + $email_names = give_get_email_names($donor_info); |
|
539 | 539 | $fullname = $email_names['fullname']; |
540 | 540 | break; |
541 | 541 | |
542 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
543 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
542 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
543 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
544 | 544 | break; |
545 | 545 | |
546 | 546 | /** |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @since 2.0 |
550 | 550 | */ |
551 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
552 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
551 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
552 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
553 | 553 | break; |
554 | 554 | } |
555 | 555 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param string $fullname |
562 | 562 | * @param array $tag_args |
563 | 563 | */ |
564 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
564 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
565 | 565 | |
566 | 566 | return $fullname; |
567 | 567 | } |
@@ -575,21 +575,21 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return string username. |
577 | 577 | */ |
578 | -function give_email_tag_username( $tag_args ) { |
|
578 | +function give_email_tag_username($tag_args) { |
|
579 | 579 | $username = ''; |
580 | 580 | |
581 | 581 | // Backward compatibility. |
582 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
582 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
583 | 583 | |
584 | - switch ( true ) { |
|
585 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
586 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
587 | - $email_names = give_get_email_names( $donor_info ); |
|
584 | + switch (true) { |
|
585 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
586 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
587 | + $email_names = give_get_email_names($donor_info); |
|
588 | 588 | $username = $email_names['username']; |
589 | 589 | break; |
590 | 590 | |
591 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
592 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
591 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
592 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
593 | 593 | $username = $user_info->user_login; |
594 | 594 | break; |
595 | 595 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @since 2.0 |
600 | 600 | */ |
601 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
602 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
603 | - $user_info = get_user_by( 'id', $user_id ); |
|
601 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
602 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
603 | + $user_info = get_user_by('id', $user_id); |
|
604 | 604 | $username = $user_info->user_login; |
605 | 605 | } |
606 | 606 | break; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * @param string $username |
615 | 615 | * @param array $tag_args |
616 | 616 | */ |
617 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
617 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
618 | 618 | |
619 | 619 | return $username; |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @return string user_email |
630 | 630 | */ |
631 | -function give_email_tag_user_email( $tag_args ) { |
|
631 | +function give_email_tag_user_email($tag_args) { |
|
632 | 632 | $email = ''; |
633 | 633 | |
634 | 634 | // Backward compatibility. |
635 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
635 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
636 | 636 | |
637 | - switch ( true ) { |
|
638 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
639 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
637 | + switch (true) { |
|
638 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
639 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
640 | 640 | break; |
641 | 641 | |
642 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
643 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
642 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
643 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
644 | 644 | $email = $user_info->user_email; |
645 | 645 | break; |
646 | 646 | |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * |
650 | 650 | * @since 2.0 |
651 | 651 | */ |
652 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
653 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
652 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
653 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
654 | 654 | break; |
655 | 655 | } |
656 | 656 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * @param string $email |
663 | 663 | * @param array $tag_args |
664 | 664 | */ |
665 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
665 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
666 | 666 | |
667 | 667 | return $email; |
668 | 668 | } |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return string billing_address |
678 | 678 | */ |
679 | -function give_email_tag_billing_address( $tag_args ) { |
|
679 | +function give_email_tag_billing_address($tag_args) { |
|
680 | 680 | $address = ''; |
681 | 681 | |
682 | 682 | // Backward compatibility. |
683 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
683 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
684 | 684 | |
685 | - switch ( true ) { |
|
686 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
687 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
688 | - $address = $donation_address['line1'] . "\n"; |
|
685 | + switch (true) { |
|
686 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
687 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
688 | + $address = $donation_address['line1']."\n"; |
|
689 | 689 | |
690 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
691 | - $address .= $donation_address['line2'] . "\n"; |
|
690 | + if ( ! empty($donation_address['line2'])) { |
|
691 | + $address .= $donation_address['line2']."\n"; |
|
692 | 692 | } |
693 | 693 | |
694 | - $address .= $donation_address['city'] . ' ' . $donation_address['zip'] . ' ' . $donation_address['state'] . "\n"; |
|
694 | + $address .= $donation_address['city'].' '.$donation_address['zip'].' '.$donation_address['state']."\n"; |
|
695 | 695 | $address .= $donation_address['country']; |
696 | 696 | break; |
697 | 697 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param string $address |
705 | 705 | * @param array $tag_args |
706 | 706 | */ |
707 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
707 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
708 | 708 | |
709 | 709 | return $address; |
710 | 710 | } |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string $date Post Date. |
720 | 720 | */ |
721 | -function give_email_tag_date( $tag_args ) { |
|
721 | +function give_email_tag_date($tag_args) { |
|
722 | 722 | $date = ''; |
723 | 723 | |
724 | 724 | // Backward compatibility. |
725 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
725 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
726 | 726 | |
727 | - switch ( true ) { |
|
728 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
729 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
727 | + switch (true) { |
|
728 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
729 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
730 | 730 | break; |
731 | 731 | } |
732 | 732 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @param string $date |
739 | 739 | * @param array $tag_args |
740 | 740 | */ |
741 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
741 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
742 | 742 | |
743 | 743 | return $date; |
744 | 744 | } |
@@ -752,16 +752,16 @@ discard block |
||
752 | 752 | * |
753 | 753 | * @return string amount |
754 | 754 | */ |
755 | -function give_email_tag_amount( $tag_args ) { |
|
755 | +function give_email_tag_amount($tag_args) { |
|
756 | 756 | $amount = ''; |
757 | 757 | |
758 | 758 | // Backward compatibility. |
759 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
759 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
760 | 760 | |
761 | - switch ( true ) { |
|
762 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
763 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
764 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
761 | + switch (true) { |
|
762 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
763 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
764 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
765 | 765 | break; |
766 | 766 | } |
767 | 767 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @param string $amount |
774 | 774 | * @param array $tag_args |
775 | 775 | */ |
776 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
776 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
777 | 777 | |
778 | 778 | return $amount; |
779 | 779 | } |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | * |
788 | 788 | * @return string price |
789 | 789 | */ |
790 | -function give_email_tag_price( $tag_args ) { |
|
791 | - return give_email_tag_amount( $tag_args ); |
|
790 | +function give_email_tag_price($tag_args) { |
|
791 | + return give_email_tag_amount($tag_args); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -800,15 +800,15 @@ discard block |
||
800 | 800 | * |
801 | 801 | * @return int payment_id |
802 | 802 | */ |
803 | -function give_email_tag_payment_id( $tag_args ) { |
|
803 | +function give_email_tag_payment_id($tag_args) { |
|
804 | 804 | $payment_id = ''; |
805 | 805 | |
806 | 806 | // Backward compatibility. |
807 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
807 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
808 | 808 | |
809 | - switch ( true ) { |
|
810 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
811 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
809 | + switch (true) { |
|
810 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
811 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
812 | 812 | break; |
813 | 813 | } |
814 | 814 | |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * @param string $payment_id |
821 | 821 | * @param array $tag_args |
822 | 822 | */ |
823 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
823 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -832,15 +832,15 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return string receipt_id |
834 | 834 | */ |
835 | -function give_email_tag_receipt_id( $tag_args ) { |
|
835 | +function give_email_tag_receipt_id($tag_args) { |
|
836 | 836 | $receipt_id = ''; |
837 | 837 | |
838 | 838 | // Backward compatibility. |
839 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
839 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
840 | 840 | |
841 | - switch ( true ) { |
|
842 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
843 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
841 | + switch (true) { |
|
842 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
843 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
844 | 844 | break; |
845 | 845 | } |
846 | 846 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * @param string $receipt_id |
853 | 853 | * @param array $tag_args |
854 | 854 | */ |
855 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
855 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -864,21 +864,21 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return string $form_title |
866 | 866 | */ |
867 | -function give_email_tag_donation( $tag_args ) { |
|
867 | +function give_email_tag_donation($tag_args) { |
|
868 | 868 | $donation_form_title = ''; |
869 | 869 | |
870 | 870 | // Backward compatibility. |
871 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
871 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
872 | 872 | |
873 | - switch ( true ) { |
|
874 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
875 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
873 | + switch (true) { |
|
874 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
875 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
876 | 876 | $separator = $level_title ? '-' : ''; |
877 | 877 | $donation_form_title = strip_tags( |
878 | 878 | give_check_variable( |
879 | 879 | give_get_donation_form_title( |
880 | 880 | $tag_args['payment_id'], |
881 | - array( 'separator' => $separator, ) |
|
881 | + array('separator' => $separator,) |
|
882 | 882 | ), |
883 | 883 | 'empty', |
884 | 884 | '' |
@@ -911,15 +911,15 @@ discard block |
||
911 | 911 | * |
912 | 912 | * @return string $form_title |
913 | 913 | */ |
914 | -function give_email_tag_form_title( $tag_args ) { |
|
914 | +function give_email_tag_form_title($tag_args) { |
|
915 | 915 | $donation_form_title = ''; |
916 | 916 | |
917 | 917 | // Backward compatibility. |
918 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
918 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
919 | 919 | |
920 | - switch ( true ) { |
|
921 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
922 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
920 | + switch (true) { |
|
921 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
922 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
923 | 923 | break; |
924 | 924 | } |
925 | 925 | |
@@ -948,15 +948,15 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @return string $company_name |
950 | 950 | */ |
951 | -function give_email_tag_company_name( $tag_args ) { |
|
951 | +function give_email_tag_company_name($tag_args) { |
|
952 | 952 | $company_name = ''; |
953 | 953 | |
954 | 954 | // Backward compatibility. |
955 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
955 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
956 | 956 | |
957 | - switch ( true ) { |
|
958 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
959 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
957 | + switch (true) { |
|
958 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
959 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
960 | 960 | break; |
961 | 961 | } |
962 | 962 | |
@@ -984,18 +984,18 @@ discard block |
||
984 | 984 | * |
985 | 985 | * @return string gateway |
986 | 986 | */ |
987 | -function give_email_tag_payment_method( $tag_args ) { |
|
987 | +function give_email_tag_payment_method($tag_args) { |
|
988 | 988 | $payment_method = ''; |
989 | 989 | |
990 | 990 | // Backward compatibility. |
991 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
991 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
992 | 992 | |
993 | 993 | // Backward compatibility. |
994 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
994 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
995 | 995 | |
996 | - switch ( true ) { |
|
997 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
998 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
996 | + switch (true) { |
|
997 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
998 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
999 | 999 | break; |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1026,15 +1026,15 @@ discard block |
||
1026 | 1026 | * |
1027 | 1027 | * @return string |
1028 | 1028 | */ |
1029 | -function give_email_tag_payment_total( $tag_args ) { |
|
1029 | +function give_email_tag_payment_total($tag_args) { |
|
1030 | 1030 | $payment_total = ''; |
1031 | 1031 | |
1032 | 1032 | // Backward compatibility. |
1033 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1033 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1034 | 1034 | |
1035 | - switch ( true ) { |
|
1036 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1037 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1035 | + switch (true) { |
|
1036 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1037 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1038 | 1038 | break; |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1062,11 +1062,11 @@ discard block |
||
1062 | 1062 | * |
1063 | 1063 | * @return string |
1064 | 1064 | */ |
1065 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1066 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1065 | +function give_email_tag_sitename($tag_args = array()) { |
|
1066 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1067 | 1067 | |
1068 | 1068 | // Backward compatibility. |
1069 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1069 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * Filter the {sitename} email template tag output. |
@@ -1092,26 +1092,26 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return string receipt_link |
1094 | 1094 | */ |
1095 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1095 | +function give_email_tag_receipt_link($tag_args) { |
|
1096 | 1096 | // Backward compatibility. |
1097 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1097 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1098 | 1098 | |
1099 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1099 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1100 | 1100 | |
1101 | 1101 | // Bailout. |
1102 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1102 | + if (give_get_option('email_template') === 'none') { |
|
1103 | 1103 | return $receipt_url; |
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | - $receipt_url = esc_url( add_query_arg( array( |
|
1108 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1109 | - ), give_get_history_page_uri() ) ); |
|
1107 | + $receipt_url = esc_url(add_query_arg(array( |
|
1108 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1109 | + ), give_get_history_page_uri())); |
|
1110 | 1110 | |
1111 | 1111 | $formatted = sprintf( |
1112 | 1112 | '<a href="%1$s">%2$s</a>', |
1113 | 1113 | $receipt_url, |
1114 | - __( 'View it in your browser »', 'give' ) |
|
1114 | + __('View it in your browser »', 'give') |
|
1115 | 1115 | ); |
1116 | 1116 | |
1117 | 1117 | /** |
@@ -1140,11 +1140,11 @@ discard block |
||
1140 | 1140 | * |
1141 | 1141 | * @return string receipt_url |
1142 | 1142 | */ |
1143 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1143 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1144 | 1144 | // Backward compatibility. |
1145 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1145 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1146 | 1146 | |
1147 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1147 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * Filter the {receipt_link_url} email template tag output. |
@@ -1171,13 +1171,13 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return string |
1173 | 1173 | */ |
1174 | -function give_get_receipt_url( $payment_id ) { |
|
1174 | +function give_get_receipt_url($payment_id) { |
|
1175 | 1175 | $receipt_url = ''; |
1176 | 1176 | |
1177 | - if ( $payment_id ) { |
|
1178 | - $receipt_url = esc_url( add_query_arg( array( |
|
1179 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1180 | - ), give_get_history_page_uri() ) ); |
|
1177 | + if ($payment_id) { |
|
1178 | + $receipt_url = esc_url(add_query_arg(array( |
|
1179 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1180 | + ), give_get_history_page_uri())); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | return $receipt_url; |
@@ -1193,22 +1193,22 @@ discard block |
||
1193 | 1193 | * |
1194 | 1194 | * @return string |
1195 | 1195 | */ |
1196 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1196 | +function give_email_tag_email_access_link($tag_args) { |
|
1197 | 1197 | $donor_id = 0; |
1198 | 1198 | $donor = array(); |
1199 | 1199 | $email_access_link = ''; |
1200 | 1200 | |
1201 | 1201 | // Backward compatibility. |
1202 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1202 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1203 | 1203 | |
1204 | - switch ( true ) { |
|
1205 | - case ! empty( $tag_args['donor_id'] ): |
|
1204 | + switch (true) { |
|
1205 | + case ! empty($tag_args['donor_id']): |
|
1206 | 1206 | $donor_id = $tag_args['donor_id']; |
1207 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1207 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1208 | 1208 | break; |
1209 | 1209 | |
1210 | - case ! empty( $tag_args['user_id'] ): |
|
1211 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1210 | + case ! empty($tag_args['user_id']): |
|
1211 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1212 | 1212 | $donor_id = $donor->id; |
1213 | 1213 | break; |
1214 | 1214 | |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | // Set email access link if donor exist. |
1220 | - if ( $donor_id ) { |
|
1221 | - $verify_key = wp_generate_password( 20, false ); |
|
1220 | + if ($donor_id) { |
|
1221 | + $verify_key = wp_generate_password(20, false); |
|
1222 | 1222 | |
1223 | 1223 | // Generate a new verify key |
1224 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1224 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1225 | 1225 | // update verify key in email tags. |
1226 | 1226 | $tag_args['verify_key'] = $verify_key; |
1227 | 1227 | |
@@ -1236,28 +1236,28 @@ discard block |
||
1236 | 1236 | ); |
1237 | 1237 | |
1238 | 1238 | // Add Payment Key to email access url, if it exists. |
1239 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1239 | + if ( ! empty($_GET['payment_key'])) { |
|
1240 | 1240 | $access_url = add_query_arg( |
1241 | 1241 | array( |
1242 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1242 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1243 | 1243 | ), |
1244 | 1244 | $access_url |
1245 | 1245 | ); |
1246 | 1246 | } |
1247 | 1247 | |
1248 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1248 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1249 | 1249 | $email_access_link = sprintf( |
1250 | 1250 | '<a href="%1$s" target="_blank">%2$s</a>', |
1251 | - esc_url( $access_url ), |
|
1252 | - __( 'View your donation history »', 'give' ) |
|
1251 | + esc_url($access_url), |
|
1252 | + __('View your donation history »', 'give') |
|
1253 | 1253 | ); |
1254 | 1254 | |
1255 | 1255 | } else { |
1256 | 1256 | |
1257 | 1257 | $email_access_link = sprintf( |
1258 | 1258 | '%1$s: %2$s', |
1259 | - __( 'View your donation history', 'give' ), |
|
1260 | - esc_url( $access_url ) |
|
1259 | + __('View your donation history', 'give'), |
|
1260 | + esc_url($access_url) |
|
1261 | 1261 | ); |
1262 | 1262 | } |
1263 | 1263 | } |
@@ -1289,23 +1289,23 @@ discard block |
||
1289 | 1289 | * |
1290 | 1290 | * @return array |
1291 | 1291 | */ |
1292 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1293 | - if ( ! is_array( $tag_args ) ) { |
|
1294 | - switch ( true ) { |
|
1295 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1296 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1292 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1293 | + if ( ! is_array($tag_args)) { |
|
1294 | + switch (true) { |
|
1295 | + case ('give_payment' === get_post_type($tag_args)): |
|
1296 | + $tag_args = array('payment_id' => $tag_args); |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1300 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1299 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1300 | + $tag_args = array('user_id' => $tag_args); |
|
1301 | 1301 | break; |
1302 | 1302 | |
1303 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1304 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1303 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1304 | + $tag_args = array('donor_id' => $tag_args); |
|
1305 | 1305 | break; |
1306 | 1306 | |
1307 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1308 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1307 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1308 | + $tag_args = array('user_id' => $tag_args); |
|
1309 | 1309 | break; |
1310 | 1310 | } |
1311 | 1311 | } |
@@ -1323,36 +1323,36 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @return array |
1325 | 1325 | */ |
1326 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1326 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1327 | 1327 | |
1328 | 1328 | $reset_password_url = ''; |
1329 | 1329 | |
1330 | - switch ( true ) { |
|
1331 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1332 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1330 | + switch (true) { |
|
1331 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1332 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1333 | 1333 | break; |
1334 | 1334 | |
1335 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1336 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1335 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1336 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1337 | 1337 | break; |
1338 | 1338 | |
1339 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1340 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1339 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1340 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1341 | 1341 | break; |
1342 | 1342 | } |
1343 | 1343 | |
1344 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1344 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1345 | 1345 | // Generate link, if Email content type is html. |
1346 | 1346 | $reset_password_link = sprintf( |
1347 | 1347 | '<a href="%1$s" target="_blank">%2$s</a>', |
1348 | - esc_url( $reset_password_url ), |
|
1349 | - __( 'Reset your password »', 'give' ) |
|
1348 | + esc_url($reset_password_url), |
|
1349 | + __('Reset your password »', 'give') |
|
1350 | 1350 | ); |
1351 | 1351 | } else { |
1352 | 1352 | $reset_password_link = sprintf( |
1353 | 1353 | '%1$s: %2$s', |
1354 | - __( 'Reset your password', 'give' ), |
|
1355 | - esc_url( $reset_password_url ) |
|
1354 | + __('Reset your password', 'give'), |
|
1355 | + esc_url($reset_password_url) |
|
1356 | 1356 | ); |
1357 | 1357 | } |
1358 | 1358 | |
@@ -1381,21 +1381,21 @@ discard block |
||
1381 | 1381 | * |
1382 | 1382 | * @return mixed|string |
1383 | 1383 | */ |
1384 | -function give_get_reset_password_url( $user_id ) { |
|
1384 | +function give_get_reset_password_url($user_id) { |
|
1385 | 1385 | $reset_password_url = ''; |
1386 | 1386 | |
1387 | 1387 | // Proceed further only, if user_id exists. |
1388 | - if ( $user_id ) { |
|
1388 | + if ($user_id) { |
|
1389 | 1389 | |
1390 | 1390 | // Get User Object Details. |
1391 | - $user = get_user_by( 'ID', $user_id ); |
|
1391 | + $user = get_user_by('ID', $user_id); |
|
1392 | 1392 | |
1393 | 1393 | // Prepare Reset Password URL. |
1394 | - $reset_password_url = esc_url( add_query_arg( array( |
|
1394 | + $reset_password_url = esc_url(add_query_arg(array( |
|
1395 | 1395 | 'action' => 'rp', |
1396 | - 'key' => get_password_reset_key( $user ), |
|
1396 | + 'key' => get_password_reset_key($user), |
|
1397 | 1397 | 'login' => $user->user_login, |
1398 | - ), wp_login_url() ) ); |
|
1398 | + ), wp_login_url())); |
|
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | return $reset_password_url; |
@@ -1414,94 +1414,94 @@ discard block |
||
1414 | 1414 | * |
1415 | 1415 | * @return mixed |
1416 | 1416 | */ |
1417 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1418 | - preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches ); |
|
1417 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1418 | + preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches); |
|
1419 | 1419 | |
1420 | - if ( ! empty( $matches[0] ) ) { |
|
1420 | + if ( ! empty($matches[0])) { |
|
1421 | 1421 | $search = $replace = array(); |
1422 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1423 | - if ( in_array( $meta_tag, $search ) ) { |
|
1422 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1423 | + if (in_array($meta_tag, $search)) { |
|
1424 | 1424 | continue; |
1425 | 1425 | } |
1426 | 1426 | |
1427 | 1427 | $search[] = $meta_tag; |
1428 | 1428 | |
1429 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1430 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1431 | - $meta_tag = current( $meta_tag_arr ); |
|
1429 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1430 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1431 | + $meta_tag = current($meta_tag_arr); |
|
1432 | 1432 | |
1433 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1434 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1435 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1433 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1434 | + $type = current(explode('_', $meta_tag, 2)); |
|
1435 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1436 | 1436 | |
1437 | - switch ( $type ) { |
|
1437 | + switch ($type) { |
|
1438 | 1438 | case 'donation': |
1439 | 1439 | |
1440 | 1440 | //Bailout. |
1441 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1441 | + if ( ! isset($tag_args['payment_id'])) { |
|
1442 | 1442 | $replace[] = ''; |
1443 | 1443 | continue; |
1444 | 1444 | } |
1445 | 1445 | |
1446 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1446 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1447 | 1447 | |
1448 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1448 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1449 | 1449 | $replace[] = $meta_data; |
1450 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1451 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1450 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1451 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | break; |
1455 | 1455 | |
1456 | 1456 | case 'form': |
1457 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1457 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1458 | 1458 | |
1459 | 1459 | // Bailout. |
1460 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1461 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1460 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1461 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1465 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1464 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1465 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1466 | 1466 | $replace[] = $meta_data; |
1467 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1468 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1467 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1468 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1469 | 1469 | } |
1470 | 1470 | break; |
1471 | 1471 | |
1472 | 1472 | case 'donor': |
1473 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1473 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1474 | 1474 | |
1475 | 1475 | // Bailout. |
1476 | - if ( ! $donor_id ) { |
|
1477 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1478 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1479 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1480 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1476 | + if ( ! $donor_id) { |
|
1477 | + if (isset($tag_args['payment_id'])) { |
|
1478 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1479 | + } elseif (isset($tag_args['user_id'])) { |
|
1480 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1481 | 1481 | } |
1482 | 1482 | } |
1483 | 1483 | |
1484 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1484 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1485 | 1485 | |
1486 | - if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1487 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1486 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1487 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1490 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1491 | 1491 | $replace[] = $meta_data; |
1492 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1493 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1492 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1493 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | break; |
1497 | 1497 | |
1498 | 1498 | default: |
1499 | - $replace[] = end( $search ); |
|
1499 | + $replace[] = end($search); |
|
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | |
1503 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1504 | - $content = str_replace( $search, $replace, $content ); |
|
1503 | + if ( ! empty($search) && ! empty($replace)) { |
|
1504 | + $content = str_replace($search, $replace, $content); |
|
1505 | 1505 | } |
1506 | 1506 | } |
1507 | 1507 | |
@@ -1509,4 +1509,4 @@ discard block |
||
1509 | 1509 | return $content; |
1510 | 1510 | } |
1511 | 1511 | |
1512 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1512 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @return Give |
262 | 262 | */ |
263 | 263 | public static function instance() { |
264 | - if ( is_null( self::$_instance ) ) { |
|
264 | + if (is_null(self::$_instance)) { |
|
265 | 265 | self::$_instance = new self(); |
266 | 266 | } |
267 | 267 | |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function __construct() { |
275 | 275 | // PHP version |
276 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
277 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
276 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
277 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // Bailout: Need minimum php version to load plugin. |
281 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
282 | - add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) ); |
|
281 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
282 | + add_action('admin_notices', array($this, 'minimum_phpversion_notice')); |
|
283 | 283 | |
284 | 284 | return; |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $this->includes(); |
289 | 289 | $this->init_hooks(); |
290 | 290 | |
291 | - do_action( 'give_loaded' ); |
|
291 | + do_action('give_loaded'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | * @since 1.8.9 |
298 | 298 | */ |
299 | 299 | private function init_hooks() { |
300 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
301 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
300 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
301 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
302 | 302 | |
303 | 303 | // Set up localization on init Hook. |
304 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
304 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @since 1.8.9 |
319 | 319 | */ |
320 | - do_action( 'before_give_init' ); |
|
320 | + do_action('before_give_init'); |
|
321 | 321 | |
322 | 322 | // Set up localization. |
323 | 323 | $this->load_textdomain(); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @since 1.8.7 |
352 | 352 | */ |
353 | - do_action( 'give_init', $this ); |
|
353 | + do_action('give_init', $this); |
|
354 | 354 | |
355 | 355 | } |
356 | 356 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function __clone() { |
369 | 369 | // Cloning instances of the class is forbidden. |
370 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
370 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function __wakeup() { |
382 | 382 | // Unserializing instances of the class is forbidden. |
383 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
383 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -394,33 +394,33 @@ discard block |
||
394 | 394 | private function setup_constants() { |
395 | 395 | |
396 | 396 | // Plugin version |
397 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
398 | - define( 'GIVE_VERSION', '2.1.3' ); |
|
397 | + if ( ! defined('GIVE_VERSION')) { |
|
398 | + define('GIVE_VERSION', '2.1.3'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // Plugin Root File |
402 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
403 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
402 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
403 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // Plugin Folder Path |
407 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
408 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
407 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
408 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | // Plugin Folder URL |
412 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
413 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
412 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
413 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | // Plugin Basename aka: "give/give.php" |
417 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
418 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
417 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
418 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | // Make sure CAL_GREGORIAN is defined |
422 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
423 | - define( 'CAL_GREGORIAN', 1 ); |
|
422 | + if ( ! defined('CAL_GREGORIAN')) { |
|
423 | + define('CAL_GREGORIAN', 1); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
@@ -438,160 +438,160 @@ discard block |
||
438 | 438 | /** |
439 | 439 | * Load libraries. |
440 | 440 | */ |
441 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
442 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
441 | + if ( ! class_exists('WP_Async_Request')) { |
|
442 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
443 | 443 | } |
444 | 444 | |
445 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
446 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
445 | + if ( ! class_exists('WP_Background_Process')) { |
|
446 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Load plugin files |
451 | 451 | */ |
452 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
453 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
454 | 454 | $give_options = give_get_settings(); |
455 | 455 | |
456 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
457 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
461 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
464 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
465 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
469 | - |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
475 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
476 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
477 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php'; |
|
488 | - |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
490 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
491 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
503 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
506 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
507 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
508 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
509 | - |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php'; |
|
517 | - |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
523 | - |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
530 | - |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
533 | - |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
535 | - |
|
536 | - require_once GIVE_PLUGIN_DIR . 'blocks/load.php'; |
|
537 | - |
|
538 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
456 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
469 | + |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
475 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php'; |
|
488 | + |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
490 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
491 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
503 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
506 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
507 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
508 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
509 | + |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php'; |
|
517 | + |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
523 | + |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
530 | + |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
533 | + |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
535 | + |
|
536 | + require_once GIVE_PLUGIN_DIR.'blocks/load.php'; |
|
537 | + |
|
538 | + if (defined('WP_CLI') && WP_CLI) { |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
540 | 540 | } |
541 | 541 | |
542 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
543 | - |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
554 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
555 | - |
|
556 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
557 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
558 | - |
|
559 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
560 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
561 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
562 | - |
|
563 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
564 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
565 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
566 | - |
|
567 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
568 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
569 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
570 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
571 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php'; |
|
572 | - |
|
573 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
574 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
575 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
576 | - |
|
577 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
578 | - |
|
579 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
580 | - |
|
581 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
582 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
583 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
584 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
585 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
586 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
587 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
588 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
589 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
590 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
591 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
542 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
543 | + |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
554 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
555 | + |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
558 | + |
|
559 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
560 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
561 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
562 | + |
|
563 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
564 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
565 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
566 | + |
|
567 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
568 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
569 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
570 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
571 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php'; |
|
572 | + |
|
573 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
574 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
575 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
576 | + |
|
577 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
578 | + |
|
579 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
580 | + |
|
581 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
582 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
583 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
584 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
585 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
586 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
587 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
588 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
589 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
590 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
591 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
592 | 592 | }// End if(). |
593 | 593 | |
594 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
594 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
595 | 595 | |
596 | 596 | } |
597 | 597 | |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | public function load_textdomain() { |
607 | 607 | |
608 | 608 | // Set filter for Give's languages directory |
609 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
610 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
609 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
610 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
611 | 611 | |
612 | 612 | // Traditional WordPress plugin locale filter. |
613 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
614 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
613 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
614 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
615 | 615 | |
616 | - unload_textdomain( 'give' ); |
|
617 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
618 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
616 | + unload_textdomain('give'); |
|
617 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
618 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
619 | 619 | |
620 | 620 | } |
621 | 621 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | */ |
629 | 629 | public function minimum_phpversion_notice() { |
630 | 630 | // Bailout. |
631 | - if ( ! is_admin() ) { |
|
631 | + if ( ! is_admin()) { |
|
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
636 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
637 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
638 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
639 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
640 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
641 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
635 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
636 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
637 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
638 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
639 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
640 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
641 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
642 | 642 | |
643 | 643 | echo sprintf( |
644 | 644 | '<div class="notice notice-error">%1$s</div>', |
645 | - wp_kses_post( $notice_desc ) |
|
645 | + wp_kses_post($notice_desc) |
|
646 | 646 | ); |
647 | 647 | } |
648 | 648 |
@@ -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,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; |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | // Sanity check - ensure form has pass all condition to show goal. |
10 | 10 | if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) ) |
11 | - || empty( $form->ID ) |
|
12 | - || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | - || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
11 | + || empty( $form->ID ) |
|
12 | + || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | + || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
14 | 14 | return false; |
15 | 15 | } |
16 | 16 | |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */ |
98 | 98 | __( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) ); |
99 | 99 | |
100 | - elseif ( 'percentage' === $goal_format ) : |
|
100 | + elseif ( 'percentage' === $goal_format ) : |
|
101 | 101 | |
102 | 102 | echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */ |
103 | 103 | __( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) ); |
104 | 104 | |
105 | - elseif ( 'donation' === $goal_format ) : |
|
105 | + elseif ( 'donation' === $goal_format ) : |
|
106 | 106 | |
107 | 107 | echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */ |
108 | 108 | _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal ); |
109 | 109 | |
110 | - elseif ( 'donors' === $goal_format ) : |
|
110 | + elseif ( 'donors' === $goal_format ) : |
|
111 | 111 | |
112 | 112 | echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */ |
113 | 113 | _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal ); |
@@ -3,46 +3,46 @@ discard block |
||
3 | 3 | * This template is used to display the goal with [give_goal] |
4 | 4 | */ |
5 | 5 | |
6 | -$form = new Give_Donate_Form( $form_id ); |
|
7 | -$goal_option = give_get_meta( $form->ID, '_give_goal_option', true ); |
|
6 | +$form = new Give_Donate_Form($form_id); |
|
7 | +$goal_option = give_get_meta($form->ID, '_give_goal_option', true); |
|
8 | 8 | |
9 | 9 | // Sanity check - ensure form has pass all condition to show goal. |
10 | -if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) ) |
|
11 | - || empty( $form->ID ) |
|
12 | - || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | - || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
10 | +if ((isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN)) |
|
11 | + || empty($form->ID) |
|
12 | + || (is_singular('give_forms') && ! give_is_setting_enabled($goal_option)) |
|
13 | + || ! give_is_setting_enabled($goal_option) || 0 === $form->goal) { |
|
14 | 14 | return false; |
15 | 15 | } |
16 | 16 | |
17 | -$goal_format = give_get_form_goal_format( $form_id ); |
|
18 | -$price = give_get_meta( $form_id, '_give_set_price', true ); |
|
19 | -$color = give_get_meta( $form_id, '_give_goal_color', true ); |
|
20 | -$show_text = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
21 | -$show_bar = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
22 | -$goal_progress_stats = give_goal_progress_stats( $form ); |
|
17 | +$goal_format = give_get_form_goal_format($form_id); |
|
18 | +$price = give_get_meta($form_id, '_give_set_price', true); |
|
19 | +$color = give_get_meta($form_id, '_give_goal_color', true); |
|
20 | +$show_text = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
21 | +$show_bar = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
22 | +$goal_progress_stats = give_goal_progress_stats($form); |
|
23 | 23 | |
24 | 24 | $income = $goal_progress_stats['raw_actual']; |
25 | 25 | $goal = $goal_progress_stats['raw_goal']; |
26 | 26 | |
27 | -switch ( $goal_format ) { |
|
27 | +switch ($goal_format) { |
|
28 | 28 | |
29 | 29 | case 'donation': |
30 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
30 | + $progress = round(($income / $goal) * 100, 2); |
|
31 | 31 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
32 | 32 | break; |
33 | 33 | |
34 | 34 | case 'donors': |
35 | - $progress_bar_value = round( ( $income / $goal ) * 100, 2 ); |
|
35 | + $progress_bar_value = round(($income / $goal) * 100, 2); |
|
36 | 36 | $progress = $progress_bar_value; |
37 | 37 | break; |
38 | 38 | |
39 | 39 | case 'percentage': |
40 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
40 | + $progress = round(($income / $goal) * 100, 2); |
|
41 | 41 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
42 | 42 | break; |
43 | 43 | |
44 | 44 | default: |
45 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
45 | + $progress = round(($income / $goal) * 100, 2); |
|
46 | 46 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
47 | 47 | break; |
48 | 48 | |
@@ -53,64 +53,64 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @since 1.8.8 |
55 | 55 | */ |
56 | -$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form_id, $form ); |
|
56 | +$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form_id, $form); |
|
57 | 57 | ?> |
58 | 58 | <div class="give-goal-progress"> |
59 | - <?php if ( ! empty( $show_text ) ) : ?> |
|
59 | + <?php if ( ! empty($show_text)) : ?> |
|
60 | 60 | <div class="raised"> |
61 | 61 | <?php |
62 | - if ( 'amount' === $goal_format ) : |
|
62 | + if ('amount' === $goal_format) : |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Filter the give currency. |
66 | 66 | * |
67 | 67 | * @since 1.8.17 |
68 | 68 | */ |
69 | - $form_currency = apply_filters( 'give_goal_form_currency', give_get_currency( $form_id ), $form_id ); |
|
69 | + $form_currency = apply_filters('give_goal_form_currency', give_get_currency($form_id), $form_id); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Filter the income formatting arguments. |
73 | 73 | * |
74 | 74 | * @since 1.8.17 |
75 | 75 | */ |
76 | - $income_format_args = apply_filters( 'give_goal_income_format_args', array( |
|
76 | + $income_format_args = apply_filters('give_goal_income_format_args', array( |
|
77 | 77 | 'sanitize' => false, |
78 | 78 | 'currency' => $form_currency, |
79 | 79 | 'decimal' => false, |
80 | - ), $form_id ); |
|
80 | + ), $form_id); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Filter the goal formatting arguments. |
84 | 84 | * |
85 | 85 | * @since 1.8.17 |
86 | 86 | */ |
87 | - $goal_format_args = apply_filters( 'give_goal_amount_format_args', array( |
|
87 | + $goal_format_args = apply_filters('give_goal_amount_format_args', array( |
|
88 | 88 | 'sanitize' => false, |
89 | 89 | 'currency' => $form_currency, |
90 | 90 | 'decimal' => false, |
91 | - ), $form_id ); |
|
91 | + ), $form_id); |
|
92 | 92 | |
93 | 93 | // Get formatted amount. |
94 | - $income = give_human_format_large_amount( give_format_amount( $income, $income_format_args ), array( 'currency' => $form_currency ) ); |
|
95 | - $goal = give_human_format_large_amount( give_format_amount( $goal, $goal_format_args ), array( 'currency' => $form_currency ) ); |
|
94 | + $income = give_human_format_large_amount(give_format_amount($income, $income_format_args), array('currency' => $form_currency)); |
|
95 | + $goal = give_human_format_large_amount(give_format_amount($goal, $goal_format_args), array('currency' => $form_currency)); |
|
96 | 96 | |
97 | 97 | echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */ |
98 | - __( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) ); |
|
98 | + __('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give'), give_currency_filter($income, array('form_id' => $form_id)), give_currency_filter($goal, array('form_id' => $form_id)) ); |
|
99 | 99 | |
100 | - elseif ( 'percentage' === $goal_format ) : |
|
100 | + elseif ('percentage' === $goal_format) : |
|
101 | 101 | |
102 | 102 | echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */ |
103 | - __( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) ); |
|
103 | + __('<span class="give-percentage">%s%%</span> funded', 'give'), round($progress) ); |
|
104 | 104 | |
105 | - elseif ( 'donation' === $goal_format ) : |
|
105 | + elseif ('donation' === $goal_format) : |
|
106 | 106 | |
107 | 107 | echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */ |
108 | - _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal ); |
|
108 | + _n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give'), $income, $goal ); |
|
109 | 109 | |
110 | - elseif ( 'donors' === $goal_format ) : |
|
110 | + elseif ('donors' === $goal_format) : |
|
111 | 111 | |
112 | 112 | echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */ |
113 | - _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal ); |
|
113 | + _n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give'), $income, $goal ); |
|
114 | 114 | |
115 | 115 | endif; |
116 | 116 | ?> |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | <?php endif; ?> |
119 | 119 | |
120 | 120 | |
121 | - <?php if ( ! empty( $show_bar ) ) : ?> |
|
121 | + <?php if ( ! empty($show_bar)) : ?> |
|
122 | 122 | <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" |
123 | - aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>"> |
|
124 | - <span style="width: <?php echo esc_attr( $progress_bar_value ); ?>%;<?php if ( ! empty( $color ) ) { |
|
125 | - echo 'background-color:' . $color; |
|
123 | + aria-valuenow="<?php echo esc_attr($progress_bar_value); ?>"> |
|
124 | + <span style="width: <?php echo esc_attr($progress_bar_value); ?>%;<?php if ( ! empty($color)) { |
|
125 | + echo 'background-color:'.$color; |
|
126 | 126 | } ?>"></span> |
127 | 127 | </div><!-- /.give-progress-bar --> |
128 | 128 | <?php endif; ?> |
@@ -9,17 +9,17 @@ discard block |
||
9 | 9 | global $give_access_form_outputted; |
10 | 10 | |
11 | 11 | // Only output the form once. |
12 | -if ( $give_access_form_outputted ) { |
|
12 | +if ($give_access_form_outputted) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | -$recaptcha_key = give_get_option( 'recaptcha_key' ); |
|
17 | -$recaptcha_secret = give_get_option( 'recaptcha_secret' ); |
|
16 | +$recaptcha_key = give_get_option('recaptcha_key'); |
|
17 | +$recaptcha_secret = give_get_option('recaptcha_secret'); |
|
18 | 18 | |
19 | -$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false; |
|
19 | +$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false; |
|
20 | 20 | |
21 | 21 | // Email already sent? |
22 | -if ( isset( $_POST['email-access-sent'] ) ) { |
|
22 | +if (isset($_POST['email-access-sent'])) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Filter to modify access mail send notice |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return string $message Send notice message for email access. |
32 | 32 | */ |
33 | - $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) ); |
|
33 | + $message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give')); |
|
34 | 34 | |
35 | 35 | Give()->notices->print_frontend_notice( |
36 | 36 | $message, |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ); |
40 | 40 | |
41 | 41 | return; |
42 | -} elseif ( isset( $_POST['email-access-exhausted'] ) ) { |
|
42 | +} elseif (isset($_POST['email-access-exhausted'])) { |
|
43 | 43 | |
44 | 44 | $value = Give()->email_access->verify_throttle / 60; |
45 | 45 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | $message = (string) apply_filters( |
57 | 57 | 'give_email_access_requests_exceed_notice', |
58 | 58 | sprintf( |
59 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
60 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
59 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
60 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
61 | 61 | ), |
62 | 62 | $value |
63 | 63 | ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.8.17 |
80 | 80 | */ |
81 | -do_action( 'give_email_access_form_login' ); |
|
81 | +do_action('give_email_access_form_login'); |
|
82 | 82 | |
83 | 83 | // Print any other messages & errors. |
84 | 84 | Give()->notices->render_frontend_notices(); |
@@ -97,20 +97,20 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return string $message email access welcome message |
99 | 99 | */ |
100 | - echo esc_html( apply_filters( 'give_email_access_welcome_message', __( 'Please verify your email to access your donation history.', 'give' ) ) ); |
|
100 | + echo esc_html(apply_filters('give_email_access_welcome_message', __('Please verify your email to access your donation history.', 'give'))); |
|
101 | 101 | ?> |
102 | 102 | </p> |
103 | 103 | |
104 | - <label for="give-email"><?php esc_attr_e( 'Donation Email:', 'give' ); ?></label> |
|
104 | + <label for="give-email"><?php esc_attr_e('Donation Email:', 'give'); ?></label> |
|
105 | 105 | <input id="give-email" type="email" name="give_email" value="" |
106 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"/> |
|
107 | - <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>"/> |
|
106 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"/> |
|
107 | + <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>"/> |
|
108 | 108 | <input type="hidden" name="give_action" value="email_access_form_login"/> |
109 | 109 | <input type="hidden" name="give_access_page" value="<?php the_ID(); ?>"/> |
110 | 110 | |
111 | 111 | <?php |
112 | 112 | // Enable reCAPTCHA? |
113 | - if ( $enable_recaptcha ) : |
|
113 | + if ($enable_recaptcha) : |
|
114 | 114 | ?> |
115 | 115 | <script> |
116 | 116 | // IP verify for reCAPTCHA. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | <input type="hidden" name="give_ip" class="give_ip" value=""/> |
129 | 129 | <?php endif; ?> |
130 | 130 | |
131 | - <input type="submit" class="give-submit" value="<?php esc_attr_e( 'Verify Email', 'give' ); ?>"/> |
|
131 | + <input type="submit" class="give-submit" value="<?php esc_attr_e('Verify Email', 'give'); ?>"/> |
|
132 | 132 | </form> |
133 | 133 | </div> |
134 | 134 | <?php |