Esempio n. 1
0
File: give.php Progetto: Boglio/Give
 /**
  * Include required files
  *
  * @access private
  * @since  1.0
  * @return void
  */
 private function includes()
 {
     global $give_options;
     require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php';
     $give_options = give_get_settings();
     require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
     require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
     require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
     require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
     require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
     require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
     require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
     require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
     require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
     require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
     require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
     require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
     require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
     require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php';
     require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
     require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
     require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
     require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
     require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
     require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
     require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
     require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
     if (is_admin() || defined('WP_CLI') && WP_CLI) {
         require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
         require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
     }
     require_once GIVE_PLUGIN_DIR . 'includes/install.php';
 }
Esempio n. 2
0
/**
 * Run the Give Install process.
 *
 * @since  1.5
 * @return void
 */
function give_run_install()
{
    $give_options = give_get_settings();
    // Setup the Give Custom Post Types.
    give_setup_post_types();
    // Clear the permalinks.
    flush_rewrite_rules(false);
    // Add Upgraded From Option.
    $current_version = get_option('give_version');
    if ($current_version) {
        update_option('give_version_upgraded_from', $current_version);
    }
    // Setup some default options.
    $options = array();
    // Checks if the Success Page option exists AND that the page exists.
    if (!get_post(give_get_option('success_page'))) {
        // Donations Confirmation (Success) Page.
        $success = wp_insert_post(array('post_title' => esc_html__('Donation Confirmation', 'give'), 'post_content' => '[give_receipt]', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed'));
        // Store our page IDs
        $options['success_page'] = $success;
    }
    // Checks if the Failure Page option exists AND that the page exists.
    if (!get_post(give_get_option('failure_page'))) {
        // Failed Donation Page.
        $failed = wp_insert_post(array('post_title' => esc_html__('Transaction Failed', 'give'), 'post_content' => esc_html__('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'), 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed'));
        $options['failure_page'] = $failed;
    }
    // Checks if the History Page option exists AND that the page exists.
    if (!get_post(give_get_option('history_page'))) {
        // Purchase History (History) Page.
        $history = wp_insert_post(array('post_title' => esc_html__('Donation History', 'give'), 'post_content' => '[donation_history]', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'page', 'comment_status' => 'closed'));
        $options['history_page'] = $history;
    }
    //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
    if (empty($current_version)) {
        $options['base_country'] = 'US';
        $options['test_mode'] = 1;
        $options['currency'] = 'USD';
        $options['session_lifetime'] = '604800';
        $options['gateways']['manual'] = 1;
        $options['default_gateway'] = 'manual';
        //default is manual gateway.
        //Offline gateway setup.
        $options['gateways']['offline'] = 1;
        $options['global_offline_donation_content'] = give_get_default_offline_donation_content();
        //Default number of decimals.
        $options['number_decimals'] = 2;
        //Default donation notification email.
        $options['donation_notification'] = give_get_default_donation_notification_email();
        //Default email receipt message.
        $options['donation_receipt'] = give_get_default_donation_receipt_email();
    }
    // Populate the default values.
    update_option('give_settings', array_merge($give_options, $options));
    update_option('give_version', GIVE_VERSION);
    // Create Give roles.
    $roles = new Give_Roles();
    $roles->add_roles();
    $roles->add_caps();
    $api = new Give_API();
    update_option('give_default_api_version', 'v' . $api->get_version());
    // Create the customers databases.
    @Give()->customers->create_table();
    @Give()->customer_meta->create_table();
    // Check for PHP Session support, and enable if available.
    Give()->session->use_php_sessions();
    // Add a temporary option to note that Give pages have been created.
    set_transient('_give_installed', $options, 30);
    if (!$current_version) {
        require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
        // When new upgrade routines are added, mark them as complete on fresh install.
        $upgrade_routines = array('upgrade_give_user_caps_cleanup', 'upgrade_give_payment_customer_id', 'upgrade_give_offline_status');
        foreach ($upgrade_routines as $upgrade) {
            give_set_upgrade_complete($upgrade);
        }
    }
    // Bail if activating from network, or bulk.
    if (is_network_admin() || isset($_GET['activate-multi'])) {
        return;
    }
    // Add the transient to redirect.
    set_transient('_give_activation_redirect', true, 30);
}