function dgx_donate_init()
{
    // Start a PHP session if none has been started yet
    // The means to test whether a session has been started varies by PHP version
    if (version_compare(phpversion(), '5.4.0', '>=')) {
        $session_already_started = session_status() === PHP_SESSION_ACTIVE;
    } else {
        $session_id = session_id();
        $session_already_started = !empty($session_id);
    }
    if (!$session_already_started) {
        session_start();
    }
    // Register CPT
    register_post_type('dgx-donation', array('labels' => array('name' => __('Donations'), 'singular_name' => __('Donation', 'dgx-donate'), 'add_new_item' => __('Add New Donation', 'dgx-donate'), 'edit_item' => __('Edit Donation', 'dgx-donate'), 'new_item' => __('New Donation', 'dgx-donate'), 'view_item' => __('View Donation', 'dgx-donate'), 'menu_name' => __('Donations Received', 'dgx-donate')), 'supports' => array('title', 'author'), 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => false, 'exclude_from_search' => true, 'show_in_nav_menus' => false, 'has_archive' => false));
    // Initialize options to defaults as needed
    dgx_donate_init_defaults();
    // 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');
    }
}
Exemple #2
0
function dgx_donate_init()
{
    // Start a PHP session if none has been started yet
    // The means to test whether a session has been started varies by PHP version
    if (version_compare(phpversion(), '5.4.0', '>=')) {
        $session_already_started = session_status() === PHP_SESSION_ACTIVE;
    } else {
        $session_id = session_id();
        $session_already_started = !empty($session_id);
    }
    if (!$session_already_started) {
        session_start();
    }
    // Initialize options to defaults as needed
    dgx_donate_init_defaults();
    // 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');
    }
}
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');
    }
}
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');
        }
    }
}