geno/wp-content/plugins/mailpoet/lib/Util/SecondLevelDomainNames.php
2024-02-01 11:54:18 +00:00

15 lines
356 B
PHP

<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Util;
if (!defined('ABSPATH')) exit;
class SecondLevelDomainNames {
public function get($host) {
if (preg_match('/[^.]*\.[^.]{2,3}(?:\.[^.]{2,3})?$/', $host, $matches)) {
return $matches[0];
}
return $host;
}
}