PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/craftsperks.online/wp-content/plugins/cloudflare/src/WordPress/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/craftsperks.online/wp-content/plugins/cloudflare/src/WordPress/Utils.php

<?php

namespace CF\WordPress;

class Utils
{
    /**
     * @param $haystack
     * @param $needle
     *
     * @return bool
     */
    public static function endsWith($haystack, $needle)
    {
        return $needle === '' || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
    }

    public static function isSubdomainOf($subDomainName, $domainName)
    {
        if (empty($subDomainName) || empty($domainName)) {
            return false;
        }

        // Check if strpos is a positive integer
        $dotPosition = strpos($subDomainName, $domainName) - 1;
        if ($dotPosition === -1) {
            return false;
        }

        return self::endsWith($subDomainName, $domainName) &&
                $subDomainName !== $domainName &&
                $subDomainName[$dotPosition] == '.';
    }

    public static function getRegistrableDomain($domainName)
    {
        // Remove characters up to the first "." character.
        // For example:
        // blog.domain.com -> domain.com
        // does not work with multiple subdomain
        // sub1.sub2.domain.com -> sub2.domain.com
        return preg_replace('/^[^.]*.\s*/', '', $domainName);
    }
}