@@ -175,10 +175,10 @@ |
||
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | 177 | $message = sprintf( |
178 | - __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | - get_bloginfo( 'url' ), |
|
180 | - get_bloginfo( 'admin_email' ) |
|
181 | - ) . "\n\n"; |
|
178 | + __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | + get_bloginfo( 'url' ), |
|
180 | + get_bloginfo( 'admin_email' ) |
|
181 | + ) . "\n\n"; |
|
182 | 182 | $message .= '{email_access_link}' . "\n\n"; |
183 | 183 | $message .= "\n\n"; |
184 | 184 | $message .= __( 'Sincerely,', 'give' ) . "\n"; |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if access directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Email_Access_Email' ) ) : |
|
18 | +if ( ! class_exists('Give_Email_Access_Email')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Email_Access_Email |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'email-access', |
36 | - 'label' => __( 'Email access', 'give' ), |
|
37 | - 'description' => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ), |
|
38 | - 'notification_status' => give_get_option( 'email_access', 'disabled' ), |
|
36 | + 'label' => __('Email access', 'give'), |
|
37 | + 'description' => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'), |
|
38 | + 'notification_status' => give_get_option('email_access', 'disabled'), |
|
39 | 39 | 'form_metabox_setting' => false, |
40 | 40 | 'notification_status_editable' => false, |
41 | 41 | 'email_tag_context' => 'donor', |
42 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
43 | - 'default_email_subject' => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ), |
|
42 | + 'recipient_group_name' => __('Donor', 'give'), |
|
43 | + 'default_email_subject' => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')), |
|
44 | 44 | 'default_email_message' => $this->get_default_email_message(), |
45 | - 'default_email_header' => __( 'Confirm Email', 'give' ), |
|
45 | + 'default_email_header' => __('Confirm Email', 'give'), |
|
46 | 46 | 'notices' => array( |
47 | 47 | 'non-notification-status-editable' => sprintf( |
48 | 48 | '%1$s <a href="%2$s">%3$s »</a>', |
49 | - __( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ), |
|
50 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control') ), |
|
51 | - __( 'Edit Setting', 'give' ) |
|
49 | + __('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'), |
|
50 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control')), |
|
51 | + __('Edit Setting', 'give') |
|
52 | 52 | ) |
53 | 53 | ), |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | |
56 | - add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 ); |
|
57 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
58 | - add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 ); |
|
56 | + add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2); |
|
57 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
58 | + add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - public function get_email_subject( $form_id = null ) { |
|
71 | + public function get_email_subject($form_id = null) { |
|
72 | 72 | $subject = wp_strip_all_tags( |
73 | 73 | Give_Email_Notification_Util::get_value( |
74 | 74 | $this, |
75 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
75 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
76 | 76 | $form_id, |
77 | 77 | $this->config['default_email_subject'] |
78 | 78 | ) |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @since 1.0 |
86 | 86 | */ |
87 | - $subject = apply_filters( 'give_email_access_token_subject', $subject ); |
|
87 | + $subject = apply_filters('give_email_access_token_subject', $subject); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Filters the donation notification subject. |
91 | 91 | * |
92 | 92 | * @since 2.0 |
93 | 93 | */ |
94 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
94 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
95 | 95 | |
96 | 96 | return $subject; |
97 | 97 | } |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function get_email_message( $form_id = null ) { |
|
110 | + public function get_email_message($form_id = null) { |
|
111 | 111 | $message = Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_message'] |
116 | 116 | ); |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @since 1.0 |
123 | 123 | */ |
124 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
124 | + $message = apply_filters('give_email_access_token_message', $message); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter the email message |
128 | 128 | * |
129 | 129 | * @since 2.0 |
130 | 130 | */ |
131 | - $message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id ); |
|
131 | + $message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id); |
|
132 | 132 | |
133 | 133 | return $message; |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param int $form_id |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public function get_email_attachments( $form_id = null ) { |
|
146 | + public function get_email_attachments($form_id = null) { |
|
147 | 147 | /** |
148 | 148 | * Filters the donation notification email attachments. |
149 | 149 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array() ); |
|
154 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array()); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Filters the donation notification email attachments. |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 2.0 |
161 | 161 | */ |
162 | - $attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id ); |
|
162 | + $attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id); |
|
163 | 163 | |
164 | 164 | return $attachments; |
165 | 165 | } |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | 177 | $message = sprintf( |
178 | - __( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ), |
|
179 | - get_bloginfo( 'url' ), |
|
180 | - get_bloginfo( 'admin_email' ) |
|
181 | - ) . "\n\n"; |
|
182 | - $message .= '{email_access_link}' . "\n\n"; |
|
178 | + __('Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give'), |
|
179 | + get_bloginfo('url'), |
|
180 | + get_bloginfo('admin_email') |
|
181 | + )."\n\n"; |
|
182 | + $message .= '{email_access_link}'."\n\n"; |
|
183 | 183 | $message .= "\n\n"; |
184 | - $message .= __( 'Sincerely,', 'give' ) . "\n"; |
|
185 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
184 | + $message .= __('Sincerely,', 'give')."\n"; |
|
185 | + $message .= get_bloginfo('name')."\n"; |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filter the new donation email message |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @param string $message |
193 | 193 | */ |
194 | - return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this ); |
|
194 | + return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @since 1.0 |
209 | 209 | */ |
210 | - $from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() ); |
|
210 | + $from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name()); |
|
211 | 211 | |
212 | 212 | /** |
213 | 213 | * Filters the from email. |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @since 1.0 |
217 | 217 | */ |
218 | - $from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() ); |
|
218 | + $from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address()); |
|
219 | 219 | |
220 | - Give()->emails->__set( 'from_name', $from_name ); |
|
221 | - Give()->emails->__set( 'from_email', $from_email ); |
|
222 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', $this->get_email_header() ) ); |
|
220 | + Give()->emails->__set('from_name', $from_name); |
|
221 | + Give()->emails->__set('from_email', $from_email); |
|
222 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', $this->get_email_header())); |
|
223 | 223 | /** |
224 | 224 | * Filters the donation notification email headers. |
225 | 225 | * |
226 | 226 | * @since 1.0 |
227 | 227 | */ |
228 | - $headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() ); |
|
228 | + $headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers()); |
|
229 | 229 | |
230 | - Give()->emails->__set( 'headers', $headers ); |
|
230 | + Give()->emails->__set('headers', $headers); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return bool |
243 | 243 | */ |
244 | - public function setup_email_notification( $donor_id, $email ) { |
|
245 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
244 | + public function setup_email_notification($donor_id, $email) { |
|
245 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
246 | 246 | $this->recipient_email = $email; |
247 | 247 | |
248 | 248 | // Set email data. |
@@ -267,17 +267,17 @@ discard block |
||
267 | 267 | * @param $update_options |
268 | 268 | * @param $option_name |
269 | 269 | */ |
270 | - public function set_notification_status( $update_options, $option_name ) { |
|
270 | + public function set_notification_status($update_options, $option_name) { |
|
271 | 271 | // Get updated settings. |
272 | 272 | $update_options = give_get_settings(); |
273 | 273 | |
274 | 274 | if ( |
275 | - ! empty( $update_options['email_access'] ) |
|
276 | - && ! empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
277 | - && $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ] |
|
275 | + ! empty($update_options['email_access']) |
|
276 | + && ! empty($update_options["{$this->config['id']}_notification"]) |
|
277 | + && $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"] |
|
278 | 278 | ) { |
279 | - $update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access']; |
|
280 | - update_option( $option_name, $update_options ); |
|
279 | + $update_options["{$this->config['id']}_notification"] = $update_options['email_access']; |
|
280 | + update_option($option_name, $update_options); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | * @param Give_Email_Access_Email $email |
293 | 293 | * @return string |
294 | 294 | */ |
295 | - public function email_preview_header( $email_preview_header, $email ) { |
|
296 | - if( $this->config['id'] === $email->config['id'] ) { |
|
295 | + public function email_preview_header($email_preview_header, $email) { |
|
296 | + if ($this->config['id'] === $email->config['id']) { |
|
297 | 297 | $email_preview_header = ''; |
298 | 298 | } |
299 | 299 |
@@ -16,12 +16,12 @@ |
||
16 | 16 | * @since 2.0 |
17 | 17 | */ |
18 | 18 | function give_set_notification_status_handler() { |
19 | - $notification_id = isset( $_POST['notification_id'] ) ? give_clean( $_POST['notification_id'] ) : ''; |
|
20 | - if ( ! empty( $notification_id ) && give_update_option( "{$notification_id}_notification", give_clean( $_POST['status'] ) ) ) { |
|
19 | + $notification_id = isset($_POST['notification_id']) ? give_clean($_POST['notification_id']) : ''; |
|
20 | + if ( ! empty($notification_id) && give_update_option("{$notification_id}_notification", give_clean($_POST['status']))) { |
|
21 | 21 | wp_send_json_success(); |
22 | 22 | } |
23 | 23 | |
24 | 24 | wp_send_json_error(); |
25 | 25 | } |
26 | 26 | |
27 | -add_action( 'wp_ajax_give_set_notification_status', 'give_set_notification_status_handler' ); |
|
27 | +add_action('wp_ajax_give_set_notification_status', 'give_set_notification_status_handler'); |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return string |
13 | 13 | */ |
14 | -function _give_bc_offline_donation_instruction_notification_status( $notification_status, $email, $form_id ) { |
|
14 | +function _give_bc_offline_donation_instruction_notification_status($notification_status, $email, $form_id) { |
|
15 | 15 | // Bailout. |
16 | - if ( ! $form_id ) { |
|
16 | + if ( ! $form_id) { |
|
17 | 17 | return $notification_status; |
18 | 18 | } |
19 | 19 | |
20 | - if ( ! get_post_meta( $form_id, '_give_offline-donation-instruction_notification', true ) ) { |
|
21 | - $old_value = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
22 | - $notification_status = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) ) |
|
20 | + if ( ! get_post_meta($form_id, '_give_offline-donation-instruction_notification', true)) { |
|
21 | + $old_value = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
22 | + $notification_status = give_is_setting_enabled($old_value, array('enabled', 'global')) |
|
23 | 23 | ? $old_value |
24 | 24 | : 'global'; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $notification_status; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3 ); |
|
31 | +add_filter('give__give_offline-donation-instruction_get_notification_status', '_give_bc_offline_donation_instruction_notification_status', 10, 3); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -43,22 +43,22 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return mixed |
45 | 45 | */ |
46 | -function _give_bc_offline_donation_instruction_email_setting_values( $option_value, $option_name, $email, $form_id ) { |
|
46 | +function _give_bc_offline_donation_instruction_email_setting_values($option_value, $option_name, $email, $form_id) { |
|
47 | 47 | // Bailout. |
48 | - if ( empty( $form_id ) || 'offline-donation-instruction' !== $email->config['id'] ) { |
|
48 | + if (empty($form_id) || 'offline-donation-instruction' !== $email->config['id']) { |
|
49 | 49 | return $option_value; |
50 | 50 | } |
51 | 51 | |
52 | - switch ( $option_name ) { |
|
52 | + switch ($option_name) { |
|
53 | 53 | case '_give_offline-donation-instruction_email_message': |
54 | - if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) { |
|
55 | - $option_value = get_post_meta( $form_id, '_give_offline_donation_email', true ); |
|
54 | + if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) { |
|
55 | + $option_value = get_post_meta($form_id, '_give_offline_donation_email', true); |
|
56 | 56 | } |
57 | 57 | break; |
58 | 58 | |
59 | 59 | case '_give_offline-donation-instruction_email_subject': |
60 | - if ( ! get_post_meta( $form_id, $option_name, true ) && give_is_setting_enabled( $email->get_notification_status( $form_id ) ) ) { |
|
61 | - $option_value = get_post_meta( $form_id, '_give_offline_donation_subject', true ); |
|
60 | + if ( ! get_post_meta($form_id, $option_name, true) && give_is_setting_enabled($email->get_notification_status($form_id))) { |
|
61 | + $option_value = get_post_meta($form_id, '_give_offline_donation_subject', true); |
|
62 | 62 | } |
63 | 63 | break; |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return $option_value; |
67 | 67 | } |
68 | 68 | |
69 | -add_filter( 'give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4 ); |
|
69 | +add_filter('give_email_setting_value', '_give_bc_offline_donation_instruction_email_setting_values', 10, 4); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | /** |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string |
82 | 82 | */ |
83 | -function _give_bc_offline_instruction_status_setting_value( $field_value, $field, $form_id ) { |
|
84 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
85 | - $old_value = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
86 | - $field_value = give_is_setting_enabled( $old_value, array( 'enabled', 'global' ) ) |
|
83 | +function _give_bc_offline_instruction_status_setting_value($field_value, $field, $form_id) { |
|
84 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
85 | + $old_value = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
86 | + $field_value = give_is_setting_enabled($old_value, array('enabled', 'global')) |
|
87 | 87 | ? $old_value |
88 | 88 | : 'global'; |
89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | return $field_value; |
92 | 92 | } |
93 | 93 | |
94 | -add_filter( '_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3 ); |
|
94 | +add_filter('_give_offline-donation-instruction_notification_field_value', '_give_bc_offline_instruction_status_setting_value', 10, 3); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | /** |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string |
107 | 107 | */ |
108 | -function _offline_donation_instruction_email_subject_setting_value( $field_value, $field, $form_id ) { |
|
109 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
110 | - $field_value = get_post_meta( $form_id, '_give_offline_donation_subject', true ); |
|
108 | +function _offline_donation_instruction_email_subject_setting_value($field_value, $field, $form_id) { |
|
109 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
110 | + $field_value = get_post_meta($form_id, '_give_offline_donation_subject', true); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $field_value; |
114 | 114 | } |
115 | 115 | |
116 | -add_filter( '_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3 ); |
|
116 | +add_filter('_give_offline-donation-instruction_email_subject_field_value', '_offline_donation_instruction_email_subject_setting_value', 10, 3); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | /** |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return string |
129 | 129 | */ |
130 | -function _give_bc_offline_donation_instruction_email_message_setting_value( $field_value, $field, $form_id ) { |
|
131 | - if ( ! get_post_meta( $form_id, $field['id'], true ) ) { |
|
132 | - $field_value = get_post_meta( $form_id, '_give_offline_donation_email', true ); |
|
130 | +function _give_bc_offline_donation_instruction_email_message_setting_value($field_value, $field, $form_id) { |
|
131 | + if ( ! get_post_meta($form_id, $field['id'], true)) { |
|
132 | + $field_value = get_post_meta($form_id, '_give_offline_donation_email', true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return $field_value; |
136 | 136 | } |
137 | 137 | |
138 | -add_filter( '_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3 ); |
|
139 | 138 | \ No newline at end of file |
139 | +add_filter('_give_offline-donation-instruction_email_message_field_value', '_give_bc_offline_donation_instruction_email_message_setting_value', 10, 3); |
|
140 | 140 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - $views = apply_filters( 'give_report_views', $views ); |
|
108 | + $views = apply_filters('give_report_views', $views); |
|
109 | 109 | |
110 | 110 | return $views; |
111 | 111 | } |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @since 1.0 |
121 | 121 | * @return string $view Report View |
122 | 122 | */ |
123 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
123 | +function give_get_reporting_view($default = 'earnings') { |
|
124 | 124 | |
125 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
125 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
126 | 126 | $view = $default; |
127 | 127 | } else { |
128 | 128 | $view = $_GET['view']; |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
131 | + return apply_filters('give_get_reporting_view', $view); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | */ |
140 | 140 | function give_reports_tab_reports() { |
141 | 141 | |
142 | - if( ! current_user_can( 'view_give_reports' ) ) { |
|
143 | - wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
142 | + if ( ! current_user_can('view_give_reports')) { |
|
143 | + wp_die(__('You do not have permission to access this report', 'give'), __('Error', 'give'), array('response' => 403)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $current_view = 'earnings'; |
147 | 147 | $views = give_reports_default_views(); |
148 | 148 | |
149 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
149 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
150 | 150 | $current_view = $_GET['tab']; |
151 | 151 | } |
152 | 152 | |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @since 1.0 |
157 | 157 | */ |
158 | - do_action( "give_reports_view_{$current_view}" ); |
|
158 | + do_action("give_reports_view_{$current_view}"); |
|
159 | 159 | } |
160 | 160 | |
161 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
161 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Renders the Reports Page Views Drop Downs |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | */ |
169 | 169 | function give_report_views() { |
170 | 170 | $views = give_reports_default_views(); |
171 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
171 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
172 | 172 | /** |
173 | 173 | * Fires before the report page actions form. |
174 | 174 | * |
175 | 175 | * @since 1.0 |
176 | 176 | */ |
177 | - do_action( 'give_report_view_actions_before' ); |
|
177 | + do_action('give_report_view_actions_before'); |
|
178 | 178 | ?> |
179 | 179 | <form id="give-reports-filter" method="get"> |
180 | 180 | <select id="give-reports-view" name="view"> |
181 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
182 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
183 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
181 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
182 | + <?php foreach ($views as $view_id => $label) : ?> |
|
183 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
184 | 184 | <?php endforeach; ?> |
185 | 185 | </select> |
186 | 186 | |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @since 1.0 |
194 | 194 | */ |
195 | - do_action( 'give_report_view_actions' ); |
|
195 | + do_action('give_report_view_actions'); |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | <input type="hidden" name="post_type" value="give_forms"/> |
199 | 199 | <input type="hidden" name="page" value="give-reports"/> |
200 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
200 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
201 | 201 | </form> |
202 | 202 | <?php |
203 | 203 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - do_action( 'give_report_view_actions_after' ); |
|
208 | + do_action('give_report_view_actions_after'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function give_reports_forms_table() { |
220 | 220 | |
221 | - if ( isset( $_GET['form-id'] ) ) { |
|
221 | + if (isset($_GET['form-id'])) { |
|
222 | 222 | return; |
223 | 223 | } |
224 | 224 | |
225 | - include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-form-reports-table.php'; |
|
225 | + include GIVE_PLUGIN_DIR.'includes/admin/reports/class-form-reports-table.php'; |
|
226 | 226 | |
227 | 227 | $give_table = new Give_Form_Reports_Table(); |
228 | 228 | $give_table->prepare_items(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | <?php |
235 | 235 | } |
236 | 236 | |
237 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
237 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Renders the detailed report for a specific give form. |
@@ -243,20 +243,20 @@ discard block |
||
243 | 243 | * @return void |
244 | 244 | */ |
245 | 245 | function give_reports_form_details() { |
246 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
246 | + if ( ! isset($_GET['form-id'])) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | ?> |
250 | 250 | <div class="tablenav top reports-forms-details-wrap"> |
251 | 251 | <div class="actions bulkactions"> |
252 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
252 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
253 | 253 | </div> |
254 | 254 | </div> |
255 | 255 | <?php |
256 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
256 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
257 | 257 | } |
258 | 258 | |
259 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
259 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Renders the Gateways Table |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | * @return void |
268 | 268 | */ |
269 | 269 | function give_reports_gateways_table() { |
270 | - include GIVE_PLUGIN_DIR . 'includes/admin/reports/class-gateways-reports-table.php'; |
|
270 | + include GIVE_PLUGIN_DIR.'includes/admin/reports/class-gateways-reports-table.php'; |
|
271 | 271 | |
272 | 272 | $give_table = new Give_Gateway_Reports_Table(); |
273 | 273 | $give_table->prepare_items(); |
274 | 274 | $give_table->display(); |
275 | 275 | } |
276 | 276 | |
277 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
277 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
278 | 278 | |
279 | 279 | /** |
280 | 280 | * Renders the Reports Earnings Graphs |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | function give_reports_earnings() { |
286 | 286 | ?> |
287 | 287 | <div class="tablenav top reports-table-nav"> |
288 | - <h2 class="reports-earnings-title screen-reader-text"><?php _e( 'Income Report', 'give' ); ?></h2> |
|
288 | + <h2 class="reports-earnings-title screen-reader-text"><?php _e('Income Report', 'give'); ?></h2> |
|
289 | 289 | </div> |
290 | 290 | <?php |
291 | 291 | give_reports_graph(); |
292 | 292 | } |
293 | 293 | |
294 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
294 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
295 | 295 | |
296 | 296 | |
297 | 297 | /** |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | */ |
303 | 303 | function give_estimated_monthly_stats() { |
304 | 304 | |
305 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
305 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
306 | 306 | |
307 | - if ( false === $estimated ) { |
|
307 | + if (false === $estimated) { |
|
308 | 308 | |
309 | 309 | $estimated = array( |
310 | 310 | 'earnings' => 0, |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | |
314 | 314 | $stats = new Give_Payment_Stats; |
315 | 315 | |
316 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
317 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
316 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
317 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
318 | 318 | |
319 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
320 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
321 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
322 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
319 | + $current_day = date('d', current_time('timestamp')); |
|
320 | + $current_month = date('n', current_time('timestamp')); |
|
321 | + $current_year = date('Y', current_time('timestamp')); |
|
322 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
323 | 323 | |
324 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
325 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
324 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
325 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
326 | 326 | |
327 | 327 | // Cache for one day |
328 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
328 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
329 | 329 | } |
330 | 330 | |
331 | - return maybe_unserialize( $estimated ); |
|
331 | + return maybe_unserialize($estimated); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | function give_reports_set_form_method() { |
342 | 342 | return 'get'; |
343 | 343 | } |
344 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
345 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
344 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
345 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
346 | 346 | |
347 | 347 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -663,9 +663,12 @@ discard block |
||
663 | 663 | <a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
664 | 664 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
665 | 665 | <?php echo $form_data_tab['icon-html']; ?> |
666 | - <?php else : ?> |
|
666 | + <?php else { |
|
667 | + : ?> |
|
667 | 668 | <span class="give-icon give-icon-default"></span> |
668 | - <?php endif; ?> |
|
669 | + <?php endif; |
|
670 | +} |
|
671 | +?> |
|
669 | 672 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
670 | 673 | </a> |
671 | 674 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -675,9 +678,12 @@ discard block |
||
675 | 678 | <a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>"> |
676 | 679 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
677 | 680 | <?php echo $sub_tab['icon-html']; ?> |
678 | - <?php else : ?> |
|
681 | + <?php else { |
|
682 | + : ?> |
|
679 | 683 | <span class="give-icon give-icon-default"></span> |
680 | - <?php endif; ?> |
|
684 | + <?php endif; |
|
685 | +} |
|
686 | +?> |
|
681 | 687 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
682 | 688 | </a> |
683 | 689 | </li> |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | |
65 | 65 | // Maintain active tab query parameter after save. |
66 | - add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 ); |
|
66 | + add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function get_settings() { |
89 | 89 | $post_id = give_get_admin_post_id(); |
90 | - $price_placeholder = give_format_decimal( '1.00', false, false ); |
|
90 | + $price_placeholder = give_format_decimal('1.00', false, false); |
|
91 | 91 | |
92 | 92 | // Start with an underscore to hide fields from custom fields list |
93 | 93 | $prefix = '_give_'; |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Repeatable Field Groups |
98 | 98 | */ |
99 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
99 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
100 | 100 | 'id' => 'form_field_options', |
101 | - 'title' => __( 'Donation Options', 'give' ), |
|
101 | + 'title' => __('Donation Options', 'give'), |
|
102 | 102 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
103 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
103 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
104 | 104 | // Donation Option. |
105 | 105 | array( |
106 | - 'name' => __( 'Donation Option', 'give' ), |
|
107 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
108 | - 'id' => $prefix . 'price_option', |
|
106 | + 'name' => __('Donation Option', 'give'), |
|
107 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
108 | + 'id' => $prefix.'price_option', |
|
109 | 109 | 'type' => 'radio_inline', |
110 | 110 | 'default' => 'multi', |
111 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
112 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
113 | - 'set' => __( 'Set Donation', 'give' ), |
|
114 | - ) ), |
|
111 | + 'options' => apply_filters('give_forms_price_options', array( |
|
112 | + 'multi' => __('Multi-level Donation', 'give'), |
|
113 | + 'set' => __('Set Donation', 'give'), |
|
114 | + )), |
|
115 | 115 | ), |
116 | 116 | array( |
117 | - 'name' => __( 'Set Donation', 'give' ), |
|
118 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
119 | - 'id' => $prefix . 'set_price', |
|
117 | + 'name' => __('Set Donation', 'give'), |
|
118 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
119 | + 'id' => $prefix.'set_price', |
|
120 | 120 | 'type' => 'text_small', |
121 | 121 | 'data_type' => 'price', |
122 | 122 | 'attributes' => array( |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | ), |
127 | 127 | // Display Style. |
128 | 128 | array( |
129 | - 'name' => __( 'Display Style', 'give' ), |
|
130 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
131 | - 'id' => $prefix . 'display_style', |
|
129 | + 'name' => __('Display Style', 'give'), |
|
130 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
131 | + 'id' => $prefix.'display_style', |
|
132 | 132 | 'type' => 'radio_inline', |
133 | 133 | 'default' => 'buttons', |
134 | 134 | 'options' => array( |
135 | - 'buttons' => __( 'Buttons', 'give' ), |
|
136 | - 'radios' => __( 'Radios', 'give' ), |
|
137 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
135 | + 'buttons' => __('Buttons', 'give'), |
|
136 | + 'radios' => __('Radios', 'give'), |
|
137 | + 'dropdown' => __('Dropdown', 'give'), |
|
138 | 138 | ), |
139 | 139 | 'wrapper_class' => 'give-hidden', |
140 | 140 | ), |
141 | 141 | // Custom Amount. |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'disabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Donation Limit', 'give' ), |
|
155 | - 'description' => __( 'Set the minimum and maximum amount for all gateways.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_range', |
|
154 | + 'name' => __('Donation Limit', 'give'), |
|
155 | + 'description' => __('Set the minimum and maximum amount for all gateways.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_range', |
|
157 | 157 | 'type' => 'donation_limit', |
158 | 158 | 'wrapper_class' => 'give-hidden', |
159 | 159 | 'data_type' => 'price', |
@@ -162,43 +162,43 @@ discard block |
||
162 | 162 | 'class' => 'give-money-field', |
163 | 163 | ), |
164 | 164 | 'options' => array( |
165 | - 'display_label' => __( 'Donation Limits: ', 'give' ), |
|
166 | - 'minimum' => give_format_decimal( '1.00', false, false ), |
|
167 | - 'maximum' => give_format_decimal( '999999.99', false, false ), |
|
165 | + 'display_label' => __('Donation Limits: ', 'give'), |
|
166 | + 'minimum' => give_format_decimal('1.00', false, false), |
|
167 | + 'maximum' => give_format_decimal('999999.99', false, false), |
|
168 | 168 | ), |
169 | 169 | ), |
170 | 170 | array( |
171 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
172 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
173 | - 'id' => $prefix . 'custom_amount_text', |
|
171 | + 'name' => __('Custom Amount Text', 'give'), |
|
172 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
173 | + 'id' => $prefix.'custom_amount_text', |
|
174 | 174 | 'type' => 'text_medium', |
175 | 175 | 'attributes' => array( |
176 | 176 | 'rows' => 3, |
177 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
177 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
178 | 178 | ), |
179 | 179 | 'wrapper_class' => 'give-hidden', |
180 | 180 | ), |
181 | 181 | // Donation Levels. |
182 | 182 | array( |
183 | - 'id' => $prefix . 'donation_levels', |
|
183 | + 'id' => $prefix.'donation_levels', |
|
184 | 184 | 'type' => 'group', |
185 | 185 | 'options' => array( |
186 | - 'add_button' => __( 'Add Level', 'give' ), |
|
187 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
186 | + 'add_button' => __('Add Level', 'give'), |
|
187 | + 'header_title' => __('Donation Level', 'give'), |
|
188 | 188 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
189 | 189 | ), |
190 | 190 | 'wrapper_class' => 'give-hidden', |
191 | 191 | // Fields array works the same, except id's only need to be unique for this group. |
192 | 192 | // Prefix is not needed. |
193 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
193 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
194 | 194 | array( |
195 | - 'name' => __( 'ID', 'give' ), |
|
196 | - 'id' => $prefix . 'id', |
|
195 | + 'name' => __('ID', 'give'), |
|
196 | + 'id' => $prefix.'id', |
|
197 | 197 | 'type' => 'levels_id', |
198 | 198 | ), |
199 | 199 | array( |
200 | - 'name' => __( 'Amount', 'give' ), |
|
201 | - 'id' => $prefix . 'amount', |
|
200 | + 'name' => __('Amount', 'give'), |
|
201 | + 'id' => $prefix.'amount', |
|
202 | 202 | 'type' => 'text_small', |
203 | 203 | 'data_type' => 'price', |
204 | 204 | 'attributes' => array( |
@@ -207,126 +207,126 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | array( |
210 | - 'name' => __( 'Text', 'give' ), |
|
211 | - 'id' => $prefix . 'text', |
|
210 | + 'name' => __('Text', 'give'), |
|
211 | + 'id' => $prefix.'text', |
|
212 | 212 | 'type' => 'text', |
213 | 213 | 'attributes' => array( |
214 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
214 | + 'placeholder' => __('Donation Level', 'give'), |
|
215 | 215 | 'class' => 'give-multilevel-text-field', |
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => __( 'Default', 'give' ), |
|
220 | - 'id' => $prefix . 'default', |
|
219 | + 'name' => __('Default', 'give'), |
|
220 | + 'id' => $prefix.'default', |
|
221 | 221 | 'type' => 'give_default_radio_inline', |
222 | 222 | ), |
223 | - ) ), |
|
223 | + )), |
|
224 | 224 | ), |
225 | 225 | array( |
226 | 226 | 'name' => 'donation_options_docs', |
227 | 227 | 'type' => 'docs_link', |
228 | 228 | 'url' => 'http://docs.givewp.com/form-donation-options', |
229 | - 'title' => __( 'Donation Options', 'give' ), |
|
229 | + 'title' => __('Donation Options', 'give'), |
|
230 | 230 | ), |
231 | 231 | ), |
232 | 232 | $post_id |
233 | 233 | ), |
234 | - ) ), |
|
234 | + )), |
|
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Display Options |
238 | 238 | */ |
239 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
239 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
240 | 240 | 'id' => 'form_display_options', |
241 | - 'title' => __( 'Form Display', 'give' ), |
|
241 | + 'title' => __('Form Display', 'give'), |
|
242 | 242 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
243 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
243 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
244 | 244 | array( |
245 | - 'name' => __( 'Display Options', 'give' ), |
|
246 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
247 | - 'id' => $prefix . 'payment_display', |
|
245 | + 'name' => __('Display Options', 'give'), |
|
246 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
247 | + 'id' => $prefix.'payment_display', |
|
248 | 248 | 'type' => 'radio_inline', |
249 | 249 | 'options' => array( |
250 | - 'onpage' => __( 'All Fields', 'give' ), |
|
251 | - 'modal' => __( 'Modal', 'give' ), |
|
252 | - 'reveal' => __( 'Reveal', 'give' ), |
|
253 | - 'button' => __( 'Button', 'give' ), |
|
250 | + 'onpage' => __('All Fields', 'give'), |
|
251 | + 'modal' => __('Modal', 'give'), |
|
252 | + 'reveal' => __('Reveal', 'give'), |
|
253 | + 'button' => __('Button', 'give'), |
|
254 | 254 | ), |
255 | 255 | 'default' => 'onpage', |
256 | 256 | ), |
257 | 257 | array( |
258 | - 'id' => $prefix . 'reveal_label', |
|
259 | - 'name' => __( 'Continue Button', 'give' ), |
|
260 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
258 | + 'id' => $prefix.'reveal_label', |
|
259 | + 'name' => __('Continue Button', 'give'), |
|
260 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
261 | 261 | 'type' => 'text_small', |
262 | 262 | 'attributes' => array( |
263 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
263 | + 'placeholder' => __('Donate Now', 'give'), |
|
264 | 264 | ), |
265 | 265 | 'wrapper_class' => 'give-hidden', |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Company Donations', 'give' ), |
|
284 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
|
285 | - 'id' => $prefix . 'company_field', |
|
283 | + 'name' => __('Company Donations', 'give'), |
|
284 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name?', 'give'), |
|
285 | + 'id' => $prefix.'company_field', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'default' => 'global', |
288 | 288 | 'options' => array( |
289 | - 'global' => __( 'Global Option', 'give' ), |
|
290 | - 'required' => __( 'Required', 'give' ), |
|
291 | - 'optional' => __( 'Optional', 'give' ), |
|
292 | - 'disabled' => __( 'Disabled', 'give' ), |
|
289 | + 'global' => __('Global Option', 'give'), |
|
290 | + 'required' => __('Required', 'give'), |
|
291 | + 'optional' => __('Optional', 'give'), |
|
292 | + 'disabled' => __('Disabled', 'give'), |
|
293 | 293 | |
294 | 294 | ), |
295 | 295 | ), |
296 | 296 | array( |
297 | - 'name' => __( 'Guest Donations', 'give' ), |
|
298 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
299 | - 'id' => $prefix . 'logged_in_only', |
|
297 | + 'name' => __('Guest Donations', 'give'), |
|
298 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
299 | + 'id' => $prefix.'logged_in_only', |
|
300 | 300 | 'type' => 'radio_inline', |
301 | 301 | 'default' => 'enabled', |
302 | 302 | 'options' => array( |
303 | - 'enabled' => __( 'Enabled', 'give' ), |
|
304 | - 'disabled' => __( 'Disabled', 'give' ), |
|
303 | + 'enabled' => __('Enabled', 'give'), |
|
304 | + 'disabled' => __('Disabled', 'give'), |
|
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | array( |
308 | - 'name' => __( 'Registration', 'give' ), |
|
309 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
310 | - 'id' => $prefix . 'show_register_form', |
|
308 | + 'name' => __('Registration', 'give'), |
|
309 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
310 | + 'id' => $prefix.'show_register_form', |
|
311 | 311 | 'type' => 'radio', |
312 | 312 | 'options' => array( |
313 | - 'none' => __( 'None', 'give' ), |
|
314 | - 'registration' => __( 'Registration', 'give' ), |
|
315 | - 'login' => __( 'Login', 'give' ), |
|
316 | - 'both' => __( 'Registration + Login', 'give' ), |
|
313 | + 'none' => __('None', 'give'), |
|
314 | + 'registration' => __('Registration', 'give'), |
|
315 | + 'login' => __('Login', 'give'), |
|
316 | + 'both' => __('Registration + Login', 'give'), |
|
317 | 317 | ), |
318 | 318 | 'default' => 'none', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Floating Labels', 'give' ), |
|
321 | + 'name' => __('Floating Labels', 'give'), |
|
322 | 322 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
323 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
324 | - 'id' => $prefix . 'form_floating_labels', |
|
323 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
324 | + 'id' => $prefix.'form_floating_labels', |
|
325 | 325 | 'type' => 'radio_inline', |
326 | 326 | 'options' => array( |
327 | - 'global' => __( 'Global Option', 'give' ), |
|
328 | - 'enabled' => __( 'Enabled', 'give' ), |
|
329 | - 'disabled' => __( 'Disabled', 'give' ), |
|
327 | + 'global' => __('Global Option', 'give'), |
|
328 | + 'enabled' => __('Enabled', 'give'), |
|
329 | + 'disabled' => __('Disabled', 'give'), |
|
330 | 330 | ), |
331 | 331 | 'default' => 'global', |
332 | 332 | ), |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | 'name' => 'form_display_docs', |
335 | 335 | 'type' => 'docs_link', |
336 | 336 | 'url' => 'http://docs.givewp.com/form-display-options', |
337 | - 'title' => __( 'Form Display', 'give' ), |
|
337 | + 'title' => __('Form Display', 'give'), |
|
338 | 338 | ), |
339 | 339 | ), |
340 | 340 | $post_id |
@@ -345,42 +345,42 @@ discard block |
||
345 | 345 | /** |
346 | 346 | * Donation Goals |
347 | 347 | */ |
348 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
348 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
349 | 349 | 'id' => 'donation_goal_options', |
350 | - 'title' => __( 'Donation Goal', 'give' ), |
|
350 | + 'title' => __('Donation Goal', 'give'), |
|
351 | 351 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
352 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
352 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
353 | 353 | // Goals |
354 | 354 | array( |
355 | - 'name' => __( 'Donation Goal', 'give' ), |
|
356 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
357 | - 'id' => $prefix . 'goal_option', |
|
355 | + 'name' => __('Donation Goal', 'give'), |
|
356 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
357 | + 'id' => $prefix.'goal_option', |
|
358 | 358 | 'type' => 'radio_inline', |
359 | 359 | 'default' => 'disabled', |
360 | 360 | 'options' => array( |
361 | - 'enabled' => __( 'Enabled', 'give' ), |
|
362 | - 'disabled' => __( 'Disabled', 'give' ), |
|
361 | + 'enabled' => __('Enabled', 'give'), |
|
362 | + 'disabled' => __('Disabled', 'give'), |
|
363 | 363 | ), |
364 | 364 | ), |
365 | 365 | |
366 | 366 | array( |
367 | - 'name' => __( 'Goal Format', 'give' ), |
|
368 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give' ), |
|
369 | - 'id' => $prefix . 'goal_format', |
|
367 | + 'name' => __('Goal Format', 'give'), |
|
368 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations". You can also display a donor-based goal, such as "100 of 1,000 donors have given".', 'give'), |
|
369 | + 'id' => $prefix.'goal_format', |
|
370 | 370 | 'type' => 'donation_form_goal', |
371 | 371 | 'default' => 'amount', |
372 | 372 | 'options' => array( |
373 | - 'amount' => __( 'Amount Raised', 'give' ), |
|
374 | - 'percentage' => __( 'Percentage Raised', 'give' ), |
|
375 | - 'donation' => __( 'Number of Donations', 'give' ), |
|
376 | - 'donors' => __( 'Number of Donors', 'give' ), |
|
373 | + 'amount' => __('Amount Raised', 'give'), |
|
374 | + 'percentage' => __('Percentage Raised', 'give'), |
|
375 | + 'donation' => __('Number of Donations', 'give'), |
|
376 | + 'donors' => __('Number of Donors', 'give'), |
|
377 | 377 | ), |
378 | 378 | ), |
379 | 379 | |
380 | 380 | array( |
381 | - 'name' => __( 'Goal Amount', 'give' ), |
|
382 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
383 | - 'id' => $prefix . 'set_goal', |
|
381 | + 'name' => __('Goal Amount', 'give'), |
|
382 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
383 | + 'id' => $prefix.'set_goal', |
|
384 | 384 | 'type' => 'text_small', |
385 | 385 | 'data_type' => 'price', |
386 | 386 | 'attributes' => array( |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | 'wrapper_class' => 'give-hidden', |
391 | 391 | ), |
392 | 392 | array( |
393 | - 'id' => $prefix . 'number_of_donation_goal', |
|
394 | - 'name' => __( 'Donation Goal', 'give' ), |
|
395 | - 'desc' => __( 'Set the total number of donations as a goal.', 'give' ), |
|
393 | + 'id' => $prefix.'number_of_donation_goal', |
|
394 | + 'name' => __('Donation Goal', 'give'), |
|
395 | + 'desc' => __('Set the total number of donations as a goal.', 'give'), |
|
396 | 396 | 'type' => 'number', |
397 | 397 | 'default' => 1, |
398 | 398 | 'attributes' => array( |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | ), |
401 | 401 | ), |
402 | 402 | array( |
403 | - 'id' => $prefix . 'number_of_donor_goal', |
|
404 | - 'name' => __( 'Donor Goal', 'give' ), |
|
405 | - 'desc' => __( 'Set the total number of donors as a goal.', 'give' ), |
|
403 | + 'id' => $prefix.'number_of_donor_goal', |
|
404 | + 'name' => __('Donor Goal', 'give'), |
|
405 | + 'desc' => __('Set the total number of donors as a goal.', 'give'), |
|
406 | 406 | 'type' => 'number', |
407 | 407 | 'default' => 1, |
408 | 408 | 'attributes' => array( |
@@ -410,85 +410,85 @@ discard block |
||
410 | 410 | ), |
411 | 411 | ), |
412 | 412 | array( |
413 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
414 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
415 | - 'id' => $prefix . 'goal_color', |
|
413 | + 'name' => __('Progress Bar Color', 'give'), |
|
414 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
415 | + 'id' => $prefix.'goal_color', |
|
416 | 416 | 'type' => 'colorpicker', |
417 | 417 | 'default' => '#2bc253', |
418 | 418 | 'wrapper_class' => 'give-hidden', |
419 | 419 | ), |
420 | 420 | |
421 | 421 | array( |
422 | - 'name' => __( 'Close Form', 'give' ), |
|
423 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
424 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
422 | + 'name' => __('Close Form', 'give'), |
|
423 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
424 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
425 | 425 | 'type' => 'radio_inline', |
426 | 426 | 'default' => 'disabled', |
427 | 427 | 'options' => array( |
428 | - 'enabled' => __( 'Enabled', 'give' ), |
|
429 | - 'disabled' => __( 'Disabled', 'give' ), |
|
428 | + 'enabled' => __('Enabled', 'give'), |
|
429 | + 'disabled' => __('Disabled', 'give'), |
|
430 | 430 | ), |
431 | 431 | 'wrapper_class' => 'give-hidden', |
432 | 432 | ), |
433 | 433 | array( |
434 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
435 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
436 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
434 | + 'name' => __('Goal Achieved Message', 'give'), |
|
435 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
436 | + 'id' => $prefix.'form_goal_achieved_message', |
|
437 | 437 | 'type' => 'wysiwyg', |
438 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
438 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
439 | 439 | 'wrapper_class' => 'give-hidden', |
440 | 440 | ), |
441 | 441 | array( |
442 | 442 | 'name' => 'donation_goal_docs', |
443 | 443 | 'type' => 'docs_link', |
444 | 444 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
445 | - 'title' => __( 'Donation Goal', 'give' ), |
|
445 | + 'title' => __('Donation Goal', 'give'), |
|
446 | 446 | ), |
447 | 447 | ), |
448 | 448 | $post_id |
449 | 449 | ), |
450 | - ) ), |
|
450 | + )), |
|
451 | 451 | |
452 | 452 | /** |
453 | 453 | * Content Field |
454 | 454 | */ |
455 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
455 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
456 | 456 | 'id' => 'form_content_options', |
457 | - 'title' => __( 'Form Content', 'give' ), |
|
457 | + 'title' => __('Form Content', 'give'), |
|
458 | 458 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
459 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
459 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
460 | 460 | |
461 | 461 | // Donation content. |
462 | 462 | array( |
463 | - 'name' => __( 'Display Content', 'give' ), |
|
464 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
465 | - 'id' => $prefix . 'display_content', |
|
463 | + 'name' => __('Display Content', 'give'), |
|
464 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
465 | + 'id' => $prefix.'display_content', |
|
466 | 466 | 'type' => 'radio_inline', |
467 | 467 | 'options' => array( |
468 | - 'enabled' => __( 'Enabled', 'give' ), |
|
469 | - 'disabled' => __( 'Disabled', 'give' ), |
|
468 | + 'enabled' => __('Enabled', 'give'), |
|
469 | + 'disabled' => __('Disabled', 'give'), |
|
470 | 470 | ), |
471 | 471 | 'default' => 'disabled', |
472 | 472 | ), |
473 | 473 | |
474 | 474 | // Content placement. |
475 | 475 | array( |
476 | - 'name' => __( 'Content Placement', 'give' ), |
|
477 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
478 | - 'id' => $prefix . 'content_placement', |
|
476 | + 'name' => __('Content Placement', 'give'), |
|
477 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
478 | + 'id' => $prefix.'content_placement', |
|
479 | 479 | 'type' => 'radio_inline', |
480 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
481 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
482 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
480 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
481 | + 'give_pre_form' => __('Above fields', 'give'), |
|
482 | + 'give_post_form' => __('Below fields', 'give'), |
|
483 | 483 | ) |
484 | 484 | ), |
485 | 485 | 'default' => 'give_pre_form', |
486 | 486 | 'wrapper_class' => 'give-hidden', |
487 | 487 | ), |
488 | 488 | array( |
489 | - 'name' => __( 'Content', 'give' ), |
|
490 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
491 | - 'id' => $prefix . 'form_content', |
|
489 | + 'name' => __('Content', 'give'), |
|
490 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
491 | + 'id' => $prefix.'form_content', |
|
492 | 492 | 'type' => 'wysiwyg', |
493 | 493 | 'wrapper_class' => 'give-hidden', |
494 | 494 | ), |
@@ -496,51 +496,51 @@ discard block |
||
496 | 496 | 'name' => 'form_content_docs', |
497 | 497 | 'type' => 'docs_link', |
498 | 498 | 'url' => 'http://docs.givewp.com/form-content', |
499 | - 'title' => __( 'Form Content', 'give' ), |
|
499 | + 'title' => __('Form Content', 'give'), |
|
500 | 500 | ), |
501 | 501 | ), |
502 | 502 | $post_id |
503 | 503 | ), |
504 | - ) ), |
|
504 | + )), |
|
505 | 505 | |
506 | 506 | /** |
507 | 507 | * Terms & Conditions |
508 | 508 | */ |
509 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
509 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
510 | 510 | 'id' => 'form_terms_options', |
511 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
511 | + 'title' => __('Terms & Conditions', 'give'), |
|
512 | 512 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
513 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
513 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
514 | 514 | // Donation Option |
515 | 515 | array( |
516 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
517 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
518 | - 'id' => $prefix . 'terms_option', |
|
516 | + 'name' => __('Terms and Conditions', 'give'), |
|
517 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
518 | + 'id' => $prefix.'terms_option', |
|
519 | 519 | 'type' => 'radio_inline', |
520 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
521 | - 'global' => __( 'Global Option', 'give' ), |
|
522 | - 'enabled' => __( 'Customize', 'give' ), |
|
523 | - 'disabled' => __( 'Disable', 'give' ), |
|
520 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
521 | + 'global' => __('Global Option', 'give'), |
|
522 | + 'enabled' => __('Customize', 'give'), |
|
523 | + 'disabled' => __('Disable', 'give'), |
|
524 | 524 | ) |
525 | 525 | ), |
526 | 526 | 'default' => 'global', |
527 | 527 | ), |
528 | 528 | array( |
529 | - 'id' => $prefix . 'agree_label', |
|
530 | - 'name' => __( 'Agreement Label', 'give' ), |
|
531 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
529 | + 'id' => $prefix.'agree_label', |
|
530 | + 'name' => __('Agreement Label', 'give'), |
|
531 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
532 | 532 | 'type' => 'text', |
533 | 533 | 'size' => 'regular', |
534 | 534 | 'attributes' => array( |
535 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
535 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
536 | 536 | ), |
537 | 537 | 'wrapper_class' => 'give-hidden', |
538 | 538 | ), |
539 | 539 | array( |
540 | - 'id' => $prefix . 'agree_text', |
|
541 | - 'name' => __( 'Agreement Text', 'give' ), |
|
542 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
543 | - 'default' => give_get_option( 'agreement_text' ), |
|
540 | + 'id' => $prefix.'agree_text', |
|
541 | + 'name' => __('Agreement Text', 'give'), |
|
542 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
543 | + 'default' => give_get_option('agreement_text'), |
|
544 | 544 | 'type' => 'wysiwyg', |
545 | 545 | 'wrapper_class' => 'give-hidden', |
546 | 546 | ), |
@@ -548,18 +548,18 @@ discard block |
||
548 | 548 | 'name' => 'terms_docs', |
549 | 549 | 'type' => 'docs_link', |
550 | 550 | 'url' => 'http://docs.givewp.com/form-terms', |
551 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
551 | + 'title' => __('Terms and Conditions', 'give'), |
|
552 | 552 | ), |
553 | 553 | ), |
554 | 554 | $post_id |
555 | 555 | ), |
556 | - ) ), |
|
556 | + )), |
|
557 | 557 | ); |
558 | 558 | |
559 | 559 | /** |
560 | 560 | * Filter the metabox tabbed panel settings. |
561 | 561 | */ |
562 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
562 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
563 | 563 | |
564 | 564 | // Output. |
565 | 565 | return $settings; |
@@ -576,19 +576,19 @@ discard block |
||
576 | 576 | add_meta_box( |
577 | 577 | $this->get_metabox_ID(), |
578 | 578 | $this->get_metabox_label(), |
579 | - array( $this, 'output' ), |
|
580 | - array( 'give_forms' ), |
|
579 | + array($this, 'output'), |
|
580 | + array('give_forms'), |
|
581 | 581 | 'normal', |
582 | 582 | 'high' |
583 | 583 | ); |
584 | 584 | |
585 | 585 | // Show Goal Metabox only if goal is enabled. |
586 | - if ( give_is_setting_enabled( give_get_meta( give_get_admin_post_id(), '_give_goal_option', true ) ) ) { |
|
586 | + if (give_is_setting_enabled(give_get_meta(give_get_admin_post_id(), '_give_goal_option', true))) { |
|
587 | 587 | add_meta_box( |
588 | 588 | 'give-form-goal-stats', |
589 | - __( 'Goal Statistics', 'give' ), |
|
590 | - array( $this, 'output_goal' ), |
|
591 | - array( 'give_forms' ), |
|
589 | + __('Goal Statistics', 'give'), |
|
590 | + array($this, 'output_goal'), |
|
591 | + array('give_forms'), |
|
592 | 592 | 'side', |
593 | 593 | 'low' |
594 | 594 | ); |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | function enqueue_script() { |
608 | 608 | global $post; |
609 | 609 | |
610 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
610 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
611 | 611 | |
612 | 612 | } |
613 | 613 | } |
@@ -645,32 +645,32 @@ discard block |
||
645 | 645 | public function get_tabs() { |
646 | 646 | $tabs = array(); |
647 | 647 | |
648 | - if ( ! empty( $this->settings ) ) { |
|
649 | - foreach ( $this->settings as $setting ) { |
|
650 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
648 | + if ( ! empty($this->settings)) { |
|
649 | + foreach ($this->settings as $setting) { |
|
650 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
651 | 651 | continue; |
652 | 652 | } |
653 | 653 | $tab = array( |
654 | 654 | 'id' => $setting['id'], |
655 | 655 | 'label' => $setting['title'], |
656 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
656 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
657 | 657 | ); |
658 | 658 | |
659 | - if ( $this->has_sub_tab( $setting ) ) { |
|
660 | - if ( empty( $setting['sub-fields'] ) ) { |
|
659 | + if ($this->has_sub_tab($setting)) { |
|
660 | + if (empty($setting['sub-fields'])) { |
|
661 | 661 | $tab = array(); |
662 | 662 | } else { |
663 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
663 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
664 | 664 | $tab['sub-fields'][] = array( |
665 | 665 | 'id' => $sub_fields['id'], |
666 | 666 | 'label' => $sub_fields['title'], |
667 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
667 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
668 | 668 | ); |
669 | 669 | } |
670 | 670 | } |
671 | 671 | } |
672 | 672 | |
673 | - if ( ! empty( $tab ) ) { |
|
673 | + if ( ! empty($tab)) { |
|
674 | 674 | $tabs[] = $tab; |
675 | 675 | } |
676 | 676 | } |
@@ -688,33 +688,33 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public function output() { |
690 | 690 | // Bailout. |
691 | - if ( $form_data_tabs = $this->get_tabs() ) : |
|
692 | - $active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options'; |
|
693 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
691 | + if ($form_data_tabs = $this->get_tabs()) : |
|
692 | + $active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options'; |
|
693 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
694 | 694 | ?> |
695 | 695 | <input id="give_form_active_tab" type="hidden" name="give_form_active_tab"> |
696 | 696 | <div class="give-metabox-panel-wrap"> |
697 | 697 | <ul class="give-form-data-tabs give-metabox-tabs"> |
698 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
698 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
699 | 699 | <?php |
700 | 700 | // Determine if current tab is active. |
701 | 701 | $is_active = $active_tab === $form_data_tab['id'] ? true : false; |
702 | 702 | ?> |
703 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
703 | + <li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
704 | 704 | <a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>"> |
705 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
705 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
706 | 706 | <?php echo $form_data_tab['icon-html']; ?> |
707 | 707 | <?php else : ?> |
708 | 708 | <span class="give-icon give-icon-default"></span> |
709 | 709 | <?php endif; ?> |
710 | 710 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
711 | 711 | </a> |
712 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
712 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
713 | 713 | <ul class="give-metabox-sub-tabs give-hidden"> |
714 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
714 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
715 | 715 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
716 | 716 | <a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>"> |
717 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
717 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
718 | 718 | <?php echo $sub_tab['icon-html']; ?> |
719 | 719 | <?php else : ?> |
720 | 720 | <span class="give-icon give-icon-default"></span> |
@@ -729,29 +729,29 @@ discard block |
||
729 | 729 | <?php endforeach; ?> |
730 | 730 | </ul> |
731 | 731 | |
732 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
733 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
732 | + <?php foreach ($this->settings as $setting) : ?> |
|
733 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
734 | 734 | <?php |
735 | 735 | // Determine if current panel is active. |
736 | 736 | $is_active = $active_tab === $setting['id'] ? true : false; |
737 | 737 | ?> |
738 | - <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>"> |
|
739 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
740 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
741 | - <?php give_render_field( $field ); ?> |
|
738 | + <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>"> |
|
739 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
740 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
741 | + <?php give_render_field($field); ?> |
|
742 | 742 | <?php endforeach; ?> |
743 | 743 | <?php endif; ?> |
744 | 744 | </div> |
745 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
745 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
746 | 746 | |
747 | 747 | |
748 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
749 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
750 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
748 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
749 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
750 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
751 | 751 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
752 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
753 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
754 | - <?php give_render_field( $sub_field ); ?> |
|
752 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
753 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
754 | + <?php give_render_field($sub_field); ?> |
|
755 | 755 | <?php endforeach; ?> |
756 | 756 | <?php endif; ?> |
757 | 757 | </div> |
@@ -774,9 +774,9 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @return void |
776 | 776 | */ |
777 | - public function output_goal( $post ) { |
|
777 | + public function output_goal($post) { |
|
778 | 778 | |
779 | - echo give_admin_form_goal_stats( $post->ID ); |
|
779 | + echo give_admin_form_goal_stats($post->ID); |
|
780 | 780 | |
781 | 781 | } |
782 | 782 | |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | * |
790 | 790 | * @return bool |
791 | 791 | */ |
792 | - private function has_sub_tab( $field_setting ) { |
|
792 | + private function has_sub_tab($field_setting) { |
|
793 | 793 | $has_sub_tab = false; |
794 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
794 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
795 | 795 | $has_sub_tab = true; |
796 | 796 | } |
797 | 797 | |
@@ -806,13 +806,13 @@ discard block |
||
806 | 806 | * @return array |
807 | 807 | */ |
808 | 808 | function cmb2_metabox_settings() { |
809 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
809 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
810 | 810 | $give_forms_settings = $all_cmb2_settings; |
811 | 811 | |
812 | 812 | // Filter settings: Use only give forms related settings. |
813 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
814 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
815 | - unset( $give_forms_settings[ $index ] ); |
|
813 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
814 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
815 | + unset($give_forms_settings[$index]); |
|
816 | 816 | } |
817 | 817 | } |
818 | 818 | |
@@ -830,100 +830,100 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return void |
832 | 832 | */ |
833 | - public function save( $post_id, $post ) { |
|
833 | + public function save($post_id, $post) { |
|
834 | 834 | |
835 | 835 | // $post_id and $post are required. |
836 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
836 | + if (empty($post_id) || empty($post)) { |
|
837 | 837 | return; |
838 | 838 | } |
839 | 839 | |
840 | 840 | // Don't save meta boxes for revisions or autosaves. |
841 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
841 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
842 | 842 | return; |
843 | 843 | } |
844 | 844 | |
845 | 845 | // Check the nonce. |
846 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
846 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
847 | 847 | return; |
848 | 848 | } |
849 | 849 | |
850 | 850 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
851 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
851 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
852 | 852 | return; |
853 | 853 | } |
854 | 854 | |
855 | 855 | // Check user has permission to edit. |
856 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
856 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
857 | 857 | return; |
858 | 858 | } |
859 | 859 | |
860 | 860 | // Fire action before saving form meta. |
861 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
861 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
862 | 862 | |
863 | 863 | /** |
864 | 864 | * Filter the meta key to save. |
865 | 865 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
866 | 866 | */ |
867 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
867 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
868 | 868 | |
869 | 869 | // Save form meta data. |
870 | - if ( ! empty( $form_meta_keys ) ) { |
|
871 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
870 | + if ( ! empty($form_meta_keys)) { |
|
871 | + foreach ($form_meta_keys as $form_meta_key) { |
|
872 | 872 | |
873 | 873 | // Set default value for checkbox fields. |
874 | 874 | if ( |
875 | - ! isset( $_POST[ $form_meta_key ] ) |
|
876 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
875 | + ! isset($_POST[$form_meta_key]) |
|
876 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
877 | 877 | ) { |
878 | - $_POST[ $form_meta_key ] = ''; |
|
878 | + $_POST[$form_meta_key] = ''; |
|
879 | 879 | } |
880 | 880 | |
881 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
882 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
883 | - if ( ! empty( $setting_field['type'] ) ) { |
|
884 | - switch ( $setting_field['type'] ) { |
|
881 | + if (isset($_POST[$form_meta_key])) { |
|
882 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
883 | + if ( ! empty($setting_field['type'])) { |
|
884 | + switch ($setting_field['type']) { |
|
885 | 885 | case 'textarea': |
886 | 886 | case 'wysiwyg': |
887 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
887 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
888 | 888 | break; |
889 | 889 | |
890 | 890 | case 'donation_limit' : |
891 | - $form_meta_value = $_POST[ $form_meta_key ]; |
|
891 | + $form_meta_value = $_POST[$form_meta_key]; |
|
892 | 892 | break; |
893 | 893 | |
894 | 894 | case 'group': |
895 | 895 | $form_meta_value = array(); |
896 | 896 | |
897 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
897 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
898 | 898 | |
899 | 899 | // Do not save template input field values. |
900 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
900 | + if ('{{row-count-placeholder}}' === $index) { |
|
901 | 901 | continue; |
902 | 902 | } |
903 | 903 | |
904 | 904 | $group_meta_value = array(); |
905 | - foreach ( $group as $field_id => $field_value ) { |
|
906 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
905 | + foreach ($group as $field_id => $field_value) { |
|
906 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
907 | 907 | case 'wysiwyg': |
908 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
908 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
909 | 909 | break; |
910 | 910 | |
911 | 911 | default: |
912 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
912 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
913 | 913 | } |
914 | 914 | } |
915 | 915 | |
916 | - if ( ! empty( $group_meta_value ) ) { |
|
917 | - $form_meta_value[ $index ] = $group_meta_value; |
|
916 | + if ( ! empty($group_meta_value)) { |
|
917 | + $form_meta_value[$index] = $group_meta_value; |
|
918 | 918 | } |
919 | 919 | } |
920 | 920 | |
921 | 921 | // Arrange repeater field keys in order. |
922 | - $form_meta_value = array_values( $form_meta_value ); |
|
922 | + $form_meta_value = array_values($form_meta_value); |
|
923 | 923 | break; |
924 | 924 | |
925 | 925 | default: |
926 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
926 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
927 | 927 | }// End switch(). |
928 | 928 | |
929 | 929 | /** |
@@ -933,38 +933,38 @@ discard block |
||
933 | 933 | */ |
934 | 934 | $form_meta_value = apply_filters( |
935 | 935 | 'give_pre_save_form_meta_value', |
936 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
936 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
937 | 937 | $form_meta_key, |
938 | 938 | $this, |
939 | 939 | $post_id |
940 | 940 | ); |
941 | 941 | |
942 | 942 | // Range slider. |
943 | - if ( 'donation_limit' === $setting_field['type'] ) { |
|
943 | + if ('donation_limit' === $setting_field['type']) { |
|
944 | 944 | |
945 | 945 | // Sanitize amount for db. |
946 | - $form_meta_value = array_map( 'give_sanitize_amount_for_db', $form_meta_value ); |
|
946 | + $form_meta_value = array_map('give_sanitize_amount_for_db', $form_meta_value); |
|
947 | 947 | |
948 | 948 | // Store it to form meta. |
949 | - give_update_meta( $post_id, $form_meta_key . '_minimum', $form_meta_value['minimum'] ); |
|
950 | - give_update_meta( $post_id, $form_meta_key . '_maximum', $form_meta_value['maximum'] ); |
|
949 | + give_update_meta($post_id, $form_meta_key.'_minimum', $form_meta_value['minimum']); |
|
950 | + give_update_meta($post_id, $form_meta_key.'_maximum', $form_meta_value['maximum']); |
|
951 | 951 | } else { |
952 | 952 | // Save data. |
953 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
953 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
954 | 954 | } |
955 | 955 | |
956 | 956 | // Verify and delete form meta based on the form status. |
957 | - give_set_form_closed_status( $post_id ); |
|
957 | + give_set_form_closed_status($post_id); |
|
958 | 958 | |
959 | 959 | // Fire after saving form meta key. |
960 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
960 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
961 | 961 | }// End if(). |
962 | 962 | }// End if(). |
963 | 963 | }// End foreach(). |
964 | 964 | }// End if(). |
965 | 965 | |
966 | 966 | // Fire action after saving form meta. |
967 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
967 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | |
@@ -977,10 +977,10 @@ discard block |
||
977 | 977 | * |
978 | 978 | * @return string |
979 | 979 | */ |
980 | - private function get_field_id( $field ) { |
|
980 | + private function get_field_id($field) { |
|
981 | 981 | $field_id = ''; |
982 | 982 | |
983 | - if ( array_key_exists( 'id', $field ) ) { |
|
983 | + if (array_key_exists('id', $field)) { |
|
984 | 984 | $field_id = $field['id']; |
985 | 985 | |
986 | 986 | } |
@@ -997,16 +997,16 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return array |
999 | 999 | */ |
1000 | - private function get_fields_id( $setting ) { |
|
1000 | + private function get_fields_id($setting) { |
|
1001 | 1001 | $meta_keys = array(); |
1002 | 1002 | |
1003 | 1003 | if ( |
1004 | - ! empty( $setting ) |
|
1005 | - && array_key_exists( 'fields', $setting ) |
|
1006 | - && ! empty( $setting['fields'] ) |
|
1004 | + ! empty($setting) |
|
1005 | + && array_key_exists('fields', $setting) |
|
1006 | + && ! empty($setting['fields']) |
|
1007 | 1007 | ) { |
1008 | - foreach ( $setting['fields'] as $field ) { |
|
1009 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1008 | + foreach ($setting['fields'] as $field) { |
|
1009 | + if ($field_id = $this->get_field_id($field)) { |
|
1010 | 1010 | $meta_keys[] = $field_id; |
1011 | 1011 | } |
1012 | 1012 | } |
@@ -1024,14 +1024,14 @@ discard block |
||
1024 | 1024 | * |
1025 | 1025 | * @return array |
1026 | 1026 | */ |
1027 | - private function get_sub_fields_id( $setting ) { |
|
1027 | + private function get_sub_fields_id($setting) { |
|
1028 | 1028 | $meta_keys = array(); |
1029 | 1029 | |
1030 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
1031 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1032 | - if ( ! empty( $fields['fields'] ) ) { |
|
1033 | - foreach ( $fields['fields'] as $field ) { |
|
1034 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
1030 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
1031 | + foreach ($setting['sub-fields'] as $fields) { |
|
1032 | + if ( ! empty($fields['fields'])) { |
|
1033 | + foreach ($fields['fields'] as $field) { |
|
1034 | + if ($field_id = $this->get_field_id($field)) { |
|
1035 | 1035 | $meta_keys[] = $field_id; |
1036 | 1036 | } |
1037 | 1037 | } |
@@ -1053,14 +1053,14 @@ discard block |
||
1053 | 1053 | private function get_meta_keys_from_settings() { |
1054 | 1054 | $meta_keys = array(); |
1055 | 1055 | |
1056 | - foreach ( $this->settings as $setting ) { |
|
1057 | - $meta_key = $this->get_fields_id( $setting ); |
|
1056 | + foreach ($this->settings as $setting) { |
|
1057 | + $meta_key = $this->get_fields_id($setting); |
|
1058 | 1058 | |
1059 | - if ( $this->has_sub_tab( $setting ) ) { |
|
1060 | - $meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) ); |
|
1059 | + if ($this->has_sub_tab($setting)) { |
|
1060 | + $meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting)); |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
1063 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | return $meta_keys; |
@@ -1077,10 +1077,10 @@ discard block |
||
1077 | 1077 | * |
1078 | 1078 | * @return string |
1079 | 1079 | */ |
1080 | - function get_field_type( $field_id, $group_id = '' ) { |
|
1081 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
1080 | + function get_field_type($field_id, $group_id = '') { |
|
1081 | + $field = $this->get_setting_field($field_id, $group_id); |
|
1082 | 1082 | |
1083 | - $type = array_key_exists( 'type', $field ) |
|
1083 | + $type = array_key_exists('type', $field) |
|
1084 | 1084 | ? $field['type'] |
1085 | 1085 | : ''; |
1086 | 1086 | |
@@ -1098,12 +1098,12 @@ discard block |
||
1098 | 1098 | * |
1099 | 1099 | * @return array |
1100 | 1100 | */ |
1101 | - private function get_field( $setting, $field_id ) { |
|
1101 | + private function get_field($setting, $field_id) { |
|
1102 | 1102 | $setting_field = array(); |
1103 | 1103 | |
1104 | - if ( ! empty( $setting['fields'] ) ) { |
|
1105 | - foreach ( $setting['fields'] as $field ) { |
|
1106 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1104 | + if ( ! empty($setting['fields'])) { |
|
1105 | + foreach ($setting['fields'] as $field) { |
|
1106 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1107 | 1107 | $setting_field = $field; |
1108 | 1108 | break; |
1109 | 1109 | } |
@@ -1123,12 +1123,12 @@ discard block |
||
1123 | 1123 | * |
1124 | 1124 | * @return array |
1125 | 1125 | */ |
1126 | - private function get_sub_field( $setting, $field_id ) { |
|
1126 | + private function get_sub_field($setting, $field_id) { |
|
1127 | 1127 | $setting_field = array(); |
1128 | 1128 | |
1129 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1130 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1131 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1129 | + if ( ! empty($setting['sub-fields'])) { |
|
1130 | + foreach ($setting['sub-fields'] as $fields) { |
|
1131 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1132 | 1132 | $setting_field = $field; |
1133 | 1133 | break; |
1134 | 1134 | } |
@@ -1148,17 +1148,17 @@ discard block |
||
1148 | 1148 | * |
1149 | 1149 | * @return array |
1150 | 1150 | */ |
1151 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1151 | + function get_setting_field($field_id, $group_id = '') { |
|
1152 | 1152 | $setting_field = array(); |
1153 | 1153 | |
1154 | 1154 | $_field_id = $field_id; |
1155 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1155 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1156 | 1156 | |
1157 | - if ( ! empty( $this->settings ) ) { |
|
1158 | - foreach ( $this->settings as $setting ) { |
|
1157 | + if ( ! empty($this->settings)) { |
|
1158 | + foreach ($this->settings as $setting) { |
|
1159 | 1159 | if ( |
1160 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1161 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1160 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1161 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1162 | 1162 | ) { |
1163 | 1163 | break; |
1164 | 1164 | } |
@@ -1166,9 +1166,9 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | // Get field from group. |
1169 | - if ( ! empty( $group_id ) ) { |
|
1170 | - foreach ( $setting_field['fields'] as $field ) { |
|
1171 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1169 | + if ( ! empty($group_id)) { |
|
1170 | + foreach ($setting_field['fields'] as $field) { |
|
1171 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1172 | 1172 | $setting_field = $field; |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1187,14 +1187,14 @@ discard block |
||
1187 | 1187 | * |
1188 | 1188 | * @return mixed |
1189 | 1189 | */ |
1190 | - function add_offline_donations_setting_tab( $settings ) { |
|
1191 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1192 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1190 | + function add_offline_donations_setting_tab($settings) { |
|
1191 | + if (give_is_gateway_active('offline')) { |
|
1192 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1193 | 1193 | 'id' => 'offline_donations_options', |
1194 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1194 | + 'title' => __('Offline Donations', 'give'), |
|
1195 | 1195 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1196 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1197 | - ) ); |
|
1196 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1197 | + )); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | return $settings; |
@@ -1212,37 +1212,33 @@ discard block |
||
1212 | 1212 | * |
1213 | 1213 | * @return mixed |
1214 | 1214 | */ |
1215 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1216 | - switch ( $setting_field['type'] ) { |
|
1215 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1216 | + switch ($setting_field['type']) { |
|
1217 | 1217 | case 'group': |
1218 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1219 | - foreach ( $setting_field['fields'] as $field ) { |
|
1220 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1218 | + if ( ! empty($setting_field['fields'])) { |
|
1219 | + foreach ($setting_field['fields'] as $field) { |
|
1220 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1221 | 1221 | continue; |
1222 | 1222 | } |
1223 | 1223 | |
1224 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1225 | - if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1224 | + foreach ($meta_value as $index => $meta_data) { |
|
1225 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1226 | 1226 | continue; |
1227 | 1227 | } |
1228 | 1228 | |
1229 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ? |
|
1230 | - give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) : |
|
1231 | - ( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ? |
|
1232 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1233 | - 0 ); |
|
1229 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ? |
|
1230 | + give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ? |
|
1231 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1234 | 1232 | } |
1235 | 1233 | } |
1236 | 1234 | } |
1237 | 1235 | break; |
1238 | 1236 | |
1239 | 1237 | default: |
1240 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1238 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1241 | 1239 | $meta_value = $meta_value ? |
1242 | - give_sanitize_amount_for_db( $meta_value ) : |
|
1243 | - ( in_array( $setting_field['id'], array( '_give_set_price', '_give_custom_amount_minimum', '_give_set_goal' ) ) ? |
|
1244 | - give_sanitize_amount_for_db( '1.00' ) : |
|
1245 | - 0 ); |
|
1240 | + give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array('_give_set_price', '_give_custom_amount_minimum', '_give_set_goal')) ? |
|
1241 | + give_sanitize_amount_for_db('1.00') : 0); |
|
1246 | 1242 | } |
1247 | 1243 | } |
1248 | 1244 | |
@@ -1260,12 +1256,12 @@ discard block |
||
1260 | 1256 | * |
1261 | 1257 | * @return string The URL after redirect. |
1262 | 1258 | */ |
1263 | - public function maintain_active_tab( $location, $post_id ) { |
|
1259 | + public function maintain_active_tab($location, $post_id) { |
|
1264 | 1260 | if ( |
1265 | - 'give_forms' === get_post_type( $post_id ) && |
|
1266 | - ! empty( $_POST['give_form_active_tab'] ) |
|
1261 | + 'give_forms' === get_post_type($post_id) && |
|
1262 | + ! empty($_POST['give_form_active_tab']) |
|
1267 | 1263 | ) { |
1268 | - $location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location ); |
|
1264 | + $location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location); |
|
1269 | 1265 | } |
1270 | 1266 | |
1271 | 1267 | return $location; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return static |
52 | 52 | */ |
53 | 53 | public static function get_instance() { |
54 | - if ( null === static::$instance ) { |
|
54 | + if (null === static::$instance) { |
|
55 | 55 | self::$instance = new static(); |
56 | 56 | self::$instance->setup(); |
57 | 57 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @since 1.8.13 |
67 | 67 | */ |
68 | 68 | private function setup() { |
69 | - add_filter( 'cron_schedules', array( self::$instance, '__add_schedules' ) ); |
|
70 | - add_action( 'wp', array( self::$instance, '__schedule_events' ) ); |
|
69 | + add_filter('cron_schedules', array(self::$instance, '__add_schedules')); |
|
70 | + add_action('wp', array(self::$instance, '__schedule_events')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array An array of non-default cron schedules. |
82 | 82 | */ |
83 | - public function __add_schedules( $schedules = array() ) { |
|
83 | + public function __add_schedules($schedules = array()) { |
|
84 | 84 | // Adds once weekly to the existing schedules. |
85 | 85 | $schedules['weekly'] = array( |
86 | 86 | 'interval' => 604800, |
87 | - 'display' => __( 'Once Weekly', 'give' ), |
|
87 | + 'display' => __('Once Weekly', 'give'), |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $schedules; |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @return void |
113 | 113 | */ |
114 | 114 | private function weekly_events() { |
115 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
116 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
115 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
116 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @return void |
127 | 127 | */ |
128 | 128 | private function daily_events() { |
129 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
130 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
129 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
130 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return string |
143 | 143 | */ |
144 | - public static function get_cron_action( $type = 'weekly' ) { |
|
145 | - switch ( $type ) { |
|
144 | + public static function get_cron_action($type = 'weekly') { |
|
145 | + switch ($type) { |
|
146 | 146 | case 'daily': |
147 | 147 | $cron_action = 'give_daily_scheduled_events'; |
148 | 148 | break; |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @param $action |
165 | 165 | * @param string $type |
166 | 166 | */ |
167 | - private static function add_event( $action, $type = 'weekly' ) { |
|
168 | - $cron_event = self::get_cron_action( $type ); |
|
169 | - add_action( $cron_event, $action ); |
|
167 | + private static function add_event($action, $type = 'weekly') { |
|
168 | + $cron_event = self::get_cron_action($type); |
|
169 | + add_action($cron_event, $action); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @param $action |
179 | 179 | */ |
180 | - public static function add_weekly_event( $action ) { |
|
181 | - self::add_event( $action, 'weekly' ); |
|
180 | + public static function add_weekly_event($action) { |
|
181 | + self::add_event($action, 'weekly'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @param $action |
191 | 191 | */ |
192 | - public static function add_daily_event( $action ) { |
|
193 | - self::add_event( $action, 'daily' ); |
|
192 | + public static function add_daily_event($action) { |
|
193 | + self::add_event($action, 'daily'); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 |
@@ -11,19 +11,19 @@ |
||
11 | 11 | * |
12 | 12 | * @return string|array |
13 | 13 | */ |
14 | -function __give_v20_bc_user_address( $meta_value, $user_id, $meta_key, $single ) { |
|
14 | +function __give_v20_bc_user_address($meta_value, $user_id, $meta_key, $single) { |
|
15 | 15 | if ( |
16 | - give_has_upgrade_completed( 'v20_upgrades_user_address' ) && |
|
16 | + give_has_upgrade_completed('v20_upgrades_user_address') && |
|
17 | 17 | '_give_user_address' === $meta_key |
18 | 18 | ) { |
19 | - $meta_value = give_get_donor_address( $user_id ); |
|
19 | + $meta_value = give_get_donor_address($user_id); |
|
20 | 20 | |
21 | - if ( $single ) { |
|
22 | - $meta_value = array( $meta_value ); |
|
21 | + if ($single) { |
|
22 | + $meta_value = array($meta_value); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | 26 | return $meta_value; |
27 | 27 | } |
28 | 28 | |
29 | -add_filter( 'get_user_metadata', '__give_v20_bc_user_address', 10, 4 ); |
|
30 | 29 | \ No newline at end of file |
30 | +add_filter('get_user_metadata', '__give_v20_bc_user_address', 10, 4); |
|
31 | 31 | \ 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 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a receipt while editing a donation. |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email. |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 ); |
|
37 | 36 | \ No newline at end of file |
37 | +add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1); |
|
38 | 38 | \ 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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @since 1.0 |
21 | 21 | */ |
22 | -class Give_Forms_Widget extends WP_Widget{ |
|
22 | +class Give_Forms_Widget extends WP_Widget { |
|
23 | 23 | /** |
24 | 24 | * The widget class name |
25 | 25 | * |
@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Instantiate the class |
32 | 32 | */ |
33 | - public function __construct(){ |
|
34 | - $this->self = get_class( $this ); |
|
33 | + public function __construct() { |
|
34 | + $this->self = get_class($this); |
|
35 | 35 | |
36 | 36 | parent::__construct( |
37 | - strtolower( $this->self ), |
|
38 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
37 | + strtolower($this->self), |
|
38 | + esc_html__('Give - Donation Form', 'give'), |
|
39 | 39 | array( |
40 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
40 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
41 | 41 | ) |
42 | 42 | ); |
43 | 43 | |
44 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
45 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
44 | + add_action('widgets_init', array($this, 'widget_init')); |
|
45 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function admin_widget_scripts( $hook ){ |
|
55 | + public function admin_widget_scripts($hook) { |
|
56 | 56 | // Directories of assets |
57 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
58 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
59 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
57 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
58 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
59 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
60 | 60 | |
61 | 61 | // Use minified libraries if SCRIPT_DEBUG is turned off |
62 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
62 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
63 | 63 | |
64 | 64 | // Widget Script |
65 | - if ( $hook == 'widgets.php' ) { |
|
65 | + if ($hook == 'widgets.php') { |
|
66 | 66 | |
67 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
67 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * before_widget, and after_widget. |
76 | 76 | * @param array $instance The settings for the particular instance of the widget. |
77 | 77 | */ |
78 | - public function widget( $args, $instance ){ |
|
79 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
80 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
78 | + public function widget($args, $instance) { |
|
79 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
80 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
81 | 81 | |
82 | 82 | echo $args['before_widget']; |
83 | 83 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_before_forms_widget' ); |
|
89 | + do_action('give_before_forms_widget'); |
|
90 | 90 | |
91 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
91 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
92 | 92 | |
93 | - give_get_donation_form( $instance ); |
|
93 | + give_get_donation_form($instance); |
|
94 | 94 | |
95 | 95 | echo $args['after_widget']; |
96 | 96 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @since 1.0 |
101 | 101 | */ |
102 | - do_action( 'give_after_forms_widget' ); |
|
102 | + do_action('give_after_forms_widget'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function form( $instance ){ |
|
112 | + public function form($instance) { |
|
113 | 113 | $defaults = array( |
114 | 114 | 'title' => '', |
115 | 115 | 'id' => '', |
@@ -119,84 +119,84 @@ discard block |
||
119 | 119 | 'continue_button_title' => '', |
120 | 120 | ); |
121 | 121 | |
122 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
122 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
123 | 123 | |
124 | 124 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
125 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
125 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
126 | 126 | |
127 | 127 | // Query Give Forms |
128 | 128 | $args = array( |
129 | 129 | 'post_type' => 'give_forms', |
130 | - 'posts_per_page' => - 1, |
|
130 | + 'posts_per_page' => -1, |
|
131 | 131 | 'post_status' => 'publish', |
132 | 132 | ); |
133 | 133 | |
134 | - $give_forms = get_posts( $args ); |
|
134 | + $give_forms = get_posts($args); |
|
135 | 135 | ?> |
136 | 136 | <div class="give_forms_widget_container"> |
137 | 137 | |
138 | 138 | <?php // Widget: widget Title. ?> |
139 | 139 | <p> |
140 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
141 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
142 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
140 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
141 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
142 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
143 | 143 | </p> |
144 | 144 | |
145 | 145 | <?php // Widget: Give Form?> |
146 | 146 | <p> |
147 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
148 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
149 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
150 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
151 | - <?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?> |
|
152 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option> |
|
147 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
148 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
149 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
150 | + <?php foreach ($give_forms as $give_form) { ?> |
|
151 | + <?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?> |
|
152 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option> |
|
153 | 153 | <?php } ?> |
154 | 154 | </select><br> |
155 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
155 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
156 | 156 | </p> |
157 | 157 | |
158 | 158 | <?php // Widget: Display Style ?> |
159 | 159 | <p class="give_forms_display_style_setting_row"> |
160 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
161 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
162 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
163 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
164 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
160 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
161 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
162 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
163 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
164 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
165 | 165 | <small class="give-field-description"> |
166 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
166 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
167 | 167 | </small> |
168 | 168 | </p> |
169 | 169 | |
170 | 170 | <?php // Widget: Continue Button Title. ?> |
171 | 171 | <p class="give_forms_continue_button_title_setting_row"> |
172 | - <label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label> |
|
173 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br> |
|
174 | - <small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small> |
|
172 | + <label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label> |
|
173 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br> |
|
174 | + <small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small> |
|
175 | 175 | </p> |
176 | 176 | |
177 | 177 | <?php // Widget: Floating Labels ?> |
178 | 178 | <p> |
179 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
180 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
181 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
182 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
179 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
180 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
181 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
182 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
183 | 183 | <small class="give-field-description"> |
184 | 184 | <?php |
185 | 185 | printf( |
186 | 186 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
187 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
188 | - esc_url( 'http://docs.givewp.com/form-floating-labels' ) |
|
187 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
188 | + esc_url('http://docs.givewp.com/form-floating-labels') |
|
189 | 189 | ); |
190 | 190 | ?></small> |
191 | 191 | </p> |
192 | 192 | |
193 | 193 | <?php // Widget: Display Content ?> |
194 | 194 | <p> |
195 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
196 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
197 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
198 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
199 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
195 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
196 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
197 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
198 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
199 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
200 | 200 | </div> |
201 | 201 | <?php |
202 | 202 | } |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return void |
208 | 208 | */ |
209 | - function widget_init(){ |
|
210 | - register_widget( $this->self ); |
|
209 | + function widget_init() { |
|
210 | + register_widget($this->self); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return array |
220 | 220 | */ |
221 | - public function update( $new_instance, $old_instance ){ |
|
221 | + public function update($new_instance, $old_instance) { |
|
222 | 222 | $this->flush_widget_cache(); |
223 | 223 | |
224 | 224 | return $new_instance; |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return void |
231 | 231 | */ |
232 | - public function flush_widget_cache(){ |
|
233 | - wp_cache_delete( $this->self, 'widget' ); |
|
232 | + public function flush_widget_cache() { |
|
233 | + wp_cache_delete($this->self, 'widget'); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 |