$92 GRAYBYTE WORDPRESS FILE MANAGER $29

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/itiministry.org/wp-content/plugins/give/src/PaymentGateways/

HOME
Current File : /home/bravrvjk/itiministry.org/wp-content/plugins/give/src/PaymentGateways//ServiceProvider.php
<?php

namespace Give\PaymentGateways;

use Give\Framework\Migrations\MigrationsRegister;
use Give\Framework\PaymentGateways\PaymentGatewayRegister;
use Give\Framework\PaymentGateways\Routes\GatewayRoute;
use Give\Helpers\Hooks;
use Give\LegacyPaymentGateways\Actions\RegisterPaymentGatewaySettingsList;
use Give\PaymentGateways\Actions\RegisterPaymentGateways;
use Give\PaymentGateways\Gateways\PayPalStandard\Webhooks\WebhookRegister;
use Give\PaymentGateways\Gateways\Stripe\CheckoutGateway;
use Give\PaymentGateways\Gateways\Stripe\Controllers\UpdateStatementDescriptorAjaxRequestController;
use Give\PaymentGateways\Gateways\Stripe\Migrations\AddMissingTransactionIdForUncompletedDonations;
use Give\PaymentGateways\Gateways\Stripe\Migrations\AddStatementDescriptorToStripeAccounts;
use Give\PaymentGateways\Gateways\Stripe\Migrations\RemovePaymentIntentSecretMeta;
use Give\PaymentGateways\Migrations\CopyV2GatewaysSettingsToV3;
use Give\PaymentGateways\PayPalCommerce\Banners\GatewaySettingPageBanner;
use Give\PaymentGateways\PayPalCommerce\Banners\PayPalStandardToDonationsMigrationGlobalBanner;
use Give\PaymentGateways\PayPalCommerce\Migrations\RegisterPayPalDonationsRefreshTokenCronJobByMode;
use Give\PaymentGateways\PayPalCommerce\Migrations\RemoveLogWithCardInfo;
use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface;

/**
 * Class ServiceProvider - PaymentGateways
 *
 * The Service Provider for loading the Payment Gateways for Payment Flow 2.0
 *
 * @since 2.18.0
 */
class ServiceProvider implements ServiceProviderInterface
{
    /**
     * @inheritDoc
     */
    public function register()
    {
        give()->singleton(PaymentGatewayRegister::class);
        give()->singleton(WebhookRegister::class);
        give()->alias(PaymentGatewayRegister::class, 'gateways');
    }

    /**
     * @inheritDoc
     */
    public function boot()
    {
        $this->registerMigrations();

        Hooks::addFilter('give_register_gateway', RegisterPaymentGateways::class);
        Hooks::addFilter('give_payment_gateways', RegisterPaymentGatewaySettingsList::class);

        Hooks::addAction('template_redirect', GatewayRoute::class);
        Hooks::addAction(
            'wp_ajax_edit_stripe_account_statement_descriptor',
            UpdateStatementDescriptorAjaxRequestController::class
        );

        /**
         * Stripe Checkout Redirect Handler
         */
        Hooks::addAction('wp_footer', CheckoutGateway::class, 'maybeHandleRedirect', 99999);
        Hooks::addAction('give_embed_footer', CheckoutGateway::class, 'maybeHandleRedirect', 99999);

        $this->registerPayPalDonationsMigrationBanners();
        $this->maybeHidePayPalStandard();
    }

    /**
     * @since 3.0.0 add CopyV2GatewaysSettingsToV3 migration
     * @since 2.33.0 add RemovePaymentIntentSecretMeta migration
     * @since 2.19.6
     */
    private function registerMigrations()
    {
        give(MigrationsRegister::class)->addMigrations([
            AddStatementDescriptorToStripeAccounts::class,
            AddMissingTransactionIdForUncompletedDonations::class,
            RemoveLogWithCardInfo::class,
            RemovePaymentIntentSecretMeta::class,
            RegisterPayPalDonationsRefreshTokenCronJobByMode::class,
            CopyV2GatewaysSettingsToV3::class,
        ]);
    }

    /**
     * This method registers the banners.
     * @since 2.33.0
     * @return void
     */
    private function registerPayPalDonationsMigrationBanners()
    {
        if (! is_admin()) {
            return;
        }

        // Banner for the migration from PayPal Standard to PayPal Donations.
        give(GatewaySettingPageBanner::class)->setupHook();
        give(PayPalStandardToDonationsMigrationGlobalBanner::class)->setHook();
    }

    /**
     * @since 4.1.0
     */
    private function maybeHidePayPalStandard()
    {
        if ( ! is_admin()) {
            return;
        }

        $isPayPalStandardConnected = is_email(give_get_option('paypal_email', false));
        $alwaysShowPayPalStandardAdminOptions = defined('GIVE_ALWAYS_SHOW_PAYPAL_STANDARD_ADMIN_OPTIONS') && GIVE_ALWAYS_SHOW_PAYPAL_STANDARD_ADMIN_OPTIONS;


        add_filter('give_settings_payment_gateways_menu_groups',
            function ($groups) use ($isPayPalStandardConnected, $alwaysShowPayPalStandardAdminOptions) {
                if ($isPayPalStandardConnected || $alwaysShowPayPalStandardAdminOptions) {
                    return $groups;
                }

                if (isset($groups['v2']['gateways']['paypal'])) {
                    unset($groups['v2']['gateways']['paypal']);
                }

                if (isset($groups['v3']['gateways']['paypal'])) {
                    unset($groups['v3']['gateways']['paypal']);
                }

                return $groups;
            },
            999
        );

        add_filter('give_get_groups_paypal',
            function ($groups) use ($isPayPalStandardConnected, $alwaysShowPayPalStandardAdminOptions) {
                if ($isPayPalStandardConnected || $alwaysShowPayPalStandardAdminOptions) {
                    return $groups;
                }

                if (isset($groups['paypal'])) {
                    unset($groups['paypal']);
                }

                return $groups;
            },
            999
        );
    }
}


Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Actions
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
DataTransferObjects
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Exceptions
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Gateways
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Migrations
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
PayPalCommerce
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
Stripe
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
resources
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
PaymentGateway.php
0.96 KB
20 Jan 2022 11.45 AM
bravrvjk / bravrvjk
0644
PaypalSettingPage.php
2.921 KB
21 Oct 2022 1.34 AM
bravrvjk / bravrvjk
0644
ServiceProvider.php
5.23 KB
16 Apr 2025 5.25 PM
bravrvjk / bravrvjk
0644
SettingPage.php
0.745 KB
24 Nov 2021 4.55 AM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF