CoreFiles by mySites.guru
url.php42 lines, 749 bytes, from Joomla_4.0.2-Stable-Full_Package.zip
Raw History Compare with 4.0.1
md5
3be7fee092e34478d473f41971620050
sha1
3d1dc57e6d56b2c9d1a41e9ac04f1e2852bdc83f
sha256
1daa68697c300276959b45d75856ae501bb18aec5627134f4bfb27d2abe0756a
<?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 51 releases, Joomla 4.0.0-beta6 to 4.2.0-beta2. See them all, or every version of this file.