Done !
| Server IP : 46.105.57.169 / Your IP : 216.73.216.67 Web Server : Apache System : Linux webm002.cluster120.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaumee ( 152031) PHP Version : 8.5.7 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/verseaumee/www/plugins/fields/mediajce/tmpl/ |
Upload File : |
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.MediaJce
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2018 Ryan Demmer. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.path');
if ($field->value == '')
{
return;
}
$class = (string) $fieldParams->get('media_class', '');
$type = (string) $fieldParams->get('mediatype', 'images');
$text = (string) $fieldParams->get('media_description', '');
if ($class)
{
$class = ' class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"';
}
if ($text)
{
$text = htmlentities($text, ENT_COMPAT, 'UTF-8', true);
}
$value = (array) $field->value;
$buffer = '';
$element = '<img src="%s"%s alt="%s" />';
if ($type !== "images") {
$element = '<a href="%s"%s>%s</a>';
}
foreach ($value as $path)
{
if (!$path)
{
continue;
}
// remove some common characters
$path = preg_replace('#[\+\\\?\#%&<>"\'=\[\]\{\},;@\^\(\)£€$]#', '', $path);
// trim
$path = trim($path);
// check for valid path after clean
if (!$path)
{
continue;
}
// clean path
$path = JPath::clean($path);
// create full path
$fullpath = JPATH_SITE . '/' . trim($path, '/');
// check path is valid
if (!is_file($fullpath)) {
continue;
}
// set text as basename if not an image
if (!$text && $type !== "images") {
$text = basename($path);
}
$buffer .= sprintf($element,
htmlentities($path, ENT_COMPAT, 'UTF-8', true),
$class,
$text
);
}
echo $buffer;