@@ -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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_upgrades_screen() { |
24 | - $action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : ''; |
|
25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
29 | - $steps = round( ( $total / $number ), 0 ); |
|
24 | + $action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : ''; |
|
25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
29 | + $steps = round(($total / $number), 0); |
|
30 | 30 | |
31 | 31 | $doing_upgrade_args = array( |
32 | 32 | 'page' => 'give-upgrades', |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | 'custom' => $custom, |
37 | 37 | 'steps' => $steps |
38 | 38 | ); |
39 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
40 | - if ( $step > $steps ) { |
|
39 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
40 | + if ($step > $steps) { |
|
41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
42 | 42 | $steps = $step; |
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | - <h1><?php esc_html_e( 'Give - Upgrades', 'give' ); ?></h1> |
|
46 | + <h1><?php esc_html_e('Give - Upgrades', 'give'); ?></h1> |
|
47 | 47 | |
48 | - <?php if ( ! empty( $action ) ) : ?> |
|
48 | + <?php if ( ! empty($action)) : ?> |
|
49 | 49 | |
50 | 50 | <div id="give-upgrade-status"> |
51 | - <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
52 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
51 | + <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
52 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
53 | 53 | </p> |
54 | 54 | |
55 | - <?php if ( ! empty( $total ) ) : ?> |
|
55 | + <?php if ( ! empty($total)) : ?> |
|
56 | 56 | <p> |
57 | - <strong><?php printf( esc_html__( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong> |
|
57 | + <strong><?php printf(esc_html__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong> |
|
58 | 58 | </p> |
59 | 59 | <?php endif; ?> |
60 | 60 | </div> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | <div id="give-upgrade-status"> |
70 | 70 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
71 | + <?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
72 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
73 | 73 | </p> |
74 | 74 | </div> |
75 | 75 | <script type="text/javascript"> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_do_automatic_upgrades() { |
28 | 28 | $did_upgrade = false; |
29 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
30 | - if ( version_compare( $give_version, GIVE_VERSION, '<' ) ) { |
|
29 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
30 | + if (version_compare($give_version, GIVE_VERSION, '<')) { |
|
31 | 31 | give_v16_upgrades(); |
32 | 32 | $did_upgrade = true; |
33 | 33 | } |
34 | - if ( $did_upgrade ) { |
|
35 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
34 | + if ($did_upgrade) { |
|
35 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
39 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Display Upgrade Notices |
@@ -46,18 +46,18 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_show_upgrade_notices() { |
48 | 48 | |
49 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
49 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
50 | 50 | return; |
51 | 51 | } // Don't show notices on the upgrades page |
52 | 52 | |
53 | - $give_version = get_option( 'give_version' ); |
|
53 | + $give_version = get_option('give_version'); |
|
54 | 54 | |
55 | - if ( ! $give_version ) { |
|
55 | + if ( ! $give_version) { |
|
56 | 56 | // 1.0 is the first version to use this option so we must add it |
57 | 57 | $give_version = '1.0'; |
58 | 58 | } |
59 | 59 | |
60 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
60 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
61 | 61 | |
62 | 62 | /* |
63 | 63 | * NOTICE: |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | */ |
69 | 69 | |
70 | 70 | //v1.3.2 Upgrades |
71 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
71 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
72 | 72 | printf( |
73 | 73 | /* translators: %s: upgrade URL */ |
74 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
75 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
74 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
75 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | //v1.3.4 Upgrades //ensure the user has gone through 1.3.4 |
80 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
80 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
81 | 81 | printf( |
82 | 82 | /* translators: %s: upgrade URL */ |
83 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
84 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
83 | + '<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
84 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | } |
93 | 93 | |
94 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
94 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Triggers all upgrade functions |
@@ -103,26 +103,26 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function give_trigger_upgrades() { |
105 | 105 | |
106 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
107 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
106 | + if ( ! current_user_can('manage_give_settings')) { |
|
107 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
108 | 108 | } |
109 | 109 | |
110 | - $give_version = get_option( 'give_version' ); |
|
110 | + $give_version = get_option('give_version'); |
|
111 | 111 | |
112 | - if ( ! $give_version ) { |
|
112 | + if ( ! $give_version) { |
|
113 | 113 | // 1.0 is the first version to use this option so we must add it |
114 | 114 | $give_version = '1.0'; |
115 | - add_option( 'give_version', $give_version ); |
|
115 | + add_option('give_version', $give_version); |
|
116 | 116 | } |
117 | 117 | |
118 | - update_option( 'give_version', GIVE_VERSION ); |
|
118 | + update_option('give_version', GIVE_VERSION); |
|
119 | 119 | |
120 | - if ( DOING_AJAX ) { |
|
121 | - die( 'complete' ); |
|
120 | + if (DOING_AJAX) { |
|
121 | + die('complete'); |
|
122 | 122 | } // Let AJAX know that the upgrade is complete |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
125 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Check if the upgrade routine has been run for a specific action |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return bool If the action has been added to the completed actions array |
135 | 135 | */ |
136 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
136 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
137 | 137 | |
138 | - if ( empty( $upgrade_action ) ) { |
|
138 | + if (empty($upgrade_action)) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | 142 | $completed_upgrades = give_get_completed_upgrades(); |
143 | 143 | |
144 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
144 | + return in_array($upgrade_action, $completed_upgrades); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return bool If the function was successfully added |
156 | 156 | */ |
157 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
157 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
158 | 158 | |
159 | - if ( empty( $upgrade_action ) ) { |
|
159 | + if (empty($upgrade_action)) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | $completed_upgrades[] = $upgrade_action; |
165 | 165 | |
166 | 166 | // Remove any blanks, and only show uniques |
167 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
167 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
168 | 168 | |
169 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
169 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function give_get_completed_upgrades() { |
179 | 179 | |
180 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
180 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
181 | 181 | |
182 | - if ( false === $completed_upgrades ) { |
|
182 | + if (false === $completed_upgrades) { |
|
183 | 183 | $completed_upgrades = array(); |
184 | 184 | } |
185 | 185 | |
@@ -197,30 +197,30 @@ discard block |
||
197 | 197 | */ |
198 | 198 | function give_v132_upgrade_give_payment_customer_id() { |
199 | 199 | global $wpdb; |
200 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
201 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
200 | + if ( ! current_user_can('manage_give_settings')) { |
|
201 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
202 | 202 | } |
203 | 203 | |
204 | - ignore_user_abort( true ); |
|
204 | + ignore_user_abort(true); |
|
205 | 205 | |
206 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
207 | - @set_time_limit( 0 ); |
|
206 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
207 | + @set_time_limit(0); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | //UPDATE DB METAKEYS |
211 | 211 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
212 | - $query = $wpdb->query( $sql ); |
|
212 | + $query = $wpdb->query($sql); |
|
213 | 213 | |
214 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
215 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
216 | - delete_option( 'give_doing_upgrade' ); |
|
217 | - wp_redirect( admin_url() ); |
|
214 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
215 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
216 | + delete_option('give_doing_upgrade'); |
|
217 | + wp_redirect(admin_url()); |
|
218 | 218 | exit; |
219 | 219 | |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
223 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * Upgrades the Offline Status |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | |
235 | 235 | global $wpdb; |
236 | 236 | |
237 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
238 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
237 | + if ( ! current_user_can('manage_give_settings')) { |
|
238 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
239 | 239 | } |
240 | 240 | |
241 | - ignore_user_abort( true ); |
|
241 | + ignore_user_abort(true); |
|
242 | 242 | |
243 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
244 | - @set_time_limit( 0 ); |
|
243 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
244 | + @set_time_limit(0); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // Get abandoned offline payments |
@@ -251,35 +251,35 @@ discard block |
||
251 | 251 | $where .= "AND ( p.post_status = 'abandoned' )"; |
252 | 252 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
253 | 253 | |
254 | - $sql = $select . $join . $where; |
|
255 | - $found_payments = $wpdb->get_col( $sql ); |
|
254 | + $sql = $select.$join.$where; |
|
255 | + $found_payments = $wpdb->get_col($sql); |
|
256 | 256 | |
257 | 257 | |
258 | - foreach ( $found_payments as $payment ) { |
|
258 | + foreach ($found_payments as $payment) { |
|
259 | 259 | |
260 | 260 | //Only change ones marked abandoned since our release last week |
261 | 261 | //because the admin may have marked some abandoned themselves |
262 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
262 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
263 | 263 | |
264 | 264 | //1450124863 = 12/10/2015 20:42:25 |
265 | - if ( $modified_time >= 1450124863 ) { |
|
265 | + if ($modified_time >= 1450124863) { |
|
266 | 266 | |
267 | - give_update_payment_status( $payment, 'pending' ); |
|
267 | + give_update_payment_status($payment, 'pending'); |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | |
271 | 271 | } |
272 | 272 | |
273 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
274 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
275 | - delete_option( 'give_doing_upgrade' ); |
|
276 | - wp_redirect( admin_url() ); |
|
273 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
274 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
275 | + delete_option('give_doing_upgrade'); |
|
276 | + wp_redirect(admin_url()); |
|
277 | 277 | exit; |
278 | 278 | |
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
282 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Cleanup User Roles |
@@ -290,17 +290,17 @@ discard block |
||
290 | 290 | */ |
291 | 291 | function give_v152_cleanup_users() { |
292 | 292 | |
293 | - $give_version = get_option( 'give_version' ); |
|
293 | + $give_version = get_option('give_version'); |
|
294 | 294 | |
295 | - if ( ! $give_version ) { |
|
295 | + if ( ! $give_version) { |
|
296 | 296 | // 1.0 is the first version to use this option so we must add it |
297 | 297 | $give_version = '1.0'; |
298 | 298 | } |
299 | 299 | |
300 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
300 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
301 | 301 | |
302 | 302 | //v1.5.2 Upgrades |
303 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
303 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
304 | 304 | |
305 | 305 | //Delete all caps with "ss" |
306 | 306 | //Also delete all unused "campaign" roles |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | ); |
348 | 348 | |
349 | 349 | global $wp_roles; |
350 | - foreach ( $delete_caps as $cap ) { |
|
351 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
352 | - $wp_roles->remove_cap( $role, $cap ); |
|
350 | + foreach ($delete_caps as $cap) { |
|
351 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
352 | + $wp_roles->remove_cap($role, $cap); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -359,15 +359,15 @@ discard block |
||
359 | 359 | $roles->add_caps(); |
360 | 360 | |
361 | 361 | //The Update Ran |
362 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
363 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
364 | - delete_option( 'give_doing_upgrade' ); |
|
362 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
363 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
364 | + delete_option('give_doing_upgrade'); |
|
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | 368 | } |
369 | 369 | |
370 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
370 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
371 | 371 | |
372 | 372 | /** |
373 | 373 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h1><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h1><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | $create_form_link = sprintf( |
35 | 35 | /* translators: %s: create new form URL */ |
36 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
37 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
36 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
37 | + admin_url('post-new.php?post_type=give_forms') |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | return array( |
@@ -44,35 +44,35 @@ discard block |
||
44 | 44 | 'post_type' => 'give_forms', |
45 | 45 | ), |
46 | 46 | 'name' => 'id', |
47 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
48 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
47 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
48 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
49 | 49 | 'required' => array( |
50 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
51 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
50 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
51 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'container', |
56 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
56 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
57 | 57 | ), |
58 | 58 | array( |
59 | 59 | 'type' => 'listbox', |
60 | 60 | 'name' => 'show_text', |
61 | - 'label' => esc_attr__( 'Show Text:', 'give' ), |
|
62 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
61 | + 'label' => esc_attr__('Show Text:', 'give'), |
|
62 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
63 | 63 | 'options' => array( |
64 | - 'true' => esc_html__( 'Show', 'give' ), |
|
65 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
64 | + 'true' => esc_html__('Show', 'give'), |
|
65 | + 'false' => esc_html__('Hide', 'give'), |
|
66 | 66 | ), |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'type' => 'listbox', |
70 | 70 | 'name' => 'show_bar', |
71 | - 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
|
72 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
71 | + 'label' => esc_attr__('Show Progress Bar:', 'give'), |
|
72 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
73 | 73 | 'options' => array( |
74 | - 'true' => esc_html__( 'Show', 'give' ), |
|
75 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
74 | + 'true' => esc_html__('Show', 'give'), |
|
75 | + 'false' => esc_html__('Hide', 'give'), |
|
76 | 76 | ), |
77 | 77 | ), |
78 | 78 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | 38 | /* translators: %s: create new form URL */ |
39 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
40 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
39 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
40 | + admin_url('post-new.php?post_type=give_forms') |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | return array( |
@@ -47,68 +47,68 @@ discard block |
||
47 | 47 | 'post_type' => 'give_forms', |
48 | 48 | ), |
49 | 49 | 'name' => 'id', |
50 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
51 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
50 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
51 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
52 | 52 | 'required' => array( |
53 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
54 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
53 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
54 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'container', |
59 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional form settings', 'give' ) ), |
|
59 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional form settings', 'give')), |
|
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'type' => 'listbox', |
63 | 63 | 'name' => 'show_title', |
64 | - 'label' => esc_attr__( 'Show Title:', 'give' ), |
|
65 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
64 | + 'label' => esc_attr__('Show Title:', 'give'), |
|
65 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
66 | 66 | 'options' => array( |
67 | - 'true' => esc_html__( 'Show', 'give' ), |
|
68 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
67 | + 'true' => esc_html__('Show', 'give'), |
|
68 | + 'false' => esc_html__('Hide', 'give'), |
|
69 | 69 | ), |
70 | 70 | ), |
71 | 71 | array( |
72 | 72 | 'type' => 'listbox', |
73 | 73 | 'name' => 'show_goal', |
74 | - 'label' => esc_attr__( 'Show Goal:', 'give' ), |
|
75 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
74 | + 'label' => esc_attr__('Show Goal:', 'give'), |
|
75 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'show_content', |
84 | 84 | 'minWidth' => 240, |
85 | - 'label' => esc_attr__( 'Display Content:', 'give' ), |
|
86 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
85 | + 'label' => esc_attr__('Display Content:', 'give'), |
|
86 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
87 | 87 | 'options' => array( |
88 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
89 | - 'above' => esc_html__( 'Display above the form fields', 'give' ), |
|
90 | - 'below' => esc_html__( 'Display below the form fields', 'give' ), |
|
88 | + 'none' => esc_html__('No Content', 'give'), |
|
89 | + 'above' => esc_html__('Display above the form fields', 'give'), |
|
90 | + 'below' => esc_html__('Display below the form fields', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | array( |
94 | 94 | 'type' => 'listbox', |
95 | 95 | 'name' => 'display_style', |
96 | - 'label' => esc_attr__( 'Payment Fields:', 'give' ), |
|
97 | - 'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ), |
|
96 | + 'label' => esc_attr__('Payment Fields:', 'give'), |
|
97 | + 'tooltip' => esc_attr__('How would you like to display payment information?', 'give'), |
|
98 | 98 | 'options' => array( |
99 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
100 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
101 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
99 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
100 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
101 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | array( |
105 | 105 | 'type' => 'listbox', |
106 | 106 | 'name' => 'float_labels', |
107 | - 'label' => esc_attr__( 'Floating Labels:', 'give' ), |
|
108 | - 'tooltip' => esc_attr__( 'Override the default floating labels setting for this form?', 'give' ), |
|
107 | + 'label' => esc_attr__('Floating Labels:', 'give'), |
|
108 | + 'tooltip' => esc_attr__('Override the default floating labels setting for this form?', 'give'), |
|
109 | 109 | 'options' => array( |
110 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
111 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
110 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
111 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
112 | 112 | ), |
113 | 113 | ), |
114 | 114 | ); |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | 'row_classes' => 'give-subfield', |
76 | 76 | 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
77 | 77 | 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
78 | - 'sanitization_cb' => 'give_sanitize_price_field_value', |
|
79 | - 'attributes' => array( |
|
78 | + 'sanitization_cb' => 'give_sanitize_price_field_value', |
|
79 | + 'attributes' => array( |
|
80 | 80 | 'placeholder' => give_format_decimal( '1.00' ), |
81 | 81 | 'value' => give_format_decimal( $price ), |
82 | 82 | 'class' => 'cmb-type-text-small give-money-field', |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
112 | 112 | 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
113 | 113 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
114 | - 'attributes' => array( |
|
114 | + 'attributes' => array( |
|
115 | 115 | 'placeholder' => give_format_decimal( '1.00' ), |
116 | 116 | 'class' => 'cmb-type-text-small give-money-field', |
117 | 117 | ), |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | 'row_classes' => 'give-subfield', |
167 | 167 | 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
168 | 168 | 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
169 | - 'sanitization_cb' => 'give_sanitize_price_field_value', |
|
170 | - 'attributes' => array( |
|
169 | + 'sanitization_cb' => 'give_sanitize_price_field_value', |
|
170 | + 'attributes' => array( |
|
171 | 171 | 'placeholder' => give_format_decimal('1.00'), |
172 | 172 | 'value' => give_format_decimal( $custom_amount_minimum ), |
173 | 173 | 'class' => 'cmb-type-text-small give-money-field', |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,330 +48,330 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => esc_html__('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
61 | - 'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => esc_html__('Donation Option', 'give'), |
|
61 | + 'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
67 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => esc_html__('Set Donation', 'give'), |
|
67 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
72 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => esc_html__('Set Donation', 'give'), |
|
72 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
78 | 78 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
79 | 79 | 'attributes' => array( |
80 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
81 | - 'value' => give_format_decimal( $price ), |
|
80 | + 'placeholder' => give_format_decimal('1.00'), |
|
81 | + 'value' => give_format_decimal($price), |
|
82 | 82 | 'class' => 'cmb-type-text-small give-money-field', |
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | //Donation levels: Header |
86 | 86 | array( |
87 | - 'id' => $prefix . 'levels_header', |
|
87 | + 'id' => $prefix.'levels_header', |
|
88 | 88 | 'type' => 'levels_repeater_header', |
89 | 89 | ), |
90 | 90 | //Donation Levels: Repeatable CMB2 Group |
91 | 91 | array( |
92 | - 'id' => $prefix . 'donation_levels', |
|
92 | + 'id' => $prefix.'donation_levels', |
|
93 | 93 | 'type' => 'group', |
94 | 94 | 'row_classes' => 'give-subfield', |
95 | 95 | 'options' => array( |
96 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
96 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
97 | 97 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
98 | 98 | 'sortable' => true, // beta |
99 | 99 | ), |
100 | 100 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
101 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
101 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
102 | 102 | array( |
103 | - 'name' => esc_html__( 'ID', 'give' ), |
|
104 | - 'id' => $prefix . 'id', |
|
103 | + 'name' => esc_html__('ID', 'give'), |
|
104 | + 'id' => $prefix.'id', |
|
105 | 105 | 'type' => 'levels_id', |
106 | 106 | ), |
107 | 107 | array( |
108 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
109 | - 'id' => $prefix . 'amount', |
|
108 | + 'name' => esc_html__('Amount', 'give'), |
|
109 | + 'id' => $prefix.'amount', |
|
110 | 110 | 'type' => 'text_small', |
111 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
112 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
111 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
112 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
113 | 113 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
114 | 114 | 'attributes' => array( |
115 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
115 | + 'placeholder' => give_format_decimal('1.00'), |
|
116 | 116 | 'class' => 'cmb-type-text-small give-money-field', |
117 | 117 | ), |
118 | 118 | 'before' => 'give_format_admin_multilevel_amount', |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => esc_html__( 'Text', 'give' ), |
|
122 | - 'id' => $prefix . 'text', |
|
121 | + 'name' => esc_html__('Text', 'give'), |
|
122 | + 'id' => $prefix.'text', |
|
123 | 123 | 'type' => 'text', |
124 | 124 | 'attributes' => array( |
125 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
125 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
126 | 126 | 'class' => 'give-multilevel-text-field', |
127 | 127 | ), |
128 | 128 | ), |
129 | 129 | array( |
130 | - 'name' => esc_html__( 'Default', 'give' ), |
|
131 | - 'id' => $prefix . 'default', |
|
130 | + 'name' => esc_html__('Default', 'give'), |
|
131 | + 'id' => $prefix.'default', |
|
132 | 132 | 'type' => 'give_default_radio_inline' |
133 | 133 | ), |
134 | - ) ), |
|
134 | + )), |
|
135 | 135 | ), |
136 | 136 | //Display Style |
137 | 137 | array( |
138 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
139 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
140 | - 'id' => $prefix . 'display_style', |
|
138 | + 'name' => esc_html__('Display Style', 'give'), |
|
139 | + 'description' => esc_html__('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' => esc_html__( 'Buttons', 'give' ), |
|
145 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
146 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
144 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
145 | + 'radios' => esc_html__('Radios', 'give'), |
|
146 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
147 | 147 | ), |
148 | 148 | ), |
149 | 149 | //Custom Amount |
150 | 150 | array( |
151 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
152 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
153 | - 'id' => $prefix . 'custom_amount', |
|
151 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
152 | + 'description' => esc_html__('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' => 'no', |
156 | 156 | 'options' => array( |
157 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
158 | - 'no' => esc_html__( 'No', 'give' ), |
|
157 | + 'yes' => esc_html__('Yes', 'give'), |
|
158 | + 'no' => esc_html__('No', 'give'), |
|
159 | 159 | ), |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
163 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
162 | + 'name' => esc_html__('Custom Amount Minimum', 'give'), |
|
163 | + 'description' => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
164 | + 'id' => $prefix.'custom_amount_minimum', |
|
165 | 165 | 'type' => 'text_small', |
166 | 166 | 'row_classes' => 'give-subfield', |
167 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
168 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
167 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
168 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
169 | 169 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
170 | 170 | 'attributes' => array( |
171 | 171 | 'placeholder' => give_format_decimal('1.00'), |
172 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
172 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
173 | 173 | 'class' => 'cmb-type-text-small give-money-field', |
174 | 174 | ) |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
178 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
179 | - 'id' => $prefix . 'custom_amount_text', |
|
177 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
178 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
179 | + 'id' => $prefix.'custom_amount_text', |
|
180 | 180 | 'type' => 'text', |
181 | 181 | 'row_classes' => 'give-subfield', |
182 | 182 | 'attributes' => array( |
183 | 183 | 'rows' => 3, |
184 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
184 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
185 | 185 | ), |
186 | 186 | ), |
187 | 187 | //Goals |
188 | 188 | array( |
189 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
190 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
191 | - 'id' => $prefix . 'goal_option', |
|
189 | + 'name' => esc_html__('Goal', 'give'), |
|
190 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
191 | + 'id' => $prefix.'goal_option', |
|
192 | 192 | 'type' => 'radio_inline', |
193 | 193 | 'default' => 'no', |
194 | 194 | 'options' => array( |
195 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
196 | - 'no' => esc_html__( 'No', 'give' ), |
|
195 | + 'yes' => esc_html__('Yes', 'give'), |
|
196 | + 'no' => esc_html__('No', 'give'), |
|
197 | 197 | ), |
198 | 198 | ), |
199 | 199 | array( |
200 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
201 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
202 | - 'id' => $prefix . 'set_goal', |
|
200 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
201 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
202 | + 'id' => $prefix.'set_goal', |
|
203 | 203 | 'type' => 'text_small', |
204 | 204 | 'row_classes' => 'give-subfield', |
205 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
206 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
205 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
206 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
207 | 207 | 'sanitization_cb' => 'give_sanitize_price_field_value', |
208 | 208 | 'attributes' => array( |
209 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
210 | - 'value' => give_format_decimal( $goal ), |
|
209 | + 'placeholder' => give_format_decimal('0.00'), |
|
210 | + 'value' => give_format_decimal($goal), |
|
211 | 211 | 'class' => 'cmb-type-text-small give-money-field', |
212 | 212 | ), |
213 | 213 | ), |
214 | 214 | |
215 | 215 | array( |
216 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
217 | - 'description' => esc_html__( 'Would you like 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' ), |
|
218 | - 'id' => $prefix . 'goal_format', |
|
216 | + 'name' => esc_html__('Goal Format', 'give'), |
|
217 | + 'description' => esc_html__('Would you like 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'), |
|
218 | + 'id' => $prefix.'goal_format', |
|
219 | 219 | 'type' => 'radio_inline', |
220 | 220 | 'default' => 'amount', |
221 | 221 | 'row_classes' => 'give-subfield', |
222 | 222 | 'options' => array( |
223 | - 'amount' => esc_html__( 'Amount ', 'give' ), |
|
224 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
223 | + 'amount' => esc_html__('Amount ', 'give'), |
|
224 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
225 | 225 | ), |
226 | 226 | ), |
227 | 227 | array( |
228 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
229 | - 'id' => $prefix . 'goal_color', |
|
228 | + 'name' => esc_html__('Goal Progress Bar Color', 'give'), |
|
229 | + 'id' => $prefix.'goal_color', |
|
230 | 230 | 'type' => 'colorpicker', |
231 | 231 | 'row_classes' => 'give-subfield', |
232 | 232 | 'default' => '#2bc253', |
233 | 233 | ), |
234 | 234 | |
235 | 235 | array( |
236 | - 'name' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
237 | - 'desc' => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
238 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
236 | + 'name' => esc_html__('Close Form when Goal Achieved', 'give'), |
|
237 | + 'desc' => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
238 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
239 | 239 | 'type' => 'radio_inline', |
240 | 240 | 'row_classes' => 'give-subfield', |
241 | 241 | 'options' => array( |
242 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
243 | - 'no' => esc_html__( 'No', 'give' ), |
|
242 | + 'yes' => esc_html__('Yes', 'give'), |
|
243 | + 'no' => esc_html__('No', 'give'), |
|
244 | 244 | ), |
245 | 245 | 'default' => 'no', |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
249 | - 'desc' => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
250 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
248 | + 'name' => esc_html__('Goal Achieved Message', 'give'), |
|
249 | + 'desc' => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
250 | + 'id' => $prefix.'form_goal_achieved_message', |
|
251 | 251 | 'type' => 'textarea', |
252 | 252 | 'row_classes' => 'give-subfield', |
253 | 253 | 'attributes' => array( |
254 | - 'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
254 | + 'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
255 | 255 | ), |
256 | 256 | ) |
257 | 257 | ) |
258 | 258 | ) |
259 | - ) ); |
|
259 | + )); |
|
260 | 260 | |
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Content Field |
264 | 264 | */ |
265 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
265 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
266 | 266 | 'id' => 'form_content_options', |
267 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
268 | - 'object_types' => array( 'give_forms' ), |
|
267 | + 'title' => esc_html__('Form Content', 'give'), |
|
268 | + 'object_types' => array('give_forms'), |
|
269 | 269 | 'context' => 'normal', |
270 | 270 | 'priority' => 'high', //Show above Content WYSIWYG |
271 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
271 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
272 | 272 | //Donation Option |
273 | 273 | array( |
274 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
275 | - 'description' => esc_html__( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
276 | - 'id' => $prefix . 'content_option', |
|
274 | + 'name' => esc_html__('Display Content', 'give'), |
|
275 | + 'description' => esc_html__('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
276 | + 'id' => $prefix.'content_option', |
|
277 | 277 | 'type' => 'select', |
278 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
279 | - 'none' => esc_html__( 'No content', 'give' ), |
|
280 | - 'give_pre_form' => esc_html__( 'Yes, display content ABOVE the form fields', 'give' ), |
|
281 | - 'give_post_form' => esc_html__( 'Yes, display content BELOW the form fields', 'give' ), |
|
278 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
279 | + 'none' => esc_html__('No content', 'give'), |
|
280 | + 'give_pre_form' => esc_html__('Yes, display content ABOVE the form fields', 'give'), |
|
281 | + 'give_post_form' => esc_html__('Yes, display content BELOW the form fields', 'give'), |
|
282 | 282 | ) |
283 | 283 | ), |
284 | 284 | 'default' => 'none', |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => esc_html__( 'Content', 'give' ), |
|
288 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
289 | - 'id' => $prefix . 'form_content', |
|
287 | + 'name' => esc_html__('Content', 'give'), |
|
288 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
289 | + 'id' => $prefix.'form_content', |
|
290 | 290 | 'row_classes' => 'give-subfield', |
291 | 291 | 'type' => 'wysiwyg' |
292 | 292 | ), |
293 | 293 | ) |
294 | 294 | ) |
295 | - ) ); |
|
295 | + )); |
|
296 | 296 | |
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Display Options |
300 | 300 | */ |
301 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
301 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
302 | 302 | 'id' => 'form_display_options', |
303 | - 'title' => esc_html__( 'Form Display Options', 'give' ), |
|
304 | - 'object_types' => array( 'give_forms' ), |
|
303 | + 'title' => esc_html__('Form Display Options', 'give'), |
|
304 | + 'object_types' => array('give_forms'), |
|
305 | 305 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
306 | 306 | 'priority' => 'high', //Show above Content WYSIWYG |
307 | 307 | 'show_names' => true, // Show field names on the left |
308 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
308 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
309 | 309 | array( |
310 | - 'name' => esc_html__( 'Payment Fields', 'give' ), |
|
311 | - 'desc' => esc_html__( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
312 | - 'id' => $prefix . 'payment_display', |
|
310 | + 'name' => esc_html__('Payment Fields', 'give'), |
|
311 | + 'desc' => esc_html__('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
312 | + 'id' => $prefix.'payment_display', |
|
313 | 313 | 'type' => 'select', |
314 | 314 | 'options' => array( |
315 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
316 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
317 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
315 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
316 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
317 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
318 | 318 | ), |
319 | 319 | 'default' => 'onpage', |
320 | 320 | ), |
321 | 321 | array( |
322 | - 'id' => $prefix . 'reveal_label', |
|
323 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
324 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
322 | + 'id' => $prefix.'reveal_label', |
|
323 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'), |
|
324 | + 'desc' => esc_html__('The button label for completing the donation.', 'give'), |
|
325 | 325 | 'type' => 'text_small', |
326 | 326 | 'row_classes' => 'give-subfield', |
327 | 327 | 'attributes' => array( |
328 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
328 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
329 | 329 | ), |
330 | 330 | ), |
331 | 331 | array( |
332 | - 'id' => $prefix . 'checkout_label', |
|
333 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
334 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
332 | + 'id' => $prefix.'checkout_label', |
|
333 | + 'name' => esc_html__('Complete Donation Text', 'give'), |
|
334 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
335 | 335 | 'type' => 'text_small', |
336 | 336 | 'attributes' => array( |
337 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
337 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
338 | 338 | ), |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
342 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
343 | - 'id' => $prefix . 'default_gateway', |
|
341 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
342 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
343 | + 'id' => $prefix.'default_gateway', |
|
344 | 344 | 'type' => 'default_gateway' |
345 | 345 | ), |
346 | 346 | array( |
347 | - 'name' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
348 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
349 | - 'id' => $prefix . 'logged_in_only', |
|
347 | + 'name' => esc_html__('Disable Guest Donations', 'give'), |
|
348 | + 'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'), |
|
349 | + 'id' => $prefix.'logged_in_only', |
|
350 | 350 | 'type' => 'checkbox' |
351 | 351 | ), |
352 | 352 | array( |
353 | - 'name' => esc_html__( 'Register / Login Form', 'give' ), |
|
354 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
355 | - 'id' => $prefix . 'show_register_form', |
|
353 | + 'name' => esc_html__('Register / Login Form', 'give'), |
|
354 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
355 | + 'id' => $prefix.'show_register_form', |
|
356 | 356 | 'type' => 'select', |
357 | 357 | 'options' => array( |
358 | - 'both' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
359 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
360 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
361 | - 'none' => esc_html__( 'None', 'give' ), |
|
358 | + 'both' => esc_html__('Registration and Login Forms', 'give'), |
|
359 | + 'registration' => esc_html__('Registration Form Only', 'give'), |
|
360 | + 'login' => esc_html__('Login Form Only', 'give'), |
|
361 | + 'none' => esc_html__('None', 'give'), |
|
362 | 362 | ), |
363 | 363 | 'default' => 'none', |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
366 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
367 | 367 | /* translators: %s: forms http://bradfrost.com/blog/post/float-label-pattern/ */ |
368 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
369 | - 'id' => $prefix . 'form_floating_labels', |
|
368 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
369 | + 'id' => $prefix.'form_floating_labels', |
|
370 | 370 | 'type' => 'select', |
371 | 371 | 'options' => array( |
372 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
373 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
374 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
372 | + '' => esc_html__('Use the global setting', 'give'), |
|
373 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
374 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
375 | 375 | ), |
376 | 376 | 'default' => 'none', |
377 | 377 | ) |
@@ -383,47 +383,47 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * Terms & Conditions |
385 | 385 | */ |
386 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
386 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
387 | 387 | 'id' => 'form_terms_options', |
388 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
389 | - 'object_types' => array( 'give_forms' ), |
|
388 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
389 | + 'object_types' => array('give_forms'), |
|
390 | 390 | 'context' => 'normal', |
391 | 391 | 'priority' => 'high', //Show above Content WYSIWYG |
392 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
392 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
393 | 393 | //Donation Option |
394 | 394 | array( |
395 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
396 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
397 | - 'id' => $prefix . 'terms_option', |
|
395 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
396 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
397 | + 'id' => $prefix.'terms_option', |
|
398 | 398 | 'type' => 'select', |
399 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
400 | - 'none' => esc_html__( 'No', 'give' ), |
|
401 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
399 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
400 | + 'none' => esc_html__('No', 'give'), |
|
401 | + 'yes' => esc_html__('Yes', 'give'), |
|
402 | 402 | ) |
403 | 403 | ), |
404 | 404 | 'default' => 'none', |
405 | 405 | ), |
406 | 406 | array( |
407 | - 'id' => $prefix . 'agree_label', |
|
408 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
409 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
407 | + 'id' => $prefix.'agree_label', |
|
408 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
409 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
410 | 410 | 'type' => 'text', |
411 | 411 | 'row_classes' => 'give-subfield', |
412 | 412 | 'size' => 'regular', |
413 | 413 | 'attributes' => array( |
414 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
414 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
415 | 415 | ), |
416 | 416 | ), |
417 | 417 | array( |
418 | - 'id' => $prefix . 'agree_text', |
|
418 | + 'id' => $prefix.'agree_text', |
|
419 | 419 | 'row_classes' => 'give-subfield', |
420 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
421 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
420 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
421 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
422 | 422 | 'type' => 'wysiwyg' |
423 | 423 | ), |
424 | 424 | ) |
425 | 425 | ) |
426 | - ) ); |
|
426 | + )); |
|
427 | 427 | |
428 | 428 | return $meta_boxes; |
429 | 429 | |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | |
438 | 438 | <div class="table-container"> |
439 | 439 | <div class="table-row"> |
440 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
441 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
442 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
440 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div> |
|
441 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div> |
|
442 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div> |
|
443 | 443 | <?php |
444 | 444 | /** |
445 | 445 | * Fires in repeatable donation levels table head. |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @since 1.0 |
453 | 453 | */ |
454 | - do_action( 'give_donation_levels_table_head' ); |
|
454 | + do_action('give_donation_levels_table_head'); |
|
455 | 455 | ?> |
456 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
456 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div> |
|
457 | 457 | |
458 | 458 | </div> |
459 | 459 | </div> |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | <?php |
462 | 462 | } |
463 | 463 | |
464 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
464 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
465 | 465 | |
466 | 466 | |
467 | 467 | /** |
@@ -478,25 +478,25 @@ discard block |
||
478 | 478 | * @param $object_type |
479 | 479 | * @param $field_type_object |
480 | 480 | */ |
481 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
481 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
482 | 482 | |
483 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
483 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
484 | 484 | |
485 | 485 | $field_options_array = array( |
486 | 486 | 'class' => 'give-hidden give-level-id-input', |
487 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
488 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
487 | + 'name' => $field_type_object->_name('[level_id]'), |
|
488 | + 'id' => $field_type_object->_id('_level_id'), |
|
489 | 489 | 'value' => $escaped_value, |
490 | 490 | 'type' => 'number', |
491 | 491 | 'desc' => '', |
492 | 492 | ); |
493 | 493 | |
494 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
495 | - echo $field_type_object->input( $field_options_array ); |
|
494 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
495 | + echo $field_type_object->input($field_options_array); |
|
496 | 496 | |
497 | 497 | } |
498 | 498 | |
499 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
499 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
500 | 500 | |
501 | 501 | |
502 | 502 | /** |
@@ -508,13 +508,13 @@ discard block |
||
508 | 508 | * @param $object_type |
509 | 509 | * @param $field_type_object |
510 | 510 | */ |
511 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
512 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
513 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
511 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
512 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
513 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
514 | 514 | |
515 | 515 | } |
516 | 516 | |
517 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
517 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
518 | 518 | |
519 | 519 | |
520 | 520 | /** |
@@ -524,20 +524,20 @@ discard block |
||
524 | 524 | */ |
525 | 525 | function give_add_shortcode_to_publish_metabox() { |
526 | 526 | |
527 | - if ( 'give_forms' !== get_post_type() ) { |
|
527 | + if ('give_forms' !== get_post_type()) { |
|
528 | 528 | return false; |
529 | 529 | } |
530 | 530 | |
531 | 531 | global $post; |
532 | 532 | |
533 | 533 | //Only enqueue scripts for CPT on post type screen |
534 | - if ( 'give_forms' === $post->post_type ) { |
|
534 | + if ('give_forms' === $post->post_type) { |
|
535 | 535 | //Shortcode column with select all input |
536 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
537 | - echo '<div class="shortcode-wrap box-sizing"><label>' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
536 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
537 | + echo '<div class="shortcode-wrap box-sizing"><label>'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
538 | 538 | |
539 | 539 | } |
540 | 540 | |
541 | 541 | } |
542 | 542 | |
543 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
543 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -defined( 'ABSPATH' ) or exit; |
|
13 | +defined('ABSPATH') or exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Give Form widget |
17 | 17 | * |
18 | 18 | * @since 1.0 |
19 | 19 | */ |
20 | -class Give_Forms_Widget extends WP_Widget{ |
|
20 | +class Give_Forms_Widget extends WP_Widget { |
|
21 | 21 | /** |
22 | 22 | * The widget class name |
23 | 23 | * |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * Instantiate the class |
30 | 30 | */ |
31 | - public function __construct(){ |
|
32 | - $this->self = get_class( $this ); |
|
31 | + public function __construct() { |
|
32 | + $this->self = get_class($this); |
|
33 | 33 | |
34 | 34 | parent::__construct( |
35 | - strtolower( $this->self ), |
|
36 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
35 | + strtolower($this->self), |
|
36 | + esc_html__('Give - Donation Form', 'give'), |
|
37 | 37 | array( |
38 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
38 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
39 | 39 | ) |
40 | 40 | ); |
41 | 41 | |
42 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
43 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
42 | + add_action('widgets_init', array($this, 'widget_init')); |
|
43 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,23 +50,23 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function admin_widget_scripts( $hook ){ |
|
53 | + public function admin_widget_scripts($hook) { |
|
54 | 54 | // Directories of assets |
55 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
56 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
57 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
55 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
56 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
57 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
58 | 58 | |
59 | 59 | // Use minified libraries if SCRIPT_DEBUG is turned off |
60 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
60 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
61 | 61 | |
62 | 62 | // Widget Script |
63 | - if ( $hook == 'widgets.php' ) { |
|
63 | + if ($hook == 'widgets.php') { |
|
64 | 64 | |
65 | - wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' ); |
|
65 | + wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css'); |
|
66 | 66 | |
67 | - wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
67 | + wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
68 | 68 | |
69 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
69 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | * before_widget, and after_widget. |
78 | 78 | * @param array $instance The settings for the particular instance of the widget. |
79 | 79 | */ |
80 | - public function widget( $args, $instance ){ |
|
81 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
82 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
80 | + public function widget($args, $instance) { |
|
81 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
82 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
83 | 83 | |
84 | 84 | echo $args['before_widget']; |
85 | 85 | |
86 | - do_action( 'give_before_forms_widget' ); |
|
86 | + do_action('give_before_forms_widget'); |
|
87 | 87 | |
88 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
88 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
89 | 89 | |
90 | - give_get_donation_form( $instance ); |
|
90 | + give_get_donation_form($instance); |
|
91 | 91 | |
92 | 92 | echo $args['after_widget']; |
93 | 93 | |
94 | - do_action( 'give_after_forms_widget' ); |
|
94 | + do_action('give_after_forms_widget'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -101,65 +101,65 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function form( $instance ){ |
|
104 | + public function form($instance) { |
|
105 | 105 | $defaults = array( |
106 | 106 | 'title' => '', |
107 | 107 | 'id' => '', |
108 | 108 | 'float_labels' => '', |
109 | 109 | ); |
110 | 110 | |
111 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
111 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
112 | 112 | |
113 | 113 | // Query Give Forms |
114 | 114 | $args = array( |
115 | 115 | 'post_type' => 'give_forms', |
116 | - 'posts_per_page' => - 1, |
|
116 | + 'posts_per_page' => -1, |
|
117 | 117 | 'post_status' => 'publish', |
118 | 118 | ); |
119 | 119 | |
120 | - $give_forms = get_posts( $args ); |
|
120 | + $give_forms = get_posts($args); |
|
121 | 121 | |
122 | 122 | // Widget: Title |
123 | 123 | |
124 | 124 | ?><p> |
125 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
126 | - <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> |
|
127 | - <small><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
125 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
126 | + <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> |
|
127 | + <small><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
128 | 128 | </p><?php |
129 | 129 | |
130 | 130 | // Widget: Give Form |
131 | 131 | |
132 | 132 | ?><p> |
133 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php |
|
133 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php |
|
134 | 134 | printf( |
135 | 135 | /* translators: %s: form singular label */ |
136 | - esc_html__( 'Give %s:', 'give' ), |
|
136 | + esc_html__('Give %s:', 'give'), |
|
137 | 137 | give_get_forms_label_singular() |
138 | 138 | ); |
139 | 139 | ?></label> |
140 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
141 | - <option value="current"><?php esc_html_e( '— Select —', 'give' ); ?></option> |
|
142 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
143 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option> |
|
140 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
141 | + <option value="current"><?php esc_html_e('— Select —', 'give'); ?></option> |
|
142 | + <?php foreach ($give_forms as $give_form) { ?> |
|
143 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option> |
|
144 | 144 | <?php } ?> |
145 | 145 | </select><br> |
146 | - <small><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
146 | + <small><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
147 | 147 | </p><?php |
148 | 148 | |
149 | 149 | // Widget: Floating Labels |
150 | 150 | |
151 | 151 | ?><p> |
152 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label> |
|
153 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"> |
|
154 | - <option value="" <?php selected( esc_attr( $instance['float_labels'] ), '' ) ?>><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
155 | - <option value="enabled" <?php selected( esc_attr( $instance['float_labels'] ), 'enabled' ) ?>><?php esc_html_e( 'Enabled', 'give' ); ?></option> |
|
156 | - <option value="disabled" <?php selected( esc_attr( $instance['float_labels'] ), 'disabled' ) ?>><?php esc_html_e( 'Disabled', 'give' ); ?></option> |
|
152 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label> |
|
153 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"> |
|
154 | + <option value="" <?php selected(esc_attr($instance['float_labels']), '') ?>><?php esc_html_e('- Select -', 'give'); ?></option> |
|
155 | + <option value="enabled" <?php selected(esc_attr($instance['float_labels']), 'enabled') ?>><?php esc_html_e('Enabled', 'give'); ?></option> |
|
156 | + <option value="disabled" <?php selected(esc_attr($instance['float_labels']), 'disabled') ?>><?php esc_html_e('Disabled', 'give'); ?></option> |
|
157 | 157 | </select><br> |
158 | 158 | <small><?php |
159 | 159 | printf( |
160 | 160 | /* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */ |
161 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
162 | - esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' ) |
|
161 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
162 | + esc_url('http://bradfrost.com/blog/post/float-label-pattern/') |
|
163 | 163 | ); |
164 | 164 | ?></small> |
165 | 165 | </p><?php |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - function widget_init(){ |
|
174 | - register_widget( $this->self ); |
|
173 | + function widget_init() { |
|
174 | + register_widget($this->self); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return array |
184 | 184 | */ |
185 | - public function update( $new_instance, $old_instance ){ |
|
185 | + public function update($new_instance, $old_instance) { |
|
186 | 186 | $this->flush_widget_cache(); |
187 | 187 | |
188 | 188 | return $new_instance; |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @return void |
195 | 195 | */ |
196 | - public function flush_widget_cache(){ |
|
197 | - wp_cache_delete( $this->self, 'widget' ); |
|
196 | + public function flush_widget_cache() { |
|
197 | + wp_cache_delete($this->self, 'widget'); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 |
@@ -790,8 +790,11 @@ |
||
790 | 790 | } |
791 | 791 | ?> |
792 | 792 | </select> |
793 | - <?php else : ?> |
|
794 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e( 'State / Province', 'give' ); ?>"/> |
|
793 | + <?php else { |
|
794 | + : ?> |
|
795 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e( 'State / Province', 'give' ); |
|
796 | +} |
|
797 | +?>"/> |
|
795 | 798 | <?php endif; ?> |
796 | 799 | </p> |
797 | 800 | <?php do_action( 'give_cc_billing_bottom' ); ?> |
@@ -1189,10 +1189,10 @@ |
||
1189 | 1189 | |
1190 | 1190 | function give_show_goal_progress( $form_id, $args ) { |
1191 | 1191 | |
1192 | - ob_start(); |
|
1193 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1192 | + ob_start(); |
|
1193 | + give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1194 | 1194 | |
1195 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1195 | + echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1196 | 1196 | |
1197 | 1197 | return true; |
1198 | 1198 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,47 +23,47 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string $purchase_form |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | 62 | //Get the form wrap CSS classes. |
63 | - $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
64 | 64 | |
65 | 65 | //Get the <form> tag wrap CSS classes. |
66 | - $form_classes = $form->get_form_classes($args); |
|
66 | + $form_classes = $form->get_form_classes($args); |
|
67 | 67 | |
68 | 68 | ob_start(); |
69 | 69 | |
@@ -75,35 +75,35 @@ discard block |
||
75 | 75 | * @param int $form ->ID The current form ID |
76 | 76 | * @param array $args An array of form args |
77 | 77 | */ |
78 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
78 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
79 | 79 | |
80 | 80 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
81 | 81 | |
82 | - <?php if ( $form->is_close_donation_form() ) { |
|
82 | + <?php if ($form->is_close_donation_form()) { |
|
83 | 83 | |
84 | 84 | //Get Goal thank you message. |
85 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
86 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
85 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
86 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
87 | 87 | |
88 | 88 | //Print thank you message. |
89 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
89 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
90 | 90 | |
91 | 91 | } else { |
92 | 92 | |
93 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
93 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
94 | 94 | |
95 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
95 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | - do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
99 | + do_action('give_pre_form', $form->ID, $args); ?> |
|
100 | 100 | |
101 | 101 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
102 | 102 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
103 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
104 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
105 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
106 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
103 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
104 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
105 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
106 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
107 | 107 | |
108 | 108 | <!-- The following field is for robots only, invisible to humans: --> |
109 | 109 | <span class="give-hidden" style="display: none !important;"> |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | <?php |
115 | 115 | |
116 | 116 | //Price ID hidden field for variable (mult-level) donation forms |
117 | - if ( give_has_variable_prices( $form_id ) ) { |
|
117 | + if (give_has_variable_prices($form_id)) { |
|
118 | 118 | //get default selected price ID |
119 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
119 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
120 | 120 | $price_id = 0; |
121 | 121 | //loop through prices |
122 | - foreach ( $prices as $price ) { |
|
123 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
122 | + foreach ($prices as $price) { |
|
123 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
124 | 124 | $price_id = $price['_give_id']['level_id']; |
125 | 125 | }; |
126 | 126 | } |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
129 | 129 | <?php } |
130 | 130 | |
131 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
131 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
132 | 132 | |
133 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
133 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
134 | 134 | |
135 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
135 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
136 | 136 | |
137 | 137 | ?> |
138 | 138 | </form> |
139 | 139 | |
140 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
140 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
141 | 141 | |
142 | 142 | <?php } ?> |
143 | 143 | |
144 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
144 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
145 | 145 | <?php |
146 | 146 | |
147 | 147 | /** |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @param int $form ->ID The current form ID |
153 | 153 | * @param array $args An array of form args |
154 | 154 | */ |
155 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
155 | + do_action('give_post_form_output', $form->ID, $args); |
|
156 | 156 | |
157 | 157 | $final_output = ob_get_clean(); |
158 | 158 | |
159 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
159 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -175,43 +175,43 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return string |
177 | 177 | */ |
178 | -function give_show_purchase_form( $form_id ) { |
|
178 | +function give_show_purchase_form($form_id) { |
|
179 | 179 | |
180 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
180 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
181 | 181 | |
182 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
182 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
183 | 183 | $form_id = $_POST['give_form_id']; |
184 | 184 | } |
185 | 185 | |
186 | - do_action( 'give_purchase_form_top', $form_id ); |
|
186 | + do_action('give_purchase_form_top', $form_id); |
|
187 | 187 | |
188 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
188 | + if (give_can_checkout() && isset($form_id)) { |
|
189 | 189 | |
190 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
190 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
191 | 191 | |
192 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
192 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
193 | 193 | |
194 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
194 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
195 | 195 | |
196 | 196 | // Load the credit card form and allow gateways to load their own if they wish |
197 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
198 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
197 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
198 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
199 | 199 | } else { |
200 | - do_action( 'give_cc_form', $form_id ); |
|
200 | + do_action('give_cc_form', $form_id); |
|
201 | 201 | } |
202 | 202 | |
203 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
203 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
204 | 204 | |
205 | 205 | } else { |
206 | 206 | // Can't checkout |
207 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
207 | + do_action('give_purchase_form_no_access', $form_id); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
211 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
211 | + do_action('give_purchase_form_bottom', $form_id); |
|
212 | 212 | } |
213 | 213 | |
214 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
214 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
215 | 215 | |
216 | 216 | /** |
217 | 217 | * |
@@ -223,26 +223,26 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void |
225 | 225 | */ |
226 | -function give_show_register_login_fields( $form_id ) { |
|
226 | +function give_show_register_login_fields($form_id) { |
|
227 | 227 | |
228 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
228 | + $show_register_form = give_show_login_register_option($form_id); |
|
229 | 229 | |
230 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
230 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
231 | 231 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
232 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
232 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
233 | 233 | </div> |
234 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
234 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
235 | 235 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
236 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
236 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
237 | 237 | </div> |
238 | 238 | <?php endif; ?> |
239 | 239 | |
240 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
241 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
240 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
241 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
245 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Donation Amount Field |
@@ -256,33 +256,33 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return void |
258 | 258 | */ |
259 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
259 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
260 | 260 | |
261 | 261 | global $give_options; |
262 | 262 | |
263 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
264 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
265 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
266 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
267 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
268 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
269 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
263 | + $variable_pricing = give_has_variable_prices($form_id); |
|
264 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
265 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
266 | + $symbol = give_currency_symbol(give_get_currency()); |
|
267 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
268 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
269 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
270 | 270 | |
271 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
271 | + do_action('give_before_donation_levels', $form_id, $args); |
|
272 | 272 | |
273 | 273 | //Set Price, No Custom Amount Allowed means hidden price field |
274 | - if ( $allow_custom_amount == 'no' ) { |
|
274 | + if ($allow_custom_amount == 'no') { |
|
275 | 275 | ?> |
276 | 276 | |
277 | - <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
277 | + <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
278 | 278 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
279 | 279 | value="<?php echo $default_amount; ?>" required> |
280 | 280 | <div class="set-price give-donation-amount form-row-wide"> |
281 | - <?php if ( $currency_position == 'before' ) { |
|
281 | + <?php if ($currency_position == 'before') { |
|
282 | 282 | echo $currency_output; |
283 | 283 | } ?> |
284 | 284 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
285 | - <?php if ( $currency_position == 'after' ) { |
|
285 | + <?php if ($currency_position == 'after') { |
|
286 | 286 | echo $currency_output; |
287 | 287 | } ?> |
288 | 288 | </div> |
@@ -292,34 +292,34 @@ discard block |
||
292 | 292 | ?> |
293 | 293 | <div class="give-total-wrap"> |
294 | 294 | <div class="give-donation-amount form-row-wide"> |
295 | - <?php if ( $currency_position == 'before' ) { |
|
295 | + <?php if ($currency_position == 'before') { |
|
296 | 296 | echo $currency_output; |
297 | 297 | } ?> |
298 | - <label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
298 | + <label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
299 | 299 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
300 | - <?php if ( $currency_position == 'after' ) { |
|
300 | + <?php if ($currency_position == 'after') { |
|
301 | 301 | echo $currency_output; |
302 | 302 | } ?> |
303 | 303 | </div> |
304 | 304 | </div> |
305 | 305 | <?php } |
306 | 306 | |
307 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
307 | + do_action('give_after_donation_amount', $form_id, $args); |
|
308 | 308 | |
309 | 309 | //Custom Amount Text |
310 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
310 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
311 | 311 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
312 | 312 | <?php } |
313 | 313 | |
314 | 314 | //Output Variable Pricing Levels |
315 | - if ( $variable_pricing ) { |
|
316 | - give_output_levels( $form_id ); |
|
315 | + if ($variable_pricing) { |
|
316 | + give_output_levels($form_id); |
|
317 | 317 | } |
318 | 318 | |
319 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
319 | + do_action('give_after_donation_levels', $form_id, $args); |
|
320 | 320 | } |
321 | 321 | |
322 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
322 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
323 | 323 | |
324 | 324 | |
325 | 325 | /** |
@@ -331,32 +331,32 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @return string |
333 | 333 | */ |
334 | -function give_output_levels( $form_id ) { |
|
334 | +function give_output_levels($form_id) { |
|
335 | 335 | |
336 | 336 | //Get variable pricing |
337 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
338 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
339 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
340 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
341 | - if ( empty( $custom_amount_text ) ) { |
|
342 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
337 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
338 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
339 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
340 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
341 | + if (empty($custom_amount_text)) { |
|
342 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | $output = ''; |
346 | 346 | $counter = 0; |
347 | 347 | |
348 | - switch ( $display_style ) { |
|
348 | + switch ($display_style) { |
|
349 | 349 | case 'buttons': |
350 | 350 | |
351 | 351 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
352 | 352 | |
353 | - foreach ( $prices as $price ) { |
|
354 | - $counter ++; |
|
355 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
356 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
353 | + foreach ($prices as $price) { |
|
354 | + $counter++; |
|
355 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
356 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
357 | 357 | |
358 | 358 | $output .= '<li>'; |
359 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
359 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
360 | 360 | $output .= $level_text; |
361 | 361 | $output .= '</button>'; |
362 | 362 | $output .= '</li>'; |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } |
365 | 365 | |
366 | 366 | //Custom Amount |
367 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
367 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
368 | 368 | $output .= '<li>'; |
369 | 369 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
370 | 370 | $output .= $custom_amount_text; |
@@ -380,23 +380,23 @@ discard block |
||
380 | 380 | |
381 | 381 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
382 | 382 | |
383 | - foreach ( $prices as $price ) { |
|
384 | - $counter ++; |
|
385 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
386 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
383 | + foreach ($prices as $price) { |
|
384 | + $counter++; |
|
385 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
386 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
387 | 387 | |
388 | 388 | $output .= '<li>'; |
389 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
390 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
389 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
390 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
391 | 391 | $output .= '</li>'; |
392 | 392 | |
393 | 393 | } |
394 | 394 | |
395 | 395 | //Custom Amount |
396 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
396 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
397 | 397 | $output .= '<li>'; |
398 | 398 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
399 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
399 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
400 | 400 | $output .= '</li>'; |
401 | 401 | } |
402 | 402 | |
@@ -406,23 +406,23 @@ discard block |
||
406 | 406 | |
407 | 407 | case 'dropdown': |
408 | 408 | |
409 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
410 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
409 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
410 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
411 | 411 | |
412 | 412 | //first loop through prices |
413 | - foreach ( $prices as $price ) { |
|
414 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
415 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
413 | + foreach ($prices as $price) { |
|
414 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
415 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
416 | 416 | |
417 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
417 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
418 | 418 | $output .= $level_text; |
419 | 419 | $output .= '</option>'; |
420 | 420 | |
421 | 421 | } |
422 | 422 | |
423 | 423 | //Custom Amount |
424 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
425 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
424 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
425 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | $output .= '</select>'; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | break; |
431 | 431 | } |
432 | 432 | |
433 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
433 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -442,26 +442,26 @@ discard block |
||
442 | 442 | * @param array $args |
443 | 443 | * |
444 | 444 | */ |
445 | -function give_display_checkout_button( $form_id, $args ) { |
|
445 | +function give_display_checkout_button($form_id, $args) { |
|
446 | 446 | |
447 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
447 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
448 | 448 | ? $args['display_style'] |
449 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
449 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
450 | 450 | |
451 | 451 | //no btn for onpage |
452 | - if ( $display_option === 'onpage' ) { |
|
452 | + if ($display_option === 'onpage') { |
|
453 | 453 | return; |
454 | 454 | } |
455 | 455 | |
456 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
457 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
456 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
457 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
458 | 458 | |
459 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
459 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
460 | 460 | |
461 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
461 | + echo apply_filters('give_display_checkout_button', $output); |
|
462 | 462 | } |
463 | 463 | |
464 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
464 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
465 | 465 | |
466 | 466 | /** |
467 | 467 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -472,71 +472,71 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @return void |
474 | 474 | */ |
475 | -function give_user_info_fields( $form_id ) { |
|
475 | +function give_user_info_fields($form_id) { |
|
476 | 476 | |
477 | - if ( is_user_logged_in() ) : |
|
478 | - $user_data = get_userdata( get_current_user_id() ); |
|
477 | + if (is_user_logged_in()) : |
|
478 | + $user_data = get_userdata(get_current_user_id()); |
|
479 | 479 | endif; |
480 | 480 | |
481 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
481 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
482 | 482 | ?> |
483 | 483 | <fieldset id="give_checkout_user_info"> |
484 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
484 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
485 | 485 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
486 | 486 | <label class="give-label" for="give-first"> |
487 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
488 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
487 | + <?php esc_html_e('First Name', 'give'); ?> |
|
488 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
489 | 489 | <span class="give-required-indicator">*</span> |
490 | 490 | <?php } ?> |
491 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
491 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
492 | 492 | </label> |
493 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_html_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
493 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_html_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
494 | 494 | echo ' required '; |
495 | 495 | } ?>/> |
496 | 496 | </p> |
497 | 497 | |
498 | 498 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
499 | 499 | <label class="give-label" for="give-last"> |
500 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
501 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
500 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
501 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
502 | 502 | <span class="give-required-indicator">*</span> |
503 | 503 | <?php } ?> |
504 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
504 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
505 | 505 | </label> |
506 | 506 | |
507 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
507 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
508 | 508 | echo ' required'; |
509 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_html_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
509 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_html_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
510 | 510 | echo ' required '; |
511 | 511 | } ?> /> |
512 | 512 | </p> |
513 | 513 | |
514 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
514 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
515 | 515 | <p id="give-email-wrap" class="form-row form-row-wide"> |
516 | 516 | <label class="give-label" for="give-email"> |
517 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
518 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
517 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
518 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
519 | 519 | <span class="give-required-indicator">*</span> |
520 | 520 | <?php } ?> |
521 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
521 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
522 | 522 | </label> |
523 | 523 | |
524 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_html_e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
524 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_html_e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
525 | 525 | echo ' required '; |
526 | 526 | } ?>/> |
527 | 527 | |
528 | 528 | </p> |
529 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
529 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
530 | 530 | |
531 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
531 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
532 | 532 | </fieldset> |
533 | 533 | <?php |
534 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
534 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
535 | 535 | |
536 | 536 | } |
537 | 537 | |
538 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
539 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
538 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
539 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
540 | 540 | |
541 | 541 | /** |
542 | 542 | * Renders the credit card info form. |
@@ -547,73 +547,73 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @return void |
549 | 549 | */ |
550 | -function give_get_cc_form( $form_id ) { |
|
550 | +function give_get_cc_form($form_id) { |
|
551 | 551 | |
552 | 552 | ob_start(); |
553 | 553 | |
554 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
554 | + do_action('give_before_cc_fields', $form_id); ?> |
|
555 | 555 | |
556 | 556 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
557 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
558 | - <?php if ( is_ssl() ) : ?> |
|
557 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
558 | + <?php if (is_ssl()) : ?> |
|
559 | 559 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
560 | 560 | <span class="give-icon padlock"></span> |
561 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
561 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
562 | 562 | </div> |
563 | 563 | <?php endif; ?> |
564 | 564 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
565 | 565 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
566 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
566 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
567 | 567 | <span class="give-required-indicator">*</span> |
568 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
568 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
569 | 569 | <span class="card-type"></span> |
570 | 570 | </label> |
571 | 571 | |
572 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_html_e( 'Card number', 'give' ); ?>" required/> |
|
572 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_html_e('Card number', 'give'); ?>" required/> |
|
573 | 573 | </p> |
574 | 574 | |
575 | 575 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
576 | 576 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
577 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
577 | + <?php esc_html_e('CVC', 'give'); ?> |
|
578 | 578 | <span class="give-required-indicator">*</span> |
579 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
579 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
580 | 580 | </label> |
581 | 581 | |
582 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_html_e( 'Security code', 'give' ); ?>" required/> |
|
582 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_html_e('Security code', 'give'); ?>" required/> |
|
583 | 583 | </p> |
584 | 584 | |
585 | 585 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
586 | 586 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
587 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
587 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
588 | 588 | <span class="give-required-indicator">*</span> |
589 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
589 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
590 | 590 | </label> |
591 | 591 | |
592 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_html_e( 'Card name', 'give' ); ?>" required/> |
|
592 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_html_e('Card name', 'give'); ?>" required/> |
|
593 | 593 | </p> |
594 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
594 | + <?php do_action('give_before_cc_expiration'); ?> |
|
595 | 595 | <p class="card-expiration form-row form-row-one-third"> |
596 | 596 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
597 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
597 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
598 | 598 | <span class="give-required-indicator">*</span> |
599 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
599 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
600 | 600 | </label> |
601 | 601 | |
602 | 602 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
603 | 603 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
604 | 604 | |
605 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_html_e( 'MM / YY', 'give' ); ?>" required/> |
|
605 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_html_e('MM / YY', 'give'); ?>" required/> |
|
606 | 606 | </p> |
607 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
607 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
608 | 608 | |
609 | 609 | </fieldset> |
610 | 610 | <?php |
611 | - do_action( 'give_after_cc_fields', $form_id ); |
|
611 | + do_action('give_after_cc_fields', $form_id); |
|
612 | 612 | |
613 | 613 | echo ob_get_clean(); |
614 | 614 | } |
615 | 615 | |
616 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
616 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
617 | 617 | |
618 | 618 | /** |
619 | 619 | * Outputs the default credit card address fields |
@@ -624,110 +624,110 @@ discard block |
||
624 | 624 | * |
625 | 625 | * @return void |
626 | 626 | */ |
627 | -function give_default_cc_address_fields( $form_id ) { |
|
627 | +function give_default_cc_address_fields($form_id) { |
|
628 | 628 | |
629 | 629 | $logged_in = is_user_logged_in(); |
630 | 630 | |
631 | - if ( $logged_in ) { |
|
632 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
631 | + if ($logged_in) { |
|
632 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
633 | 633 | } |
634 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
635 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
636 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
637 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
634 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
635 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
636 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
637 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
638 | 638 | ob_start(); ?> |
639 | 639 | <fieldset id="give_cc_address" class="cc-address"> |
640 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
641 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
640 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
641 | + <?php do_action('give_cc_billing_top'); ?> |
|
642 | 642 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
643 | 643 | <label for="card_address" class="give-label"> |
644 | - <?php esc_html_e( 'Address', 'give' ); ?> |
|
644 | + <?php esc_html_e('Address', 'give'); ?> |
|
645 | 645 | <?php |
646 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
646 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
647 | 647 | <span class="give-required-indicator">*</span> |
648 | 648 | <?php } ?> |
649 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
649 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
650 | 650 | </label> |
651 | 651 | |
652 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
652 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
653 | 653 | echo ' required'; |
654 | - } ?>" placeholder="<?php esc_html_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
654 | + } ?>" placeholder="<?php esc_html_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
655 | 655 | echo ' required '; |
656 | 656 | } ?>/> |
657 | 657 | </p> |
658 | 658 | |
659 | 659 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
660 | 660 | <label for="card_address_2" class="give-label"> |
661 | - <?php esc_html_e( 'Address Line 2', 'give' ); ?> |
|
662 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
661 | + <?php esc_html_e('Address Line 2', 'give'); ?> |
|
662 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
663 | 663 | <span class="give-required-indicator">*</span> |
664 | 664 | <?php } ?> |
665 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
665 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
666 | 666 | </label> |
667 | 667 | |
668 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
668 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
669 | 669 | echo ' required'; |
670 | - } ?>" placeholder="<?php esc_html_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
670 | + } ?>" placeholder="<?php esc_html_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
671 | 671 | echo ' required '; |
672 | 672 | } ?>/> |
673 | 673 | </p> |
674 | 674 | |
675 | 675 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
676 | 676 | <label for="card_city" class="give-label"> |
677 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
678 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
677 | + <?php esc_html_e('City', 'give'); ?> |
|
678 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
679 | 679 | <span class="give-required-indicator">*</span> |
680 | 680 | <?php } ?> |
681 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
681 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The city for your billing address.', 'give'); ?>"></span> |
|
682 | 682 | </label> |
683 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
683 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
684 | 684 | echo ' required'; |
685 | - } ?>" placeholder="<?php esc_html_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
685 | + } ?>" placeholder="<?php esc_html_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
686 | 686 | echo ' required '; |
687 | 687 | } ?>/> |
688 | 688 | </p> |
689 | 689 | |
690 | 690 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
691 | 691 | <label for="card_zip" class="give-label"> |
692 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
693 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
692 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
693 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
694 | 694 | <span class="give-required-indicator">*</span> |
695 | 695 | <?php } ?> |
696 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
696 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
697 | 697 | </label> |
698 | 698 | |
699 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
699 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
700 | 700 | echo ' required'; |
701 | - } ?>" placeholder="<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
701 | + } ?>" placeholder="<?php esc_html_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
702 | 702 | echo ' required '; |
703 | 703 | } ?>/> |
704 | 704 | </p> |
705 | 705 | |
706 | 706 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
707 | 707 | <label for="billing_country" class="give-label"> |
708 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
709 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
708 | + <?php esc_html_e('Country', 'give'); ?> |
|
709 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
710 | 710 | <span class="give-required-indicator">*</span> |
711 | 711 | <?php } ?> |
712 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
712 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The country for your billing address.', 'give'); ?>"></span> |
|
713 | 713 | </label> |
714 | 714 | |
715 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
715 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
716 | 716 | echo ' required'; |
717 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
717 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
718 | 718 | echo ' required '; |
719 | 719 | } ?>> |
720 | 720 | <?php |
721 | 721 | |
722 | 722 | $selected_country = give_get_country(); |
723 | 723 | |
724 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
724 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
725 | 725 | $selected_country = $user_address['country']; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $countries = give_get_country_list(); |
729 | - foreach ( $countries as $country_code => $country ) { |
|
730 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
729 | + foreach ($countries as $country_code => $country) { |
|
730 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
731 | 731 | } |
732 | 732 | ?> |
733 | 733 | </select> |
@@ -735,44 +735,44 @@ discard block |
||
735 | 735 | |
736 | 736 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
737 | 737 | <label for="card_state" class="give-label"> |
738 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
739 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
738 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
739 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
740 | 740 | <span class="give-required-indicator">*</span> |
741 | 741 | <?php } ?> |
742 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
742 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
743 | 743 | </label> |
744 | 744 | |
745 | 745 | <?php |
746 | 746 | $selected_state = give_get_state(); |
747 | - $states = give_get_states( $selected_country ); |
|
747 | + $states = give_get_states($selected_country); |
|
748 | 748 | |
749 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
749 | + if ($logged_in && ! empty($user_address['state'])) { |
|
750 | 750 | $selected_state = $user_address['state']; |
751 | 751 | } |
752 | 752 | |
753 | - if ( ! empty( $states ) ) : ?> |
|
754 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
753 | + if ( ! empty($states)) : ?> |
|
754 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
755 | 755 | echo ' required'; |
756 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
756 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
757 | 757 | echo ' required '; |
758 | 758 | } ?>> |
759 | 759 | <?php |
760 | - foreach ( $states as $state_code => $state ) { |
|
761 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
760 | + foreach ($states as $state_code => $state) { |
|
761 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
762 | 762 | } |
763 | 763 | ?> |
764 | 764 | </select> |
765 | 765 | <?php else : ?> |
766 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e( 'State / Province', 'give' ); ?>"/> |
|
766 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e('State / Province', 'give'); ?>"/> |
|
767 | 767 | <?php endif; ?> |
768 | 768 | </p> |
769 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
769 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
770 | 770 | </fieldset> |
771 | 771 | <?php |
772 | 772 | echo ob_get_clean(); |
773 | 773 | } |
774 | 774 | |
775 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
775 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
776 | 776 | |
777 | 777 | |
778 | 778 | /** |
@@ -784,93 +784,93 @@ discard block |
||
784 | 784 | * |
785 | 785 | * @return string |
786 | 786 | */ |
787 | -function give_get_register_fields( $form_id ) { |
|
787 | +function give_get_register_fields($form_id) { |
|
788 | 788 | |
789 | 789 | global $user_ID; |
790 | 790 | |
791 | - if ( is_user_logged_in() ) { |
|
792 | - $user_data = get_userdata( $user_ID ); |
|
791 | + if (is_user_logged_in()) { |
|
792 | + $user_data = get_userdata($user_ID); |
|
793 | 793 | } |
794 | 794 | |
795 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
795 | + $show_register_form = give_show_login_register_option($form_id); |
|
796 | 796 | |
797 | 797 | ob_start(); ?> |
798 | 798 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
799 | 799 | |
800 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
800 | + <?php if ($show_register_form == 'both') { ?> |
|
801 | 801 | <div class="give-login-account-wrap"> |
802 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
803 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
802 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
803 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
804 | 804 | </p> |
805 | 805 | <p class="give-loading-text"> |
806 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
806 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
807 | 807 | </div> |
808 | 808 | <?php } ?> |
809 | 809 | |
810 | - <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
810 | + <?php do_action('give_register_fields_before', $form_id); ?> |
|
811 | 811 | |
812 | 812 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
813 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
814 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
815 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
813 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
814 | + if ( ! give_logged_in_only($form_id)) { |
|
815 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
816 | 816 | } ?></legend> |
817 | - <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
817 | + <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
818 | 818 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
819 | 819 | <label for="give-user-login-<?php echo $form_id; ?>"> |
820 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
821 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
820 | + <?php esc_html_e('Username', 'give'); ?> |
|
821 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
822 | 822 | <span class="give-required-indicator">*</span> |
823 | 823 | <?php } ?> |
824 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
824 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
825 | 825 | </label> |
826 | 826 | |
827 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
827 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
828 | 828 | echo 'required '; |
829 | - } ?>give-input" type="text" placeholder="<?php esc_html_e( 'Username', 'give' ); ?>" title="<?php esc_html_e( 'Username', 'give' ); ?>"/> |
|
829 | + } ?>give-input" type="text" placeholder="<?php esc_html_e('Username', 'give'); ?>" title="<?php esc_html_e('Username', 'give'); ?>"/> |
|
830 | 830 | </div> |
831 | 831 | |
832 | 832 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
833 | 833 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
834 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
835 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
834 | + <?php esc_html_e('Password', 'give'); ?> |
|
835 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
836 | 836 | <span class="give-required-indicator">*</span> |
837 | 837 | <?php } ?> |
838 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
838 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The password used to access your account.', 'give'); ?>"></span> |
|
839 | 839 | </label> |
840 | 840 | |
841 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
841 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
842 | 842 | echo 'required '; |
843 | - } ?>give-input" placeholder="<?php esc_html_e( 'Password', 'give' ); ?>" type="password"/> |
|
843 | + } ?>give-input" placeholder="<?php esc_html_e('Password', 'give'); ?>" type="password"/> |
|
844 | 844 | </div> |
845 | 845 | |
846 | 846 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
847 | 847 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
848 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
849 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
848 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
849 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
850 | 850 | <span class="give-required-indicator">*</span> |
851 | 851 | <?php } ?> |
852 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
852 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
853 | 853 | </label> |
854 | 854 | |
855 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
855 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
856 | 856 | echo 'required '; |
857 | - } ?>give-input" placeholder="<?php esc_html_e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
857 | + } ?>give-input" placeholder="<?php esc_html_e('Confirm password', 'give'); ?>" type="password"/> |
|
858 | 858 | </div> |
859 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
859 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
860 | 860 | </fieldset> |
861 | 861 | |
862 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
862 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
863 | 863 | |
864 | 864 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
865 | 865 | |
866 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
866 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
867 | 867 | |
868 | 868 | </fieldset> |
869 | 869 | <?php |
870 | 870 | echo ob_get_clean(); |
871 | 871 | } |
872 | 872 | |
873 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
873 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -883,79 +883,79 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return string |
885 | 885 | */ |
886 | -function give_get_login_fields( $form_id ) { |
|
886 | +function give_get_login_fields($form_id) { |
|
887 | 887 | |
888 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
889 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
888 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
889 | + $show_register_form = give_show_login_register_option($form_id); |
|
890 | 890 | |
891 | 891 | ob_start(); |
892 | 892 | ?> |
893 | 893 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
894 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
895 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
896 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
894 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
895 | + if ( ! give_logged_in_only($form_id)) { |
|
896 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
897 | 897 | } ?> |
898 | 898 | </legend> |
899 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
899 | + <?php if ($show_register_form == 'both') { ?> |
|
900 | 900 | <p class="give-new-account-link"> |
901 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
902 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
903 | - <?php esc_html_e( 'Register', 'give' ); |
|
904 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
905 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
901 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
902 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
903 | + <?php esc_html_e('Register', 'give'); |
|
904 | + if ( ! give_logged_in_only($form_id)) { |
|
905 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
906 | 906 | } ?> |
907 | 907 | </a> |
908 | 908 | </p> |
909 | 909 | <p class="give-loading-text"> |
910 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
910 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
911 | 911 | <?php } ?> |
912 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
912 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
913 | 913 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
914 | 914 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
915 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
916 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
915 | + <?php esc_html_e('Username', 'give'); ?> |
|
916 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
917 | 917 | <span class="give-required-indicator">*</span> |
918 | 918 | <?php } ?> |
919 | 919 | </label> |
920 | 920 | |
921 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
921 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
922 | 922 | echo 'required '; |
923 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_html_e( 'Your username', 'give' ); ?>"/> |
|
923 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_html_e('Your username', 'give'); ?>"/> |
|
924 | 924 | </div> |
925 | 925 | |
926 | 926 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
927 | 927 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
928 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
929 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
928 | + <?php esc_html_e('Password', 'give'); ?> |
|
929 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
930 | 930 | <span class="give-required-indicator">*</span> |
931 | 931 | <?php } ?> |
932 | 932 | </label> |
933 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
933 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
934 | 934 | echo 'required '; |
935 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_html_e( 'Your password', 'give' ); ?>"/> |
|
935 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_html_e('Your password', 'give'); ?>"/> |
|
936 | 936 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
937 | 937 | </div> |
938 | 938 | |
939 | 939 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
940 | 940 | <span class="give-forgot-password "> |
941 | - <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset password?' ) ?></a> |
|
941 | + <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset password?') ?></a> |
|
942 | 942 | </span> |
943 | 943 | </div> |
944 | 944 | |
945 | 945 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
946 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_html_e( 'Login', 'give' ); ?>"/> |
|
947 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
948 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_html_e( 'Cancel', 'give' ); ?>"/> |
|
946 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_html_e('Login', 'give'); ?>"/> |
|
947 | + <?php if ($show_register_form !== 'login') { ?> |
|
948 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_html_e('Cancel', 'give'); ?>"/> |
|
949 | 949 | <?php } ?> |
950 | 950 | <span class="give-loading-animation"></span> |
951 | 951 | </div> |
952 | - <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
952 | + <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
953 | 953 | </fieldset><!--end #give-login-fields--> |
954 | 954 | <?php |
955 | 955 | echo ob_get_clean(); |
956 | 956 | } |
957 | 957 | |
958 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
958 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
959 | 959 | |
960 | 960 | /** |
961 | 961 | * Payment Mode Select |
@@ -971,49 +971,49 @@ discard block |
||
971 | 971 | * |
972 | 972 | * @return void |
973 | 973 | */ |
974 | -function give_payment_mode_select( $form_id ) { |
|
974 | +function give_payment_mode_select($form_id) { |
|
975 | 975 | |
976 | 976 | $gateways = give_get_enabled_payment_gateways(); |
977 | 977 | |
978 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
978 | + do_action('give_payment_mode_top', $form_id); ?> |
|
979 | 979 | |
980 | 980 | <fieldset id="give-payment-mode-select"> |
981 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
981 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
982 | 982 | <div id="give-payment-mode-wrap"> |
983 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
984 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
983 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
984 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
985 | 985 | </legend> |
986 | 986 | <?php |
987 | 987 | |
988 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
988 | + do_action('give_payment_mode_before_gateways') ?> |
|
989 | 989 | |
990 | 990 | <ul id="give-gateway-radio-list"> |
991 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
992 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
991 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
992 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
993 | 993 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
994 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
995 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
994 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
995 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
996 | 996 | echo '</label></li>'; |
997 | 997 | endforeach; ?> |
998 | 998 | </ul> |
999 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
999 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
1000 | 1000 | </div> |
1001 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
1001 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
1002 | 1002 | </fieldset> |
1003 | 1003 | |
1004 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
1004 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
1005 | 1005 | |
1006 | 1006 | <div id="give_purchase_form_wrap"> |
1007 | 1007 | |
1008 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
1008 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
1009 | 1009 | |
1010 | 1010 | </div><!-- the checkout fields are loaded into this--> |
1011 | 1011 | |
1012 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
1012 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
1013 | 1013 | |
1014 | 1014 | } |
1015 | 1015 | |
1016 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1016 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1017 | 1017 | |
1018 | 1018 | |
1019 | 1019 | /** |
@@ -1027,36 +1027,36 @@ discard block |
||
1027 | 1027 | * |
1028 | 1028 | * @return void |
1029 | 1029 | */ |
1030 | -function give_terms_agreement( $form_id ) { |
|
1030 | +function give_terms_agreement($form_id) { |
|
1031 | 1031 | |
1032 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1033 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1034 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1032 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1033 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1034 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1035 | 1035 | |
1036 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1036 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1037 | 1037 | <fieldset id="give_terms_agreement"> |
1038 | - <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
1038 | + <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
1039 | 1039 | <?php |
1040 | - do_action( 'give_before_terms' ); |
|
1041 | - echo wpautop( stripslashes( $terms ) ); |
|
1042 | - do_action( 'give_after_terms' ); |
|
1040 | + do_action('give_before_terms'); |
|
1041 | + echo wpautop(stripslashes($terms)); |
|
1042 | + do_action('give_after_terms'); |
|
1043 | 1043 | ?> |
1044 | 1044 | </div> |
1045 | 1045 | <div id="give_show_terms"> |
1046 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1047 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1046 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1047 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1048 | 1048 | </div> |
1049 | 1049 | |
1050 | 1050 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1051 | 1051 | <label |
1052 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label> |
|
1052 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label> |
|
1053 | 1053 | |
1054 | 1054 | </fieldset> |
1055 | 1055 | <?php |
1056 | 1056 | } |
1057 | 1057 | } |
1058 | 1058 | |
1059 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1059 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1060 | 1060 | |
1061 | 1061 | /** |
1062 | 1062 | * Checkout Final Total |
@@ -1069,27 +1069,27 @@ discard block |
||
1069 | 1069 | * |
1070 | 1070 | * @return void |
1071 | 1071 | */ |
1072 | -function give_checkout_final_total( $form_id ) { |
|
1072 | +function give_checkout_final_total($form_id) { |
|
1073 | 1073 | |
1074 | - if ( isset( $_POST['give_total'] ) ) { |
|
1075 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1074 | + if (isset($_POST['give_total'])) { |
|
1075 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1076 | 1076 | } else { |
1077 | 1077 | //default total |
1078 | - $total = give_get_default_form_amount( $form_id ); |
|
1078 | + $total = give_get_default_form_amount($form_id); |
|
1079 | 1079 | } |
1080 | 1080 | //Only proceed if give_total available |
1081 | - if ( empty( $total ) ) { |
|
1081 | + if (empty($total)) { |
|
1082 | 1082 | return; |
1083 | 1083 | } |
1084 | 1084 | ?> |
1085 | 1085 | <p id="give-final-total-wrap" class="form-wrap "> |
1086 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1087 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1086 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1087 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1088 | 1088 | </p> |
1089 | 1089 | <?php |
1090 | 1090 | } |
1091 | 1091 | |
1092 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1092 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1093 | 1093 | |
1094 | 1094 | |
1095 | 1095 | /** |
@@ -1101,22 +1101,22 @@ discard block |
||
1101 | 1101 | * |
1102 | 1102 | * @return void |
1103 | 1103 | */ |
1104 | -function give_checkout_submit( $form_id ) { |
|
1104 | +function give_checkout_submit($form_id) { |
|
1105 | 1105 | ?> |
1106 | 1106 | <fieldset id="give_purchase_submit"> |
1107 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1107 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1108 | 1108 | |
1109 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1109 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1110 | 1110 | |
1111 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1111 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1112 | 1112 | |
1113 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1113 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1114 | 1114 | |
1115 | 1115 | </fieldset> |
1116 | 1116 | <?php |
1117 | 1117 | } |
1118 | 1118 | |
1119 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1119 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | /** |
@@ -1129,17 +1129,17 @@ discard block |
||
1129 | 1129 | * |
1130 | 1130 | * @return string |
1131 | 1131 | */ |
1132 | -function give_checkout_button_purchase( $form_id ) { |
|
1132 | +function give_checkout_button_purchase($form_id) { |
|
1133 | 1133 | |
1134 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1135 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1134 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1135 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1136 | 1136 | ob_start(); ?> |
1137 | 1137 | <div class="give-submit-button-wrap give-clearfix"> |
1138 | 1138 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
1139 | 1139 | <span class="give-loading-animation"></span> |
1140 | 1140 | </div> |
1141 | 1141 | <?php |
1142 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1142 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | /** |
@@ -1152,18 +1152,18 @@ discard block |
||
1152 | 1152 | * |
1153 | 1153 | * @return void |
1154 | 1154 | */ |
1155 | -function give_agree_to_terms_js( $form_id ) { |
|
1155 | +function give_agree_to_terms_js($form_id) { |
|
1156 | 1156 | |
1157 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1157 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1158 | 1158 | |
1159 | - if ( $form_option === 'yes' ) { |
|
1159 | + if ($form_option === 'yes') { |
|
1160 | 1160 | ?> |
1161 | 1161 | <script type="text/javascript"> |
1162 | 1162 | jQuery(document).ready(function ($) { |
1163 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
1163 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1164 | 1164 | e.preventDefault(); |
1165 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1166 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
1165 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
1166 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1167 | 1167 | return false; |
1168 | 1168 | }); |
1169 | 1169 | }); |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | |
1175 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1175 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1176 | 1176 | |
1177 | 1177 | /** |
1178 | 1178 | * Show Give Goals |
@@ -1187,17 +1187,17 @@ discard block |
||
1187 | 1187 | * @return mixed |
1188 | 1188 | */ |
1189 | 1189 | |
1190 | -function give_show_goal_progress( $form_id, $args ) { |
|
1190 | +function give_show_goal_progress($form_id, $args) { |
|
1191 | 1191 | |
1192 | 1192 | ob_start(); |
1193 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1193 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1194 | 1194 | |
1195 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1195 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1196 | 1196 | |
1197 | 1197 | return true; |
1198 | 1198 | } |
1199 | 1199 | |
1200 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1200 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * Adds Actions to Render Form Content |
@@ -1209,19 +1209,19 @@ discard block |
||
1209 | 1209 | * |
1210 | 1210 | * @return void |
1211 | 1211 | */ |
1212 | -function give_form_content( $form_id, $args ) { |
|
1212 | +function give_form_content($form_id, $args) { |
|
1213 | 1213 | |
1214 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1214 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1215 | 1215 | ? $args['show_content'] |
1216 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1216 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1217 | 1217 | |
1218 | - if ( $show_content !== 'none' ) { |
|
1218 | + if ($show_content !== 'none') { |
|
1219 | 1219 | //add action according to value |
1220 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1220 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1221 | 1221 | } |
1222 | 1222 | } |
1223 | 1223 | |
1224 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1224 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1225 | 1225 | |
1226 | 1226 | /** |
1227 | 1227 | * Renders Post Form Content |
@@ -1233,24 +1233,24 @@ discard block |
||
1233 | 1233 | * @return void |
1234 | 1234 | * @since 1.0 |
1235 | 1235 | */ |
1236 | -function give_form_display_content( $form_id, $args ) { |
|
1236 | +function give_form_display_content($form_id, $args) { |
|
1237 | 1237 | |
1238 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1239 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1238 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1239 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1240 | 1240 | ? $args['show_content'] |
1241 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1241 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1242 | 1242 | |
1243 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1244 | - $content = apply_filters( 'the_content', $content ); |
|
1243 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1244 | + $content = apply_filters('the_content', $content); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1247 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1248 | 1248 | |
1249 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1249 | + echo apply_filters('give_form_content_output', $output); |
|
1250 | 1250 | |
1251 | 1251 | //remove action to prevent content output on addition forms on page |
1252 | 1252 | //@see: https://github.com/WordImpress/Give/issues/634 |
1253 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1253 | + remove_action($show_content, 'give_form_display_content'); |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | |
@@ -1263,16 +1263,16 @@ discard block |
||
1263 | 1263 | * |
1264 | 1264 | * @return void |
1265 | 1265 | */ |
1266 | -function give_checkout_hidden_fields( $form_id ) { |
|
1266 | +function give_checkout_hidden_fields($form_id) { |
|
1267 | 1267 | |
1268 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1269 | - if ( is_user_logged_in() ) { ?> |
|
1268 | + do_action('give_hidden_fields_before', $form_id); |
|
1269 | + if (is_user_logged_in()) { ?> |
|
1270 | 1270 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1271 | 1271 | <?php } ?> |
1272 | 1272 | <input type="hidden" name="give_action" value="purchase"/> |
1273 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1273 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1274 | 1274 | <?php |
1275 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1275 | + do_action('give_hidden_fields_after', $form_id); |
|
1276 | 1276 | |
1277 | 1277 | } |
1278 | 1278 | |
@@ -1287,20 +1287,20 @@ discard block |
||
1287 | 1287 | * |
1288 | 1288 | * @return string $content Filtered content |
1289 | 1289 | */ |
1290 | -function give_filter_success_page_content( $content ) { |
|
1290 | +function give_filter_success_page_content($content) { |
|
1291 | 1291 | |
1292 | 1292 | global $give_options; |
1293 | 1293 | |
1294 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1295 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1296 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1294 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1295 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1296 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1297 | 1297 | } |
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | return $content; |
1301 | 1301 | } |
1302 | 1302 | |
1303 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1303 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1304 | 1304 | |
1305 | 1305 | |
1306 | 1306 | /** |
@@ -1312,14 +1312,14 @@ discard block |
||
1312 | 1312 | |
1313 | 1313 | function give_test_mode_frontend_warning() { |
1314 | 1314 | |
1315 | - $test_mode = give_get_option( 'test_mode' ); |
|
1315 | + $test_mode = give_get_option('test_mode'); |
|
1316 | 1316 | |
1317 | - if ( $test_mode == 'on' ) { |
|
1318 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
1317 | + if ($test_mode == 'on') { |
|
1318 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice', 'give').'</strong>: '.esc_html__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
1319 | 1319 | } |
1320 | 1320 | } |
1321 | 1321 | |
1322 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1322 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1323 | 1323 | |
1324 | 1324 | |
1325 | 1325 | /** |
@@ -1335,21 +1335,21 @@ discard block |
||
1335 | 1335 | * @return string |
1336 | 1336 | */ |
1337 | 1337 | |
1338 | -function give_members_only_form( $final_output, $args ) { |
|
1338 | +function give_members_only_form($final_output, $args) { |
|
1339 | 1339 | |
1340 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1340 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1341 | 1341 | |
1342 | 1342 | //Sanity Check: Must have form_id & not be logged in |
1343 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1343 | + if (empty($form_id) || is_user_logged_in()) { |
|
1344 | 1344 | return $final_output; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | //Logged in only and Register / Login set to none |
1348 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1348 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1349 | 1349 | |
1350 | - $final_output = give_output_error( esc_html__( 'Please login in order to complete your donation.', 'give' ), false ); |
|
1350 | + $final_output = give_output_error(esc_html__('Please login in order to complete your donation.', 'give'), false); |
|
1351 | 1351 | |
1352 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1352 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1353 | 1353 | |
1354 | 1354 | } |
1355 | 1355 | |
@@ -1357,4 +1357,4 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | } |
1359 | 1359 | |
1360 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1360 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -10,86 +10,86 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type', ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type',); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids' |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Delete all the Plugin Options |
72 | - delete_option( 'give_settings' ); |
|
73 | - delete_option( 'give_version' ); |
|
72 | + delete_option('give_settings'); |
|
73 | + delete_option('give_version'); |
|
74 | 74 | |
75 | 75 | // Delete Capabilities |
76 | 76 | Give()->roles->remove_caps(); |
77 | 77 | |
78 | 78 | // Delete the Roles |
79 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
80 | - foreach ( $give_roles as $role ) { |
|
81 | - remove_role( $role ); |
|
79 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
80 | + foreach ($give_roles as $role) { |
|
81 | + remove_role($role); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Remove all database tables |
85 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_donors" ); |
|
86 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customers" ); |
|
87 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customermeta" ); |
|
85 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_donors"); |
|
86 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customers"); |
|
87 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customermeta"); |
|
88 | 88 | |
89 | 89 | // Cleanup Cron Events |
90 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
91 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
92 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
90 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
91 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
92 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | } |
96 | 96 | \ No newline at end of file |