@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if access directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
20 | -if ( ! class_exists( 'Give_New_Donation_Email' ) ) : |
|
20 | +if ( ! class_exists('Give_New_Donation_Email')) : |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Give_New_Donation_Email |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function init() { |
39 | 39 | // Initialize empty payment. |
40 | - $this->payment = new Give_Payment( 0 ); |
|
40 | + $this->payment = new Give_Payment(0); |
|
41 | 41 | |
42 | - $this->load( array( |
|
42 | + $this->load(array( |
|
43 | 43 | 'id' => 'new-donation', |
44 | - 'label' => __( 'New Donation', 'give' ), |
|
45 | - 'description' => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ), |
|
44 | + 'label' => __('New Donation', 'give'), |
|
45 | + 'description' => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'), |
|
46 | 46 | 'has_recipient_field' => true, |
47 | 47 | 'notification_status' => 'enabled', |
48 | 48 | 'form_metabox_setting' => true, |
49 | - 'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
49 | + 'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
50 | 50 | 'default_email_message' => give_get_default_donation_notification_email(), |
51 | - 'default_email_header' => __( 'New Donation!', 'give' ), |
|
52 | - ) ); |
|
51 | + 'default_email_header' => __('New Donation!', 'give'), |
|
52 | + )); |
|
53 | 53 | |
54 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) ); |
|
54 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - public function get_email_subject( $form_id = null ) { |
|
67 | + public function get_email_subject($form_id = null) { |
|
68 | 68 | $subject = wp_strip_all_tags( |
69 | 69 | Give_Email_Notification_Util::get_value( |
70 | 70 | $this, |
71 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
71 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
72 | 72 | $form_id, |
73 | 73 | $this->config['default_email_subject'] |
74 | 74 | ) |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - $subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID ); |
|
83 | + $subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Filters the donation notification subject. |
87 | 87 | * |
88 | 88 | * @since 2.0 |
89 | 89 | */ |
90 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
90 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
91 | 91 | |
92 | 92 | return $subject; |
93 | 93 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function get_email_message( $form_id = null ) { |
|
106 | + public function get_email_message($form_id = null) { |
|
107 | 107 | $message = Give_Email_Notification_Util::get_value( |
108 | 108 | $this, |
109 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
109 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
110 | 110 | $form_id, |
111 | 111 | $this->config['default_email_message'] |
112 | 112 | ); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param int $form_id |
150 | 150 | * @return array |
151 | 151 | */ |
152 | - public function get_email_attachments( $form_id = null ) { |
|
152 | + public function get_email_attachments($form_id = null) { |
|
153 | 153 | /** |
154 | 154 | * Filters the donation notification email attachments. |
155 | 155 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $this->payment->payment_meta |
213 | 213 | ); |
214 | 214 | |
215 | - Give()->emails->__set( 'from_name', $from_name ); |
|
216 | - Give()->emails->__set( 'from_email', $from_email ); |
|
217 | - Give()->emails->__set( 'heading', $this->get_email_header() ); |
|
215 | + Give()->emails->__set('from_name', $from_name); |
|
216 | + Give()->emails->__set('from_email', $from_email); |
|
217 | + Give()->emails->__set('heading', $this->get_email_header()); |
|
218 | 218 | |
219 | 219 | /** |
220 | 220 | * Filters the donation notification email headers. |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $this->payment->payment_meta |
229 | 229 | ); |
230 | 230 | |
231 | - Give()->emails->__set( 'headers', $headers ); |
|
231 | + Give()->emails->__set('headers', $headers); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -239,16 +239,16 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @param int $payment_id |
241 | 241 | */ |
242 | - public function setup_email_notification( $payment_id ) { |
|
243 | - $this->payment = new Give_Payment( $payment_id ); |
|
242 | + public function setup_email_notification($payment_id) { |
|
243 | + $this->payment = new Give_Payment($payment_id); |
|
244 | 244 | |
245 | 245 | // Set email data. |
246 | 246 | $this->setup_email_data(); |
247 | 247 | |
248 | 248 | // Send email. |
249 | - $this->send_email_notification( array( |
|
249 | + $this->send_email_notification(array( |
|
250 | 250 | 'payment_id' => $payment_id, |
251 | - ) ); |
|
251 | + )); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * @access public |
37 | 37 | */ |
38 | 38 | public function __construct() { |
39 | - parent::__construct( array( |
|
40 | - 'singular' => __( 'Give Email Notification', 'give' ), |
|
41 | - 'plural' => __( 'Give Email Notifications', 'give' ), |
|
42 | - ) ); |
|
39 | + parent::__construct(array( |
|
40 | + 'singular' => __('Give Email Notification', 'give'), |
|
41 | + 'plural' => __('Give Email Notifications', 'give'), |
|
42 | + )); |
|
43 | 43 | |
44 | 44 | $this->email_notifications = Give_Email_Notifications::get_instance(); |
45 | 45 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 2.0 |
61 | 61 | */ |
62 | - return apply_filters( 'give_email_notification_setting_columns', array( |
|
63 | - 'cb' => __( 'Email Status', 'give' ), |
|
64 | - 'name' => __( 'Email', 'give' ), |
|
65 | - 'email_type' => __( 'Content Type', 'give' ), |
|
66 | - 'recipient' => __( 'Recipient(s)', 'give' ), |
|
67 | - 'setting' => __( 'Edit Email', 'give' ), |
|
68 | - ) ); |
|
62 | + return apply_filters('give_email_notification_setting_columns', array( |
|
63 | + 'cb' => __('Email Status', 'give'), |
|
64 | + 'name' => __('Email', 'give'), |
|
65 | + 'email_type' => __('Content Type', 'give'), |
|
66 | + 'recipient' => __('Recipient(s)', 'give'), |
|
67 | + 'setting' => __('Edit Email', 'give'), |
|
68 | + )); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function column_name( $email ) { |
|
82 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
83 | - $actions = $this->get_row_actions( $email ); |
|
81 | + public function column_name($email) { |
|
82 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
83 | + $actions = $this->get_row_actions($email); |
|
84 | 84 | |
85 | 85 | ob_start(); |
86 | 86 | ?> |
87 | 87 | <a class="row-title" href="<?php echo $edit_url; ?>"><?php echo $email->config['label']; ?></a> |
88 | 88 | |
89 | - <?php if ( $desc = $email->config['description'] ) : ?> |
|
90 | - <?php echo Give()->tooltips->render_help( esc_attr( $desc ) ); ?> |
|
89 | + <?php if ($desc = $email->config['description']) : ?> |
|
90 | + <?php echo Give()->tooltips->render_help(esc_attr($desc)); ?> |
|
91 | 91 | <?php endif; ?> |
92 | 92 | |
93 | - <?php echo $this->row_actions( $actions ); ?> |
|
93 | + <?php echo $this->row_actions($actions); ?> |
|
94 | 94 | <?php |
95 | 95 | return ob_get_clean(); |
96 | 96 | } |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function column_recipient( $email ) { |
|
108 | + public function column_recipient($email) { |
|
109 | 109 | ob_start(); |
110 | 110 | |
111 | - if( Give_Email_Notification_Util::has_recipient_field( $email ) ) { |
|
111 | + if (Give_Email_Notification_Util::has_recipient_field($email)) { |
|
112 | 112 | $recipients = $email->get_recipient(); |
113 | - if ( is_array( $recipients ) ) { |
|
114 | - $recipients = implode( '<br>', $recipients ); |
|
113 | + if (is_array($recipients)) { |
|
114 | + $recipients = implode('<br>', $recipients); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | echo $recipients; |
118 | 118 | |
119 | - } elseif ( ! empty( $email->config['recipient_group_name'] ) ) { |
|
119 | + } elseif ( ! empty($email->config['recipient_group_name'])) { |
|
120 | 120 | echo $email->config['recipient_group_name']; |
121 | 121 | } |
122 | 122 | |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return string |
135 | 135 | */ |
136 | - public function column_cb( $email ) { |
|
136 | + public function column_cb($email) { |
|
137 | 137 | $notification_status = $email->get_notification_status(); |
138 | - $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable( $email ); |
|
139 | - $icon_classes = Give_Email_Notification_Util::is_email_notification_active( $email ) |
|
138 | + $user_can_edit_status = (int) Give_Email_Notification_Util::is_notification_status_editable($email); |
|
139 | + $icon_classes = Give_Email_Notification_Util::is_email_notification_active($email) |
|
140 | 140 | ? 'dashicons dashicons-yes' |
141 | 141 | : 'dashicons dashicons-no-alt'; |
142 | 142 | $attributes = array( |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | 'data-edit' => $user_can_edit_status, |
147 | 147 | ); |
148 | 148 | |
149 | - if ( ! $user_can_edit_status ) { |
|
150 | - $icon_classes = 'dashicons dashicons-lock'; |
|
149 | + if ( ! $user_can_edit_status) { |
|
150 | + $icon_classes = 'dashicons dashicons-lock'; |
|
151 | 151 | |
152 | - $attributes['data-notice'] = esc_attr( $email->config['notices']['non-notification-status-editable'] ); |
|
152 | + $attributes['data-notice'] = esc_attr($email->config['notices']['non-notification-status-editable']); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $html = sprintf( |
156 | 156 | '<span %1$s><i class="%2$s"></i></span></span><span class="spinner"></span>', |
157 | - give_get_attribute_str( $attributes ), |
|
157 | + give_get_attribute_str($attributes), |
|
158 | 158 | $icon_classes |
159 | 159 | ); |
160 | 160 | |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function column_email_type( Give_Email_Notification $email ) { |
|
175 | + public function column_email_type(Give_Email_Notification $email) { |
|
176 | 176 | $email_content_type_label = apply_filters( |
177 | 177 | "give_email_list_render_{$email->config['id']}_email_content_type", |
178 | - Give_Email_Notification_Util::get_formatted_email_type( $email->config['content_type'] ), |
|
178 | + Give_Email_Notification_Util::get_formatted_email_type($email->config['content_type']), |
|
179 | 179 | |
180 | 180 | ); |
181 | 181 | |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return string |
194 | 194 | */ |
195 | - public function column_setting( Give_Email_Notification $email ) { |
|
196 | - return Give()->tooltips->render_link( array( |
|
197 | - 'label' => __( 'Edit', 'give' ) . " {$email->config['label']}", |
|
195 | + public function column_setting(Give_Email_Notification $email) { |
|
196 | + return Give()->tooltips->render_link(array( |
|
197 | + 'label' => __('Edit', 'give')." {$email->config['label']}", |
|
198 | 198 | 'tag_content' => '<span class="dashicons dashicons-admin-generic"></span>', |
199 | - 'link' => esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ), |
|
199 | + 'link' => esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])), |
|
200 | 200 | 'attributes' => array( |
201 | 201 | 'class' => 'button button-small', |
202 | 202 | ), |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return array |
216 | 216 | */ |
217 | - private function get_row_actions( $email ) { |
|
218 | - $edit_url = esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails§ion=' . $email->config['id'] ) ); |
|
217 | + private function get_row_actions($email) { |
|
218 | + $edit_url = esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails§ion='.$email->config['id'])); |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Filter the row actions |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $row_actions = apply_filters( |
228 | 228 | 'give_email_notification_row_actions', |
229 | 229 | array( |
230 | - 'edit' => "<a href=\"{$edit_url}\">" . __( 'Edit', 'give' ) . '</a>', |
|
230 | + 'edit' => "<a href=\"{$edit_url}\">".__('Edit', 'give').'</a>', |
|
231 | 231 | ), |
232 | 232 | |
233 | 233 | ); |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $hidden = array(); |
249 | 249 | $email_notifications = array(); |
250 | 250 | $sortable = $this->get_sortable_columns(); |
251 | - $this->_column_headers = array( $columns, $hidden, $sortable, $this->get_primary_column_name() ); |
|
251 | + $this->_column_headers = array($columns, $hidden, $sortable, $this->get_primary_column_name()); |
|
252 | 252 | |
253 | 253 | // Set email notifications. |
254 | 254 | /* @var Give_Email_Notification $email_notification */ |
255 | - foreach ( $this->email_notifications->get_email_notifications() as $email_notification ) { |
|
256 | - if ( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email_notification ) ) { |
|
255 | + foreach ($this->email_notifications->get_email_notifications() as $email_notification) { |
|
256 | + if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email_notification)) { |
|
257 | 257 | $email_notifications[] = $email_notification; |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - $totalItems = count( $email_notifications ); |
|
261 | + $totalItems = count($email_notifications); |
|
262 | 262 | $this->items = $email_notifications; |
263 | - $this->set_pagination_args( array( |
|
263 | + $this->set_pagination_args(array( |
|
264 | 264 | 'total_items' => $totalItems, |
265 | 265 | 'per_page' => $this->per_page, |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @access public |
274 | 274 | */ |
275 | 275 | public function no_items() { |
276 | - _e( 'No give email notification found.', 'give' ); |
|
276 | + _e('No give email notification found.', 'give'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -21,30 +21,30 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return array |
23 | 23 | */ |
24 | - public static function get_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
25 | - $setting_fields = self::get_default_setting_fields( $email, $form_id ); |
|
24 | + public static function get_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
25 | + $setting_fields = self::get_default_setting_fields($email, $form_id); |
|
26 | 26 | |
27 | 27 | // Recipient field. |
28 | - $setting_fields[] = self::get_recipient_setting_field( $email, $form_id, Give_Email_Notification_Util::has_recipient_field( $email ) ); |
|
28 | + $setting_fields[] = self::get_recipient_setting_field($email, $form_id, Give_Email_Notification_Util::has_recipient_field($email)); |
|
29 | 29 | |
30 | 30 | // Add extra setting field. |
31 | - if ( $extra_setting_field = $email->get_extra_setting_fields( $form_id ) ) { |
|
32 | - $setting_fields = array_merge( $setting_fields, $extra_setting_field ); |
|
31 | + if ($extra_setting_field = $email->get_extra_setting_fields($form_id)) { |
|
32 | + $setting_fields = array_merge($setting_fields, $extra_setting_field); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Preview field. |
36 | - if ( Give_Email_Notification_Util::has_preview( $email ) ) { |
|
37 | - $setting_fields[] = self::get_preview_setting_field( $email, $form_id ); |
|
36 | + if (Give_Email_Notification_Util::has_preview($email)) { |
|
37 | + $setting_fields[] = self::get_preview_setting_field($email, $form_id); |
|
38 | 38 | } |
39 | 39 | |
40 | - $setting_fields = self::add_section_end( $email, $setting_fields ); |
|
40 | + $setting_fields = self::add_section_end($email, $setting_fields); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Filter the email notification settings. |
44 | 44 | * |
45 | 45 | * @since 2.0 |
46 | 46 | */ |
47 | - return apply_filters( 'give_email_notification_setting_fields', $setting_fields, $email, $form_id ); |
|
47 | + return apply_filters('give_email_notification_setting_fields', $setting_fields, $email, $form_id); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return bool |
60 | 60 | */ |
61 | - public static function has_section_end( $setting ) { |
|
62 | - $last_field = end( $setting ); |
|
61 | + public static function has_section_end($setting) { |
|
62 | + $last_field = end($setting); |
|
63 | 63 | $has_section_end = false; |
64 | 64 | |
65 | - if ( 'sectionend' === $last_field['type'] ) { |
|
65 | + if ('sectionend' === $last_field['type']) { |
|
66 | 66 | $has_section_end = true; |
67 | 67 | } |
68 | 68 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public static function get_section_start( Give_Email_Notification $email, $form_id = null ) { |
|
83 | + public static function get_section_start(Give_Email_Notification $email, $form_id = null) { |
|
84 | 84 | // Add section end field. |
85 | 85 | $setting = array( |
86 | 86 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public static function add_section_end( Give_Email_Notification $email, $setting ) { |
|
106 | - if ( ! self::has_section_end( $setting ) ) { |
|
105 | + public static function add_section_end(Give_Email_Notification $email, $setting) { |
|
106 | + if ( ! self::has_section_end($setting)) { |
|
107 | 107 | // Add section end field. |
108 | 108 | $setting[] = array( |
109 | 109 | 'id' => "give_title_email_settings_{$email->config['id']}", |
@@ -125,26 +125,26 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return array |
127 | 127 | */ |
128 | - public static function get_default_setting_fields( Give_Email_Notification $email, $form_id = null ) { |
|
129 | - $settings[] = self::get_section_start( $email, $form_id ); |
|
130 | - $settings[] = self::get_notification_status_field( $email, $form_id ); |
|
128 | + public static function get_default_setting_fields(Give_Email_Notification $email, $form_id = null) { |
|
129 | + $settings[] = self::get_section_start($email, $form_id); |
|
130 | + $settings[] = self::get_notification_status_field($email, $form_id); |
|
131 | 131 | |
132 | - if ( ! Give_Email_Notification_Util::is_notification_status_editable( $email ) ) { |
|
133 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
132 | + if ( ! Give_Email_Notification_Util::is_notification_status_editable($email)) { |
|
133 | + if ($form_id || give_is_add_new_form_page()) { |
|
134 | 134 | // Do not allow admin to disable notification on perform basis. |
135 | - unset( $settings[1]['options']['disabled'] ); |
|
135 | + unset($settings[1]['options']['disabled']); |
|
136 | 136 | } else { |
137 | 137 | // Do not allow admin to edit notification status globally. |
138 | - unset( $settings[1] ); |
|
138 | + unset($settings[1]); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - $settings[] = self::get_email_subject_field( $email, $form_id ); |
|
143 | - $settings[] = self::get_email_header_field( $email, $form_id ); |
|
144 | - $settings[] = self::get_email_message_field( $email, $form_id ); |
|
142 | + $settings[] = self::get_email_subject_field($email, $form_id); |
|
143 | + $settings[] = self::get_email_header_field($email, $form_id); |
|
144 | + $settings[] = self::get_email_message_field($email, $form_id); |
|
145 | 145 | |
146 | - if ( Give_Email_Notification_Util::is_content_type_editable( $email ) ) { |
|
147 | - $settings[] = self::get_email_content_type_field( $email, $form_id ); |
|
146 | + if (Give_Email_Notification_Util::is_content_type_editable($email)) { |
|
147 | + $settings[] = self::get_email_content_type_field($email, $form_id); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $settings; |
@@ -161,31 +161,31 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return array |
163 | 163 | */ |
164 | - public static function get_notification_status_field( Give_Email_Notification $email, $form_id = null ) { |
|
164 | + public static function get_notification_status_field(Give_Email_Notification $email, $form_id = null) { |
|
165 | 165 | $option = array( |
166 | - 'enabled' => __( 'Enabled', 'give' ), |
|
167 | - 'disabled' => __( 'Disabled', 'give' ), |
|
166 | + 'enabled' => __('Enabled', 'give'), |
|
167 | + 'disabled' => __('Disabled', 'give'), |
|
168 | 168 | ); |
169 | 169 | |
170 | 170 | $default_value = $email->get_notification_status(); |
171 | 171 | |
172 | 172 | // Add global options. |
173 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
173 | + if ($form_id || give_is_add_new_form_page()) { |
|
174 | 174 | $option = array( |
175 | - 'global' => __( 'Global Options' ), |
|
176 | - 'enabled' => __( 'Customize', 'give' ), |
|
177 | - 'disabled' => __( 'Disabled', 'give' ), |
|
175 | + 'global' => __('Global Options'), |
|
176 | + 'enabled' => __('Customize', 'give'), |
|
177 | + 'disabled' => __('Disabled', 'give'), |
|
178 | 178 | ); |
179 | 179 | |
180 | 180 | $default_value = 'global'; |
181 | 181 | } |
182 | 182 | |
183 | - $description = isset( $_GET['page'] ) && 'give-settings' === $_GET['page'] ? __( 'Choose whether you want this email enabled or not.', 'give' ) : sprintf( __( 'Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=emails' ) ); |
|
183 | + $description = isset($_GET['page']) && 'give-settings' === $_GET['page'] ? __('Choose whether you want this email enabled or not.', 'give') : sprintf(__('Global Options are set <a href="%s">in Give settings</a>. You may override them for this form here.', 'give'), admin_url('edit.php?post_type=give_forms&page=give-settings&tab=emails')); |
|
184 | 184 | |
185 | 185 | return array( |
186 | - 'name' => esc_html__( 'Notification', 'give' ), |
|
186 | + 'name' => esc_html__('Notification', 'give'), |
|
187 | 187 | 'desc' => $description, |
188 | - 'id' => self::get_prefix( $email, $form_id ) . 'notification', |
|
188 | + 'id' => self::get_prefix($email, $form_id).'notification', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => $default_value, |
191 | 191 | 'options' => $option, |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array |
206 | 206 | */ |
207 | - public static function get_email_subject_field( Give_Email_Notification $email, $form_id = null ) { |
|
207 | + public static function get_email_subject_field(Give_Email_Notification $email, $form_id = null) { |
|
208 | 208 | return array( |
209 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_subject', |
|
210 | - 'name' => esc_html__( 'Email Subject', 'give' ), |
|
211 | - 'desc' => esc_html__( 'Enter the email subject line.', 'give' ), |
|
209 | + 'id' => self::get_prefix($email, $form_id).'email_subject', |
|
210 | + 'name' => esc_html__('Email Subject', 'give'), |
|
211 | + 'desc' => esc_html__('Enter the email subject line.', 'give'), |
|
212 | 212 | 'default' => $email->config['default_email_subject'], |
213 | 213 | 'type' => 'text', |
214 | 214 | ); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return array |
226 | 226 | */ |
227 | - public static function get_email_header_field( Give_Email_Notification $email, $form_id = null ) { |
|
227 | + public static function get_email_header_field(Give_Email_Notification $email, $form_id = null) { |
|
228 | 228 | return array( |
229 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_header', |
|
230 | - 'name' => esc_html__( 'Email Header', 'give' ), |
|
231 | - 'desc' => esc_html__( 'Enter the email header that appears at the top of the email.', 'give' ), |
|
229 | + 'id' => self::get_prefix($email, $form_id).'email_header', |
|
230 | + 'name' => esc_html__('Email Header', 'give'), |
|
231 | + 'desc' => esc_html__('Enter the email header that appears at the top of the email.', 'give'), |
|
232 | 232 | 'default' => $email->config['default_email_header'], |
233 | 233 | 'type' => 'text', |
234 | 234 | ); |
@@ -245,28 +245,28 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return array |
247 | 247 | */ |
248 | - public static function get_email_message_field( Give_Email_Notification $email, $form_id = null ) { |
|
249 | - $desc = esc_html__( 'Enter the email message.', 'give' ); |
|
248 | + public static function get_email_message_field(Give_Email_Notification $email, $form_id = null) { |
|
249 | + $desc = esc_html__('Enter the email message.', 'give'); |
|
250 | 250 | |
251 | - if ( $email_tag_list = $email->get_allowed_email_tags( true ) ) { |
|
251 | + if ($email_tag_list = $email->get_allowed_email_tags(true)) { |
|
252 | 252 | $desc = sprintf( |
253 | 253 | '%1$s <br> %2$s: %3$s %4$s', |
254 | - __( 'The email that is sent to users after completing a successful donation. HTML is accepted.', 'give' ), |
|
255 | - __( 'Available template tags', 'give' ), |
|
254 | + __('The email that is sent to users after completing a successful donation. HTML is accepted.', 'give'), |
|
255 | + __('Available template tags', 'give'), |
|
256 | 256 | $email_tag_list, |
257 | 257 | sprintf( |
258 | 258 | '<br><a href="%1$s" target="_blank">%2$s</a> %3$s', |
259 | - esc_url( 'http://docs.givewp.com/meta-email-tags' ), |
|
260 | - __( 'See our documentation', 'give' ), |
|
261 | - __( 'for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give' ) |
|
259 | + esc_url('http://docs.givewp.com/meta-email-tags'), |
|
260 | + __('See our documentation', 'give'), |
|
261 | + __('for examples of how to use custom meta email tags to output additional donor or donation information in your Give emails.', 'give') |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | |
265 | 265 | } |
266 | 266 | |
267 | 267 | return array( |
268 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_message', |
|
269 | - 'name' => esc_html__( 'Email message', 'give' ), |
|
268 | + 'id' => self::get_prefix($email, $form_id).'email_message', |
|
269 | + 'name' => esc_html__('Email message', 'give'), |
|
270 | 270 | 'desc' => $desc, |
271 | 271 | 'type' => 'wysiwyg', |
272 | 272 | 'default' => $email->config['default_email_message'], |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return array |
286 | 286 | */ |
287 | - public static function get_email_content_type_field( Give_Email_Notification $email, $form_id = null ) { |
|
287 | + public static function get_email_content_type_field(Give_Email_Notification $email, $form_id = null) { |
|
288 | 288 | return array( |
289 | - 'id' => self::get_prefix( $email, $form_id ) . 'email_content_type', |
|
290 | - 'name' => esc_html__( 'Email Content Type', 'give' ), |
|
291 | - 'desc' => __( 'Choose email type.', 'give' ), |
|
289 | + 'id' => self::get_prefix($email, $form_id).'email_content_type', |
|
290 | + 'name' => esc_html__('Email Content Type', 'give'), |
|
291 | + 'desc' => __('Choose email type.', 'give'), |
|
292 | 292 | 'type' => 'select', |
293 | 293 | 'options' => array( |
294 | - 'text/html' => Give_Email_Notification_Util::get_formatted_email_type( 'text/html' ), |
|
295 | - 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type( 'text/plain' ), |
|
294 | + 'text/html' => Give_Email_Notification_Util::get_formatted_email_type('text/html'), |
|
295 | + 'text/plain' => Give_Email_Notification_Util::get_formatted_email_type('text/plain'), |
|
296 | 296 | ), |
297 | 297 | 'default' => $email->config['content_type'], |
298 | 298 | ); |
@@ -312,29 +312,29 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return array |
314 | 314 | */ |
315 | - public static function get_recipient_setting_field( Give_Email_Notification $email, $form_id = null, $edit_recipient = true ) { |
|
315 | + public static function get_recipient_setting_field(Give_Email_Notification $email, $form_id = null, $edit_recipient = true) { |
|
316 | 316 | $recipient = array( |
317 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
318 | - 'name' => esc_html__( 'Email Recipients', 'give' ), |
|
319 | - 'desc' => __( 'Enter the email address(es) that should receive a notification.', 'give' ), |
|
317 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
318 | + 'name' => esc_html__('Email Recipients', 'give'), |
|
319 | + 'desc' => __('Enter the email address(es) that should receive a notification.', 'give'), |
|
320 | 320 | 'type' => 'email', |
321 | - 'default' => get_bloginfo( 'admin_email' ), |
|
321 | + 'default' => get_bloginfo('admin_email'), |
|
322 | 322 | 'repeat' => true, |
323 | - 'repeat_btn_title' => esc_html__( 'Add Recipient', 'give' ), |
|
323 | + 'repeat_btn_title' => esc_html__('Add Recipient', 'give'), |
|
324 | 324 | ); |
325 | 325 | |
326 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
327 | - $recipient['name'] = __( 'Email', 'give' ); |
|
326 | + if ($form_id || give_is_add_new_form_page()) { |
|
327 | + $recipient['name'] = __('Email', 'give'); |
|
328 | 328 | $recipient['default'] = ''; |
329 | 329 | $recipient['id'] = 'email'; |
330 | - $recipient['desc'] = __( 'Enter the email address that should receive a notification.', 'give' ); |
|
330 | + $recipient['desc'] = __('Enter the email address that should receive a notification.', 'give'); |
|
331 | 331 | |
332 | 332 | $recipient = array( |
333 | - 'id' => self::get_prefix( $email, $form_id ) . 'recipient', |
|
333 | + 'id' => self::get_prefix($email, $form_id).'recipient', |
|
334 | 334 | 'type' => 'group', |
335 | 335 | 'options' => array( |
336 | - 'add_button' => __( 'Add Email', 'give' ), |
|
337 | - 'header_title' => __( 'Email Recipient', 'give' ), |
|
336 | + 'add_button' => __('Add Email', 'give'), |
|
337 | + 'header_title' => __('Email Recipient', 'give'), |
|
338 | 338 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
339 | 339 | ), |
340 | 340 | 'fields' => array( |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | |
346 | 346 | // Disable field if email donor has recipient field. |
347 | 347 | // @see https://github.com/WordImpress/Give/issues/2657 |
348 | - if ( ! $edit_recipient ) { |
|
349 | - if ( 'group' == $recipient['type'] ) { |
|
350 | - $recipient = current( $recipient['fields'] ); |
|
348 | + if ( ! $edit_recipient) { |
|
349 | + if ('group' == $recipient['type']) { |
|
350 | + $recipient = current($recipient['fields']); |
|
351 | 351 | $recipient['type'] = 'text'; |
352 | 352 | } |
353 | 353 | |
354 | 354 | $recipient['attributes']['disabled'] = 'disabled'; |
355 | 355 | $recipient['value'] = $recipient['default'] = '{donor_email}'; |
356 | 356 | $recipient['repeat'] = false; |
357 | - $recipient['desc'] = __( 'This email is automatically sent to the donor and the recipient cannot be customized.', 'give' ); |
|
357 | + $recipient['desc'] = __('This email is automatically sent to the donor and the recipient cannot be customized.', 'give'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $recipient; |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return array |
373 | 373 | */ |
374 | - public static function get_preview_setting_field( Give_Email_Notification $email, $form_id = null ) { |
|
374 | + public static function get_preview_setting_field(Give_Email_Notification $email, $form_id = null) { |
|
375 | 375 | return array( |
376 | - 'name' => __( 'Preview Email', 'give' ), |
|
377 | - 'desc' => __( 'Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
378 | - 'give' ), |
|
379 | - 'id' => self::get_prefix( $email, $form_id ) . 'preview_buttons', |
|
376 | + 'name' => __('Preview Email', 'give'), |
|
377 | + 'desc' => __('Click the "Preview Email" button to preview the email in your browser. Click the "Send Test Email" button to send a test email directly to your inbox.', |
|
378 | + 'give'), |
|
379 | + 'id' => self::get_prefix($email, $form_id).'preview_buttons', |
|
380 | 380 | 'type' => 'email_preview_buttons', |
381 | 381 | ); |
382 | 382 | } |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public static function get_prefix( Give_Email_Notification $email, $form_id = null ) { |
|
396 | + public static function get_prefix(Give_Email_Notification $email, $form_id = null) { |
|
397 | 397 | $meta_key = "{$email->config['id']}_"; |
398 | 398 | |
399 | - if ( $form_id || give_is_add_new_form_page() ) { |
|
399 | + if ($form_id || give_is_add_new_form_page()) { |
|
400 | 400 | $meta_key = "_give_{$email->config['id']}_"; |
401 | 401 | } |
402 | 402 |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_New_Offline_Donation_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_New_Offline_Donation_Email |
@@ -36,33 +36,33 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'new-offline-donation', |
43 | - 'label' => __( 'New Offline Donation', 'give' ), |
|
44 | - 'description' => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ), |
|
43 | + 'label' => __('New Offline Donation', 'give'), |
|
44 | + 'description' => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'), |
|
45 | 45 | 'has_recipient_field' => true, |
46 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
46 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tags_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | 51 | 'default_email_subject' => $this->get_default_email_subject(), |
52 | 52 | 'default_email_message' => $this->get_default_email_message(), |
53 | - 'default_email_header' => __( 'New Offline Donation!', 'give' ), |
|
53 | + 'default_email_header' => __('New Offline Donation!', 'give'), |
|
54 | 54 | 'notices' => array( |
55 | 55 | 'non-notification-status-editable' => sprintf( |
56 | 56 | '%1$s <a href="%2$s">%3$s »</a>', |
57 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
58 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
59 | - __( 'Edit Setting', 'give' ) |
|
57 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
58 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
59 | + __('Edit Setting', 'give') |
|
60 | 60 | ) |
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
65 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
64 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
65 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | $subject = apply_filters( |
83 | 83 | 'give_offline_admin_donation_notification_subject', |
84 | - __( 'New Pending Donation', 'give' ) |
|
84 | + __('New Pending Donation', 'give') |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | /** |
@@ -106,18 +106,18 @@ discard block |
||
106 | 106 | * @return string |
107 | 107 | */ |
108 | 108 | public function get_default_email_message() { |
109 | - $message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
110 | - $message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' '; |
|
111 | - $message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
109 | + $message = __('Dear Admin,', 'give')."\n\n"; |
|
110 | + $message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' '; |
|
111 | + $message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
112 | 112 | |
113 | - $message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
114 | - $message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
113 | + $message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
114 | + $message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
115 | 115 | |
116 | 116 | $message .= sprintf( |
117 | 117 | '<a href="%1$s">%2$s</a>', |
118 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ), |
|
119 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
120 | - ) . "\n\n"; |
|
118 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID), |
|
119 | + __('Click Here to View and/or Update Donation Details', 'give') |
|
120 | + )."\n\n"; |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Filter the donation receipt email message |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - public function get_email_message( $form_id = null ) { |
|
158 | + public function get_email_message($form_id = null) { |
|
159 | 159 | $message = Give_Email_Notification_Util::get_value( |
160 | 160 | $this, |
161 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
161 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
162 | 162 | $form_id, |
163 | 163 | $this->config['default_email_message'] |
164 | 164 | ); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return array |
200 | 200 | */ |
201 | - public function get_email_attachments( $form_id = null ) { |
|
201 | + public function get_email_attachments($form_id = null) { |
|
202 | 202 | /** |
203 | 203 | * Filter the attachments. |
204 | 204 | * Note: This filter will deprecate soon. |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ) |
241 | 241 | ); |
242 | 242 | |
243 | - Give()->emails->__set( 'heading', $this->get_email_header() ); |
|
243 | + Give()->emails->__set('heading', $this->get_email_header()); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @param int $payment_id |
253 | 253 | */ |
254 | - public function setup_email_notification( $payment_id ) { |
|
255 | - $this->payment = new Give_Payment( $payment_id ); |
|
254 | + public function setup_email_notification($payment_id) { |
|
255 | + $this->payment = new Give_Payment($payment_id); |
|
256 | 256 | |
257 | 257 | // Exit if not donation was not with offline donation. |
258 | - if ( 'offline' !== $this->payment->gateway ) { |
|
258 | + if ('offline' !== $this->payment->gateway) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | 261 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->setup_email_data(); |
264 | 264 | |
265 | 265 | // Send email. |
266 | - $this->send_email_notification( array( |
|
266 | + $this->send_email_notification(array( |
|
267 | 267 | 'payment_id' => $this->payment->ID, |
268 | - ) ); |
|
268 | + )); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -277,18 +277,18 @@ discard block |
||
277 | 277 | * @param $update_options |
278 | 278 | * @param $option_name |
279 | 279 | */ |
280 | - public function set_notification_status( $update_options, $option_name ) { |
|
280 | + public function set_notification_status($update_options, $option_name) { |
|
281 | 281 | // Get updated settings. |
282 | 282 | $update_options = give_get_settings(); |
283 | 283 | |
284 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
284 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
285 | 285 | |
286 | 286 | if ( |
287 | - empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
288 | - || $notification_status !== $update_options[ "{$this->config['id']}_notification" ] |
|
287 | + empty($update_options["{$this->config['id']}_notification"]) |
|
288 | + || $notification_status !== $update_options["{$this->config['id']}_notification"] |
|
289 | 289 | ) { |
290 | - $update_options[ "{$this->config['id']}_notification" ] = $notification_status; |
|
291 | - update_option( $option_name, $update_options ); |
|
290 | + $update_options["{$this->config['id']}_notification"] = $notification_status; |
|
291 | + update_option($option_name, $update_options); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @return array |
305 | 305 | */ |
306 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
306 | + public function add_metabox_setting_field($settings, $form_id) { |
|
307 | 307 | |
308 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
308 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
309 | 309 | $settings[] = array( |
310 | 310 | 'id' => $this->config['id'], |
311 | 311 | 'title' => $this->config['label'], |
312 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
312 | + 'fields' => $this->get_setting_fields($form_id), |
|
313 | 313 | ); |
314 | 314 | } |
315 | 315 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return static |
47 | 47 | */ |
48 | 48 | static function get_instance() { |
49 | - if ( null === static::$instance ) { |
|
49 | + if (null === static::$instance) { |
|
50 | 50 | self::$instance = new static(); |
51 | 51 | } |
52 | 52 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - public static function has_preview( Give_Email_Notification $email ) { |
|
67 | + public static function has_preview(Give_Email_Notification $email) { |
|
68 | 68 | return $email->config['has_preview']; |
69 | 69 | } |
70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return bool |
80 | 80 | */ |
81 | - public static function has_recipient_field( Give_Email_Notification $email ) { |
|
81 | + public static function has_recipient_field(Give_Email_Notification $email) { |
|
82 | 82 | return $email->config['has_recipient_field']; |
83 | 83 | } |
84 | 84 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public static function is_notification_status_editable( Give_Email_Notification $email ) { |
|
95 | + public static function is_notification_status_editable(Give_Email_Notification $email) { |
|
96 | 96 | $user_can_edit = $email->config['notification_status_editable']; |
97 | 97 | |
98 | 98 | return (bool) $user_can_edit; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public static function is_content_type_editable( Give_Email_Notification $email ) { |
|
111 | + public static function is_content_type_editable(Give_Email_Notification $email) { |
|
112 | 112 | return $email->config['content_type_editable']; |
113 | 113 | } |
114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return bool |
124 | 124 | */ |
125 | - public static function is_email_preview_has_header( Give_Email_Notification $email ) { |
|
125 | + public static function is_email_preview_has_header(Give_Email_Notification $email) { |
|
126 | 126 | return $email->config['has_preview_header']; |
127 | 127 | } |
128 | 128 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return bool |
138 | 138 | */ |
139 | - public static function is_email_preview( Give_Email_Notification $email ) { |
|
139 | + public static function is_email_preview(Give_Email_Notification $email) { |
|
140 | 140 | return $email->config['has_preview']; |
141 | 141 | } |
142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | - public static function is_show_on_emails_setting_page( Give_Email_Notification $email ){ |
|
153 | + public static function is_show_on_emails_setting_page(Give_Email_Notification $email) { |
|
154 | 154 | return $email->config['show_on_emails_setting_page']; |
155 | 155 | } |
156 | 156 | |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return bool |
167 | 167 | */ |
168 | - public static function can_use_form_email_options( Give_Email_Notification $email, $form_id = null ){ |
|
169 | - return give_is_setting_enabled( give_get_meta( $form_id, '_give_email_options', true ) ); |
|
168 | + public static function can_use_form_email_options(Give_Email_Notification $email, $form_id = null) { |
|
169 | + return give_is_setting_enabled(give_get_meta($form_id, '_give_email_options', true)); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public static function is_email_notification_active( Give_Email_Notification $email, $form_id = null ) { |
|
184 | - $notification_status = $email->get_notification_status( $form_id ); |
|
183 | + public static function is_email_notification_active(Give_Email_Notification $email, $form_id = null) { |
|
184 | + $notification_status = $email->get_notification_status($form_id); |
|
185 | 185 | |
186 | 186 | |
187 | - $notification_status = empty( $form_id ) |
|
188 | - ? give_is_setting_enabled( $notification_status ) |
|
189 | - : give_is_setting_enabled( give_get_option( "{$email->config['id']}_notification", $email->config['notification_status'] ) ) && give_is_setting_enabled( $notification_status, array( 'enabled', 'global' ) ); |
|
187 | + $notification_status = empty($form_id) |
|
188 | + ? give_is_setting_enabled($notification_status) |
|
189 | + : give_is_setting_enabled(give_get_option("{$email->config['id']}_notification", $email->config['notification_status'])) && give_is_setting_enabled($notification_status, array('enabled', 'global')); |
|
190 | 190 | // To check if email notification is active or not on a per-form basis, email notification must be globally active—otherwise it will be considered disabled. |
191 | 191 | |
192 | 192 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param bool $notification_status True if notification is enable and false when disable |
202 | 202 | */ |
203 | - return apply_filters( "give_{$email->config['id']}_is_email_notification_active", $notification_status, $email, $form_id ); |
|
203 | + return apply_filters("give_{$email->config['id']}_is_email_notification_active", $notification_status, $email, $form_id); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | $is_preview = false; |
215 | 215 | |
216 | 216 | if ( |
217 | - current_user_can( 'manage_give_settings' ) |
|
218 | - && ! empty( $_GET['give_action'] ) |
|
217 | + current_user_can('manage_give_settings') |
|
218 | + && ! empty($_GET['give_action']) |
|
219 | 219 | && 'preview_email' === $_GET['give_action'] |
220 | 220 | ) { |
221 | 221 | $is_preview = true; |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | $is_preview = false; |
236 | 236 | |
237 | 237 | if ( |
238 | - current_user_can( 'manage_give_settings' ) |
|
239 | - && ! empty( $_GET['give_action'] ) |
|
238 | + current_user_can('manage_give_settings') |
|
239 | + && ! empty($_GET['give_action']) |
|
240 | 240 | && 'send_preview_email' === $_GET['give_action'] |
241 | 241 | ) { |
242 | 242 | $is_preview = true; |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return string |
258 | 258 | */ |
259 | - public static function get_formatted_email_type( $content_type ) { |
|
259 | + public static function get_formatted_email_type($content_type) { |
|
260 | 260 | $email_contents = array( |
261 | - 'text/html' => __( 'HTML', 'give' ), |
|
262 | - 'text/plain' => __( 'Plain', 'give' ), |
|
261 | + 'text/html' => __('HTML', 'give'), |
|
262 | + 'text/plain' => __('Plain', 'give'), |
|
263 | 263 | ); |
264 | 264 | |
265 | - return $email_contents[ $content_type ]; |
|
265 | + return $email_contents[$content_type]; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -279,40 +279,40 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return mixed |
281 | 281 | */ |
282 | - public static function get_value( Give_Email_Notification $email, $option_name, $form_id = null, $default = false ) { |
|
282 | + public static function get_value(Give_Email_Notification $email, $option_name, $form_id = null, $default = false) { |
|
283 | 283 | // If form id set then option name can be contain _give_ prefix which is only used for meta key, |
284 | 284 | // So make sure you are using correct option name. |
285 | - $global_option_name = ( 0 === strpos( $option_name, '_give_' ) |
|
286 | - ? str_replace( '_give_', '', $option_name ) |
|
287 | - : $option_name ); |
|
288 | - $option_value = give_get_option( $global_option_name, $default ); |
|
285 | + $global_option_name = (0 === strpos($option_name, '_give_') |
|
286 | + ? str_replace('_give_', '', $option_name) |
|
287 | + : $option_name); |
|
288 | + $option_value = give_get_option($global_option_name, $default); |
|
289 | 289 | |
290 | 290 | if ( |
291 | - ! empty( $form_id ) |
|
291 | + ! empty($form_id) |
|
292 | 292 | && give_is_setting_enabled( |
293 | 293 | give_get_meta( |
294 | 294 | $form_id, |
295 | - Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'notification', |
|
295 | + Give_Email_Setting_Field::get_prefix($email, $form_id).'notification', |
|
296 | 296 | true, |
297 | 297 | 'global' |
298 | 298 | ) |
299 | 299 | ) |
300 | 300 | ) { |
301 | - $option_value = get_post_meta( $form_id, $option_name, true ); |
|
301 | + $option_value = get_post_meta($form_id, $option_name, true); |
|
302 | 302 | |
303 | 303 | // Get only email field value from recipients setting. |
304 | - if( Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'recipient' === $option_name ) { |
|
305 | - $option_value = wp_list_pluck( $option_value, 'email' ); |
|
304 | + if (Give_Email_Setting_Field::get_prefix($email, $form_id).'recipient' === $option_name) { |
|
305 | + $option_value = wp_list_pluck($option_value, 'email'); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - $option_value = empty( $option_value ) ? $default : $option_value; |
|
309 | + $option_value = empty($option_value) ? $default : $option_value; |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Filter the setting value |
313 | 313 | * |
314 | 314 | * @since 2.0 |
315 | 315 | */ |
316 | - return apply_filters( 'give_email_setting_value', $option_value, $option_name, $email, $form_id, $default ); |
|
316 | + return apply_filters('give_email_setting_value', $option_value, $option_name, $email, $form_id, $default); |
|
317 | 317 | } |
318 | 318 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string $message Fully formatted message |
44 | 44 | */ |
45 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
46 | - return give_do_email_tags( $message, $payment_id ); |
|
45 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
46 | + return give_do_email_tags($message, $payment_id); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -57,45 +57,45 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return string $message Fully formatted message |
59 | 59 | */ |
60 | -function give_email_preview_template_tags( $message ) { |
|
60 | +function give_email_preview_template_tags($message) { |
|
61 | 61 | |
62 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
62 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
63 | 63 | |
64 | 64 | $gateway = 'PayPal'; |
65 | 65 | |
66 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
66 | + $receipt_id = strtolower(md5(uniqid())); |
|
67 | 67 | |
68 | - $payment_id = rand( 1, 100 ); |
|
69 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) ); |
|
68 | + $payment_id = rand(1, 100); |
|
69 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri())); |
|
70 | 70 | |
71 | 71 | $receipt_link = sprintf( |
72 | 72 | '<a href="%1$s">%2$s</a>', |
73 | 73 | $receipt_link_url, |
74 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
74 | + esc_html__('View the receipt in your browser »', 'give') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Set user. |
78 | 78 | $user = wp_get_current_user(); |
79 | 79 | |
80 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
82 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
83 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
84 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
85 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
86 | - $message = str_replace( '{amount}', $price, $message ); |
|
87 | - $message = str_replace( '{price}', $price, $message ); |
|
88 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
89 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
90 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
91 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
92 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
93 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
94 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
95 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
96 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
97 | - |
|
98 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
80 | + $message = str_replace('{name}', $user->display_name, $message); |
|
81 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
82 | + $message = str_replace('{username}', $user->user_login, $message); |
|
83 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
84 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
85 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
86 | + $message = str_replace('{amount}', $price, $message); |
|
87 | + $message = str_replace('{price}', $price, $message); |
|
88 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
89 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
90 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
91 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
92 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
93 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
94 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
95 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
96 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
97 | + |
|
98 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array |
113 | 113 | */ |
114 | -function give_email_preview_buttons_callback( $field ) { |
|
115 | - $field_id = str_replace( '_preview_buttons', '', $field['id'] ); |
|
114 | +function give_email_preview_buttons_callback($field) { |
|
115 | + $field_id = str_replace('_preview_buttons', '', $field['id']); |
|
116 | 116 | |
117 | 117 | ob_start(); |
118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
121 | 121 | wp_nonce_url( |
122 | 122 | add_query_arg( |
123 | - array( 'give_action' => 'preview_email', 'email_type' => $field_id ), |
|
123 | + array('give_action' => 'preview_email', 'email_type' => $field_id), |
|
124 | 124 | home_url() |
125 | 125 | ), 'give-preview-email' |
126 | 126 | ), |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | echo sprintf( |
131 | 131 | ' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>', |
132 | 132 | wp_nonce_url( |
133 | - add_query_arg( array( |
|
133 | + add_query_arg(array( |
|
134 | 134 | 'give_action' => 'send_preview_email', |
135 | 135 | 'email_type' => $field_id, |
136 | 136 | 'give-message' => 'sent-test-email', |
137 | - ) ), 'give-send-preview-email' ), |
|
138 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
139 | - esc_html__( 'Send Test Email', 'give' ) |
|
137 | + )), 'give-send-preview-email' ), |
|
138 | + esc_attr__('Send Test Email.', 'give'), |
|
139 | + esc_html__('Send Test Email', 'give') |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | echo ob_get_clean(); |
@@ -155,34 +155,34 @@ discard block |
||
155 | 155 | |
156 | 156 | //Payment receipt switcher |
157 | 157 | $payment_count = give_count_payments()->publish; |
158 | - $payment_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ); |
|
158 | + $payment_id = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id'); |
|
159 | 159 | |
160 | - if ( $payment_count <= 0 ) { |
|
160 | + if ($payment_count <= 0) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
164 | 164 | //Get payments. |
165 | - $donations = new Give_Payments_Query( array( |
|
165 | + $donations = new Give_Payments_Query(array( |
|
166 | 166 | 'number' => 100, |
167 | 167 | 'output' => '', |
168 | 168 | 'fields' => 'ids' |
169 | - ) ); |
|
169 | + )); |
|
170 | 170 | $donations = $donations->get_payments(); |
171 | - $options = array(); |
|
171 | + $options = array(); |
|
172 | 172 | |
173 | 173 | // Default option. |
174 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
174 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
175 | 175 | |
176 | 176 | //Provide nice human readable options. |
177 | - if ( $donations ) { |
|
178 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
179 | - foreach ( $donations as $donation_id ) { |
|
177 | + if ($donations) { |
|
178 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
179 | + foreach ($donations as $donation_id) { |
|
180 | 180 | |
181 | - $options[ $donation_id ] = sprintf( |
|
181 | + $options[$donation_id] = sprintf( |
|
182 | 182 | '#%1$s - %2$s - %3$s', |
183 | 183 | $donation_id, |
184 | - give_get_donation_donor_email( $donation_id ), |
|
185 | - get_the_title( $donation_id ) |
|
184 | + give_get_donation_donor_email($donation_id), |
|
185 | + get_the_title($donation_id) |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | } |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | $transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">'; |
192 | 192 | |
193 | 193 | // Remove payment id query param if set from request url. |
194 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
194 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
195 | 195 | $query = $request_url_data['query']; |
196 | - $query = remove_query_arg( array( 'preview_id' ), $query ); |
|
196 | + $query = remove_query_arg(array('preview_id'), $query); |
|
197 | 197 | |
198 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
198 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
199 | 199 | |
200 | 200 | $transaction_header .= '<script> |
201 | 201 | function change_preview(){ |
202 | 202 | var transactions = document.getElementById("give_preview_email_payment_id"); |
203 | 203 | var selected_trans = transactions.options[transactions.selectedIndex]; |
204 | 204 | if (selected_trans){ |
205 | - var url_string = "' . $request_url . '&preview_id=" + selected_trans.value; |
|
205 | + var url_string = "' . $request_url.'&preview_id=" + selected_trans.value; |
|
206 | 206 | window.location = url_string; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | </script>'; |
210 | 210 | |
211 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
211 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
212 | 212 | |
213 | 213 | //The select field with 100 latest transactions |
214 | - $transaction_header .= Give()->html->select( array( |
|
214 | + $transaction_header .= Give()->html->select(array( |
|
215 | 215 | 'name' => 'preview_email_payment_id', |
216 | 216 | 'selected' => $payment_id, |
217 | 217 | 'id' => 'give_preview_email_payment_id', |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | 'select_atts' => 'onchange="change_preview()"', |
222 | 222 | 'show_option_all' => false, |
223 | 223 | 'show_option_none' => false, |
224 | - ) ); |
|
224 | + )); |
|
225 | 225 | |
226 | 226 | //Closing tag |
227 | 227 | $transaction_header .= '</div>'; |
228 | 228 | |
229 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
229 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
230 | 230 | |
231 | 231 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | * @param string $context Email tag category |
58 | 58 | */ |
59 | - public function add( $tag, $description, $func, $context = '' ) { |
|
60 | - if ( is_callable( $func ) ) { |
|
61 | - $this->tags[ $tag ] = array( |
|
59 | + public function add($tag, $description, $func, $context = '') { |
|
60 | + if (is_callable($func)) { |
|
61 | + $this->tags[$tag] = array( |
|
62 | 62 | 'tag' => $tag, |
63 | 63 | 'description' => $description, |
64 | 64 | 'func' => $func, |
65 | - 'context' => give_check_variable( $context, 'empty', 'general' ), |
|
65 | + 'context' => give_check_variable($context, 'empty', 'general'), |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $tag Email tag to remove hook from |
76 | 76 | */ |
77 | - public function remove( $tag ) { |
|
78 | - unset( $this->tags[ $tag ] ); |
|
77 | + public function remove($tag) { |
|
78 | + unset($this->tags[$tag]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - public function email_tag_exists( $tag ) { |
|
91 | - return array_key_exists( $tag, $this->tags ); |
|
90 | + public function email_tag_exists($tag) { |
|
91 | + return array_key_exists($tag, $this->tags); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
105 | + public function get_tags($context_type = 'all', $field = '') { |
|
106 | 106 | $tags = $this->tags; |
107 | 107 | |
108 | - if ( 'all' !== $context_type ) { |
|
108 | + if ('all' !== $context_type) { |
|
109 | 109 | $tags = array(); |
110 | 110 | |
111 | - foreach ( $this->tags as $tag ) { |
|
112 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
111 | + foreach ($this->tags as $tag) { |
|
112 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $tags[ $tag['tag'] ] = $tag; |
|
116 | + $tags[$tag['tag']] = $tag; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
121 | - $tags = wp_list_pluck( $tags, $field ); |
|
120 | + if ( ! empty($tags) && ! empty($field)) { |
|
121 | + $tags = wp_list_pluck($tags, $field); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $tags; |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return string Content with email tags filtered out. |
138 | 138 | */ |
139 | - public function do_tags( $content, $tag_args ) { |
|
139 | + public function do_tags($content, $tag_args) { |
|
140 | 140 | |
141 | 141 | // Check if there is at least one tag added. |
142 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
142 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->tag_args = $tag_args; |
147 | 147 | |
148 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
148 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
149 | 149 | |
150 | 150 | $this->tag_args = null; |
151 | 151 | |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return mixed |
163 | 163 | */ |
164 | - public function do_tag( $m ) { |
|
164 | + public function do_tag($m) { |
|
165 | 165 | |
166 | 166 | // Get tag |
167 | 167 | $tag = $m[1]; |
168 | 168 | |
169 | 169 | // Return tag if tag not set |
170 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
170 | + if ( ! $this->email_tag_exists($tag)) { |
|
171 | 171 | return $m[0]; |
172 | 172 | } |
173 | 173 | |
174 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
174 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param callable $func Hook to run when email tag is found |
187 | 187 | * @param string $context Email tag category |
188 | 188 | */ |
189 | -function give_add_email_tag( $tag, $description, $func, $context = '' ) { |
|
190 | - Give()->email_tags->add( $tag, $description, $func, $context ); |
|
189 | +function give_add_email_tag($tag, $description, $func, $context = '') { |
|
190 | + Give()->email_tags->add($tag, $description, $func, $context); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string $tag Email tag to remove hook from |
199 | 199 | */ |
200 | -function give_remove_email_tag( $tag ) { |
|
201 | - Give()->email_tags->remove( $tag ); |
|
200 | +function give_remove_email_tag($tag) { |
|
201 | + Give()->email_tags->remove($tag); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return bool |
212 | 212 | */ |
213 | -function give_email_tag_exists( $tag ) { |
|
214 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
213 | +function give_email_tag_exists($tag) { |
|
214 | + return Give()->email_tags->email_tag_exists($tag); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $email_tags = give_get_email_tags(); |
239 | 239 | |
240 | 240 | ob_start(); |
241 | - if ( count( $email_tags ) > 0 ) : ?> |
|
241 | + if (count($email_tags) > 0) : ?> |
|
242 | 242 | <div class="give-email-tags-wrap"> |
243 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
243 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
244 | 244 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
245 | 245 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
246 | 246 | </span> |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string Content with email tags filtered out. |
266 | 266 | */ |
267 | -function give_do_email_tags( $content, $tag_args ) { |
|
267 | +function give_do_email_tags($content, $tag_args) { |
|
268 | 268 | // Backward compatibility < 2.0 |
269 | - if ( ! is_array( $tag_args ) ) { |
|
270 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
269 | + if ( ! is_array($tag_args)) { |
|
270 | + $tag_args = array('payment_id' => $tag_args); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Replace all tags |
274 | - $content = Give()->email_tags->do_tags( $content, $tag_args ); |
|
274 | + $content = Give()->email_tags->do_tags($content, $tag_args); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Filter the filtered content text. |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
281 | 281 | */ |
282 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
282 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
283 | 283 | |
284 | 284 | // Return content |
285 | 285 | return $content; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.0 |
300 | 300 | */ |
301 | - do_action( 'give_add_email_tags' ); |
|
301 | + do_action('give_add_email_tags'); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
304 | +add_action('init', 'give_load_email_tags', - 999); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -316,67 +316,67 @@ discard block |
||
316 | 316 | /* Donation Payment */ |
317 | 317 | array( |
318 | 318 | 'tag' => 'donation', |
319 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
319 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
320 | 320 | 'function' => 'give_email_tag_donation', |
321 | 321 | 'context' => 'donation', |
322 | 322 | ), |
323 | 323 | array( |
324 | 324 | 'tag' => 'amount', |
325 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
325 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
326 | 326 | 'function' => 'give_email_tag_amount', |
327 | 327 | 'context' => 'donation', |
328 | 328 | ), |
329 | 329 | array( |
330 | 330 | 'tag' => 'price', |
331 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
331 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
332 | 332 | 'function' => 'give_email_tag_price', |
333 | 333 | 'context' => 'donation', |
334 | 334 | ), |
335 | 335 | array( |
336 | 336 | 'tag' => 'billing_address', |
337 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
337 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
338 | 338 | 'function' => 'give_email_tag_billing_address', |
339 | 339 | 'context' => 'donation', |
340 | 340 | ), |
341 | 341 | array( |
342 | 342 | 'tag' => 'date', |
343 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
343 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
344 | 344 | 'function' => 'give_email_tag_date', |
345 | 345 | 'context' => 'donation', |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'tag' => 'payment_id', |
349 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
349 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
350 | 350 | 'function' => 'give_email_tag_payment_id', |
351 | 351 | 'context' => 'donation', |
352 | 352 | ), |
353 | 353 | array( |
354 | 354 | 'tag' => 'payment_method', |
355 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
355 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
356 | 356 | 'function' => 'give_email_tag_payment_method', |
357 | 357 | 'context' => 'donation', |
358 | 358 | ), |
359 | 359 | array( |
360 | 360 | 'tag' => 'payment_total', |
361 | - 'description' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
361 | + 'description' => esc_html__('The payment total for this donation.', 'give'), |
|
362 | 362 | 'function' => 'give_email_tag_payment_total', |
363 | 363 | 'context' => 'donation', |
364 | 364 | ), |
365 | 365 | array( |
366 | 366 | 'tag' => 'receipt_id', |
367 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
367 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
368 | 368 | 'function' => 'give_email_tag_receipt_id', |
369 | 369 | 'context' => 'donation', |
370 | 370 | ), |
371 | 371 | array( |
372 | 372 | 'tag' => 'receipt_link', |
373 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
373 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
374 | 374 | 'function' => 'give_email_tag_receipt_link', |
375 | 375 | 'context' => 'donation', |
376 | 376 | ), |
377 | 377 | array( |
378 | 378 | 'tag' => 'receipt_link_url', |
379 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
379 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
380 | 380 | 'function' => 'give_email_tag_receipt_link_url', |
381 | 381 | 'context' => 'donation', |
382 | 382 | ), |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | /* Donation Form */ |
385 | 385 | array( |
386 | 386 | 'tag' => 'form_title', |
387 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
387 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
388 | 388 | 'function' => 'give_email_tag_form_title', |
389 | 389 | 'context' => 'form', |
390 | 390 | ), |
@@ -392,37 +392,37 @@ discard block |
||
392 | 392 | /* Donor */ |
393 | 393 | array( |
394 | 394 | 'tag' => 'name', |
395 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
395 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
396 | 396 | 'function' => 'give_email_tag_first_name', |
397 | 397 | 'context' => 'donor', |
398 | 398 | ), |
399 | 399 | array( |
400 | 400 | 'tag' => 'fullname', |
401 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
401 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
402 | 402 | 'function' => 'give_email_tag_fullname', |
403 | 403 | 'context' => 'donor', |
404 | 404 | ), |
405 | 405 | array( |
406 | 406 | 'tag' => 'username', |
407 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
407 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
408 | 408 | 'function' => 'give_email_tag_username', |
409 | 409 | 'context' => 'donor', |
410 | 410 | ), |
411 | 411 | array( |
412 | 412 | 'tag' => 'company_name', |
413 | - 'description' => esc_html__( 'Company name.', 'give' ), |
|
413 | + 'description' => esc_html__('Company name.', 'give'), |
|
414 | 414 | 'function' => 'give_email_tag_company_name', |
415 | 415 | 'context' => 'donation', |
416 | 416 | ), |
417 | 417 | array( |
418 | 418 | 'tag' => 'user_email', |
419 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
419 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
420 | 420 | 'function' => 'give_email_tag_user_email', |
421 | 421 | 'context' => 'donor', |
422 | 422 | ), |
423 | 423 | array( |
424 | 424 | 'tag' => 'email_access_link', |
425 | - 'description' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
425 | + 'description' => esc_html__('The donor\'s email access link.', 'give'), |
|
426 | 426 | 'function' => 'give_email_tag_email_access_link', |
427 | 427 | 'context' => 'donor', |
428 | 428 | ), |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | /* General */ |
431 | 431 | array( |
432 | 432 | 'tag' => 'sitename', |
433 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
433 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
434 | 434 | 'function' => 'give_email_tag_sitename', |
435 | 435 | 'context' => 'general', |
436 | 436 | ), |
437 | 437 | |
438 | 438 | array( |
439 | 439 | 'tag' => 'reset_password_link', |
440 | - 'description' => esc_html__( 'The reset password link for user.', 'give' ), |
|
440 | + 'description' => esc_html__('The reset password link for user.', 'give'), |
|
441 | 441 | 'function' => 'give_email_tag_reset_password_link', |
442 | 442 | 'context' => 'general', |
443 | 443 | ), |
@@ -445,21 +445,21 @@ discard block |
||
445 | 445 | ); |
446 | 446 | |
447 | 447 | // Apply give_email_tags filter |
448 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
448 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
449 | 449 | |
450 | 450 | // Add email tags |
451 | - foreach ( $email_tags as $email_tag ) { |
|
451 | + foreach ($email_tags as $email_tag) { |
|
452 | 452 | give_add_email_tag( |
453 | 453 | $email_tag['tag'], |
454 | 454 | $email_tag['description'], |
455 | 455 | $email_tag['function'], |
456 | - ( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' ) |
|
456 | + ( ! empty($email_tag['context']) ? $email_tag['context'] : '') |
|
457 | 457 | ); |
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
462 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @return string $firstname |
473 | 473 | */ |
474 | -function give_email_tag_first_name( $tag_args ) { |
|
474 | +function give_email_tag_first_name($tag_args) { |
|
475 | 475 | $user_info = array(); |
476 | 476 | $firstname = ''; |
477 | 477 | |
478 | 478 | // Backward compatibility. |
479 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
479 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
480 | 480 | |
481 | - switch ( true ) { |
|
482 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
483 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
484 | - $email_names = give_get_email_names( $donor_info ); |
|
481 | + switch (true) { |
|
482 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
483 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
484 | + $email_names = give_get_email_names($donor_info); |
|
485 | 485 | $firstname = $email_names['name']; |
486 | 486 | |
487 | 487 | break; |
488 | 488 | |
489 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
489 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
490 | 490 | $firstname = Give()->donor_meta->get_meta( |
491 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
491 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
492 | 492 | '_give_donor_first_name', |
493 | 493 | true |
494 | 494 | ); |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @since 2.0 |
501 | 501 | */ |
502 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
503 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
502 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
503 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
504 | 504 | break; |
505 | 505 | } |
506 | 506 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param string $firstname |
513 | 513 | * @param array $tag_args |
514 | 514 | */ |
515 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
515 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
516 | 516 | |
517 | 517 | return $firstname; |
518 | 518 | } |
@@ -526,21 +526,21 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @return string $fullname |
528 | 528 | */ |
529 | -function give_email_tag_fullname( $tag_args ) { |
|
529 | +function give_email_tag_fullname($tag_args) { |
|
530 | 530 | $fullname = ''; |
531 | 531 | |
532 | 532 | // Backward compatibility. |
533 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
533 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
534 | 534 | |
535 | - switch ( true ) { |
|
536 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
537 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
538 | - $email_names = give_get_email_names( $donor_info ); |
|
535 | + switch (true) { |
|
536 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
537 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
538 | + $email_names = give_get_email_names($donor_info); |
|
539 | 539 | $fullname = $email_names['fullname']; |
540 | 540 | break; |
541 | 541 | |
542 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
543 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
542 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
543 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
544 | 544 | break; |
545 | 545 | |
546 | 546 | /** |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @since 2.0 |
550 | 550 | */ |
551 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
552 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
551 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
552 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
553 | 553 | break; |
554 | 554 | } |
555 | 555 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param string $fullname |
562 | 562 | * @param array $tag_args |
563 | 563 | */ |
564 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
564 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
565 | 565 | |
566 | 566 | return $fullname; |
567 | 567 | } |
@@ -575,21 +575,21 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return string username. |
577 | 577 | */ |
578 | -function give_email_tag_username( $tag_args ) { |
|
578 | +function give_email_tag_username($tag_args) { |
|
579 | 579 | $username = ''; |
580 | 580 | |
581 | 581 | // Backward compatibility. |
582 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
582 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
583 | 583 | |
584 | - switch ( true ) { |
|
585 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
586 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
587 | - $email_names = give_get_email_names( $donor_info ); |
|
584 | + switch (true) { |
|
585 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
586 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
587 | + $email_names = give_get_email_names($donor_info); |
|
588 | 588 | $username = $email_names['username']; |
589 | 589 | break; |
590 | 590 | |
591 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
592 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
591 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
592 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
593 | 593 | $username = $user_info->user_login; |
594 | 594 | break; |
595 | 595 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @since 2.0 |
600 | 600 | */ |
601 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
602 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
603 | - $user_info = get_user_by( 'id', $user_id ); |
|
601 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
602 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
603 | + $user_info = get_user_by('id', $user_id); |
|
604 | 604 | $username = $user_info->user_login; |
605 | 605 | } |
606 | 606 | break; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * @param string $username |
615 | 615 | * @param array $tag_args |
616 | 616 | */ |
617 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
617 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
618 | 618 | |
619 | 619 | return $username; |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @return string user_email |
630 | 630 | */ |
631 | -function give_email_tag_user_email( $tag_args ) { |
|
631 | +function give_email_tag_user_email($tag_args) { |
|
632 | 632 | $email = ''; |
633 | 633 | |
634 | 634 | // Backward compatibility. |
635 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
635 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
636 | 636 | |
637 | - switch ( true ) { |
|
638 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
639 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
637 | + switch (true) { |
|
638 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
639 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
640 | 640 | break; |
641 | 641 | |
642 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
643 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
642 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
643 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
644 | 644 | $email = $user_info->user_email; |
645 | 645 | break; |
646 | 646 | |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * |
650 | 650 | * @since 2.0 |
651 | 651 | */ |
652 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
653 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
652 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
653 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
654 | 654 | break; |
655 | 655 | } |
656 | 656 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * @param string $email |
663 | 663 | * @param array $tag_args |
664 | 664 | */ |
665 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
665 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
666 | 666 | |
667 | 667 | return $email; |
668 | 668 | } |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return string billing_address |
678 | 678 | */ |
679 | -function give_email_tag_billing_address( $tag_args ) { |
|
679 | +function give_email_tag_billing_address($tag_args) { |
|
680 | 680 | $address = ''; |
681 | 681 | |
682 | 682 | // Backward compatibility. |
683 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
683 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
684 | 684 | |
685 | - switch ( true ) { |
|
686 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
687 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
688 | - $address = $donation_address['line1'] . "\n"; |
|
685 | + switch (true) { |
|
686 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
687 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
688 | + $address = $donation_address['line1']."\n"; |
|
689 | 689 | |
690 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
691 | - $address .= $donation_address['line2'] . "\n"; |
|
690 | + if ( ! empty($donation_address['line2'])) { |
|
691 | + $address .= $donation_address['line2']."\n"; |
|
692 | 692 | } |
693 | 693 | |
694 | - $address .= $donation_address['city'] . ' ' . $donation_address['zip'] . ' ' . $donation_address['state'] . "\n"; |
|
694 | + $address .= $donation_address['city'].' '.$donation_address['zip'].' '.$donation_address['state']."\n"; |
|
695 | 695 | $address .= $donation_address['country']; |
696 | 696 | break; |
697 | 697 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param string $address |
705 | 705 | * @param array $tag_args |
706 | 706 | */ |
707 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
707 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
708 | 708 | |
709 | 709 | return $address; |
710 | 710 | } |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string $date Post Date. |
720 | 720 | */ |
721 | -function give_email_tag_date( $tag_args ) { |
|
721 | +function give_email_tag_date($tag_args) { |
|
722 | 722 | $date = ''; |
723 | 723 | |
724 | 724 | // Backward compatibility. |
725 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
725 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
726 | 726 | |
727 | - switch ( true ) { |
|
728 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
729 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
727 | + switch (true) { |
|
728 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
729 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
730 | 730 | break; |
731 | 731 | } |
732 | 732 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @param string $date |
739 | 739 | * @param array $tag_args |
740 | 740 | */ |
741 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
741 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
742 | 742 | |
743 | 743 | return $date; |
744 | 744 | } |
@@ -752,16 +752,16 @@ discard block |
||
752 | 752 | * |
753 | 753 | * @return string amount |
754 | 754 | */ |
755 | -function give_email_tag_amount( $tag_args ) { |
|
755 | +function give_email_tag_amount($tag_args) { |
|
756 | 756 | $amount = ''; |
757 | 757 | |
758 | 758 | // Backward compatibility. |
759 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
759 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
760 | 760 | |
761 | - switch ( true ) { |
|
762 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
763 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
764 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
761 | + switch (true) { |
|
762 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
763 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
764 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
765 | 765 | break; |
766 | 766 | } |
767 | 767 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @param string $amount |
774 | 774 | * @param array $tag_args |
775 | 775 | */ |
776 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
776 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
777 | 777 | |
778 | 778 | return $amount; |
779 | 779 | } |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | * |
788 | 788 | * @return string price |
789 | 789 | */ |
790 | -function give_email_tag_price( $tag_args ) { |
|
791 | - return give_email_tag_amount( $tag_args ); |
|
790 | +function give_email_tag_price($tag_args) { |
|
791 | + return give_email_tag_amount($tag_args); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -800,15 +800,15 @@ discard block |
||
800 | 800 | * |
801 | 801 | * @return int payment_id |
802 | 802 | */ |
803 | -function give_email_tag_payment_id( $tag_args ) { |
|
803 | +function give_email_tag_payment_id($tag_args) { |
|
804 | 804 | $payment_id = ''; |
805 | 805 | |
806 | 806 | // Backward compatibility. |
807 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
807 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
808 | 808 | |
809 | - switch ( true ) { |
|
810 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
811 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
809 | + switch (true) { |
|
810 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
811 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
812 | 812 | break; |
813 | 813 | } |
814 | 814 | |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * @param string $payment_id |
821 | 821 | * @param array $tag_args |
822 | 822 | */ |
823 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
823 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -832,15 +832,15 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return string receipt_id |
834 | 834 | */ |
835 | -function give_email_tag_receipt_id( $tag_args ) { |
|
835 | +function give_email_tag_receipt_id($tag_args) { |
|
836 | 836 | $receipt_id = ''; |
837 | 837 | |
838 | 838 | // Backward compatibility. |
839 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
839 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
840 | 840 | |
841 | - switch ( true ) { |
|
842 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
843 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
841 | + switch (true) { |
|
842 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
843 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
844 | 844 | break; |
845 | 845 | } |
846 | 846 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * @param string $receipt_id |
853 | 853 | * @param array $tag_args |
854 | 854 | */ |
855 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
855 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -864,21 +864,21 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return string $form_title |
866 | 866 | */ |
867 | -function give_email_tag_donation( $tag_args ) { |
|
867 | +function give_email_tag_donation($tag_args) { |
|
868 | 868 | $donation_form_title = ''; |
869 | 869 | |
870 | 870 | // Backward compatibility. |
871 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
871 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
872 | 872 | |
873 | - switch ( true ) { |
|
874 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
875 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
873 | + switch (true) { |
|
874 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
875 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
876 | 876 | $separator = $level_title ? '-' : ''; |
877 | 877 | $donation_form_title = strip_tags( |
878 | 878 | give_check_variable( |
879 | 879 | give_get_donation_form_title( |
880 | 880 | $tag_args['payment_id'], |
881 | - array( 'separator' => $separator, ) |
|
881 | + array('separator' => $separator,) |
|
882 | 882 | ), |
883 | 883 | 'empty', |
884 | 884 | '' |
@@ -911,15 +911,15 @@ discard block |
||
911 | 911 | * |
912 | 912 | * @return string $form_title |
913 | 913 | */ |
914 | -function give_email_tag_form_title( $tag_args ) { |
|
914 | +function give_email_tag_form_title($tag_args) { |
|
915 | 915 | $donation_form_title = ''; |
916 | 916 | |
917 | 917 | // Backward compatibility. |
918 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
918 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
919 | 919 | |
920 | - switch ( true ) { |
|
921 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
922 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
920 | + switch (true) { |
|
921 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
922 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
923 | 923 | break; |
924 | 924 | } |
925 | 925 | |
@@ -948,15 +948,15 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @return string $company_name |
950 | 950 | */ |
951 | -function give_email_tag_company_name( $tag_args ) { |
|
951 | +function give_email_tag_company_name($tag_args) { |
|
952 | 952 | $company_name = ''; |
953 | 953 | |
954 | 954 | // Backward compatibility. |
955 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
955 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
956 | 956 | |
957 | - switch ( true ) { |
|
958 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
959 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
957 | + switch (true) { |
|
958 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
959 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
960 | 960 | break; |
961 | 961 | } |
962 | 962 | |
@@ -984,18 +984,18 @@ discard block |
||
984 | 984 | * |
985 | 985 | * @return string gateway |
986 | 986 | */ |
987 | -function give_email_tag_payment_method( $tag_args ) { |
|
987 | +function give_email_tag_payment_method($tag_args) { |
|
988 | 988 | $payment_method = ''; |
989 | 989 | |
990 | 990 | // Backward compatibility. |
991 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
991 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
992 | 992 | |
993 | 993 | // Backward compatibility. |
994 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
994 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
995 | 995 | |
996 | - switch ( true ) { |
|
997 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
998 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
996 | + switch (true) { |
|
997 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
998 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
999 | 999 | break; |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1026,15 +1026,15 @@ discard block |
||
1026 | 1026 | * |
1027 | 1027 | * @return string |
1028 | 1028 | */ |
1029 | -function give_email_tag_payment_total( $tag_args ) { |
|
1029 | +function give_email_tag_payment_total($tag_args) { |
|
1030 | 1030 | $payment_total = ''; |
1031 | 1031 | |
1032 | 1032 | // Backward compatibility. |
1033 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1033 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1034 | 1034 | |
1035 | - switch ( true ) { |
|
1036 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1037 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1035 | + switch (true) { |
|
1036 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1037 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1038 | 1038 | break; |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1062,11 +1062,11 @@ discard block |
||
1062 | 1062 | * |
1063 | 1063 | * @return string |
1064 | 1064 | */ |
1065 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1066 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1065 | +function give_email_tag_sitename($tag_args = array()) { |
|
1066 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1067 | 1067 | |
1068 | 1068 | // Backward compatibility. |
1069 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1069 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * Filter the {sitename} email template tag output. |
@@ -1092,26 +1092,26 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return string receipt_link |
1094 | 1094 | */ |
1095 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1095 | +function give_email_tag_receipt_link($tag_args) { |
|
1096 | 1096 | // Backward compatibility. |
1097 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1097 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1098 | 1098 | |
1099 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1099 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1100 | 1100 | |
1101 | 1101 | // Bailout. |
1102 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1102 | + if (give_get_option('email_template') === 'none') { |
|
1103 | 1103 | return $receipt_url; |
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | - $receipt_url = esc_url( add_query_arg( array( |
|
1108 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1109 | - ), give_get_history_page_uri() ) ); |
|
1107 | + $receipt_url = esc_url(add_query_arg(array( |
|
1108 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1109 | + ), give_get_history_page_uri())); |
|
1110 | 1110 | |
1111 | 1111 | $formatted = sprintf( |
1112 | 1112 | '<a href="%1$s">%2$s</a>', |
1113 | 1113 | $receipt_url, |
1114 | - __( 'View it in your browser »', 'give' ) |
|
1114 | + __('View it in your browser »', 'give') |
|
1115 | 1115 | ); |
1116 | 1116 | |
1117 | 1117 | /** |
@@ -1140,11 +1140,11 @@ discard block |
||
1140 | 1140 | * |
1141 | 1141 | * @return string receipt_url |
1142 | 1142 | */ |
1143 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1143 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1144 | 1144 | // Backward compatibility. |
1145 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1145 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1146 | 1146 | |
1147 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1147 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * Filter the {receipt_link_url} email template tag output. |
@@ -1171,13 +1171,13 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return string |
1173 | 1173 | */ |
1174 | -function give_get_receipt_url( $payment_id ) { |
|
1174 | +function give_get_receipt_url($payment_id) { |
|
1175 | 1175 | $receipt_url = ''; |
1176 | 1176 | |
1177 | - if ( $payment_id ) { |
|
1178 | - $receipt_url = esc_url( add_query_arg( array( |
|
1179 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1180 | - ), give_get_history_page_uri() ) ); |
|
1177 | + if ($payment_id) { |
|
1178 | + $receipt_url = esc_url(add_query_arg(array( |
|
1179 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1180 | + ), give_get_history_page_uri())); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | return $receipt_url; |
@@ -1193,22 +1193,22 @@ discard block |
||
1193 | 1193 | * |
1194 | 1194 | * @return string |
1195 | 1195 | */ |
1196 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1196 | +function give_email_tag_email_access_link($tag_args) { |
|
1197 | 1197 | $donor_id = 0; |
1198 | 1198 | $donor = array(); |
1199 | 1199 | $email_access_link = ''; |
1200 | 1200 | |
1201 | 1201 | // Backward compatibility. |
1202 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1202 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1203 | 1203 | |
1204 | - switch ( true ) { |
|
1205 | - case ! empty( $tag_args['donor_id'] ): |
|
1204 | + switch (true) { |
|
1205 | + case ! empty($tag_args['donor_id']): |
|
1206 | 1206 | $donor_id = $tag_args['donor_id']; |
1207 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1207 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1208 | 1208 | break; |
1209 | 1209 | |
1210 | - case ! empty( $tag_args['user_id'] ): |
|
1211 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1210 | + case ! empty($tag_args['user_id']): |
|
1211 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1212 | 1212 | $donor_id = $donor->id; |
1213 | 1213 | break; |
1214 | 1214 | |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | // Set email access link if donor exist. |
1220 | - if ( $donor_id ) { |
|
1221 | - $verify_key = wp_generate_password( 20, false ); |
|
1220 | + if ($donor_id) { |
|
1221 | + $verify_key = wp_generate_password(20, false); |
|
1222 | 1222 | |
1223 | 1223 | // Generate a new verify key |
1224 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1224 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1225 | 1225 | // update verify key in email tags. |
1226 | 1226 | $tag_args['verify_key'] = $verify_key; |
1227 | 1227 | |
@@ -1236,28 +1236,28 @@ discard block |
||
1236 | 1236 | ); |
1237 | 1237 | |
1238 | 1238 | // Add Payment Key to email access url, if it exists. |
1239 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1239 | + if ( ! empty($_GET['payment_key'])) { |
|
1240 | 1240 | $access_url = add_query_arg( |
1241 | 1241 | array( |
1242 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1242 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1243 | 1243 | ), |
1244 | 1244 | $access_url |
1245 | 1245 | ); |
1246 | 1246 | } |
1247 | 1247 | |
1248 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1248 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1249 | 1249 | $email_access_link = sprintf( |
1250 | 1250 | '<a href="%1$s" target="_blank">%2$s</a>', |
1251 | - esc_url( $access_url ), |
|
1252 | - __( 'View your donation history »', 'give' ) |
|
1251 | + esc_url($access_url), |
|
1252 | + __('View your donation history »', 'give') |
|
1253 | 1253 | ); |
1254 | 1254 | |
1255 | 1255 | } else { |
1256 | 1256 | |
1257 | 1257 | $email_access_link = sprintf( |
1258 | 1258 | '%1$s: %2$s', |
1259 | - __( 'View your donation history', 'give' ), |
|
1260 | - esc_url( $access_url ) |
|
1259 | + __('View your donation history', 'give'), |
|
1260 | + esc_url($access_url) |
|
1261 | 1261 | ); |
1262 | 1262 | } |
1263 | 1263 | } |
@@ -1289,23 +1289,23 @@ discard block |
||
1289 | 1289 | * |
1290 | 1290 | * @return array |
1291 | 1291 | */ |
1292 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1293 | - if ( ! is_array( $tag_args ) ) { |
|
1294 | - switch ( true ) { |
|
1295 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1296 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1292 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1293 | + if ( ! is_array($tag_args)) { |
|
1294 | + switch (true) { |
|
1295 | + case ('give_payment' === get_post_type($tag_args)): |
|
1296 | + $tag_args = array('payment_id' => $tag_args); |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1300 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1299 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1300 | + $tag_args = array('user_id' => $tag_args); |
|
1301 | 1301 | break; |
1302 | 1302 | |
1303 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1304 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1303 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1304 | + $tag_args = array('donor_id' => $tag_args); |
|
1305 | 1305 | break; |
1306 | 1306 | |
1307 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1308 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1307 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1308 | + $tag_args = array('user_id' => $tag_args); |
|
1309 | 1309 | break; |
1310 | 1310 | } |
1311 | 1311 | } |
@@ -1323,36 +1323,36 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @return array |
1325 | 1325 | */ |
1326 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1326 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1327 | 1327 | |
1328 | 1328 | $reset_password_url = ''; |
1329 | 1329 | |
1330 | - switch ( true ) { |
|
1331 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1332 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1330 | + switch (true) { |
|
1331 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1332 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1333 | 1333 | break; |
1334 | 1334 | |
1335 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1336 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1335 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1336 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1337 | 1337 | break; |
1338 | 1338 | |
1339 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1340 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1339 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1340 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1341 | 1341 | break; |
1342 | 1342 | } |
1343 | 1343 | |
1344 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1344 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1345 | 1345 | // Generate link, if Email content type is html. |
1346 | 1346 | $reset_password_link = sprintf( |
1347 | 1347 | '<a href="%1$s" target="_blank">%2$s</a>', |
1348 | - esc_url( $reset_password_url ), |
|
1349 | - __( 'Reset your password »', 'give' ) |
|
1348 | + esc_url($reset_password_url), |
|
1349 | + __('Reset your password »', 'give') |
|
1350 | 1350 | ); |
1351 | 1351 | } else { |
1352 | 1352 | $reset_password_link = sprintf( |
1353 | 1353 | '%1$s: %2$s', |
1354 | - __( 'Reset your password', 'give' ), |
|
1355 | - esc_url( $reset_password_url ) |
|
1354 | + __('Reset your password', 'give'), |
|
1355 | + esc_url($reset_password_url) |
|
1356 | 1356 | ); |
1357 | 1357 | } |
1358 | 1358 | |
@@ -1381,21 +1381,21 @@ discard block |
||
1381 | 1381 | * |
1382 | 1382 | * @return mixed|string |
1383 | 1383 | */ |
1384 | -function give_get_reset_password_url( $user_id ) { |
|
1384 | +function give_get_reset_password_url($user_id) { |
|
1385 | 1385 | $reset_password_url = ''; |
1386 | 1386 | |
1387 | 1387 | // Proceed further only, if user_id exists. |
1388 | - if ( $user_id ) { |
|
1388 | + if ($user_id) { |
|
1389 | 1389 | |
1390 | 1390 | // Get User Object Details. |
1391 | - $user = get_user_by( 'ID', $user_id ); |
|
1391 | + $user = get_user_by('ID', $user_id); |
|
1392 | 1392 | |
1393 | 1393 | // Prepare Reset Password URL. |
1394 | - $reset_password_url = esc_url( add_query_arg( array( |
|
1394 | + $reset_password_url = esc_url(add_query_arg(array( |
|
1395 | 1395 | 'action' => 'rp', |
1396 | - 'key' => get_password_reset_key( $user ), |
|
1396 | + 'key' => get_password_reset_key($user), |
|
1397 | 1397 | 'login' => $user->user_login, |
1398 | - ), wp_login_url() ) ); |
|
1398 | + ), wp_login_url())); |
|
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | return $reset_password_url; |
@@ -1414,94 +1414,94 @@ discard block |
||
1414 | 1414 | * |
1415 | 1415 | * @return mixed |
1416 | 1416 | */ |
1417 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1418 | - preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches ); |
|
1417 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1418 | + preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches); |
|
1419 | 1419 | |
1420 | - if ( ! empty( $matches[0] ) ) { |
|
1420 | + if ( ! empty($matches[0])) { |
|
1421 | 1421 | $search = $replace = array(); |
1422 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1423 | - if ( in_array( $meta_tag, $search ) ) { |
|
1422 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1423 | + if (in_array($meta_tag, $search)) { |
|
1424 | 1424 | continue; |
1425 | 1425 | } |
1426 | 1426 | |
1427 | 1427 | $search[] = $meta_tag; |
1428 | 1428 | |
1429 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1430 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1431 | - $meta_tag = current( $meta_tag_arr ); |
|
1429 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1430 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1431 | + $meta_tag = current($meta_tag_arr); |
|
1432 | 1432 | |
1433 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1434 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1435 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1433 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1434 | + $type = current(explode('_', $meta_tag, 2)); |
|
1435 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1436 | 1436 | |
1437 | - switch ( $type ) { |
|
1437 | + switch ($type) { |
|
1438 | 1438 | case 'donation': |
1439 | 1439 | |
1440 | 1440 | //Bailout. |
1441 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1441 | + if ( ! isset($tag_args['payment_id'])) { |
|
1442 | 1442 | $replace[] = ''; |
1443 | 1443 | continue; |
1444 | 1444 | } |
1445 | 1445 | |
1446 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1446 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1447 | 1447 | |
1448 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1448 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1449 | 1449 | $replace[] = $meta_data; |
1450 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1451 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1450 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1451 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | break; |
1455 | 1455 | |
1456 | 1456 | case 'form': |
1457 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1457 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1458 | 1458 | |
1459 | 1459 | // Bailout. |
1460 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1461 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1460 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1461 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1465 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1464 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1465 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1466 | 1466 | $replace[] = $meta_data; |
1467 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1468 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1467 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1468 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1469 | 1469 | } |
1470 | 1470 | break; |
1471 | 1471 | |
1472 | 1472 | case 'donor': |
1473 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1473 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1474 | 1474 | |
1475 | 1475 | // Bailout. |
1476 | - if ( ! $donor_id ) { |
|
1477 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1478 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1479 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1480 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1476 | + if ( ! $donor_id) { |
|
1477 | + if (isset($tag_args['payment_id'])) { |
|
1478 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1479 | + } elseif (isset($tag_args['user_id'])) { |
|
1480 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1481 | 1481 | } |
1482 | 1482 | } |
1483 | 1483 | |
1484 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1484 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1485 | 1485 | |
1486 | - if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1487 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1486 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1487 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1490 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1491 | 1491 | $replace[] = $meta_data; |
1492 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1493 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1492 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1493 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | break; |
1497 | 1497 | |
1498 | 1498 | default: |
1499 | - $replace[] = end( $search ); |
|
1499 | + $replace[] = end($search); |
|
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | |
1503 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1504 | - $content = str_replace( $search, $replace, $content ); |
|
1503 | + if ( ! empty($search) && ! empty($replace)) { |
|
1504 | + $content = str_replace($search, $replace, $content); |
|
1505 | 1505 | } |
1506 | 1506 | } |
1507 | 1507 | |
@@ -1509,4 +1509,4 @@ discard block |
||
1509 | 1509 | return $content; |
1510 | 1510 | } |
1511 | 1511 | |
1512 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1512 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | |
41 | 41 | // Exit if accessed directly. |
42 | -if ( ! defined( 'ABSPATH' ) ) { |
|
42 | +if ( ! defined('ABSPATH')) { |
|
43 | 43 | exit; |
44 | 44 | } |
45 | 45 | |
46 | -if ( ! class_exists( 'Give' ) ) : |
|
46 | +if ( ! class_exists('Give')) : |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Main Give Class |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @return Give |
262 | 262 | */ |
263 | 263 | public static function instance() { |
264 | - if ( is_null( self::$_instance ) ) { |
|
264 | + if (is_null(self::$_instance)) { |
|
265 | 265 | self::$_instance = new self(); |
266 | 266 | } |
267 | 267 | |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function __construct() { |
275 | 275 | // PHP version |
276 | - if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) { |
|
277 | - define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' ); |
|
276 | + if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) { |
|
277 | + define('GIVE_REQUIRED_PHP_VERSION', '5.3'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // Bailout: Need minimum php version to load plugin. |
281 | - if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) { |
|
282 | - add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) ); |
|
281 | + if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) { |
|
282 | + add_action('admin_notices', array($this, 'minimum_phpversion_notice')); |
|
283 | 283 | |
284 | 284 | return; |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $this->includes(); |
289 | 289 | $this->init_hooks(); |
290 | 290 | |
291 | - do_action( 'give_loaded' ); |
|
291 | + do_action('give_loaded'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | * @since 1.8.9 |
298 | 298 | */ |
299 | 299 | private function init_hooks() { |
300 | - register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' ); |
|
301 | - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); |
|
300 | + register_activation_hook(GIVE_PLUGIN_FILE, 'give_install'); |
|
301 | + add_action('plugins_loaded', array($this, 'init'), 0); |
|
302 | 302 | |
303 | 303 | // Set up localization on init Hook. |
304 | - add_action( 'init', array( $this, 'load_textdomain' ), 0 ); |
|
304 | + add_action('init', array($this, 'load_textdomain'), 0); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @since 1.8.9 |
319 | 319 | */ |
320 | - do_action( 'before_give_init' ); |
|
320 | + do_action('before_give_init'); |
|
321 | 321 | |
322 | 322 | // Set up localization. |
323 | 323 | $this->load_textdomain(); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @since 1.8.7 |
352 | 352 | */ |
353 | - do_action( 'give_init', $this ); |
|
353 | + do_action('give_init', $this); |
|
354 | 354 | |
355 | 355 | } |
356 | 356 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function __clone() { |
369 | 369 | // Cloning instances of the class is forbidden. |
370 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
370 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function __wakeup() { |
382 | 382 | // Unserializing instances of the class is forbidden. |
383 | - give_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
383 | + give_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -394,33 +394,33 @@ discard block |
||
394 | 394 | private function setup_constants() { |
395 | 395 | |
396 | 396 | // Plugin version |
397 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
398 | - define( 'GIVE_VERSION', '2.1.3' ); |
|
397 | + if ( ! defined('GIVE_VERSION')) { |
|
398 | + define('GIVE_VERSION', '2.1.3'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // Plugin Root File |
402 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
403 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
402 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
403 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // Plugin Folder Path |
407 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
408 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) ); |
|
407 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
408 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE)); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | // Plugin Folder URL |
412 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
413 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) ); |
|
412 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
413 | + define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE)); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | // Plugin Basename aka: "give/give.php" |
417 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
418 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) ); |
|
417 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
418 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE)); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | // Make sure CAL_GREGORIAN is defined |
422 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
423 | - define( 'CAL_GREGORIAN', 1 ); |
|
422 | + if ( ! defined('CAL_GREGORIAN')) { |
|
423 | + define('CAL_GREGORIAN', 1); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | |
@@ -438,160 +438,160 @@ discard block |
||
438 | 438 | /** |
439 | 439 | * Load libraries. |
440 | 440 | */ |
441 | - if ( ! class_exists( 'WP_Async_Request' ) ) { |
|
442 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' ); |
|
441 | + if ( ! class_exists('WP_Async_Request')) { |
|
442 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php'); |
|
443 | 443 | } |
444 | 444 | |
445 | - if ( ! class_exists( 'WP_Background_Process' ) ) { |
|
446 | - include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' ); |
|
445 | + if ( ! class_exists('WP_Background_Process')) { |
|
446 | + include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Load plugin files |
451 | 451 | */ |
452 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
453 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
452 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
453 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
454 | 454 | $give_options = give_get_settings(); |
455 | 455 | |
456 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
457 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php'; |
|
458 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
459 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
460 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
461 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
462 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
463 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
464 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
465 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php'; |
|
466 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php'; |
|
467 | - require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php'; |
|
468 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php'; |
|
469 | - |
|
470 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php'; |
|
471 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
472 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
473 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
474 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
475 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php'; |
|
476 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php'; |
|
477 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php'; |
|
478 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php'; |
|
479 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
480 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
481 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
482 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
483 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
484 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
485 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php'; |
|
486 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php'; |
|
487 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php'; |
|
488 | - |
|
489 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
490 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
491 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
492 | - require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php'; |
|
493 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
494 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
495 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
496 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
497 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
498 | - require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php'; |
|
499 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
500 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
501 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
502 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
503 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
504 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
505 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php'; |
|
506 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
507 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
508 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
509 | - |
|
510 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php'; |
|
511 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
512 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
513 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
514 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
515 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
516 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php'; |
|
517 | - |
|
518 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
519 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
520 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
521 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
522 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
523 | - |
|
524 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
525 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
526 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php'; |
|
527 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
528 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
529 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
530 | - |
|
531 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php'; |
|
532 | - require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php'; |
|
533 | - |
|
534 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php'; |
|
535 | - |
|
536 | - require_once GIVE_PLUGIN_DIR . 'blocks/load.php'; |
|
537 | - |
|
538 | - if ( defined( 'WP_CLI' ) && WP_CLI ) { |
|
539 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
456 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
457 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php'; |
|
458 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
459 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
460 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
461 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
462 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
463 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
464 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
465 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php'; |
|
466 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php'; |
|
467 | + require_once GIVE_PLUGIN_DIR.'includes/class-notices.php'; |
|
468 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php'; |
|
469 | + |
|
470 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php'; |
|
471 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
472 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
473 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
474 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
475 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php'; |
|
476 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php'; |
|
477 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php'; |
|
478 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php'; |
|
479 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
480 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
481 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
482 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
483 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
484 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
485 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php'; |
|
486 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php'; |
|
487 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php'; |
|
488 | + |
|
489 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
490 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
491 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
492 | + require_once GIVE_PLUGIN_DIR.'includes/import-functions.php'; |
|
493 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
494 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
495 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
496 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
497 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
498 | + require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php'; |
|
499 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
500 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
501 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
502 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
503 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
504 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
505 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php'; |
|
506 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
507 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
508 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
509 | + |
|
510 | + require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php'; |
|
511 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
512 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
513 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
514 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
515 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
516 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php'; |
|
517 | + |
|
518 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
519 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
520 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
521 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
522 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
523 | + |
|
524 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
525 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
526 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php'; |
|
527 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
528 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
529 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
530 | + |
|
531 | + require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php'; |
|
532 | + require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php'; |
|
533 | + |
|
534 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php'; |
|
535 | + |
|
536 | + require_once GIVE_PLUGIN_DIR.'blocks/load.php'; |
|
537 | + |
|
538 | + if (defined('WP_CLI') && WP_CLI) { |
|
539 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
540 | 540 | } |
541 | 541 | |
542 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
543 | - |
|
544 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
545 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
546 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
547 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
548 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
549 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
550 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
551 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
552 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
553 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
554 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php'; |
|
555 | - |
|
556 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
557 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
558 | - |
|
559 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php'; |
|
560 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php'; |
|
561 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php'; |
|
562 | - |
|
563 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
564 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
565 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
566 | - |
|
567 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php'; |
|
568 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php'; |
|
569 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php'; |
|
570 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php'; |
|
571 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php'; |
|
572 | - |
|
573 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php'; |
|
574 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php'; |
|
575 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php'; |
|
576 | - |
|
577 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
578 | - |
|
579 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php'; |
|
580 | - |
|
581 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
582 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
583 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
584 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
585 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
586 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
587 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
588 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
589 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
590 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
591 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
542 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
543 | + |
|
544 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
545 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
546 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
547 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
548 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
549 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
550 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
551 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
552 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
553 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
554 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php'; |
|
555 | + |
|
556 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
557 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
558 | + |
|
559 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php'; |
|
560 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php'; |
|
561 | + require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php'; |
|
562 | + |
|
563 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
564 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
565 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
566 | + |
|
567 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php'; |
|
568 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php'; |
|
569 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php'; |
|
570 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php'; |
|
571 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php'; |
|
572 | + |
|
573 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php'; |
|
574 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php'; |
|
575 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php'; |
|
576 | + |
|
577 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
578 | + |
|
579 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php'; |
|
580 | + |
|
581 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
582 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
583 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
584 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
585 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
586 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
587 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
588 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php'; |
|
589 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
590 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
591 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php'; |
|
592 | 592 | }// End if(). |
593 | 593 | |
594 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
594 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
595 | 595 | |
596 | 596 | } |
597 | 597 | |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | public function load_textdomain() { |
607 | 607 | |
608 | 608 | // Set filter for Give's languages directory |
609 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
610 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
609 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
610 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
611 | 611 | |
612 | 612 | // Traditional WordPress plugin locale filter. |
613 | - $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale(); |
|
614 | - $locale = apply_filters( 'plugin_locale', $locale, 'give' ); |
|
613 | + $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale(); |
|
614 | + $locale = apply_filters('plugin_locale', $locale, 'give'); |
|
615 | 615 | |
616 | - unload_textdomain( 'give' ); |
|
617 | - load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' ); |
|
618 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
616 | + unload_textdomain('give'); |
|
617 | + load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo'); |
|
618 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
619 | 619 | |
620 | 620 | } |
621 | 621 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | */ |
629 | 629 | public function minimum_phpversion_notice() { |
630 | 630 | // Bailout. |
631 | - if ( ! is_admin() ) { |
|
631 | + if ( ! is_admin()) { |
|
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | - $notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>'; |
|
636 | - $notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>'; |
|
637 | - $notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>'; |
|
638 | - $notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>'; |
|
639 | - $notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>'; |
|
640 | - $notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>'; |
|
641 | - $notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>'; |
|
635 | + $notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>'; |
|
636 | + $notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>'; |
|
637 | + $notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>'; |
|
638 | + $notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>'; |
|
639 | + $notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>'; |
|
640 | + $notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>'; |
|
641 | + $notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>'; |
|
642 | 642 | |
643 | 643 | echo sprintf( |
644 | 644 | '<div class="notice notice-error">%1$s</div>', |
645 | - wp_kses_post( $notice_desc ) |
|
645 | + wp_kses_post($notice_desc) |
|
646 | 646 | ); |
647 | 647 | } |
648 | 648 |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | // Sanity check - ensure form has pass all condition to show goal. |
10 | 10 | if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) ) |
11 | - || empty( $form->ID ) |
|
12 | - || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | - || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
11 | + || empty( $form->ID ) |
|
12 | + || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | + || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
14 | 14 | return false; |
15 | 15 | } |
16 | 16 | |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */ |
98 | 98 | __( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) ); |
99 | 99 | |
100 | - elseif ( 'percentage' === $goal_format ) : |
|
100 | + elseif ( 'percentage' === $goal_format ) : |
|
101 | 101 | |
102 | 102 | echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */ |
103 | 103 | __( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) ); |
104 | 104 | |
105 | - elseif ( 'donation' === $goal_format ) : |
|
105 | + elseif ( 'donation' === $goal_format ) : |
|
106 | 106 | |
107 | 107 | echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */ |
108 | 108 | _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal ); |
109 | 109 | |
110 | - elseif ( 'donors' === $goal_format ) : |
|
110 | + elseif ( 'donors' === $goal_format ) : |
|
111 | 111 | |
112 | 112 | echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */ |
113 | 113 | _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal ); |
@@ -3,46 +3,46 @@ discard block |
||
3 | 3 | * This template is used to display the goal with [give_goal] |
4 | 4 | */ |
5 | 5 | |
6 | -$form = new Give_Donate_Form( $form_id ); |
|
7 | -$goal_option = give_get_meta( $form->ID, '_give_goal_option', true ); |
|
6 | +$form = new Give_Donate_Form($form_id); |
|
7 | +$goal_option = give_get_meta($form->ID, '_give_goal_option', true); |
|
8 | 8 | |
9 | 9 | // Sanity check - ensure form has pass all condition to show goal. |
10 | -if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) ) |
|
11 | - || empty( $form->ID ) |
|
12 | - || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) ) |
|
13 | - || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) { |
|
10 | +if ((isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN)) |
|
11 | + || empty($form->ID) |
|
12 | + || (is_singular('give_forms') && ! give_is_setting_enabled($goal_option)) |
|
13 | + || ! give_is_setting_enabled($goal_option) || 0 === $form->goal) { |
|
14 | 14 | return false; |
15 | 15 | } |
16 | 16 | |
17 | -$goal_format = give_get_form_goal_format( $form_id ); |
|
18 | -$price = give_get_meta( $form_id, '_give_set_price', true ); |
|
19 | -$color = give_get_meta( $form_id, '_give_goal_color', true ); |
|
20 | -$show_text = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
21 | -$show_bar = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
22 | -$goal_progress_stats = give_goal_progress_stats( $form ); |
|
17 | +$goal_format = give_get_form_goal_format($form_id); |
|
18 | +$price = give_get_meta($form_id, '_give_set_price', true); |
|
19 | +$color = give_get_meta($form_id, '_give_goal_color', true); |
|
20 | +$show_text = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
21 | +$show_bar = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
22 | +$goal_progress_stats = give_goal_progress_stats($form); |
|
23 | 23 | |
24 | 24 | $income = $goal_progress_stats['raw_actual']; |
25 | 25 | $goal = $goal_progress_stats['raw_goal']; |
26 | 26 | |
27 | -switch ( $goal_format ) { |
|
27 | +switch ($goal_format) { |
|
28 | 28 | |
29 | 29 | case 'donation': |
30 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
30 | + $progress = round(($income / $goal) * 100, 2); |
|
31 | 31 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
32 | 32 | break; |
33 | 33 | |
34 | 34 | case 'donors': |
35 | - $progress_bar_value = round( ( $income / $goal ) * 100, 2 ); |
|
35 | + $progress_bar_value = round(($income / $goal) * 100, 2); |
|
36 | 36 | $progress = $progress_bar_value; |
37 | 37 | break; |
38 | 38 | |
39 | 39 | case 'percentage': |
40 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
40 | + $progress = round(($income / $goal) * 100, 2); |
|
41 | 41 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
42 | 42 | break; |
43 | 43 | |
44 | 44 | default: |
45 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
45 | + $progress = round(($income / $goal) * 100, 2); |
|
46 | 46 | $progress_bar_value = $income >= $goal ? 100 : $progress; |
47 | 47 | break; |
48 | 48 | |
@@ -53,64 +53,64 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @since 1.8.8 |
55 | 55 | */ |
56 | -$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form_id, $form ); |
|
56 | +$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form_id, $form); |
|
57 | 57 | ?> |
58 | 58 | <div class="give-goal-progress"> |
59 | - <?php if ( ! empty( $show_text ) ) : ?> |
|
59 | + <?php if ( ! empty($show_text)) : ?> |
|
60 | 60 | <div class="raised"> |
61 | 61 | <?php |
62 | - if ( 'amount' === $goal_format ) : |
|
62 | + if ('amount' === $goal_format) : |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Filter the give currency. |
66 | 66 | * |
67 | 67 | * @since 1.8.17 |
68 | 68 | */ |
69 | - $form_currency = apply_filters( 'give_goal_form_currency', give_get_currency( $form_id ), $form_id ); |
|
69 | + $form_currency = apply_filters('give_goal_form_currency', give_get_currency($form_id), $form_id); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Filter the income formatting arguments. |
73 | 73 | * |
74 | 74 | * @since 1.8.17 |
75 | 75 | */ |
76 | - $income_format_args = apply_filters( 'give_goal_income_format_args', array( |
|
76 | + $income_format_args = apply_filters('give_goal_income_format_args', array( |
|
77 | 77 | 'sanitize' => false, |
78 | 78 | 'currency' => $form_currency, |
79 | 79 | 'decimal' => false, |
80 | - ), $form_id ); |
|
80 | + ), $form_id); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Filter the goal formatting arguments. |
84 | 84 | * |
85 | 85 | * @since 1.8.17 |
86 | 86 | */ |
87 | - $goal_format_args = apply_filters( 'give_goal_amount_format_args', array( |
|
87 | + $goal_format_args = apply_filters('give_goal_amount_format_args', array( |
|
88 | 88 | 'sanitize' => false, |
89 | 89 | 'currency' => $form_currency, |
90 | 90 | 'decimal' => false, |
91 | - ), $form_id ); |
|
91 | + ), $form_id); |
|
92 | 92 | |
93 | 93 | // Get formatted amount. |
94 | - $income = give_human_format_large_amount( give_format_amount( $income, $income_format_args ), array( 'currency' => $form_currency ) ); |
|
95 | - $goal = give_human_format_large_amount( give_format_amount( $goal, $goal_format_args ), array( 'currency' => $form_currency ) ); |
|
94 | + $income = give_human_format_large_amount(give_format_amount($income, $income_format_args), array('currency' => $form_currency)); |
|
95 | + $goal = give_human_format_large_amount(give_format_amount($goal, $goal_format_args), array('currency' => $form_currency)); |
|
96 | 96 | |
97 | 97 | echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */ |
98 | - __( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) ); |
|
98 | + __('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give'), give_currency_filter($income, array('form_id' => $form_id)), give_currency_filter($goal, array('form_id' => $form_id)) ); |
|
99 | 99 | |
100 | - elseif ( 'percentage' === $goal_format ) : |
|
100 | + elseif ('percentage' === $goal_format) : |
|
101 | 101 | |
102 | 102 | echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */ |
103 | - __( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) ); |
|
103 | + __('<span class="give-percentage">%s%%</span> funded', 'give'), round($progress) ); |
|
104 | 104 | |
105 | - elseif ( 'donation' === $goal_format ) : |
|
105 | + elseif ('donation' === $goal_format) : |
|
106 | 106 | |
107 | 107 | echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */ |
108 | - _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal ); |
|
108 | + _n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give'), $income, $goal ); |
|
109 | 109 | |
110 | - elseif ( 'donors' === $goal_format ) : |
|
110 | + elseif ('donors' === $goal_format) : |
|
111 | 111 | |
112 | 112 | echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */ |
113 | - _n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal ); |
|
113 | + _n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give'), $income, $goal ); |
|
114 | 114 | |
115 | 115 | endif; |
116 | 116 | ?> |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | <?php endif; ?> |
119 | 119 | |
120 | 120 | |
121 | - <?php if ( ! empty( $show_bar ) ) : ?> |
|
121 | + <?php if ( ! empty($show_bar)) : ?> |
|
122 | 122 | <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" |
123 | - aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>"> |
|
124 | - <span style="width: <?php echo esc_attr( $progress_bar_value ); ?>%;<?php if ( ! empty( $color ) ) { |
|
125 | - echo 'background-color:' . $color; |
|
123 | + aria-valuenow="<?php echo esc_attr($progress_bar_value); ?>"> |
|
124 | + <span style="width: <?php echo esc_attr($progress_bar_value); ?>%;<?php if ( ! empty($color)) { |
|
125 | + echo 'background-color:'.$color; |
|
126 | 126 | } ?>"></span> |
127 | 127 | </div><!-- /.give-progress-bar --> |
128 | 128 | <?php endif; ?> |