WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

YoastSEO_Vendor\Symfony\Polyfill\Intl\Idn

Idn::validateLabel() private Yoast 1.0

{} Это метод класса: Idn{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$result = Idn::validateLabel( $label, \YoastSEO_Vendor\Symfony\Polyfill\Intl\Idn\Info $info, $options, $canBeEmpty );
$label(строка) (обязательный)
bool>(массив<строка,) (обязательный)
$options
$canBeEmpty(true/false) (обязательный)

Заметки

Код Idn::validateLabel() Yoast 15.1.1

<?php
private static function validateLabel($label, \YoastSEO_Vendor\Symfony\Polyfill\Intl\Idn\Info $info, array $options, $canBeEmpty)
{
    if ('' === $label) {
        if (!$canBeEmpty && (!isset($options['VerifyDnsLength']) || $options['VerifyDnsLength'])) {
            $info->errors |= self::ERROR_EMPTY_LABEL;
        }
        return;
    }
    // Step 1. The label must be in Unicode Normalization Form C.
    if (!\Normalizer::isNormalized($label, \Normalizer::FORM_C)) {
        $info->errors |= self::ERROR_INVALID_ACE_LABEL;
    }
    $codePoints = self::utf8Decode($label);
    if ($options['CheckHyphens']) {
        // Step 2. If CheckHyphens, the label must not contain a U+002D HYPHEN-MINUS character
        // in both the thrid and fourth positions.
        if (isset($codePoints[2], $codePoints[3]) && 0x2d === $codePoints[2] && 0x2d === $codePoints[3]) {
            $info->errors |= self::ERROR_HYPHEN_3_4;
        }
        // Step 3. If CheckHyphens, the label must neither begin nor end with a U+002D
        // HYPHEN-MINUS character.
        if ('-' === \substr($label, 0, 1)) {
            $info->errors |= self::ERROR_LEADING_HYPHEN;
        }
        if ('-' === \substr($label, -1, 1)) {
            $info->errors |= self::ERROR_TRAILING_HYPHEN;
        }
    }
    // Step 4. The label must not contain a U+002E (.) FULL STOP.
    if (\false !== \strpos($label, '.')) {
        $info->errors |= self::ERROR_LABEL_HAS_DOT;
    }
    // Step 5. The label must not begin with a combining mark, that is: General_Category=Mark.
    if (1 === \preg_match(\YoastSEO_Vendor\Symfony\Polyfill\Intl\Idn\Resources\unidata\Regex::COMBINING_MARK, $label)) {
        $info->errors |= self::ERROR_LEADING_COMBINING_MARK;
    }
    // Step 6. Each code point in the label must only have certain status values according to
    // Section 5, IDNA Mapping Table:
    $transitional = $options['Transitional_Processing'];
    $useSTD3ASCIIRules = $options['UseSTD3ASCIIRules'];
    foreach ($codePoints as $codePoint) {
        $data = self::lookupCodePointStatus($codePoint, $useSTD3ASCIIRules);
        $status = $data['status'];
        if ('valid' === $status || !$transitional && 'deviation' === $status) {
            continue;
        }
        $info->errors |= self::ERROR_DISALLOWED;
        break;
    }
    // Step 7. If CheckJoiners, the label must satisify the ContextJ rules from Appendix A, in
    // The Unicode Code Points and Internationalized Domain Names for Applications (IDNA)
    // [IDNA2008].
    if ($options['CheckJoiners'] && !self::isValidContextJ($codePoints, $label)) {
        $info->errors |= self::ERROR_CONTEXTJ;
    }
    // Step 8. If CheckBidi, and if the domain name is a  Bidi domain name, then the label must
    // satisfy all six of the numbered conditions in [IDNA2008] RFC 5893, Section 2.
    if ($options['CheckBidi'] && (!$info->bidiDomain || $info->validBidiDomain)) {
        self::validateBidiLabel($label, $info);
    }
}