@@ -87,13 +87,13 @@ |
||
87 | 87 | 'disabled' => __( 'Head', 'give' ), |
88 | 88 | ) |
89 | 89 | ), |
90 | - array( |
|
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | - 'id' => 'advanced_settings_docs_link', |
|
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | - 'type' => 'give_docs_link', |
|
96 | - ), |
|
90 | + array( |
|
91 | + 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
92 | + 'id' => 'advanced_settings_docs_link', |
|
93 | + 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | + 'title' => __( 'Advanced Settings', 'give' ), |
|
95 | + 'type' => 'give_docs_link', |
|
96 | + ), |
|
97 | 97 | array( |
98 | 98 | 'id' => 'give_title_data_control_2', |
99 | 99 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = esc_html__( 'Advanced', 'give' ); |
|
30 | + $this->label = esc_html__('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,45 +53,45 @@ discard block |
||
53 | 53 | 'type' => 'title' |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => esc_html__( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => esc_html__('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => esc_html__('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data this time', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data this time', 'give'), |
|
64 | 64 | ) |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | /* translators: %s: the_content */ |
68 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
68 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
69 | 69 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
70 | - '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>' ), |
|
70 | + '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>'), |
|
71 | 71 | 'id' => 'the_content_filter', |
72 | 72 | 'default' => 'enabled', |
73 | 73 | 'type' => 'radio_inline', |
74 | 74 | 'options' => array( |
75 | - 'enabled' => __( 'Enabled', 'give' ), |
|
76 | - 'disabled' => __( 'Disabled', 'give' ), |
|
75 | + 'enabled' => __('Enabled', 'give'), |
|
76 | + 'disabled' => __('Disabled', 'give'), |
|
77 | 77 | ) |
78 | 78 | ), |
79 | 79 | array( |
80 | - 'name' => esc_html__( 'Script Loading Location', 'give' ), |
|
81 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
80 | + 'name' => esc_html__('Script Loading Location', 'give'), |
|
81 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
82 | 82 | 'id' => 'scripts_footer', |
83 | 83 | 'type' => 'radio_inline', |
84 | 84 | 'default' => 'disabled', |
85 | 85 | 'options' => array( |
86 | - 'enabled' => __( 'Footer', 'give' ), |
|
87 | - 'disabled' => __( 'Head', 'give' ), |
|
86 | + 'enabled' => __('Footer', 'give'), |
|
87 | + 'disabled' => __('Head', 'give'), |
|
88 | 88 | ) |
89 | 89 | ), |
90 | 90 | array( |
91 | - 'name' => esc_html__( 'Advanced Settings Docs Link', 'give' ), |
|
91 | + 'name' => esc_html__('Advanced Settings Docs Link', 'give'), |
|
92 | 92 | 'id' => 'advanced_settings_docs_link', |
93 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
94 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
93 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
94 | + 'title' => __('Advanced Settings', 'give'), |
|
95 | 95 | 'type' => 'give_docs_link', |
96 | 96 | ), |
97 | 97 | array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * Filter the advanced settings. |
108 | 108 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
109 | 109 | */ |
110 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
110 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Filter the settings. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param array $settings |
118 | 118 | */ |
119 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
119 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
120 | 120 | |
121 | 121 | // Output. |
122 | 122 | return $settings; |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function get_sections() { |
132 | 132 | $sections = array( |
133 | - 'advanced-options' => esc_html__( 'Advanced Options', 'give' ) |
|
133 | + 'advanced-options' => esc_html__('Advanced Options', 'give') |
|
134 | 134 | ); |
135 | 135 | |
136 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
136 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 |
@@ -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,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = esc_html__( 'General', 'give' ); |
|
30 | + $this->label = esc_html__('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'access-control': |
49 | 49 | $settings = array( |
50 | 50 | // Section 3: Access control. |
@@ -54,47 +54,47 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'session_lifetime', |
57 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
58 | - 'desc' => esc_html__( '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' ), |
|
57 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
58 | + 'desc' => esc_html__('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'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => array( |
61 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
62 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
63 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
64 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
61 | + '86400' => esc_html__('24 Hours', 'give'), |
|
62 | + '172800' => esc_html__('48 Hours', 'give'), |
|
63 | + '259200' => esc_html__('72 Hours', 'give'), |
|
64 | + '604800' => esc_html__('1 Week', 'give'), |
|
65 | 65 | ) |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
69 | - 'desc' => esc_html__( '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' ), |
|
68 | + 'name' => esc_html__('Email Access', 'give'), |
|
69 | + 'desc' => esc_html__('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'), |
|
70 | 70 | 'id' => 'email_access', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | 79 | 'id' => 'recaptcha_key', |
80 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
80 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
81 | 81 | /* translators: %s: https://www.google.com/recaptcha/ */ |
82 | - 'desc' => sprintf( __( 'Please paste your reCAPTCHA site key here. <br />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. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
82 | + 'desc' => sprintf(__('Please paste your reCAPTCHA site key here. <br />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. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
83 | 83 | 'default' => '', |
84 | 84 | 'type' => 'text' |
85 | 85 | ), |
86 | 86 | array( |
87 | 87 | 'id' => 'recaptcha_secret', |
88 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
89 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
88 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
89 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | 93 | array( |
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
94 | + 'name' => esc_html__('Access Control Docs Link', 'give'), |
|
95 | 95 | 'id' => 'access_control_docs_link', |
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
96 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
97 | + 'title' => __('Access Control', 'give'), |
|
98 | 98 | 'type' => 'give_docs_link', |
99 | 99 | ), |
100 | 100 | array( |
@@ -112,61 +112,61 @@ discard block |
||
112 | 112 | 'id' => 'give_title_general_settings_2' |
113 | 113 | ), |
114 | 114 | array( |
115 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
115 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
116 | 116 | 'desc' => '', |
117 | 117 | 'type' => 'give_title', |
118 | 118 | 'id' => 'give_title_general_settings_2' |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
122 | - 'desc' => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
121 | + 'name' => esc_html__('Currency', 'give'), |
|
122 | + 'desc' => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
123 | 123 | 'id' => 'currency', |
124 | 124 | 'type' => 'select', |
125 | 125 | 'options' => give_get_currencies(), |
126 | 126 | 'default' => 'USD', |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
130 | - 'desc' => esc_html__( 'The position of the currency symbol.', 'give' ), |
|
129 | + 'name' => esc_html__('Currency Position', 'give'), |
|
130 | + 'desc' => esc_html__('The position of the currency symbol.', 'give'), |
|
131 | 131 | 'id' => 'currency_position', |
132 | 132 | 'type' => 'select', |
133 | 133 | 'options' => array( |
134 | 134 | /* translators: %s: currency symbol */ |
135 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
135 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
136 | 136 | /* translators: %s: currency symbol */ |
137 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
137 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
138 | 138 | ), |
139 | 139 | 'default' => 'before', |
140 | 140 | ), |
141 | 141 | array( |
142 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
143 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
142 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
143 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
144 | 144 | 'id' => 'thousands_separator', |
145 | 145 | 'type' => 'text', |
146 | 146 | 'default' => ',', |
147 | 147 | 'css' => 'width:12em;', |
148 | 148 | ), |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
151 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
150 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
151 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
152 | 152 | 'id' => 'decimal_separator', |
153 | 153 | 'type' => 'text', |
154 | 154 | 'default' => '.', |
155 | 155 | 'css' => 'width:12em;', |
156 | 156 | ), |
157 | 157 | array( |
158 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
159 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
158 | + 'name' => __('Number of Decimals', 'give'), |
|
159 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
160 | 160 | 'id' => 'number_decimals', |
161 | 161 | 'type' => 'text', |
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | 165 | array( |
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
166 | + 'name' => esc_html__('Currency Options Docs Link', 'give'), |
|
167 | 167 | 'id' => 'currency_settings_docs_link', |
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
168 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
169 | + 'title' => __('Currency Settings', 'give'), |
|
170 | 170 | 'type' => 'give_docs_link', |
171 | 171 | ), |
172 | 172 | array( |
@@ -184,55 +184,55 @@ discard block |
||
184 | 184 | 'id' => 'give_title_general_settings_1' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
187 | + 'name' => esc_html__('General Settings', 'give'), |
|
188 | 188 | 'desc' => '', |
189 | 189 | 'type' => 'give_title', |
190 | 190 | 'id' => 'give_title_general_settings_1' |
191 | 191 | ), |
192 | 192 | array( |
193 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
193 | + 'name' => esc_html__('Success Page', 'give'), |
|
194 | 194 | /* translators: %s: [give_receipt] */ |
195 | - '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>' ), |
|
195 | + '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>'), |
|
196 | 196 | 'id' => 'success_page', |
197 | 197 | 'type' => 'select', |
198 | - 'options' => give_cmb2_get_post_options( array( |
|
198 | + 'options' => give_cmb2_get_post_options(array( |
|
199 | 199 | 'post_type' => 'page', |
200 | - 'numberposts' => - 1 |
|
201 | - ) ), |
|
200 | + 'numberposts' => -1 |
|
201 | + )), |
|
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => esc_html__( 'Failed Donation Page', 'give' ), |
|
205 | - 'desc' => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
204 | + 'name' => esc_html__('Failed Donation Page', 'give'), |
|
205 | + 'desc' => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
206 | 206 | 'id' => 'failure_page', |
207 | 207 | 'type' => 'select', |
208 | - 'options' => give_cmb2_get_post_options( array( |
|
208 | + 'options' => give_cmb2_get_post_options(array( |
|
209 | 209 | 'post_type' => 'page', |
210 | - 'numberposts' => - 1 |
|
211 | - ) ), |
|
210 | + 'numberposts' => -1 |
|
211 | + )), |
|
212 | 212 | ), |
213 | 213 | array( |
214 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
214 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
215 | 215 | /* translators: %s: [donation_history] */ |
216 | - '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>' ), |
|
216 | + '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>'), |
|
217 | 217 | 'id' => 'history_page', |
218 | 218 | 'type' => 'select', |
219 | - 'options' => give_cmb2_get_post_options( array( |
|
219 | + 'options' => give_cmb2_get_post_options(array( |
|
220 | 220 | 'post_type' => 'page', |
221 | - 'numberposts' => - 1 |
|
222 | - ) ), |
|
221 | + 'numberposts' => -1 |
|
222 | + )), |
|
223 | 223 | ), |
224 | 224 | array( |
225 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
226 | - 'desc' => esc_html__( 'The country your site operates from.', 'give' ), |
|
225 | + 'name' => esc_html__('Base Country', 'give'), |
|
226 | + 'desc' => esc_html__('The country your site operates from.', 'give'), |
|
227 | 227 | 'id' => 'base_country', |
228 | 228 | 'type' => 'select', |
229 | 229 | 'options' => give_get_country_list(), |
230 | 230 | ), |
231 | 231 | array( |
232 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
232 | + 'name' => esc_html__('General Options Docs Link', 'give'), |
|
233 | 233 | 'id' => 'general_options_docs_link', |
234 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
235 | - 'title' => __( 'General Options', 'give' ), |
|
234 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
235 | + 'title' => __('General Options', 'give'), |
|
236 | 236 | 'type' => 'give_docs_link', |
237 | 237 | ), |
238 | 238 | array( |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * Filter the general settings. |
248 | 248 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
249 | 249 | */ |
250 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
250 | + $settings = apply_filters('give_settings_general', $settings); |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Filter the settings. |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @param array $settings |
258 | 258 | */ |
259 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
259 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
260 | 260 | |
261 | 261 | // Output. |
262 | 262 | return $settings; |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function get_sections() { |
272 | 272 | $sections = array( |
273 | - 'general-settings' => esc_html__( 'General', 'give' ), |
|
274 | - 'currency-settings' => esc_html__( 'Currency', 'give' ), |
|
275 | - 'access-control' => esc_html__( 'Access Control', 'give' ) |
|
273 | + 'general-settings' => esc_html__('General', 'give'), |
|
274 | + 'currency-settings' => esc_html__('Currency', 'give'), |
|
275 | + 'access-control' => esc_html__('Access Control', 'give') |
|
276 | 276 | ); |
277 | 277 | |
278 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
278 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | - array( |
|
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
95 | - 'id' => 'access_control_docs_link', |
|
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
98 | - 'type' => 'give_docs_link', |
|
99 | - ), |
|
93 | + array( |
|
94 | + 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
95 | + 'id' => 'access_control_docs_link', |
|
96 | + 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | + 'title' => __( 'Access Control', 'give' ), |
|
98 | + 'type' => 'give_docs_link', |
|
99 | + ), |
|
100 | 100 | array( |
101 | 101 | 'id' => 'give_title_session_control_1', |
102 | 102 | 'type' => 'sectionend' |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | - array( |
|
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
167 | - 'id' => 'currency_settings_docs_link', |
|
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
170 | - 'type' => 'give_docs_link', |
|
171 | - ), |
|
165 | + array( |
|
166 | + 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
167 | + 'id' => 'currency_settings_docs_link', |
|
168 | + 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | + 'title' => __( 'Currency Settings', 'give' ), |
|
170 | + 'type' => 'give_docs_link', |
|
171 | + ), |
|
172 | 172 | array( |
173 | 173 | 'type' => 'sectionend', |
174 | 174 | 'id' => 'give_title_general_settings_2' |
@@ -228,13 +228,13 @@ discard block |
||
228 | 228 | 'type' => 'select', |
229 | 229 | 'options' => give_get_country_list(), |
230 | 230 | ), |
231 | - array( |
|
232 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
233 | - 'id' => 'general_options_docs_link', |
|
234 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
235 | - 'title' => __( 'General Options', 'give' ), |
|
236 | - 'type' => 'give_docs_link', |
|
237 | - ), |
|
231 | + array( |
|
232 | + 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
233 | + 'id' => 'general_options_docs_link', |
|
234 | + 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
235 | + 'title' => __( 'General Options', 'give' ), |
|
236 | + 'type' => 'give_docs_link', |
|
237 | + ), |
|
238 | 238 | array( |
239 | 239 | 'type' => 'sectionend', |
240 | 240 | 'id' => 'give_title_general_settings_1' |
@@ -641,9 +641,12 @@ discard block |
||
641 | 641 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
642 | 642 | <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
643 | 643 | <?php echo $form_data_tab['icon-html']; ?> |
644 | - <?php else : ?> |
|
644 | + <?php else { |
|
645 | + : ?> |
|
645 | 646 | <span class="give-icon give-icon-default"></span> |
646 | - <?php endif; ?> |
|
647 | + <?php endif; |
|
648 | +} |
|
649 | +?> |
|
647 | 650 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
648 | 651 | </a> |
649 | 652 | <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
@@ -653,9 +656,12 @@ discard block |
||
653 | 656 | <a href="#<?php echo $sub_tab['id']; ?>"> |
654 | 657 | <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
655 | 658 | <?php echo $sub_tab['icon-html']; ?> |
656 | - <?php else : ?> |
|
659 | + <?php else { |
|
660 | + : ?> |
|
657 | 661 | <span class="give-icon give-icon-default"></span> |
658 | - <?php endif; ?> |
|
662 | + <?php endif; |
|
663 | +} |
|
664 | +?> |
|
659 | 665 | <span class="give-label"><?php echo $sub_tab['label']; ?></span> |
660 | 666 | </a> |
661 | 667 | </li> |
@@ -682,11 +688,14 @@ discard block |
||
682 | 688 | </div> |
683 | 689 | |
684 | 690 | <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
685 | - <?php else: ?> |
|
691 | + <?php else { |
|
692 | + : ?> |
|
686 | 693 | <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
687 | 694 | <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
688 | 695 | <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
689 | - <div id="<?php echo $sub_fields['id']; ?>" |
|
696 | + <div id="<?php echo $sub_fields['id']; |
|
697 | +} |
|
698 | +?>" |
|
690 | 699 | class="panel give_options_panel give-hidden"> |
691 | 700 | <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
692 | 701 | <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
400 | 400 | 'id' => $prefix . 'form_goal_achieved_message', |
401 | 401 | 'type' => 'wysiwyg', |
402 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
402 | + 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
403 | 403 | ), |
404 | 404 | array( |
405 | 405 | 'name' => 'donation_goal_docs', |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | |
672 | 672 | <div id="<?php echo $setting['id']; ?>" |
673 | 673 | class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
674 | - $show_first_tab_content = false; ?>"> |
|
674 | + $show_first_tab_content = false; ?>"> |
|
675 | 675 | <?php if ( ! empty( $setting['fields'] ) ) : ?> |
676 | 676 | <?php foreach ( $setting['fields'] as $field ) : ?> |
677 | 677 | <?php give_render_field( $field ); ?> |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function __construct() { |
48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
49 | - $this->metabox_label = __( 'Donation Form Options', 'give' ); |
|
49 | + $this->metabox_label = __('Donation Form Options', 'give'); |
|
50 | 50 | |
51 | 51 | // Setup. |
52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
52 | + add_action('admin_init', array($this, 'setup')); |
|
53 | 53 | |
54 | 54 | // Add metabox. |
55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 ); |
|
55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 10); |
|
56 | 56 | |
57 | 57 | // Save form meta. |
58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
59 | 59 | |
60 | 60 | // cmb2 old setting loaders. |
61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
62 | 62 | // Add offline donations options. |
63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | */ |
84 | 84 | function get_settings() { |
85 | 85 | $post_id = give_get_admin_post_id(); |
86 | - $price = give_get_form_price( $post_id ); |
|
87 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
88 | - $goal = give_get_form_goal( $post_id ); |
|
86 | + $price = give_get_form_price($post_id); |
|
87 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
88 | + $goal = give_get_form_goal($post_id); |
|
89 | 89 | |
90 | 90 | // No empty prices - min. 1.00 for new forms |
91 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
92 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
91 | + if (empty($price) && is_null($post_id)) { |
|
92 | + $price = esc_attr(give_format_decimal('1.00')); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Min. $1.00 for new forms |
96 | - if ( empty( $custom_amount_minimum ) ) { |
|
97 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
96 | + if (empty($custom_amount_minimum)) { |
|
97 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // Start with an underscore to hide fields from custom fields list |
@@ -104,215 +104,215 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Repeatable Field Groups |
106 | 106 | */ |
107 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
107 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
108 | 108 | 'id' => 'form_field_options', |
109 | - 'title' => __( 'Donation Options', 'give' ), |
|
109 | + 'title' => __('Donation Options', 'give'), |
|
110 | 110 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
111 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
111 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
112 | 112 | // Donation Option |
113 | 113 | array( |
114 | - 'name' => __( 'Donation Option', 'give' ), |
|
115 | - 'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
116 | - 'id' => $prefix . 'price_option', |
|
114 | + 'name' => __('Donation Option', 'give'), |
|
115 | + 'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
116 | + 'id' => $prefix.'price_option', |
|
117 | 117 | 'type' => 'radio_inline', |
118 | 118 | 'default' => 'set', |
119 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
120 | - 'set' => __( 'Set Donation', 'give' ), |
|
121 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
122 | - ) ), |
|
119 | + 'options' => apply_filters('give_forms_price_options', array( |
|
120 | + 'set' => __('Set Donation', 'give'), |
|
121 | + 'multi' => __('Multi-level Donation', 'give'), |
|
122 | + )), |
|
123 | 123 | ), |
124 | 124 | array( |
125 | - 'name' => __( 'Set Donation', 'give' ), |
|
126 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
127 | - 'id' => $prefix . 'set_price', |
|
125 | + 'name' => __('Set Donation', 'give'), |
|
126 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
127 | + 'id' => $prefix.'set_price', |
|
128 | 128 | 'type' => 'text_small', |
129 | 129 | 'data_type' => 'price', |
130 | 130 | 'attributes' => array( |
131 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
132 | - 'value' => give_format_decimal( $price ), |
|
131 | + 'placeholder' => give_format_decimal('1.00'), |
|
132 | + 'value' => give_format_decimal($price), |
|
133 | 133 | 'class' => 'give-money-field', |
134 | 134 | ), |
135 | 135 | ), |
136 | 136 | // Display Style |
137 | 137 | array( |
138 | - 'name' => __( 'Display Style', 'give' ), |
|
139 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
140 | - 'id' => $prefix . 'display_style', |
|
138 | + 'name' => __('Display Style', 'give'), |
|
139 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
140 | + 'id' => $prefix.'display_style', |
|
141 | 141 | 'type' => 'radio_inline', |
142 | 142 | 'default' => 'buttons', |
143 | 143 | 'options' => array( |
144 | - 'buttons' => __( 'Buttons', 'give' ), |
|
145 | - 'radios' => __( 'Radios', 'give' ), |
|
146 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
144 | + 'buttons' => __('Buttons', 'give'), |
|
145 | + 'radios' => __('Radios', 'give'), |
|
146 | + 'dropdown' => __('Dropdown', 'give'), |
|
147 | 147 | ), |
148 | 148 | ), |
149 | 149 | // Custom Amount |
150 | 150 | array( |
151 | - 'name' => __( 'Custom Amount', 'give' ), |
|
152 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
153 | - 'id' => $prefix . 'custom_amount', |
|
151 | + 'name' => __('Custom Amount', 'give'), |
|
152 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
153 | + 'id' => $prefix.'custom_amount', |
|
154 | 154 | 'type' => 'radio_inline', |
155 | 155 | 'default' => 'disabled', |
156 | 156 | 'options' => array( |
157 | - 'enabled' => __( 'Enabled', 'give' ), |
|
158 | - 'disabled' => __( 'Disabled', 'give' ), |
|
157 | + 'enabled' => __('Enabled', 'give'), |
|
158 | + 'disabled' => __('Disabled', 'give'), |
|
159 | 159 | ), |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Minimum Amount', 'give' ), |
|
163 | - 'description' => __( 'Enter the minimum custom donation amount.', 'give' ), |
|
164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
162 | + 'name' => __('Minimum Amount', 'give'), |
|
163 | + 'description' => __('Enter the minimum custom donation amount.', 'give'), |
|
164 | + 'id' => $prefix.'custom_amount_minimum', |
|
165 | 165 | 'type' => 'text_small', |
166 | 166 | 'data_type' => 'price', |
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_decimal('1.00'), |
|
169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
170 | 170 | 'class' => 'give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text_medium', |
178 | 178 | 'attributes' => array( |
179 | 179 | 'rows' => 3, |
180 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
180 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
181 | 181 | ), |
182 | 182 | ), |
183 | 183 | // Donation Levels: Repeatable CMB2 Group |
184 | 184 | array( |
185 | - 'id' => $prefix . 'donation_levels', |
|
185 | + 'id' => $prefix.'donation_levels', |
|
186 | 186 | 'type' => 'group', |
187 | 187 | 'options' => array( |
188 | - 'add_button' => __( 'Add Level', 'give' ), |
|
189 | - 'header_title' => __( 'Donation Level', 'give' ), |
|
188 | + 'add_button' => __('Add Level', 'give'), |
|
189 | + 'header_title' => __('Donation Level', 'give'), |
|
190 | 190 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
191 | 191 | ), |
192 | 192 | // Fields array works the same, except id's only need to be unique for this group. |
193 | 193 | // Prefix is not needed. |
194 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
194 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
195 | 195 | array( |
196 | - 'name' => __( 'ID', 'give' ), |
|
197 | - 'id' => $prefix . 'id', |
|
196 | + 'name' => __('ID', 'give'), |
|
197 | + 'id' => $prefix.'id', |
|
198 | 198 | 'type' => 'levels_id', |
199 | 199 | ), |
200 | 200 | array( |
201 | - 'name' => __( 'Amount', 'give' ), |
|
202 | - 'id' => $prefix . 'amount', |
|
201 | + 'name' => __('Amount', 'give'), |
|
202 | + 'id' => $prefix.'amount', |
|
203 | 203 | 'type' => 'text_small', |
204 | 204 | 'data_type' => 'price', |
205 | 205 | 'attributes' => array( |
206 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
206 | + 'placeholder' => give_format_decimal('1.00'), |
|
207 | 207 | 'class' => 'give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | array( |
211 | - 'name' => __( 'Text', 'give' ), |
|
212 | - 'id' => $prefix . 'text', |
|
211 | + 'name' => __('Text', 'give'), |
|
212 | + 'id' => $prefix.'text', |
|
213 | 213 | 'type' => 'text', |
214 | 214 | 'attributes' => array( |
215 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
215 | + 'placeholder' => __('Donation Level', 'give'), |
|
216 | 216 | 'class' => 'give-multilevel-text-field', |
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Default', 'give' ), |
|
221 | - 'id' => $prefix . 'default', |
|
220 | + 'name' => __('Default', 'give'), |
|
221 | + 'id' => $prefix.'default', |
|
222 | 222 | 'type' => 'give_default_radio_inline', |
223 | 223 | ), |
224 | - ) ), |
|
224 | + )), |
|
225 | 225 | ), |
226 | 226 | array( |
227 | 227 | 'name' => 'donation_options_docs', |
228 | 228 | 'type' => 'docs_link', |
229 | 229 | 'url' => 'http://docs.givewp.com/form-donation-options', |
230 | - 'title' => __( 'Donation Options', 'give' ), |
|
230 | + 'title' => __('Donation Options', 'give'), |
|
231 | 231 | ), |
232 | 232 | ), |
233 | 233 | $post_id |
234 | 234 | ), |
235 | - ) ), |
|
235 | + )), |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Display Options |
239 | 239 | */ |
240 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
240 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
241 | 241 | 'id' => 'form_display_options', |
242 | - 'title' => __( 'Form Display', 'give' ), |
|
242 | + 'title' => __('Form Display', 'give'), |
|
243 | 243 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
244 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
245 | 245 | array( |
246 | - 'name' => __( 'Display Options', 'give' ), |
|
247 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
248 | - 'id' => $prefix . 'payment_display', |
|
246 | + 'name' => __('Display Options', 'give'), |
|
247 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
248 | + 'id' => $prefix.'payment_display', |
|
249 | 249 | 'type' => 'radio_inline', |
250 | 250 | 'options' => array( |
251 | - 'onpage' => __( 'All Fields', 'give' ), |
|
252 | - 'modal' => __( 'Modal', 'give' ), |
|
253 | - 'reveal' => __( 'Reveal', 'give' ), |
|
254 | - 'button' => __( 'Button', 'give' ), |
|
251 | + 'onpage' => __('All Fields', 'give'), |
|
252 | + 'modal' => __('Modal', 'give'), |
|
253 | + 'reveal' => __('Reveal', 'give'), |
|
254 | + 'button' => __('Button', 'give'), |
|
255 | 255 | ), |
256 | 256 | 'default' => 'onpage', |
257 | 257 | ), |
258 | 258 | array( |
259 | - 'id' => $prefix . 'reveal_label', |
|
260 | - 'name' => __( 'Continue Button', 'give' ), |
|
261 | - 'desc' => __( 'The button label for displaying the additional payment fields.', 'give' ), |
|
259 | + 'id' => $prefix.'reveal_label', |
|
260 | + 'name' => __('Continue Button', 'give'), |
|
261 | + 'desc' => __('The button label for displaying the additional payment fields.', 'give'), |
|
262 | 262 | 'type' => 'text_small', |
263 | 263 | 'attributes' => array( |
264 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
264 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
265 | 265 | ), |
266 | 266 | ), |
267 | 267 | array( |
268 | - 'id' => $prefix . 'checkout_label', |
|
269 | - 'name' => __( 'Submit Button', 'give' ), |
|
270 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
268 | + 'id' => $prefix.'checkout_label', |
|
269 | + 'name' => __('Submit Button', 'give'), |
|
270 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
271 | 271 | 'type' => 'text_small', |
272 | 272 | 'attributes' => array( |
273 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
273 | + 'placeholder' => __('Donate Now', 'give'), |
|
274 | 274 | ), |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Default Gateway', 'give' ), |
|
278 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
279 | - 'id' => $prefix . 'default_gateway', |
|
277 | + 'name' => __('Default Gateway', 'give'), |
|
278 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
279 | + 'id' => $prefix.'default_gateway', |
|
280 | 280 | 'type' => 'default_gateway', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Guest Donations', 'give' ), |
|
284 | - 'desc' => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
285 | - 'id' => $prefix . 'logged_in_only', |
|
283 | + 'name' => __('Guest Donations', 'give'), |
|
284 | + 'desc' => __('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
285 | + 'id' => $prefix.'logged_in_only', |
|
286 | 286 | 'type' => 'radio_inline', |
287 | 287 | 'default' => 'enabled', |
288 | 288 | 'options' => array( |
289 | - 'enabled' => __( 'Enabled', 'give' ), |
|
290 | - 'disabled' => __( 'Disabled', 'give' ), |
|
289 | + 'enabled' => __('Enabled', 'give'), |
|
290 | + 'disabled' => __('Disabled', 'give'), |
|
291 | 291 | ), |
292 | 292 | ), |
293 | 293 | array( |
294 | - 'name' => __( 'Registration', 'give' ), |
|
295 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
296 | - 'id' => $prefix . 'show_register_form', |
|
294 | + 'name' => __('Registration', 'give'), |
|
295 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
296 | + 'id' => $prefix.'show_register_form', |
|
297 | 297 | 'type' => 'radio', |
298 | 298 | 'options' => array( |
299 | - 'none' => __( 'None', 'give' ), |
|
300 | - 'registration' => __( 'Registration', 'give' ), |
|
301 | - 'login' => __( 'Login', 'give' ), |
|
302 | - 'both' => __( 'Registration + Login', 'give' ), |
|
299 | + 'none' => __('None', 'give'), |
|
300 | + 'registration' => __('Registration', 'give'), |
|
301 | + 'login' => __('Login', 'give'), |
|
302 | + 'both' => __('Registration + Login', 'give'), |
|
303 | 303 | ), |
304 | 304 | 'default' => 'none', |
305 | 305 | ), |
306 | 306 | array( |
307 | - 'name' => __( 'Floating Labels', 'give' ), |
|
307 | + 'name' => __('Floating Labels', 'give'), |
|
308 | 308 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
309 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
310 | - 'id' => $prefix . 'form_floating_labels', |
|
309 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
310 | + 'id' => $prefix.'form_floating_labels', |
|
311 | 311 | 'type' => 'radio_inline', |
312 | 312 | 'options' => array( |
313 | - 'global' => __( 'Global Option', 'give' ), |
|
314 | - 'enabled' => __( 'Enabled', 'give' ), |
|
315 | - 'disabled' => __( 'Disabled', 'give' ), |
|
313 | + 'global' => __('Global Option', 'give'), |
|
314 | + 'enabled' => __('Enabled', 'give'), |
|
315 | + 'disabled' => __('Disabled', 'give'), |
|
316 | 316 | ), |
317 | 317 | 'default' => 'global', |
318 | 318 | ), |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'name' => 'form_display_docs', |
321 | 321 | 'type' => 'docs_link', |
322 | 322 | 'url' => 'http://docs.givewp.com/form-display-options', |
323 | - 'title' => __( 'Form Display', 'give' ), |
|
323 | + 'title' => __('Form Display', 'give'), |
|
324 | 324 | ), |
325 | 325 | ), |
326 | 326 | $post_id |
@@ -331,172 +331,172 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Donation Goals |
333 | 333 | */ |
334 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
334 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
335 | 335 | 'id' => 'donation_goal_options', |
336 | - 'title' => __( 'Donation Goal', 'give' ), |
|
336 | + 'title' => __('Donation Goal', 'give'), |
|
337 | 337 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
339 | 339 | // Goals |
340 | 340 | array( |
341 | - 'name' => __( 'Donation Goal', 'give' ), |
|
342 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
343 | - 'id' => $prefix . 'goal_option', |
|
341 | + 'name' => __('Donation Goal', 'give'), |
|
342 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
343 | + 'id' => $prefix.'goal_option', |
|
344 | 344 | 'type' => 'radio_inline', |
345 | 345 | 'default' => 'disabled', |
346 | 346 | 'options' => array( |
347 | - 'enabled' => __( 'Enabled', 'give' ), |
|
348 | - 'disabled' => __( 'Disabled', 'give' ), |
|
347 | + 'enabled' => __('Enabled', 'give'), |
|
348 | + 'disabled' => __('Disabled', 'give'), |
|
349 | 349 | ), |
350 | 350 | ), |
351 | 351 | array( |
352 | - 'name' => __( 'Goal Amount', 'give' ), |
|
353 | - 'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
354 | - 'id' => $prefix . 'set_goal', |
|
352 | + 'name' => __('Goal Amount', 'give'), |
|
353 | + 'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
354 | + 'id' => $prefix.'set_goal', |
|
355 | 355 | 'type' => 'text_small', |
356 | 356 | 'data_type' => 'price', |
357 | 357 | 'attributes' => array( |
358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
359 | - 'value' => give_format_decimal( $goal ), |
|
358 | + 'placeholder' => give_format_decimal('0.00'), |
|
359 | + 'value' => give_format_decimal($goal), |
|
360 | 360 | 'class' => 'give-money-field', |
361 | 361 | ), |
362 | 362 | ), |
363 | 363 | |
364 | 364 | array( |
365 | - 'name' => __( 'Goal Format', 'give' ), |
|
366 | - 'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
367 | - 'id' => $prefix . 'goal_format', |
|
365 | + 'name' => __('Goal Format', 'give'), |
|
366 | + 'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
367 | + 'id' => $prefix.'goal_format', |
|
368 | 368 | 'type' => 'radio_inline', |
369 | 369 | 'default' => 'amount', |
370 | 370 | 'options' => array( |
371 | - 'amount' => __( 'Amount', 'give' ), |
|
372 | - 'percentage' => __( 'Percentage', 'give' ), |
|
371 | + 'amount' => __('Amount', 'give'), |
|
372 | + 'percentage' => __('Percentage', 'give'), |
|
373 | 373 | ), |
374 | 374 | ), |
375 | 375 | array( |
376 | - 'name' => __( 'Progress Bar Color', 'give' ), |
|
377 | - 'desc' => __( 'Customize the color of the goal progress bar.', 'give' ), |
|
378 | - 'id' => $prefix . 'goal_color', |
|
376 | + 'name' => __('Progress Bar Color', 'give'), |
|
377 | + 'desc' => __('Customize the color of the goal progress bar.', 'give'), |
|
378 | + 'id' => $prefix.'goal_color', |
|
379 | 379 | 'type' => 'colorpicker', |
380 | 380 | 'default' => '#2bc253', |
381 | 381 | ), |
382 | 382 | |
383 | 383 | array( |
384 | - 'name' => __( 'Close Form', 'give' ), |
|
385 | - 'desc' => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
384 | + 'name' => __('Close Form', 'give'), |
|
385 | + 'desc' => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
387 | 387 | 'type' => 'radio_inline', |
388 | 388 | 'default' => 'disabled', |
389 | 389 | 'options' => array( |
390 | - 'enabled' => __( 'Enabled', 'give' ), |
|
391 | - 'disabled' => __( 'Disabled', 'give' ), |
|
390 | + 'enabled' => __('Enabled', 'give'), |
|
391 | + 'disabled' => __('Disabled', 'give'), |
|
392 | 392 | ), |
393 | 393 | ), |
394 | 394 | array( |
395 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
396 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
395 | + 'name' => __('Goal Achieved Message', 'give'), |
|
396 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
398 | 398 | 'type' => 'wysiwyg', |
399 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
399 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
400 | 400 | ), |
401 | 401 | array( |
402 | 402 | 'name' => 'donation_goal_docs', |
403 | 403 | 'type' => 'docs_link', |
404 | 404 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
405 | - 'title' => __( 'Donation Goal', 'give' ), |
|
405 | + 'title' => __('Donation Goal', 'give'), |
|
406 | 406 | ), |
407 | 407 | ), |
408 | 408 | $post_id |
409 | 409 | ), |
410 | - ) ), |
|
410 | + )), |
|
411 | 411 | |
412 | 412 | /** |
413 | 413 | * Content Field |
414 | 414 | */ |
415 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
415 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
416 | 416 | 'id' => 'form_content_options', |
417 | - 'title' => __( 'Form Content', 'give' ), |
|
417 | + 'title' => __('Form Content', 'give'), |
|
418 | 418 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
419 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
419 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
420 | 420 | |
421 | 421 | // Donation content. |
422 | 422 | array( |
423 | - 'name' => __( 'Display Content', 'give' ), |
|
424 | - 'description' => __( 'Do you want to add custom content to this form?', 'give' ), |
|
425 | - 'id' => $prefix . 'display_content', |
|
423 | + 'name' => __('Display Content', 'give'), |
|
424 | + 'description' => __('Do you want to add custom content to this form?', 'give'), |
|
425 | + 'id' => $prefix.'display_content', |
|
426 | 426 | 'type' => 'radio_inline', |
427 | 427 | 'options' => array( |
428 | - 'enabled' => __( 'Enabled', 'give' ), |
|
429 | - 'disabled' => __( 'Disabled', 'give' ), |
|
428 | + 'enabled' => __('Enabled', 'give'), |
|
429 | + 'disabled' => __('Disabled', 'give'), |
|
430 | 430 | ), |
431 | 431 | 'default' => 'disabled', |
432 | 432 | ), |
433 | 433 | |
434 | 434 | // Content placement. |
435 | 435 | array( |
436 | - 'name' => __( 'Content Placement', 'give' ), |
|
437 | - 'description' => __( 'This option controls where the content appears within the donation form.', 'give' ), |
|
438 | - 'id' => $prefix . 'content_placement', |
|
436 | + 'name' => __('Content Placement', 'give'), |
|
437 | + 'description' => __('This option controls where the content appears within the donation form.', 'give'), |
|
438 | + 'id' => $prefix.'content_placement', |
|
439 | 439 | 'type' => 'radio_inline', |
440 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
441 | - 'give_pre_form' => __( 'Above fields', 'give' ), |
|
442 | - 'give_post_form' => __( 'Below fields', 'give' ), |
|
440 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
441 | + 'give_pre_form' => __('Above fields', 'give'), |
|
442 | + 'give_post_form' => __('Below fields', 'give'), |
|
443 | 443 | ) |
444 | 444 | ), |
445 | 445 | 'default' => 'give_pre_form', |
446 | 446 | ), |
447 | 447 | array( |
448 | - 'name' => __( 'Content', 'give' ), |
|
449 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
450 | - 'id' => $prefix . 'form_content', |
|
448 | + 'name' => __('Content', 'give'), |
|
449 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
450 | + 'id' => $prefix.'form_content', |
|
451 | 451 | 'type' => 'wysiwyg', |
452 | 452 | ), |
453 | 453 | array( |
454 | 454 | 'name' => 'form_content_docs', |
455 | 455 | 'type' => 'docs_link', |
456 | 456 | 'url' => 'http://docs.givewp.com/form-content', |
457 | - 'title' => __( 'Form Content', 'give' ), |
|
457 | + 'title' => __('Form Content', 'give'), |
|
458 | 458 | ), |
459 | 459 | ), |
460 | 460 | $post_id |
461 | 461 | ), |
462 | - ) ), |
|
462 | + )), |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Terms & Conditions |
466 | 466 | */ |
467 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
467 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
468 | 468 | 'id' => 'form_terms_options', |
469 | - 'title' => __( 'Terms & Conditions', 'give' ), |
|
469 | + 'title' => __('Terms & Conditions', 'give'), |
|
470 | 470 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
472 | 472 | // Donation Option |
473 | 473 | array( |
474 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
475 | - 'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
476 | - 'id' => $prefix . 'terms_option', |
|
474 | + 'name' => __('Terms and Conditions', 'give'), |
|
475 | + 'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
476 | + 'id' => $prefix.'terms_option', |
|
477 | 477 | 'type' => 'radio_inline', |
478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
479 | - 'global' => __( 'Global Option', 'give' ), |
|
480 | - 'enabled' => __( 'Customize', 'give' ), |
|
481 | - 'disabled' => __( 'Disable', 'give' ), |
|
478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
479 | + 'global' => __('Global Option', 'give'), |
|
480 | + 'enabled' => __('Customize', 'give'), |
|
481 | + 'disabled' => __('Disable', 'give'), |
|
482 | 482 | ) |
483 | 483 | ), |
484 | 484 | 'default' => 'global', |
485 | 485 | ), |
486 | 486 | array( |
487 | - 'id' => $prefix . 'agree_label', |
|
488 | - 'name' => __( 'Agreement Label', 'give' ), |
|
489 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
487 | + 'id' => $prefix.'agree_label', |
|
488 | + 'name' => __('Agreement Label', 'give'), |
|
489 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
490 | 490 | 'type' => 'text', |
491 | 491 | 'size' => 'regular', |
492 | 492 | 'attributes' => array( |
493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
494 | 494 | ), |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'id' => $prefix . 'agree_text', |
|
498 | - 'name' => __( 'Agreement Text', 'give' ), |
|
499 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
497 | + 'id' => $prefix.'agree_text', |
|
498 | + 'name' => __('Agreement Text', 'give'), |
|
499 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
500 | 500 | 'default' => give_get_option('agreement_text'), |
501 | 501 | 'type' => 'wysiwyg', |
502 | 502 | ), |
@@ -504,19 +504,19 @@ discard block |
||
504 | 504 | 'name' => 'terms_docs', |
505 | 505 | 'type' => 'docs_link', |
506 | 506 | 'url' => 'http://docs.givewp.com/form-terms', |
507 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
507 | + 'title' => __('Terms and Conditions', 'give'), |
|
508 | 508 | ), |
509 | 509 | ), |
510 | 510 | $post_id |
511 | 511 | ), |
512 | - ) ), |
|
512 | + )), |
|
513 | 513 | ); |
514 | 514 | |
515 | 515 | |
516 | 516 | /** |
517 | 517 | * Filter the metabox tabbed panel settings. |
518 | 518 | */ |
519 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
519 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
520 | 520 | |
521 | 521 | // Output. |
522 | 522 | return $settings; |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | add_meta_box( |
533 | 533 | $this->get_metabox_ID(), |
534 | 534 | $this->get_metabox_label(), |
535 | - array( $this, 'output' ), |
|
536 | - array( 'give_forms' ), |
|
535 | + array($this, 'output'), |
|
536 | + array('give_forms'), |
|
537 | 537 | 'normal', |
538 | 538 | 'high' |
539 | 539 | ); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | function enqueue_script() { |
550 | 550 | global $post; |
551 | 551 | |
552 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
552 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
553 | 553 | |
554 | 554 | } |
555 | 555 | } |
@@ -584,32 +584,32 @@ discard block |
||
584 | 584 | public function get_tabs() { |
585 | 585 | $tabs = array(); |
586 | 586 | |
587 | - if ( ! empty( $this->settings ) ) { |
|
588 | - foreach ( $this->settings as $setting ) { |
|
589 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
587 | + if ( ! empty($this->settings)) { |
|
588 | + foreach ($this->settings as $setting) { |
|
589 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
590 | 590 | continue; |
591 | 591 | } |
592 | 592 | $tab = array( |
593 | 593 | 'id' => $setting['id'], |
594 | 594 | 'label' => $setting['title'], |
595 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
595 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
596 | 596 | ); |
597 | 597 | |
598 | - if ( $this->has_sub_tab( $setting ) ) { |
|
599 | - if ( empty( $setting['sub-fields'] ) ) { |
|
598 | + if ($this->has_sub_tab($setting)) { |
|
599 | + if (empty($setting['sub-fields'])) { |
|
600 | 600 | $tab = array(); |
601 | 601 | } else { |
602 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
602 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
603 | 603 | $tab['sub-fields'][] = array( |
604 | 604 | 'id' => $sub_fields['id'], |
605 | 605 | 'label' => $sub_fields['title'], |
606 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
606 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
607 | 607 | ); |
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | - if ( ! empty( $tab ) ) { |
|
612 | + if ( ! empty($tab)) { |
|
613 | 613 | $tabs[] = $tab; |
614 | 614 | } |
615 | 615 | } |
@@ -626,27 +626,27 @@ discard block |
||
626 | 626 | */ |
627 | 627 | public function output() { |
628 | 628 | // Bailout. |
629 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
630 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
629 | + if ($form_data_tabs = $this->get_tabs()) { |
|
630 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
631 | 631 | ?> |
632 | 632 | <div class="give-metabox-panel-wrap"> |
633 | 633 | <ul class="give-form-data-tabs give-metabox-tabs"> |
634 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
635 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
634 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
635 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
636 | 636 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
637 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
637 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
638 | 638 | <?php echo $form_data_tab['icon-html']; ?> |
639 | 639 | <?php else : ?> |
640 | 640 | <span class="give-icon give-icon-default"></span> |
641 | 641 | <?php endif; ?> |
642 | 642 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
643 | 643 | </a> |
644 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
644 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
645 | 645 | <ul class="give-metabox-sub-tabs give-hidden"> |
646 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
646 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
647 | 647 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
648 | 648 | <a href="#<?php echo $sub_tab['id']; ?>"> |
649 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
649 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
650 | 650 | <?php echo $sub_tab['icon-html']; ?> |
651 | 651 | <?php else : ?> |
652 | 652 | <span class="give-icon give-icon-default"></span> |
@@ -662,30 +662,30 @@ discard block |
||
662 | 662 | </ul> |
663 | 663 | |
664 | 664 | <?php $show_first_tab_content = true; ?> |
665 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
666 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
667 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
665 | + <?php foreach ($this->settings as $setting) : ?> |
|
666 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
667 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
668 | 668 | |
669 | 669 | <div id="<?php echo $setting['id']; ?>" |
670 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
670 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
671 | 671 | $show_first_tab_content = false; ?>"> |
672 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
673 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
674 | - <?php give_render_field( $field ); ?> |
|
672 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
673 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
674 | + <?php give_render_field($field); ?> |
|
675 | 675 | <?php endforeach; ?> |
676 | 676 | <?php endif; ?> |
677 | 677 | </div> |
678 | 678 | |
679 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
679 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
680 | 680 | <?php else: ?> |
681 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
682 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
683 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
681 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
682 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
683 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
684 | 684 | <div id="<?php echo $sub_fields['id']; ?>" |
685 | 685 | class="panel give_options_panel give-hidden"> |
686 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
687 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
688 | - <?php give_render_field( $sub_field ); ?> |
|
686 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
687 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
688 | + <?php give_render_field($sub_field); ?> |
|
689 | 689 | <?php endforeach; ?> |
690 | 690 | <?php endif; ?> |
691 | 691 | </div> |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return bool |
711 | 711 | */ |
712 | - private function has_sub_tab( $field_setting ) { |
|
712 | + private function has_sub_tab($field_setting) { |
|
713 | 713 | $has_sub_tab = false; |
714 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
714 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
715 | 715 | $has_sub_tab = true; |
716 | 716 | } |
717 | 717 | |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | * @return array |
726 | 726 | */ |
727 | 727 | function cmb2_metabox_settings() { |
728 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
728 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
729 | 729 | $give_forms_settings = $all_cmb2_settings; |
730 | 730 | |
731 | 731 | // Filter settings: Use only give forms related settings. |
732 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
733 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
734 | - unset( $give_forms_settings[ $index ] ); |
|
732 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
733 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
734 | + unset($give_forms_settings[$index]); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -749,97 +749,97 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return void |
751 | 751 | */ |
752 | - public function save( $post_id, $post ) { |
|
752 | + public function save($post_id, $post) { |
|
753 | 753 | |
754 | 754 | // $post_id and $post are required. |
755 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
755 | + if (empty($post_id) || empty($post)) { |
|
756 | 756 | return; |
757 | 757 | } |
758 | 758 | |
759 | 759 | // Don't save meta boxes for revisions or autosaves. |
760 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
760 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
761 | 761 | return; |
762 | 762 | } |
763 | 763 | |
764 | 764 | // Check the nonce. |
765 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
765 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
766 | 766 | return; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
770 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
770 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
771 | 771 | return; |
772 | 772 | } |
773 | 773 | |
774 | 774 | // Check user has permission to edit. |
775 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
775 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
776 | 776 | return; |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Fire action before saving form meta. |
780 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
780 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
781 | 781 | |
782 | 782 | /** |
783 | 783 | * Filter the meta key to save. |
784 | 784 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
785 | 785 | */ |
786 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
786 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
787 | 787 | |
788 | 788 | // Save form meta data. |
789 | - if ( ! empty( $form_meta_keys ) ) { |
|
790 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
789 | + if ( ! empty($form_meta_keys)) { |
|
790 | + foreach ($form_meta_keys as $form_meta_key) { |
|
791 | 791 | |
792 | 792 | // Set default value for checkbox fields. |
793 | 793 | if ( |
794 | - ! isset( $_POST[ $form_meta_key ] ) |
|
795 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
794 | + ! isset($_POST[$form_meta_key]) |
|
795 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
796 | 796 | ) { |
797 | - $_POST[ $form_meta_key ] = ''; |
|
797 | + $_POST[$form_meta_key] = ''; |
|
798 | 798 | } |
799 | 799 | |
800 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
801 | - $setting_field = $this->get_setting_field( $form_meta_key ); |
|
802 | - if ( ! empty( $setting_field['type'] ) ) { |
|
803 | - switch ( $setting_field['type'] ) { |
|
800 | + if (isset($_POST[$form_meta_key])) { |
|
801 | + $setting_field = $this->get_setting_field($form_meta_key); |
|
802 | + if ( ! empty($setting_field['type'])) { |
|
803 | + switch ($setting_field['type']) { |
|
804 | 804 | case 'textarea': |
805 | 805 | case 'wysiwyg': |
806 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
806 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
807 | 807 | break; |
808 | 808 | |
809 | 809 | case 'group': |
810 | 810 | $form_meta_value = array(); |
811 | 811 | |
812 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
812 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
813 | 813 | |
814 | 814 | // Do not save template input field values. |
815 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
815 | + if ('{{row-count-placeholder}}' === $index) { |
|
816 | 816 | continue; |
817 | 817 | } |
818 | 818 | |
819 | 819 | $group_meta_value = array(); |
820 | - foreach ( $group as $field_id => $field_value ) { |
|
821 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
820 | + foreach ($group as $field_id => $field_value) { |
|
821 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
822 | 822 | case 'wysiwyg': |
823 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
823 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
824 | 824 | break; |
825 | 825 | |
826 | 826 | default: |
827 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
827 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | |
831 | - if ( ! empty( $group_meta_value ) ) { |
|
832 | - $form_meta_value[ $index ] = $group_meta_value; |
|
831 | + if ( ! empty($group_meta_value)) { |
|
832 | + $form_meta_value[$index] = $group_meta_value; |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
836 | 836 | |
837 | 837 | // Arrange repeater field keys in order. |
838 | - $form_meta_value = array_values( $form_meta_value ); |
|
838 | + $form_meta_value = array_values($form_meta_value); |
|
839 | 839 | break; |
840 | 840 | |
841 | 841 | default: |
842 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
842 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | |
@@ -850,24 +850,24 @@ discard block |
||
850 | 850 | */ |
851 | 851 | $form_meta_value = apply_filters( |
852 | 852 | 'give_pre_save_form_meta_value', |
853 | - $this->sanitize_form_meta( $form_meta_value, $setting_field ), |
|
853 | + $this->sanitize_form_meta($form_meta_value, $setting_field), |
|
854 | 854 | $form_meta_key, |
855 | 855 | $this, |
856 | 856 | $post_id |
857 | 857 | ); |
858 | 858 | |
859 | 859 | // Save data. |
860 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
860 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
861 | 861 | |
862 | 862 | // Fire after saving form meta key. |
863 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
863 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
864 | 864 | } |
865 | 865 | } |
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
869 | 869 | // Fire action after saving form meta. |
870 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
870 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | |
@@ -880,10 +880,10 @@ discard block |
||
880 | 880 | * |
881 | 881 | * @return string |
882 | 882 | */ |
883 | - private function get_field_id( $field ) { |
|
883 | + private function get_field_id($field) { |
|
884 | 884 | $field_id = ''; |
885 | 885 | |
886 | - if ( array_key_exists( 'id', $field ) ) { |
|
886 | + if (array_key_exists('id', $field)) { |
|
887 | 887 | $field_id = $field['id']; |
888 | 888 | |
889 | 889 | } |
@@ -900,12 +900,12 @@ discard block |
||
900 | 900 | * |
901 | 901 | * @return array |
902 | 902 | */ |
903 | - private function get_fields_id( $setting ) { |
|
903 | + private function get_fields_id($setting) { |
|
904 | 904 | $meta_keys = array(); |
905 | 905 | |
906 | - if ( ! empty( $setting ) ) { |
|
907 | - foreach ( $setting['fields'] as $field ) { |
|
908 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
906 | + if ( ! empty($setting)) { |
|
907 | + foreach ($setting['fields'] as $field) { |
|
908 | + if ($field_id = $this->get_field_id($field)) { |
|
909 | 909 | $meta_keys[] = $field_id; |
910 | 910 | } |
911 | 911 | } |
@@ -923,14 +923,14 @@ discard block |
||
923 | 923 | * |
924 | 924 | * @return array |
925 | 925 | */ |
926 | - private function get_sub_fields_id( $setting ) { |
|
926 | + private function get_sub_fields_id($setting) { |
|
927 | 927 | $meta_keys = array(); |
928 | 928 | |
929 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
930 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
931 | - if ( ! empty( $fields['fields'] ) ) { |
|
932 | - foreach ( $fields['fields'] as $field ) { |
|
933 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
929 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
930 | + foreach ($setting['sub-fields'] as $fields) { |
|
931 | + if ( ! empty($fields['fields'])) { |
|
932 | + foreach ($fields['fields'] as $field) { |
|
933 | + if ($field_id = $this->get_field_id($field)) { |
|
934 | 934 | $meta_keys[] = $field_id; |
935 | 935 | } |
936 | 936 | } |
@@ -951,14 +951,14 @@ discard block |
||
951 | 951 | private function get_meta_keys_from_settings() { |
952 | 952 | $meta_keys = array(); |
953 | 953 | |
954 | - foreach ( $this->settings as $setting ) { |
|
955 | - if ( $this->has_sub_tab( $setting ) ) { |
|
956 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
954 | + foreach ($this->settings as $setting) { |
|
955 | + if ($this->has_sub_tab($setting)) { |
|
956 | + $meta_key = $this->get_sub_fields_id($setting); |
|
957 | 957 | } else { |
958 | - $meta_key = $this->get_fields_id( $setting ); |
|
958 | + $meta_key = $this->get_fields_id($setting); |
|
959 | 959 | } |
960 | 960 | |
961 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
961 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | return $meta_keys; |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | * |
976 | 976 | * @return string |
977 | 977 | */ |
978 | - function get_field_type( $field_id, $group_id = '' ) { |
|
979 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
978 | + function get_field_type($field_id, $group_id = '') { |
|
979 | + $field = $this->get_setting_field($field_id, $group_id); |
|
980 | 980 | |
981 | - $type = array_key_exists( 'type', $field ) |
|
981 | + $type = array_key_exists('type', $field) |
|
982 | 982 | ? $field['type'] |
983 | 983 | : ''; |
984 | 984 | |
@@ -996,12 +996,12 @@ discard block |
||
996 | 996 | * |
997 | 997 | * @return array |
998 | 998 | */ |
999 | - private function get_field( $setting, $field_id ) { |
|
999 | + private function get_field($setting, $field_id) { |
|
1000 | 1000 | $setting_field = array(); |
1001 | 1001 | |
1002 | - if ( ! empty( $setting['fields'] ) ) { |
|
1003 | - foreach ( $setting['fields'] as $field ) { |
|
1004 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
1002 | + if ( ! empty($setting['fields'])) { |
|
1003 | + foreach ($setting['fields'] as $field) { |
|
1004 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
1005 | 1005 | $setting_field = $field; |
1006 | 1006 | break; |
1007 | 1007 | } |
@@ -1021,12 +1021,12 @@ discard block |
||
1021 | 1021 | * |
1022 | 1022 | * @return array |
1023 | 1023 | */ |
1024 | - private function get_sub_field( $setting, $field_id ) { |
|
1024 | + private function get_sub_field($setting, $field_id) { |
|
1025 | 1025 | $setting_field = array(); |
1026 | 1026 | |
1027 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
1028 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
1029 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
1027 | + if ( ! empty($setting['sub-fields'])) { |
|
1028 | + foreach ($setting['sub-fields'] as $fields) { |
|
1029 | + if ($field = $this->get_field($fields, $field_id)) { |
|
1030 | 1030 | $setting_field = $field; |
1031 | 1031 | break; |
1032 | 1032 | } |
@@ -1046,17 +1046,17 @@ discard block |
||
1046 | 1046 | * |
1047 | 1047 | * @return array |
1048 | 1048 | */ |
1049 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
1049 | + function get_setting_field($field_id, $group_id = '') { |
|
1050 | 1050 | $setting_field = array(); |
1051 | 1051 | |
1052 | 1052 | $_field_id = $field_id; |
1053 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
1053 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
1054 | 1054 | |
1055 | - if ( ! empty( $this->settings ) ) { |
|
1056 | - foreach ( $this->settings as $setting ) { |
|
1055 | + if ( ! empty($this->settings)) { |
|
1056 | + foreach ($this->settings as $setting) { |
|
1057 | 1057 | if ( |
1058 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
1059 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
1058 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
1059 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
1060 | 1060 | ) { |
1061 | 1061 | break; |
1062 | 1062 | } |
@@ -1065,9 +1065,9 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | |
1067 | 1067 | // Get field from group. |
1068 | - if ( ! empty( $group_id ) ) { |
|
1069 | - foreach ( $setting_field['fields'] as $field ) { |
|
1070 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
1068 | + if ( ! empty($group_id)) { |
|
1069 | + foreach ($setting_field['fields'] as $field) { |
|
1070 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
1071 | 1071 | $setting_field = $field; |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -1086,14 +1086,14 @@ discard block |
||
1086 | 1086 | * |
1087 | 1087 | * @return mixed |
1088 | 1088 | */ |
1089 | - function add_offline_donations_setting_tab( $settings ) { |
|
1090 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
1091 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
1089 | + function add_offline_donations_setting_tab($settings) { |
|
1090 | + if (give_is_gateway_active('offline')) { |
|
1091 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
1092 | 1092 | 'id' => 'offline_donations_options', |
1093 | - 'title' => __( 'Offline Donations', 'give' ), |
|
1093 | + 'title' => __('Offline Donations', 'give'), |
|
1094 | 1094 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
1095 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
1096 | - ) ); |
|
1095 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
1096 | + )); |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | return $settings; |
@@ -1111,22 +1111,22 @@ discard block |
||
1111 | 1111 | * |
1112 | 1112 | * @return mixed |
1113 | 1113 | */ |
1114 | - function sanitize_form_meta( $meta_value, $setting_field ) { |
|
1115 | - switch ( $setting_field['type'] ) { |
|
1114 | + function sanitize_form_meta($meta_value, $setting_field) { |
|
1115 | + switch ($setting_field['type']) { |
|
1116 | 1116 | case 'group': |
1117 | - if ( ! empty( $setting_field['fields'] ) ) { |
|
1118 | - foreach ( $setting_field['fields'] as $field ) { |
|
1119 | - if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) { |
|
1117 | + if ( ! empty($setting_field['fields'])) { |
|
1118 | + foreach ($setting_field['fields'] as $field) { |
|
1119 | + if (empty($field['data_type']) || 'price' !== $field['data_type']) { |
|
1120 | 1120 | continue; |
1121 | 1121 | } |
1122 | 1122 | |
1123 | - foreach ( $meta_value as $index => $meta_data ) { |
|
1124 | - if( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) { |
|
1123 | + foreach ($meta_value as $index => $meta_data) { |
|
1124 | + if ( ! isset($meta_value[$index][$field['id']])) { |
|
1125 | 1125 | continue; |
1126 | 1126 | } |
1127 | 1127 | |
1128 | - $meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) |
|
1129 | - ? give_sanitize_amount( $meta_value[ $index ][ $field['id'] ] ) |
|
1128 | + $meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) |
|
1129 | + ? give_sanitize_amount($meta_value[$index][$field['id']]) |
|
1130 | 1130 | : 0; |
1131 | 1131 | } |
1132 | 1132 | } |
@@ -1134,8 +1134,8 @@ discard block |
||
1134 | 1134 | break; |
1135 | 1135 | |
1136 | 1136 | default: |
1137 | - if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) { |
|
1138 | - $meta_value = $meta_value ? give_sanitize_amount( $meta_value ) : 0; |
|
1137 | + if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) { |
|
1138 | + $meta_value = $meta_value ? give_sanitize_amount($meta_value) : 0; |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 |
@@ -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 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function __construct() { |
89 | 89 | |
90 | - if ( 'none' === $this->get_template() ) { |
|
90 | + if ('none' === $this->get_template()) { |
|
91 | 91 | $this->html = false; |
92 | 92 | } |
93 | 93 | |
94 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
95 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
94 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
95 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param $key |
105 | 105 | * @param $value |
106 | 106 | */ |
107 | - public function __set( $key, $value ) { |
|
107 | + public function __set($key, $value) { |
|
108 | 108 | $this->$key = $value; |
109 | 109 | } |
110 | 110 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | 116 | public function get_from_name() { |
117 | - if ( ! $this->from_name ) { |
|
118 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
117 | + if ( ! $this->from_name) { |
|
118 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
119 | 119 | } |
120 | 120 | |
121 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
121 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | 129 | public function get_from_address() { |
130 | - if ( ! $this->from_address ) { |
|
131 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
130 | + if ( ! $this->from_address) { |
|
131 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
134 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | * @since 1.0 |
141 | 141 | */ |
142 | 142 | public function get_content_type() { |
143 | - if ( ! $this->content_type && $this->html ) { |
|
144 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
145 | - } else if ( ! $this->html ) { |
|
143 | + if ( ! $this->content_type && $this->html) { |
|
144 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
145 | + } else if ( ! $this->html) { |
|
146 | 146 | $this->content_type = 'text/plain'; |
147 | 147 | } |
148 | 148 | |
149 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
149 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * @since 1.0 |
156 | 156 | */ |
157 | 157 | public function get_headers() { |
158 | - if ( ! $this->headers ) { |
|
158 | + if ( ! $this->headers) { |
|
159 | 159 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
160 | 160 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
161 | 161 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
162 | 162 | } |
163 | 163 | |
164 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
164 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function get_templates() { |
173 | 173 | $templates = array( |
174 | - 'default' => esc_html__( 'Default Template', 'give' ), |
|
175 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) |
|
174 | + 'default' => esc_html__('Default Template', 'give'), |
|
175 | + 'none' => esc_html__('No template, plain text only', 'give') |
|
176 | 176 | ); |
177 | 177 | |
178 | - return apply_filters( 'give_email_templates', $templates ); |
|
178 | + return apply_filters('give_email_templates', $templates); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @since 1.0 |
185 | 185 | */ |
186 | 186 | public function get_template() { |
187 | - if ( ! $this->template ) { |
|
188 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
187 | + if ( ! $this->template) { |
|
188 | + $this->template = give_get_option('email_template', 'default'); |
|
189 | 189 | } |
190 | 190 | |
191 | - return apply_filters( 'give_email_template', $this->template ); |
|
191 | + return apply_filters('give_email_template', $this->template); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @since 1.0 |
198 | 198 | */ |
199 | 199 | public function get_heading() { |
200 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
200 | + return apply_filters('give_email_heading', $this->heading); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function parse_tags( $content ) { |
|
210 | + public function parse_tags($content) { |
|
211 | 211 | return $content; |
212 | 212 | } |
213 | 213 | |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function build_email( $message ) { |
|
223 | + public function build_email($message) { |
|
224 | 224 | |
225 | - if ( false === $this->html ) { |
|
226 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
225 | + if (false === $this->html) { |
|
226 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
227 | 227 | } |
228 | 228 | |
229 | - $message = $this->text_to_html( $message ); |
|
229 | + $message = $this->text_to_html($message); |
|
230 | 230 | |
231 | 231 | $template = $this->get_template(); |
232 | 232 | |
233 | 233 | ob_start(); |
234 | 234 | |
235 | - give_get_template_part( 'emails/header', $template, true ); |
|
235 | + give_get_template_part('emails/header', $template, true); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires in the email head. |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param Give_Emails $this The email object. |
243 | 243 | */ |
244 | - do_action( 'give_email_header', $this ); |
|
244 | + do_action('give_email_header', $this); |
|
245 | 245 | |
246 | - if ( has_action( 'give_email_template_' . $template ) ) { |
|
246 | + if (has_action('give_email_template_'.$template)) { |
|
247 | 247 | /** |
248 | 248 | * Fires in a specific email template. |
249 | 249 | * |
250 | 250 | * @since 1.0 |
251 | 251 | */ |
252 | - do_action( "give_email_template_{$template}" ); |
|
252 | + do_action("give_email_template_{$template}"); |
|
253 | 253 | } else { |
254 | - give_get_template_part( 'emails/body', $template, true ); |
|
254 | + give_get_template_part('emails/body', $template, true); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @param Give_Emails $this The email object. |
263 | 263 | */ |
264 | - do_action( 'give_email_body', $this ); |
|
264 | + do_action('give_email_body', $this); |
|
265 | 265 | |
266 | - give_get_template_part( 'emails/footer', $template, true ); |
|
266 | + give_get_template_part('emails/footer', $template, true); |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Fires in the email footer. |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @param Give_Emails $this The email object. |
274 | 274 | */ |
275 | - do_action( 'give_email_footer', $this ); |
|
275 | + do_action('give_email_footer', $this); |
|
276 | 276 | |
277 | 277 | $body = ob_get_clean(); |
278 | - $message = str_replace( '{email}', $message, $body ); |
|
278 | + $message = str_replace('{email}', $message, $body); |
|
279 | 279 | |
280 | - return apply_filters( 'give_email_message', $message, $this ); |
|
280 | + return apply_filters('give_email_message', $message, $this); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return bool |
292 | 292 | */ |
293 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
293 | + public function send($to, $subject, $message, $attachments = '') { |
|
294 | 294 | |
295 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
296 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
295 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
296 | + _doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
297 | 297 | |
298 | 298 | return false; |
299 | 299 | } |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @param Give_Emails $this The email object. |
307 | 307 | */ |
308 | - do_action( 'give_email_send_before', $this ); |
|
308 | + do_action('give_email_send_before', $this); |
|
309 | 309 | |
310 | - $subject = $this->parse_tags( $subject ); |
|
311 | - $message = $this->parse_tags( $message ); |
|
310 | + $subject = $this->parse_tags($subject); |
|
311 | + $message = $this->parse_tags($message); |
|
312 | 312 | |
313 | - $message = $this->build_email( $message ); |
|
313 | + $message = $this->build_email($message); |
|
314 | 314 | |
315 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
315 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
316 | 316 | |
317 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
317 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Fires after sending an email. |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param Give_Emails $this The email object. |
325 | 325 | */ |
326 | - do_action( 'give_email_send_after', $this ); |
|
326 | + do_action('give_email_send_after', $this); |
|
327 | 327 | |
328 | 328 | return $sent; |
329 | 329 | |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * @since 1.0 |
336 | 336 | */ |
337 | 337 | public function send_before() { |
338 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
339 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
340 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
338 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
339 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
340 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @since 1.0 |
347 | 347 | */ |
348 | 348 | public function send_after() { |
349 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
350 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
351 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
349 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
350 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
351 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
352 | 352 | |
353 | 353 | // Reset heading to an empty string |
354 | 354 | $this->heading = ''; |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @since 1.0 |
361 | 361 | */ |
362 | - public function text_to_html( $message ) { |
|
362 | + public function text_to_html($message) { |
|
363 | 363 | |
364 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
365 | - $message = wpautop( $message ); |
|
364 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
365 | + $message = wpautop($message); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | return $message; |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | 'disabled' => __( 'Disabled', 'give' ), |
87 | 87 | ) |
88 | 88 | ), |
89 | - array( |
|
90 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
91 | - 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
92 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
93 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
94 | - 'type' => 'give_docs_link', |
|
95 | - ), |
|
89 | + array( |
|
90 | + 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
91 | + 'id' => 'paypal_standard_gateway_settings_docs_link', |
|
92 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
93 | + 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
94 | + 'type' => 'give_docs_link', |
|
95 | + ), |
|
96 | 96 | array( |
97 | 97 | 'type' => 'sectionend', |
98 | 98 | 'id' => 'give_title_gateway_settings_2', |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | 'textarea_rows' => 6, |
146 | 146 | ) |
147 | 147 | ), |
148 | - array( |
|
149 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
150 | - 'id' => 'offline_gateway_settings_docs_link', |
|
151 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
152 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
153 | - 'type' => 'give_docs_link', |
|
154 | - ), |
|
148 | + array( |
|
149 | + 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
150 | + 'id' => 'offline_gateway_settings_docs_link', |
|
151 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
152 | + 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
153 | + 'type' => 'give_docs_link', |
|
154 | + ), |
|
155 | 155 | array( |
156 | 156 | 'type' => 'sectionend', |
157 | 157 | 'id' => 'give_title_gateway_settings_3', |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | 'id' => 'default_gateway', |
190 | 190 | 'type' => 'default_gateway' |
191 | 191 | ), |
192 | - array( |
|
193 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
194 | - 'id' => 'gateway_settings_docs_link', |
|
195 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
196 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
197 | - 'type' => 'give_docs_link', |
|
198 | - ), |
|
192 | + array( |
|
193 | + 'name' => __( 'Gateways Docs Link', 'give' ), |
|
194 | + 'id' => 'gateway_settings_docs_link', |
|
195 | + 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
196 | + 'title' => __( 'Gateway Settings', 'give' ), |
|
197 | + 'type' => 'give_docs_link', |
|
198 | + ), |
|
199 | 199 | array( |
200 | 200 | 'id' => 'give_title_gateway_settings_1', |
201 | 201 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Gateways. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'gateways'; |
30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'gateways-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'paypal-standard': |
49 | 49 | $settings = array( |
50 | 50 | // Section 2: PayPal Standard. |
@@ -53,55 +53,55 @@ discard block |
||
53 | 53 | 'id' => 'give_title_gateway_settings_2', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'PayPal Email', 'give' ), |
|
57 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
56 | + 'name' => __('PayPal Email', 'give'), |
|
57 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
58 | 58 | 'id' => 'paypal_email', |
59 | 59 | 'type' => 'email', |
60 | 60 | ), |
61 | 61 | array( |
62 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
63 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
62 | + 'name' => __('PayPal Page Style', 'give'), |
|
63 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
64 | 64 | 'id' => 'paypal_page_style', |
65 | 65 | 'type' => 'text', |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
69 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
68 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
69 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
70 | 70 | 'id' => 'paypal_button_type', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'options' => array( |
73 | - 'donation' => __( 'Donation', 'give' ), |
|
74 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
73 | + 'donation' => __('Donation', 'give'), |
|
74 | + 'standard' => __('Standard Transaction', 'give') |
|
75 | 75 | ), |
76 | 76 | 'default' => 'donation', |
77 | 77 | ), |
78 | 78 | array( |
79 | - 'name' => __( 'Billing Details', 'give' ), |
|
80 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
79 | + 'name' => __('Billing Details', 'give'), |
|
80 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
81 | 81 | 'id' => 'paypal_standard_billing_details', |
82 | 82 | 'type' => 'radio_inline', |
83 | 83 | 'default' => 'disabled', |
84 | 84 | 'options' => array( |
85 | - 'enabled' => __( 'Enabled', 'give' ), |
|
86 | - 'disabled' => __( 'Disabled', 'give' ), |
|
85 | + 'enabled' => __('Enabled', 'give'), |
|
86 | + 'disabled' => __('Disabled', 'give'), |
|
87 | 87 | ) |
88 | 88 | ), |
89 | 89 | array( |
90 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
91 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
90 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
91 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
92 | 92 | 'id' => 'paypal_verification', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ) |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
101 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
102 | 102 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
103 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
104 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
103 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
104 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
105 | 105 | 'type' => 'give_docs_link', |
106 | 106 | ), |
107 | 107 | array( |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | 'id' => 'give_title_gateway_settings_3', |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
123 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
122 | + 'name' => __('Collect Billing Details', 'give'), |
|
123 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
124 | 124 | 'id' => 'give_offline_donation_enable_billing_fields', |
125 | 125 | 'type' => 'radio_inline', |
126 | 126 | 'default' => 'disabled', |
127 | 127 | 'options' => array( |
128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
129 | - 'disabled' => __( 'Disabled', 'give' ) |
|
128 | + 'enabled' => __('Enabled', 'give'), |
|
129 | + 'disabled' => __('Disabled', 'give') |
|
130 | 130 | ) |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
134 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
133 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
134 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
135 | 135 | 'id' => 'global_offline_donation_content', |
136 | 136 | 'default' => give_get_default_offline_donation_content(), |
137 | 137 | 'type' => 'wysiwyg', |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | ) |
141 | 141 | ), |
142 | 142 | array( |
143 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
144 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
143 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
144 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
145 | 145 | 'id' => 'offline_donation_subject', |
146 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
146 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
147 | 147 | 'type' => 'text' |
148 | 148 | ), |
149 | 149 | array( |
150 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
151 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
150 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
151 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
152 | 152 | 'id' => 'global_offline_donation_email', |
153 | 153 | 'default' => give_get_default_offline_donation_email_content(), |
154 | 154 | 'type' => 'wysiwyg', |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | ) |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
160 | + 'name' => __('Offline Donations Settings Docs Link', 'give'), |
|
161 | 161 | 'id' => 'offline_gateway_settings_docs_link', |
162 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
163 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
162 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'), |
|
163 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
164 | 164 | 'type' => 'give_docs_link', |
165 | 165 | ), |
166 | 166 | array( |
@@ -178,33 +178,33 @@ discard block |
||
178 | 178 | 'type' => 'title' |
179 | 179 | ), |
180 | 180 | array( |
181 | - 'name' => __( 'Test Mode', 'give' ), |
|
182 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
181 | + 'name' => __('Test Mode', 'give'), |
|
182 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
183 | 183 | 'id' => 'test_mode', |
184 | 184 | 'type' => 'radio_inline', |
185 | 185 | 'default' => 'disabled', |
186 | 186 | 'options' => array( |
187 | - 'enabled' => __( 'Enabled', 'give' ), |
|
188 | - 'disabled' => __( 'Disabled', 'give' ), |
|
187 | + 'enabled' => __('Enabled', 'give'), |
|
188 | + 'disabled' => __('Disabled', 'give'), |
|
189 | 189 | ) |
190 | 190 | ), |
191 | 191 | array( |
192 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
193 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
192 | + 'name' => __('Enabled Gateways', 'give'), |
|
193 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
194 | 194 | 'id' => 'gateways', |
195 | 195 | 'type' => 'enabled_gateways' |
196 | 196 | ), |
197 | 197 | array( |
198 | - 'name' => __( 'Default Gateway', 'give' ), |
|
199 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
198 | + 'name' => __('Default Gateway', 'give'), |
|
199 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
200 | 200 | 'id' => 'default_gateway', |
201 | 201 | 'type' => 'default_gateway' |
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
204 | + 'name' => __('Gateways Docs Link', 'give'), |
|
205 | 205 | 'id' => 'gateway_settings_docs_link', |
206 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
207 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
206 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
207 | + 'title' => __('Gateway Settings', 'give'), |
|
208 | 208 | 'type' => 'give_docs_link', |
209 | 209 | ), |
210 | 210 | array( |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * Filter the payment gateways settings. |
220 | 220 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
221 | 221 | */ |
222 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
222 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Filter the settings. |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @param array $settings |
230 | 230 | */ |
231 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
231 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
232 | 232 | |
233 | 233 | // Output. |
234 | 234 | return $settings; |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function get_sections() { |
244 | 244 | $sections = array( |
245 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
246 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
247 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
245 | + 'gateways-settings' => __('Gateways', 'give'), |
|
246 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
247 | + 'offline-donations' => __('Offline Donations', 'give') |
|
248 | 248 | ); |
249 | 249 | |
250 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
250 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 |
@@ -232,7 +232,7 @@ |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @access public |
234 | 234 | * |
235 | - * @return bool |
|
235 | + * @return null|boolean |
|
236 | 236 | */ |
237 | 237 | public function check_for_token() { |
238 | 238 |
@@ -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 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function __construct() { |
97 | 97 | |
98 | 98 | // get it started |
99 | - add_action( 'init', array( $this, 'init' ) ); |
|
99 | + add_action('init', array($this, 'init')); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -120,29 +120,29 @@ discard block |
||
120 | 120 | */ |
121 | 121 | if ( |
122 | 122 | is_user_logged_in() |
123 | - || ! give_is_setting_enabled( give_get_option( 'email_access' ) ) |
|
123 | + || ! give_is_setting_enabled(give_get_option('email_access')) |
|
124 | 124 | || is_admin() |
125 | 125 | ) { |
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Are db columns setup? |
130 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
131 | - if ( empty( $is_setup ) ) { |
|
130 | + $is_setup = give_get_option('email_access_installed'); |
|
131 | + if (empty($is_setup)) { |
|
132 | 132 | $this->create_columns(); |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Timeouts. |
136 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
137 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
136 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
137 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
138 | 138 | |
139 | 139 | // Setup login. |
140 | 140 | $this->check_for_token(); |
141 | 141 | |
142 | - if ( $this->token_exists ) { |
|
143 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
144 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
145 | - add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) ); |
|
142 | + if ($this->token_exists) { |
|
143 | + add_filter('give_can_view_receipt', '__return_true'); |
|
144 | + add_filter('give_user_pending_verification', '__return_false'); |
|
145 | + add_filter('give_get_users_donations_args', array($this, 'users_donations_args')); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | } |
@@ -157,25 +157,25 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return bool |
159 | 159 | */ |
160 | - public function can_send_email( $customer_id ) { |
|
160 | + public function can_send_email($customer_id) { |
|
161 | 161 | /* @var WPDB $wpdb */ |
162 | 162 | global $wpdb; |
163 | 163 | |
164 | 164 | // Prevent multiple emails within X minutes |
165 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
165 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
166 | 166 | |
167 | 167 | // Does a user row exist? |
168 | 168 | $exists = (int) $wpdb->get_var( |
169 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
169 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
170 | 170 | ); |
171 | 171 | |
172 | - if ( 0 < $exists ) { |
|
172 | + if (0 < $exists) { |
|
173 | 173 | $row_id = (int) $wpdb->get_var( |
174 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
174 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
175 | 175 | ); |
176 | 176 | |
177 | - if ( $row_id < 1 ) { |
|
178 | - give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
177 | + if ($row_id < 1) { |
|
178 | + give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
179 | 179 | |
180 | 180 | return false; |
181 | 181 | } |
@@ -195,34 +195,34 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return void |
197 | 197 | */ |
198 | - public function send_email( $customer_id, $email ) { |
|
198 | + public function send_email($customer_id, $email) { |
|
199 | 199 | |
200 | - $verify_key = wp_generate_password( 20, false ); |
|
200 | + $verify_key = wp_generate_password(20, false); |
|
201 | 201 | |
202 | 202 | // Generate a new verify key |
203 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
203 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
204 | 204 | |
205 | 205 | // Get the donation history page |
206 | - $page_id = give_get_option( 'history_page' ); |
|
206 | + $page_id = give_get_option('history_page'); |
|
207 | 207 | |
208 | - $access_url = add_query_arg( array( |
|
208 | + $access_url = add_query_arg(array( |
|
209 | 209 | 'give_nl' => $verify_key, |
210 | - ), get_permalink( $page_id ) ); |
|
210 | + ), get_permalink($page_id)); |
|
211 | 211 | |
212 | 212 | // Nice subject and message. |
213 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
213 | + $subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %s', 'give'), get_bloginfo('name'))); |
|
214 | 214 | |
215 | - $message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
216 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access Donation Details »', 'give' ) . '</a>' . "\n\n"; |
|
215 | + $message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
216 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access Donation Details »', 'give').'</a>'."\n\n"; |
|
217 | 217 | $message .= "\n\n"; |
218 | - $message .= __( 'Sincerely,', 'give' ) . "\n"; |
|
219 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
218 | + $message .= __('Sincerely,', 'give')."\n"; |
|
219 | + $message .= get_bloginfo('name')."\n"; |
|
220 | 220 | |
221 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
221 | + $message = apply_filters('give_email_access_token_message', $message); |
|
222 | 222 | |
223 | 223 | // Send the email. |
224 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) ); |
|
225 | - Give()->emails->send( $email, $subject, $message ); |
|
224 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give'))); |
|
225 | + Give()->emails->send($email, $subject, $message); |
|
226 | 226 | |
227 | 227 | } |
228 | 228 | |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function check_for_token() { |
238 | 238 | |
239 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
239 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
240 | 240 | |
241 | 241 | // Check for cookie. |
242 | - if ( empty( $token ) ) { |
|
243 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
242 | + if (empty($token)) { |
|
243 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // Must have a token. |
247 | - if ( ! empty( $token ) ) { |
|
247 | + if ( ! empty($token)) { |
|
248 | 248 | |
249 | - if ( ! $this->is_valid_token( $token ) ) { |
|
250 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
249 | + if ( ! $this->is_valid_token($token)) { |
|
250 | + if ( ! $this->is_valid_verify_key($token)) { |
|
251 | 251 | return; |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | $this->token_exists = true; |
256 | 256 | // Set cookie. |
257 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
258 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
257 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
258 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
259 | 259 | |
260 | 260 | return true; |
261 | 261 | } |
@@ -271,26 +271,26 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return bool |
273 | 273 | */ |
274 | - public function is_valid_token( $token ) { |
|
274 | + public function is_valid_token($token) { |
|
275 | 275 | |
276 | 276 | global $wpdb; |
277 | 277 | |
278 | 278 | // Make sure token isn't expired. |
279 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
279 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
280 | 280 | |
281 | 281 | $email = $wpdb->get_var( |
282 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
282 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
283 | 283 | ); |
284 | 284 | |
285 | - if ( ! empty( $email ) ) { |
|
285 | + if ( ! empty($email)) { |
|
286 | 286 | $this->token_email = $email; |
287 | 287 | $this->token = $token; |
288 | 288 | return true; |
289 | 289 | } |
290 | 290 | |
291 | 291 | // Set error only if email access form isn't being submitted |
292 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
293 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) ); |
|
292 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
293 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give'))); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | return false; |
@@ -309,25 +309,25 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @return void |
311 | 311 | */ |
312 | - public function set_verify_key( $customer_id, $email, $verify_key ) { |
|
312 | + public function set_verify_key($customer_id, $email, $verify_key) { |
|
313 | 313 | global $wpdb; |
314 | 314 | |
315 | - $now = date( 'Y-m-d H:i:s' ); |
|
315 | + $now = date('Y-m-d H:i:s'); |
|
316 | 316 | |
317 | 317 | // Insert or update? |
318 | 318 | $row_id = (int) $wpdb->get_var( |
319 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
319 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
320 | 320 | ); |
321 | 321 | |
322 | 322 | // Update. |
323 | - if ( ! empty( $row_id ) ) { |
|
323 | + if ( ! empty($row_id)) { |
|
324 | 324 | $wpdb->query( |
325 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
325 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
326 | 326 | ); |
327 | 327 | } // Insert. |
328 | 328 | else { |
329 | 329 | $wpdb->query( |
330 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
330 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | } |
@@ -342,21 +342,21 @@ discard block |
||
342 | 342 | * |
343 | 343 | * @return bool |
344 | 344 | */ |
345 | - public function is_valid_verify_key( $token ) { |
|
345 | + public function is_valid_verify_key($token) { |
|
346 | 346 | /* @var WPDB $wpdb */ |
347 | 347 | global $wpdb; |
348 | 348 | |
349 | 349 | // See if the verify_key exists. |
350 | 350 | $row = $wpdb->get_row( |
351 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
351 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
352 | 352 | ); |
353 | 353 | |
354 | - $now = date( 'Y-m-d H:i:s' ); |
|
354 | + $now = date('Y-m-d H:i:s'); |
|
355 | 355 | |
356 | 356 | // Set token and remove verify key. |
357 | - if ( ! empty( $row ) ) { |
|
357 | + if ( ! empty($row)) { |
|
358 | 358 | $wpdb->query( |
359 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
359 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
360 | 360 | ); |
361 | 361 | |
362 | 362 | $this->token_email = $row->email; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return mixed |
382 | 382 | */ |
383 | - public function users_donations_args( $args ) { |
|
383 | + public function users_donations_args($args) { |
|
384 | 384 | $args['user'] = $this->token_email; |
385 | 385 | |
386 | 386 | return $args; |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | global $wpdb; |
402 | 402 | |
403 | 403 | // Create columns in customers table |
404 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
404 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
405 | 405 | |
406 | 406 | // Columns added properly |
407 | - if ( $query ) { |
|
408 | - give_update_option( 'email_access_installed', 1 ); |
|
407 | + if ($query) { |
|
408 | + give_update_option('email_access_installed', 1); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | * @uses api_request() |
78 | 78 | * |
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | - * @return array Modified update array with custom plugin data. |
|
80 | + * @return stdClass Modified update array with custom plugin data. |
|
81 | 81 | */ |
82 | 82 | public function check_update( $_transient_data ) { |
83 | 83 |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * Allows plugins to use their own update API. |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Allows plugins to use their own update API. |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | * @param string $_plugin_file Path to the plugin file. |
30 | 30 | * @param array $_api_data Optional data to send with API calls. |
31 | 31 | */ |
32 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
32 | + public function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
33 | 33 | |
34 | 34 | global $edd_plugin_data; |
35 | 35 | |
36 | - $this->api_url = trailingslashit( $_api_url ); |
|
36 | + $this->api_url = trailingslashit($_api_url); |
|
37 | 37 | $this->api_data = $_api_data; |
38 | - $this->name = plugin_basename( $_plugin_file ); |
|
39 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
38 | + $this->name = plugin_basename($_plugin_file); |
|
39 | + $this->slug = basename($_plugin_file, '.php'); |
|
40 | 40 | $this->version = $_api_data['version']; |
41 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
42 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
43 | - $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
41 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
42 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
43 | + $this->cache_key = md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
44 | 44 | |
45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
45 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
46 | 46 | |
47 | 47 | // Set up hooks. |
48 | 48 | $this->init(); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function init() { |
60 | 60 | |
61 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
62 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
65 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
61 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
62 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
63 | + remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10); |
|
64 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
65 | + add_action('admin_init', array($this, 'show_changelog')); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -79,41 +79,41 @@ discard block |
||
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | 80 | * @return array Modified update array with custom plugin data. |
81 | 81 | */ |
82 | - public function check_update( $_transient_data ) { |
|
82 | + public function check_update($_transient_data) { |
|
83 | 83 | |
84 | 84 | global $pagenow; |
85 | 85 | |
86 | - if ( ! is_object( $_transient_data ) ) { |
|
86 | + if ( ! is_object($_transient_data)) { |
|
87 | 87 | $_transient_data = new stdClass; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
90 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
91 | 91 | return $_transient_data; |
92 | 92 | } |
93 | 93 | |
94 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
94 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
95 | 95 | return $_transient_data; |
96 | 96 | } |
97 | 97 | |
98 | 98 | $version_info = $this->get_cached_version_info(); |
99 | 99 | |
100 | - if ( false === $version_info ) { |
|
101 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
100 | + if (false === $version_info) { |
|
101 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
102 | 102 | |
103 | - $this->set_version_info_cache( $version_info ); |
|
103 | + $this->set_version_info_cache($version_info); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
107 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
108 | 108 | |
109 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
109 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
110 | 110 | |
111 | - $_transient_data->response[ $this->name ] = $version_info; |
|
111 | + $_transient_data->response[$this->name] = $version_info; |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - $_transient_data->last_checked = current_time( 'timestamp' ); |
|
116 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
115 | + $_transient_data->last_checked = current_time('timestamp'); |
|
116 | + $_transient_data->checked[$this->name] = $this->version; |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -126,97 +126,97 @@ discard block |
||
126 | 126 | * @param string $file |
127 | 127 | * @param array $plugin |
128 | 128 | */ |
129 | - public function show_update_notification( $file, $plugin ) { |
|
129 | + public function show_update_notification($file, $plugin) { |
|
130 | 130 | |
131 | - if ( is_network_admin() ) { |
|
131 | + if (is_network_admin()) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
135 | + if ( ! current_user_can('update_plugins')) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | - if( ! is_multisite() ) { |
|
139 | + if ( ! is_multisite()) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | - if ( $this->name != $file ) { |
|
143 | + if ($this->name != $file) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Remove our filter on the site transient |
148 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
148 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
149 | 149 | |
150 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
150 | + $update_cache = get_site_transient('update_plugins'); |
|
151 | 151 | |
152 | - $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
|
152 | + $update_cache = is_object($update_cache) ? $update_cache : new stdClass(); |
|
153 | 153 | |
154 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
154 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
155 | 155 | |
156 | 156 | $version_info = $this->get_cached_version_info(); |
157 | 157 | |
158 | - if ( false === $version_info ) { |
|
159 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
158 | + if (false === $version_info) { |
|
159 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
160 | 160 | |
161 | - $this->set_version_info_cache( $version_info ); |
|
161 | + $this->set_version_info_cache($version_info); |
|
162 | 162 | } |
163 | 163 | |
164 | - if ( ! is_object( $version_info ) ) { |
|
164 | + if ( ! is_object($version_info)) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
168 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
169 | 169 | |
170 | - $update_cache->response[ $this->name ] = $version_info; |
|
170 | + $update_cache->response[$this->name] = $version_info; |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | - $update_cache->last_checked = current_time( 'timestamp' ); |
|
175 | - $update_cache->checked[ $this->name ] = $this->version; |
|
174 | + $update_cache->last_checked = current_time('timestamp'); |
|
175 | + $update_cache->checked[$this->name] = $this->version; |
|
176 | 176 | |
177 | - set_site_transient( 'update_plugins', $update_cache ); |
|
177 | + set_site_transient('update_plugins', $update_cache); |
|
178 | 178 | |
179 | 179 | } else { |
180 | 180 | |
181 | - $version_info = $update_cache->response[ $this->name ]; |
|
181 | + $version_info = $update_cache->response[$this->name]; |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
185 | 185 | // Restore our filter |
186 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
186 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
187 | 187 | |
188 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
188 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
189 | 189 | |
190 | 190 | // build a plugin list row, with update notification |
191 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
191 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
192 | 192 | # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
193 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
193 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
194 | 194 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
195 | 195 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
196 | 196 | |
197 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
197 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
198 | 198 | |
199 | - if ( empty( $version_info->download_link ) ) { |
|
199 | + if (empty($version_info->download_link)) { |
|
200 | 200 | printf( |
201 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ), |
|
202 | - esc_html( $version_info->name ), |
|
203 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
204 | - esc_html( $version_info->new_version ), |
|
201 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'), |
|
202 | + esc_html($version_info->name), |
|
203 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
204 | + esc_html($version_info->new_version), |
|
205 | 205 | '</a>' |
206 | 206 | ); |
207 | 207 | } else { |
208 | 208 | printf( |
209 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ), |
|
210 | - esc_html( $version_info->name ), |
|
211 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
212 | - esc_html( $version_info->new_version ), |
|
209 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'), |
|
210 | + esc_html($version_info->name), |
|
211 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
212 | + esc_html($version_info->new_version), |
|
213 | 213 | '</a>', |
214 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
214 | + '<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">', |
|
215 | 215 | '</a>' |
216 | 216 | ); |
217 | 217 | } |
218 | 218 | |
219 | - do_action( "in_plugin_update_message-{$file}", $plugin, $version_info ); |
|
219 | + do_action("in_plugin_update_message-{$file}", $plugin, $version_info); |
|
220 | 220 | |
221 | 221 | echo '</div></td></tr>'; |
222 | 222 | } |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * @param object $_args |
233 | 233 | * @return object $_data |
234 | 234 | */ |
235 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
235 | + public function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
236 | 236 | |
237 | - if ( $_action != 'plugin_information' ) { |
|
237 | + if ($_action != 'plugin_information') { |
|
238 | 238 | |
239 | 239 | return $_data; |
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
243 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
244 | 244 | |
245 | 245 | return $_data; |
246 | 246 | |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | ) |
256 | 256 | ); |
257 | 257 | |
258 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
258 | + $cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
259 | 259 | |
260 | 260 | // Get the transient where we store the api request for this plugin for 24 hours |
261 | - $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
|
261 | + $edd_api_request_transient = $this->get_cached_version_info($cache_key); |
|
262 | 262 | |
263 | 263 | //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
264 | - if ( empty( $edd_api_request_transient ) ) { |
|
264 | + if (empty($edd_api_request_transient)) { |
|
265 | 265 | |
266 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
266 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
267 | 267 | |
268 | 268 | // Expires in 3 hours |
269 | - $this->set_version_info_cache( $api_response, $cache_key ); |
|
269 | + $this->set_version_info_cache($api_response, $cache_key); |
|
270 | 270 | |
271 | - if ( false !== $api_response ) { |
|
271 | + if (false !== $api_response) { |
|
272 | 272 | $_data = $api_response; |
273 | 273 | } |
274 | 274 | |
@@ -277,20 +277,20 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
280 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
280 | + if (isset($_data->sections) && ! is_array($_data->sections)) { |
|
281 | 281 | $new_sections = array(); |
282 | - foreach ( $_data->sections as $key => $value ) { |
|
283 | - $new_sections[ $key ] = $value; |
|
282 | + foreach ($_data->sections as $key => $value) { |
|
283 | + $new_sections[$key] = $value; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $_data->sections = $new_sections; |
287 | 287 | } |
288 | 288 | |
289 | 289 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
290 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
290 | + if (isset($_data->banners) && ! is_array($_data->banners)) { |
|
291 | 291 | $new_banners = array(); |
292 | - foreach ( $_data->banners as $key => $value ) { |
|
293 | - $new_banners[ $key ] = $value; |
|
292 | + foreach ($_data->banners as $key => $value) { |
|
293 | + $new_banners[$key] = $value; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $_data->banners = $new_banners; |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @param string $url |
307 | 307 | * @return object $array |
308 | 308 | */ |
309 | - public function http_request_args( $args, $url ) { |
|
309 | + public function http_request_args($args, $url) { |
|
310 | 310 | // If it is an https request and we are performing a package download, disable ssl verification |
311 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
311 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
312 | 312 | $args['sslverify'] = false; |
313 | 313 | } |
314 | 314 | return $args; |
@@ -325,50 +325,50 @@ discard block |
||
325 | 325 | * @param array $_data Parameters for the API action. |
326 | 326 | * @return false|object |
327 | 327 | */ |
328 | - private function api_request( $_action, $_data ) { |
|
328 | + private function api_request($_action, $_data) { |
|
329 | 329 | |
330 | 330 | global $wp_version; |
331 | 331 | |
332 | - $data = array_merge( $this->api_data, $_data ); |
|
332 | + $data = array_merge($this->api_data, $_data); |
|
333 | 333 | |
334 | - if ( $data['slug'] != $this->slug ) { |
|
334 | + if ($data['slug'] != $this->slug) { |
|
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
338 | - if( $this->api_url == trailingslashit (home_url() ) ) { |
|
338 | + if ($this->api_url == trailingslashit(home_url())) { |
|
339 | 339 | return false; // Don't allow a plugin to ping itself |
340 | 340 | } |
341 | 341 | |
342 | 342 | $api_params = array( |
343 | 343 | 'edd_action' => 'get_version', |
344 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
345 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
346 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
347 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
344 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
345 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
346 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
347 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
348 | 348 | 'slug' => $data['slug'], |
349 | 349 | 'author' => $data['author'], |
350 | 350 | 'url' => home_url(), |
351 | - 'beta' => ! empty( $data['beta'] ), |
|
351 | + 'beta' => ! empty($data['beta']), |
|
352 | 352 | ); |
353 | 353 | |
354 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
354 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
355 | 355 | |
356 | - if ( ! is_wp_error( $request ) ) { |
|
357 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
356 | + if ( ! is_wp_error($request)) { |
|
357 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( $request && isset( $request->sections ) ) { |
|
361 | - $request->sections = maybe_unserialize( $request->sections ); |
|
360 | + if ($request && isset($request->sections)) { |
|
361 | + $request->sections = maybe_unserialize($request->sections); |
|
362 | 362 | } else { |
363 | 363 | $request = false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( $request && isset( $request->banners ) ) { |
|
367 | - $request->banners = maybe_unserialize( $request->banners ); |
|
366 | + if ($request && isset($request->banners)) { |
|
367 | + $request->banners = maybe_unserialize($request->banners); |
|
368 | 368 | } |
369 | 369 | |
370 | - if( ! empty( $request->sections ) ) { |
|
371 | - foreach( $request->sections as $key => $section ) { |
|
370 | + if ( ! empty($request->sections)) { |
|
371 | + foreach ($request->sections as $key => $section) { |
|
372 | 372 | $request->$key = (array) $section; |
373 | 373 | } |
374 | 374 | } |
@@ -380,97 +380,97 @@ discard block |
||
380 | 380 | |
381 | 381 | global $edd_plugin_data; |
382 | 382 | |
383 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
383 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
387 | + if (empty($_REQUEST['plugin'])) { |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 | |
391 | - if( empty( $_REQUEST['slug'] ) ) { |
|
391 | + if (empty($_REQUEST['slug'])) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | |
395 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
396 | - wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
395 | + if ( ! current_user_can('update_plugins')) { |
|
396 | + wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403)); |
|
397 | 397 | } |
398 | 398 | |
399 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
400 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
401 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
402 | - $version_info = $this->get_cached_version_info( $cache_key ); |
|
399 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
400 | + $beta = ! empty($data['beta']) ? true : false; |
|
401 | + $cache_key = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info'); |
|
402 | + $version_info = $this->get_cached_version_info($cache_key); |
|
403 | 403 | |
404 | - if( false === $version_info ) { |
|
404 | + if (false === $version_info) { |
|
405 | 405 | |
406 | 406 | $api_params = array( |
407 | 407 | 'edd_action' => 'get_version', |
408 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
409 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
408 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
409 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
410 | 410 | 'slug' => $_REQUEST['slug'], |
411 | 411 | 'author' => $data['author'], |
412 | 412 | 'url' => home_url(), |
413 | - 'beta' => ! empty( $data['beta'] ) |
|
413 | + 'beta' => ! empty($data['beta']) |
|
414 | 414 | ); |
415 | 415 | |
416 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
416 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
417 | 417 | |
418 | - if ( ! is_wp_error( $request ) ) { |
|
419 | - $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
|
418 | + if ( ! is_wp_error($request)) { |
|
419 | + $version_info = json_decode(wp_remote_retrieve_body($request)); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
423 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
424 | - $version_info->sections = maybe_unserialize( $version_info->sections ); |
|
423 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
424 | + $version_info->sections = maybe_unserialize($version_info->sections); |
|
425 | 425 | } else { |
426 | 426 | $version_info = false; |
427 | 427 | } |
428 | 428 | |
429 | - if( ! empty( $version_info ) ) { |
|
430 | - foreach( $version_info->sections as $key => $section ) { |
|
429 | + if ( ! empty($version_info)) { |
|
430 | + foreach ($version_info->sections as $key => $section) { |
|
431 | 431 | $version_info->$key = (array) $section; |
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | - $this->set_version_info_cache( $version_info, $cache_key ); |
|
435 | + $this->set_version_info_cache($version_info, $cache_key); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | |
439 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
440 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
439 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
440 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | exit; |
444 | 444 | } |
445 | 445 | |
446 | - public function get_cached_version_info( $cache_key = '' ) { |
|
446 | + public function get_cached_version_info($cache_key = '') { |
|
447 | 447 | |
448 | - if( empty( $cache_key ) ) { |
|
448 | + if (empty($cache_key)) { |
|
449 | 449 | $cache_key = $this->cache_key; |
450 | 450 | } |
451 | 451 | |
452 | - $cache = get_option( $cache_key ); |
|
452 | + $cache = get_option($cache_key); |
|
453 | 453 | |
454 | - if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) { |
|
454 | + if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) { |
|
455 | 455 | return false; // Cache is expired |
456 | 456 | } |
457 | 457 | |
458 | - return json_decode( $cache['value'] ); |
|
458 | + return json_decode($cache['value']); |
|
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | - public function set_version_info_cache( $value = '', $cache_key = '' ) { |
|
462 | + public function set_version_info_cache($value = '', $cache_key = '') { |
|
463 | 463 | |
464 | - if( empty( $cache_key ) ) { |
|
464 | + if (empty($cache_key)) { |
|
465 | 465 | $cache_key = $this->cache_key; |
466 | 466 | } |
467 | 467 | |
468 | 468 | $data = array( |
469 | - 'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ), |
|
470 | - 'value' => json_encode( $value ) |
|
469 | + 'timeout' => strtotime('+3 hours', current_time('timestamp')), |
|
470 | + 'value' => json_encode($value) |
|
471 | 471 | ); |
472 | 472 | |
473 | - update_option( $cache_key, $data ); |
|
473 | + update_option($cache_key, $data); |
|
474 | 474 | |
475 | 475 | } |
476 | 476 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @since 1.0 |
21 | 21 | */ |
22 | -class Give_Forms_Widget extends WP_Widget{ |
|
22 | +class Give_Forms_Widget extends WP_Widget { |
|
23 | 23 | /** |
24 | 24 | * The widget class name |
25 | 25 | * |
@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Instantiate the class |
32 | 32 | */ |
33 | - public function __construct(){ |
|
34 | - $this->self = get_class( $this ); |
|
33 | + public function __construct() { |
|
34 | + $this->self = get_class($this); |
|
35 | 35 | |
36 | 36 | parent::__construct( |
37 | - strtolower( $this->self ), |
|
38 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
37 | + strtolower($this->self), |
|
38 | + esc_html__('Give - Donation Form', 'give'), |
|
39 | 39 | array( |
40 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
40 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
41 | 41 | ) |
42 | 42 | ); |
43 | 43 | |
44 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
45 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
44 | + add_action('widgets_init', array($this, 'widget_init')); |
|
45 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function admin_widget_scripts( $hook ){ |
|
55 | + public function admin_widget_scripts($hook) { |
|
56 | 56 | // Directories of assets |
57 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
58 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
59 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
57 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
58 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
59 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
60 | 60 | |
61 | 61 | // Use minified libraries if SCRIPT_DEBUG is turned off |
62 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
62 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
63 | 63 | |
64 | 64 | // Widget Script |
65 | - if ( $hook == 'widgets.php' ) { |
|
65 | + if ($hook == 'widgets.php') { |
|
66 | 66 | |
67 | - wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' ); |
|
67 | + wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css'); |
|
68 | 68 | |
69 | - wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
69 | + wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
70 | 70 | |
71 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
71 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * before_widget, and after_widget. |
80 | 80 | * @param array $instance The settings for the particular instance of the widget. |
81 | 81 | */ |
82 | - public function widget( $args, $instance ){ |
|
83 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
84 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
82 | + public function widget($args, $instance) { |
|
83 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
84 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
85 | 85 | |
86 | 86 | echo $args['before_widget']; |
87 | 87 | |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.0 |
92 | 92 | */ |
93 | - do_action( 'give_before_forms_widget' ); |
|
93 | + do_action('give_before_forms_widget'); |
|
94 | 94 | |
95 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
95 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
96 | 96 | |
97 | - give_get_donation_form( $instance ); |
|
97 | + give_get_donation_form($instance); |
|
98 | 98 | |
99 | 99 | echo $args['after_widget']; |
100 | 100 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @since 1.0 |
105 | 105 | */ |
106 | - do_action( 'give_after_forms_widget' ); |
|
106 | + do_action('give_after_forms_widget'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - public function form( $instance ){ |
|
116 | + public function form($instance) { |
|
117 | 117 | $defaults = array( |
118 | 118 | 'title' => '', |
119 | 119 | 'id' => '', |
@@ -123,84 +123,84 @@ discard block |
||
123 | 123 | 'continue_button_title' => '', |
124 | 124 | ); |
125 | 125 | |
126 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
126 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
127 | 127 | |
128 | 128 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
129 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
129 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
130 | 130 | |
131 | 131 | // Query Give Forms |
132 | 132 | $args = array( |
133 | 133 | 'post_type' => 'give_forms', |
134 | - 'posts_per_page' => - 1, |
|
134 | + 'posts_per_page' => -1, |
|
135 | 135 | 'post_status' => 'publish', |
136 | 136 | ); |
137 | 137 | |
138 | - $give_forms = get_posts( $args ); |
|
138 | + $give_forms = get_posts($args); |
|
139 | 139 | ?> |
140 | 140 | <div class="give_forms_widget_container"> |
141 | 141 | |
142 | 142 | <?php // Widget: widget Title. ?> |
143 | 143 | <p> |
144 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
145 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
146 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
144 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
145 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
146 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
147 | 147 | </p> |
148 | 148 | |
149 | 149 | <?php // Widget: Give Form?> |
150 | 150 | <p> |
151 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
152 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
153 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
154 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
155 | - <?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?> |
|
156 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option> |
|
151 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
152 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
153 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
154 | + <?php foreach ($give_forms as $give_form) { ?> |
|
155 | + <?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?> |
|
156 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option> |
|
157 | 157 | <?php } ?> |
158 | 158 | </select><br> |
159 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
159 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
160 | 160 | </p> |
161 | 161 | |
162 | 162 | <?php // Widget: Display Style ?> |
163 | 163 | <p class="give_forms_display_style_setting_row"> |
164 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
165 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
166 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
167 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
168 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
164 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
165 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
166 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
167 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
168 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
169 | 169 | <small class="give-field-description"> |
170 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
170 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
171 | 171 | </small> |
172 | 172 | </p> |
173 | 173 | |
174 | 174 | <?php // Widget: Continue Button Title. ?> |
175 | 175 | <p class="give_forms_continue_button_title_setting_row"> |
176 | - <label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label> |
|
177 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br> |
|
178 | - <small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small> |
|
176 | + <label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label> |
|
177 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br> |
|
178 | + <small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small> |
|
179 | 179 | </p> |
180 | 180 | |
181 | 181 | <?php // Widget: Floating Labels ?> |
182 | 182 | <p> |
183 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
184 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
185 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
186 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
183 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
184 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
185 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
186 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
187 | 187 | <small class="give-field-description"> |
188 | 188 | <?php |
189 | 189 | printf( |
190 | 190 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
191 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
192 | - esc_url( 'http://docs.givewp.com/form-floating-labels' ) |
|
191 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
192 | + esc_url('http://docs.givewp.com/form-floating-labels') |
|
193 | 193 | ); |
194 | 194 | ?></small> |
195 | 195 | </p> |
196 | 196 | |
197 | 197 | <?php // Widget: Display Content ?> |
198 | 198 | <p> |
199 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
200 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
201 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
202 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
203 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
199 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
200 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
201 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
202 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
203 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
204 | 204 | </div> |
205 | 205 | <?php |
206 | 206 | } |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return void |
212 | 212 | */ |
213 | - function widget_init(){ |
|
214 | - register_widget( $this->self ); |
|
213 | + function widget_init() { |
|
214 | + register_widget($this->self); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return array |
224 | 224 | */ |
225 | - public function update( $new_instance, $old_instance ){ |
|
225 | + public function update($new_instance, $old_instance) { |
|
226 | 226 | $this->flush_widget_cache(); |
227 | 227 | |
228 | 228 | return $new_instance; |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - public function flush_widget_cache(){ |
|
237 | - wp_cache_delete( $this->self, 'widget' ); |
|
236 | + public function flush_widget_cache() { |
|
237 | + wp_cache_delete($this->self, 'widget'); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_form' ); |
|
30 | + parent::__construct('give_form'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | $create_form_link = sprintf( |
41 | 41 | /* translators: %s: create new form URL */ |
42 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
43 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
42 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
43 | + admin_url('post-new.php?post_type=give_forms') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | return array( |
@@ -50,68 +50,68 @@ discard block |
||
50 | 50 | 'post_type' => 'give_forms', |
51 | 51 | ), |
52 | 52 | 'name' => 'id', |
53 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
54 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
53 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
54 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
55 | 55 | 'required' => array( |
56 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
57 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
56 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
57 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
58 | 58 | ), |
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'container', |
62 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
62 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_title', |
67 | - 'label' => esc_attr__( 'Show Title', 'give' ), |
|
68 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Title', 'give'), |
|
68 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_goal', |
77 | - 'label' => esc_attr__( 'Show Goal', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Goal', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_content', |
87 | 87 | 'minWidth' => 240, |
88 | - 'label' => esc_attr__( 'Display Content', 'give' ), |
|
89 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
88 | + 'label' => esc_attr__('Display Content', 'give'), |
|
89 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
90 | 90 | 'options' => array( |
91 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
92 | - 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
93 | - 'below' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
91 | + 'none' => esc_html__('No Content', 'give'), |
|
92 | + 'above' => esc_html__('Display content ABOVE the fields', 'give'), |
|
93 | + 'below' => esc_html__('Display content BELOW the fields', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'type' => 'listbox', |
98 | 98 | 'name' => 'display_style', |
99 | 99 | 'classes' => 'give-display-style', |
100 | - 'label' => esc_attr__( 'Display Options', 'give' ), |
|
101 | - 'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ), |
|
100 | + 'label' => esc_attr__('Display Options', 'give'), |
|
101 | + 'tooltip' => esc_attr__('How would you like to display donation information?', 'give'), |
|
102 | 102 | 'options' => array( |
103 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
104 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
105 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
106 | - 'button' => esc_html__( 'Button', 'give' ), |
|
103 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
104 | + 'modal' => esc_html__('Modal', 'give'), |
|
105 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
106 | + 'button' => esc_html__('Button', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | 110 | 'type' => 'textbox', |
111 | 111 | 'classes' => 'give-hidden give-continue-button-title', |
112 | 112 | 'name' => 'continue_button_title', |
113 | - 'label' => esc_attr__( 'Button Text', 'give' ), |
|
114 | - 'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
113 | + 'label' => esc_attr__('Button Text', 'give'), |
|
114 | + 'tooltip' => esc_attr__('The button label for displaying the additional payment fields.', 'give'), |
|
115 | 115 | ), |
116 | 116 | ); |
117 | 117 | } |