| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/plats-individuels/lyon/plugins/system/nrframework/NRFramework/Helpers/ |
Upload File : |
<?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
namespace NRFramework\Helpers;
defined('_JEXEC') or die;
use Joomla\CMS\Uri\Uri;
class File
{
public static function getFileSources($sources, $allowedExtensions = null)
{
if (!$sources)
{
return;
}
// Support comma separated values
$sources = is_array($sources) ? $sources : explode(',', $sources);
$result = [];
$ds = DIRECTORY_SEPARATOR;
foreach ($sources as $source)
{
if (!$pathinfo = pathinfo($source))
{
continue;
}
if (!isset($pathinfo['extension']))
{
continue;
}
if ($allowedExtensions && !in_array($pathinfo['extension'], $allowedExtensions))
{
continue;
}
// Add root path to local source
if (strpos($source, 'http') === false)
{
$source = Uri::root() . ltrim($source, '/');
}
$result[] = [
'ext' => $pathinfo['extension'],
'file' => $source
];
}
return $result;
}
}