CoreFiles by mySites.guru
url.php40 lines, 780 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
fc4c4714c3b25047f9f59ba07d0b905f
sha1
011083580984a4a26c399f111c1a4a6399468c5b
sha256
0cf2e189bbc62a38d470b19a3afb94d78c08b443747f2220979b251e2fbd1a1b
<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.URL
 *
 * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$value = $field->value;

if ($value == '') {
    return;
}

$attributes = '';

if (!Uri::isInternal($value)) {
    $attributes = ' rel="nofollow noopener noreferrer" target="_blank"';
    $text       = Text::_('JVISIT_WEBSITE');
} else {
    $text       = Text::_('JVISIT_LINK');
}

if ($fieldParams->get('show_url', 0)) {
    $text = htmlspecialchars($value);
}

echo sprintf(
    '<a href="%s"%s>%s</a>',
    htmlspecialchars($value),
    $attributes,
    $text
);

The same content is in 230 releases, Joomla 4.2.0-beta3 to 6.2.1-rc1. See them all, or every version of this file.