@@ -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 |
@@ -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 |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | /** |
49 | 49 | * Main Give Class. |
50 | 50 | * |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | * @return Give |
168 | 168 | */ |
169 | 169 | public static function instance() { |
170 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
170 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
171 | 171 | self::$instance = new Give; |
172 | 172 | self::$instance->setup_constants(); |
173 | 173 | |
174 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
174 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
175 | 175 | |
176 | 176 | self::$instance->includes(); |
177 | 177 | self::$instance->roles = new Give_Roles(); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function __clone() { |
205 | 205 | // Cloning instances of the class is forbidden |
206 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
206 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0'); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function __wakeup() { |
217 | 217 | // Unserializing instances of the class is forbidden. |
218 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
218 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -228,33 +228,33 @@ discard block |
||
228 | 228 | private function setup_constants() { |
229 | 229 | |
230 | 230 | // Plugin version |
231 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
232 | - define( 'GIVE_VERSION', '1.6' ); |
|
231 | + if ( ! defined('GIVE_VERSION')) { |
|
232 | + define('GIVE_VERSION', '1.6'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | // Plugin Folder Path |
236 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
237 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
236 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
237 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | // Plugin Folder URL |
241 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
242 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
241 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
242 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | // Plugin Basename aka: "give/give.php" |
246 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
247 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
246 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
247 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | // Plugin Root File |
251 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
252 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
251 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
252 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | // Make sure CAL_GREGORIAN is defined |
256 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
257 | - define( 'CAL_GREGORIAN', 1 ); |
|
256 | + if ( ! defined('CAL_GREGORIAN')) { |
|
257 | + define('CAL_GREGORIAN', 1); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
@@ -268,110 +268,110 @@ discard block |
||
268 | 268 | private function includes() { |
269 | 269 | global $give_options; |
270 | 270 | |
271 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
271 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
272 | 272 | $give_options = give_get_settings(); |
273 | 273 | |
274 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
275 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
276 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
277 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
278 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
279 | - |
|
280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
285 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
286 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
287 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
288 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
289 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
290 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
291 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
292 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
293 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
294 | - |
|
295 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
296 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
297 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
298 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
299 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
300 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
301 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
302 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
303 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
305 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
306 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
310 | - |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
314 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
316 | - |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
322 | - |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
328 | - |
|
329 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
330 | - |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
341 | - |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
344 | - |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
350 | - |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
358 | - |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
362 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
367 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
368 | - |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
274 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
275 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
276 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
277 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
278 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
279 | + |
|
280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
285 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
286 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
287 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
288 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
289 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
290 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
291 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
292 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
293 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
294 | + |
|
295 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
296 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
297 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
298 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
299 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
300 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
301 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
302 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
305 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
310 | + |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
316 | + |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
322 | + |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
328 | + |
|
329 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
330 | + |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
341 | + |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
344 | + |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
350 | + |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
358 | + |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
362 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
367 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
368 | + |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
371 | 371 | |
372 | 372 | } |
373 | 373 | |
374 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
375 | 375 | |
376 | 376 | } |
377 | 377 | |
@@ -384,26 +384,26 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function load_textdomain() { |
386 | 386 | // Set filter for Give's languages directory |
387 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
388 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
387 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
388 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
389 | 389 | |
390 | 390 | // Traditional WordPress plugin locale filter |
391 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
392 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
391 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
392 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
393 | 393 | |
394 | 394 | // Setup paths to current locale file |
395 | - $mofile_local = $give_lang_dir . $mofile; |
|
396 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
395 | + $mofile_local = $give_lang_dir.$mofile; |
|
396 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
397 | 397 | |
398 | - if ( file_exists( $mofile_global ) ) { |
|
398 | + if (file_exists($mofile_global)) { |
|
399 | 399 | // Look in global /wp-content/languages/give folder |
400 | - load_textdomain( 'give', $mofile_global ); |
|
401 | - } elseif ( file_exists( $mofile_local ) ) { |
|
400 | + load_textdomain('give', $mofile_global); |
|
401 | + } elseif (file_exists($mofile_local)) { |
|
402 | 402 | // Look in local location from filter `give_languages_directory` |
403 | - load_textdomain( 'give', $mofile_local ); |
|
403 | + load_textdomain('give', $mofile_local); |
|
404 | 404 | } else { |
405 | 405 | // Load the default language files packaged up w/ Give |
406 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
406 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @param bool $_id Post id. Default is false. |
330 | 330 | * @param array $_args Arguments passed. |
331 | 331 | * |
332 | - * @return void |
|
332 | + * @return boolean |
|
333 | 333 | */ |
334 | 334 | public function __construct( $_id = false, $_args = array() ) { |
335 | 335 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @param array $data Array of attributes for a donation form. |
414 | 414 | * |
415 | - * @return mixed False if data isn't passed and class not instantiated for creation, or New Form ID. |
|
415 | + * @return boolean False if data isn't passed and class not instantiated for creation, or New Form ID. |
|
416 | 416 | */ |
417 | 417 | public function create( $data = array() ) { |
418 | 418 |
@@ -770,12 +770,12 @@ discard block |
||
770 | 770 | |
771 | 771 | } |
772 | 772 | |
773 | - /** |
|
774 | - * Get if form type set or not. |
|
775 | - * |
|
776 | - * @since 1.6 |
|
773 | + /** |
|
774 | + * Get if form type set or not. |
|
775 | + * |
|
776 | + * @since 1.6 |
|
777 | 777 | * @access public |
778 | - * |
|
778 | + * |
|
779 | 779 | * @return bool |
780 | 780 | * |
781 | 781 | public function is_set_type_donation_form() { |
@@ -1023,10 +1023,10 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | public function is_close_donation_form() { |
1025 | 1025 | return ( |
1026 | - 'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) ) |
|
1027 | - && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1028 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1029 | - ); |
|
1026 | + 'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) ) |
|
1027 | + && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1028 | + && ( $this->get_goal() <= $this->get_earnings() |
|
1029 | + ); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | /** |
@@ -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 | |
@@ -331,11 +331,11 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @return void |
333 | 333 | */ |
334 | - public function __construct( $_id = false, $_args = array() ) { |
|
334 | + public function __construct($_id = false, $_args = array()) { |
|
335 | 335 | |
336 | - $donation_form = WP_Post::get_instance( $_id ); |
|
336 | + $donation_form = WP_Post::get_instance($_id); |
|
337 | 337 | |
338 | - return $this->setup_donation_form( $donation_form ); |
|
338 | + return $this->setup_donation_form($donation_form); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -348,23 +348,23 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return bool If the setup was successful or not. |
350 | 350 | */ |
351 | - private function setup_donation_form( $donation_form ) { |
|
351 | + private function setup_donation_form($donation_form) { |
|
352 | 352 | |
353 | - if ( ! is_object( $donation_form ) ) { |
|
353 | + if ( ! is_object($donation_form)) { |
|
354 | 354 | return false; |
355 | 355 | } |
356 | 356 | |
357 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
357 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
358 | 358 | return false; |
359 | 359 | } |
360 | 360 | |
361 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
361 | + if ('give_forms' !== $donation_form->post_type) { |
|
362 | 362 | return false; |
363 | 363 | } |
364 | 364 | |
365 | - foreach ( $donation_form as $key => $value ) { |
|
365 | + foreach ($donation_form as $key => $value) { |
|
366 | 366 | |
367 | - switch ( $key ) { |
|
367 | + switch ($key) { |
|
368 | 368 | |
369 | 369 | default: |
370 | 370 | $this->$key = $value; |
@@ -389,16 +389,16 @@ discard block |
||
389 | 389 | * @return mixed |
390 | 390 | * @throws Exception |
391 | 391 | */ |
392 | - public function __get( $key ) { |
|
392 | + public function __get($key) { |
|
393 | 393 | |
394 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
394 | + if (method_exists($this, 'get_'.$key)) { |
|
395 | 395 | |
396 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
396 | + return call_user_func(array($this, 'get_'.$key)); |
|
397 | 397 | |
398 | 398 | } else { |
399 | 399 | |
400 | 400 | /* translators: %s: property key */ |
401 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
401 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
402 | 402 | |
403 | 403 | } |
404 | 404 | |
@@ -414,30 +414,30 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @return mixed False if data isn't passed and class not instantiated for creation, or New Form ID. |
416 | 416 | */ |
417 | - public function create( $data = array() ) { |
|
417 | + public function create($data = array()) { |
|
418 | 418 | |
419 | - if ( $this->id != 0 ) { |
|
419 | + if ($this->id != 0) { |
|
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | 423 | $defaults = array( |
424 | 424 | 'post_type' => 'give_forms', |
425 | 425 | 'post_status' => 'draft', |
426 | - 'post_title' => esc_html__( 'New Donation Form', 'give' ) |
|
426 | + 'post_title' => esc_html__('New Donation Form', 'give') |
|
427 | 427 | ); |
428 | 428 | |
429 | - $args = wp_parse_args( $data, $defaults ); |
|
429 | + $args = wp_parse_args($data, $defaults); |
|
430 | 430 | |
431 | 431 | /** |
432 | 432 | * Fired before a donation form is created |
433 | 433 | * |
434 | 434 | * @param array $args The post object arguments used for creation. |
435 | 435 | */ |
436 | - do_action( 'give_form_pre_create', $args ); |
|
436 | + do_action('give_form_pre_create', $args); |
|
437 | 437 | |
438 | - $id = wp_insert_post( $args, true ); |
|
438 | + $id = wp_insert_post($args, true); |
|
439 | 439 | |
440 | - $donation_form = WP_Post::get_instance( $id ); |
|
440 | + $donation_form = WP_Post::get_instance($id); |
|
441 | 441 | |
442 | 442 | /** |
443 | 443 | * Fired after a donation form is created |
@@ -445,9 +445,9 @@ discard block |
||
445 | 445 | * @param int $id The post ID of the created item. |
446 | 446 | * @param array $args The post object arguments used for creation. |
447 | 447 | */ |
448 | - do_action( 'give_form_post_create', $id, $args ); |
|
448 | + do_action('give_form_post_create', $id, $args); |
|
449 | 449 | |
450 | - return $this->setup_donation_form( $donation_form ); |
|
450 | + return $this->setup_donation_form($donation_form); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @return string Donation form name. |
473 | 473 | */ |
474 | 474 | public function get_name() { |
475 | - return get_the_title( $this->ID ); |
|
475 | + return get_the_title($this->ID); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public function get_price() { |
487 | 487 | |
488 | - if ( ! isset( $this->price ) ) { |
|
488 | + if ( ! isset($this->price)) { |
|
489 | 489 | |
490 | - $this->price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
490 | + $this->price = get_post_meta($this->ID, '_give_set_price', true); |
|
491 | 491 | |
492 | - if ( $this->price ) { |
|
492 | + if ($this->price) { |
|
493 | 493 | |
494 | - $this->price = give_sanitize_amount( $this->price ); |
|
494 | + $this->price = give_sanitize_amount($this->price); |
|
495 | 495 | |
496 | 496 | } else { |
497 | 497 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @param string $price The donation form price. |
510 | 510 | * @param string|int $id The form ID. |
511 | 511 | */ |
512 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
512 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -522,14 +522,14 @@ discard block |
||
522 | 522 | */ |
523 | 523 | public function get_minimum_price() { |
524 | 524 | |
525 | - if ( ! isset( $this->minimum_price ) ) { |
|
525 | + if ( ! isset($this->minimum_price)) { |
|
526 | 526 | |
527 | - $allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
528 | - $this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
527 | + $allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true); |
|
528 | + $this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true); |
|
529 | 529 | |
530 | - if ( $allow_custom_amount != 'no' && $this->minimum_price ) { |
|
530 | + if ($allow_custom_amount != 'no' && $this->minimum_price) { |
|
531 | 531 | |
532 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
532 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
533 | 533 | |
534 | 534 | } else { |
535 | 535 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | |
540 | 540 | } |
541 | 541 | |
542 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
542 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | */ |
553 | 553 | public function get_prices() { |
554 | 554 | |
555 | - if ( ! isset( $this->prices ) ) { |
|
555 | + if ( ! isset($this->prices)) { |
|
556 | 556 | |
557 | - $this->prices = get_post_meta( $this->ID, '_give_donation_levels', true ); |
|
557 | + $this->prices = get_post_meta($this->ID, '_give_donation_levels', true); |
|
558 | 558 | |
559 | 559 | } |
560 | 560 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @param array $prices The array of mulit-level prices. |
567 | 567 | * @param int|string The ID of the form. |
568 | 568 | */ |
569 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
569 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
570 | 570 | |
571 | 571 | } |
572 | 572 | |
@@ -580,13 +580,13 @@ discard block |
||
580 | 580 | */ |
581 | 581 | public function get_goal() { |
582 | 582 | |
583 | - if ( ! isset( $this->goal ) ) { |
|
583 | + if ( ! isset($this->goal)) { |
|
584 | 584 | |
585 | - $this->goal = get_post_meta( $this->ID, '_give_set_goal', true ); |
|
585 | + $this->goal = get_post_meta($this->ID, '_give_set_goal', true); |
|
586 | 586 | |
587 | - if ( $this->goal ) { |
|
587 | + if ($this->goal) { |
|
588 | 588 | |
589 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
589 | + $this->goal = give_sanitize_amount($this->goal); |
|
590 | 590 | |
591 | 591 | } else { |
592 | 592 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | |
597 | 597 | } |
598 | 598 | |
599 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
599 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
600 | 600 | |
601 | 601 | } |
602 | 602 | |
@@ -610,10 +610,10 @@ discard block |
||
610 | 610 | */ |
611 | 611 | public function is_single_price_mode() { |
612 | 612 | |
613 | - $option = get_post_meta( $this->ID, '_give_price_options_mode', true ); |
|
613 | + $option = get_post_meta($this->ID, '_give_price_options_mode', true); |
|
614 | 614 | $ret = 0; |
615 | 615 | |
616 | - if ( empty( $option ) || $option === 'set' ) { |
|
616 | + if (empty($option) || $option === 'set') { |
|
617 | 617 | $ret = 1; |
618 | 618 | } |
619 | 619 | |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | * @param bool $ret Is donation form in single price mode? |
626 | 626 | * @param int|string The ID of the donation form. |
627 | 627 | */ |
628 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
628 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
629 | 629 | |
630 | 630 | } |
631 | 631 | |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | */ |
640 | 640 | public function is_custom_price_mode() { |
641 | 641 | |
642 | - $option = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
642 | + $option = get_post_meta($this->ID, '_give_custom_amount', true); |
|
643 | 643 | $ret = 0; |
644 | 644 | |
645 | - if ( $option === 'yes' ) { |
|
645 | + if ($option === 'yes') { |
|
646 | 646 | $ret = 1; |
647 | 647 | } |
648 | 648 | |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * @param bool $ret Is donation form in custom price mode? |
655 | 655 | * @param int|string The ID of the donation form. |
656 | 656 | */ |
657 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
657 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
658 | 658 | |
659 | 659 | } |
660 | 660 | |
@@ -670,10 +670,10 @@ discard block |
||
670 | 670 | */ |
671 | 671 | public function has_variable_prices() { |
672 | 672 | |
673 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
673 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
674 | 674 | $ret = 0; |
675 | 675 | |
676 | - if ( $option === 'multi' ) { |
|
676 | + if ($option === 'multi') { |
|
677 | 677 | $ret = 1; |
678 | 678 | } |
679 | 679 | |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | * @param bool $ret Does donation form have variable prices? |
684 | 684 | * @param int|string The ID of the donation form. |
685 | 685 | */ |
686 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
686 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
687 | 687 | |
688 | 688 | } |
689 | 689 | |
@@ -697,17 +697,17 @@ discard block |
||
697 | 697 | */ |
698 | 698 | public function get_type() { |
699 | 699 | |
700 | - if ( ! isset( $this->type ) ) { |
|
700 | + if ( ! isset($this->type)) { |
|
701 | 701 | |
702 | - $this->type = get_post_meta( $this->ID, '_give_price_option', true ); |
|
702 | + $this->type = get_post_meta($this->ID, '_give_price_option', true); |
|
703 | 703 | |
704 | - if ( empty( $this->type ) ) { |
|
704 | + if (empty($this->type)) { |
|
705 | 705 | $this->type = 'set'; |
706 | 706 | } |
707 | 707 | |
708 | 708 | } |
709 | 709 | |
710 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
710 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
711 | 711 | |
712 | 712 | } |
713 | 713 | |
@@ -723,23 +723,23 @@ discard block |
||
723 | 723 | * |
724 | 724 | * @return string |
725 | 725 | */ |
726 | - public function get_form_classes( $args ) { |
|
726 | + public function get_form_classes($args) { |
|
727 | 727 | |
728 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
728 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
729 | 729 | ? 'float-labels-enabled' |
730 | 730 | : ''; |
731 | 731 | |
732 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
732 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
733 | 733 | 'give-form', |
734 | - 'give-form-' . $this->ID, |
|
735 | - 'give-form-type-' . $this->get_type(), |
|
734 | + 'give-form-'.$this->ID, |
|
735 | + 'give-form-type-'.$this->get_type(), |
|
736 | 736 | $float_labels_option |
737 | - ), $this->ID, $args ); |
|
737 | + ), $this->ID, $args); |
|
738 | 738 | |
739 | 739 | // Remove empty class names. |
740 | - $form_classes_array = array_filter( $form_classes_array ); |
|
740 | + $form_classes_array = array_filter($form_classes_array); |
|
741 | 741 | |
742 | - return implode( ' ', $form_classes_array ); |
|
742 | + return implode(' ', $form_classes_array); |
|
743 | 743 | |
744 | 744 | } |
745 | 745 | |
@@ -754,19 +754,19 @@ discard block |
||
754 | 754 | * |
755 | 755 | * @return string |
756 | 756 | */ |
757 | - public function get_form_wrap_classes( $args ) { |
|
757 | + public function get_form_wrap_classes($args) { |
|
758 | 758 | |
759 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
759 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
760 | 760 | ? $args['display_style'] |
761 | - : get_post_meta( $this->ID, '_give_payment_display', true ); |
|
761 | + : get_post_meta($this->ID, '_give_payment_display', true); |
|
762 | 762 | |
763 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
763 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
764 | 764 | 'give-form-wrap', |
765 | - 'give-display-' . $display_option |
|
766 | - ), $this->ID, $args ); |
|
765 | + 'give-display-'.$display_option |
|
766 | + ), $this->ID, $args); |
|
767 | 767 | |
768 | 768 | |
769 | - return implode( ' ', $form_wrap_classes_array ); |
|
769 | + return implode(' ', $form_wrap_classes_array); |
|
770 | 770 | |
771 | 771 | } |
772 | 772 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | public function is_multi_type_donation_form() { |
797 | 797 | $form_type = $this->get_type(); |
798 | 798 | |
799 | - return ( 'multi' === $form_type ? true : false ); |
|
799 | + return ('multi' === $form_type ? true : false); |
|
800 | 800 | |
801 | 801 | } |
802 | 802 | |
@@ -810,15 +810,15 @@ discard block |
||
810 | 810 | */ |
811 | 811 | public function get_sales() { |
812 | 812 | |
813 | - if ( ! isset( $this->sales ) ) { |
|
813 | + if ( ! isset($this->sales)) { |
|
814 | 814 | |
815 | - if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) { |
|
816 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
815 | + if ('' == get_post_meta($this->ID, '_give_form_sales', true)) { |
|
816 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
817 | 817 | } // End if |
818 | 818 | |
819 | - $this->sales = get_post_meta( $this->ID, '_give_form_sales', true ); |
|
819 | + $this->sales = get_post_meta($this->ID, '_give_form_sales', true); |
|
820 | 820 | |
821 | - if ( $this->sales < 0 ) { |
|
821 | + if ($this->sales < 0) { |
|
822 | 822 | // Never let sales be less than zero |
823 | 823 | $this->sales = 0; |
824 | 824 | } |
@@ -839,13 +839,13 @@ discard block |
||
839 | 839 | * |
840 | 840 | * @return int|false New number of total sales. |
841 | 841 | */ |
842 | - public function increase_sales( $quantity = 1 ) { |
|
842 | + public function increase_sales($quantity = 1) { |
|
843 | 843 | |
844 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
845 | - $quantity = absint( $quantity ); |
|
844 | + $sales = give_get_form_sales_stats($this->ID); |
|
845 | + $quantity = absint($quantity); |
|
846 | 846 | $total_sales = $sales + $quantity; |
847 | 847 | |
848 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
848 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
849 | 849 | |
850 | 850 | $this->sales = $total_sales; |
851 | 851 | |
@@ -866,17 +866,17 @@ discard block |
||
866 | 866 | * |
867 | 867 | * @return int|false New number of total sales. |
868 | 868 | */ |
869 | - public function decrease_sales( $quantity = 1 ) { |
|
869 | + public function decrease_sales($quantity = 1) { |
|
870 | 870 | |
871 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
871 | + $sales = give_get_form_sales_stats($this->ID); |
|
872 | 872 | |
873 | 873 | // Only decrease if not already zero |
874 | - if ( $sales > 0 ) { |
|
874 | + if ($sales > 0) { |
|
875 | 875 | |
876 | - $quantity = absint( $quantity ); |
|
876 | + $quantity = absint($quantity); |
|
877 | 877 | $total_sales = $sales - $quantity; |
878 | 878 | |
879 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
879 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
880 | 880 | |
881 | 881 | $this->sales = $sales; |
882 | 882 | |
@@ -900,15 +900,15 @@ discard block |
||
900 | 900 | */ |
901 | 901 | public function get_earnings() { |
902 | 902 | |
903 | - if ( ! isset( $this->earnings ) ) { |
|
903 | + if ( ! isset($this->earnings)) { |
|
904 | 904 | |
905 | - if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
906 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
905 | + if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) { |
|
906 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
907 | 907 | } |
908 | 908 | |
909 | - $this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true ); |
|
909 | + $this->earnings = get_post_meta($this->ID, '_give_form_earnings', true); |
|
910 | 910 | |
911 | - if ( $this->earnings < 0 ) { |
|
911 | + if ($this->earnings < 0) { |
|
912 | 912 | // Never let earnings be less than zero |
913 | 913 | $this->earnings = 0; |
914 | 914 | } |
@@ -929,12 +929,12 @@ discard block |
||
929 | 929 | * |
930 | 930 | * @return float|false |
931 | 931 | */ |
932 | - public function increase_earnings( $amount = 0 ) { |
|
932 | + public function increase_earnings($amount = 0) { |
|
933 | 933 | |
934 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
934 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
935 | 935 | $new_amount = $earnings + (float) $amount; |
936 | 936 | |
937 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
937 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
938 | 938 | |
939 | 939 | $this->earnings = $new_amount; |
940 | 940 | |
@@ -956,16 +956,16 @@ discard block |
||
956 | 956 | * |
957 | 957 | * @return float|false |
958 | 958 | */ |
959 | - public function decrease_earnings( $amount ) { |
|
959 | + public function decrease_earnings($amount) { |
|
960 | 960 | |
961 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
961 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
962 | 962 | |
963 | - if ( $earnings > 0 ) { |
|
963 | + if ($earnings > 0) { |
|
964 | 964 | // Only decrease if greater than zero |
965 | 965 | $new_amount = $earnings - (float) $amount; |
966 | 966 | |
967 | 967 | |
968 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
968 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
969 | 969 | |
970 | 970 | $this->earnings = $new_amount; |
971 | 971 | |
@@ -989,22 +989,22 @@ discard block |
||
989 | 989 | * |
990 | 990 | * @return bool |
991 | 991 | */ |
992 | - public function is_free( $price_id = false ) { |
|
992 | + public function is_free($price_id = false) { |
|
993 | 993 | |
994 | 994 | $is_free = false; |
995 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
995 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
996 | 996 | |
997 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
998 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
999 | - } elseif ( ! $variable_pricing ) { |
|
1000 | - $price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
997 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
998 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
999 | + } elseif ( ! $variable_pricing) { |
|
1000 | + $price = get_post_meta($this->ID, '_give_set_price', true); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1003 | + if (isset($price) && (float) $price == 0) { |
|
1004 | 1004 | $is_free = true; |
1005 | 1005 | } |
1006 | 1006 | |
1007 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1007 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1008 | 1008 | |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1023,9 +1023,9 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | public function is_close_donation_form() { |
1025 | 1025 | return ( |
1026 | - 'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) ) |
|
1027 | - && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1028 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1026 | + 'yes' === get_post_meta($this->ID, '_give_goal_option', true) ) |
|
1027 | + && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1028 | + && ($this->get_goal() <= $this->get_earnings() |
|
1029 | 1029 | ); |
1030 | 1030 | } |
1031 | 1031 | |
@@ -1040,29 +1040,29 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return bool The result of the update query. |
1042 | 1042 | */ |
1043 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1043 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1044 | 1044 | |
1045 | 1045 | /* @var WPDB $wpdb */ |
1046 | 1046 | global $wpdb; |
1047 | 1047 | |
1048 | - if ( empty( $meta_key ) ) { |
|
1048 | + if (empty($meta_key)) { |
|
1049 | 1049 | return false; |
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | // Make sure if it needs to be serialized, we do |
1053 | - $meta_value = maybe_serialize( $meta_value ); |
|
1053 | + $meta_value = maybe_serialize($meta_value); |
|
1054 | 1054 | |
1055 | - if ( is_numeric( $meta_value ) ) { |
|
1056 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1055 | + if (is_numeric($meta_value)) { |
|
1056 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1057 | 1057 | } else { |
1058 | 1058 | $value_type = "'%s'"; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1061 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1062 | 1062 | |
1063 | - if ( $wpdb->query( $sql ) ) { |
|
1063 | + if ($wpdb->query($sql)) { |
|
1064 | 1064 | |
1065 | - clean_post_cache( $this->ID ); |
|
1065 | + clean_post_cache($this->ID); |
|
1066 | 1066 | |
1067 | 1067 | return true; |
1068 | 1068 |