CoreFiles by mySites.guru
url.php42 lines, 762 bytes, from Joomla_4.0.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta2
md5
7d0c5d11b5f40e2b67ded485e1c186a6
sha1
6a83ee1fc32f40df5259b043f3619845829eacdd
sha256
2ad51edbd6fa94091274c1661b359b4e4f50c4247694b0645428572da6ceb301
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.URL
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @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 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.