get_available_gateways(); $charitable_default = $charitable_helper->get_default_gateway(); $charitable_upgrades = $charitable_helper->get_recommended_gateways(); /** * Map of gateway IDs to documentation URLs. When set, a small help icon * (dashicons-editor-help) appears next to the gateway name and links to * the docs in a new tab. Legacy `paypal` is intentionally omitted — only * PayPal Commerce gets a doc link. */ $charitable_gateway_doc_urls = array( 'stripe' => 'https://www.wpcharitable.com/documentation/charitable-stripe/', 'square_core' => 'https://www.wpcharitable.com/documentation/how-to-connect-to-square/', 'paypal_commerce' => 'https://www.wpcharitable.com/documentation/how-to-connect-to-paypal-ecommerce', 'offline' => 'https://www.wpcharitable.com/documentation/setting-up-offline-donations/', ); // Add a warning message here if Stripe is an enabled gateway, but no keys are found. if ( class_exists( 'Charitable_Gateway_Stripe_AM' ) ) { if ( ( ! defined( 'CHARITABLE_DISABLE_STRIPE_KEY_CHECK' ) || ! CHARITABLE_DISABLE_STRIPE_KEY_CHECK ) && is_array( $charitable_gateways ) && ! empty( $charitable_gateways ) && in_array( 'Charitable_Gateway_Stripe_AM', $charitable_gateways, true ) && $charitable_helper->is_active_gateway( 'Charitable_Gateway_Stripe_AM' ) ) { // phpcs:ignore $charitable_stripe_gateway = new Charitable_Gateway_Stripe_AM(); $charitable_stripe_keys = $charitable_stripe_gateway->get_keys(); if ( ! isset( $charitable_stripe_keys['public_key'] ) || empty( $charitable_stripe_keys['public_key'] ) ) { // Display the warning message HTML. /* translators: %s: URL to the Stripe settings page */ echo wp_kses( sprintf( '
%s
', sprintf( /* translators: %s: URL to the Stripe settings page */ esc_html__( 'Note: Stripe is enabled but it does not appear to be connected or API keys are missing. Confirm Stripe settings to keep using this gateway.', 'charitable' ), esc_url( admin_url( 'admin.php?page=charitable-settings&tab=gateways&group=gateways_stripe' ) ) ) ), array( 'div' => array( 'class' => array() ), 'strong' => array(), 'a' => array( 'href' => array() ), ) ); } } } // Enforce display order: Stripe → PayPal Commerce → Square → everything else. $charitable_reordered_gateways = array(); $charitable_anchored_keys = array( 'stripe', 'paypal_commerce', 'square_core' ); foreach ( $charitable_anchored_keys as $charitable_key ) { if ( isset( $charitable_gateways[ $charitable_key ] ) ) { $charitable_reordered_gateways[ $charitable_key ] = $charitable_gateways[ $charitable_key ]; } } // Append remaining gateways in their original order. foreach ( $charitable_gateways as $charitable_key => $charitable_class ) { if ( ! isset( $charitable_reordered_gateways[ $charitable_key ] ) ) { $charitable_reordered_gateways[ $charitable_key ] = $charitable_class; } } $charitable_gateways = $charitable_reordered_gateways; foreach ( $charitable_gateways as $charitable_gateway ) : $charitable_gateway = class_exists( $charitable_gateway ) ? new $charitable_gateway() : null; if ( ! $charitable_gateway ) { continue; } $charitable_is_active = $charitable_helper->is_active_gateway( $charitable_gateway->get_gateway_id() ); if ( $charitable_is_active ) { $charitable_action_url = esc_url( add_query_arg( array( 'charitable_action' => 'disable_gateway', 'gateway_id' => $charitable_gateway->get_gateway_id(), '_nonce' => wp_create_nonce( 'gateway' ), ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) ); $charitable_action_text = __( 'Disable Gateway', 'charitable' ); } else { $charitable_action_url = esc_url( add_query_arg( array( 'charitable_action' => 'enable_gateway', 'gateway_id' => $charitable_gateway->get_gateway_id(), '_nonce' => wp_create_nonce( 'gateway' ), ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) ); $charitable_action_text = __( 'Enable Gateway', 'charitable' ); } $charitable_action_url = esc_url( add_query_arg( array( 'charitable_action' => $charitable_is_active ? 'disable_gateway' : 'enable_gateway', 'gateway_id' => $charitable_gateway->get_gateway_id(), '_nonce' => wp_create_nonce( 'gateway' ), ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) ); $charitable_make_default_url = esc_url( add_query_arg( array( 'charitable_action' => 'make_default_gateway', 'gateway_id' => $charitable_gateway->get_gateway_id(), '_nonce' => wp_create_nonce( 'gateway' ), ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) ); $charitable_gateway_name = null !== $charitable_gateway->get_name() ? $charitable_gateway->get_name() : ''; ?> get_gateway_id(); ?>
get_logo(); if ( is_string( $charitable_logo ) && ( strpos( $charitable_logo, ''; } else { echo ''; } } else { $charitable_name = esc_html( $charitable_gateway->get_name() ); if ( 'square' === strtolower( $charitable_name ) ) { $charitable_name .= ' ' . __( '(Legacy)', 'charitable' ); } echo '

' . esc_html( $charitable_name ) . '

'; } ?> get_recommended() ) : ?> get_gateway_id() === (string) $charitable_default ) : ?> 'gateways_' . $charitable_gateway->get_gateway_id(), ), admin_url( 'admin.php?page=charitable-settings&tab=gateways' ) ) ); ?>
get_gateway_id() && ! class_exists( 'Charitable_Gateway_Square' ) ) : $charitable_php_version_check = version_compare( PHP_VERSION, '8.1.0', '>=' ); if ( ! $charitable_php_version_check ) { $charitable_error_message = sprintf( /* translators: %s: URL to documentation */ __( 'Requires PHP 8.1.0 or higher. See our documentation.', 'charitable' ), 'https://www.wpcharitable.com/documentation/php-version-compatibility-square/' ); } else { $charitable_error_message = __( 'Square gateway could not be loaded.', 'charitable' ); } ?>
array( 'href' => array(), 'target' => array(), ), ) ); ?>
get_all_currencies(); $charitable_gateway = key( $charitable_upgrades ); $charitable_message = sprintf( /* translators: %1$s: currency; %2$s: hyperlink %3$s: payment gateway name */ __( 'Tip: Accept donations in %1$s with %3$s.', 'charitable' ), $charitable_currencies[ charitable_get_currency() ], 'https://www.wpcharitable.com/extensions/charitable-' . $charitable_gateway . '/?utm_source=WordPress&utm_campaign=WP+Charitable&utm_medium=Upgrade+Notice&utm_content=Accept+Donations', current( $charitable_upgrades ) ); } else { $charitable_message = sprintf( /* translators: %1$s: hyperlink; %2$s: single extension name; %3$s: comma-separated list of extension names */ __( 'Need more options? Click here to browse our payment gateway extensions, including %3$s and %2$s.', 'charitable' ), 'https://www.wpcharitable.com/extensions/category/payment-gateways/?utm_source=WordPress&utm_campaign=WP+Charitable&utm_medium=Admin+Notice&utm_content=Need+More+Options+Browse+Gateway+Extensions', array_pop( $charitable_upgrades ), implode( ', ', $charitable_upgrades ) ); } ?>