HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: //var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/src/Features/Worldpay/Worldpay.php
<?php

namespace GoDaddy\WordPress\MWC\Core\Features\Worldpay;

use Exception;
use GoDaddy\WordPress\MWC\Common\Components\Contracts\ComponentContract;
use GoDaddy\WordPress\MWC\Common\Components\Traits\HasComponentsTrait;
use GoDaddy\WordPress\MWC\Common\Configuration\Configuration;
use GoDaddy\WordPress\MWC\Common\Features\AbstractFeature;
use GoDaddy\WordPress\MWC\Common\Platforms\PlatformRepositoryFactory;
use GoDaddy\WordPress\MWC\Core\Features\Worldpay\Interceptors\ConnectionInterceptor;
use GoDaddy\WordPress\MWC\Core\Features\Worldpay\Interceptors\OverridesInterceptor;

/**
 * The Worldpay feature loader.
 */
class Worldpay extends AbstractFeature
{
    use HasComponentsTrait;

    /** @var class-string<ComponentContract>[] component classes to load */
    protected $componentClasses = [
        ConnectionInterceptor::class,
        OverridesInterceptor::class,
    ];

    /**
     * Gets the feature name, matching the key used in configuration.
     *
     * @return string
     */
    public static function getName() : string
    {
        return 'worldpay';
    }

    /**
     * Determines whether the class should load.
     *
     * @return bool
     * @throws Exception
     */
    public static function shouldLoad() : bool
    {
        return parent::shouldLoadFeature()
            && PlatformRepositoryFactory::getNewInstance()->getPlatformRepository()->getGoDaddyCustomer()->getFederationPartnerId() === 'WORLDPAY'
            && 'woosaas' === PlatformRepositoryFactory::getNewInstance()->getPlatformRepository()->getPlatformName();
    }

    /**
     * Initializes this feature.
     *
     * @throws Exception
     */
    public function load() : void
    {
        $this->loadComponents();
    }

    /**
     * Determines whether Worldpay should be loaded with temporary content to the pages.
     *
     * By temporary content, consider new URLs, hooks that may behave with or without this conditional, among others.
     *
     * @return bool
     * @throws Exception
     */
    public static function shouldProcessTemporaryContent() : bool
    {
        return Configuration::get('features.worldpay.useNewUrls', false) && static::shouldLoad();
    }
}