HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/avoxlive/public_html/application/libraries/SEOstats/Helper/Url.php
<?php
namespace SEOstats\Helper;

/**
 * URL-String Helper Class
 *
 * @package    SEOstats
 * @author     Stephan Schmitz <eyecatchup@gmail.com>
 * @copyright  Copyright (c) 2010 - present Stephan Schmitz
 * @license    http://eyecatchup.mit-license.org/  MIT License
 * @updated    2013/02/03
 */

class Url
{
    public static function parseHost($url)
    {
        $url = @parse_url('http://' . preg_replace('#^https?://#', '', $url));
        return (isset($url['host']) && !empty($url['host'])) ? $url['host'] : false;
    }

    /**
     * Validates the initialized object URL syntax.
     *
     * @access        private
     * @param         string        $url        String, containing the initialized object URL.
     * @return        string                    Returns string, containing the validation result.
     */
    public static function isRfc($url)
    {
        if(isset($url) && 1 < strlen($url)) {
            $host   = self::parseHost($url);
            $scheme = strtolower(parse_url($url, PHP_URL_SCHEME));
            if (false !== $host && ($scheme == 'http' || $scheme == 'https')) {
                $pattern  = '([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@&~=-])';
                $pattern .= '|%[A-Fa-f0-9]{2}){1,333}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@&~=%-]{0,1000}))?)';
                return (bool) preg_match($pattern, $url);
            }
        }
        return false;
    }
}