@@ -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 | |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * @global $wpdb |
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | -function give_install( $network_wide = false ) { |
|
| 29 | +function give_install($network_wide = false) { |
|
| 30 | 30 | |
| 31 | 31 | global $wpdb; |
| 32 | 32 | |
| 33 | - if ( is_multisite() && $network_wide ) { |
|
| 33 | + if (is_multisite() && $network_wide) { |
|
| 34 | 34 | |
| 35 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
| 35 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
| 36 | 36 | |
| 37 | - switch_to_blog( $blog_id ); |
|
| 37 | + switch_to_blog($blog_id); |
|
| 38 | 38 | give_run_install(); |
| 39 | 39 | restore_current_blog(); |
| 40 | 40 | |
@@ -62,34 +62,34 @@ discard block |
||
| 62 | 62 | give_setup_post_types(); |
| 63 | 63 | |
| 64 | 64 | // Clear the permalinks. |
| 65 | - flush_rewrite_rules( false ); |
|
| 65 | + flush_rewrite_rules(false); |
|
| 66 | 66 | |
| 67 | 67 | // Add Upgraded From Option. |
| 68 | - $current_version = get_option( 'give_version' ); |
|
| 69 | - if ( $current_version ) { |
|
| 70 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
| 68 | + $current_version = get_option('give_version'); |
|
| 69 | + if ($current_version) { |
|
| 70 | + update_option('give_version_upgraded_from', $current_version); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Setup some default options. |
| 74 | 74 | $options = array(); |
| 75 | 75 | |
| 76 | 76 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
| 77 | - if ( empty( $current_version ) ) { |
|
| 78 | - $options = array_merge( $options, give_get_default_settings() ); |
|
| 77 | + if (empty($current_version)) { |
|
| 78 | + $options = array_merge($options, give_get_default_settings()); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Populate the default values. |
| 82 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
| 82 | + update_option('give_settings', array_merge($give_options, $options)); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Run plugin upgrades. |
| 86 | 86 | * |
| 87 | 87 | * @since 1.8 |
| 88 | 88 | */ |
| 89 | - do_action( 'give_upgrades' ); |
|
| 89 | + do_action('give_upgrades'); |
|
| 90 | 90 | |
| 91 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
| 92 | - update_option( 'give_version', GIVE_VERSION ); |
|
| 91 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
| 92 | + update_option('give_version', GIVE_VERSION); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Create Give roles. |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | $roles->add_caps(); |
| 99 | 99 | |
| 100 | 100 | $api = new Give_API(); |
| 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 | // Check for PHP Session support, and enable if available. |
| 104 | 104 | $give_sessions = new Give_Session(); |
| 105 | 105 | $give_sessions->use_php_sessions(); |
| 106 | 106 | |
| 107 | 107 | // Add a temporary option to note that Give pages have been created. |
| 108 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
| 108 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
| 109 | 109 | |
| 110 | - if ( ! $current_version ) { |
|
| 110 | + if ( ! $current_version) { |
|
| 111 | 111 | |
| 112 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 112 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 113 | 113 | |
| 114 | 114 | // When new upgrade routines are added, mark them as complete on fresh install. |
| 115 | 115 | $upgrade_routines = array( |
@@ -121,18 +121,18 @@ discard block |
||
| 121 | 121 | 'v189_upgrades_levels_post_meta' |
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | - foreach ( $upgrade_routines as $upgrade ) { |
|
| 125 | - give_set_upgrade_complete( $upgrade ); |
|
| 124 | + foreach ($upgrade_routines as $upgrade) { |
|
| 125 | + give_set_upgrade_complete($upgrade); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // Bail if activating from network, or bulk. |
| 130 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 130 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Add the transient to redirect. |
| 135 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
| 135 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
| 136 | 136 | |
| 137 | 137 | // Set 'Donation Form' meta box enabled by default. |
| 138 | 138 | give_nav_donation_metabox_enabled(); |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | * @param int $site_id The Site ID. |
| 153 | 153 | * @param array $meta Blog Meta. |
| 154 | 154 | */ |
| 155 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
| 155 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
| 156 | 156 | |
| 157 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
| 157 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
| 158 | 158 | |
| 159 | - switch_to_blog( $blog_id ); |
|
| 159 | + switch_to_blog($blog_id); |
|
| 160 | 160 | give_install(); |
| 161 | 161 | restore_current_blog(); |
| 162 | 162 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
| 167 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
| 168 | 168 | |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return array The tables to drop. |
| 179 | 179 | */ |
| 180 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
| 180 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
| 181 | 181 | |
| 182 | - switch_to_blog( $blog_id ); |
|
| 182 | + switch_to_blog($blog_id); |
|
| 183 | 183 | $donors_db = new Give_DB_Donors(); |
| 184 | 184 | $donor_meta_db = new Give_DB_Donor_Meta(); |
| 185 | 185 | |
| 186 | - if ( $donors_db->installed() ) { |
|
| 186 | + if ($donors_db->installed()) { |
|
| 187 | 187 | $tables[] = $donors_db->table_name; |
| 188 | 188 | $tables[] = $donor_meta_db->table_name; |
| 189 | 189 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
| 196 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * Post-installation |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | function give_after_install() { |
| 207 | 207 | |
| 208 | - if ( ! is_admin() ) { |
|
| 208 | + if ( ! is_admin()) { |
|
| 209 | 209 | return; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
| 213 | - $give_table_check = get_option( '_give_table_check', false ); |
|
| 212 | + $give_options = Give_Cache::get('_give_installed', true); |
|
| 213 | + $give_table_check = get_option('_give_table_check', false); |
|
| 214 | 214 | |
| 215 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
| 215 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
| 216 | 216 | |
| 217 | - if ( ! @Give()->donor_meta->installed() ) { |
|
| 217 | + if ( ! @Give()->donor_meta->installed()) { |
|
| 218 | 218 | |
| 219 | 219 | // Create the donor meta database. |
| 220 | 220 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if ( ! @Give()->donors->installed() ) { |
|
| 225 | + if ( ! @Give()->donors->installed()) { |
|
| 226 | 226 | // Create the donor database. |
| 227 | 227 | // (this ensures it creates it on multisite instances where it is network activated). |
| 228 | 228 | @Give()->donors->create_table(); |
@@ -234,22 +234,22 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @param array $give_options Give plugin options. |
| 236 | 236 | */ |
| 237 | - do_action( 'give_after_install', $give_options ); |
|
| 237 | + do_action('give_after_install', $give_options); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
| 240 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Delete the transient |
| 245 | - if ( false !== $give_options ) { |
|
| 246 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
| 245 | + if (false !== $give_options) { |
|
| 246 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | -add_action( 'admin_init', 'give_after_install' ); |
|
| 252 | +add_action('admin_init', 'give_after_install'); |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | global $wp_roles; |
| 266 | 266 | |
| 267 | - if ( ! is_object( $wp_roles ) ) { |
|
| 267 | + if ( ! is_object($wp_roles)) { |
|
| 268 | 268 | return; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
| 271 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
| 272 | 272 | |
| 273 | 273 | // Create Give plugin roles |
| 274 | 274 | $roles = new Give_Roles(); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
| 282 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | 285 | * Default core setting values. |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | 'uninstall_on_delete' => 'disabled', |
| 316 | 316 | 'the_content_filter' => 'enabled', |
| 317 | 317 | 'scripts_footer' => 'disabled', |
| 318 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
| 318 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
| 319 | 319 | 'agreement_text' => give_get_default_agreement_text(), |
| 320 | 320 | |
| 321 | 321 | // Paypal IPN verification. |
| 322 | 322 | 'paypal_verification' => 'enabled', |
| 323 | 323 | |
| 324 | 324 | // Default is manual gateway. |
| 325 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
| 325 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
| 326 | 326 | 'default_gateway' => 'manual', |
| 327 | 327 | |
| 328 | 328 | // Offline gateway setup. |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | function give_get_default_agreement_text() { |
| 349 | 349 | |
| 350 | - $org_name = get_bloginfo( 'name' ); |
|
| 350 | + $org_name = get_bloginfo('name'); |
|
| 351 | 351 | |
| 352 | 352 | $agreement = sprintf( |
| 353 | 353 | '<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> |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | $org_name |
| 362 | 362 | ); |
| 363 | 363 | |
| 364 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
| 364 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
@@ -370,21 +370,21 @@ discard block |
||
| 370 | 370 | * |
| 371 | 371 | * @since 1.8.11 |
| 372 | 372 | */ |
| 373 | -function give_create_pages(){ |
|
| 373 | +function give_create_pages() { |
|
| 374 | 374 | // Bailout. |
| 375 | - if( get_option( 'give_install_pages_created') ) { |
|
| 375 | + if (get_option('give_install_pages_created')) { |
|
| 376 | 376 | return; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $options = array(); |
| 380 | 380 | |
| 381 | 381 | // Checks if the Success Page option exists AND that the page exists. |
| 382 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
| 382 | + if ( ! get_post(give_get_option('success_page'))) { |
|
| 383 | 383 | |
| 384 | 384 | // Donation Confirmation (Success) Page |
| 385 | 385 | $success = wp_insert_post( |
| 386 | 386 | array( |
| 387 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
| 387 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
| 388 | 388 | 'post_content' => '[give_receipt]', |
| 389 | 389 | 'post_status' => 'publish', |
| 390 | 390 | 'post_author' => 1, |
@@ -398,13 +398,13 @@ discard block |
||
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | // Checks if the Failure Page option exists AND that the page exists. |
| 401 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
| 401 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
| 402 | 402 | |
| 403 | 403 | // Failed Donation Page |
| 404 | 404 | $failed = wp_insert_post( |
| 405 | 405 | array( |
| 406 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
| 407 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
| 406 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
| 407 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
| 408 | 408 | 'post_status' => 'publish', |
| 409 | 409 | 'post_author' => 1, |
| 410 | 410 | 'post_type' => 'page', |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | // Checks if the History Page option exists AND that the page exists. |
| 419 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
| 419 | + if ( ! get_post(give_get_option('history_page'))) { |
|
| 420 | 420 | // Donation History Page |
| 421 | 421 | $history = wp_insert_post( |
| 422 | 422 | array( |
| 423 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
| 423 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
| 424 | 424 | 'post_content' => '[donation_history]', |
| 425 | 425 | 'post_status' => 'publish', |
| 426 | 426 | 'post_author' => 1, |
@@ -432,11 +432,11 @@ discard block |
||
| 432 | 432 | $options['history_page'] = $history; |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - if( ! empty( $options ) ) { |
|
| 436 | - $options = array_merge( give_get_settings(), $options ); |
|
| 437 | - give_update_option( 'give_settings', $options ); |
|
| 435 | + if ( ! empty($options)) { |
|
| 436 | + $options = array_merge(give_get_settings(), $options); |
|
| 437 | + give_update_option('give_settings', $options); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - add_option( 'give_install_pages_created', 1, '', 'no' ); |
|
| 440 | + add_option('give_install_pages_created', 1, '', 'no'); |
|
| 441 | 441 | } |
| 442 | -add_action( 'admin_init', 'give_create_pages', -1 ); |
|
| 442 | +add_action('admin_init', 'give_create_pages', -1); |
|