@@ -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,13 +27,13 @@ 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 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | - add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) ); |
|
36 | + add_action('give_admin_field_email_notification', array($this, 'email_notification_setting')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $settings = array(); |
47 | 47 | $current_section = give_get_current_setting_section(); |
48 | 48 | |
49 | - switch ( $current_section ) { |
|
49 | + switch ($current_section) { |
|
50 | 50 | case 'email-settings' : |
51 | 51 | $settings = array( |
52 | 52 | |
53 | 53 | // Section 1: Email Notification Listing. |
54 | 54 | array( |
55 | - 'desc' => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ), |
|
55 | + 'desc' => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'), |
|
56 | 56 | 'type' => 'title', |
57 | 57 | 'id' => 'give_email_notification_settings', |
58 | 58 | 'table_html' => false, |
@@ -67,42 +67,42 @@ discard block |
||
67 | 67 | |
68 | 68 | // Section 2: Email Sender Setting |
69 | 69 | array( |
70 | - 'title' => __( 'Email Sender Options', 'give' ), |
|
70 | + 'title' => __('Email Sender Options', 'give'), |
|
71 | 71 | 'id' => 'give_title_email_settings_1', |
72 | 72 | 'type' => 'title', |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'email_template', |
76 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
77 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
76 | + 'name' => esc_html__('Email Template', 'give'), |
|
77 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
78 | 78 | 'type' => 'select', |
79 | 79 | 'options' => give_get_email_templates(), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'id' => 'email_logo', |
83 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
84 | - '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' ), |
|
83 | + 'name' => esc_html__('Logo', 'give'), |
|
84 | + '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'), |
|
85 | 85 | 'type' => 'file', |
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'from_name', |
89 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
90 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
91 | - 'default' => get_bloginfo( 'name' ), |
|
89 | + 'name' => esc_html__('From Name', 'give'), |
|
90 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
91 | + 'default' => get_bloginfo('name'), |
|
92 | 92 | 'type' => 'text', |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'id' => 'from_email', |
96 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
97 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
98 | - 'default' => get_bloginfo( 'admin_email' ), |
|
96 | + 'name' => esc_html__('From Email', 'give'), |
|
97 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
98 | + 'default' => get_bloginfo('admin_email'), |
|
99 | 99 | 'type' => 'text', |
100 | 100 | ), |
101 | 101 | array( |
102 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
102 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
103 | 103 | 'id' => 'donation_notification_settings_docs_link', |
104 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
105 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
104 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
105 | + 'title' => __('Donation Notification Settings', 'give'), |
|
106 | 106 | 'type' => 'give_docs_link', |
107 | 107 | ), |
108 | 108 | array( |
@@ -120,19 +120,19 @@ discard block |
||
120 | 120 | 'type' => 'title' |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Admin Email Address', 'give' ), |
|
123 | + 'name' => __('Admin Email Address', 'give'), |
|
124 | 124 | 'id' => "contact_admin_email", |
125 | - 'desc' => sprintf( '%1$s <code>{admin_email}</code> %2$s', __( 'By default, the', 'give' ), __( 'tag will use your WordPress admin email. If you would like to customize this address you can do so in the field above.', 'give' ) ), |
|
125 | + 'desc' => sprintf('%1$s <code>{admin_email}</code> %2$s', __('By default, the', 'give'), __('tag will use your WordPress admin email. If you would like to customize this address you can do so in the field above.', 'give')), |
|
126 | 126 | 'type' => 'text', |
127 | 127 | 'default' => give_email_admin_email(), |
128 | 128 | |
129 | 129 | ), |
130 | 130 | array( |
131 | - 'name' => __( 'Offline Mailing Address', 'give' ), |
|
131 | + 'name' => __('Offline Mailing Address', 'give'), |
|
132 | 132 | 'id' => "contact_offline_mailing_address", |
133 | - 'desc' => sprintf( '%1$s <code>{offline_mailing_address}</code> %2$s', __( 'Set the mailing address to where you would like your donors to send their offline donations. This will customize the', 'give' ), __( 'email tag for the Offline Donations payment gateway.', 'give' ) ), |
|
133 | + 'desc' => sprintf('%1$s <code>{offline_mailing_address}</code> %2$s', __('Set the mailing address to where you would like your donors to send their offline donations. This will customize the', 'give'), __('email tag for the Offline Donations payment gateway.', 'give')), |
|
134 | 134 | 'type' => 'wysiwyg', |
135 | - 'default' => ' <em>' . get_bloginfo( 'sitename' ) . '</em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', |
|
135 | + 'default' => ' <em>'.get_bloginfo('sitename').'</em><br> <em>111 Not A Real St.</em><br> <em>Anytown, CA 12345 </em><br>', |
|
136 | 136 | ), |
137 | 137 | array( |
138 | 138 | 'id' => 'give_title_general_settings_4', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Filter the emails settings. |
148 | 148 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
149 | 149 | */ |
150 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
150 | + $settings = apply_filters('give_settings_emails', $settings); |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Filter the settings. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param array $settings |
158 | 158 | */ |
159 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
159 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
160 | 160 | |
161 | 161 | // Output. |
162 | 162 | return $settings; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_sections() { |
172 | 172 | $sections = array( |
173 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
174 | - 'contact' => esc_html__( 'Contact Information', 'give' ), |
|
173 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
174 | + 'contact' => esc_html__('Contact Information', 'give'), |
|
175 | 175 | ); |
176 | 176 | |
177 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
177 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function email_notification_setting() { |
187 | 187 | // Load email notification table. |
188 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php'; |
|
188 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php'; |
|
189 | 189 | |
190 | 190 | // Init table. |
191 | 191 | $email_notifications_table = new Give_Email_Notification_Table(); |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | */ |
206 | 206 | public function output() { |
207 | - if ( $this->enable_save ) { |
|
208 | - $GLOBALS['give_hide_save_button'] = apply_filters( 'give_hide_save_button_on_email_admin_setting_page', false ); |
|
207 | + if ($this->enable_save) { |
|
208 | + $GLOBALS['give_hide_save_button'] = apply_filters('give_hide_save_button_on_email_admin_setting_page', false); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $settings = $this->get_settings(); |
212 | 212 | |
213 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
213 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -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_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = __( 'General', 'give' ); |
|
30 | + $this->label = __('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_save_settings_give_settings', array( $this, '__give_change_donation_stating_number' ), 10, 3 ); |
|
36 | - add_action( 'give_admin_field_give_sequential_donation_code_preview', array( $this, '__render_give_sequential_donation_code_preview' ), 10, 3 ); |
|
37 | - add_action( 'give_admin_field_give_unlock_all_settings', array( $this, '__render_give_unlock_all_settings' ), 10, 3 ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_save_settings_give_settings', array($this, '__give_change_donation_stating_number'), 10, 3); |
|
36 | + add_action('give_admin_field_give_sequential_donation_code_preview', array($this, '__render_give_sequential_donation_code_preview'), 10, 3); |
|
37 | + add_action('give_admin_field_give_unlock_all_settings', array($this, '__render_give_unlock_all_settings'), 10, 3); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | parent::__construct(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $settings = array(); |
51 | 51 | $current_section = give_get_current_setting_section(); |
52 | 52 | |
53 | - switch ( $current_section ) { |
|
53 | + switch ($current_section) { |
|
54 | 54 | case 'access-control': |
55 | 55 | $settings = array( |
56 | 56 | // Section 3: Access control. |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'id' => 'session_lifetime', |
63 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
64 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
63 | + 'name' => __('Session Lifetime', 'give'), |
|
64 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
65 | 65 | 'type' => 'select', |
66 | 66 | 'options' => array( |
67 | - '86400' => __( '24 Hours', 'give' ), |
|
68 | - '172800' => __( '48 Hours', 'give' ), |
|
69 | - '259200' => __( '72 Hours', 'give' ), |
|
70 | - '604800' => __( '1 Week', 'give' ), |
|
67 | + '86400' => __('24 Hours', 'give'), |
|
68 | + '172800' => __('48 Hours', 'give'), |
|
69 | + '259200' => __('72 Hours', 'give'), |
|
70 | + '604800' => __('1 Week', 'give'), |
|
71 | 71 | ), |
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'id' => 'limit_display_donations', |
75 | - 'name' => __( 'Limit Donations Displayed', 'give' ), |
|
76 | - 'desc' => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ), |
|
75 | + 'name' => __('Limit Donations Displayed', 'give'), |
|
76 | + 'desc' => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'), |
|
77 | 77 | 'default' => '1', |
78 | 78 | 'type' => 'number', |
79 | 79 | 'css' => 'width:50px;', |
@@ -83,47 +83,47 @@ discard block |
||
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | array( |
86 | - 'name' => __( 'Email Access', 'give' ), |
|
87 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
86 | + 'name' => __('Email Access', 'give'), |
|
87 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
88 | 88 | 'id' => 'email_access', |
89 | 89 | 'type' => 'radio_inline', |
90 | 90 | 'default' => 'disabled', |
91 | 91 | 'options' => array( |
92 | - 'enabled' => __( 'Enabled', 'give' ), |
|
93 | - 'disabled' => __( 'Disabled', 'give' ), |
|
92 | + 'enabled' => __('Enabled', 'give'), |
|
93 | + 'disabled' => __('Disabled', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | - 'name' => __( 'Enable reCAPTCHA', 'give' ), |
|
98 | - 'desc' => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ), |
|
97 | + 'name' => __('Enable reCAPTCHA', 'give'), |
|
98 | + 'desc' => __('Would you like to enable the reCAPTCHA feature?', 'give'), |
|
99 | 99 | 'id' => 'enable_recaptcha', |
100 | 100 | 'type' => 'radio_inline', |
101 | 101 | 'default' => 'disabled', |
102 | 102 | 'options' => array( |
103 | - 'enabled' => __( 'Enabled', 'give' ), |
|
104 | - 'disabled' => __( 'Disabled', 'give' ), |
|
103 | + 'enabled' => __('Enabled', 'give'), |
|
104 | + 'disabled' => __('Disabled', 'give'), |
|
105 | 105 | ), |
106 | 106 | ), |
107 | 107 | array( |
108 | 108 | 'id' => 'recaptcha_key', |
109 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
109 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
110 | 110 | /* translators: %s: https://www.google.com/recaptcha/ */ |
111 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
111 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
112 | 112 | 'default' => '', |
113 | 113 | 'type' => 'text', |
114 | 114 | ), |
115 | 115 | array( |
116 | 116 | 'id' => 'recaptcha_secret', |
117 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
118 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
117 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
118 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
119 | 119 | 'default' => '', |
120 | 120 | 'type' => 'text', |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Access Control Docs Link', 'give' ), |
|
123 | + 'name' => __('Access Control Docs Link', 'give'), |
|
124 | 124 | 'id' => 'access_control_docs_link', |
125 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
126 | - 'title' => __( 'Access Control', 'give' ), |
|
125 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
126 | + 'title' => __('Access Control', 'give'), |
|
127 | 127 | 'type' => 'give_docs_link', |
128 | 128 | ), |
129 | 129 | array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'currency-settings' : |
137 | - $currency_position_before = __( 'Before - %s‎10', 'give' ); |
|
138 | - $currency_position_after = __( 'After - 10%s‏', 'give' ); |
|
137 | + $currency_position_before = __('Before - %s‎10', 'give'); |
|
138 | + $currency_position_after = __('After - 10%s‏', 'give'); |
|
139 | 139 | |
140 | 140 | $settings = array( |
141 | 141 | // Section 2: Currency |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | 'id' => 'give_title_general_settings_2', |
145 | 145 | ), |
146 | 146 | array( |
147 | - 'name' => __( 'Currency Settings', 'give' ), |
|
147 | + 'name' => __('Currency Settings', 'give'), |
|
148 | 148 | 'desc' => '', |
149 | 149 | 'type' => 'give_title', |
150 | 150 | 'id' => 'give_title_general_settings_2', |
151 | 151 | ), |
152 | 152 | array( |
153 | - 'name' => __( 'Currency', 'give' ), |
|
154 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
153 | + 'name' => __('Currency', 'give'), |
|
154 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
155 | 155 | 'id' => 'currency', |
156 | 156 | 'class' => 'give-select-chosen', |
157 | 157 | 'type' => 'select', |
@@ -159,51 +159,51 @@ discard block |
||
159 | 159 | 'default' => 'USD', |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Currency Position', 'give' ), |
|
163 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
162 | + 'name' => __('Currency Position', 'give'), |
|
163 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
164 | 164 | 'id' => 'currency_position', |
165 | 165 | 'type' => 'select', |
166 | 166 | 'options' => array( |
167 | 167 | /* translators: %s: currency symbol */ |
168 | - 'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ), |
|
168 | + 'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())), |
|
169 | 169 | /* translators: %s: currency symbol */ |
170 | - 'after' => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ), |
|
170 | + 'after' => sprintf($currency_position_after, give_currency_symbol(give_get_currency())), |
|
171 | 171 | ), |
172 | 172 | 'default' => 'before', |
173 | 173 | 'attributes' => array( |
174 | - 'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ), |
|
175 | - 'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ), |
|
174 | + 'data-before-template' => sprintf($currency_position_before, '{currency_pos}'), |
|
175 | + 'data-after-template' => sprintf($currency_position_after, '{currency_pos}'), |
|
176 | 176 | ), |
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
180 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
179 | + 'name' => __('Thousands Separator', 'give'), |
|
180 | + 'desc' => __('The symbol (typically , or .) to separate thousands.', 'give'), |
|
181 | 181 | 'id' => 'thousands_separator', |
182 | 182 | 'type' => 'text', |
183 | 183 | 'default' => ',', |
184 | 184 | 'css' => 'width:12em;', |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
188 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
187 | + 'name' => __('Decimal Separator', 'give'), |
|
188 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
189 | 189 | 'id' => 'decimal_separator', |
190 | 190 | 'type' => 'text', |
191 | 191 | 'default' => '.', |
192 | 192 | 'css' => 'width:12em;', |
193 | 193 | ), |
194 | 194 | array( |
195 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
196 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
195 | + 'name' => __('Number of Decimals', 'give'), |
|
196 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
197 | 197 | 'id' => 'number_decimals', |
198 | 198 | 'type' => 'text', |
199 | 199 | 'default' => 2, |
200 | 200 | 'css' => 'width:12em;', |
201 | 201 | ), |
202 | 202 | array( |
203 | - 'name' => __( 'Currency Options Docs Link', 'give' ), |
|
203 | + 'name' => __('Currency Options Docs Link', 'give'), |
|
204 | 204 | 'id' => 'currency_settings_docs_link', |
205 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
206 | - 'title' => __( 'Currency Settings', 'give' ), |
|
205 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
206 | + 'title' => __('Currency Settings', 'give'), |
|
207 | 207 | 'type' => 'give_docs_link', |
208 | 208 | ), |
209 | 209 | array( |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | $countries = give_get_country(); |
220 | 220 | |
221 | 221 | // get the list of the states of which default country is selected. |
222 | - $states = give_get_states( $countries ); |
|
222 | + $states = give_get_states($countries); |
|
223 | 223 | |
224 | 224 | // Get the country list that does not have any states init. |
225 | 225 | $no_states_country = give_no_states_country_list(); |
226 | 226 | |
227 | 227 | $states_label = give_get_states_label(); |
228 | 228 | $country = give_get_country(); |
229 | - $label = __( 'State', 'give' ); |
|
229 | + $label = __('State', 'give'); |
|
230 | 230 | // Check if $country code exists in the array key for states label. |
231 | - if ( array_key_exists( $country, $states_label ) ) { |
|
232 | - $label = $states_label[ $country ]; |
|
231 | + if (array_key_exists($country, $states_label)) { |
|
232 | + $label = $states_label[$country]; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -240,58 +240,58 @@ discard block |
||
240 | 240 | 'id' => 'give_title_general_settings_1', |
241 | 241 | ), |
242 | 242 | array( |
243 | - 'name' => __( 'General Settings', 'give' ), |
|
243 | + 'name' => __('General Settings', 'give'), |
|
244 | 244 | 'desc' => '', |
245 | 245 | 'type' => 'give_title', |
246 | 246 | 'id' => 'give_title_general_settings_1', |
247 | 247 | ), |
248 | 248 | array( |
249 | - 'name' => __( 'Success Page', 'give' ), |
|
249 | + 'name' => __('Success Page', 'give'), |
|
250 | 250 | /* translators: %s: [give_receipt] */ |
251 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
251 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
252 | 252 | 'id' => 'success_page', |
253 | 253 | 'class' => 'give-select give-select-chosen', |
254 | 254 | 'type' => 'select', |
255 | - 'options' => give_cmb2_get_post_options( array( |
|
255 | + 'options' => give_cmb2_get_post_options(array( |
|
256 | 256 | 'post_type' => 'page', |
257 | 257 | 'numberposts' => 30, |
258 | - ) ), |
|
258 | + )), |
|
259 | 259 | 'attributes' => array( |
260 | 260 | 'data-search-type' => 'pages' |
261 | 261 | ) |
262 | 262 | ), |
263 | 263 | array( |
264 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
265 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
264 | + 'name' => __('Failed Donation Page', 'give'), |
|
265 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
266 | 266 | 'class' => 'give-select give-select-chosen', |
267 | 267 | 'id' => 'failure_page', |
268 | 268 | 'type' => 'select', |
269 | - 'options' => give_cmb2_get_post_options( array( |
|
269 | + 'options' => give_cmb2_get_post_options(array( |
|
270 | 270 | 'post_type' => 'page', |
271 | 271 | 'numberposts' => 30, |
272 | - ) ), |
|
272 | + )), |
|
273 | 273 | 'attributes' => array( |
274 | 274 | 'data-search-type' => 'pages' |
275 | 275 | ) |
276 | 276 | ), |
277 | 277 | array( |
278 | - 'name' => __( 'Donation History Page', 'give' ), |
|
278 | + 'name' => __('Donation History Page', 'give'), |
|
279 | 279 | /* translators: %s: [donation_history] */ |
280 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
280 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
281 | 281 | 'id' => 'history_page', |
282 | 282 | 'class' => 'give-select give-select-chosen', |
283 | 283 | 'type' => 'select', |
284 | - 'options' => give_cmb2_get_post_options( array( |
|
284 | + 'options' => give_cmb2_get_post_options(array( |
|
285 | 285 | 'post_type' => 'page', |
286 | 286 | 'numberposts' => 30, |
287 | - ) ), |
|
287 | + )), |
|
288 | 288 | 'attributes' => array( |
289 | 289 | 'data-search-type' => 'pages' |
290 | 290 | ) |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => __( 'Base Country', 'give' ), |
|
294 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
293 | + 'name' => __('Base Country', 'give'), |
|
294 | + 'desc' => __('The country your site operates from.', 'give'), |
|
295 | 295 | 'id' => 'base_country', |
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => give_get_country_list(), |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | * @since 1.8.14 |
308 | 308 | */ |
309 | 309 | array( |
310 | - 'wrapper_class' => ( array_key_exists( $countries, $no_states_country ) ? 'give-hidden' : '' ), |
|
311 | - 'name' => __( 'Base State/Province', 'give' ), |
|
312 | - 'desc' => __( 'The state/province your site operates from.', 'give' ), |
|
310 | + 'wrapper_class' => (array_key_exists($countries, $no_states_country) ? 'give-hidden' : ''), |
|
311 | + 'name' => __('Base State/Province', 'give'), |
|
312 | + 'desc' => __('The state/province your site operates from.', 'give'), |
|
313 | 313 | 'id' => 'base_state', |
314 | - 'type' => ( empty( $states ) ? 'text' : 'select' ), |
|
315 | - 'class' => ( empty( $states ) ? '' : 'give-select give-select-chosen' ), |
|
314 | + 'type' => (empty($states) ? 'text' : 'select'), |
|
315 | + 'class' => (empty($states) ? '' : 'give-select give-select-chosen'), |
|
316 | 316 | 'options' => $states, |
317 | 317 | 'attributes' => array( |
318 | 318 | 'data-search-type' => 'no_ajax', |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | ), |
321 | 321 | ), |
322 | 322 | array( |
323 | - 'name' => __( 'General Options Docs Link', 'give' ), |
|
323 | + 'name' => __('General Options Docs Link', 'give'), |
|
324 | 324 | 'id' => 'general_options_docs_link', |
325 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
326 | - 'title' => __( 'General Options', 'give' ), |
|
325 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
326 | + 'title' => __('General Options', 'give'), |
|
327 | 327 | 'type' => 'give_docs_link', |
328 | 328 | ), |
329 | 329 | array( |
@@ -343,48 +343,48 @@ discard block |
||
343 | 343 | 'type' => 'title' |
344 | 344 | ), |
345 | 345 | array( |
346 | - 'name' => __( 'Sequential Ordering', 'give' ), |
|
346 | + 'name' => __('Sequential Ordering', 'give'), |
|
347 | 347 | 'id' => "{$current_section}_status", |
348 | - 'desc' => __( 'Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give' ), |
|
348 | + 'desc' => __('Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give'), |
|
349 | 349 | 'type' => 'radio_inline', |
350 | 350 | 'default' => 'disabled', |
351 | 351 | 'options' => array( |
352 | - 'enabled' => __( 'Enabled', 'give' ), |
|
353 | - 'disabled' => __( 'Disabled', 'give' ) |
|
352 | + 'enabled' => __('Enabled', 'give'), |
|
353 | + 'disabled' => __('Disabled', 'give') |
|
354 | 354 | ) |
355 | 355 | ), |
356 | 356 | array( |
357 | - 'name' => __( 'Next Donation Number', 'give' ), |
|
357 | + 'name' => __('Next Donation Number', 'give'), |
|
358 | 358 | 'id' => "{$current_section}_number", |
359 | 359 | 'desc' => sprintf( |
360 | - __( 'The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
361 | - '<code>' . Give()->seq_donation_number->get_next_number() . '</code>' |
|
360 | + __('The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give'), |
|
361 | + '<code>'.Give()->seq_donation_number->get_next_number().'</code>' |
|
362 | 362 | ), |
363 | 363 | 'type' => 'number', |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => __( 'Number Prefix', 'give' ), |
|
366 | + 'name' => __('Number Prefix', 'give'), |
|
367 | 367 | 'id' => "{$current_section}_number_prefix", |
368 | 368 | 'desc' => sprintf( |
369 | - __( 'The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
369 | + __('The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
370 | 370 | '<code>-</code>' |
371 | 371 | ), |
372 | 372 | 'type' => 'text', |
373 | 373 | ), |
374 | 374 | array( |
375 | - 'name' => __( 'Number Suffix', 'give' ), |
|
375 | + 'name' => __('Number Suffix', 'give'), |
|
376 | 376 | 'id' => "{$current_section}_number_suffix", |
377 | 377 | 'desc' => sprintf( |
378 | - __( 'The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
378 | + __('The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
379 | 379 | '<code>-</code>' |
380 | 380 | ), |
381 | 381 | 'type' => 'text', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => __( 'Number Padding', 'give' ), |
|
384 | + 'name' => __('Number Padding', 'give'), |
|
385 | 385 | 'id' => "{$current_section}_number_padding", |
386 | 386 | 'desc' => sprintf( |
387 | - __( 'The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give' ), |
|
387 | + __('The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give'), |
|
388 | 388 | '<code>4</code>', |
389 | 389 | '<code>1</code>', |
390 | 390 | '<code>0001</code>' |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | 'default' => '0', |
394 | 394 | ), |
395 | 395 | array( |
396 | - 'name' => __( 'Donation ID Preview', 'give' ), |
|
396 | + 'name' => __('Donation ID Preview', 'give'), |
|
397 | 397 | 'id' => "{$current_section}_preview", |
398 | 398 | 'type' => 'give_sequential_donation_code_preview', |
399 | - 'desc' => __( 'A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give' ), |
|
399 | + 'desc' => __('A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give'), |
|
400 | 400 | ), |
401 | 401 | array( |
402 | - 'name' => __( 'Sequential Ordering Docs Link', 'give' ), |
|
402 | + 'name' => __('Sequential Ordering Docs Link', 'give'), |
|
403 | 403 | 'id' => "{$current_section}_doc link", |
404 | - 'url' => esc_url( 'http://docs.givewp.com/settings-sequential-ordering' ), |
|
405 | - 'title' => __( 'Sequential Ordering', 'give' ), |
|
404 | + 'url' => esc_url('http://docs.givewp.com/settings-sequential-ordering'), |
|
405 | + 'title' => __('Sequential Ordering', 'give'), |
|
406 | 406 | 'type' => 'give_docs_link', |
407 | 407 | ), |
408 | 408 | array( |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * Filter the general settings. |
417 | 417 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
418 | 418 | */ |
419 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
419 | + $settings = apply_filters('give_settings_general', $settings); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Filter the settings. |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @param array $settings |
427 | 427 | */ |
428 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
428 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
429 | 429 | |
430 | 430 | // Output. |
431 | 431 | return $settings; |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function get_sections() { |
441 | 441 | $sections = array( |
442 | - 'general-settings' => __( 'General', 'give' ), |
|
443 | - 'currency-settings' => __( 'Currency', 'give' ), |
|
444 | - 'access-control' => __( 'Access Control', 'give' ), |
|
445 | - 'sequential-ordering' => __( 'Sequential Ordering', 'give' ), |
|
442 | + 'general-settings' => __('General', 'give'), |
|
443 | + 'currency-settings' => __('Currency', 'give'), |
|
444 | + 'access-control' => __('Access Control', 'give'), |
|
445 | + 'sequential-ordering' => __('Sequential Ordering', 'give'), |
|
446 | 446 | ); |
447 | 447 | |
448 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
448 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -461,23 +461,23 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @return bool |
463 | 463 | */ |
464 | - public function __give_change_donation_stating_number( $update_options, $option_name, $old_options ) { |
|
465 | - if ( ! isset( $_POST['sequential-ordering_number'] ) ) { |
|
464 | + public function __give_change_donation_stating_number($update_options, $option_name, $old_options) { |
|
465 | + if ( ! isset($_POST['sequential-ordering_number'])) { |
|
466 | 466 | return false; |
467 | 467 | } |
468 | 468 | |
469 | - if ( ( $next_number = Give()->seq_donation_number->get_next_number() ) > $update_options['sequential-ordering_number'] ) { |
|
470 | - give_update_option( 'sequential-ordering_number', $next_number ); |
|
469 | + if (($next_number = Give()->seq_donation_number->get_next_number()) > $update_options['sequential-ordering_number']) { |
|
470 | + give_update_option('sequential-ordering_number', $next_number); |
|
471 | 471 | |
472 | 472 | Give_Admin_Settings::add_error( |
473 | 473 | 'give-invalid-sequential-starting-number', |
474 | 474 | sprintf( |
475 | - __( 'Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
475 | + __('Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give'), |
|
476 | 476 | $next_number |
477 | 477 | ) |
478 | 478 | ); |
479 | - } elseif ( $update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number'] ) { |
|
480 | - update_option( '_give_reset_sequential_number', 1, false ); |
|
479 | + } elseif ($update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number']) { |
|
480 | + update_option('_give_reset_sequential_number', 1, false); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | return true; |
@@ -492,16 +492,16 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param $field |
494 | 494 | */ |
495 | - public function __render_give_sequential_donation_code_preview( $field ) { |
|
495 | + public function __render_give_sequential_donation_code_preview($field) { |
|
496 | 496 | ?> |
497 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
497 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
498 | 498 | <th scope="row" class="titledesc"> |
499 | 499 | <label |
500 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
500 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
501 | 501 | </th> |
502 | 502 | <td class="give-forminp"> |
503 | - <input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled> |
|
504 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
503 | + <input id="<?php echo esc_attr($field['id']); ?>" class="give-input-field" type="text" disabled> |
|
504 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
505 | 505 | </td> |
506 | 506 | </tr> |
507 | 507 | <?php |
@@ -516,16 +516,16 @@ discard block |
||
516 | 516 | * |
517 | 517 | * @param $field |
518 | 518 | */ |
519 | - public function __render_give_unlock_all_settings( $field ) { |
|
519 | + public function __render_give_unlock_all_settings($field) { |
|
520 | 520 | ?> |
521 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
521 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
522 | 522 | <th scope="row" class="titledesc"> |
523 | 523 | <label |
524 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
524 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
525 | 525 | </th> |
526 | 526 | <td class="give-forminp"> |
527 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
528 | - <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __( 'Unlock all settings', 'give' ); ?></a> |
|
527 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
528 | + <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __('Unlock all settings', 'give'); ?></a> |
|
529 | 529 | </td> |
530 | 530 | </tr> |
531 | 531 | <?php |
@@ -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_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = __( 'Advanced', 'give' ); |
|
30 | + $this->label = __('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_admin_field_remove_cache_button', array( $this, 'render_remove_cache_button' ), 10, 1 ); |
|
36 | - add_action( 'give_save_settings_give_settings', array( $this, 'validate_settngs' ) ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_admin_field_remove_cache_button', array($this, 'render_remove_cache_button'), 10, 1); |
|
36 | + add_action('give_save_settings_give_settings', array($this, 'validate_settngs')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | parent::__construct(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $current_section = give_get_current_setting_section(); |
52 | 52 | |
53 | - switch ( $current_section ) { |
|
53 | + switch ($current_section) { |
|
54 | 54 | case 'advanced-options': |
55 | 55 | $settings = array( |
56 | 56 | array( |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | 'type' => 'title', |
59 | 59 | ), |
60 | 60 | array( |
61 | - 'name' => __( 'Remove Data on Uninstall', 'give' ), |
|
62 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
61 | + 'name' => __('Remove Data on Uninstall', 'give'), |
|
62 | + 'desc' => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
63 | 63 | 'id' => 'uninstall_on_delete', |
64 | 64 | 'type' => 'radio_inline', |
65 | 65 | 'default' => 'disabled', |
66 | 66 | 'options' => array( |
67 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
68 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
67 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
68 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
69 | 69 | ), |
70 | 70 | ), |
71 | 71 | array( |
72 | - 'name' => __( 'Default User Role', 'give' ), |
|
73 | - 'desc' => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ), |
|
72 | + 'name' => __('Default User Role', 'give'), |
|
73 | + 'desc' => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'), |
|
74 | 74 | 'id' => 'donor_default_user_role', |
75 | 75 | 'type' => 'select', |
76 | 76 | 'default' => 'give_donor', |
@@ -78,51 +78,51 @@ discard block |
||
78 | 78 | ), |
79 | 79 | array( |
80 | 80 | /* translators: %s: the_content */ |
81 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
81 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
82 | 82 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
83 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
83 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
84 | 84 | 'id' => 'the_content_filter', |
85 | 85 | 'default' => 'enabled', |
86 | 86 | 'type' => 'radio_inline', |
87 | 87 | 'options' => array( |
88 | - 'enabled' => __( 'Enabled', 'give' ), |
|
89 | - 'disabled' => __( 'Disabled', 'give' ), |
|
88 | + 'enabled' => __('Enabled', 'give'), |
|
89 | + 'disabled' => __('Disabled', 'give'), |
|
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | array( |
93 | - 'name' => __( 'Script Loading Location', 'give' ), |
|
94 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
93 | + 'name' => __('Script Loading Location', 'give'), |
|
94 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
95 | 95 | 'id' => 'scripts_footer', |
96 | 96 | 'type' => 'radio_inline', |
97 | 97 | 'default' => 'disabled', |
98 | 98 | 'options' => array( |
99 | - 'disabled' => __( 'Head', 'give' ), |
|
100 | - 'enabled' => __( 'Footer', 'give' ), |
|
99 | + 'disabled' => __('Head', 'give'), |
|
100 | + 'enabled' => __('Footer', 'give'), |
|
101 | 101 | ), |
102 | 102 | ), |
103 | 103 | array( |
104 | - 'name' => __( 'Akismet SPAM Protection', 'give' ), |
|
105 | - 'desc' => __( 'Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give' ), |
|
104 | + 'name' => __('Akismet SPAM Protection', 'give'), |
|
105 | + 'desc' => __('Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give'), |
|
106 | 106 | 'id' => 'akismet_spam_protection', |
107 | 107 | 'type' => 'radio_inline', |
108 | - 'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled', |
|
108 | + 'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled', |
|
109 | 109 | 'options' => array( |
110 | - 'enabled' => __( 'Enabled', 'give' ), |
|
111 | - 'disabled' => __( 'Disabled', 'give' ), |
|
110 | + 'enabled' => __('Enabled', 'give'), |
|
111 | + 'disabled' => __('Disabled', 'give'), |
|
112 | 112 | ), |
113 | 113 | ), |
114 | 114 | array( |
115 | 115 | 'name' => 'Give Cache', |
116 | 116 | 'id' => 'give-clear-cache', |
117 | - 'buttonTitle' => __( 'Clear Cache', 'give' ), |
|
118 | - 'desc' => __( 'Click this button if you want to clear Give\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give' ), |
|
117 | + 'buttonTitle' => __('Clear Cache', 'give'), |
|
118 | + 'desc' => __('Click this button if you want to clear Give\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give'), |
|
119 | 119 | 'type' => 'remove_cache_button' |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Advanced Settings Docs Link', 'give' ), |
|
122 | + 'name' => __('Advanced Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'advanced_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
125 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
125 | + 'title' => __('Advanced Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @since 2.0 |
140 | 140 | */ |
141 | - if ( apply_filters( 'give_settings_advanced_show_cache_setting', false ) ) { |
|
142 | - array_splice( $settings, 1, 0, array( |
|
141 | + if (apply_filters('give_settings_advanced_show_cache_setting', false)) { |
|
142 | + array_splice($settings, 1, 0, array( |
|
143 | 143 | array( |
144 | - 'name' => __( 'Cache', 'give' ), |
|
145 | - 'desc' => __( 'If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give' ), |
|
144 | + 'name' => __('Cache', 'give'), |
|
145 | + 'desc' => __('If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give'), |
|
146 | 146 | 'id' => 'cache', |
147 | 147 | 'type' => 'radio_inline', |
148 | 148 | 'default' => 'enabled', |
149 | 149 | 'options' => array( |
150 | - 'enabled' => __( 'Enabled', 'give' ), |
|
151 | - 'disabled' => __( 'Disabled', 'give' ), |
|
150 | + 'enabled' => __('Enabled', 'give'), |
|
151 | + 'disabled' => __('Disabled', 'give'), |
|
152 | 152 | ), |
153 | 153 | ) |
154 | - ) ); |
|
154 | + )); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * Filter the advanced settings. |
160 | 160 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
161 | 161 | */ |
162 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
162 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Filter the settings. |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @param array $settings |
170 | 170 | */ |
171 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
171 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
172 | 172 | |
173 | 173 | // Output. |
174 | 174 | return $settings; |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function get_sections() { |
184 | 184 | $sections = array( |
185 | - 'advanced-options' => __( 'Advanced Options', 'give' ), |
|
185 | + 'advanced-options' => __('Advanced Options', 'give'), |
|
186 | 186 | ); |
187 | 187 | |
188 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
188 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param array $field |
199 | 199 | */ |
200 | - public function render_remove_cache_button( $field ) { |
|
200 | + public function render_remove_cache_button($field) { |
|
201 | 201 | ?> |
202 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
202 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
203 | 203 | <th scope="row" class="titledesc"> |
204 | 204 | <label |
205 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
205 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
206 | 206 | </th> |
207 | 207 | <td class="give-forminp"> |
208 | - <button type="button" id="<?php echo esc_attr( $field['id'] ); ?>" |
|
209 | - class="button button-secondary"><?php echo esc_html( $field['buttonTitle'] ) ?></button> |
|
210 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
208 | + <button type="button" id="<?php echo esc_attr($field['id']); ?>" |
|
209 | + class="button button-secondary"><?php echo esc_html($field['buttonTitle']) ?></button> |
|
210 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
211 | 211 | </td> |
212 | 212 | </tr> |
213 | 213 | <?php |
@@ -222,23 +222,23 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @param array $options |
224 | 224 | */ |
225 | - public function validate_settngs( $options ) { |
|
225 | + public function validate_settngs($options) { |
|
226 | 226 | // Sanitize data. |
227 | - $akismet_spam_protection = isset( $options['akismet_spam_protection'] ) |
|
227 | + $akismet_spam_protection = isset($options['akismet_spam_protection']) |
|
228 | 228 | ? $options['akismet_spam_protection'] |
229 | - : ( give_check_akismet_key() ? 'enabled' : 'disabled' ); |
|
229 | + : (give_check_akismet_key() ? 'enabled' : 'disabled'); |
|
230 | 230 | |
231 | 231 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
232 | 232 | if ( |
233 | - give_is_setting_enabled( $akismet_spam_protection ) |
|
233 | + give_is_setting_enabled($akismet_spam_protection) |
|
234 | 234 | && ! give_check_akismet_key() |
235 | 235 | ) { |
236 | 236 | Give_Admin_Settings::add_error( |
237 | 237 | 'give-akismet-protection', |
238 | - __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) |
|
238 | + __('Please properly configure Akismet to enable SPAM protection.', 'give') |
|
239 | 239 | ); |
240 | 240 | |
241 | - give_update_option( 'akismet_spam_protection', 'disabled' ); |
|
241 | + give_update_option('akismet_spam_protection', 'disabled'); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array An array of updated action links. |
25 | 25 | */ |
26 | -function give_plugin_action_links( $actions ) { |
|
26 | +function give_plugin_action_links($actions) { |
|
27 | 27 | $new_actions = array( |
28 | 28 | 'settings' => sprintf( |
29 | 29 | '<a href="%1$s">%2$s</a>', |
30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
31 | - __( 'Settings', 'give' ) |
|
30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
31 | + __('Settings', 'give') |
|
32 | 32 | ), |
33 | 33 | ); |
34 | 34 | |
35 | - return array_merge( $new_actions, $actions ); |
|
35 | + return array_merge($new_actions, $actions); |
|
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array |
50 | 50 | */ |
51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
52 | - if ( GIVE_PLUGIN_BASENAME !== $plugin_file ) { |
|
51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
52 | + if (GIVE_PLUGIN_BASENAME !== $plugin_file) { |
|
53 | 53 | return $plugin_meta; |
54 | 54 | } |
55 | 55 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ), 'https://givewp.com/documentation/' |
66 | 66 | ) |
67 | 67 | ), |
68 | - __( 'Documentation', 'give' ) |
|
68 | + __('Documentation', 'give') |
|
69 | 69 | ), |
70 | 70 | sprintf( |
71 | 71 | '<a href="%1$s" target="_blank">%2$s</a>', |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | ), 'https://givewp.com/addons/' |
79 | 79 | ) |
80 | 80 | ), |
81 | - __( 'Add-ons', 'give' ) |
|
81 | + __('Add-ons', 'give') |
|
82 | 82 | ), |
83 | 83 | ); |
84 | 84 | |
85 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
85 | + return array_merge($plugin_meta, $new_meta_links); |
|
86 | 86 | } |
87 | 87 | |
88 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
88 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
@@ -103,19 +103,18 @@ discard block |
||
103 | 103 | $title = ''; |
104 | 104 | global $submenu, $plugin_page; |
105 | 105 | |
106 | - foreach ( array_keys( $submenu ) as $parent ) { |
|
107 | - if ( 'edit.php?post_type=give_forms' !== $parent ) { |
|
106 | + foreach (array_keys($submenu) as $parent) { |
|
107 | + if ('edit.php?post_type=give_forms' !== $parent) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - foreach ( $submenu[ $parent ] as $submenu_array ) { |
|
112 | - if ( $plugin_page !== $submenu_array[2] ) { |
|
111 | + foreach ($submenu[$parent] as $submenu_array) { |
|
112 | + if ($plugin_page !== $submenu_array[2]) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $title = isset( $submenu_array[0] ) ? |
|
117 | - $submenu_array[0] : |
|
118 | - $submenu_array[3]; |
|
116 | + $title = isset($submenu_array[0]) ? |
|
117 | + $submenu_array[0] : $submenu_array[3]; |
|
119 | 118 | } |
120 | 119 | } |
121 | 120 | |
@@ -129,11 +128,11 @@ discard block |
||
129 | 128 | */ |
130 | 129 | function give_recently_activated_addons() { |
131 | 130 | // Check if action is set. |
132 | - if ( isset( $_REQUEST['action'] ) ) { |
|
133 | - $plugin_action = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : ( isset( $_REQUEST['action2'] ) ? $_REQUEST['action2'] : '' ); |
|
131 | + if (isset($_REQUEST['action'])) { |
|
132 | + $plugin_action = ('-1' !== $_REQUEST['action']) ? $_REQUEST['action'] : (isset($_REQUEST['action2']) ? $_REQUEST['action2'] : ''); |
|
134 | 133 | $plugins = array(); |
135 | 134 | |
136 | - switch ( $plugin_action ) { |
|
135 | + switch ($plugin_action) { |
|
137 | 136 | case 'activate': // Single add-on activation. |
138 | 137 | $plugins[] = $_REQUEST['plugin']; |
139 | 138 | break; |
@@ -143,27 +142,27 @@ discard block |
||
143 | 142 | } |
144 | 143 | |
145 | 144 | |
146 | - if ( ! empty( $plugins ) ) { |
|
145 | + if ( ! empty($plugins)) { |
|
147 | 146 | |
148 | 147 | $give_addons = give_get_recently_activated_addons(); |
149 | 148 | |
150 | - foreach ( $plugins as $plugin ) { |
|
149 | + foreach ($plugins as $plugin) { |
|
151 | 150 | // Get plugins which has 'Give-' as prefix. |
152 | - if ( stripos( $plugin, 'Give-' ) !== false ) { |
|
151 | + if (stripos($plugin, 'Give-') !== false) { |
|
153 | 152 | $give_addons[] = $plugin; |
154 | 153 | } |
155 | 154 | } |
156 | 155 | |
157 | - if ( ! empty( $give_addons ) ) { |
|
156 | + if ( ! empty($give_addons)) { |
|
158 | 157 | // Update the Give's activated add-ons. |
159 | - update_option( 'give_recently_activated_addons', $give_addons, false ); |
|
158 | + update_option('give_recently_activated_addons', $give_addons, false); |
|
160 | 159 | } |
161 | 160 | } |
162 | 161 | } |
163 | 162 | } |
164 | 163 | |
165 | 164 | // Add add-on plugins to wp option table. |
166 | -add_action( 'activated_plugin', 'give_recently_activated_addons', 10 ); |
|
165 | +add_action('activated_plugin', 'give_recently_activated_addons', 10); |
|
167 | 166 | |
168 | 167 | /** |
169 | 168 | * Create new menu in plugin section that include all the add-on |
@@ -174,19 +173,19 @@ discard block |
||
174 | 173 | * |
175 | 174 | * @return mixed |
176 | 175 | */ |
177 | -function give_filter_addons_do_filter_addons( $plugin_menu ) { |
|
176 | +function give_filter_addons_do_filter_addons($plugin_menu) { |
|
178 | 177 | global $plugins; |
179 | 178 | |
180 | - foreach ( $plugins['all'] as $plugin_slug => $plugin_data ) { |
|
179 | + foreach ($plugins['all'] as $plugin_slug => $plugin_data) { |
|
181 | 180 | |
182 | - if ( false !== strpos( $plugin_data['Name'], 'Give' ) && false !== strpos( $plugin_data['AuthorName'], 'WordImpress' ) ) { |
|
183 | - $plugins['give'][ $plugin_slug ] = $plugins['all'][ $plugin_slug ]; |
|
184 | - $plugins['give'][ $plugin_slug ]['plugin'] = $plugin_slug; |
|
181 | + if (false !== strpos($plugin_data['Name'], 'Give') && false !== strpos($plugin_data['AuthorName'], 'WordImpress')) { |
|
182 | + $plugins['give'][$plugin_slug] = $plugins['all'][$plugin_slug]; |
|
183 | + $plugins['give'][$plugin_slug]['plugin'] = $plugin_slug; |
|
185 | 184 | // replicate the next step. |
186 | - if ( current_user_can( 'update_plugins' ) ) { |
|
187 | - $current = get_site_transient( 'update_plugins' ); |
|
188 | - if ( isset( $current->response[ $plugin_slug ] ) ) { |
|
189 | - $plugins['give'][ $plugin_slug ]['update'] = true; |
|
185 | + if (current_user_can('update_plugins')) { |
|
186 | + $current = get_site_transient('update_plugins'); |
|
187 | + if (isset($current->response[$plugin_slug])) { |
|
188 | + $plugins['give'][$plugin_slug]['update'] = true; |
|
190 | 189 | } |
191 | 190 | } |
192 | 191 | } |
@@ -196,8 +195,8 @@ discard block |
||
196 | 195 | |
197 | 196 | } |
198 | 197 | |
199 | -add_filter( 'show_advanced_plugins', 'give_filter_addons_do_filter_addons' ); |
|
200 | -add_filter( 'show_network_active_plugins', 'give_filter_addons_do_filter_addons' ); |
|
198 | +add_filter('show_advanced_plugins', 'give_filter_addons_do_filter_addons'); |
|
199 | +add_filter('show_network_active_plugins', 'give_filter_addons_do_filter_addons'); |
|
201 | 200 | |
202 | 201 | /** |
203 | 202 | * Keep activating the same add-on when admin activate or deactivate from Give Menu |
@@ -207,18 +206,18 @@ discard block |
||
207 | 206 | * @param $action |
208 | 207 | * @param $result |
209 | 208 | */ |
210 | -function give_prepare_filter_addons_referer( $action, $result ) { |
|
211 | - if ( ! function_exists( 'get_current_screen' ) ) { |
|
209 | +function give_prepare_filter_addons_referer($action, $result) { |
|
210 | + if ( ! function_exists('get_current_screen')) { |
|
212 | 211 | return; |
213 | 212 | } |
214 | 213 | $screen = get_current_screen(); |
215 | - if ( is_object( $screen ) && $screen->base === 'plugins' && ! empty( $_REQUEST['plugin_status'] ) && $_REQUEST['plugin_status'] === 'give' ) { |
|
214 | + if (is_object($screen) && $screen->base === 'plugins' && ! empty($_REQUEST['plugin_status']) && $_REQUEST['plugin_status'] === 'give') { |
|
216 | 215 | global $status; |
217 | 216 | $status = 'give'; |
218 | 217 | } |
219 | 218 | } |
220 | 219 | |
221 | -add_action( 'check_admin_referer', 'give_prepare_filter_addons_referer', 10, 2 ); |
|
220 | +add_action('check_admin_referer', 'give_prepare_filter_addons_referer', 10, 2); |
|
222 | 221 | |
223 | 222 | /** |
224 | 223 | * Make the Give Menu as an default menu and update the Menu Name |
@@ -229,30 +228,30 @@ discard block |
||
229 | 228 | * |
230 | 229 | * @return mixed |
231 | 230 | */ |
232 | -function give_filter_addons_filter_addons( $views ) { |
|
231 | +function give_filter_addons_filter_addons($views) { |
|
233 | 232 | |
234 | 233 | global $status, $plugins; |
235 | 234 | |
236 | - if ( ! empty( $plugins['give'] ) ) { |
|
235 | + if ( ! empty($plugins['give'])) { |
|
237 | 236 | $class = ''; |
238 | 237 | |
239 | - if ( 'give' === $status ) { |
|
238 | + if ('give' === $status) { |
|
240 | 239 | $class = 'current'; |
241 | 240 | } |
242 | 241 | |
243 | 242 | $views['give'] = sprintf( |
244 | 243 | '<a class="%s" href="plugins.php?plugin_status=give"> %s <span class="count">(%s) </span></a>', |
245 | 244 | $class, |
246 | - __( 'Give', 'give' ), |
|
247 | - count( $plugins['give'] ) |
|
245 | + __('Give', 'give'), |
|
246 | + count($plugins['give']) |
|
248 | 247 | ); |
249 | 248 | } |
250 | 249 | |
251 | 250 | return $views; |
252 | 251 | } |
253 | 252 | |
254 | -add_filter( 'views_plugins', 'give_filter_addons_filter_addons' ); |
|
255 | -add_filter( 'views_plugins-network', 'give_filter_addons_filter_addons' ); |
|
253 | +add_filter('views_plugins', 'give_filter_addons_filter_addons'); |
|
254 | +add_filter('views_plugins-network', 'give_filter_addons_filter_addons'); |
|
256 | 255 | |
257 | 256 | /** |
258 | 257 | * Set the Give as the Main menu when admin click on the Give Menu in Plugin section. |
@@ -263,17 +262,17 @@ discard block |
||
263 | 262 | * |
264 | 263 | * @return mixed |
265 | 264 | */ |
266 | -function give_prepare_filter_addons( $plugins ) { |
|
265 | +function give_prepare_filter_addons($plugins) { |
|
267 | 266 | global $status; |
268 | 267 | |
269 | - if ( isset( $_REQUEST['plugin_status'] ) && 'give' === $_REQUEST['plugin_status'] ) { |
|
268 | + if (isset($_REQUEST['plugin_status']) && 'give' === $_REQUEST['plugin_status']) { |
|
270 | 269 | $status = 'give'; |
271 | 270 | } |
272 | 271 | |
273 | 272 | return $plugins; |
274 | 273 | } |
275 | 274 | |
276 | -add_filter( 'all_plugins', 'give_prepare_filter_addons' ); |
|
275 | +add_filter('all_plugins', 'give_prepare_filter_addons'); |
|
277 | 276 | |
278 | 277 | |
279 | 278 | /** |
@@ -284,26 +283,26 @@ discard block |
||
284 | 283 | * |
285 | 284 | * @since 2.1 |
286 | 285 | */ |
287 | -function give_in_plugin_update_message( $data, $response ) { |
|
286 | +function give_in_plugin_update_message($data, $response) { |
|
288 | 287 | $new_version = $data['new_version']; |
289 | - $current_version_parts = explode( '.', GIVE_VERSION ); |
|
290 | - $new_version_parts = explode( '.', $new_version ); |
|
288 | + $current_version_parts = explode('.', GIVE_VERSION); |
|
289 | + $new_version_parts = explode('.', $new_version); |
|
291 | 290 | |
292 | 291 | // If it is a minor upgrade then return. |
293 | - if ( version_compare( $current_version_parts[0] . '.' . $current_version_parts[1], $new_version_parts[0] . '.' . $new_version_parts[1], '=' ) ) { |
|
292 | + if (version_compare($current_version_parts[0].'.'.$current_version_parts[1], $new_version_parts[0].'.'.$new_version_parts[1], '=')) { |
|
294 | 293 | |
295 | 294 | return; |
296 | 295 | } |
297 | 296 | |
298 | 297 | // Get the upgrade notice from the trunk. |
299 | - $upgrade_notice = give_get_plugin_upgrade_notice( $new_version ); |
|
298 | + $upgrade_notice = give_get_plugin_upgrade_notice($new_version); |
|
300 | 299 | |
301 | 300 | // Display upgrade notice. |
302 | - echo apply_filters( 'give_in_plugin_update_message', $upgrade_notice ? '</p>' . wp_kses_post( $upgrade_notice ) . '<p class="dummy">' : '' ); |
|
301 | + echo apply_filters('give_in_plugin_update_message', $upgrade_notice ? '</p>'.wp_kses_post($upgrade_notice).'<p class="dummy">' : ''); |
|
303 | 302 | } |
304 | 303 | |
305 | 304 | // Display upgrade notice. |
306 | -add_action( 'in_plugin_update_message-' . GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2 ); |
|
305 | +add_action('in_plugin_update_message-'.GIVE_PLUGIN_BASENAME, 'give_in_plugin_update_message', 10, 2); |
|
307 | 306 | |
308 | 307 | |
309 | 308 | /** |
@@ -317,18 +316,18 @@ discard block |
||
317 | 316 | * |
318 | 317 | * @return string |
319 | 318 | */ |
320 | -function give_get_plugin_upgrade_notice( $new_version ) { |
|
319 | +function give_get_plugin_upgrade_notice($new_version) { |
|
321 | 320 | |
322 | 321 | // Cache the upgrade notice. |
323 | 322 | $transient_name = "give_upgrade_notice_{$new_version}"; |
324 | - $upgrade_notice = get_transient( $transient_name ); |
|
323 | + $upgrade_notice = get_transient($transient_name); |
|
325 | 324 | |
326 | - if ( false === $upgrade_notice ) { |
|
327 | - $response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/give/trunk/readme.txt' ); |
|
325 | + if (false === $upgrade_notice) { |
|
326 | + $response = wp_safe_remote_get('https://plugins.svn.wordpress.org/give/trunk/readme.txt'); |
|
328 | 327 | |
329 | - if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) { |
|
330 | - $upgrade_notice = give_parse_plugin_update_notice( $response['body'], $new_version ); |
|
331 | - set_transient( $transient_name, $upgrade_notice, DAY_IN_SECONDS ); |
|
328 | + if ( ! is_wp_error($response) && ! empty($response['body'])) { |
|
329 | + $upgrade_notice = give_parse_plugin_update_notice($response['body'], $new_version); |
|
330 | + set_transient($transient_name, $upgrade_notice, DAY_IN_SECONDS); |
|
332 | 331 | } |
333 | 332 | } |
334 | 333 | |
@@ -348,46 +347,46 @@ discard block |
||
348 | 347 | * |
349 | 348 | * @return string |
350 | 349 | */ |
351 | -function give_parse_plugin_update_notice( $content, $new_version ) { |
|
352 | - $version_parts = explode( '.', $new_version ); |
|
350 | +function give_parse_plugin_update_notice($content, $new_version) { |
|
351 | + $version_parts = explode('.', $new_version); |
|
353 | 352 | $check_for_notices = array( |
354 | - $version_parts[0] . '.0', |
|
355 | - $version_parts[0] . '.0.0', |
|
356 | - $version_parts[0] . '.' . $version_parts[1] . '.' . '0', |
|
353 | + $version_parts[0].'.0', |
|
354 | + $version_parts[0].'.0.0', |
|
355 | + $version_parts[0].'.'.$version_parts[1].'.'.'0', |
|
357 | 356 | ); |
358 | 357 | |
359 | 358 | // Regex to extract Upgrade notice from the readme.txt file. |
360 | - $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis'; |
|
359 | + $notice_regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote($new_version).'\s*=|$)~Uis'; |
|
361 | 360 | |
362 | 361 | $upgrade_notice = ''; |
363 | 362 | |
364 | - foreach ( $check_for_notices as $check_version ) { |
|
365 | - if ( version_compare( GIVE_VERSION, $check_version, '>' ) ) { |
|
363 | + foreach ($check_for_notices as $check_version) { |
|
364 | + if (version_compare(GIVE_VERSION, $check_version, '>')) { |
|
366 | 365 | continue; |
367 | 366 | } |
368 | 367 | |
369 | 368 | $matches = null; |
370 | 369 | |
371 | - if ( preg_match( $notice_regexp, $content, $matches ) ) { |
|
372 | - $notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) ); |
|
370 | + if (preg_match($notice_regexp, $content, $matches)) { |
|
371 | + $notices = (array) preg_split('~[\r\n]+~', trim($matches[2])); |
|
373 | 372 | |
374 | - if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) { |
|
373 | + if (version_compare(trim($matches[1]), $check_version, '=')) { |
|
375 | 374 | $upgrade_notice .= '<p class="give-plugin-upgrade-notice">'; |
376 | 375 | |
377 | - foreach ( $notices as $index => $line ) { |
|
378 | - $upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ); |
|
376 | + foreach ($notices as $index => $line) { |
|
377 | + $upgrade_notice .= preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line); |
|
379 | 378 | } |
380 | 379 | |
381 | 380 | $upgrade_notice .= '</p>'; |
382 | 381 | } |
383 | 382 | |
384 | - if ( ! empty( $upgrade_notice ) ) { |
|
383 | + if ( ! empty($upgrade_notice)) { |
|
385 | 384 | break; |
386 | 385 | } |
387 | 386 | } |
388 | 387 | } |
389 | 388 | |
390 | - return wp_kses_post( $upgrade_notice ); |
|
389 | + return wp_kses_post($upgrade_notice); |
|
391 | 390 | } |
392 | 391 | |
393 | 392 | |
@@ -424,7 +423,7 @@ discard block |
||
424 | 423 | <?php |
425 | 424 | } |
426 | 425 | |
427 | -add_action( 'admin_head', 'give_plugin_notice_css' ); |
|
426 | +add_action('admin_head', 'give_plugin_notice_css'); |
|
428 | 427 | |
429 | 428 | /** |
430 | 429 | * Get list of add-on last activated. |
@@ -434,7 +433,7 @@ discard block |
||
434 | 433 | * @return mixed|array list of recently activated add-on |
435 | 434 | */ |
436 | 435 | function give_get_recently_activated_addons() { |
437 | - return get_option( 'give_recently_activated_addons', array() ); |
|
436 | + return get_option('give_recently_activated_addons', array()); |
|
438 | 437 | } |
439 | 438 | |
440 | 439 | /** |
@@ -452,34 +451,34 @@ discard block |
||
452 | 451 | ?> |
453 | 452 | |
454 | 453 | <h2 id="deactivation-survey-title"> |
455 | - <img src="<?php echo esc_url( GIVE_PLUGIN_URL ) ?>/assets/dist/images/give-icon-full-circle.svg"> |
|
456 | - <span><?php esc_html_e( 'Give Deactivation', 'give' ); ?></span> |
|
454 | + <img src="<?php echo esc_url(GIVE_PLUGIN_URL) ?>/assets/dist/images/give-icon-full-circle.svg"> |
|
455 | + <span><?php esc_html_e('Give Deactivation', 'give'); ?></span> |
|
457 | 456 | </h2> |
458 | 457 | <form class="deactivation-survey-form" method="POST"> |
459 | - <p><?php esc_html_e( 'If you have a moment, please let us know why you are deactivating Give. All submissions are anonymous and we only use this feedback to improve this plugin.', 'give' ); ?></p> |
|
458 | + <p><?php esc_html_e('If you have a moment, please let us know why you are deactivating Give. All submissions are anonymous and we only use this feedback to improve this plugin.', 'give'); ?></p> |
|
460 | 459 | |
461 | 460 | <div> |
462 | 461 | <label class="give-field-description"> |
463 | 462 | <input type="radio" name="give-survey-radios" value="1"> |
464 | - <?php esc_html_e( "I'm only deactivating temporarily", 'give' ); ?> |
|
463 | + <?php esc_html_e("I'm only deactivating temporarily", 'give'); ?> |
|
465 | 464 | </label> |
466 | 465 | </div> |
467 | 466 | |
468 | 467 | <div> |
469 | 468 | <label class="give-field-description"> |
470 | 469 | <input type="radio" name="give-survey-radios" value="2"> |
471 | - <?php esc_html_e( 'I no longer need the plugin', 'give' ); ?> |
|
470 | + <?php esc_html_e('I no longer need the plugin', 'give'); ?> |
|
472 | 471 | </label> |
473 | 472 | </div> |
474 | 473 | |
475 | 474 | <div> |
476 | 475 | <label class="give-field-description"> |
477 | 476 | <input type="radio" name="give-survey-radios" value="3" data-has-field="true"> |
478 | - <?php esc_html_e( 'I found a better plugin', 'give' ); ?> |
|
477 | + <?php esc_html_e('I found a better plugin', 'give'); ?> |
|
479 | 478 | </label> |
480 | 479 | |
481 | 480 | <div class="give-survey-extra-field"> |
482 | - <p><?php esc_html_e( 'What is the name of the plugin?', 'give' ); ?></p> |
|
481 | + <p><?php esc_html_e('What is the name of the plugin?', 'give'); ?></p> |
|
483 | 482 | <input type="text" name="user-reason" class="widefat"> |
484 | 483 | </div> |
485 | 484 | </div> |
@@ -487,23 +486,23 @@ discard block |
||
487 | 486 | <div> |
488 | 487 | <label class="give-field-description"> |
489 | 488 | <input type="radio" name="give-survey-radios" value="4"> |
490 | - <?php esc_html_e( 'I only needed the plugin for a short period', 'give' ); ?> |
|
489 | + <?php esc_html_e('I only needed the plugin for a short period', 'give'); ?> |
|
491 | 490 | </label> |
492 | 491 | </div> |
493 | 492 | |
494 | 493 | <div> |
495 | 494 | <label class="give-field-description"> |
496 | 495 | <input type="radio" name="give-survey-radios" value="5" data-has-field="true"> |
497 | - <?php esc_html_e( 'The plugin broke my site', 'give' ); ?> |
|
496 | + <?php esc_html_e('The plugin broke my site', 'give'); ?> |
|
498 | 497 | </label> |
499 | 498 | |
500 | 499 | <div class="give-survey-extra-field"> |
501 | 500 | <p><?php |
502 | 501 | printf( |
503 | 502 | '%1$s %2$s %3$s', |
504 | - __( "We're sorry to hear that, check", 'give' ), |
|
503 | + __("We're sorry to hear that, check", 'give'), |
|
505 | 504 | '<a href="https://wordpress.org/support/plugin/give">Give Support</a>.', |
506 | - __( 'Can you describe the issue?', 'give' ) |
|
505 | + __('Can you describe the issue?', 'give') |
|
507 | 506 | ); |
508 | 507 | ?> |
509 | 508 | </p> |
@@ -514,16 +513,16 @@ discard block |
||
514 | 513 | <div> |
515 | 514 | <label class="give-field-description"> |
516 | 515 | <input type="radio" name="give-survey-radios" value="6" data-has-field="true"> |
517 | - <?php esc_html_e( 'The plugin suddenly stopped working', 'give' ); ?> |
|
516 | + <?php esc_html_e('The plugin suddenly stopped working', 'give'); ?> |
|
518 | 517 | </label> |
519 | 518 | |
520 | 519 | <div class="give-survey-extra-field"> |
521 | 520 | <p><?php |
522 | 521 | printf( |
523 | 522 | '%1$s %2$s %3$s', |
524 | - __( "We're sorry to hear that, check", 'give' ), |
|
523 | + __("We're sorry to hear that, check", 'give'), |
|
525 | 524 | '<a href="https://wordpress.org/support/plugin/give">Give Support</a>.', |
526 | - __( 'Can you describe the issue?', 'give' ) |
|
525 | + __('Can you describe the issue?', 'give') |
|
527 | 526 | ); |
528 | 527 | ?> |
529 | 528 | </p> |
@@ -534,11 +533,11 @@ discard block |
||
534 | 533 | <div> |
535 | 534 | <label class="give-field-description"> |
536 | 535 | <input type="radio" name="give-survey-radios" value="7" data-has-field="true"> |
537 | - <?php esc_html_e( 'Other', 'give' ); ?> |
|
536 | + <?php esc_html_e('Other', 'give'); ?> |
|
538 | 537 | </label> |
539 | 538 | |
540 | 539 | <div class="give-survey-extra-field"> |
541 | - <p><?php esc_html_e( "Please describe why you're deactivating Give", 'give' ); ?></p> |
|
540 | + <p><?php esc_html_e("Please describe why you're deactivating Give", 'give'); ?></p> |
|
542 | 541 | <textarea disabled name="user-reason" class="widefat" rows="6"></textarea disabled> |
543 | 542 | </div> |
544 | 543 | </div> |
@@ -547,10 +546,10 @@ discard block |
||
547 | 546 | <p> |
548 | 547 | <label> |
549 | 548 | <input type="checkbox" name="confirm_reset_store" value="1"> |
550 | - <?php esc_html_e( 'Would you like to delete all Give data?', 'give' ); ?> |
|
549 | + <?php esc_html_e('Would you like to delete all Give data?', 'give'); ?> |
|
551 | 550 | </label> |
552 | 551 | <section class="give-field-description"> |
553 | - <?php esc_html_e( 'By default the custom roles, Give options, and database entries are not deleted when you deactivate Give. If you are deleting Give completely from your website and want those items removed as well check this option. Note: This will permanently delete all Give data from your database.', 'give' ); ?> |
|
552 | + <?php esc_html_e('By default the custom roles, Give options, and database entries are not deleted when you deactivate Give. If you are deleting Give completely from your website and want those items removed as well check this option. Note: This will permanently delete all Give data from your database.', 'give'); ?> |
|
554 | 553 | </section> |
555 | 554 | </p> |
556 | 555 | </div> |
@@ -559,9 +558,9 @@ discard block |
||
559 | 558 | $current_user_email = $current_user->user_email; |
560 | 559 | ?> |
561 | 560 | <input type="hidden" name="current-user-email" value="<?php echo $current_user_email; ?>"> |
562 | - <input type="hidden" name="current-site-url" value="<?php echo esc_url( get_bloginfo( 'url' ) ); ?>"> |
|
561 | + <input type="hidden" name="current-site-url" value="<?php echo esc_url(get_bloginfo('url')); ?>"> |
|
563 | 562 | <input type="hidden" name="give-export-class" value="Give_Tools_Reset_Stats"> |
564 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
563 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
565 | 564 | </form> |
566 | 565 | |
567 | 566 | <?php |
@@ -574,10 +573,10 @@ discard block |
||
574 | 573 | |
575 | 574 | $results['html'] = $output; |
576 | 575 | |
577 | - wp_send_json( $results ); |
|
576 | + wp_send_json($results); |
|
578 | 577 | } |
579 | 578 | |
580 | -add_action( 'wp_ajax_give_deactivation_popup', 'give_deactivation_popup' ); |
|
579 | +add_action('wp_ajax_give_deactivation_popup', 'give_deactivation_popup'); |
|
581 | 580 | |
582 | 581 | /** |
583 | 582 | * Ajax callback after the deactivation survey form has been submitted. |
@@ -587,27 +586,27 @@ discard block |
||
587 | 586 | */ |
588 | 587 | function give_deactivation_form_submit() { |
589 | 588 | |
590 | - if ( ! check_ajax_referer( 'deactivation_survey_nonce', 'nonce', false ) ) { |
|
589 | + if ( ! check_ajax_referer('deactivation_survey_nonce', 'nonce', false)) { |
|
591 | 590 | wp_send_json_error(); |
592 | 591 | wp_die(); |
593 | 592 | } |
594 | 593 | |
595 | - $form_data = give_clean( wp_parse_args( $_POST['form-data'] ) ); |
|
594 | + $form_data = give_clean(wp_parse_args($_POST['form-data'])); |
|
596 | 595 | |
597 | 596 | // Get the selected radio value. |
598 | - $radio_value = isset( $form_data['give-survey-radios'] ) ? $form_data['give-survey-radios'] : 0; |
|
597 | + $radio_value = isset($form_data['give-survey-radios']) ? $form_data['give-survey-radios'] : 0; |
|
599 | 598 | |
600 | 599 | // Get the reason if any radio button has an optional text field. |
601 | - $user_reason = isset( $form_data['user-reason'] ) ? $form_data['user-reason'] : ''; |
|
600 | + $user_reason = isset($form_data['user-reason']) ? $form_data['user-reason'] : ''; |
|
602 | 601 | |
603 | 602 | // Get the email of the user who deactivated the plugin. |
604 | - $user_email = isset( $form_data['current-user-email'] ) ? $form_data['current-user-email'] : ''; |
|
603 | + $user_email = isset($form_data['current-user-email']) ? $form_data['current-user-email'] : ''; |
|
605 | 604 | |
606 | 605 | // Get the URL of the website on which Give plugin is being deactivated. |
607 | - $site_url = isset( $form_data['current-site-url'] ) ? $form_data['current-site-url'] : ''; |
|
606 | + $site_url = isset($form_data['current-site-url']) ? $form_data['current-site-url'] : ''; |
|
608 | 607 | |
609 | 608 | // Get the value of the checkbox for deleting Give's data. |
610 | - $delete_data = isset( $form_data['confirm_reset_store'] ) ? $form_data['confirm_reset_store'] : ''; |
|
609 | + $delete_data = isset($form_data['confirm_reset_store']) ? $form_data['confirm_reset_store'] : ''; |
|
611 | 610 | |
612 | 611 | /** |
613 | 612 | * Make a POST request to the endpoint to send the survey data. |
@@ -625,10 +624,10 @@ discard block |
||
625 | 624 | ); |
626 | 625 | |
627 | 626 | // Check if the data is sent and stored correctly. |
628 | - $response = wp_remote_retrieve_body( $response ); |
|
627 | + $response = wp_remote_retrieve_body($response); |
|
629 | 628 | |
630 | - if ( 'true' === $response ) { |
|
631 | - if ( '1' === $delete_data ) { |
|
629 | + if ('true' === $response) { |
|
630 | + if ('1' === $delete_data) { |
|
632 | 631 | wp_send_json_success( |
633 | 632 | array( |
634 | 633 | 'delete_data' => true, |
@@ -648,4 +647,4 @@ discard block |
||
648 | 647 | wp_die(); |
649 | 648 | } |
650 | 649 | |
651 | -add_action( 'wp_ajax_deactivation_form_submit', 'give_deactivation_form_submit' ); |
|
650 | +add_action('wp_ajax_deactivation_form_submit', 'give_deactivation_form_submit'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string |
27 | 27 | */ |
28 | -function __give_get_format_address( $address, $address_args = array() ) { |
|
28 | +function __give_get_format_address($address, $address_args = array()) { |
|
29 | 29 | $address_html = ''; |
30 | 30 | $address_args = wp_parse_args( |
31 | 31 | $address_args, |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $address_id = $address_args['type']; |
41 | 41 | |
42 | 42 | // Bailout. |
43 | - if ( empty( $address ) || ! is_array( $address ) ) { |
|
43 | + if (empty($address) || ! is_array($address)) { |
|
44 | 44 | return $address_html; |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $address_html .= sprintf( |
50 | 50 | '<span data-address-type="line1">%1$s</span>%2$s', |
51 | 51 | $address['line1'], |
52 | - ( ! empty( $address['line2'] ) ? '<br>' : '' ) |
|
52 | + ( ! empty($address['line2']) ? '<br>' : '') |
|
53 | 53 | ); |
54 | 54 | $address_html .= sprintf( |
55 | 55 | '<span data-address-type="line2">%1$s</span>%2$s', |
56 | 56 | $address['line2'], |
57 | - ( ! empty( $address['city'] ) ? '<br>' : '' ) |
|
57 | + ( ! empty($address['city']) ? '<br>' : '') |
|
58 | 58 | ); |
59 | 59 | $address_html .= sprintf( |
60 | 60 | '<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
61 | 61 | $address['city'], |
62 | - ( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
|
63 | - ( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
|
64 | - ( ! empty( $address['country'] ) ? '<br>' : '' ) |
|
62 | + ( ! empty($address['state']) ? ", {$address['state']}" : ''), |
|
63 | + ( ! empty($address['zip']) ? " {$address['zip']}" : ''), |
|
64 | + ( ! empty($address['country']) ? '<br>' : '') |
|
65 | 65 | ); |
66 | 66 | $address_html .= sprintf( |
67 | 67 | '<span data-address-type="country">%s</span><br>', |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | // Address action. |
72 | 72 | $address_html .= sprintf( |
73 | 73 | '<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
74 | - __( 'Edit', 'give' ), |
|
75 | - __( 'Remove', 'give' ) |
|
74 | + __('Edit', 'give'), |
|
75 | + __('Remove', 'give') |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 2.0 |
82 | 82 | */ |
83 | - $address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
|
83 | + $address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args); |
|
84 | 84 | |
85 | 85 | // Set unique id and index for multi type address. |
86 | - if ( isset( $address_args['index'] ) ) { |
|
86 | + if (isset($address_args['index'])) { |
|
87 | 87 | $address_label = "{$address_label} #{$address_args['index']}"; |
88 | 88 | } |
89 | 89 | |
90 | - if ( isset( $address_args['id'] ) ) { |
|
90 | + if (isset($address_args['id'])) { |
|
91 | 91 | $address_id = "{$address_id}_{$address_args['id']}"; |
92 | 92 | } |
93 | 93 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function give_donors_page() { |
114 | 114 | $default_views = give_donor_views(); |
115 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
116 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
117 | - give_render_donor_view( $requested_view, $default_views ); |
|
115 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
116 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
117 | + give_render_donor_view($requested_view, $default_views); |
|
118 | 118 | } else { |
119 | 119 | give_donors_list(); |
120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $views = array(); |
132 | 132 | |
133 | - return apply_filters( 'give_donor_views', $views ); |
|
133 | + return apply_filters('give_donor_views', $views); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $tabs = array(); |
146 | 146 | |
147 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
147 | + return apply_filters('give_donor_tabs', $tabs); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_donors_list() { |
158 | 158 | |
159 | - include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
|
159 | + include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php'; |
|
160 | 160 | |
161 | 161 | $donors_table = new Give_Donor_List_Table(); |
162 | 162 | $donors_table->prepare_items(); |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_donors_table_top' ); |
|
172 | + do_action('give_donors_table_top'); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <hr class="wp-header-end"> |
176 | 176 | <form id="give-donors-search-filter" method="get" |
177 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
178 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
177 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
178 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
179 | 179 | <input type="hidden" name="post_type" value="give_forms"/> |
180 | 180 | <input type="hidden" name="page" value="give-donors"/> |
181 | 181 | <input type="hidden" name="view" value="donors"/> |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @since 1.0 |
194 | 194 | */ |
195 | - do_action( 'give_donors_table_bottom' ); |
|
195 | + do_action('give_donors_table_bottom'); |
|
196 | 196 | ?> |
197 | 197 | </div> |
198 | 198 | <?php |
@@ -208,33 +208,33 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return void |
210 | 210 | */ |
211 | -function give_render_donor_view( $view, $callbacks ) { |
|
211 | +function give_render_donor_view($view, $callbacks) { |
|
212 | 212 | |
213 | 213 | $render = true; |
214 | 214 | |
215 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
215 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
216 | 216 | |
217 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
218 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
217 | + if ( ! current_user_can($donor_view_role)) { |
|
218 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
219 | 219 | $render = false; |
220 | 220 | } |
221 | 221 | |
222 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
223 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
222 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
223 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
224 | 224 | $render = false; |
225 | 225 | } |
226 | 226 | |
227 | 227 | $donor_id = (int) $_GET['id']; |
228 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
229 | - $donor = new Give_Donor( $donor_id ); |
|
228 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
229 | + $donor = new Give_Donor($donor_id); |
|
230 | 230 | |
231 | 231 | // Reconnect User with Donor profile. |
232 | - if ( $reconnect_user_id ) { |
|
233 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
232 | + if ($reconnect_user_id) { |
|
233 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
234 | 234 | } |
235 | 235 | |
236 | - if ( empty( $donor->id ) ) { |
|
237 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
236 | + if (empty($donor->id)) { |
|
237 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
238 | 238 | $render = false; |
239 | 239 | } |
240 | 240 | |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | |
244 | 244 | <div class='wrap'> |
245 | 245 | |
246 | - <?php if ( give_get_errors() ) : ?> |
|
246 | + <?php if (give_get_errors()) : ?> |
|
247 | 247 | <div class="error settings-error"> |
248 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
248 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
249 | 249 | </div> |
250 | 250 | <?php endif; ?> |
251 | 251 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | <?php |
254 | 254 | printf( |
255 | 255 | /* translators: %s: donor first name */ |
256 | - __( 'Edit Donor: %s %s', 'give' ), |
|
256 | + __('Edit Donor: %s %s', 'give'), |
|
257 | 257 | $donor->get_first_name(), |
258 | 258 | $donor->get_last_name() |
259 | 259 | ); |
@@ -262,26 +262,26 @@ discard block |
||
262 | 262 | |
263 | 263 | <hr class="wp-header-end"> |
264 | 264 | |
265 | - <?php if ( $donor && $render ) : ?> |
|
265 | + <?php if ($donor && $render) : ?> |
|
266 | 266 | |
267 | 267 | <h2 class="nav-tab-wrapper"> |
268 | 268 | <?php |
269 | - foreach ( $donor_tabs as $key => $tab ) : |
|
269 | + foreach ($donor_tabs as $key => $tab) : |
|
270 | 270 | $active = $key === $view ? true : false; |
271 | 271 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
272 | 272 | printf( |
273 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
274 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
275 | - esc_attr( $class ), |
|
276 | - sanitize_html_class( $tab['dashicon'] ), |
|
277 | - esc_html( $tab['title'] ) |
|
273 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
274 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
275 | + esc_attr($class), |
|
276 | + sanitize_html_class($tab['dashicon']), |
|
277 | + esc_html($tab['title']) |
|
278 | 278 | ); |
279 | 279 | endforeach; |
280 | 280 | ?> |
281 | 281 | </h2> |
282 | 282 | |
283 | 283 | <div id="give-donor-card-wrapper"> |
284 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
284 | + <?php $callbacks[$view]($donor) ?> |
|
285 | 285 | </div> |
286 | 286 | |
287 | 287 | <?php endif; ?> |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return void |
303 | 303 | */ |
304 | -function give_donor_view( $donor ) { |
|
304 | +function give_donor_view($donor) { |
|
305 | 305 | |
306 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
306 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
307 | 307 | |
308 | 308 | /** |
309 | 309 | * Fires in donor profile screen, above the donor card. |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @param object $donor The donor object being displayed. |
314 | 314 | */ |
315 | - do_action( 'give_donor_card_top', $donor ); |
|
315 | + do_action('give_donor_card_top', $donor); |
|
316 | 316 | |
317 | 317 | // Set Read only to the fields which needs to be locked. |
318 | 318 | $read_only = ''; |
319 | - if ( $donor->user_id ) { |
|
319 | + if ($donor->user_id) { |
|
320 | 320 | $read_only = 'readonly="readonly"'; |
321 | 321 | } |
322 | 322 | |
@@ -324,28 +324,28 @@ discard block |
||
324 | 324 | $title_prefixes = give_get_name_title_prefixes(); |
325 | 325 | |
326 | 326 | // Prepend title prefix to name if it is set. |
327 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
328 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
327 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
328 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
329 | 329 | ?> |
330 | 330 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
331 | 331 | <form id="edit-donor-info" method="post" |
332 | - action="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); ?>"> |
|
332 | + action="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); ?>"> |
|
333 | 333 | <div class="donor-info"> |
334 | 334 | <div class="donor-bio-header clearfix"> |
335 | 335 | <div class="avatar-wrap left" id="donor-avatar"> |
336 | - <?php echo get_avatar( $donor->email ); ?> |
|
336 | + <?php echo get_avatar($donor->email); ?> |
|
337 | 337 | </div> |
338 | 338 | <div id="donor-name-wrap" class="left"> |
339 | 339 | <span class="donor-name info-item edit-item"> |
340 | 340 | <select name="donor_info[title]"> |
341 | - <option disabled value="0"><?php esc_html_e( 'Title', 'give' ); ?></option> |
|
341 | + <option disabled value="0"><?php esc_html_e('Title', 'give'); ?></option> |
|
342 | 342 | <?php |
343 | - if ( is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { |
|
344 | - foreach ( $title_prefixes as $title ) { |
|
343 | + if (is_array($title_prefixes) && count($title_prefixes) > 0) { |
|
344 | + foreach ($title_prefixes as $title) { |
|
345 | 345 | echo sprintf( |
346 | 346 | '<option %1$s value="%2$s">%2$s</option>', |
347 | - selected( $title_prefix, $title, false ), |
|
348 | - esc_html( $title ) |
|
347 | + selected($title_prefix, $title, false), |
|
348 | + esc_html($title) |
|
349 | 349 | ); |
350 | 350 | } |
351 | 351 | } |
@@ -353,34 +353,34 @@ discard block |
||
353 | 353 | </select> |
354 | 354 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
355 | 355 | name="donor_info[first_name]" type="text" |
356 | - value="<?php echo esc_html( $donor->get_first_name() ); ?>" |
|
357 | - placeholder="<?php esc_html_e( 'First Name', 'give' ); ?>"/> |
|
358 | - <?php if ( $donor->user_id ) : ?> |
|
356 | + value="<?php echo esc_html($donor->get_first_name()); ?>" |
|
357 | + placeholder="<?php esc_html_e('First Name', 'give'); ?>"/> |
|
358 | + <?php if ($donor->user_id) : ?> |
|
359 | 359 | <a href="#" class="give-lock-block"> |
360 | 360 | <i class="give-icon give-icon-locked"></i> |
361 | 361 | </a> |
362 | 362 | <?php endif; ?> |
363 | 363 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
364 | 364 | name="donor_info[last_name]" type="text" |
365 | - value="<?php echo esc_html( $donor->get_last_name() ); ?>" |
|
366 | - placeholder="<?php esc_html_e( 'Last Name', 'give' ); ?>"/> |
|
367 | - <?php if ( $donor->user_id ) : ?> |
|
365 | + value="<?php echo esc_html($donor->get_last_name()); ?>" |
|
366 | + placeholder="<?php esc_html_e('Last Name', 'give'); ?>"/> |
|
367 | + <?php if ($donor->user_id) : ?> |
|
368 | 368 | <a href="#" class="give-lock-block"> |
369 | 369 | <i class="give-icon give-icon-locked"></i> |
370 | 370 | </a> |
371 | 371 | <?php endif; ?> |
372 | 372 | </span> |
373 | 373 | <span class="donor-name info-item editable"> |
374 | - <span data-key="name"><?php echo esc_html( $donor->name ); ?></span> |
|
374 | + <span data-key="name"><?php echo esc_html($donor->name); ?></span> |
|
375 | 375 | </span> |
376 | 376 | </div> |
377 | 377 | <p class="donor-since info-item"> |
378 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
379 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
378 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
379 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
380 | 380 | </p> |
381 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
381 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
382 | 382 | <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"> |
383 | - <?php esc_html_e( 'Edit Donor', 'give' ); ?> |
|
383 | + <?php esc_html_e('Edit Donor', 'give'); ?> |
|
384 | 384 | </a> |
385 | 385 | <?php endif; ?> |
386 | 386 | </div> |
@@ -391,12 +391,12 @@ discard block |
||
391 | 391 | <table class="widefat striped"> |
392 | 392 | <tbody> |
393 | 393 | <tr> |
394 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'Donor ID:', 'give' ); ?></label> |
|
394 | + <th scope="col"><label for="tablecell"><?php esc_html_e('Donor ID:', 'give'); ?></label> |
|
395 | 395 | </th> |
396 | - <td><?php echo intval( $donor->id ); ?></td> |
|
396 | + <td><?php echo intval($donor->id); ?></td> |
|
397 | 397 | </tr> |
398 | 398 | <tr> |
399 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label> |
|
399 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label> |
|
400 | 400 | </th> |
401 | 401 | <td> |
402 | 402 | <span class="donor-user-id info-item edit-item"> |
@@ -414,24 +414,24 @@ discard block |
||
414 | 414 | 'data' => $data_atts, |
415 | 415 | ); |
416 | 416 | |
417 | - if ( ! empty( $user_id ) ) { |
|
418 | - $userdata = get_userdata( $user_id ); |
|
417 | + if ( ! empty($user_id)) { |
|
418 | + $userdata = get_userdata($user_id); |
|
419 | 419 | $user_args['selected'] = $user_id; |
420 | 420 | } |
421 | 421 | |
422 | - echo Give()->html->ajax_user_search( $user_args ); |
|
422 | + echo Give()->html->ajax_user_search($user_args); |
|
423 | 423 | ?> |
424 | 424 | </span> |
425 | 425 | |
426 | 426 | <span class="donor-user-id info-item editable"> |
427 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
427 | + <?php if ( ! empty($userdata)) : ?> |
|
428 | 428 | <span |
429 | - data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
429 | + data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
430 | 430 | <?php else : ?> |
431 | 431 | <span |
432 | - data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
|
432 | + data-key="user_id"><?php esc_html_e('Unregistered', 'give'); ?></span> |
|
433 | 433 | <?php endif; ?> |
434 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
|
434 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) : |
|
435 | 435 | |
436 | 436 | echo sprintf( |
437 | 437 | '- <span class="disconnect-user"> |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | <span class="view-user-profile"> |
441 | 441 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
442 | 442 | </span>', |
443 | - esc_html__( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
444 | - esc_html__( 'Disconnect User', 'give' ), |
|
445 | - esc_url( 'user-edit.php?user_id=' . $donor->user_id ), |
|
446 | - esc_html__( 'View User Profile of current user ID.', 'give' ), |
|
447 | - esc_html__( 'View User Profile', 'give' ) |
|
443 | + esc_html__('Disconnects the current user ID from this donor record.', 'give'), |
|
444 | + esc_html__('Disconnect User', 'give'), |
|
445 | + esc_url('user-edit.php?user_id='.$donor->user_id), |
|
446 | + esc_html__('View User Profile of current user ID.', 'give'), |
|
447 | + esc_html__('View User Profile', 'give') |
|
448 | 448 | ); |
449 | 449 | |
450 | 450 | endif; ?> |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | </tr> |
454 | 454 | |
455 | 455 | <?php |
456 | - $donor_company = $donor->get_meta( '_give_donor_company', true ); |
|
456 | + $donor_company = $donor->get_meta('_give_donor_company', true); |
|
457 | 457 | ?> |
458 | 458 | <tr class="alternate"> |
459 | 459 | <th scope="col"> |
460 | - <label for="tablecell"><?php esc_html_e( 'Company Name:', 'give' ); ?></label> |
|
460 | + <label for="tablecell"><?php esc_html_e('Company Name:', 'give'); ?></label> |
|
461 | 461 | </th> |
462 | 462 | <td> |
463 | 463 | <span class="donor-user-id info-item edit-item"> |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | </td> |
471 | 471 | </tr> |
472 | 472 | |
473 | - <?php $anonymous_donor = absint( $donor->get_meta( '_give_anonymous_donor', true ) ); ?> |
|
473 | + <?php $anonymous_donor = absint($donor->get_meta('_give_anonymous_donor', true)); ?> |
|
474 | 474 | <tr class="alternate"> |
475 | 475 | <th scope="col"> |
476 | - <label for="tablecell"><?php _e( 'Anonymous Donor:', 'give' ); ?></label> |
|
476 | + <label for="tablecell"><?php _e('Anonymous Donor:', 'give'); ?></label> |
|
477 | 477 | </th> |
478 | 478 | <td> |
479 | 479 | <span class="donor-anonymous-donor info-item edit-item"> |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | name="give_anonymous_donor" |
485 | 485 | value="1" |
486 | 486 | type="radio" |
487 | - <?php checked( 1, $anonymous_donor ) ?> |
|
488 | - ><?php _e( 'Yes', 'give' ); ?> |
|
487 | + <?php checked(1, $anonymous_donor) ?> |
|
488 | + ><?php _e('Yes', 'give'); ?> |
|
489 | 489 | </label> |
490 | 490 | </li> |
491 | 491 | <li> |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | name="give_anonymous_donor" |
495 | 495 | value="0" |
496 | 496 | type="radio" |
497 | - <?php checked( 0, $anonymous_donor ) ?> |
|
498 | - ><?php _e( 'No', 'give' ); ?> |
|
497 | + <?php checked(0, $anonymous_donor) ?> |
|
498 | + ><?php _e('No', 'give'); ?> |
|
499 | 499 | </label> |
500 | 500 | </li> |
501 | 501 | </ul> |
502 | 502 | </span> |
503 | 503 | <span class="donor-anonymous-donor info-item editable"> |
504 | - <?php echo( $anonymous_donor ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ); ?> |
|
504 | + <?php echo($anonymous_donor ? __('Yes', 'give') : __('No', 'give')); ?> |
|
505 | 505 | </span> |
506 | 506 | </td> |
507 | 507 | </tr> |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | </div> |
514 | 514 | |
515 | 515 | <span id="donor-edit-actions" class="edit-item"> |
516 | - <input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval( $donor->id ); ?>"/> |
|
517 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
516 | + <input type="hidden" data-key="id" name="donor_info[id]" value="<?php echo intval($donor->id); ?>"/> |
|
517 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
518 | 518 | <input type="hidden" name="give_action" value="edit-donor"/> |
519 | 519 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
520 | - value="<?php esc_html_e( 'Update Donor', 'give' ); ?>"/> |
|
521 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
520 | + value="<?php esc_html_e('Update Donor', 'give'); ?>"/> |
|
521 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
522 | 522 | </span> |
523 | 523 | |
524 | 524 | </form> |
@@ -533,24 +533,24 @@ discard block |
||
533 | 533 | * |
534 | 534 | * @param Give_Donor $donor The donor object being displayed. |
535 | 535 | */ |
536 | - do_action( 'give_donor_before_stats', $donor ); |
|
536 | + do_action('give_donor_before_stats', $donor); |
|
537 | 537 | ?> |
538 | 538 | |
539 | 539 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
540 | 540 | <ul> |
541 | 541 | <li> |
542 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
542 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
543 | 543 | <span class="dashicons dashicons-heart"></span> |
544 | 544 | <?php |
545 | 545 | // Completed Donations. |
546 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
547 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
546 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
547 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
548 | 548 | ?> |
549 | 549 | </a> |
550 | 550 | </li> |
551 | 551 | <li> |
552 | 552 | <span class="dashicons dashicons-chart-area"></span> |
553 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
553 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
554 | 554 | </li> |
555 | 555 | <?php |
556 | 556 | /** |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @param object $donor The donor object being displayed. |
564 | 564 | */ |
565 | - do_action( 'give_donor_stats_list', $donor ); |
|
565 | + do_action('give_donor_stats_list', $donor); |
|
566 | 566 | ?> |
567 | 567 | </ul> |
568 | 568 | </div> |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @param Give_Donor $donor The donor object being displayed. |
577 | 577 | */ |
578 | - do_action( 'give_donor_before_address', $donor ); |
|
578 | + do_action('give_donor_before_address', $donor); |
|
579 | 579 | ?> |
580 | 580 | |
581 | 581 | <div id="donor-address-wrapper" class="donor-section clear"> |
582 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
582 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
583 | 583 | |
584 | 584 | <div class="postbox"> |
585 | 585 | <div class="give-spinner-wrapper"> |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | <div class="all-address"> |
590 | 590 | <div class="give-grid-row"> |
591 | 591 | <?php |
592 | - if ( ! empty( $donor->address ) ) : |
|
592 | + if ( ! empty($donor->address)) : |
|
593 | 593 | // Default address always will be at zero array index. |
594 | 594 | $is_set_as_default = null; |
595 | 595 | |
596 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
596 | + foreach ($donor->address as $address_type => $addresses) { |
|
597 | 597 | |
598 | - switch ( true ) { |
|
599 | - case is_array( end( $addresses ) ): |
|
598 | + switch (true) { |
|
599 | + case is_array(end($addresses)): |
|
600 | 600 | $index = 1; |
601 | - foreach ( $addresses as $id => $address ) { |
|
601 | + foreach ($addresses as $id => $address) { |
|
602 | 602 | echo __give_get_format_address( |
603 | 603 | $address, |
604 | 604 | array( |
@@ -608,11 +608,11 @@ discard block |
||
608 | 608 | ) |
609 | 609 | ); |
610 | 610 | |
611 | - $index ++; |
|
611 | + $index++; |
|
612 | 612 | } |
613 | 613 | break; |
614 | 614 | |
615 | - case is_string( end( $addresses ) ): |
|
615 | + case is_string(end($addresses)): |
|
616 | 616 | echo __give_get_format_address( |
617 | 617 | $addresses, |
618 | 618 | array( |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | endif; |
626 | 626 | ?> |
627 | 627 | </div> |
628 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
628 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
629 | 629 | echo ' give-hidden'; |
630 | 630 | } ?>"> |
631 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
631 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
632 | 632 | </span> |
633 | 633 | <button class="button add-new-address"> |
634 | - <?php _e( 'Add Address', 'give' ); ?> |
|
634 | + <?php _e('Add Address', 'give'); ?> |
|
635 | 635 | </button> |
636 | 636 | </div> |
637 | 637 | |
@@ -641,26 +641,26 @@ discard block |
||
641 | 641 | <tbody> |
642 | 642 | <tr> |
643 | 643 | <th class="col"> |
644 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
644 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
645 | 645 | </th> |
646 | 646 | <td> |
647 | 647 | <?php |
648 | - echo Give()->html->select( array( |
|
648 | + echo Give()->html->select(array( |
|
649 | 649 | 'options' => give_get_country_list(), |
650 | 650 | 'name' => 'country', |
651 | - 'selected' => give_get_option( 'base_country' ), |
|
651 | + 'selected' => give_get_option('base_country'), |
|
652 | 652 | 'show_option_all' => false, |
653 | 653 | 'show_option_none' => false, |
654 | 654 | 'chosen' => true, |
655 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
656 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
657 | - ) ); |
|
655 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
656 | + 'data' => array('search-type' => 'no_ajax'), |
|
657 | + )); |
|
658 | 658 | ?> |
659 | 659 | </td> |
660 | 660 | </tr> |
661 | 661 | <tr> |
662 | 662 | <th class="col"> |
663 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
663 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
664 | 664 | </th> |
665 | 665 | <td> |
666 | 666 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | </tr> |
669 | 669 | <tr> |
670 | 670 | <th class="col"> |
671 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
671 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
672 | 672 | </th> |
673 | 673 | <td> |
674 | 674 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | </tr> |
678 | 678 | <tr> |
679 | 679 | <th class="col"> |
680 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
680 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
681 | 681 | </th> |
682 | 682 | <td> |
683 | 683 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -685,42 +685,42 @@ discard block |
||
685 | 685 | </tr> |
686 | 686 | <?php |
687 | 687 | $no_states_country = give_no_states_country_list(); |
688 | - $base_country = give_get_option( 'base_country' ); |
|
689 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
688 | + $base_country = give_get_option('base_country'); |
|
689 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
690 | 690 | ?> |
691 | 691 | <tr class="give-field-wrap"> |
692 | 692 | <th class="col"> |
693 | 693 | <label |
694 | - for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
694 | + for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
695 | 695 | </th> |
696 | 696 | <td> |
697 | 697 | <?php |
698 | - $states = give_get_states( $base_country ); |
|
698 | + $states = give_get_states($base_country); |
|
699 | 699 | $state_args = array( |
700 | 700 | 'name' => 'state', |
701 | 701 | 'class' => 'regular-text', |
702 | 702 | ); |
703 | 703 | |
704 | - if ( empty( $states ) ) { |
|
704 | + if (empty($states)) { |
|
705 | 705 | |
706 | 706 | // Show Text field, if empty states. |
707 | - $state_args = wp_parse_args( $state_args, array( |
|
708 | - 'value' => give_get_option( 'base_state' ), |
|
709 | - ) ); |
|
710 | - echo Give()->html->text( $state_args ); |
|
707 | + $state_args = wp_parse_args($state_args, array( |
|
708 | + 'value' => give_get_option('base_state'), |
|
709 | + )); |
|
710 | + echo Give()->html->text($state_args); |
|
711 | 711 | } else { |
712 | 712 | |
713 | 713 | // Show Chosen DropDown, if states are not empty. |
714 | - $state_args = wp_parse_args( $state_args, array( |
|
714 | + $state_args = wp_parse_args($state_args, array( |
|
715 | 715 | 'options' => $states, |
716 | - 'selected' => give_get_option( 'base_state' ), |
|
716 | + 'selected' => give_get_option('base_state'), |
|
717 | 717 | 'show_option_all' => false, |
718 | 718 | 'show_option_none' => false, |
719 | 719 | 'chosen' => true, |
720 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
721 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
722 | - ) ); |
|
723 | - echo Give()->html->select( $state_args ); |
|
720 | + 'placeholder' => __('Select a state', 'give'), |
|
721 | + 'data' => array('search-type' => 'no_ajax'), |
|
722 | + )); |
|
723 | + echo Give()->html->select($state_args); |
|
724 | 724 | } |
725 | 725 | ?> |
726 | 726 | </td> |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | ?> |
731 | 731 | <tr> |
732 | 732 | <th class="col"> |
733 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
733 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
734 | 734 | </th> |
735 | 735 | <td> |
736 | 736 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | </tr> |
739 | 739 | <tr> |
740 | 740 | <td colspan="2"> |
741 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
741 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
742 | 742 | <input type="hidden" name="address-action" value="add"> |
743 | 743 | <input type="hidden" name="address-id" value=""> |
744 | 744 | <input type="submit" class="button button-primary js-save" |
745 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
746 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
745 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
746 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
747 | 747 | </td> |
748 | 748 | </tr> |
749 | 749 | </tbody> |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @param Give_Donor $donor The donor object being displayed. |
764 | 764 | */ |
765 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
765 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
766 | 766 | ?> |
767 | 767 | |
768 | 768 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -775,46 +775,46 @@ discard block |
||
775 | 775 | * |
776 | 776 | * @param object $donor The donor object being displayed. |
777 | 777 | */ |
778 | - do_action( 'give_donor_before_tables', $donor ); |
|
778 | + do_action('give_donor_before_tables', $donor); |
|
779 | 779 | ?> |
780 | 780 | |
781 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
781 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
782 | 782 | |
783 | 783 | <table class="wp-list-table widefat striped emails"> |
784 | 784 | <thead> |
785 | 785 | <tr> |
786 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
787 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
786 | + <th><?php _e('Email', 'give'); ?></th> |
|
787 | + <th><?php _e('Actions', 'give'); ?></th> |
|
788 | 788 | </tr> |
789 | 789 | </thead> |
790 | 790 | |
791 | 791 | <tbody> |
792 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
792 | + <?php if ( ! empty($donor->emails)) { ?> |
|
793 | 793 | |
794 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
794 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
795 | 795 | <tr data-key="<?php echo $key; ?>"> |
796 | 796 | <td> |
797 | 797 | <?php echo $email; ?> |
798 | - <?php if ( 'primary' === $key ) : ?> |
|
798 | + <?php if ('primary' === $key) : ?> |
|
799 | 799 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
800 | 800 | <?php endif; ?> |
801 | 801 | </td> |
802 | 802 | <td> |
803 | - <?php if ( 'primary' !== $key ) : ?> |
|
803 | + <?php if ('primary' !== $key) : ?> |
|
804 | 804 | <?php |
805 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
806 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
807 | - 'email' => rawurlencode( $email ), |
|
805 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
806 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
807 | + 'email' => rawurlencode($email), |
|
808 | 808 | 'give_action' => 'set_donor_primary_email', |
809 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
810 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
811 | - 'email' => rawurlencode( $email ), |
|
809 | + ), $base_url), 'give-set-donor-primary-email'); |
|
810 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
811 | + 'email' => rawurlencode($email), |
|
812 | 812 | 'give_action' => 'remove_donor_email', |
813 | - ), $base_url ), 'give-remove-donor-email' ); |
|
813 | + ), $base_url), 'give-remove-donor-email'); |
|
814 | 814 | ?> |
815 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
815 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
816 | 816 | | |
817 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
817 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
818 | 818 | <?php endif; ?> |
819 | 819 | </td> |
820 | 820 | </tr> |
@@ -824,14 +824,14 @@ discard block |
||
824 | 824 | <td colspan="2" class="add-donor-email-td"> |
825 | 825 | <div class="add-donor-email-wrapper"> |
826 | 826 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
827 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
827 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
828 | 828 | <input type="email" name="additional-email" value="" |
829 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
829 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
830 | 830 | <input type="checkbox" name="make-additional-primary" value="1" |
831 | 831 | id="make-additional-primary"/> <label |
832 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
832 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
833 | 833 | <button class="button-secondary give-add-donor-email" |
834 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
834 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
835 | 835 | <span class="spinner"></span> |
836 | 836 | </div> |
837 | 837 | <div class="notice-wrap"></div> |
@@ -839,54 +839,54 @@ discard block |
||
839 | 839 | </tr> |
840 | 840 | <?php } else { ?> |
841 | 841 | <tr> |
842 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
842 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
843 | 843 | </tr> |
844 | 844 | <?php }// End if(). |
845 | 845 | ?> |
846 | 846 | </tbody> |
847 | 847 | </table> |
848 | 848 | |
849 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
849 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
850 | 850 | <?php |
851 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
852 | - $payments = give_get_payments( array( |
|
851 | + $payment_ids = explode(',', $donor->payment_ids); |
|
852 | + $payments = give_get_payments(array( |
|
853 | 853 | 'post__in' => $payment_ids, |
854 | - ) ); |
|
855 | - $payments = array_slice( $payments, 0, 10 ); |
|
854 | + )); |
|
855 | + $payments = array_slice($payments, 0, 10); |
|
856 | 856 | ?> |
857 | 857 | <table class="wp-list-table widefat striped payments"> |
858 | 858 | <thead> |
859 | 859 | <tr> |
860 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
861 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
862 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
863 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
864 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
860 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
861 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
862 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
863 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
864 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
865 | 865 | </tr> |
866 | 866 | </thead> |
867 | 867 | <tbody> |
868 | - <?php if ( ! empty( $payments ) ) { ?> |
|
869 | - <?php foreach ( $payments as $payment ) : ?> |
|
868 | + <?php if ( ! empty($payments)) { ?> |
|
869 | + <?php foreach ($payments as $payment) : ?> |
|
870 | 870 | <tr> |
871 | - <td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td> |
|
872 | - <td><?php echo give_donation_amount( $payment->ID, array( |
|
871 | + <td><?php echo Give()->seq_donation_number->get_serial_code($payment->ID); ?></td> |
|
872 | + <td><?php echo give_donation_amount($payment->ID, array( |
|
873 | 873 | 'currency' => true, |
874 | 874 | 'amount' => true, |
875 | 875 | 'type' => 'donor' |
876 | - ) ); ?></td> |
|
877 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
878 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
876 | + )); ?></td> |
|
877 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
878 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
879 | 879 | <td> |
880 | 880 | <?php |
881 | 881 | printf( |
882 | 882 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
883 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
883 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
884 | 884 | sprintf( |
885 | 885 | /* translators: %s: Donation ID */ |
886 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
886 | + esc_attr__('View Donation %s.', 'give'), |
|
887 | 887 | $payment->ID |
888 | 888 | ), |
889 | - __( 'View Donation', 'give' ) |
|
889 | + __('View Donation', 'give') |
|
890 | 890 | ); |
891 | 891 | ?> |
892 | 892 | |
@@ -901,47 +901,47 @@ discard block |
||
901 | 901 | * @param object $donor The donor object being displayed. |
902 | 902 | * @param object $payment The payment object being displayed. |
903 | 903 | */ |
904 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
904 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
905 | 905 | ?> |
906 | 906 | </td> |
907 | 907 | </tr> |
908 | 908 | <?php endforeach; ?> |
909 | 909 | <?php } else { ?> |
910 | 910 | <tr> |
911 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
911 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
912 | 912 | </tr> |
913 | 913 | <?php }// End if(). |
914 | 914 | ?> |
915 | 915 | </tbody> |
916 | 916 | </table> |
917 | 917 | |
918 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
918 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
919 | 919 | <?php |
920 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
920 | + $donations = give_get_users_completed_donations($donor->email); |
|
921 | 921 | ?> |
922 | 922 | <table class="wp-list-table widefat striped donations"> |
923 | 923 | <thead> |
924 | 924 | <tr> |
925 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
926 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
925 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
926 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
927 | 927 | </tr> |
928 | 928 | </thead> |
929 | 929 | <tbody> |
930 | - <?php if ( ! empty( $donations ) ) { ?> |
|
931 | - <?php foreach ( $donations as $donation ) : ?> |
|
930 | + <?php if ( ! empty($donations)) { ?> |
|
931 | + <?php foreach ($donations as $donation) : ?> |
|
932 | 932 | <tr> |
933 | 933 | <td><?php echo $donation->post_title; ?></td> |
934 | 934 | <td> |
935 | 935 | <?php |
936 | 936 | printf( |
937 | 937 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
938 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
938 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
939 | 939 | sprintf( |
940 | 940 | /* translators: %s: form name */ |
941 | - esc_attr__( 'View Form %s.', 'give' ), |
|
941 | + esc_attr__('View Form %s.', 'give'), |
|
942 | 942 | $donation->post_title |
943 | 943 | ), |
944 | - __( 'View Form', 'give' ) |
|
944 | + __('View Form', 'give') |
|
945 | 945 | ); |
946 | 946 | ?> |
947 | 947 | </td> |
@@ -949,62 +949,62 @@ discard block |
||
949 | 949 | <?php endforeach; ?> |
950 | 950 | <?php } else { ?> |
951 | 951 | <tr> |
952 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
952 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
953 | 953 | </tr> |
954 | 954 | <?php } ?> |
955 | 955 | </tbody> |
956 | 956 | </table> |
957 | 957 | |
958 | - <h3><?php _e( 'Comments', 'give' ); ?></h3> |
|
958 | + <h3><?php _e('Comments', 'give'); ?></h3> |
|
959 | 959 | <?php |
960 | 960 | // @todo load comment by ajax to improve performance. |
961 | - $donations = give_get_users_donations( $donor->email ); |
|
961 | + $donations = give_get_users_donations($donor->email); |
|
962 | 962 | ?> |
963 | 963 | <table class="wp-list-table widefat striped comments"> |
964 | 964 | <thead> |
965 | 965 | <tr> |
966 | - <th scope="col"><?php _e( 'Donation', 'give' ); ?></th> |
|
967 | - <th scope="col"><?php _e( 'Anonymous', 'give' ); ?></th> |
|
968 | - <th scope="col" colspan="3"><?php _e( 'Comment', 'give' ); ?></th> |
|
966 | + <th scope="col"><?php _e('Donation', 'give'); ?></th> |
|
967 | + <th scope="col"><?php _e('Anonymous', 'give'); ?></th> |
|
968 | + <th scope="col" colspan="3"><?php _e('Comment', 'give'); ?></th> |
|
969 | 969 | </tr> |
970 | 970 | </thead> |
971 | 971 | <tbody> |
972 | - <?php if ( ! empty( $donations ) ) : ?> |
|
973 | - <?php foreach ( $donations as $donation ) : ?> |
|
972 | + <?php if ( ! empty($donations)) : ?> |
|
973 | + <?php foreach ($donations as $donation) : ?> |
|
974 | 974 | <?php |
975 | - $comment = give_get_donor_donation_comment( $donation->ID, give_get_payment_donor_id( $donation->ID ) ); |
|
975 | + $comment = give_get_donor_donation_comment($donation->ID, give_get_payment_donor_id($donation->ID)); |
|
976 | 976 | |
977 | - if ( ! $comment instanceof WP_Comment ) { |
|
977 | + if ( ! $comment instanceof WP_Comment) { |
|
978 | 978 | continue; |
979 | 979 | } |
980 | 980 | ?> |
981 | 981 | <tr> |
982 | 982 | <td> |
983 | 983 | <?php |
984 | - $donation_number = Give()->seq_donation_number->get_serial_code( $donation ); |
|
984 | + $donation_number = Give()->seq_donation_number->get_serial_code($donation); |
|
985 | 985 | echo $donation_number; |
986 | 986 | ?> |
987 | 987 | </td> |
988 | 988 | <td> |
989 | 989 | <?php |
990 | - echo absint( give_get_payment_meta( $donation->ID, '_give_anonymous_donation' ) ) |
|
991 | - ? __( 'Yes', 'give' ) |
|
992 | - : __( 'No', 'give' ); |
|
990 | + echo absint(give_get_payment_meta($donation->ID, '_give_anonymous_donation')) |
|
991 | + ? __('Yes', 'give') |
|
992 | + : __('No', 'give'); |
|
993 | 993 | ?> |
994 | 994 | </td> |
995 | 995 | <td> |
996 | 996 | <?php |
997 | - echo apply_filters( 'the_content', $comment->comment_content ); |
|
997 | + echo apply_filters('the_content', $comment->comment_content); |
|
998 | 998 | |
999 | 999 | echo sprintf( |
1000 | 1000 | '<a href="%1$s" aria-label="%2$s" target="_blank">%3$s</a>', |
1001 | - admin_url( "edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id={$donation->ID}#give-payment-donor-comment" ), |
|
1001 | + admin_url("edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id={$donation->ID}#give-payment-donor-comment"), |
|
1002 | 1002 | sprintf( |
1003 | 1003 | /* translators: %s: Comment ID */ |
1004 | - esc_attr__( 'Edit Comment %s.', 'give' ), |
|
1004 | + esc_attr__('Edit Comment %s.', 'give'), |
|
1005 | 1005 | $comment->comment_ID |
1006 | 1006 | ), |
1007 | - __( 'Edit Comment', 'give' ) |
|
1007 | + __('Edit Comment', 'give') |
|
1008 | 1008 | ); |
1009 | 1009 | ?> |
1010 | 1010 | </td> |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | <?php endforeach; ?> |
1013 | 1013 | <?php else: ?> |
1014 | 1014 | <tr> |
1015 | - <td colspan="5"><?php _e( 'No comment found.', 'give' ); ?></td> |
|
1015 | + <td colspan="5"><?php _e('No comment found.', 'give'); ?></td> |
|
1016 | 1016 | </tr> |
1017 | 1017 | <?php endif ?> |
1018 | 1018 | </tbody> |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | * |
1027 | 1027 | * @param object $donor The donor object being displayed. |
1028 | 1028 | */ |
1029 | - do_action( 'give_donor_after_tables', $donor ); |
|
1029 | + do_action('give_donor_after_tables', $donor); |
|
1030 | 1030 | ?> |
1031 | 1031 | |
1032 | 1032 | </div> |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | * |
1040 | 1040 | * @param object $donor The donor object being displayed. |
1041 | 1041 | */ |
1042 | - do_action( 'give_donor_card_bottom', $donor ); |
|
1042 | + do_action('give_donor_card_bottom', $donor); |
|
1043 | 1043 | |
1044 | 1044 | } |
1045 | 1045 | |
@@ -1052,31 +1052,31 @@ discard block |
||
1052 | 1052 | * |
1053 | 1053 | * @return void |
1054 | 1054 | */ |
1055 | -function give_donor_notes_view( $donor ) { |
|
1055 | +function give_donor_notes_view($donor) { |
|
1056 | 1056 | |
1057 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
1058 | - $paged = absint( $paged ); |
|
1057 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
1058 | + $paged = absint($paged); |
|
1059 | 1059 | $note_count = $donor->get_notes_count(); |
1060 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
1061 | - $total_pages = ceil( $note_count / $per_page ); |
|
1062 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
1060 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
1061 | + $total_pages = ceil($note_count / $per_page); |
|
1062 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
1063 | 1063 | ?> |
1064 | 1064 | |
1065 | 1065 | <div id="donor-notes-wrapper"> |
1066 | 1066 | <div class="donor-notes-header"> |
1067 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1067 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1068 | 1068 | </div> |
1069 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
1069 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
1070 | 1070 | |
1071 | - <?php if ( 1 == $paged ) : ?> |
|
1071 | + <?php if (1 == $paged) : ?> |
|
1072 | 1072 | <div style="display: block; margin-bottom: 55px;"> |
1073 | 1073 | <form id="give-add-donor-note" method="post" |
1074 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
1074 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
1075 | 1075 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
1076 | 1076 | <br/> |
1077 | 1077 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
1078 | 1078 | <input type="hidden" name="give_action" value="add-donor-note"/> |
1079 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
1079 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
1080 | 1080 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
1081 | 1081 | </form> |
1082 | 1082 | </div> |
@@ -1091,26 +1091,26 @@ discard block |
||
1091 | 1091 | 'show_all' => true, |
1092 | 1092 | ); |
1093 | 1093 | |
1094 | - echo paginate_links( $pagination_args ); |
|
1094 | + echo paginate_links($pagination_args); |
|
1095 | 1095 | ?> |
1096 | 1096 | |
1097 | 1097 | <div id="give-donor-notes" class="postbox"> |
1098 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
1099 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
1098 | + <?php if (count($donor_notes) > 0) { ?> |
|
1099 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
1100 | 1100 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
1101 | 1101 | <span class="note-content-wrap"> |
1102 | - <?php echo stripslashes( $note ); ?> |
|
1102 | + <?php echo stripslashes($note); ?> |
|
1103 | 1103 | </span> |
1104 | 1104 | </div> |
1105 | 1105 | <?php endforeach; ?> |
1106 | 1106 | <?php } else { ?> |
1107 | 1107 | <div class="give-no-donor-notes"> |
1108 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
1108 | + <?php _e('No donor notes found.', 'give'); ?> |
|
1109 | 1109 | </div> |
1110 | 1110 | <?php } ?> |
1111 | 1111 | </div> |
1112 | 1112 | |
1113 | - <?php echo paginate_links( $pagination_args ); ?> |
|
1113 | + <?php echo paginate_links($pagination_args); ?> |
|
1114 | 1114 | |
1115 | 1115 | </div> |
1116 | 1116 | |
@@ -1126,9 +1126,9 @@ discard block |
||
1126 | 1126 | * |
1127 | 1127 | * @return void |
1128 | 1128 | */ |
1129 | -function give_donor_delete_view( $donor ) { |
|
1129 | +function give_donor_delete_view($donor) { |
|
1130 | 1130 | |
1131 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
1131 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
1132 | 1132 | |
1133 | 1133 | /** |
1134 | 1134 | * Fires in donor delete screen, above the content. |
@@ -1137,16 +1137,16 @@ discard block |
||
1137 | 1137 | * |
1138 | 1138 | * @param object $donor The donor object being displayed. |
1139 | 1139 | */ |
1140 | - do_action( 'give_donor_delete_top', $donor ); |
|
1140 | + do_action('give_donor_delete_top', $donor); |
|
1141 | 1141 | ?> |
1142 | 1142 | |
1143 | 1143 | <div class="info-wrapper donor-section"> |
1144 | 1144 | |
1145 | 1145 | <form id="delete-donor" method="post" |
1146 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
1146 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
1147 | 1147 | |
1148 | 1148 | <div class="donor-notes-header"> |
1149 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1149 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1150 | 1150 | </div> |
1151 | 1151 | |
1152 | 1152 | |
@@ -1154,22 +1154,22 @@ discard block |
||
1154 | 1154 | |
1155 | 1155 | <span class="delete-donor-options"> |
1156 | 1156 | <p> |
1157 | - <?php echo Give()->html->checkbox( array( |
|
1157 | + <?php echo Give()->html->checkbox(array( |
|
1158 | 1158 | 'name' => 'give-donor-delete-confirm', |
1159 | - ) ); ?> |
|
1159 | + )); ?> |
|
1160 | 1160 | <label |
1161 | - for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
1161 | + for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
1162 | 1162 | </p> |
1163 | 1163 | |
1164 | 1164 | <p> |
1165 | - <?php echo Give()->html->checkbox( array( |
|
1165 | + <?php echo Give()->html->checkbox(array( |
|
1166 | 1166 | 'name' => 'give-donor-delete-records', |
1167 | 1167 | 'options' => array( |
1168 | 1168 | 'disabled' => true, |
1169 | 1169 | ), |
1170 | - ) ); ?> |
|
1170 | + )); ?> |
|
1171 | 1171 | <label |
1172 | - for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
1172 | + for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
1173 | 1173 | </p> |
1174 | 1174 | |
1175 | 1175 | <?php |
@@ -1182,19 +1182,19 @@ discard block |
||
1182 | 1182 | * |
1183 | 1183 | * @param object $donor The donor object being displayed. |
1184 | 1184 | */ |
1185 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
1185 | + do_action('give_donor_delete_inputs', $donor); |
|
1186 | 1186 | ?> |
1187 | 1187 | </span> |
1188 | 1188 | |
1189 | 1189 | <span id="donor-edit-actions"> |
1190 | 1190 | <input type="hidden" name="donor_id" value="<?php echo $donor->id; ?>"/> |
1191 | - <?php wp_nonce_field( 'give-delete-donor', '_wpnonce', false, true ); ?> |
|
1191 | + <?php wp_nonce_field('give-delete-donor', '_wpnonce', false, true); ?> |
|
1192 | 1192 | <input type="hidden" name="give_action" value="delete_donor"/> |
1193 | 1193 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
1194 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
1194 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
1195 | 1195 | <a id="give-delete-donor-cancel" |
1196 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
1197 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
1196 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
1197 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
1198 | 1198 | </span> |
1199 | 1199 | |
1200 | 1200 | </div> |
@@ -1210,5 +1210,5 @@ discard block |
||
1210 | 1210 | * |
1211 | 1211 | * @param object $donor The donor object being displayed. |
1212 | 1212 | */ |
1213 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
1213 | + do_action('give_donor_delete_bottom', $donor); |
|
1214 | 1214 | } |
@@ -427,9 +427,12 @@ discard block |
||
427 | 427 | <?php if ( ! empty( $userdata ) ) : ?> |
428 | 428 | <span |
429 | 429 | data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
430 | - <?php else : ?> |
|
430 | + <?php else { |
|
431 | + : ?> |
|
431 | 432 | <span |
432 | - data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); ?></span> |
|
433 | + data-key="user_id"><?php esc_html_e( 'Unregistered', 'give' ); |
|
434 | +} |
|
435 | +?></span> |
|
433 | 436 | <?php endif; ?> |
434 | 437 | <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) : |
435 | 438 | |
@@ -1010,9 +1013,12 @@ discard block |
||
1010 | 1013 | </td> |
1011 | 1014 | </tr> |
1012 | 1015 | <?php endforeach; ?> |
1013 | - <?php else: ?> |
|
1016 | + <?php else { |
|
1017 | + : ?> |
|
1014 | 1018 | <tr> |
1015 | - <td colspan="5"><?php _e( 'No comment found.', 'give' ); ?></td> |
|
1019 | + <td colspan="5"><?php _e( 'No comment found.', 'give' ); |
|
1020 | +} |
|
1021 | +?></td> |
|
1016 | 1022 | </tr> |
1017 | 1023 | <?php endif ?> |
1018 | 1024 | </tbody> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * Constructor. |
51 | 51 | */ |
52 | - public function __construct( $_step = 1 ) { |
|
53 | - parent::__construct( $_step ); |
|
52 | + public function __construct($_step = 1) { |
|
53 | + parent::__construct($_step); |
|
54 | 54 | |
55 | 55 | $this->is_writable = true; |
56 | 56 | } |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | public function get_data() { |
68 | 68 | global $wpdb; |
69 | 69 | |
70 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
70 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
71 | 71 | |
72 | - if ( ! is_array( $items ) ) { |
|
72 | + if ( ! is_array($items)) { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
77 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
76 | + $offset = ($this->step - 1) * $this->per_step; |
|
77 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
78 | 78 | |
79 | - if ( $step_items ) { |
|
79 | + if ($step_items) { |
|
80 | 80 | |
81 | 81 | $step_ids = array( |
82 | 82 | 'customers' => array(), |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | 'other' => array(), |
85 | 85 | ); |
86 | 86 | |
87 | - foreach ( $step_items as $item ) { |
|
87 | + foreach ($step_items as $item) { |
|
88 | 88 | |
89 | - switch ( $item['type'] ) { |
|
89 | + switch ($item['type']) { |
|
90 | 90 | case 'customer': |
91 | 91 | $step_ids['customers'][] = $item['id']; |
92 | 92 | break; |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | $step_ids['give_forms'][] = $item['id']; |
95 | 95 | break; |
96 | 96 | default: |
97 | - $item_type = apply_filters( 'give_reset_item_type', 'other', $item ); |
|
98 | - $step_ids[ $item_type ][] = $item['id']; |
|
97 | + $item_type = apply_filters('give_reset_item_type', 'other', $item); |
|
98 | + $step_ids[$item_type][] = $item['id']; |
|
99 | 99 | break; |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | $sql = array(); |
104 | - $meta_table = __give_v20_bc_table_details('form' ); |
|
104 | + $meta_table = __give_v20_bc_table_details('form'); |
|
105 | 105 | |
106 | - foreach ( $step_ids as $type => $ids ) { |
|
106 | + foreach ($step_ids as $type => $ids) { |
|
107 | 107 | |
108 | - if ( empty( $ids ) ) { |
|
108 | + if (empty($ids)) { |
|
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | |
112 | - $ids = implode( ',', $ids ); |
|
112 | + $ids = implode(',', $ids); |
|
113 | 113 | |
114 | - switch ( $type ) { |
|
114 | + switch ($type) { |
|
115 | 115 | case 'customers': |
116 | 116 | $sql[] = "DELETE FROM $wpdb->donors WHERE id IN ($ids)"; |
117 | 117 | $table_name = $wpdb->donors; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | OR $wpdb->term_taxonomy.taxonomy = %s |
140 | 140 | ) |
141 | 141 | ", |
142 | - array( 'give_forms_category', 'give_forms_tag' ) |
|
142 | + array('give_forms_category', 'give_forms_tag') |
|
143 | 143 | ); |
144 | 144 | $sql[] = $wpdb->prepare( |
145 | 145 | " |
@@ -147,21 +147,21 @@ discard block |
||
147 | 147 | WHERE $wpdb->term_taxonomy.taxonomy = %s |
148 | 148 | OR $wpdb->term_taxonomy.taxonomy = %s |
149 | 149 | ", |
150 | - array( 'give_forms_category', 'give_forms_tag' ) |
|
150 | + array('give_forms_category', 'give_forms_tag') |
|
151 | 151 | ); |
152 | 152 | break; |
153 | 153 | } |
154 | 154 | |
155 | - if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) { |
|
155 | + if ( ! in_array($type, array('customers', 'forms', 'other'))) { |
|
156 | 156 | // Allows other types of custom post types to filter on their own post_type |
157 | 157 | // and add items to the query list, for the IDs found in their post type. |
158 | - $sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids ); |
|
158 | + $sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - if ( ! empty( $sql ) ) { |
|
163 | - foreach ( $sql as $query ) { |
|
164 | - $wpdb->query( $query ); |
|
162 | + if ( ! empty($sql)) { |
|
163 | + foreach ($sql as $query) { |
|
164 | + $wpdb->query($query); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -181,16 +181,16 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function get_percentage_complete() { |
183 | 183 | |
184 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
185 | - $total = count( $items ); |
|
184 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
185 | + $total = count($items); |
|
186 | 186 | |
187 | 187 | $percentage = 100; |
188 | 188 | |
189 | - if ( $total > 0 ) { |
|
190 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
189 | + if ($total > 0) { |
|
190 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
191 | 191 | } |
192 | 192 | |
193 | - if ( $percentage > 100 ) { |
|
193 | + if ($percentage > 100) { |
|
194 | 194 | $percentage = 100; |
195 | 195 | } |
196 | 196 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @param array $request The Form Data passed into the batch processing. |
206 | 206 | */ |
207 | - public function set_properties( $request ) { |
|
207 | + public function set_properties($request) { |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -215,26 +215,26 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function process_step() { |
217 | 217 | |
218 | - if ( ! $this->can_export() ) { |
|
219 | - wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
218 | + if ( ! $this->can_export()) { |
|
219 | + wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array( |
|
220 | 220 | 'response' => 403, |
221 | - ) ); |
|
221 | + )); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | $had_data = $this->get_data(); |
225 | 225 | |
226 | - if ( $had_data ) { |
|
226 | + if ($had_data) { |
|
227 | 227 | $this->done = false; |
228 | 228 | |
229 | 229 | return true; |
230 | 230 | } else { |
231 | - update_option( 'give_earnings_total', 0, false ); |
|
232 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
231 | + update_option('give_earnings_total', 0, false); |
|
232 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
233 | 233 | |
234 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
234 | + $this->delete_data('give_temp_reset_ids'); |
|
235 | 235 | |
236 | 236 | $this->done = true; |
237 | - $this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' ); |
|
237 | + $this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give'); |
|
238 | 238 | |
239 | 239 | return false; |
240 | 240 | } |
@@ -267,26 +267,26 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function pre_fetch() { |
269 | 269 | |
270 | - if ( $this->step == 1 ) { |
|
271 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
270 | + if ($this->step == 1) { |
|
271 | + $this->delete_data('give_temp_reset_ids'); |
|
272 | 272 | } |
273 | 273 | |
274 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
274 | + $items = get_option('give_temp_reset_ids', false); |
|
275 | 275 | |
276 | - if ( false === $items ) { |
|
276 | + if (false === $items) { |
|
277 | 277 | $items = array(); |
278 | 278 | |
279 | - $give_types_for_reset = array( 'give_forms', 'give_payment' ); |
|
280 | - $give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset ); |
|
279 | + $give_types_for_reset = array('give_forms', 'give_payment'); |
|
280 | + $give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset); |
|
281 | 281 | |
282 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
282 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
283 | 283 | 'post_type' => $give_types_for_reset, |
284 | 284 | 'post_status' => 'any', |
285 | - 'posts_per_page' => - 1, |
|
286 | - ) ); |
|
285 | + 'posts_per_page' => -1, |
|
286 | + )); |
|
287 | 287 | |
288 | - $posts = get_posts( $args ); |
|
289 | - foreach ( $posts as $post ) { |
|
288 | + $posts = get_posts($args); |
|
289 | + foreach ($posts as $post) { |
|
290 | 290 | $items[] = array( |
291 | 291 | 'id' => (int) $post->ID, |
292 | 292 | 'type' => $post->post_type, |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | $donor_args = array( |
297 | - 'number' => - 1, |
|
297 | + 'number' => -1, |
|
298 | 298 | ); |
299 | - $donors = Give()->donors->get_donors( $donor_args ); |
|
300 | - foreach ( $donors as $donor ) { |
|
299 | + $donors = Give()->donors->get_donors($donor_args); |
|
300 | + foreach ($donors as $donor) { |
|
301 | 301 | $items[] = array( |
302 | 302 | 'id' => (int) $donor->id, |
303 | 303 | 'type' => 'customer', |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | |
307 | 307 | // Allow filtering of items to remove with an unassociative array for each item |
308 | 308 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
309 | - $items = apply_filters( 'give_reset_items', $items ); |
|
309 | + $items = apply_filters('give_reset_items', $items); |
|
310 | 310 | |
311 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
311 | + $this->store_data('give_temp_reset_ids', $items); |
|
312 | 312 | }// End if(). |
313 | 313 | |
314 | 314 | } |
@@ -322,17 +322,17 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return mixed Returns the data from the database. |
324 | 324 | */ |
325 | - private function get_stored_data( $key ) { |
|
325 | + private function get_stored_data($key) { |
|
326 | 326 | global $wpdb; |
327 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $key ) ); |
|
327 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $key)); |
|
328 | 328 | |
329 | - if ( empty( $value ) ) { |
|
329 | + if (empty($value)) { |
|
330 | 330 | return false; |
331 | 331 | } |
332 | 332 | |
333 | - $maybe_json = json_decode( $value ); |
|
334 | - if ( ! is_null( $maybe_json ) ) { |
|
335 | - $value = json_decode( $value, true ); |
|
333 | + $maybe_json = json_decode($value); |
|
334 | + if ( ! is_null($maybe_json)) { |
|
335 | + $value = json_decode($value, true); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | return (array) $value; |
@@ -348,10 +348,10 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - private function store_data( $key, $value ) { |
|
351 | + private function store_data($key, $value) { |
|
352 | 352 | global $wpdb; |
353 | 353 | |
354 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
354 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
355 | 355 | |
356 | 356 | $data = array( |
357 | 357 | 'option_name' => $key, |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | '%s', |
366 | 366 | ); |
367 | 367 | |
368 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
368 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return void |
379 | 379 | */ |
380 | - private function delete_data( $key ) { |
|
380 | + private function delete_data($key) { |
|
381 | 381 | global $wpdb; |
382 | - $wpdb->delete( $wpdb->options, array( |
|
382 | + $wpdb->delete($wpdb->options, array( |
|
383 | 383 | 'option_name' => $key, |
384 | - ) ); |
|
384 | + )); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * Constructor. |
48 | 48 | */ |
49 | - public function __construct( $_step = 1 ) { |
|
50 | - parent::__construct( $_step ); |
|
49 | + public function __construct($_step = 1) { |
|
50 | + parent::__construct($_step); |
|
51 | 51 | |
52 | 52 | $this->is_writable = true; |
53 | 53 | } |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | * @return array|bool $data The data for the CSV file |
63 | 63 | */ |
64 | 64 | public function get_data() { |
65 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids' ); |
|
65 | + $items = $this->get_stored_data('give_temp_delete_test_ids'); |
|
66 | 66 | |
67 | - if ( ! is_array( $items ) ) { |
|
67 | + if ( ! is_array($items)) { |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | |
71 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
72 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
73 | - $meta_table = __give_v20_bc_table_details( 'payment' ); |
|
71 | + $offset = ($this->step - 1) * $this->per_step; |
|
72 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
73 | + $meta_table = __give_v20_bc_table_details('payment'); |
|
74 | 74 | |
75 | - if ( $step_items ) { |
|
76 | - foreach ( $step_items as $item ) { |
|
75 | + if ($step_items) { |
|
76 | + foreach ($step_items as $item) { |
|
77 | 77 | // Delete the main payment. |
78 | - give_delete_donation( absint( $item['id'] ) ); |
|
78 | + give_delete_donation(absint($item['id'])); |
|
79 | 79 | } |
80 | 80 | return true; |
81 | 81 | } |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_percentage_complete() { |
93 | 93 | |
94 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids', false ); |
|
95 | - $total = count( $items ); |
|
94 | + $items = $this->get_stored_data('give_temp_delete_test_ids', false); |
|
95 | + $total = count($items); |
|
96 | 96 | |
97 | 97 | $percentage = 100; |
98 | 98 | |
99 | - if ( $total > 0 ) { |
|
100 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
99 | + if ($total > 0) { |
|
100 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( $percentage > 100 ) { |
|
103 | + if ($percentage > 100) { |
|
104 | 104 | $percentage = 100; |
105 | 105 | } |
106 | 106 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @param array $request The Form Data passed into the batch processing |
116 | 116 | */ |
117 | - public function set_properties( $request ) { |
|
117 | + public function set_properties($request) { |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function process_step() { |
127 | 127 | |
128 | - if ( ! $this->can_export() ) { |
|
129 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
128 | + if ( ! $this->can_export()) { |
|
129 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $had_data = $this->get_data(); |
133 | 133 | |
134 | - if ( $had_data ) { |
|
134 | + if ($had_data) { |
|
135 | 135 | $this->done = false; |
136 | 136 | |
137 | 137 | return true; |
138 | 138 | } else { |
139 | - update_option( 'give_earnings_total', give_get_total_earnings( true ), false ); |
|
140 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
139 | + update_option('give_earnings_total', give_get_total_earnings(true), false); |
|
140 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
141 | 141 | |
142 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
142 | + $this->delete_data('give_temp_delete_test_ids'); |
|
143 | 143 | |
144 | 144 | $this->done = true; |
145 | - $this->message = __( 'Test transactions successfully deleted.', 'give' ); |
|
145 | + $this->message = __('Test transactions successfully deleted.', 'give'); |
|
146 | 146 | |
147 | 147 | return false; |
148 | 148 | } |
@@ -175,27 +175,27 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function pre_fetch() { |
177 | 177 | |
178 | - if ( $this->step == 1 ) { |
|
179 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
178 | + if ($this->step == 1) { |
|
179 | + $this->delete_data('give_temp_delete_test_ids'); |
|
180 | 180 | } |
181 | 181 | |
182 | - $items = get_option( 'give_temp_delete_test_ids', false ); |
|
182 | + $items = get_option('give_temp_delete_test_ids', false); |
|
183 | 183 | |
184 | - if ( false === $items ) { |
|
184 | + if (false === $items) { |
|
185 | 185 | $items = array(); |
186 | 186 | |
187 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
187 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
188 | 188 | 'post_status' => 'any', |
189 | - 'number' => - 1, |
|
189 | + 'number' => -1, |
|
190 | 190 | 'meta_key' => '_give_payment_mode', |
191 | 191 | 'meta_value' => 'test' |
192 | - ) ); |
|
192 | + )); |
|
193 | 193 | |
194 | - $posts = new Give_Payments_Query( $args ); |
|
194 | + $posts = new Give_Payments_Query($args); |
|
195 | 195 | $payments = $posts->get_payments(); |
196 | 196 | |
197 | 197 | /* @var Give_Payment $payment */ |
198 | - foreach ( $payments as $payment ) { |
|
198 | + foreach ($payments as $payment) { |
|
199 | 199 | $items[] = array( |
200 | 200 | 'id' => (int) $payment->ID, |
201 | 201 | 'type' => 'give_payment', |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | // Allow filtering of items to remove with an unassociative array for each item. |
206 | 206 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method. |
207 | - $items = apply_filters( 'give_delete_test_items', $items ); |
|
207 | + $items = apply_filters('give_delete_test_items', $items); |
|
208 | 208 | |
209 | - $this->store_data( 'give_temp_delete_test_ids', $items ); |
|
209 | + $this->store_data('give_temp_delete_test_ids', $items); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | } |
@@ -220,17 +220,17 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return mixed Returns the data from the database |
222 | 222 | */ |
223 | - private function get_stored_data( $key ) { |
|
223 | + private function get_stored_data($key) { |
|
224 | 224 | global $wpdb; |
225 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
225 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
226 | 226 | |
227 | - if ( empty( $value ) ) { |
|
227 | + if (empty($value)) { |
|
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | - $maybe_json = json_decode( $value ); |
|
232 | - if ( ! is_null( $maybe_json ) ) { |
|
233 | - $value = json_decode( $value, true ); |
|
231 | + $maybe_json = json_decode($value); |
|
232 | + if ( ! is_null($maybe_json)) { |
|
233 | + $value = json_decode($value, true); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | return $value; |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | * |
247 | 247 | * @return void |
248 | 248 | */ |
249 | - private function store_data( $key, $value ) { |
|
249 | + private function store_data($key, $value) { |
|
250 | 250 | global $wpdb; |
251 | 251 | |
252 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
252 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
253 | 253 | |
254 | 254 | $data = array( |
255 | 255 | 'option_name' => $key, |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | '%s', |
264 | 264 | ); |
265 | 265 | |
266 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
266 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return void |
277 | 277 | */ |
278 | - private function delete_data( $key ) { |
|
278 | + private function delete_data($key) { |
|
279 | 279 | global $wpdb; |
280 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
280 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | } |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | * @since 1.8.17 |
12 | 12 | */ |
13 | 13 | |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; // Exit if accessed directly |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Import_Core_Settings' ) ) { |
|
18 | +if ( ! class_exists('Give_Import_Core_Settings')) { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Import_Core_Settings. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return static |
78 | 78 | */ |
79 | 79 | public static function get_instance() { |
80 | - if ( null === static::$instance ) { |
|
80 | + if (null === static::$instance) { |
|
81 | 81 | self::$instance = new static(); |
82 | 82 | } |
83 | 83 | |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | * @return void |
105 | 105 | */ |
106 | 106 | private function setup_hooks() { |
107 | - if ( ! $this->is_donations_import_page() ) { |
|
107 | + if ( ! $this->is_donations_import_page()) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | 111 | // Do not render main import tools page. |
112 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
112 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
113 | 113 | |
114 | 114 | // Render donation import page |
115 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
115 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
116 | 116 | |
117 | 117 | // Print the HTML. |
118 | - add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 ); |
|
118 | + add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10); |
|
119 | 119 | |
120 | 120 | // Run when form submit. |
121 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
121 | + add_action('give-tools_save_import', array($this, 'save')); |
|
122 | 122 | |
123 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
123 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
124 | 124 | |
125 | 125 | // Used to add submit button. |
126 | - add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 ); |
|
126 | + add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function update_notices( $messages ) { |
|
139 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
140 | - unset( $messages['give-setting-updated'] ); |
|
138 | + public function update_notices($messages) { |
|
139 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
140 | + unset($messages['give-setting-updated']); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | return $messages; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @since 1.8.17 |
150 | 150 | */ |
151 | 151 | public function submit() { |
152 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
152 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
153 | 153 | ?> |
154 | 154 | <input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/> |
155 | 155 | <input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/> |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | ?> |
170 | 170 | <section> |
171 | 171 | <table |
172 | - class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_json_valid ) ? 'give-hidden' : '' ); ?> " |
|
172 | + class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_json_valid) ? 'give-hidden' : ''); ?> " |
|
173 | 173 | id="<?php echo "step-{$step}"; ?>"> |
174 | 174 | <tbody> |
175 | 175 | <?php |
176 | - switch ( $step ) { |
|
176 | + switch ($step) { |
|
177 | 177 | case 1: |
178 | 178 | $this->render_upload_html(); |
179 | 179 | break; |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | public function import_success() { |
201 | 201 | // Imported successfully |
202 | 202 | |
203 | - $success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false ); |
|
204 | - $undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false ); |
|
203 | + $success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false); |
|
204 | + $undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false); |
|
205 | 205 | $query_arg_setting = array( |
206 | 206 | 'post_type' => 'give_forms', |
207 | 207 | 'page' => 'give-settings', |
208 | 208 | ); |
209 | 209 | |
210 | - if ( $undo ) { |
|
210 | + if ($undo) { |
|
211 | 211 | $success = false; |
212 | 212 | } |
213 | 213 | |
@@ -220,30 +220,30 @@ discard block |
||
220 | 220 | 'undo' => 'true', |
221 | 221 | ); |
222 | 222 | |
223 | - $title = __( 'Settings Importing Completed!', 'give' ); |
|
224 | - if ( $success ) { |
|
223 | + $title = __('Settings Importing Completed!', 'give'); |
|
224 | + if ($success) { |
|
225 | 225 | $query_arg_success['undo'] = '1'; |
226 | 226 | $query_arg_success['step'] = '3'; |
227 | 227 | $query_arg_success['success'] = '1'; |
228 | - $text = __( 'Undo Importing', 'give' ); |
|
228 | + $text = __('Undo Importing', 'give'); |
|
229 | 229 | } else { |
230 | - if ( $undo ) { |
|
231 | - $host_give_options = get_option( 'give_settings_old', array() ); |
|
232 | - update_option( 'give_settings', $host_give_options, false ); |
|
233 | - $title = __( 'Undo of Setting Imported Completed!', 'give' ); |
|
230 | + if ($undo) { |
|
231 | + $host_give_options = get_option('give_settings_old', array()); |
|
232 | + update_option('give_settings', $host_give_options, false); |
|
233 | + $title = __('Undo of Setting Imported Completed!', 'give'); |
|
234 | 234 | } else { |
235 | - $title = __( 'Failed to import', 'give' ); |
|
235 | + $title = __('Failed to import', 'give'); |
|
236 | 236 | } |
237 | 237 | |
238 | - $text = __( 'Importing Again', 'give' ); |
|
238 | + $text = __('Importing Again', 'give'); |
|
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | <tr valign="top" class="give-import-dropdown"> |
242 | 242 | <th colspan="2"> |
243 | 243 | <h2><?php echo $title; ?></h2> |
244 | 244 | <p> |
245 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
246 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a> |
|
245 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
246 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a> |
|
247 | 247 | </p> |
248 | 248 | </th> |
249 | 249 | </tr> |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | * @since 1.8.17 |
257 | 257 | */ |
258 | 258 | public function start_import() { |
259 | - $type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' ); |
|
260 | - $file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' ); |
|
259 | + $type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace'); |
|
260 | + $file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : ''); |
|
261 | 261 | |
262 | 262 | ?> |
263 | 263 | <tr valign="top" class="give-import-dropdown"> |
264 | 264 | <th colspan="2"> |
265 | - <h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2> |
|
266 | - <p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p> |
|
265 | + <h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2> |
|
266 | + <p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p> |
|
267 | 267 | </th> |
268 | 268 | </tr> |
269 | 269 | |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | $step = $this->get_step(); |
291 | 291 | ?> |
292 | 292 | <ol class="give-progress-steps"> |
293 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
294 | - <?php esc_html_e( 'Upload JSON file', 'give' ); ?> |
|
293 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
294 | + <?php esc_html_e('Upload JSON file', 'give'); ?> |
|
295 | 295 | </li> |
296 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
297 | - <?php esc_html_e( 'Import', 'give' ); ?> |
|
296 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
297 | + <?php esc_html_e('Import', 'give'); ?> |
|
298 | 298 | </li> |
299 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
300 | - <?php esc_html_e( 'Done!', 'give' ); ?> |
|
299 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
300 | + <?php esc_html_e('Done!', 'give'); ?> |
|
301 | 301 | </li> |
302 | 302 | </ol> |
303 | 303 | <?php |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | * @return int $step on which step doest the import is on. |
312 | 312 | */ |
313 | 313 | public function get_step() { |
314 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
314 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
315 | 315 | $on_step = 1; |
316 | 316 | |
317 | - if ( empty( $step ) || 1 === $step ) { |
|
317 | + if (empty($step) || 1 === $step) { |
|
318 | 318 | $on_step = 1; |
319 | - } elseif ( 2 === $step ) { |
|
319 | + } elseif (2 === $step) { |
|
320 | 320 | $on_step = 2; |
321 | - } elseif ( 3 === $step ) { |
|
321 | + } elseif (3 === $step) { |
|
322 | 322 | $on_step = 3; |
323 | 323 | } |
324 | 324 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * @since 1.8.17 |
332 | 332 | */ |
333 | 333 | public function render_page() { |
334 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
334 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -343,28 +343,28 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | */ |
345 | 345 | public function render_upload_html() { |
346 | - $json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' ); |
|
347 | - $type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' ); |
|
346 | + $json = (isset($_POST['json']) ? give_clean($_POST['json']) : ''); |
|
347 | + $type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge'); |
|
348 | 348 | $step = $this->get_step(); |
349 | 349 | |
350 | 350 | ?> |
351 | 351 | <tr valign="top"> |
352 | 352 | <th colspan="2"> |
353 | - <h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2> |
|
354 | - <p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p> |
|
353 | + <h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2> |
|
354 | + <p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p> |
|
355 | 355 | </th> |
356 | 356 | </tr> |
357 | 357 | |
358 | 358 | <tr valign="top"> |
359 | 359 | <th scope="row" class="titledesc"> |
360 | - <label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label> |
|
360 | + <label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label> |
|
361 | 361 | </th> |
362 | 362 | <td class="give-forminp"> |
363 | 363 | <div class="give-field-wrap"> |
364 | 364 | <label for="json"> |
365 | 365 | <input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>" |
366 | 366 | accept=".json"> |
367 | - <p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p> |
|
367 | + <p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p> |
|
368 | 368 | </label> |
369 | 369 | </div> |
370 | 370 | </td> |
@@ -373,21 +373,21 @@ discard block |
||
373 | 373 | $settings = array( |
374 | 374 | array( |
375 | 375 | 'id' => 'type', |
376 | - 'name' => __( 'Merge Type:', 'give' ), |
|
377 | - 'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ), |
|
376 | + 'name' => __('Merge Type:', 'give'), |
|
377 | + 'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'), |
|
378 | 378 | 'default' => $type, |
379 | 379 | 'type' => 'radio_inline', |
380 | 380 | 'options' => array( |
381 | - 'merge' => __( 'Merge', 'give' ), |
|
382 | - 'replace' => __( 'Replace', 'give' ), |
|
381 | + 'merge' => __('Merge', 'give'), |
|
382 | + 'replace' => __('Replace', 'give'), |
|
383 | 383 | ), |
384 | 384 | ), |
385 | 385 | ); |
386 | 386 | |
387 | - $settings = apply_filters( 'give_import_core_setting_html', $settings ); |
|
387 | + $settings = apply_filters('give_import_core_setting_html', $settings); |
|
388 | 388 | |
389 | - if ( empty( $this->is_json_valid ) ) { |
|
390 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
389 | + if (empty($this->is_json_valid)) { |
|
390 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
391 | 391 | ?> |
392 | 392 | <tr valign="top"> |
393 | 393 | <th></th> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | <input type="submit" |
396 | 396 | class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>" |
397 | 397 | id="recount-stats-submit" |
398 | - value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/> |
|
398 | + value="<?php esc_attr_e('Submit', 'give'); ?>"/> |
|
399 | 399 | </th> |
400 | 400 | </tr> |
401 | 401 | <?php |
@@ -417,20 +417,20 @@ discard block |
||
417 | 417 | $step = $this->get_step(); |
418 | 418 | |
419 | 419 | // Validation for first step. |
420 | - if ( 1 === $step ) { |
|
421 | - $type = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' ); |
|
420 | + if (1 === $step) { |
|
421 | + $type = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace'); |
|
422 | 422 | $core_settings = self::upload_widget_settings_file(); |
423 | - if ( ! empty( $core_settings['error'] ) ) { |
|
424 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) ); |
|
423 | + if ( ! empty($core_settings['error'])) { |
|
424 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give')); |
|
425 | 425 | } else { |
426 | - $file_path = explode( '/', $core_settings['file'] ); |
|
427 | - $count = ( count( $file_path ) - 1 ); |
|
428 | - $url = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array( |
|
426 | + $file_path = explode('/', $core_settings['file']); |
|
427 | + $count = (count($file_path) - 1); |
|
428 | + $url = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array( |
|
429 | 429 | 'step' => '2', |
430 | 430 | 'importer-type' => $this->importer_type, |
431 | 431 | 'type' => $type, |
432 | - 'file_name' => $file_path[ $count ], |
|
433 | - ) ) ); |
|
432 | + 'file_name' => $file_path[$count], |
|
433 | + ))); |
|
434 | 434 | |
435 | 435 | |
436 | 436 | $this->is_json_valid = $url; |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @return bool |
446 | 446 | */ |
447 | 447 | private function is_donations_import_page() { |
448 | - return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
448 | + return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public static function upload_widget_settings_file() { |
456 | 456 | $upload = false; |
457 | - if ( isset( $_FILES['json'] ) ) { |
|
458 | - add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
457 | + if (isset($_FILES['json'])) { |
|
458 | + add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
459 | 459 | |
460 | - $upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) ); |
|
460 | + $upload = wp_handle_upload($_FILES['json'], array('test_form' => false)); |
|
461 | 461 | |
462 | - remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
462 | + remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
463 | 463 | } else { |
464 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
464 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return $upload; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param array $existing_mimes |
474 | 474 | */ |
475 | - public static function json_upload_mimes( $existing_mimes = array() ) { |
|
475 | + public static function json_upload_mimes($existing_mimes = array()) { |
|
476 | 476 | $existing_mimes['json'] = 'application/json'; |
477 | 477 | |
478 | 478 | return $existing_mimes; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param array $request The Form Data passed into the batch processing. |
87 | 87 | */ |
88 | - public function set_properties( $request ) { |
|
88 | + public function set_properties($request) { |
|
89 | 89 | |
90 | 90 | // Set data from form submission |
91 | - if ( isset( $_POST['form'] ) ) { |
|
92 | - $this->data = give_clean( wp_parse_args( $_POST['form'] ) ); |
|
91 | + if (isset($_POST['form'])) { |
|
92 | + $this->data = give_clean(wp_parse_args($_POST['form'])); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $this->form = $this->data['forms']; |
96 | - $this->categories = ! empty( $request['give_forms_categories'] ) ? (array) $request['give_forms_categories'] : array(); |
|
97 | - $this->tags = ! empty( $request['give_forms_tags'] ) ? (array) $request['give_forms_tags'] : array(); |
|
98 | - $this->form_id = $this->get_form_ids( $request ); |
|
99 | - $this->price_id = isset( $request['give_price_option'] ) && ( 'all' !== $request['give_price_option'] && '' !== $request['give_price_option'] ) ? absint( $request['give_price_option'] ) : null; |
|
100 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
101 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
102 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
96 | + $this->categories = ! empty($request['give_forms_categories']) ? (array) $request['give_forms_categories'] : array(); |
|
97 | + $this->tags = ! empty($request['give_forms_tags']) ? (array) $request['give_forms_tags'] : array(); |
|
98 | + $this->form_id = $this->get_form_ids($request); |
|
99 | + $this->price_id = isset($request['give_price_option']) && ('all' !== $request['give_price_option'] && '' !== $request['give_price_option']) ? absint($request['give_price_option']) : null; |
|
100 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
101 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
102 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Hook to use after setting properties. |
106 | 106 | * |
107 | 107 | * @since 2.1.3 |
108 | 108 | */ |
109 | - do_action( 'give_export_donations_form_data', $this->data ); |
|
109 | + do_action('give_export_donations_form_data', $this->data); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return array|boolean|null $form get all the donation id that need to be exported |
120 | 120 | */ |
121 | - public function get_form_ids( $request = array() ) { |
|
122 | - $form = ! empty( $request['forms'] ) && 0 !== $request['forms'] ? absint( $request['forms'] ) : null; |
|
121 | + public function get_form_ids($request = array()) { |
|
122 | + $form = ! empty($request['forms']) && 0 !== $request['forms'] ? absint($request['forms']) : null; |
|
123 | 123 | |
124 | - $form_ids = ! empty( $request['form_ids'] ) ? sanitize_text_field( $request['form_ids'] ) : null; |
|
124 | + $form_ids = ! empty($request['form_ids']) ? sanitize_text_field($request['form_ids']) : null; |
|
125 | 125 | |
126 | - if ( empty( $form ) && ! empty( $form_ids ) && ( ! empty( $this->categories ) || ! empty( $this->tags ) ) ) { |
|
127 | - $form = explode( ',', $form_ids ); |
|
126 | + if (empty($form) && ! empty($form_ids) && ( ! empty($this->categories) || ! empty($this->tags))) { |
|
127 | + $form = explode(',', $form_ids); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return $form; |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function csv_cols() { |
143 | 143 | |
144 | - $columns = isset( $this->data['give_give_donations_export_option'] ) ? $this->data['give_give_donations_export_option'] : array(); |
|
144 | + $columns = isset($this->data['give_give_donations_export_option']) ? $this->data['give_give_donations_export_option'] : array(); |
|
145 | 145 | |
146 | 146 | // We need columns. |
147 | - if ( empty( $columns ) ) { |
|
147 | + if (empty($columns)) { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | |
151 | - $this->cols = $this->get_cols( $columns ); |
|
151 | + $this->cols = $this->get_cols($columns); |
|
152 | 152 | |
153 | 153 | return $this->cols; |
154 | 154 | } |
@@ -163,88 +163,88 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return array |
165 | 165 | */ |
166 | - private function get_cols( $columns ) { |
|
166 | + private function get_cols($columns) { |
|
167 | 167 | |
168 | 168 | $cols = array(); |
169 | 169 | |
170 | - foreach ( $columns as $key => $value ) { |
|
170 | + foreach ($columns as $key => $value) { |
|
171 | 171 | |
172 | - switch ( $key ) { |
|
172 | + switch ($key) { |
|
173 | 173 | case 'donation_id': |
174 | - $cols['donation_id'] = __( 'Donation ID', 'give' ); |
|
174 | + $cols['donation_id'] = __('Donation ID', 'give'); |
|
175 | 175 | break; |
176 | 176 | case 'seq_id': |
177 | - $cols['seq_id'] = __( 'Donation Number', 'give' ); |
|
177 | + $cols['seq_id'] = __('Donation Number', 'give'); |
|
178 | 178 | break; |
179 | 179 | case 'title_prefix': |
180 | - $cols['title_prefix'] = __( 'Title Prefix', 'give' ); |
|
180 | + $cols['title_prefix'] = __('Title Prefix', 'give'); |
|
181 | 181 | break; |
182 | 182 | case 'first_name': |
183 | - $cols['first_name'] = __( 'First Name', 'give' ); |
|
183 | + $cols['first_name'] = __('First Name', 'give'); |
|
184 | 184 | break; |
185 | 185 | case 'last_name': |
186 | - $cols['last_name'] = __( 'Last Name', 'give' ); |
|
186 | + $cols['last_name'] = __('Last Name', 'give'); |
|
187 | 187 | break; |
188 | 188 | case 'email': |
189 | - $cols['email'] = __( 'Email Address', 'give' ); |
|
189 | + $cols['email'] = __('Email Address', 'give'); |
|
190 | 190 | break; |
191 | 191 | case 'company': |
192 | - $cols['company'] = __( 'Company Name', 'give' ); |
|
192 | + $cols['company'] = __('Company Name', 'give'); |
|
193 | 193 | break; |
194 | 194 | case 'address': |
195 | - $cols['address_line1'] = __( 'Address 1', 'give' ); |
|
196 | - $cols['address_line2'] = __( 'Address 2', 'give' ); |
|
197 | - $cols['address_city'] = __( 'City', 'give' ); |
|
198 | - $cols['address_state'] = __( 'State', 'give' ); |
|
199 | - $cols['address_zip'] = __( 'Zip', 'give' ); |
|
200 | - $cols['address_country'] = __( 'Country', 'give' ); |
|
195 | + $cols['address_line1'] = __('Address 1', 'give'); |
|
196 | + $cols['address_line2'] = __('Address 2', 'give'); |
|
197 | + $cols['address_city'] = __('City', 'give'); |
|
198 | + $cols['address_state'] = __('State', 'give'); |
|
199 | + $cols['address_zip'] = __('Zip', 'give'); |
|
200 | + $cols['address_country'] = __('Country', 'give'); |
|
201 | 201 | break; |
202 | 202 | case 'donation_total': |
203 | - $cols['donation_total'] = __( 'Donation Total', 'give' ); |
|
203 | + $cols['donation_total'] = __('Donation Total', 'give'); |
|
204 | 204 | break; |
205 | 205 | case 'currency_code': |
206 | - $cols['currency_code'] = __( 'Currency Code', 'give' ); |
|
206 | + $cols['currency_code'] = __('Currency Code', 'give'); |
|
207 | 207 | break; |
208 | 208 | case 'currency_symbol': |
209 | - $cols['currency_symbol'] = __( 'Currency Symbol', 'give' ); |
|
209 | + $cols['currency_symbol'] = __('Currency Symbol', 'give'); |
|
210 | 210 | break; |
211 | 211 | case 'donation_status': |
212 | - $cols['donation_status'] = __( 'Donation Status', 'give' ); |
|
212 | + $cols['donation_status'] = __('Donation Status', 'give'); |
|
213 | 213 | break; |
214 | 214 | case 'payment_gateway': |
215 | - $cols['payment_gateway'] = __( 'Payment Gateway', 'give' ); |
|
215 | + $cols['payment_gateway'] = __('Payment Gateway', 'give'); |
|
216 | 216 | case 'payment_mode': |
217 | - $cols['payment_mode'] = __( 'Payment Mode', 'give' ); |
|
217 | + $cols['payment_mode'] = __('Payment Mode', 'give'); |
|
218 | 218 | break; |
219 | 219 | case 'form_id': |
220 | - $cols['form_id'] = __( 'Form ID', 'give' ); |
|
220 | + $cols['form_id'] = __('Form ID', 'give'); |
|
221 | 221 | break; |
222 | 222 | case 'form_title': |
223 | - $cols['form_title'] = __( 'Form Title', 'give' ); |
|
223 | + $cols['form_title'] = __('Form Title', 'give'); |
|
224 | 224 | break; |
225 | 225 | case 'form_level_id': |
226 | - $cols['form_level_id'] = __( 'Level ID', 'give' ); |
|
226 | + $cols['form_level_id'] = __('Level ID', 'give'); |
|
227 | 227 | break; |
228 | 228 | case 'form_level_title': |
229 | - $cols['form_level_title'] = __( 'Level Title', 'give' ); |
|
229 | + $cols['form_level_title'] = __('Level Title', 'give'); |
|
230 | 230 | break; |
231 | 231 | case 'donation_date': |
232 | - $cols['donation_date'] = __( 'Donation Date', 'give' ); |
|
232 | + $cols['donation_date'] = __('Donation Date', 'give'); |
|
233 | 233 | break; |
234 | 234 | case 'donation_time': |
235 | - $cols['donation_time'] = __( 'Donation Time', 'give' ); |
|
235 | + $cols['donation_time'] = __('Donation Time', 'give'); |
|
236 | 236 | break; |
237 | 237 | case 'userid': |
238 | - $cols['userid'] = __( 'User ID', 'give' ); |
|
238 | + $cols['userid'] = __('User ID', 'give'); |
|
239 | 239 | break; |
240 | 240 | case 'donorid': |
241 | - $cols['donorid'] = __( 'Donor ID', 'give' ); |
|
241 | + $cols['donorid'] = __('Donor ID', 'give'); |
|
242 | 242 | break; |
243 | 243 | case 'donor_ip': |
244 | - $cols['donor_ip'] = __( 'Donor IP Address', 'give' ); |
|
244 | + $cols['donor_ip'] = __('Donor IP Address', 'give'); |
|
245 | 245 | break; |
246 | 246 | default: |
247 | - $cols[ $key ] = $key; |
|
247 | + $cols[$key] = $key; |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param array $cols columns name for CSV |
258 | 258 | * @param array $columns columns select by admin to export |
259 | 259 | */ |
260 | - return (array) apply_filters( 'give_export_donation_get_columns_name', $cols, $columns ); |
|
260 | + return (array) apply_filters('give_export_donation_get_columns_name', $cols, $columns); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return array $args donation argument |
271 | 271 | */ |
272 | - public function get_donation_argument( $args = array() ) { |
|
272 | + public function get_donation_argument($args = array()) { |
|
273 | 273 | $defaults = array( |
274 | 274 | 'number' => 30, |
275 | 275 | 'page' => $this->step, |
276 | 276 | 'status' => $this->status, |
277 | 277 | ); |
278 | 278 | // Date query. |
279 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
280 | - if ( ! empty( $this->start ) ) { |
|
281 | - $defaults['date_query'][0]['after'] = date( 'Y-n-d 00:00:00', strtotime( $this->start ) ); |
|
279 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
280 | + if ( ! empty($this->start)) { |
|
281 | + $defaults['date_query'][0]['after'] = date('Y-n-d 00:00:00', strtotime($this->start)); |
|
282 | 282 | } |
283 | - if ( ! empty( $this->end ) ) { |
|
284 | - $defaults['date_query'][0]['before'] = date( 'Y-n-d 00:00:00', strtotime( $this->end ) ); |
|
283 | + if ( ! empty($this->end)) { |
|
284 | + $defaults['date_query'][0]['before'] = date('Y-n-d 00:00:00', strtotime($this->end)); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | - if ( ! empty( $this->form_id ) ) { |
|
289 | - $defaults['give_forms'] = is_array( $this->form_id ) ? $this->form_id : array( $this->form_id ); |
|
288 | + if ( ! empty($this->form_id)) { |
|
289 | + $defaults['give_forms'] = is_array($this->form_id) ? $this->form_id : array($this->form_id); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @since 2.1.3 |
297 | 297 | */ |
298 | - return apply_filters( 'give_export_donations_donation_query_args', wp_parse_args( $args, $defaults ) ); |
|
298 | + return apply_filters('give_export_donations_donation_query_args', wp_parse_args($args, $defaults)); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -314,130 +314,130 @@ discard block |
||
314 | 314 | $data = array(); |
315 | 315 | $i = 0; |
316 | 316 | // Payment query. |
317 | - $payments = give_get_payments( $this->get_donation_argument() ); |
|
317 | + $payments = give_get_payments($this->get_donation_argument()); |
|
318 | 318 | |
319 | - if ( $payments ) { |
|
319 | + if ($payments) { |
|
320 | 320 | |
321 | - foreach ( $payments as $payment ) { |
|
321 | + foreach ($payments as $payment) { |
|
322 | 322 | |
323 | 323 | $columns = $this->csv_cols(); |
324 | - $payment = new Give_Payment( $payment->ID ); |
|
324 | + $payment = new Give_Payment($payment->ID); |
|
325 | 325 | $payment_meta = $payment->payment_meta; |
326 | 326 | $address = $payment->address; |
327 | 327 | |
328 | 328 | // Set columns. |
329 | - if ( ! empty( $columns['donation_id'] ) ) { |
|
330 | - $data[ $i ]['donation_id'] = $payment->ID; |
|
329 | + if ( ! empty($columns['donation_id'])) { |
|
330 | + $data[$i]['donation_id'] = $payment->ID; |
|
331 | 331 | } |
332 | 332 | |
333 | - if ( ! empty( $columns['seq_id'] ) ) { |
|
334 | - $data[ $i ]['seq_id'] = Give()->seq_donation_number->get_serial_code( $payment->ID ); |
|
333 | + if ( ! empty($columns['seq_id'])) { |
|
334 | + $data[$i]['seq_id'] = Give()->seq_donation_number->get_serial_code($payment->ID); |
|
335 | 335 | } |
336 | 336 | |
337 | - if ( ! empty( $columns['title_prefix'] ) ) { |
|
338 | - $data[ $i ]['title_prefix'] = ! empty( $payment->title_prefix ) ? $payment->title_prefix : ''; |
|
337 | + if ( ! empty($columns['title_prefix'])) { |
|
338 | + $data[$i]['title_prefix'] = ! empty($payment->title_prefix) ? $payment->title_prefix : ''; |
|
339 | 339 | } |
340 | 340 | |
341 | - if ( ! empty( $columns['first_name'] ) ) { |
|
342 | - $data[ $i ]['first_name'] = isset( $payment->first_name ) ? $payment->first_name : ''; |
|
341 | + if ( ! empty($columns['first_name'])) { |
|
342 | + $data[$i]['first_name'] = isset($payment->first_name) ? $payment->first_name : ''; |
|
343 | 343 | } |
344 | 344 | |
345 | - if ( ! empty( $columns['last_name'] ) ) { |
|
346 | - $data[ $i ]['last_name'] = isset( $payment->last_name ) ? $payment->last_name : ''; |
|
345 | + if ( ! empty($columns['last_name'])) { |
|
346 | + $data[$i]['last_name'] = isset($payment->last_name) ? $payment->last_name : ''; |
|
347 | 347 | } |
348 | 348 | |
349 | - if ( ! empty( $columns['email'] ) ) { |
|
350 | - $data[ $i ]['email'] = $payment->email; |
|
349 | + if ( ! empty($columns['email'])) { |
|
350 | + $data[$i]['email'] = $payment->email; |
|
351 | 351 | } |
352 | 352 | |
353 | - if ( ! empty( $columns['company'] ) ) { |
|
354 | - $data[ $i ]['company'] = empty( $payment_meta['_give_donation_company'] ) ? '' : str_replace( "\'", "'", $payment_meta['_give_donation_company'] ); |
|
353 | + if ( ! empty($columns['company'])) { |
|
354 | + $data[$i]['company'] = empty($payment_meta['_give_donation_company']) ? '' : str_replace("\'", "'", $payment_meta['_give_donation_company']); |
|
355 | 355 | } |
356 | 356 | |
357 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
358 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
359 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
360 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
361 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
362 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
363 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
357 | + if ( ! empty($columns['address_line1'])) { |
|
358 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
359 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
360 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
361 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
362 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
363 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $columns['donation_total'] ) ) { |
|
367 | - $data[ $i ]['donation_total'] = give_format_amount( give_donation_amount( $payment->ID ) ); |
|
366 | + if ( ! empty($columns['donation_total'])) { |
|
367 | + $data[$i]['donation_total'] = give_format_amount(give_donation_amount($payment->ID)); |
|
368 | 368 | } |
369 | 369 | |
370 | - if ( ! empty( $columns['currency_code'] ) ) { |
|
371 | - $data[ $i ]['currency_code'] = empty( $payment_meta['_give_payment_currency'] ) ? give_get_currency() : $payment_meta['_give_payment_currency']; |
|
370 | + if ( ! empty($columns['currency_code'])) { |
|
371 | + $data[$i]['currency_code'] = empty($payment_meta['_give_payment_currency']) ? give_get_currency() : $payment_meta['_give_payment_currency']; |
|
372 | 372 | } |
373 | 373 | |
374 | - if ( ! empty( $columns['currency_symbol'] ) ) { |
|
375 | - $currency_code = $data[ $i ]['currency_code']; |
|
376 | - $data[ $i ]['currency_symbol'] = give_currency_symbol( $currency_code, true ); |
|
374 | + if ( ! empty($columns['currency_symbol'])) { |
|
375 | + $currency_code = $data[$i]['currency_code']; |
|
376 | + $data[$i]['currency_symbol'] = give_currency_symbol($currency_code, true); |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( ! empty( $columns['donation_status'] ) ) { |
|
380 | - $data[ $i ]['donation_status'] = give_get_payment_status( $payment, true ); |
|
379 | + if ( ! empty($columns['donation_status'])) { |
|
380 | + $data[$i]['donation_status'] = give_get_payment_status($payment, true); |
|
381 | 381 | } |
382 | 382 | |
383 | - if ( ! empty( $columns['payment_gateway'] ) ) { |
|
384 | - $data[ $i ]['payment_gateway'] = $payment->gateway; |
|
383 | + if ( ! empty($columns['payment_gateway'])) { |
|
384 | + $data[$i]['payment_gateway'] = $payment->gateway; |
|
385 | 385 | } |
386 | 386 | |
387 | - if ( ! empty( $columns['payment_mode'] ) ) { |
|
388 | - $data[ $i ]['payment_mode'] = $payment->mode; |
|
387 | + if ( ! empty($columns['payment_mode'])) { |
|
388 | + $data[$i]['payment_mode'] = $payment->mode; |
|
389 | 389 | } |
390 | 390 | |
391 | - if ( ! empty( $columns['form_id'] ) ) { |
|
392 | - $data[ $i ]['form_id'] = $payment->form_id; |
|
391 | + if ( ! empty($columns['form_id'])) { |
|
392 | + $data[$i]['form_id'] = $payment->form_id; |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( ! empty( $columns['form_title'] ) ) { |
|
396 | - $data[ $i ]['form_title'] = get_the_title( $payment->form_id ); |
|
395 | + if ( ! empty($columns['form_title'])) { |
|
396 | + $data[$i]['form_title'] = get_the_title($payment->form_id); |
|
397 | 397 | } |
398 | 398 | |
399 | - if ( ! empty( $columns['form_level_id'] ) ) { |
|
400 | - $data[ $i ]['form_level_id'] = $payment->price_id; |
|
399 | + if ( ! empty($columns['form_level_id'])) { |
|
400 | + $data[$i]['form_level_id'] = $payment->price_id; |
|
401 | 401 | } |
402 | 402 | |
403 | - if ( ! empty( $columns['form_level_title'] ) ) { |
|
404 | - $var_prices = give_has_variable_prices( $payment->form_id ); |
|
405 | - if ( empty( $var_prices ) ) { |
|
406 | - $data[ $i ]['form_level_title'] = ''; |
|
403 | + if ( ! empty($columns['form_level_title'])) { |
|
404 | + $var_prices = give_has_variable_prices($payment->form_id); |
|
405 | + if (empty($var_prices)) { |
|
406 | + $data[$i]['form_level_title'] = ''; |
|
407 | 407 | } else { |
408 | - if ( 'custom' === $payment->price_id ) { |
|
409 | - $custom_amount_text = give_get_meta( $payment->form_id, '_give_custom_amount_text', true ); |
|
408 | + if ('custom' === $payment->price_id) { |
|
409 | + $custom_amount_text = give_get_meta($payment->form_id, '_give_custom_amount_text', true); |
|
410 | 410 | |
411 | - if ( empty( $custom_amount_text ) ) { |
|
412 | - $custom_amount_text = esc_html__( 'Custom', 'give' ); |
|
411 | + if (empty($custom_amount_text)) { |
|
412 | + $custom_amount_text = esc_html__('Custom', 'give'); |
|
413 | 413 | } |
414 | - $data[ $i ]['form_level_title'] = $custom_amount_text; |
|
414 | + $data[$i]['form_level_title'] = $custom_amount_text; |
|
415 | 415 | } else { |
416 | - $data[ $i ]['form_level_title'] = give_get_price_option_name( $payment->form_id, $payment->price_id ); |
|
416 | + $data[$i]['form_level_title'] = give_get_price_option_name($payment->form_id, $payment->price_id); |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | } |
420 | 420 | |
421 | - if ( ! empty( $columns['donation_date'] ) ) { |
|
422 | - $payment_date = strtotime( $payment->date ); |
|
423 | - $data[ $i ]['donation_date'] = date( give_date_format(), $payment_date ); |
|
421 | + if ( ! empty($columns['donation_date'])) { |
|
422 | + $payment_date = strtotime($payment->date); |
|
423 | + $data[$i]['donation_date'] = date(give_date_format(), $payment_date); |
|
424 | 424 | } |
425 | 425 | |
426 | - if ( ! empty( $columns['donation_time'] ) ) { |
|
427 | - $payment_date = strtotime( $payment->date ); |
|
428 | - $data[ $i ]['donation_time'] = date_i18n( 'H', $payment_date ) . ':' . date( 'i', $payment_date ); |
|
426 | + if ( ! empty($columns['donation_time'])) { |
|
427 | + $payment_date = strtotime($payment->date); |
|
428 | + $data[$i]['donation_time'] = date_i18n('H', $payment_date).':'.date('i', $payment_date); |
|
429 | 429 | } |
430 | 430 | |
431 | - if ( ! empty( $columns['userid'] ) ) { |
|
432 | - $data[ $i ]['userid'] = $payment->user_id; |
|
431 | + if ( ! empty($columns['userid'])) { |
|
432 | + $data[$i]['userid'] = $payment->user_id; |
|
433 | 433 | } |
434 | 434 | |
435 | - if ( ! empty( $columns['donorid'] ) ) { |
|
436 | - $data[ $i ]['donorid'] = $payment->customer_id; |
|
435 | + if ( ! empty($columns['donorid'])) { |
|
436 | + $data[$i]['donorid'] = $payment->customer_id; |
|
437 | 437 | } |
438 | 438 | |
439 | - if ( ! empty( $columns['donor_ip'] ) ) { |
|
440 | - $data[ $i ]['donor_ip'] = give_get_payment_user_ip( $payment->ID ); |
|
439 | + if ( ! empty($columns['donor_ip'])) { |
|
440 | + $data[$i]['donor_ip'] = give_get_payment_user_ip($payment->ID); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | // Add custom field data. |
@@ -469,15 +469,15 @@ discard block |
||
469 | 469 | ); |
470 | 470 | |
471 | 471 | // Removing above keys... |
472 | - foreach ( $remove_keys as $key ) { |
|
473 | - unset( $columns[ $key ] ); |
|
472 | + foreach ($remove_keys as $key) { |
|
473 | + unset($columns[$key]); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | // Now loop through remaining meta fields. |
477 | - foreach ( $columns as $col ) { |
|
478 | - $field_data = get_post_meta( $payment->ID, $col, true ); |
|
479 | - $data[ $i ][ $col ] = $field_data; |
|
480 | - unset( $columns[ $col ] ); |
|
477 | + foreach ($columns as $col) { |
|
478 | + $field_data = get_post_meta($payment->ID, $col, true); |
|
479 | + $data[$i][$col] = $field_data; |
|
480 | + unset($columns[$col]); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -492,27 +492,27 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @return array Donation data |
494 | 494 | */ |
495 | - $data[ $i ] = apply_filters( 'give_export_donation_data', $data[ $i ], $payment, $columns, $this ); |
|
495 | + $data[$i] = apply_filters('give_export_donation_data', $data[$i], $payment, $columns, $this); |
|
496 | 496 | |
497 | 497 | $new_data = array(); |
498 | - $old_data = $data[ $i ]; |
|
498 | + $old_data = $data[$i]; |
|
499 | 499 | |
500 | 500 | // sorting the columns bas on row |
501 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
502 | - if ( array_key_exists( $key, $old_data ) ) { |
|
503 | - $new_data[ $key ] = $old_data[ $key ]; |
|
501 | + foreach ($this->csv_cols() as $key => $value) { |
|
502 | + if (array_key_exists($key, $old_data)) { |
|
503 | + $new_data[$key] = $old_data[$key]; |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | |
507 | - $data[ $i ] = $new_data; |
|
507 | + $data[$i] = $new_data; |
|
508 | 508 | |
509 | 509 | // Increment iterator. |
510 | - $i ++; |
|
510 | + $i++; |
|
511 | 511 | |
512 | 512 | } |
513 | 513 | |
514 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
515 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
514 | + $data = apply_filters('give_export_get_data', $data); |
|
515 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
516 | 516 | |
517 | 517 | return $data; |
518 | 518 | |
@@ -530,17 +530,17 @@ discard block |
||
530 | 530 | * @return int |
531 | 531 | */ |
532 | 532 | public function get_percentage_complete() { |
533 | - $args = $this->get_donation_argument( array( 'number' => - 1 ) ); |
|
534 | - if ( isset( $args['page'] ) ) { |
|
535 | - unset( $args['page'] ); |
|
533 | + $args = $this->get_donation_argument(array('number' => -1)); |
|
534 | + if (isset($args['page'])) { |
|
535 | + unset($args['page']); |
|
536 | 536 | } |
537 | - $query = give_get_payments( $args ); |
|
538 | - $total = count( $query ); |
|
537 | + $query = give_get_payments($args); |
|
538 | + $total = count($query); |
|
539 | 539 | $percentage = 100; |
540 | - if ( $total > 0 ) { |
|
541 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
540 | + if ($total > 0) { |
|
541 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
542 | 542 | } |
543 | - if ( $percentage > 100 ) { |
|
543 | + if ($percentage > 100) { |
|
544 | 544 | $percentage = 100; |
545 | 545 | } |
546 | 546 | |
@@ -562,23 +562,23 @@ discard block |
||
562 | 562 | $data = $this->get_data(); |
563 | 563 | $cols = $this->get_csv_cols(); |
564 | 564 | |
565 | - if ( $data ) { |
|
565 | + if ($data) { |
|
566 | 566 | |
567 | 567 | // Output each row |
568 | - foreach ( $data as $row ) { |
|
568 | + foreach ($data as $row) { |
|
569 | 569 | $i = 1; |
570 | - foreach ( $row as $col_id => $column ) { |
|
570 | + foreach ($row as $col_id => $column) { |
|
571 | 571 | // Make sure the column is valid |
572 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
573 | - $row_data .= '"' . preg_replace( '/"/', "'", $column ) . '"'; |
|
574 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
575 | - $i ++; |
|
572 | + if (array_key_exists($col_id, $cols)) { |
|
573 | + $row_data .= '"'.preg_replace('/"/', "'", $column).'"'; |
|
574 | + $row_data .= $i == count($cols) ? '' : ','; |
|
575 | + $i++; |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | $row_data .= "\r\n"; |
579 | 579 | } |
580 | 580 | |
581 | - $this->stash_step_data( $row_data ); |
|
581 | + $this->stash_step_data($row_data); |
|
582 | 582 | |
583 | 583 | return $row_data; |
584 | 584 | } |