| Server IP : 46.105.57.169 / Your IP : 216.73.216.84 Web Server : Apache System : Linux webd003.cluster120.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 : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/m/a/i/maitricfuz/www/new-saint-martin/modules/mod_spgallery/fields/ |
Upload File : |
<?php
/**
* @package Smile Pack
* @version 1.2.2 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2019 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Form\Field\TextField;
use Joomla\Registry\Registry;
class JFormFieldSPGalleryEditor extends TextField
{
/**
* Generates the Gallery Field
*
* @return string The field input markup.
*/
protected function getInput()
{
require_once __DIR__ . '/helper.php';
$limit_files = (int) $this->form->getData()->get('params.limit_files');
if ($limit_files < 1 || $limit_files > 8)
{
$limit_files = 8;
}
$data = [
'value' => $this->prepareValue(),
'name' => $limit_files == 1 ? $this->name . '[items][0]' : $this->name . '[items][ITEM_ID]',
'limit_files' => $limit_files,
'max_file_size' => 5,
'original_image_resize' => false,
'disabled' => $this->disabled,
'context' => 'module',
'item_id' => $this->getItemID(),
'id' => $this->id
];
return \NRFramework\Widgets\Helper::render('GalleryManager2', $data);
}
private function getItemID()
{
$item_id = (int) Factory::getApplication()->input->get('id');
switch (Factory::getApplication()->input->get('option'))
{
case 'com_users':
$item_id = Factory::getUser()->id;
break;
}
return $item_id;
}
/**
* The list of uploaded Gallery Items.
*
* @return mixed
*/
private function prepareValue()
{
if (empty($this->value))
{
return;
}
$this->value = is_string($this->value) ? json_decode($this->value, true) : (array) $this->value;
if (!isset($this->value['items']))
{
return;
}
$value = [];
foreach ($this->value['items'] as $key => $file)
{
$file = new Registry($file);
$tags = $file->get('tags', []);
$tags = is_array($tags) ? $tags : [];
$value[] = [
'source' => $file->get('source'),
'original' => $file->get('image'),
'exists' => file_exists(Path::clean(implode(DIRECTORY_SEPARATOR, [JPATH_ROOT, $file->get('thumbnail')]))),
'caption' => $file->get('caption', ''),
'thumbnail' => $file->get('thumbnail', ''),
'slideshow' => $file->get('slideshow', ''),
'alt' => $file->get('alt', ''),
'tags' => json_encode($tags)
];
}
return $value;
}
}