コード例 #1
0
function seamless_donations_init()
{
    seamless_donations_set_version();
    // make sure we've got the version set as an option
    // Check to see if we're supposed to run an upgrade
    seamless_donations_sd40_process_upgrade_check();
    // Check to see if first-time run
    $from_name = get_option('dgx_donate_email_name');
    if ($from_name == false) {
        // this is a pure 4.0+ start
        update_option('dgx_donate_start_in_sd4_mode', 'true');
        $sd4_mode = true;
    } else {
        // now we need to determine if we've already updated to 4.0+ or not
        $sd4_mode = get_option('dgx_donate_start_in_sd4_mode');
        if ($sd4_mode != false) {
            $sd4_mode = true;
        }
    }
    // Initialize options to defaults as needed
    if ($sd4_mode) {
        //seamless_donations_init_session ();
        //dgx_donate_init_session ();
        seamless_donations_init_defaults();
        seamless_donations_init_audit();
        seamless_donations_admin_loader();
    } else {
        dgx_donate_init_session();
        dgx_donate_init_defaults();
        seamless_donations_legacy_admin_loader();
        add_action('admin_notices', 'seamless_donations_sd40_update_alert_message');
    }
    // Display an admin notice if we are in sandbox mode
    $payPalServer = get_option('dgx_donate_paypal_server');
    if (strcasecmp($payPalServer, "SANDBOX") == 0) {
        add_action('admin_notices', 'dgx_donate_admin_sandbox_msg');
    }
    // Display an admin notice if we are in debug mode
    $debug_mode = get_option('dgx_donate_debug_mode');
    if ($debug_mode == 1) {
        add_action('admin_notices', 'seamless_donations_admin_debug_mode_msg');
    }
}
コード例 #2
0
function seamless_donations_init()
{
    seamless_donations_set_version();
    // make sure we've got the version set as an option
    // Check to see if we're supposed to run an upgrade
    seamless_donations_sd40_process_upgrade_check();
    // Check to see if first-time run
    $from_name = get_option('dgx_donate_email_name');
    if ($from_name == false) {
        // this is a pure 4.0+ start
        update_option('dgx_donate_start_in_sd4_mode', 'true');
        $sd4_mode = true;
    } else {
        // now we need to determine if we've already updated to 4.0+ or not
        $sd4_mode = get_option('dgx_donate_start_in_sd4_mode');
        if ($sd4_mode != false) {
            $sd4_mode = true;
        }
    }
    // Check to see if we're processing donation form data
    // This section drives the payment form through the shortcode page, rather than a separate PHP file
    // done because some hosts can't handle redirecting forms to another php file.
    $process_form_via = get_option('dgx_donate_form_via_action');
    if ($process_form_via == '1') {
        $form_via_mode = '';
        if (isset($_POST['_dgx_donate_form_via'])) {
            $form_via_mode = $_POST['_dgx_donate_form_via'];
        }
        if ($form_via_mode == '1') {
            seamless_donations_process_payment();
        }
    }
    // Initialize options to defaults as needed
    if ($sd4_mode) {
        //seamless_donations_init_session ();
        //dgx_donate_init_session ();
        seamless_donations_init_defaults();
        seamless_donations_init_audit();
        seamless_donations_admin_loader();
        // check for any sd4 upgrades
        seamless_donations_4012_update_indexes();
        seamless_donations_4013_update_anon();
    } else {
        dgx_donate_init_session();
        dgx_donate_init_defaults();
        seamless_donations_legacy_admin_loader();
        add_action('admin_notices', 'seamless_donations_sd40_update_alert_message');
    }
    // Display an admin notice if we are in sandbox mode
    $payPalServer = get_option('dgx_donate_paypal_server');
    if (strcasecmp($payPalServer, "SANDBOX") == 0) {
        add_action('admin_notices', 'dgx_donate_admin_sandbox_msg');
    }
    // Display an admin notice on the Seamless Donations pages for new support message
    if (isset($_GET["page"])) {
        $current_page = $_GET["page"];
        if (stripos($current_page, 'seamless_donations_admin') !== false) {
            add_action('admin_notices', 'seamless_donations_admin_new_support_msg');
        }
        // Display an admin notice if we are in debug mode
        $debug_mode = get_option('dgx_donate_debug_mode');
        if ($debug_mode == 1) {
            add_action('admin_notices', 'seamless_donations_admin_debug_mode_msg');
        }
    }
}