@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | - array( |
|
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | - 'id' => 'email_settings_docs_link', |
|
85 | - 'url' => esc_url( 'http://docs.givewp.com/emailsettings' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
87 | - 'type' => 'give_docs_link', |
|
88 | - ), |
|
82 | + array( |
|
83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | + 'id' => 'email_settings_docs_link', |
|
85 | + 'url' => esc_url( 'http://docs.givewp.com/emailsettings' ), |
|
86 | + 'title' => __( 'Email Settings', 'give' ), |
|
87 | + 'type' => 'give_docs_link', |
|
88 | + ), |
|
89 | 89 | array( |
90 | 90 | 'id' => 'give_title_email_settings_1', |
91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | - array( |
|
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
124 | - 'url' => esc_url( 'http://docs.givewp.com/donationreceipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | - 'type' => 'give_docs_link', |
|
127 | - ), |
|
121 | + array( |
|
122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
124 | + 'url' => esc_url( 'http://docs.givewp.com/donationreceipt' ), |
|
125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | + 'type' => 'give_docs_link', |
|
127 | + ), |
|
128 | 128 | array( |
129 | 129 | 'id' => 'give_title_email_settings_2', |
130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'type' => 'textarea', |
176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
177 | 177 | ), |
178 | - array( |
|
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | - 'id' => 'donation_notification_settings_docs_link', |
|
181 | - 'url' => esc_url( 'http://docs.givewp.com/donationnotification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | - 'type' => 'give_docs_link', |
|
184 | - ), |
|
178 | + array( |
|
179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | + 'id' => 'donation_notification_settings_docs_link', |
|
181 | + 'url' => esc_url( 'http://docs.givewp.com/donationnotification' ), |
|
182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | + 'type' => 'give_docs_link', |
|
184 | + ), |
|
185 | 185 | array( |
186 | 186 | 'id' => 'give_title_email_settings_3', |
187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'email-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'email_template', |
57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
58 | - 'desc' => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
57 | + 'name' => esc_html__('Email Template', 'give'), |
|
58 | + 'desc' => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => give_get_email_templates() |
61 | 61 | ), |
62 | 62 | array( |
63 | 63 | 'id' => 'email_logo', |
64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
64 | + 'name' => esc_html__('Logo', 'give'), |
|
65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
66 | 66 | 'type' => 'file' |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'id' => 'from_name', |
70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in donation receipt emails.', 'give' ), |
|
72 | - 'default' => get_bloginfo( 'name' ), |
|
70 | + 'name' => esc_html__('From Name', 'give'), |
|
71 | + 'desc' => esc_html__('The name which appears in the "From" field in donation receipt emails.', 'give'), |
|
72 | + 'default' => get_bloginfo('name'), |
|
73 | 73 | 'type' => 'text' |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'id' => 'from_email', |
77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
78 | - 'desc' => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
77 | + 'name' => esc_html__('From Email', 'give'), |
|
78 | + 'desc' => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
79 | + 'default' => get_bloginfo('admin_email'), |
|
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | 82 | array( |
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
84 | 84 | 'id' => 'email_settings_docs_link', |
85 | - 'url' => esc_url( 'http://docs.givewp.com/emailsettings' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
85 | + 'url' => esc_url('http://docs.givewp.com/emailsettings'), |
|
86 | + 'title' => __('Email Settings', 'give'), |
|
87 | 87 | 'type' => 'give_docs_link', |
88 | 88 | ), |
89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'id' => 'donation_subject', |
105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
108 | 108 | 'type' => 'text' |
109 | 109 | ), |
110 | 110 | array( |
111 | 111 | 'id' => 'donation_receipt', |
112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
113 | 113 | 'desc' => sprintf( |
114 | 114 | /* translators: %s: emails tags list */ |
115 | - esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
115 | + esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
116 | 116 | '<br/>'.give_get_emails_tags_list() |
117 | 117 | ), |
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/donationreceipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/donationreceipt'), |
|
125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => 'admin_notices', |
144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
145 | + 'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ) |
152 | 152 | ), |
153 | 153 | array( |
154 | 154 | 'id' => 'donation_notification_subject', |
155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
156 | - 'desc' => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ), |
|
155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
156 | + 'desc' => esc_html__('Enter the subject line for the donation notification email.', 'give'), |
|
157 | 157 | 'type' => 'text', |
158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
159 | 159 | ), |
160 | 160 | array( |
161 | 161 | 'id' => 'donation_notification', |
162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
163 | 163 | 'desc' => sprintf( |
164 | 164 | /* translators: %s: emails tags list */ |
165 | - esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
165 | + esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
166 | 166 | '<br/>'.give_get_emails_tags_list() |
167 | 167 | ), |
168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ), |
171 | 171 | array( |
172 | 172 | 'id' => 'admin_notice_emails', |
173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
175 | 175 | 'type' => 'textarea', |
176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
176 | + 'default' => get_bloginfo('admin_email') |
|
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
181 | - 'url' => esc_url( 'http://docs.givewp.com/donationnotification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
181 | + 'url' => esc_url('http://docs.givewp.com/donationnotification'), |
|
182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
183 | 183 | 'type' => 'give_docs_link', |
184 | 184 | ), |
185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Filter the emails settings. |
195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
196 | 196 | */ |
197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.8 |
203 | 203 | * @param array $settings |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
206 | 206 | |
207 | 207 | // Output. |
208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_sections() { |
218 | 218 | $sections = array( |
219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
222 | 222 | ); |
223 | 223 | |
224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_form' ); |
|
30 | + parent::__construct('give_form'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | $create_form_link = sprintf( |
41 | 41 | /* translators: %s: create new form URL */ |
42 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
43 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
42 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
43 | + admin_url('post-new.php?post_type=give_forms') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | return array( |
@@ -50,59 +50,59 @@ discard block |
||
50 | 50 | 'post_type' => 'give_forms', |
51 | 51 | ), |
52 | 52 | 'name' => 'id', |
53 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
54 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
53 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
54 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
55 | 55 | 'required' => array( |
56 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
57 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
56 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
57 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
58 | 58 | ), |
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'container', |
62 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
62 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_title', |
67 | - 'label' => esc_attr__( 'Show Title:', 'give' ), |
|
68 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Title:', 'give'), |
|
68 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_goal', |
77 | - 'label' => esc_attr__( 'Show Goal:', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Goal:', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_content', |
87 | 87 | 'minWidth' => 240, |
88 | - 'label' => esc_attr__( 'Display Content:', 'give' ), |
|
89 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
88 | + 'label' => esc_attr__('Display Content:', 'give'), |
|
89 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
90 | 90 | 'options' => array( |
91 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
92 | - 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
93 | - 'below' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
91 | + 'none' => esc_html__('No Content', 'give'), |
|
92 | + 'above' => esc_html__('Display content ABOVE the fields', 'give'), |
|
93 | + 'below' => esc_html__('Display content BELOW the fields', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'type' => 'listbox', |
98 | 98 | 'name' => 'display_style', |
99 | - 'label' => esc_attr__( 'Donation Options:', 'give' ), |
|
100 | - 'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ), |
|
99 | + 'label' => esc_attr__('Donation Options:', 'give'), |
|
100 | + 'tooltip' => esc_attr__('How would you like to display donation information?', 'give'), |
|
101 | 101 | 'options' => array( |
102 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
103 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
104 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
105 | - 'button' => esc_html__( 'Button', 'give' ), |
|
102 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
103 | + 'modal' => esc_html__('Modal', 'give'), |
|
104 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
105 | + 'button' => esc_html__('Button', 'give'), |
|
106 | 106 | ), |
107 | 107 | ), |
108 | 108 | ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return mixed |
28 | 28 | */ |
29 | -function _give_sanitize_number_decimals_setting_field( $value ) { |
|
30 | - return absint( $value ); |
|
29 | +function _give_sanitize_number_decimals_setting_field($value) { |
|
30 | + return absint($value); |
|
31 | 31 | } |
32 | -add_filter( 'give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10 ); |
|
33 | 32 | \ No newline at end of file |
33 | +add_filter('give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10); |
|
34 | 34 | \ No newline at end of file |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = esc_html__( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = esc_html__('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 30 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 30); |
|
56 | 56 | |
57 | 57 | // Load required scripts. |
58 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) ); |
|
58 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_script')); |
|
59 | 59 | |
60 | 60 | // Save form meta. |
61 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
61 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
62 | 62 | |
63 | 63 | // cmb2 old setting loaders. |
64 | 64 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
65 | 65 | // Add offline donations options. |
66 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
66 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function get_settings() { |
88 | 88 | $post_id = give_get_admin_post_id(); |
89 | - $price = give_get_form_price( $post_id ); |
|
90 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
91 | - $goal = give_get_form_goal( $post_id ); |
|
89 | + $price = give_get_form_price($post_id); |
|
90 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
91 | + $goal = give_get_form_goal($post_id); |
|
92 | 92 | |
93 | 93 | // No empty prices - min. 1.00 for new forms |
94 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
95 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
94 | + if (empty($price) && is_null($post_id)) { |
|
95 | + $price = esc_attr(give_format_decimal('1.00')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // Min. $1.00 for new forms |
99 | - if ( empty( $custom_amount_minimum ) ) { |
|
100 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
99 | + if (empty($custom_amount_minimum)) { |
|
100 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Start with an underscore to hide fields from custom fields list |
@@ -107,213 +107,213 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * Repeatable Field Groups |
109 | 109 | */ |
110 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
110 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
111 | 111 | 'id' => 'form_field_options', |
112 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
113 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
112 | + 'title' => esc_html__('Donation Options', 'give'), |
|
113 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
114 | 114 | // Donation Option |
115 | 115 | array( |
116 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
117 | - 'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
118 | - 'id' => $prefix . 'price_option', |
|
116 | + 'name' => esc_html__('Donation Option', 'give'), |
|
117 | + 'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
118 | + 'id' => $prefix.'price_option', |
|
119 | 119 | 'type' => 'radio_inline', |
120 | 120 | 'default' => 'set', |
121 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
122 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
123 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
124 | - ) ), |
|
121 | + 'options' => apply_filters('give_forms_price_options', array( |
|
122 | + 'set' => esc_html__('Set Donation', 'give'), |
|
123 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
124 | + )), |
|
125 | 125 | ), |
126 | 126 | array( |
127 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
128 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
129 | - 'id' => $prefix . 'set_price', |
|
127 | + 'name' => esc_html__('Set Donation', 'give'), |
|
128 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
129 | + 'id' => $prefix.'set_price', |
|
130 | 130 | 'type' => 'text_small', |
131 | 131 | 'data_type' => 'price', |
132 | 132 | 'attributes' => array( |
133 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
134 | - 'value' => give_format_decimal( $price ), |
|
133 | + 'placeholder' => give_format_decimal('1.00'), |
|
134 | + 'value' => give_format_decimal($price), |
|
135 | 135 | 'class' => 'give-money-field', |
136 | 136 | ), |
137 | 137 | ), |
138 | 138 | // Donation Levels: Repeatable CMB2 Group |
139 | 139 | array( |
140 | - 'id' => $prefix . 'donation_levels', |
|
140 | + 'id' => $prefix.'donation_levels', |
|
141 | 141 | 'type' => 'group', |
142 | 142 | 'options' => array( |
143 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
144 | - 'header_title' => esc_html__( 'Donation Level', 'give' ), |
|
143 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
144 | + 'header_title' => esc_html__('Donation Level', 'give'), |
|
145 | 145 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
146 | 146 | ), |
147 | 147 | // Fields array works the same, except id's only need to be unique for this group. |
148 | 148 | // Prefix is not needed. |
149 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
149 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
150 | 150 | array( |
151 | - 'name' => esc_html__( 'ID', 'give' ), |
|
152 | - 'id' => $prefix . 'id', |
|
151 | + 'name' => esc_html__('ID', 'give'), |
|
152 | + 'id' => $prefix.'id', |
|
153 | 153 | 'type' => 'levels_id', |
154 | 154 | ), |
155 | 155 | array( |
156 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
157 | - 'id' => $prefix . 'amount', |
|
156 | + 'name' => esc_html__('Amount', 'give'), |
|
157 | + 'id' => $prefix.'amount', |
|
158 | 158 | 'type' => 'text_small', |
159 | 159 | 'data_type' => 'price', |
160 | 160 | 'attributes' => array( |
161 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
161 | + 'placeholder' => give_format_decimal('1.00'), |
|
162 | 162 | 'class' => 'give-money-field', |
163 | 163 | ), |
164 | 164 | ), |
165 | 165 | array( |
166 | - 'name' => esc_html__( 'Text', 'give' ), |
|
167 | - 'id' => $prefix . 'text', |
|
166 | + 'name' => esc_html__('Text', 'give'), |
|
167 | + 'id' => $prefix.'text', |
|
168 | 168 | 'type' => 'text', |
169 | 169 | 'attributes' => array( |
170 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
170 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
171 | 171 | 'class' => 'give-multilevel-text-field', |
172 | 172 | ), |
173 | 173 | ), |
174 | 174 | array( |
175 | - 'name' => esc_html__( 'Default', 'give' ), |
|
176 | - 'id' => $prefix . 'default', |
|
175 | + 'name' => esc_html__('Default', 'give'), |
|
176 | + 'id' => $prefix.'default', |
|
177 | 177 | 'type' => 'give_default_radio_inline', |
178 | 178 | ), |
179 | - ) ), |
|
179 | + )), |
|
180 | 180 | ), |
181 | 181 | // Display Style |
182 | 182 | array( |
183 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
184 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
185 | - 'id' => $prefix . 'display_style', |
|
183 | + 'name' => esc_html__('Display Style', 'give'), |
|
184 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
185 | + 'id' => $prefix.'display_style', |
|
186 | 186 | 'type' => 'radio_inline', |
187 | 187 | 'default' => 'buttons', |
188 | 188 | 'options' => array( |
189 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
190 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
191 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
189 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
190 | + 'radios' => esc_html__('Radios', 'give'), |
|
191 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
192 | 192 | ), |
193 | 193 | ), |
194 | 194 | // Custom Amount |
195 | 195 | array( |
196 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
197 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
198 | - 'id' => $prefix . 'custom_amount', |
|
196 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
197 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
198 | + 'id' => $prefix.'custom_amount', |
|
199 | 199 | 'type' => 'radio_inline', |
200 | 200 | 'default' => 'disabled', |
201 | 201 | 'options' => array( |
202 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
203 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
202 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
203 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
204 | 204 | ), |
205 | 205 | ), |
206 | 206 | array( |
207 | - 'name' => esc_html__( 'Minimum Amount', 'give' ), |
|
208 | - 'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ), |
|
209 | - 'id' => $prefix . 'custom_amount_minimum', |
|
207 | + 'name' => esc_html__('Minimum Amount', 'give'), |
|
208 | + 'description' => esc_html__('Enter the minimum custom donation amount.', 'give'), |
|
209 | + 'id' => $prefix.'custom_amount_minimum', |
|
210 | 210 | 'type' => 'text_small', |
211 | 211 | 'data_type' => 'price', |
212 | 212 | 'attributes' => array( |
213 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
214 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
213 | + 'placeholder' => give_format_decimal('1.00'), |
|
214 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
215 | 215 | 'class' => 'give-money-field', |
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | array( |
219 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
220 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
221 | - 'id' => $prefix . 'custom_amount_text', |
|
219 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
220 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
221 | + 'id' => $prefix.'custom_amount_text', |
|
222 | 222 | 'type' => 'text', |
223 | 223 | 'attributes' => array( |
224 | 224 | 'rows' => 3, |
225 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
225 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
226 | 226 | ), |
227 | 227 | ), |
228 | 228 | array( |
229 | 229 | 'name' => 'donation_options_docs', |
230 | 230 | 'type' => 'docs_link', |
231 | 231 | 'url' => 'http://docs.givewp.com/donationoptions', |
232 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
232 | + 'title' => esc_html__('Donation Options', 'give'), |
|
233 | 233 | ), |
234 | 234 | ), |
235 | 235 | $post_id |
236 | 236 | ), |
237 | - ) ), |
|
237 | + )), |
|
238 | 238 | |
239 | 239 | /** |
240 | 240 | * Display Options |
241 | 241 | */ |
242 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
242 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
243 | 243 | 'id' => 'form_display_options', |
244 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
245 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
244 | + 'title' => esc_html__('Form Display', 'give'), |
|
245 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
246 | 246 | array( |
247 | - 'name' => esc_html__( 'Display Options', 'give' ), |
|
248 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
249 | - 'id' => $prefix . 'payment_display', |
|
247 | + 'name' => esc_html__('Display Options', 'give'), |
|
248 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
249 | + 'id' => $prefix.'payment_display', |
|
250 | 250 | 'type' => 'radio_inline', |
251 | 251 | 'options' => array( |
252 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
253 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
254 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
255 | - 'button' => esc_html__( 'Button', 'give' ), |
|
252 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
253 | + 'modal' => esc_html__('Modal', 'give'), |
|
254 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
255 | + 'button' => esc_html__('Button', 'give'), |
|
256 | 256 | ), |
257 | 257 | 'default' => 'onpage', |
258 | 258 | ), |
259 | 259 | array( |
260 | - 'id' => $prefix . 'reveal_label', |
|
261 | - 'name' => esc_html__( 'Continue Button', 'give' ), |
|
262 | - 'desc' => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
260 | + 'id' => $prefix.'reveal_label', |
|
261 | + 'name' => esc_html__('Continue Button', 'give'), |
|
262 | + 'desc' => esc_html__('The button label for displaying the additional payment fields.', 'give'), |
|
263 | 263 | 'type' => 'text_small', |
264 | 264 | 'attributes' => array( |
265 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
265 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
266 | 266 | ), |
267 | 267 | ), |
268 | 268 | array( |
269 | - 'id' => $prefix . 'checkout_label', |
|
270 | - 'name' => esc_html__( 'Submit Button', 'give' ), |
|
271 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
269 | + 'id' => $prefix.'checkout_label', |
|
270 | + 'name' => esc_html__('Submit Button', 'give'), |
|
271 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
272 | 272 | 'type' => 'text_small', |
273 | 273 | 'attributes' => array( |
274 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
274 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
275 | 275 | ), |
276 | 276 | ), |
277 | 277 | array( |
278 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
279 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
280 | - 'id' => $prefix . 'default_gateway', |
|
278 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
279 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
280 | + 'id' => $prefix.'default_gateway', |
|
281 | 281 | 'type' => 'default_gateway', |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'name' => esc_html__( 'Guest Donations', 'give' ), |
|
285 | - 'desc' => esc_html__( 'Do you want to enable non-logged-in users to make donations?', 'give' ), |
|
286 | - 'id' => $prefix . 'logged_in_only', |
|
284 | + 'name' => esc_html__('Guest Donations', 'give'), |
|
285 | + 'desc' => esc_html__('Do you want to enable non-logged-in users to make donations?', 'give'), |
|
286 | + 'id' => $prefix.'logged_in_only', |
|
287 | 287 | 'type' => 'radio_inline', |
288 | 288 | 'default' => 'enabled', |
289 | 289 | 'options' => array( |
290 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
291 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
290 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
291 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
292 | 292 | ), |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'name' => esc_html__( 'Registration', 'give' ), |
|
296 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
297 | - 'id' => $prefix . 'show_register_form', |
|
295 | + 'name' => esc_html__('Registration', 'give'), |
|
296 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
297 | + 'id' => $prefix.'show_register_form', |
|
298 | 298 | 'type' => 'radio', |
299 | 299 | 'options' => array( |
300 | - 'none' => esc_html__( 'None', 'give' ), |
|
301 | - 'registration' => esc_html__( 'Registration', 'give' ), |
|
302 | - 'login' => esc_html__( 'Login', 'give' ), |
|
303 | - 'both' => esc_html__( 'Registration + Login', 'give' ), |
|
300 | + 'none' => esc_html__('None', 'give'), |
|
301 | + 'registration' => esc_html__('Registration', 'give'), |
|
302 | + 'login' => esc_html__('Login', 'give'), |
|
303 | + 'both' => esc_html__('Registration + Login', 'give'), |
|
304 | 304 | ), |
305 | 305 | 'default' => 'none', |
306 | 306 | ), |
307 | 307 | array( |
308 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
308 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
309 | 309 | /* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
310 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ), |
|
311 | - 'id' => $prefix . 'form_floating_labels', |
|
310 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')), |
|
311 | + 'id' => $prefix.'form_floating_labels', |
|
312 | 312 | 'type' => 'radio_inline', |
313 | 313 | 'options' => array( |
314 | - 'global' => esc_html__( 'Global Options', 'give' ), |
|
315 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
316 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
314 | + 'global' => esc_html__('Global Options', 'give'), |
|
315 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
316 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
317 | 317 | ), |
318 | 318 | 'default' => 'global', |
319 | 319 | ), |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | 'name' => 'form_display_docs', |
322 | 322 | 'type' => 'docs_link', |
323 | 323 | 'url' => 'http://docs.givewp.com/formdisplay', |
324 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
324 | + 'title' => esc_html__('Form Display', 'give'), |
|
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | $post_id |
@@ -332,190 +332,190 @@ discard block |
||
332 | 332 | /** |
333 | 333 | * Donation Goals |
334 | 334 | */ |
335 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
335 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
336 | 336 | 'id' => 'donation_goal_options', |
337 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
337 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
339 | 339 | // Goals |
340 | 340 | array( |
341 | - 'name' => esc_html__( 'Donation Goal', 'give' ), |
|
342 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
343 | - 'id' => $prefix . 'goal_option', |
|
341 | + 'name' => esc_html__('Donation Goal', 'give'), |
|
342 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
343 | + 'id' => $prefix.'goal_option', |
|
344 | 344 | 'type' => 'radio_inline', |
345 | 345 | 'default' => 'disabled', |
346 | 346 | 'options' => array( |
347 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
348 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
347 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
348 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
349 | 349 | ), |
350 | 350 | ), |
351 | 351 | array( |
352 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
353 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
354 | - 'id' => $prefix . 'set_goal', |
|
352 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
353 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
354 | + 'id' => $prefix.'set_goal', |
|
355 | 355 | 'type' => 'text_small', |
356 | 356 | 'data_type' => 'price', |
357 | 357 | 'attributes' => array( |
358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
359 | - 'value' => give_format_decimal( $goal ), |
|
358 | + 'placeholder' => give_format_decimal('0.00'), |
|
359 | + 'value' => give_format_decimal($goal), |
|
360 | 360 | 'class' => 'give-money-field', |
361 | 361 | ), |
362 | 362 | ), |
363 | 363 | |
364 | 364 | array( |
365 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
366 | - 'description' => esc_html__( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
367 | - 'id' => $prefix . 'goal_format', |
|
365 | + 'name' => esc_html__('Goal Format', 'give'), |
|
366 | + 'description' => esc_html__('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
367 | + 'id' => $prefix.'goal_format', |
|
368 | 368 | 'type' => 'radio_inline', |
369 | 369 | 'default' => 'amount', |
370 | 370 | 'options' => array( |
371 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
372 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
371 | + 'amount' => esc_html__('Amount', 'give'), |
|
372 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
373 | 373 | ), |
374 | 374 | ), |
375 | 375 | array( |
376 | - 'name' => esc_html__( 'Progress Bar Color', 'give' ), |
|
377 | - 'desc' => esc_html__( 'Customize the color of the goal progress bar.', 'give' ), |
|
378 | - 'id' => $prefix . 'goal_color', |
|
376 | + 'name' => esc_html__('Progress Bar Color', 'give'), |
|
377 | + 'desc' => esc_html__('Customize the color of the goal progress bar.', 'give'), |
|
378 | + 'id' => $prefix.'goal_color', |
|
379 | 379 | 'type' => 'colorpicker', |
380 | 380 | 'default' => '#2bc253', |
381 | 381 | ), |
382 | 382 | |
383 | 383 | array( |
384 | - 'name' => esc_html__( 'Close Form', 'give' ), |
|
385 | - 'desc' => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
384 | + 'name' => esc_html__('Close Form', 'give'), |
|
385 | + 'desc' => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
387 | 387 | 'type' => 'radio_inline', |
388 | 388 | 'default' => 'disabled', |
389 | 389 | 'options' => array( |
390 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
391 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
390 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
391 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
392 | 392 | ), |
393 | 393 | ), |
394 | 394 | array( |
395 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
396 | - 'desc' => esc_html__( 'Do you want to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
395 | + 'name' => esc_html__('Goal Achieved Message', 'give'), |
|
396 | + 'desc' => esc_html__('Do you want to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
398 | 398 | 'type' => 'textarea', |
399 | 399 | 'attributes' => array( |
400 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
400 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
401 | 401 | ), |
402 | 402 | ), |
403 | 403 | array( |
404 | 404 | 'name' => 'donation_goal_docs', |
405 | 405 | 'type' => 'docs_link', |
406 | 406 | 'url' => 'http://docs.givewp.com/donationgoal', |
407 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
407 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
408 | 408 | ), |
409 | 409 | ), |
410 | 410 | $post_id |
411 | 411 | ), |
412 | - ) ), |
|
412 | + )), |
|
413 | 413 | |
414 | 414 | /** |
415 | 415 | * Content Field |
416 | 416 | */ |
417 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
417 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
418 | 418 | 'id' => 'form_content_options', |
419 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
420 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
419 | + 'title' => esc_html__('Form Content', 'give'), |
|
420 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
421 | 421 | |
422 | 422 | // Donation content. |
423 | 423 | array( |
424 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
425 | - 'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ), |
|
426 | - 'id' => $prefix . 'display_content', |
|
424 | + 'name' => esc_html__('Display Content', 'give'), |
|
425 | + 'description' => esc_html__('Do you want to add custom content to this form?', 'give'), |
|
426 | + 'id' => $prefix.'display_content', |
|
427 | 427 | 'type' => 'radio_inline', |
428 | 428 | 'options' => array( |
429 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
430 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
429 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
430 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
431 | 431 | ), |
432 | 432 | 'default' => 'disabled', |
433 | 433 | ), |
434 | 434 | |
435 | 435 | // Content placement. |
436 | 436 | array( |
437 | - 'name' => esc_html__( 'Content Placement', 'give' ), |
|
438 | - 'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ), |
|
439 | - 'id' => $prefix . 'content_placement', |
|
437 | + 'name' => esc_html__('Content Placement', 'give'), |
|
438 | + 'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'), |
|
439 | + 'id' => $prefix.'content_placement', |
|
440 | 440 | 'type' => 'radio_inline', |
441 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
442 | - 'give_pre_form' => esc_html__( 'Above fields', 'give' ), |
|
443 | - 'give_post_form' => esc_html__( 'Below fields', 'give' ), |
|
441 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
442 | + 'give_pre_form' => esc_html__('Above fields', 'give'), |
|
443 | + 'give_post_form' => esc_html__('Below fields', 'give'), |
|
444 | 444 | ) |
445 | 445 | ), |
446 | 446 | 'default' => 'give_pre_form', |
447 | 447 | ), |
448 | 448 | array( |
449 | - 'name' => esc_html__( 'Content', 'give' ), |
|
450 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
451 | - 'id' => $prefix . 'form_content', |
|
449 | + 'name' => esc_html__('Content', 'give'), |
|
450 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
451 | + 'id' => $prefix.'form_content', |
|
452 | 452 | 'type' => 'wysiwyg', |
453 | 453 | ), |
454 | 454 | array( |
455 | 455 | 'name' => 'form_content_docs', |
456 | 456 | 'type' => 'docs_link', |
457 | 457 | 'url' => 'http://docs.givewp.com/formcontent', |
458 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
458 | + 'title' => esc_html__('Form Content', 'give'), |
|
459 | 459 | ), |
460 | 460 | ), |
461 | 461 | $post_id |
462 | 462 | ), |
463 | - ) ), |
|
463 | + )), |
|
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Terms & Conditions |
467 | 467 | */ |
468 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
468 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
469 | 469 | 'id' => 'form_terms_options', |
470 | - 'title' => esc_html__( 'Terms & Conditions', 'give' ), |
|
471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
470 | + 'title' => esc_html__('Terms & Conditions', 'give'), |
|
471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
472 | 472 | // Donation Option |
473 | 473 | array( |
474 | - 'name' => esc_html__( 'Terms & Conditions', 'give' ), |
|
475 | - 'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
476 | - 'id' => $prefix . 'terms_option', |
|
474 | + 'name' => esc_html__('Terms & Conditions', 'give'), |
|
475 | + 'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
476 | + 'id' => $prefix.'terms_option', |
|
477 | 477 | 'type' => 'radio_inline', |
478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
479 | - 'global' => esc_html__( 'Global Options', 'give' ), |
|
480 | - 'enabled' => esc_html__( 'Customize', 'give' ), |
|
481 | - 'disabled' => esc_html__( 'Disable', 'give' ), |
|
478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
479 | + 'global' => esc_html__('Global Options', 'give'), |
|
480 | + 'enabled' => esc_html__('Customize', 'give'), |
|
481 | + 'disabled' => esc_html__('Disable', 'give'), |
|
482 | 482 | ) |
483 | 483 | ), |
484 | 484 | 'default' => 'global', |
485 | 485 | ), |
486 | 486 | array( |
487 | - 'id' => $prefix . 'agree_label', |
|
488 | - 'name' => esc_html__( 'Agreement Label', 'give' ), |
|
489 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
487 | + 'id' => $prefix.'agree_label', |
|
488 | + 'name' => esc_html__('Agreement Label', 'give'), |
|
489 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
490 | 490 | 'type' => 'text', |
491 | 491 | 'size' => 'regular', |
492 | 492 | 'attributes' => array( |
493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
494 | 494 | ), |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'id' => $prefix . 'agree_text', |
|
498 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
499 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
497 | + 'id' => $prefix.'agree_text', |
|
498 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
499 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
500 | 500 | 'type' => 'wysiwyg', |
501 | 501 | ), |
502 | 502 | array( |
503 | 503 | 'name' => 'terms_docs', |
504 | 504 | 'type' => 'docs_link', |
505 | 505 | 'url' => 'http://docs.givewp.com/form-terms', |
506 | - 'title' => esc_html__( 'Terms & Conditions', 'give' ), |
|
506 | + 'title' => esc_html__('Terms & Conditions', 'give'), |
|
507 | 507 | ), |
508 | 508 | ), |
509 | 509 | $post_id |
510 | 510 | ), |
511 | - ) ), |
|
511 | + )), |
|
512 | 512 | ); |
513 | 513 | |
514 | 514 | |
515 | 515 | /** |
516 | 516 | * Filter the metabox tabbed panel settings. |
517 | 517 | */ |
518 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
518 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
519 | 519 | |
520 | 520 | // Output. |
521 | 521 | return $settings; |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | add_meta_box( |
532 | 532 | $this->get_metabox_ID(), |
533 | 533 | $this->get_metabox_label(), |
534 | - array( $this, 'output' ), |
|
535 | - array( 'give_forms' ), |
|
534 | + array($this, 'output'), |
|
535 | + array('give_forms'), |
|
536 | 536 | 'normal', |
537 | 537 | 'high' |
538 | 538 | ); |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | function enqueue_script() { |
549 | 549 | global $post; |
550 | 550 | |
551 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
552 | - wp_enqueue_style( 'wp-color-picker' ); |
|
553 | - wp_enqueue_script( 'wp-color-picker' ); |
|
551 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
552 | + wp_enqueue_style('wp-color-picker'); |
|
553 | + wp_enqueue_script('wp-color-picker'); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | public function get_tabs() { |
585 | 585 | $tabs = array(); |
586 | 586 | |
587 | - if ( ! empty( $this->settings ) ) { |
|
588 | - foreach ( $this->settings as $setting ) { |
|
589 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
587 | + if ( ! empty($this->settings)) { |
|
588 | + foreach ($this->settings as $setting) { |
|
589 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
590 | 590 | continue; |
591 | 591 | } |
592 | 592 | $tab = array( |
@@ -594,11 +594,11 @@ discard block |
||
594 | 594 | 'label' => $setting['title'], |
595 | 595 | ); |
596 | 596 | |
597 | - if ( $this->has_sub_tab( $setting ) ) { |
|
598 | - if ( empty( $setting['sub-fields'] ) ) { |
|
597 | + if ($this->has_sub_tab($setting)) { |
|
598 | + if (empty($setting['sub-fields'])) { |
|
599 | 599 | $tab = array(); |
600 | 600 | } else { |
601 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
601 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
602 | 602 | $tab['sub-fields'][] = array( |
603 | 603 | 'id' => $sub_fields['id'], |
604 | 604 | 'label' => $sub_fields['title'], |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
610 | - if ( ! empty( $tab ) ) { |
|
610 | + if ( ! empty($tab)) { |
|
611 | 611 | $tabs[] = $tab; |
612 | 612 | } |
613 | 613 | } |
@@ -624,17 +624,17 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function output() { |
626 | 626 | // Bailout. |
627 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
628 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
627 | + if ($form_data_tabs = $this->get_tabs()) { |
|
628 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
629 | 629 | ?> |
630 | 630 | <div class="give-metabox-panel-wrap"> |
631 | 631 | <ul class="give-form-data-tabs give-metabox-tabs"> |
632 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
633 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
632 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
633 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
634 | 634 | <a href="#<?php echo $form_data_tab['id']; ?>"><?php echo $form_data_tab['label']; ?></a> |
635 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
635 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
636 | 636 | <ul class="give-metabox-sub-tabs give-hidden"> |
637 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
637 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
638 | 638 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
639 | 639 | <a href="#<?php echo $sub_tab['id']; ?>"><?php echo $sub_tab['label']; ?></a> |
640 | 640 | </li> |
@@ -646,28 +646,28 @@ discard block |
||
646 | 646 | </ul> |
647 | 647 | |
648 | 648 | <?php $show_first_tab_content = true; ?> |
649 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
650 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
651 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
649 | + <?php foreach ($this->settings as $setting) : ?> |
|
650 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
651 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
652 | 652 | |
653 | - <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
653 | + <div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
654 | 654 | $show_first_tab_content = false; ?>"> |
655 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
656 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
657 | - <?php give_render_field( $field ); ?> |
|
655 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
656 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
657 | + <?php give_render_field($field); ?> |
|
658 | 658 | <?php endforeach; ?> |
659 | 659 | <?php endif; ?> |
660 | 660 | </div> |
661 | 661 | |
662 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
662 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
663 | 663 | <?php else: ?> |
664 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
665 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
666 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
664 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
665 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
666 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
667 | 667 | <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
668 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
669 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
670 | - <?php give_render_field( $sub_field ); ?> |
|
668 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
669 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
670 | + <?php give_render_field($sub_field); ?> |
|
671 | 671 | <?php endforeach; ?> |
672 | 672 | <?php endif; ?> |
673 | 673 | </div> |
@@ -691,9 +691,9 @@ discard block |
||
691 | 691 | * |
692 | 692 | * @return bool |
693 | 693 | */ |
694 | - private function has_sub_tab( $field_setting ) { |
|
694 | + private function has_sub_tab($field_setting) { |
|
695 | 695 | $has_sub_tab = false; |
696 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
696 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
697 | 697 | $has_sub_tab = true; |
698 | 698 | } |
699 | 699 | |
@@ -707,13 +707,13 @@ discard block |
||
707 | 707 | * @return array |
708 | 708 | */ |
709 | 709 | function cmb2_metabox_settings() { |
710 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
710 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
711 | 711 | $give_forms_settings = $all_cmb2_settings; |
712 | 712 | |
713 | 713 | // Filter settings: Use only give forms related settings. |
714 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
715 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
716 | - unset( $give_forms_settings[ $index ] ); |
|
714 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
715 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
716 | + unset($give_forms_settings[$index]); |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
@@ -731,104 +731,104 @@ discard block |
||
731 | 731 | * |
732 | 732 | * @return void |
733 | 733 | */ |
734 | - public function save( $post_id, $post ) { |
|
734 | + public function save($post_id, $post) { |
|
735 | 735 | |
736 | 736 | // $post_id and $post are required. |
737 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
737 | + if (empty($post_id) || empty($post)) { |
|
738 | 738 | return; |
739 | 739 | } |
740 | 740 | |
741 | 741 | // Don't save meta boxes for revisions or autosaves. |
742 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
742 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
743 | 743 | return; |
744 | 744 | } |
745 | 745 | |
746 | 746 | // Check the nonce. |
747 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
747 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
748 | 748 | return; |
749 | 749 | } |
750 | 750 | |
751 | 751 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
752 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
752 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
753 | 753 | return; |
754 | 754 | } |
755 | 755 | |
756 | 756 | // Check user has permission to edit. |
757 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
757 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
758 | 758 | return; |
759 | 759 | } |
760 | 760 | |
761 | 761 | // Fire action before saving form meta. |
762 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
762 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
763 | 763 | |
764 | 764 | /** |
765 | 765 | * Filter the meta key to save. |
766 | 766 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
767 | 767 | */ |
768 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
768 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
769 | 769 | |
770 | 770 | // Save form meta data. |
771 | - if ( ! empty( $form_meta_keys ) ) { |
|
772 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
773 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
774 | - if ( $field_type = $this->get_field_type( $form_meta_key ) ) { |
|
775 | - switch ( $field_type ) { |
|
771 | + if ( ! empty($form_meta_keys)) { |
|
772 | + foreach ($form_meta_keys as $form_meta_key) { |
|
773 | + if (isset($_POST[$form_meta_key])) { |
|
774 | + if ($field_type = $this->get_field_type($form_meta_key)) { |
|
775 | + switch ($field_type) { |
|
776 | 776 | case 'wysiwyg': |
777 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
778 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
777 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
778 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
779 | 779 | break; |
780 | 780 | |
781 | 781 | case 'group': |
782 | 782 | $form_meta_value = array(); |
783 | 783 | |
784 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
784 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
785 | 785 | |
786 | 786 | // Do not save template input field values. |
787 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
787 | + if ('{{row-count-placeholder}}' === $index) { |
|
788 | 788 | continue; |
789 | 789 | } |
790 | 790 | |
791 | 791 | $group_meta_value = array(); |
792 | - foreach ( $group as $field_id => $field_value ) { |
|
793 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
792 | + foreach ($group as $field_id => $field_value) { |
|
793 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
794 | 794 | case 'wysiwyg': |
795 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
795 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
796 | 796 | break; |
797 | 797 | |
798 | 798 | default: |
799 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
799 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
800 | 800 | } |
801 | 801 | } |
802 | 802 | |
803 | - if ( ! empty( $group_meta_value ) ) { |
|
804 | - $form_meta_value[ $index ] = $group_meta_value; |
|
803 | + if ( ! empty($group_meta_value)) { |
|
804 | + $form_meta_value[$index] = $group_meta_value; |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | |
808 | 808 | |
809 | 809 | // Arrange repeater field keys in order. |
810 | - $form_meta_value = array_values( $form_meta_value ); |
|
810 | + $form_meta_value = array_values($form_meta_value); |
|
811 | 811 | |
812 | 812 | // Save data. |
813 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
813 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
814 | 814 | break; |
815 | 815 | |
816 | 816 | default: |
817 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
817 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
818 | 818 | |
819 | 819 | // Save data. |
820 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
820 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | // Fire after saving form meta key. |
824 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
824 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | } |
828 | 828 | } |
829 | 829 | |
830 | 830 | // Fire action after saving form meta. |
831 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
831 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -840,10 +840,10 @@ discard block |
||
840 | 840 | * |
841 | 841 | * @return string |
842 | 842 | */ |
843 | - private function get_field_id( $field ) { |
|
843 | + private function get_field_id($field) { |
|
844 | 844 | $field_id = ''; |
845 | 845 | |
846 | - if ( array_key_exists( 'id', $field ) ) { |
|
846 | + if (array_key_exists('id', $field)) { |
|
847 | 847 | $field_id = $field['id']; |
848 | 848 | |
849 | 849 | } |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | * |
860 | 860 | * @return array |
861 | 861 | */ |
862 | - private function get_fields_id( $setting ) { |
|
862 | + private function get_fields_id($setting) { |
|
863 | 863 | $meta_keys = array(); |
864 | 864 | |
865 | - if( ! empty( $setting ) ) { |
|
866 | - foreach ( $setting['fields'] as $field ) { |
|
867 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
865 | + if ( ! empty($setting)) { |
|
866 | + foreach ($setting['fields'] as $field) { |
|
867 | + if ($field_id = $this->get_field_id($field)) { |
|
868 | 868 | $meta_keys[] = $field_id; |
869 | 869 | } |
870 | 870 | } |
@@ -881,14 +881,14 @@ discard block |
||
881 | 881 | * |
882 | 882 | * @return array |
883 | 883 | */ |
884 | - private function get_sub_fields_id( $setting ) { |
|
884 | + private function get_sub_fields_id($setting) { |
|
885 | 885 | $meta_keys = array(); |
886 | 886 | |
887 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
888 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
889 | - if ( ! empty( $fields['fields'] ) ) { |
|
890 | - foreach ( $fields['fields'] as $field ) { |
|
891 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
887 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
888 | + foreach ($setting['sub-fields'] as $fields) { |
|
889 | + if ( ! empty($fields['fields'])) { |
|
890 | + foreach ($fields['fields'] as $field) { |
|
891 | + if ($field_id = $this->get_field_id($field)) { |
|
892 | 892 | $meta_keys[] = $field_id; |
893 | 893 | } |
894 | 894 | } |
@@ -909,14 +909,14 @@ discard block |
||
909 | 909 | private function get_meta_keys_from_settings() { |
910 | 910 | $meta_keys = array(); |
911 | 911 | |
912 | - foreach ( $this->settings as $setting ) { |
|
913 | - if ( $this->has_sub_tab( $setting ) ) { |
|
914 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
912 | + foreach ($this->settings as $setting) { |
|
913 | + if ($this->has_sub_tab($setting)) { |
|
914 | + $meta_key = $this->get_sub_fields_id($setting); |
|
915 | 915 | } else { |
916 | - $meta_key = $this->get_fields_id( $setting ); |
|
916 | + $meta_key = $this->get_fields_id($setting); |
|
917 | 917 | } |
918 | 918 | |
919 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
919 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | return $meta_keys; |
@@ -933,10 +933,10 @@ discard block |
||
933 | 933 | * |
934 | 934 | * @return string |
935 | 935 | */ |
936 | - function get_field_type( $field_id, $group_id = '' ) { |
|
937 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
936 | + function get_field_type($field_id, $group_id = '') { |
|
937 | + $field = $this->get_setting_field($field_id, $group_id); |
|
938 | 938 | |
939 | - $type = array_key_exists( 'type', $field ) |
|
939 | + $type = array_key_exists('type', $field) |
|
940 | 940 | ? $field['type'] |
941 | 941 | : ''; |
942 | 942 | |
@@ -954,12 +954,12 @@ discard block |
||
954 | 954 | * |
955 | 955 | * @return array |
956 | 956 | */ |
957 | - private function get_field( $setting, $field_id ) { |
|
957 | + private function get_field($setting, $field_id) { |
|
958 | 958 | $setting_field = array(); |
959 | 959 | |
960 | - if ( ! empty( $setting['fields'] ) ) { |
|
961 | - foreach ( $setting['fields'] as $field ) { |
|
962 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
960 | + if ( ! empty($setting['fields'])) { |
|
961 | + foreach ($setting['fields'] as $field) { |
|
962 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
963 | 963 | $setting_field = $field; |
964 | 964 | break; |
965 | 965 | } |
@@ -979,12 +979,12 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @return array |
981 | 981 | */ |
982 | - private function get_sub_field( $setting, $field_id ) { |
|
982 | + private function get_sub_field($setting, $field_id) { |
|
983 | 983 | $setting_field = array(); |
984 | 984 | |
985 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
986 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
987 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
985 | + if ( ! empty($setting['sub-fields'])) { |
|
986 | + foreach ($setting['sub-fields'] as $fields) { |
|
987 | + if ($field = $this->get_field($fields, $field_id)) { |
|
988 | 988 | $setting_field = $field; |
989 | 989 | break; |
990 | 990 | } |
@@ -1004,18 +1004,18 @@ discard block |
||
1004 | 1004 | * |
1005 | 1005 | * @return array |
1006 | 1006 | */ |
1007 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1007 | + function get_setting_field($field_id, $group_id = '') { |
|
1008 | 1008 | $setting_field = array(); |
1009 | 1009 | |
1010 | 1010 | $_field_id = $field_id; |
1011 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1011 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1012 | 1012 | |
1013 | - if ( ! empty( $this->settings ) ) { |
|
1014 | - foreach ( $this->settings as $setting ) { |
|
1015 | - if( $this->has_sub_tab( $setting ) ) { |
|
1016 | - $setting_field = $this->get_sub_field( $setting, $field_id ); |
|
1013 | + if ( ! empty($this->settings)) { |
|
1014 | + foreach ($this->settings as $setting) { |
|
1015 | + if ($this->has_sub_tab($setting)) { |
|
1016 | + $setting_field = $this->get_sub_field($setting, $field_id); |
|
1017 | 1017 | break; |
1018 | - } elseif ( $field = $this->get_field( $setting, $field_id ) ) { |
|
1018 | + } elseif ($field = $this->get_field($setting, $field_id)) { |
|
1019 | 1019 | $setting_field = $field; |
1020 | 1020 | break; |
1021 | 1021 | } |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | |
1026 | 1026 | // Get field from group. |
1027 | - if ( ! empty( $group_id ) ) { |
|
1028 | - foreach ( $setting_field['fields'] as $field ) { |
|
1029 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1027 | + if ( ! empty($group_id)) { |
|
1028 | + foreach ($setting_field['fields'] as $field) { |
|
1029 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1030 | 1030 | $setting_field = $field; |
1031 | 1031 | } |
1032 | 1032 | } |
@@ -1045,13 +1045,13 @@ discard block |
||
1045 | 1045 | * |
1046 | 1046 | * @return mixed |
1047 | 1047 | */ |
1048 | - function add_offline_donations_setting_tab( $settings ) { |
|
1049 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1050 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1048 | + function add_offline_donations_setting_tab($settings) { |
|
1049 | + if (give_is_gateway_active('offline')) { |
|
1050 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1051 | 1051 | 'id' => 'offline_donations_options', |
1052 | - 'title' => esc_html__( 'Offline Donations', 'give' ), |
|
1053 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1054 | - ) ); |
|
1052 | + 'title' => esc_html__('Offline Donations', 'give'), |
|
1053 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1054 | + )); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | return $settings; |
@@ -660,11 +660,14 @@ |
||
660 | 660 | </div> |
661 | 661 | |
662 | 662 | <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
663 | - <?php else: ?> |
|
663 | + <?php else { |
|
664 | + : ?> |
|
664 | 665 | <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
665 | 666 | <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
666 | 667 | <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
667 | - <div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden"> |
|
668 | + <div id="<?php echo $sub_fields['id']; |
|
669 | +} |
|
670 | +?>" class="panel give_options_panel give-hidden"> |
|
668 | 671 | <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
669 | 672 | <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
670 | 673 | <?php give_render_field( $sub_field ); ?> |
@@ -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 | |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_add_shortcode_to_publish_metabox() { |
24 | 24 | |
25 | - if ( 'give_forms' !== get_post_type() ) { |
|
25 | + if ('give_forms' !== get_post_type()) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | global $post; |
29 | 29 | |
30 | 30 | //Only enqueue scripts for CPT on post type screen |
31 | - if ( 'give_forms' === $post->post_type ) { |
|
31 | + if ('give_forms' === $post->post_type) { |
|
32 | 32 | //Shortcode column with select all input |
33 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
34 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
33 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
34 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
39 | 39 | |
40 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
40 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | // Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => esc_html__( 'Name', 'give' ), |
|
36 | - 'form_category' => esc_html__( 'Categories', 'give' ), |
|
37 | - 'form_tag' => esc_html__( 'Tags', 'give' ), |
|
38 | - 'price' => esc_html__( 'Amount', 'give' ), |
|
39 | - 'goal' => esc_html__( 'Goal', 'give' ), |
|
40 | - 'donations' => esc_html__( 'Donations', 'give' ), |
|
41 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
42 | - 'shortcode' => esc_html__( 'Shortcode', 'give' ), |
|
43 | - 'date' => esc_html__( 'Date', 'give' ), |
|
35 | + 'title' => esc_html__('Name', 'give'), |
|
36 | + 'form_category' => esc_html__('Categories', 'give'), |
|
37 | + 'form_tag' => esc_html__('Tags', 'give'), |
|
38 | + 'price' => esc_html__('Amount', 'give'), |
|
39 | + 'goal' => esc_html__('Goal', 'give'), |
|
40 | + 'donations' => esc_html__('Donations', 'give'), |
|
41 | + 'earnings' => esc_html__('Income', 'give'), |
|
42 | + 'shortcode' => esc_html__('Shortcode', 'give'), |
|
43 | + 'date' => esc_html__('Date', 'give'), |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | // Does the user want categories / tags? |
47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,59 +66,59 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | |
72 | - switch ( $column_name ) { |
|
72 | + switch ($column_name) { |
|
73 | 73 | case 'form_category': |
74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
75 | 75 | break; |
76 | 76 | case 'form_tag': |
77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
78 | 78 | break; |
79 | 79 | case 'price': |
80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
81 | - echo give_price_range( $post_id ); |
|
80 | + if (give_has_variable_prices($post_id)) { |
|
81 | + echo give_price_range($post_id); |
|
82 | 82 | } else { |
83 | - echo give_price( $post_id, false ); |
|
84 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
83 | + echo give_price($post_id, false); |
|
84 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
85 | 85 | } |
86 | 86 | break; |
87 | 87 | case 'goal': |
88 | - if ( give_is_setting_enabled( get_post_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
89 | - echo give_goal( $post_id, false ); |
|
88 | + if (give_is_setting_enabled(get_post_meta($post_id, '_give_goal_option', true))) { |
|
89 | + echo give_goal($post_id, false); |
|
90 | 90 | } else { |
91 | - esc_html_e( 'No Goal Set', 'give' ); |
|
91 | + esc_html_e('No Goal Set', 'give'); |
|
92 | 92 | } |
93 | 93 | |
94 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
94 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
95 | 95 | break; |
96 | 96 | case 'donations': |
97 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
98 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">'; |
|
99 | - echo give_get_form_sales_stats( $post_id ); |
|
97 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
98 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">'; |
|
99 | + echo give_get_form_sales_stats($post_id); |
|
100 | 100 | echo '</a>'; |
101 | 101 | } else { |
102 | 102 | echo '-'; |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | case 'earnings': |
106 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
107 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">'; |
|
108 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
106 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
107 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">'; |
|
108 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
109 | 109 | echo '</a>'; |
110 | 110 | } else { |
111 | 111 | echo '-'; |
112 | 112 | } |
113 | 113 | break; |
114 | 114 | case 'shortcode': |
115 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
115 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
121 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Registers the sortable columns in the list table |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return array $columns Array of sortable columns |
131 | 131 | */ |
132 | -function give_sortable_form_columns( $columns ) { |
|
132 | +function give_sortable_form_columns($columns) { |
|
133 | 133 | $columns['price'] = 'amount'; |
134 | 134 | $columns['sales'] = 'sales'; |
135 | 135 | $columns['earnings'] = 'earnings'; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return $columns; |
140 | 140 | } |
141 | 141 | |
142 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
142 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Sorts Columns in the Forms List Table |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return array $vars Array of all the sort variables |
152 | 152 | */ |
153 | -function give_sort_forms( $vars ) { |
|
153 | +function give_sort_forms($vars) { |
|
154 | 154 | // Check if we're viewing the "give_forms" post type |
155 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
155 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
156 | 156 | return $vars; |
157 | 157 | } |
158 | 158 | |
159 | - switch ( $vars['orderby'] ) { |
|
159 | + switch ($vars['orderby']) { |
|
160 | 160 | // Check if 'orderby' is set to "sales" |
161 | 161 | case 'sales': |
162 | 162 | $vars = array_merge( |
@@ -225,16 +225,16 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @return array Array of all sort variables |
227 | 227 | */ |
228 | -function give_filter_forms( $vars ) { |
|
229 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
228 | +function give_filter_forms($vars) { |
|
229 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
230 | 230 | |
231 | 231 | // If an author ID was passed, use it |
232 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
232 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
233 | 233 | |
234 | 234 | $author_id = $_REQUEST['author']; |
235 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
235 | + if ((int) $author_id !== get_current_user_id()) { |
|
236 | 236 | // Tried to view the products of another person, sorry |
237 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
237 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
238 | 238 | } |
239 | 239 | $vars = array_merge( |
240 | 240 | $vars, |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | * @return void |
259 | 259 | */ |
260 | 260 | function give_forms_load() { |
261 | - add_filter( 'request', 'give_sort_forms' ); |
|
262 | - add_filter( 'request', 'give_filter_forms' ); |
|
261 | + add_filter('request', 'give_sort_forms'); |
|
262 | + add_filter('request', 'give_filter_forms'); |
|
263 | 263 | } |
264 | 264 | |
265 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
265 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Remove Forms Month Filter |
@@ -276,17 +276,17 @@ discard block |
||
276 | 276 | * @global $typenow The post type we are viewing |
277 | 277 | * @return array Empty array disables the dropdown |
278 | 278 | */ |
279 | -function give_remove_month_filter( $dates ) { |
|
279 | +function give_remove_month_filter($dates) { |
|
280 | 280 | global $typenow; |
281 | 281 | |
282 | - if ( $typenow == 'give_forms' ) { |
|
282 | + if ($typenow == 'give_forms') { |
|
283 | 283 | $dates = array(); |
284 | 284 | } |
285 | 285 | |
286 | 286 | return $dates; |
287 | 287 | } |
288 | 288 | |
289 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
289 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Updates price when saving post |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return int|null |
299 | 299 | */ |
300 | -function give_price_save_quick_edit( $post_id ) { |
|
301 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
300 | +function give_price_save_quick_edit($post_id) { |
|
301 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
302 | 302 | return; |
303 | 303 | } |
304 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
304 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
305 | 305 | return $post_id; |
306 | 306 | } |
307 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
307 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
308 | 308 | return $post_id; |
309 | 309 | } |
310 | 310 | |
311 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
312 | - update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
311 | + if (isset($_REQUEST['_give_regprice'])) { |
|
312 | + update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
316 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
316 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Process bulk edit actions via AJAX |
@@ -323,18 +323,18 @@ discard block |
||
323 | 323 | */ |
324 | 324 | function give_save_bulk_edit() { |
325 | 325 | |
326 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
326 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
327 | 327 | |
328 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
329 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
330 | - foreach ( $post_ids as $post_id ) { |
|
328 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
329 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
330 | + foreach ($post_ids as $post_id) { |
|
331 | 331 | |
332 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
332 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
333 | 333 | continue; |
334 | 334 | } |
335 | 335 | |
336 | - if ( ! empty( $price ) ) { |
|
337 | - update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
336 | + if ( ! empty($price)) { |
|
337 | + update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
@@ -342,4 +342,4 @@ discard block |
||
342 | 342 | die(); |
343 | 343 | } |
344 | 344 | |
345 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
345 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -33,37 +33,37 @@ discard block |
||
33 | 33 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
34 | 34 | |
35 | 35 | //Payments |
36 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
37 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
36 | + $give_payment = get_post_type_object('give_payment'); |
|
37 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
38 | 38 | |
39 | 39 | //Donors |
40 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
40 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
41 | 41 | |
42 | 42 | //Reports` |
43 | - $give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donation Reports', 'give' ), esc_html__( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' ); |
|
43 | + $give_reports_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donation Reports', 'give'), esc_html__('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page'); |
|
44 | 44 | |
45 | 45 | //Settings |
46 | - $give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Settings', 'give' ), esc_html__( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array( |
|
46 | + $give_settings_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Settings', 'give'), esc_html__('Settings', 'give'), 'manage_give_settings', 'give-settings', array( |
|
47 | 47 | Give()->give_settings, |
48 | 48 | 'output' |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | 51 | //Tools. |
52 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
52 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
53 | 53 | Give()->give_settings, |
54 | 54 | 'output' |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Add-ons |
58 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
58 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
59 | 59 | |
60 | 60 | //Upgrades |
61 | - $give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
61 | + $give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
62 | 62 | |
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
66 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Determines whether the current admin page is a Give admin page. |
@@ -78,224 +78,224 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return bool True if Give admin page. |
80 | 80 | */ |
81 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
81 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
82 | 82 | |
83 | 83 | global $pagenow, $typenow; |
84 | 84 | |
85 | 85 | $found = false; |
86 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
87 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
88 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
89 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
90 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
91 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
92 | - |
|
93 | - switch ( $passed_page ) { |
|
86 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
87 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
88 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
89 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
90 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
91 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
92 | + |
|
93 | + switch ($passed_page) { |
|
94 | 94 | case 'give_forms': |
95 | - switch ( $passed_view ) { |
|
95 | + switch ($passed_view) { |
|
96 | 96 | case 'list-table': |
97 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
97 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
98 | 98 | $found = true; |
99 | 99 | } |
100 | 100 | break; |
101 | 101 | case 'edit': |
102 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
102 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
103 | 103 | $found = true; |
104 | 104 | } |
105 | 105 | break; |
106 | 106 | case 'new': |
107 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
107 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
108 | 108 | $found = true; |
109 | 109 | } |
110 | 110 | break; |
111 | 111 | default: |
112 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
112 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
113 | 113 | $found = true; |
114 | 114 | } |
115 | 115 | break; |
116 | 116 | } |
117 | 117 | break; |
118 | 118 | case 'categories': |
119 | - switch ( $passed_view ) { |
|
119 | + switch ($passed_view) { |
|
120 | 120 | case 'list-table': |
121 | 121 | case 'new': |
122 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
122 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
123 | 123 | $found = true; |
124 | 124 | } |
125 | 125 | break; |
126 | 126 | case 'edit': |
127 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
127 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
128 | 128 | $found = true; |
129 | 129 | } |
130 | 130 | break; |
131 | 131 | default: |
132 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
132 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
133 | 133 | $found = true; |
134 | 134 | } |
135 | 135 | break; |
136 | 136 | } |
137 | 137 | break; |
138 | 138 | case 'tags': |
139 | - switch ( $passed_view ) { |
|
139 | + switch ($passed_view) { |
|
140 | 140 | case 'list-table': |
141 | 141 | case 'new': |
142 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
142 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
143 | 143 | $found = true; |
144 | 144 | } |
145 | 145 | break; |
146 | 146 | case 'edit': |
147 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
147 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
148 | 148 | $found = true; |
149 | 149 | } |
150 | 150 | break; |
151 | 151 | default: |
152 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
152 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
153 | 153 | $found = true; |
154 | 154 | } |
155 | 155 | break; |
156 | 156 | } |
157 | 157 | break; |
158 | 158 | case 'payments': |
159 | - switch ( $passed_view ) { |
|
159 | + switch ($passed_view) { |
|
160 | 160 | case 'list-table': |
161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
162 | 162 | $found = true; |
163 | 163 | } |
164 | 164 | break; |
165 | 165 | case 'edit': |
166 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
166 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
167 | 167 | $found = true; |
168 | 168 | } |
169 | 169 | break; |
170 | 170 | default: |
171 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
171 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
172 | 172 | $found = true; |
173 | 173 | } |
174 | 174 | break; |
175 | 175 | } |
176 | 176 | break; |
177 | 177 | case 'reports': |
178 | - switch ( $passed_view ) { |
|
178 | + switch ($passed_view) { |
|
179 | 179 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
180 | 180 | case 'earnings': |
181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
182 | 182 | $found = true; |
183 | 183 | } |
184 | 184 | break; |
185 | 185 | case 'donors': |
186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
187 | 187 | $found = true; |
188 | 188 | } |
189 | 189 | break; |
190 | 190 | case 'gateways': |
191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
192 | 192 | $found = true; |
193 | 193 | } |
194 | 194 | break; |
195 | 195 | case 'export': |
196 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
196 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
197 | 197 | $found = true; |
198 | 198 | } |
199 | 199 | break; |
200 | 200 | case 'logs': |
201 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
201 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
202 | 202 | $found = true; |
203 | 203 | } |
204 | 204 | break; |
205 | 205 | default: |
206 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
206 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
207 | 207 | $found = true; |
208 | 208 | } |
209 | 209 | break; |
210 | 210 | } |
211 | 211 | break; |
212 | 212 | case 'settings': |
213 | - switch ( $passed_view ) { |
|
213 | + switch ($passed_view) { |
|
214 | 214 | case 'general': |
215 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
215 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
216 | 216 | $found = true; |
217 | 217 | } |
218 | 218 | break; |
219 | 219 | case 'gateways': |
220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
221 | 221 | $found = true; |
222 | 222 | } |
223 | 223 | break; |
224 | 224 | case 'emails': |
225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
226 | 226 | $found = true; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'display': |
230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
231 | 231 | $found = true; |
232 | 232 | } |
233 | 233 | break; |
234 | 234 | case 'licenses': |
235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
236 | 236 | $found = true; |
237 | 237 | } |
238 | 238 | break; |
239 | 239 | case 'api': |
240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
241 | 241 | $found = true; |
242 | 242 | } |
243 | 243 | break; |
244 | 244 | case 'advanced': |
245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
246 | 246 | $found = true; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | case 'system_info': |
250 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
250 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
251 | 251 | $found = true; |
252 | 252 | } |
253 | 253 | break; |
254 | 254 | default: |
255 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
255 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
256 | 256 | $found = true; |
257 | 257 | } |
258 | 258 | break; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'addons': |
262 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
262 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
263 | 263 | $found = true; |
264 | 264 | } |
265 | 265 | break; |
266 | 266 | case 'donors': |
267 | - switch ( $passed_view ) { |
|
267 | + switch ($passed_view) { |
|
268 | 268 | case 'list-table': |
269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
270 | 270 | $found = true; |
271 | 271 | } |
272 | 272 | break; |
273 | 273 | case 'overview': |
274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
275 | 275 | $found = true; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | case 'notes': |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | default: |
284 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
284 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
285 | 285 | $found = true; |
286 | 286 | } |
287 | 287 | break; |
288 | 288 | } |
289 | 289 | break; |
290 | 290 | case 'reports': |
291 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
291 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
292 | 292 | $found = true; |
293 | 293 | } |
294 | 294 | break; |
295 | 295 | default: |
296 | 296 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page, $give_tools_page; |
297 | 297 | |
298 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
298 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
299 | 299 | $give_payments_page, |
300 | 300 | $give_settings_page, |
301 | 301 | $give_reports_page, |
@@ -306,19 +306,19 @@ discard block |
||
306 | 306 | $give_customers_page, |
307 | 307 | $give_tools_page, |
308 | 308 | 'widgets.php' |
309 | - ) ); |
|
310 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
309 | + )); |
|
310 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
311 | 311 | $found = true; |
312 | - if ( 'give-upgrades' === $page ) { |
|
312 | + if ('give-upgrades' === $page) { |
|
313 | 313 | $found = false; |
314 | 314 | } |
315 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
315 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
316 | 316 | $found = true; |
317 | 317 | } |
318 | 318 | break; |
319 | 319 | } |
320 | 320 | |
321 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
321 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -330,37 +330,37 @@ discard block |
||
330 | 330 | * @param array $settings |
331 | 331 | * @return array |
332 | 332 | */ |
333 | -function give_settings_page_pages( $settings ) { |
|
334 | - include( 'abstract-admin-settings-page.php' ); |
|
335 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
333 | +function give_settings_page_pages($settings) { |
|
334 | + include('abstract-admin-settings-page.php'); |
|
335 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
336 | 336 | |
337 | 337 | $settings = array( |
338 | 338 | // General settings. |
339 | - include( 'settings/class-settings-general.php' ), |
|
339 | + include('settings/class-settings-general.php'), |
|
340 | 340 | |
341 | 341 | // Payment Gateways Settings. |
342 | - include( 'settings/class-settings-gateways.php' ), |
|
342 | + include('settings/class-settings-gateways.php'), |
|
343 | 343 | |
344 | 344 | // Display settings. |
345 | - include( 'settings/class-settings-display.php' ), |
|
345 | + include('settings/class-settings-display.php'), |
|
346 | 346 | |
347 | 347 | // Emails settings. |
348 | - include( 'settings/class-settings-email.php' ), |
|
348 | + include('settings/class-settings-email.php'), |
|
349 | 349 | |
350 | 350 | // Addons settings. |
351 | - include( 'settings/class-settings-addon.php' ), |
|
351 | + include('settings/class-settings-addon.php'), |
|
352 | 352 | |
353 | 353 | // License settings. |
354 | - include( 'settings/class-settings-license.php' ), |
|
354 | + include('settings/class-settings-license.php'), |
|
355 | 355 | |
356 | 356 | // Advanced settinns. |
357 | - include( 'settings/class-settings-advanced.php' ) |
|
357 | + include('settings/class-settings-advanced.php') |
|
358 | 358 | ); |
359 | 359 | |
360 | 360 | // Output. |
361 | 361 | return $settings; |
362 | 362 | } |
363 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
363 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
364 | 364 | |
365 | 365 | |
366 | 366 | /** |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | * @param array $settings |
371 | 371 | * @return array |
372 | 372 | */ |
373 | -function give_tools_page_pages( $settings ) { |
|
374 | - include( 'abstract-admin-settings-page.php' ); |
|
373 | +function give_tools_page_pages($settings) { |
|
374 | + include('abstract-admin-settings-page.php'); |
|
375 | 375 | |
376 | 376 | $settings = array( |
377 | 377 | // System Info. |
378 | - include( 'tools/class-settings-system-info.php' ), |
|
378 | + include('tools/class-settings-system-info.php'), |
|
379 | 379 | |
380 | 380 | // Logs. |
381 | - include( 'tools/class-settings-logs.php' ), |
|
381 | + include('tools/class-settings-logs.php'), |
|
382 | 382 | |
383 | 383 | // API. |
384 | - include( 'tools/class-settings-api.php' ), |
|
384 | + include('tools/class-settings-api.php'), |
|
385 | 385 | |
386 | 386 | // Data. |
387 | - include( 'tools/class-settings-data.php' ), |
|
387 | + include('tools/class-settings-data.php'), |
|
388 | 388 | ); |
389 | 389 | |
390 | 390 | // Output. |
391 | 391 | return $settings; |
392 | 392 | } |
393 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
393 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
394 | 394 | |
395 | 395 | /** |
396 | 396 | * Set default tools page tab. |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param string $default_tab Default tab name. |
400 | 400 | * @return string |
401 | 401 | */ |
402 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
402 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
403 | 403 | return 'system-info'; |
404 | 404 | } |
405 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
406 | 405 | \ No newline at end of file |
406 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
407 | 407 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults. |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
124 | - 'ajax' => false, // Does this table support ajax? |
|
125 | - ) ); |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
124 | + 'ajax' => false, // Does this table support ajax? |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | public function advanced_filters() { |
138 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
139 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
140 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
138 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
139 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
140 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
141 | 141 | ?> |
142 | 142 | <div id="give-payment-filters"> |
143 | 143 | <span id="give-payment-date-filters"> |
144 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
144 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
145 | 145 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
146 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
146 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
147 | 147 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
148 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
148 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
149 | 149 | </span> |
150 | - <?php if ( ! empty( $status ) ) : ?> |
|
151 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
150 | + <?php if ( ! empty($status)) : ?> |
|
151 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
152 | 152 | <?php endif; ?> |
153 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
154 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
153 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
154 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
155 | 155 | <?php endif; ?> |
156 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
156 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
157 | 157 | </div> |
158 | 158 | |
159 | 159 | <?php |
@@ -170,18 +170,18 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - public function search_box( $text, $input_id ) { |
|
174 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
173 | + public function search_box($text, $input_id) { |
|
174 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
175 | 175 | return; |
176 | 176 | } |
177 | 177 | |
178 | - $input_id = $input_id . '-search-input'; |
|
178 | + $input_id = $input_id.'-search-input'; |
|
179 | 179 | |
180 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
181 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
180 | + if ( ! empty($_REQUEST['orderby'])) { |
|
181 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
182 | 182 | } |
183 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
184 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
183 | + if ( ! empty($_REQUEST['order'])) { |
|
184 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | <p class="search-box" role="search"> |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @since 1.7 |
195 | 195 | */ |
196 | - do_action( 'give_payment_history_search' ); |
|
196 | + do_action('give_payment_history_search'); |
|
197 | 197 | ?> |
198 | 198 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
199 | 199 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
200 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
200 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
201 | 201 | </p> |
202 | 202 | <?php |
203 | 203 | } |
@@ -211,52 +211,52 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function get_views() { |
213 | 213 | |
214 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
215 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
216 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
217 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
218 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
219 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
220 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
221 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
222 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
214 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
215 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
216 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
217 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
218 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
219 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
220 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
221 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
222 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
223 | 223 | |
224 | 224 | $views = array( |
225 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
225 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
226 | 226 | 'status', |
227 | 227 | 'paged', |
228 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
229 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
228 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
229 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
230 | 230 | 'status' => 'publish', |
231 | 231 | 'paged' => false, |
232 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
233 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
232 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
233 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
234 | 234 | 'status' => 'pending', |
235 | 235 | 'paged' => false, |
236 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
237 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
236 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
237 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
238 | 238 | 'status' => 'refunded', |
239 | 239 | 'paged' => false, |
240 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
241 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
240 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
241 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
242 | 242 | 'status' => 'revoked', |
243 | 243 | 'paged' => false, |
244 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
245 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
244 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
245 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
246 | 246 | 'status' => 'failed', |
247 | 247 | 'paged' => false, |
248 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
249 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
248 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
249 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
250 | 250 | 'status' => 'cancelled', |
251 | 251 | 'paged' => false, |
252 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
253 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
252 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
253 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
254 | 254 | 'status' => 'abandoned', |
255 | 255 | 'paged' => false, |
256 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
256 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
257 | 257 | ); |
258 | 258 | |
259 | - return apply_filters( 'give_payments_table_views', $views ); |
|
259 | + return apply_filters('give_payments_table_views', $views); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -269,15 +269,15 @@ discard block |
||
269 | 269 | public function get_columns() { |
270 | 270 | $columns = array( |
271 | 271 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
272 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
273 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
274 | - 'status' => esc_html__( 'Status', 'give' ), |
|
275 | - 'date' => esc_html__( 'Date', 'give' ), |
|
276 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
277 | - 'details' => esc_html__( 'Details', 'give' ), |
|
272 | + 'donation' => esc_html__('Donation', 'give'), |
|
273 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
274 | + 'status' => esc_html__('Status', 'give'), |
|
275 | + 'date' => esc_html__('Date', 'give'), |
|
276 | + 'amount' => esc_html__('Amount', 'give'), |
|
277 | + 'details' => esc_html__('Details', 'give'), |
|
278 | 278 | ); |
279 | 279 | |
280 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
280 | + return apply_filters('give_payments_table_columns', $columns); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function get_sortable_columns() { |
291 | 291 | $columns = array( |
292 | - 'donation' => array( 'ID', true ), |
|
293 | - 'donation_form' => array( 'donation_form', false ), |
|
294 | - 'status' => array( 'status', false ), |
|
295 | - 'amount' => array( 'amount', false ), |
|
296 | - 'date' => array( 'date', false ), |
|
292 | + 'donation' => array('ID', true), |
|
293 | + 'donation_form' => array('donation_form', false), |
|
294 | + 'status' => array('status', false), |
|
295 | + 'amount' => array('amount', false), |
|
296 | + 'date' => array('date', false), |
|
297 | 297 | ); |
298 | 298 | |
299 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
299 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -322,65 +322,65 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return string Column Name |
324 | 324 | */ |
325 | - public function column_default( $payment, $column_name ) { |
|
325 | + public function column_default($payment, $column_name) { |
|
326 | 326 | |
327 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
328 | - $row_actions = $this->get_row_actions( $payment ); |
|
327 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
328 | + $row_actions = $this->get_row_actions($payment); |
|
329 | 329 | |
330 | - switch ( $column_name ) { |
|
330 | + switch ($column_name) { |
|
331 | 331 | case 'donation' : |
332 | 332 | $value = sprintf( |
333 | 333 | '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', |
334 | 334 | $single_donation_url, |
335 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ), |
|
335 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID), |
|
336 | 336 | $payment->ID, |
337 | - esc_html__( 'by', 'give' ), |
|
338 | - $this->get_donor( $payment ) |
|
337 | + esc_html__('by', 'give'), |
|
338 | + $this->get_donor($payment) |
|
339 | 339 | ); |
340 | - $value .= $this->get_donor_email( $payment ); |
|
341 | - $value .= $this->row_actions( $row_actions ); |
|
340 | + $value .= $this->get_donor_email($payment); |
|
341 | + $value .= $this->row_actions($row_actions); |
|
342 | 342 | break; |
343 | 343 | |
344 | 344 | case 'amount' : |
345 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
346 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
345 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
346 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
347 | 347 | break; |
348 | 348 | |
349 | 349 | case 'donation_form' : |
350 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
351 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
352 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
350 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
351 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
352 | + $level = give_get_payment_form_title($payment->meta, true); |
|
353 | 353 | |
354 | - if ( ! empty( $level ) ) { |
|
354 | + if ( ! empty($level)) { |
|
355 | 355 | $value .= $level; |
356 | 356 | } |
357 | 357 | |
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'date' : |
361 | - $date = strtotime( $payment->date ); |
|
362 | - $value = date_i18n( give_date_format(), $date ); |
|
361 | + $date = strtotime($payment->date); |
|
362 | + $value = date_i18n(give_date_format(), $date); |
|
363 | 363 | break; |
364 | 364 | |
365 | 365 | case 'status' : |
366 | - $value = $this->get_payment_status( $payment ); |
|
366 | + $value = $this->get_payment_status($payment); |
|
367 | 367 | break; |
368 | 368 | |
369 | 369 | case 'details' : |
370 | 370 | $value = sprintf( |
371 | 371 | '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', |
372 | 372 | $single_donation_url, |
373 | - sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ) |
|
373 | + sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID) |
|
374 | 374 | ); |
375 | 375 | break; |
376 | 376 | |
377 | 377 | default: |
378 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
378 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
379 | 379 | break; |
380 | 380 | |
381 | 381 | } |
382 | 382 | |
383 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
383 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return string Data shown in the Email column |
395 | 395 | */ |
396 | - public function get_donor_email( $payment ) { |
|
396 | + public function get_donor_email($payment) { |
|
397 | 397 | |
398 | - $email = give_get_payment_user_email( $payment->ID ); |
|
398 | + $email = give_get_payment_user_email($payment->ID); |
|
399 | 399 | |
400 | - if ( empty( $email ) ) { |
|
401 | - $email = esc_html__( '(unknown)', 'give' ); |
|
400 | + if (empty($email)) { |
|
401 | + $email = esc_html__('(unknown)', 'give'); |
|
402 | 402 | } |
403 | 403 | |
404 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
404 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
405 | 405 | |
406 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
406 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -415,18 +415,18 @@ discard block |
||
415 | 415 | * |
416 | 416 | * @return mixed|void |
417 | 417 | */ |
418 | - function get_row_actions( $payment ) { |
|
418 | + function get_row_actions($payment) { |
|
419 | 419 | |
420 | 420 | $actions = array(); |
421 | - $email = give_get_payment_user_email( $payment->ID ); |
|
421 | + $email = give_get_payment_user_email($payment->ID); |
|
422 | 422 | |
423 | 423 | // Add search term string back to base URL. |
424 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
425 | - if ( ! empty( $search_terms ) ) { |
|
426 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
424 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
425 | + if ( ! empty($search_terms)) { |
|
426 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
427 | 427 | } |
428 | 428 | |
429 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
429 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
430 | 430 | |
431 | 431 | $actions['email_links'] = sprintf( |
432 | 432 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | ), |
441 | 441 | 'give_payment_nonce' |
442 | 442 | ), |
443 | - sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), |
|
444 | - esc_html__( 'Resend Receipt', 'give' ) |
|
443 | + sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), |
|
444 | + esc_html__('Resend Receipt', 'give') |
|
445 | 445 | ); |
446 | 446 | |
447 | 447 | } |
@@ -458,11 +458,11 @@ discard block |
||
458 | 458 | ), |
459 | 459 | 'give_donation_nonce' |
460 | 460 | ), |
461 | - sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), |
|
462 | - esc_html__( 'Delete', 'give' ) |
|
461 | + sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), |
|
462 | + esc_html__('Delete', 'give') |
|
463 | 463 | ); |
464 | 464 | |
465 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
465 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -476,10 +476,10 @@ discard block |
||
476 | 476 | * |
477 | 477 | * @return string Data shown in the Email column |
478 | 478 | */ |
479 | - function get_payment_status( $payment ) { |
|
480 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
481 | - if ( $payment->mode == 'test' ) { |
|
482 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
479 | + function get_payment_status($payment) { |
|
480 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
481 | + if ($payment->mode == 'test') { |
|
482 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | return $value; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return string Displays a checkbox. |
497 | 497 | */ |
498 | - public function column_cb( $payment ) { |
|
498 | + public function column_cb($payment) { |
|
499 | 499 | return sprintf( |
500 | 500 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
501 | 501 | 'payment', |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | * |
514 | 514 | * @return string Displays a checkbox. |
515 | 515 | */ |
516 | - public function get_payment_id( $payment ) { |
|
517 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
516 | + public function get_payment_id($payment) { |
|
517 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -527,19 +527,19 @@ discard block |
||
527 | 527 | * |
528 | 528 | * @return string Data shown in the User column |
529 | 529 | */ |
530 | - public function get_donor( $payment ) { |
|
530 | + public function get_donor($payment) { |
|
531 | 531 | |
532 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
532 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
533 | 533 | |
534 | - if ( ! empty( $customer_id ) ) { |
|
535 | - $customer = new Give_Customer( $customer_id ); |
|
536 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
534 | + if ( ! empty($customer_id)) { |
|
535 | + $customer = new Give_Customer($customer_id); |
|
536 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
537 | 537 | } else { |
538 | - $email = give_get_payment_user_email( $payment->ID ); |
|
539 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
538 | + $email = give_get_payment_user_email($payment->ID); |
|
539 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
540 | 540 | } |
541 | 541 | |
542 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
542 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -551,18 +551,18 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function get_bulk_actions() { |
553 | 553 | $actions = array( |
554 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
555 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
556 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
557 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
558 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
559 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
560 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
561 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
562 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ), |
|
554 | + 'delete' => esc_html__('Delete', 'give'), |
|
555 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
556 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
557 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
558 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
559 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
560 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
561 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
562 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give'), |
|
563 | 563 | ); |
564 | 564 | |
565 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
565 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -573,59 +573,59 @@ discard block |
||
573 | 573 | * @return void |
574 | 574 | */ |
575 | 575 | public function process_bulk_action() { |
576 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
576 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
577 | 577 | $action = $this->current_action(); |
578 | 578 | |
579 | - if ( ! is_array( $ids ) ) { |
|
580 | - $ids = array( $ids ); |
|
579 | + if ( ! is_array($ids)) { |
|
580 | + $ids = array($ids); |
|
581 | 581 | } |
582 | 582 | |
583 | - if ( empty( $action ) ) { |
|
583 | + if (empty($action)) { |
|
584 | 584 | return; |
585 | 585 | } |
586 | 586 | |
587 | - foreach ( $ids as $id ) { |
|
587 | + foreach ($ids as $id) { |
|
588 | 588 | |
589 | 589 | // Detect when a bulk action is being triggered. |
590 | - switch ( $this->current_action() ) { |
|
590 | + switch ($this->current_action()) { |
|
591 | 591 | |
592 | 592 | case'delete': |
593 | - give_delete_purchase( $id ); |
|
593 | + give_delete_purchase($id); |
|
594 | 594 | break; |
595 | 595 | |
596 | 596 | case 'set-status-publish': |
597 | - give_update_payment_status( $id, 'publish' ); |
|
597 | + give_update_payment_status($id, 'publish'); |
|
598 | 598 | break; |
599 | 599 | |
600 | 600 | case 'set-status-pending': |
601 | - give_update_payment_status( $id, 'pending' ); |
|
601 | + give_update_payment_status($id, 'pending'); |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'set-status-refunded': |
605 | - give_update_payment_status( $id, 'refunded' ); |
|
605 | + give_update_payment_status($id, 'refunded'); |
|
606 | 606 | break; |
607 | 607 | case 'set-status-revoked': |
608 | - give_update_payment_status( $id, 'revoked' ); |
|
608 | + give_update_payment_status($id, 'revoked'); |
|
609 | 609 | break; |
610 | 610 | |
611 | 611 | case 'set-status-failed': |
612 | - give_update_payment_status( $id, 'failed' ); |
|
612 | + give_update_payment_status($id, 'failed'); |
|
613 | 613 | break; |
614 | 614 | |
615 | 615 | case 'set-status-cancelled': |
616 | - give_update_payment_status( $id, 'cancelled' ); |
|
616 | + give_update_payment_status($id, 'cancelled'); |
|
617 | 617 | break; |
618 | 618 | |
619 | 619 | case 'set-status-abandoned': |
620 | - give_update_payment_status( $id, 'abandoned' ); |
|
620 | + give_update_payment_status($id, 'abandoned'); |
|
621 | 621 | break; |
622 | 622 | |
623 | 623 | case 'set-status-preapproval': |
624 | - give_update_payment_status( $id, 'preapproval' ); |
|
624 | + give_update_payment_status($id, 'preapproval'); |
|
625 | 625 | break; |
626 | 626 | |
627 | 627 | case 'resend-receipt': |
628 | - give_email_donation_receipt( $id, false ); |
|
628 | + give_email_donation_receipt($id, false); |
|
629 | 629 | break; |
630 | 630 | } |
631 | 631 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @param int $id The ID of the payment. |
638 | 638 | * @param string $current_action The action that is being triggered. |
639 | 639 | */ |
640 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
640 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | } |
@@ -653,27 +653,27 @@ discard block |
||
653 | 653 | |
654 | 654 | $args = array(); |
655 | 655 | |
656 | - if ( isset( $_GET['user'] ) ) { |
|
657 | - $args['user'] = urldecode( $_GET['user'] ); |
|
658 | - } elseif ( isset( $_GET['s'] ) ) { |
|
659 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
660 | - if ( $is_user ) { |
|
661 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
662 | - unset( $args['s'] ); |
|
656 | + if (isset($_GET['user'])) { |
|
657 | + $args['user'] = urldecode($_GET['user']); |
|
658 | + } elseif (isset($_GET['s'])) { |
|
659 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
660 | + if ($is_user) { |
|
661 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
662 | + unset($args['s']); |
|
663 | 663 | } else { |
664 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
664 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
669 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
668 | + if ( ! empty($_GET['start-date'])) { |
|
669 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
670 | 670 | } |
671 | 671 | |
672 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
673 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
672 | + if ( ! empty($_GET['end-date'])) { |
|
673 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
674 | 674 | } |
675 | 675 | |
676 | - $payment_count = give_count_payments( $args ); |
|
676 | + $payment_count = give_count_payments($args); |
|
677 | 677 | $this->complete_count = $payment_count->publish; |
678 | 678 | $this->pending_count = $payment_count->pending; |
679 | 679 | $this->refunded_count = $payment_count->refunded; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $this->cancelled_count = $payment_count->cancelled; |
683 | 683 | $this->abandoned_count = $payment_count->abandoned; |
684 | 684 | |
685 | - foreach ( $payment_count as $count ) { |
|
685 | + foreach ($payment_count as $count) { |
|
686 | 686 | $this->total_count += $count; |
687 | 687 | } |
688 | 688 | } |
@@ -697,26 +697,26 @@ discard block |
||
697 | 697 | public function payments_data() { |
698 | 698 | |
699 | 699 | $per_page = $this->per_page; |
700 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
701 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
702 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
703 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
704 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
705 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
706 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
707 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
708 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
709 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
710 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
711 | - |
|
712 | - if ( ! empty( $search ) ) { |
|
700 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
701 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
702 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
703 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
704 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
705 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
706 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
707 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
708 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
709 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
710 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
711 | + |
|
712 | + if ( ! empty($search)) { |
|
713 | 713 | $status = 'any'; // Force all payment statuses when searching. |
714 | 714 | } |
715 | 715 | |
716 | 716 | $args = array( |
717 | 717 | 'output' => 'payments', |
718 | 718 | 'number' => $per_page, |
719 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
719 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
720 | 720 | 'orderby' => $orderby, |
721 | 721 | 'order' => $order, |
722 | 722 | 'user' => $user, |
@@ -730,14 +730,14 @@ discard block |
||
730 | 730 | 'end_date' => $end_date, |
731 | 731 | ); |
732 | 732 | |
733 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
733 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
734 | 734 | |
735 | 735 | $args['search_in_notes'] = true; |
736 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
736 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
737 | 737 | |
738 | 738 | } |
739 | 739 | |
740 | - $p_query = new Give_Payments_Query( $args ); |
|
740 | + $p_query = new Give_Payments_Query($args); |
|
741 | 741 | |
742 | 742 | return $p_query->get_payments(); |
743 | 743 | |
@@ -757,17 +757,17 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public function prepare_items() { |
759 | 759 | |
760 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
760 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
761 | 761 | |
762 | 762 | $columns = $this->get_columns(); |
763 | 763 | $hidden = array(); // No hidden columns. |
764 | 764 | $sortable = $this->get_sortable_columns(); |
765 | 765 | $data = $this->payments_data(); |
766 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
766 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
767 | 767 | |
768 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
768 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
769 | 769 | |
770 | - switch ( $status ) { |
|
770 | + switch ($status) { |
|
771 | 771 | case 'publish': |
772 | 772 | $total_items = $this->complete_count; |
773 | 773 | break; |
@@ -794,19 +794,19 @@ discard block |
||
794 | 794 | break; |
795 | 795 | default: |
796 | 796 | // Retrieve the count of the non-default-Give status. |
797 | - $count = wp_count_posts( 'give_payment' ); |
|
797 | + $count = wp_count_posts('give_payment'); |
|
798 | 798 | $total_items = $count->{$status}; |
799 | 799 | break; |
800 | 800 | } |
801 | 801 | |
802 | 802 | $this->items = $data; |
803 | 803 | |
804 | - $this->set_pagination_args( array( |
|
804 | + $this->set_pagination_args(array( |
|
805 | 805 | 'total_items' => $total_items, |
806 | 806 | // We have to calculate the total number of items. |
807 | 807 | 'per_page' => $this->per_page, |
808 | 808 | // We have to determine how many items to show on a page. |
809 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
809 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
810 | 810 | // We have to calculate the total number of pages. |
811 | 811 | ) |
812 | 812 | ); |