wp_kses_bad_protocol_once2

The timeline below displays how wordpress function wp_kses_bad_protocol_once2 has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Callback for `wp_kses_bad_protocol_once()` regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * list of allowed protocols or not, and returns different data depending
 * on the answer.
 *
 * @access private
 * @ignore
 * @since 1.0.0
 *
 * @param string   $scheme            URI scheme to check against the list of allowed protocols.
 * @param string[] $allowed_protocols Array of allowed URL protocols.
 * @return string Sanitized content.
 */
function wp_kses_bad_protocol_once2($scheme, $allowed_protocols)
{
    $scheme = wp_kses_decode_entities($scheme);
    $scheme = preg_replace('/\s/', '', $scheme);
    $scheme = wp_kses_no_null($scheme);
    $scheme = strtolower($scheme);
    $allowed = false;
    foreach ((array) $allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) === $scheme) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$scheme}:";
    } else {
        return '';
    }
}

WordPress Version: 6.2

/**
 * Callback for `wp_kses_bad_protocol_once()` regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * list of allowed protocols or not, and returns different data depending
 * on the answer.
 *
 * @access private
 * @ignore
 * @since 1.0.0
 *
 * @param string   $scheme            URI scheme to check against the list of allowed protocols.
 * @param string[] $allowed_protocols Array of allowed URL protocols.
 * @return string Sanitized content.
 */
function wp_kses_bad_protocol_once2($scheme, $allowed_protocols)
{
    $scheme = wp_kses_decode_entities($scheme);
    $scheme = preg_replace('/\s/', '', $scheme);
    $scheme = wp_kses_no_null($scheme);
    $scheme = strtolower($scheme);
    $allowed = false;
    foreach ((array) $allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) == $scheme) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$scheme}:";
    } else {
        return '';
    }
}

WordPress Version: 5.5

/**
 * Callback for `wp_kses_bad_protocol_once()` regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * list of allowed protocols or not, and returns different data depending
 * on the answer.
 *
 * @access private
 * @ignore
 * @since 1.0.0
 *
 * @param string   $string            URI scheme to check against the list of allowed protocols.
 * @param string[] $allowed_protocols Array of allowed URL protocols.
 * @return string Sanitized content.
 */
function wp_kses_bad_protocol_once2($string, $allowed_protocols)
{
    $string2 = wp_kses_decode_entities($string);
    $string2 = preg_replace('/\s/', '', $string2);
    $string2 = wp_kses_no_null($string2);
    $string2 = strtolower($string2);
    $allowed = false;
    foreach ((array) $allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) == $string2) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$string2}:";
    } else {
        return '';
    }
}

WordPress Version: 5.1

/**
 * Callback for `wp_kses_bad_protocol_once()` regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * whitelist or not, and returns different data depending on the answer.
 *
 * @access private
 * @ignore
 * @since 1.0.0
 *
 * @param string   $string            URI scheme to check against the whitelist.
 * @param string[] $allowed_protocols Array of allowed URL protocols.
 * @return string Sanitized content.
 */
function wp_kses_bad_protocol_once2($string, $allowed_protocols)
{
    $string2 = wp_kses_decode_entities($string);
    $string2 = preg_replace('/\s/', '', $string2);
    $string2 = wp_kses_no_null($string2);
    $string2 = strtolower($string2);
    $allowed = false;
    foreach ((array) $allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) == $string2) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$string2}:";
    } else {
        return '';
    }
}

WordPress Version: 4.3

/**
 * Callback for wp_kses_bad_protocol_once() regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * whitelist or not, and returns different data depending on the answer.
 *
 * @access private
 * @since 1.0.0
 *
 * @param string $string            URI scheme to check against the whitelist
 * @param string $allowed_protocols Allowed protocols
 * @return string Sanitized content
 */
function wp_kses_bad_protocol_once2($string, $allowed_protocols)
{
    $string2 = wp_kses_decode_entities($string);
    $string2 = preg_replace('/\s/', '', $string2);
    $string2 = wp_kses_no_null($string2);
    $string2 = strtolower($string2);
    $allowed = false;
    foreach ((array) $allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) == $string2) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$string2}:";
    } else {
        return '';
    }
}

WordPress Version: 3.7

/**
 * Callback for wp_kses_bad_protocol_once() regular expression.
 *
 * This function processes URL protocols, checks to see if they're in the
 * whitelist or not, and returns different data depending on the answer.
 *
 * @access private
 * @since 1.0.0
 *
 * @param string $string URI scheme to check against the whitelist
 * @param string $allowed_protocols Allowed protocols
 * @return string Sanitized content
 */
function wp_kses_bad_protocol_once2($string, $allowed_protocols)
{
    $string2 = wp_kses_decode_entities($string);
    $string2 = preg_replace('/\s/', '', $string2);
    $string2 = wp_kses_no_null($string2);
    $string2 = strtolower($string2);
    $allowed = false;
    foreach ((array) $allowed_protocols as $one_protocol) {
        if (strtolower($one_protocol) == $string2) {
            $allowed = true;
            break;
        }
    }
    if ($allowed) {
        return "{$string2}:";
    } else {
        return '';
    }
}