@@ -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 | |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @global $wpdb |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_install( $network_wide = false ) { |
|
31 | +function give_install($network_wide = false) { |
|
32 | 32 | |
33 | 33 | global $wpdb; |
34 | 34 | |
35 | - if ( is_multisite() && $network_wide ) { |
|
35 | + if (is_multisite() && $network_wide) { |
|
36 | 36 | |
37 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
37 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
38 | 38 | |
39 | - switch_to_blog( $blog_id ); |
|
39 | + switch_to_blog($blog_id); |
|
40 | 40 | give_run_install(); |
41 | 41 | restore_current_blog(); |
42 | 42 | |
@@ -63,31 +63,31 @@ discard block |
||
63 | 63 | give_setup_post_types(); |
64 | 64 | |
65 | 65 | // Add Upgraded From Option. |
66 | - $current_version = get_option( 'give_version' ); |
|
67 | - if ( $current_version ) { |
|
68 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
66 | + $current_version = get_option('give_version'); |
|
67 | + if ($current_version) { |
|
68 | + update_option('give_version_upgraded_from', $current_version); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Setup some default options. |
72 | 72 | $options = array(); |
73 | 73 | |
74 | 74 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
75 | - if ( empty( $current_version ) ) { |
|
76 | - $options = array_merge( $options, give_get_default_settings() ); |
|
75 | + if (empty($current_version)) { |
|
76 | + $options = array_merge($options, give_get_default_settings()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Populate the default values. |
80 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
80 | + update_option('give_settings', array_merge($give_options, $options)); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Run plugin upgrades. |
84 | 84 | * |
85 | 85 | * @since 1.8 |
86 | 86 | */ |
87 | - do_action( 'give_upgrades' ); |
|
87 | + do_action('give_upgrades'); |
|
88 | 88 | |
89 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
90 | - update_option( 'give_version', GIVE_VERSION ); |
|
89 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
90 | + update_option('give_version', GIVE_VERSION); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Create Give roles. |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Set api version, end point and refresh permalink. |
99 | 99 | $api = new Give_API(); |
100 | 100 | $api->add_endpoint(); |
101 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
101 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
102 | 102 | |
103 | 103 | flush_rewrite_rules(); |
104 | 104 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $give_sessions->use_php_sessions(); |
114 | 114 | |
115 | 115 | // Add a temporary option to note that Give pages have been created. |
116 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
116 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
117 | 117 | |
118 | - if ( ! $current_version ) { |
|
118 | + if ( ! $current_version) { |
|
119 | 119 | |
120 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
120 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
121 | 121 | |
122 | 122 | // When new upgrade routines are added, mark them as complete on fresh install. |
123 | 123 | $upgrade_routines = array( |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | 'v201_logs_upgrades' |
149 | 149 | ); |
150 | 150 | |
151 | - foreach ( $upgrade_routines as $upgrade ) { |
|
152 | - give_set_upgrade_complete( $upgrade ); |
|
151 | + foreach ($upgrade_routines as $upgrade) { |
|
152 | + give_set_upgrade_complete($upgrade); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | 156 | // Bail if activating from network, or bulk. |
157 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
157 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Add the transient to redirect. |
162 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
162 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param int $site_id The Site ID. |
178 | 178 | * @param array $meta Blog Meta. |
179 | 179 | */ |
180 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
180 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
181 | 181 | |
182 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
182 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
183 | 183 | |
184 | - switch_to_blog( $blog_id ); |
|
184 | + switch_to_blog($blog_id); |
|
185 | 185 | give_install(); |
186 | 186 | restore_current_blog(); |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | } |
191 | 191 | |
192 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
192 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
193 | 193 | |
194 | 194 | |
195 | 195 | /** |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return array The tables to drop. |
204 | 204 | */ |
205 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
205 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
206 | 206 | |
207 | - switch_to_blog( $blog_id ); |
|
207 | + switch_to_blog($blog_id); |
|
208 | 208 | $donors_db = new Give_DB_Donors(); |
209 | 209 | $donor_meta_db = new Give_DB_Donor_Meta(); |
210 | 210 | |
211 | - if ( $donors_db->installed() ) { |
|
211 | + if ($donors_db->installed()) { |
|
212 | 212 | $tables[] = $donors_db->table_name; |
213 | 213 | $tables[] = $donor_meta_db->table_name; |
214 | 214 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | } |
220 | 220 | |
221 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
221 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
222 | 222 | |
223 | 223 | /** |
224 | 224 | * Post-installation |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function give_after_install() { |
232 | 232 | |
233 | - if ( ! is_admin() ) { |
|
233 | + if ( ! is_admin()) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
237 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
238 | - $give_table_check = get_option( '_give_table_check', false ); |
|
237 | + $give_options = Give_Cache::get('_give_installed', true); |
|
238 | + $give_table_check = get_option('_give_table_check', false); |
|
239 | 239 | |
240 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
240 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
241 | 241 | |
242 | - if ( ! @Give()->donor_meta->installed() ) { |
|
242 | + if ( ! @Give()->donor_meta->installed()) { |
|
243 | 243 | |
244 | 244 | // Create the donor meta database. |
245 | 245 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | } |
249 | 249 | |
250 | - if ( ! @Give()->donors->installed() ) { |
|
250 | + if ( ! @Give()->donors->installed()) { |
|
251 | 251 | // Create the donor database. |
252 | 252 | // (this ensures it creates it on multisite instances where it is network activated). |
253 | 253 | @Give()->donors->create_table(); |
@@ -259,22 +259,22 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param array $give_options Give plugin options. |
261 | 261 | */ |
262 | - do_action( 'give_after_install', $give_options ); |
|
262 | + do_action('give_after_install', $give_options); |
|
263 | 263 | } |
264 | 264 | |
265 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
265 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
266 | 266 | |
267 | 267 | } |
268 | 268 | |
269 | 269 | // Delete the transient |
270 | - if ( false !== $give_options ) { |
|
271 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
270 | + if (false !== $give_options) { |
|
271 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
275 | 275 | } |
276 | 276 | |
277 | -add_action( 'admin_init', 'give_after_install' ); |
|
277 | +add_action('admin_init', 'give_after_install'); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | /** |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | |
290 | 290 | global $wp_roles; |
291 | 291 | |
292 | - if ( ! is_object( $wp_roles ) ) { |
|
292 | + if ( ! is_object($wp_roles)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
296 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
296 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
297 | 297 | |
298 | 298 | // Create Give plugin roles |
299 | 299 | $roles = new Give_Roles(); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | } |
306 | 306 | |
307 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
307 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Default core setting values. |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | 'uninstall_on_delete' => 'disabled', |
344 | 344 | 'the_content_filter' => 'enabled', |
345 | 345 | 'scripts_footer' => 'disabled', |
346 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
346 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
347 | 347 | 'agreement_text' => give_get_default_agreement_text(), |
348 | 348 | |
349 | 349 | // Paypal IPN verification. |
350 | 350 | 'paypal_verification' => 'enabled', |
351 | 351 | |
352 | 352 | // Default is manual gateway. |
353 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
353 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
354 | 354 | 'default_gateway' => 'manual', |
355 | 355 | |
356 | 356 | // Offline gateway setup. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | function give_get_default_agreement_text() { |
380 | 380 | |
381 | - $org_name = get_bloginfo( 'name' ); |
|
381 | + $org_name = get_bloginfo('name'); |
|
382 | 382 | |
383 | 383 | $agreement = sprintf( |
384 | 384 | '<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the %1$s.</p> |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $org_name |
393 | 393 | ); |
394 | 394 | |
395 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
395 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -406,19 +406,19 @@ discard block |
||
406 | 406 | function give_create_pages() { |
407 | 407 | |
408 | 408 | // Bailout if pages already created. |
409 | - if ( get_option( 'give_install_pages_created' ) ) { |
|
409 | + if (get_option('give_install_pages_created')) { |
|
410 | 410 | return false; |
411 | 411 | } |
412 | 412 | |
413 | 413 | $options = array(); |
414 | 414 | |
415 | 415 | // Checks if the Success Page option exists AND that the page exists. |
416 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
416 | + if ( ! get_post(give_get_option('success_page'))) { |
|
417 | 417 | |
418 | 418 | // Donation Confirmation (Success) Page |
419 | 419 | $success = wp_insert_post( |
420 | 420 | array( |
421 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
421 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
422 | 422 | 'post_content' => '[give_receipt]', |
423 | 423 | 'post_status' => 'publish', |
424 | 424 | 'post_author' => 1, |
@@ -432,13 +432,13 @@ discard block |
||
432 | 432 | } |
433 | 433 | |
434 | 434 | // Checks if the Failure Page option exists AND that the page exists. |
435 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
435 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
436 | 436 | |
437 | 437 | // Failed Donation Page |
438 | 438 | $failed = wp_insert_post( |
439 | 439 | array( |
440 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
441 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
440 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
441 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
442 | 442 | 'post_status' => 'publish', |
443 | 443 | 'post_author' => 1, |
444 | 444 | 'post_type' => 'page', |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | // Checks if the History Page option exists AND that the page exists. |
453 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
453 | + if ( ! get_post(give_get_option('history_page'))) { |
|
454 | 454 | // Donation History Page |
455 | 455 | $history = wp_insert_post( |
456 | 456 | array( |
457 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
457 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
458 | 458 | 'post_content' => '[donation_history]', |
459 | 459 | 'post_status' => 'publish', |
460 | 460 | 'post_author' => 1, |
@@ -466,11 +466,11 @@ discard block |
||
466 | 466 | $options['history_page'] = $history; |
467 | 467 | } |
468 | 468 | |
469 | - if ( ! empty( $options ) ) { |
|
470 | - update_option( 'give_settings', array_merge( give_get_settings(), $options ) ); |
|
469 | + if ( ! empty($options)) { |
|
470 | + update_option('give_settings', array_merge(give_get_settings(), $options)); |
|
471 | 471 | } |
472 | 472 | |
473 | - add_option( 'give_install_pages_created', 1, '', 'no' ); |
|
473 | + add_option('give_install_pages_created', 1, '', 'no'); |
|
474 | 474 | } |
475 | 475 | |
476 | -add_action( 'admin_init', 'give_create_pages', - 1 ); |
|
476 | +add_action('admin_init', 'give_create_pages', - 1); |