_make_web_ftp_clickable_cb

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

WordPress Version: 6.2

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    // Removed trailing [.,;:)] from URL.
    $last_char = substr($dest, -1);
    if (in_array($last_char, array('.', ',', ';', ':', ')'), true) === true) {
        $ret = $last_char;
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    $rel_attr = _make_clickable_rel_attr($dest);
    return $matches[1] . "<a href=\"{$dest}\"{$rel_attr}>{$dest}</a>{$ret}";
}

WordPress Version: 5.5

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    // Removed trailing [.,;:)] from URL.
    $last_char = substr($dest, -1);
    if (in_array($last_char, array('.', ',', ';', ':', ')'), true) === true) {
        $ret = $last_char;
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    if ('comment_text' === current_filter()) {
        $rel = 'nofollow ugc';
    } else {
        $rel = 'nofollow';
    }
    /** This filter is documented in wp-includes/formatting.php */
    $rel = apply_filters('make_clickable_rel', $rel, $dest);
    $rel = esc_attr($rel);
    return $matches[1] . "<a href=\"{$dest}\" rel=\"{$rel}\">{$dest}</a>{$ret}";
}

WordPress Version: 5.4

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    // Removed trailing [.,;:)] from URL.
    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
        $ret = substr($dest, -1);
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    if ('comment_text' === current_filter()) {
        $rel = 'nofollow ugc';
    } else {
        $rel = 'nofollow';
    }
    /** This filter is documented in wp-includes/formatting.php */
    $rel = apply_filters('make_clickable_rel', $rel, $dest);
    $rel = esc_attr($rel);
    return $matches[1] . "<a href=\"{$dest}\" rel=\"{$rel}\">{$dest}</a>{$ret}";
}

WordPress Version: 5.3

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    // removed trailing [.,;:)] from URL
    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
        $ret = substr($dest, -1);
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    if ('comment_text' === current_filter()) {
        $rel = 'nofollow ugc';
    } else {
        $rel = 'nofollow';
    }
    /** This filter is documented in wp-includes/formatting.php */
    $rel = apply_filters('make_clickable_rel', $rel, $dest);
    $rel = esc_attr($rel);
    return $matches[1] . "<a href=\"{$dest}\" rel=\"{$rel}\">{$dest}</a>{$ret}";
}

WordPress Version: 4.6

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for make_clickable().
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    // removed trailing [.,;:)] from URL
    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
        $ret = substr($dest, -1);
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    return $matches[1] . "<a href=\"{$dest}\" rel=\"nofollow\">{$dest}</a>{$ret}";
}

WordPress Version: 4.4

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
 * make_clickable()}.
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    // removed trailing [.,;:)] from URL
    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
        $ret = substr($dest, -1);
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    return $matches[1] . "<a href=\"{$dest}\" rel=\"nofollow\">{$dest}</a>{$ret}";
}

WordPress Version: 3.7

/**
 * Callback to convert URL match to HTML A element.
 *
 * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
 * make_clickable()}.
 *
 * @since 2.3.2
 * @access private
 *
 * @param array $matches Single Regex Match.
 * @return string HTML A element with URL address.
 */
function _make_web_ftp_clickable_cb($matches)
{
    $ret = '';
    $dest = $matches[2];
    $dest = 'http://' . $dest;
    $dest = esc_url($dest);
    if (empty($dest)) {
        return $matches[0];
    }
    // removed trailing [.,;:)] from URL
    if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
        $ret = substr($dest, -1);
        $dest = substr($dest, 0, strlen($dest) - 1);
    }
    return $matches[1] . "<a href=\"{$dest}\" rel=\"nofollow\">{$dest}</a>{$ret}";
}