| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 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/maitricfuz/www/saint-martin-lg/plugins/system/jtaldef/field/ |
Upload File : |
<?php
/**
* Automatic local download external files
*
* @package Joomla.Plugin
* @subpackage System.Jtaldef
*
* @author Guido De Gobbis <support@joomtools.de>
* @copyright JoomTools.de - All rights reserved.
* @license GNU General Public License version 3 or later
*/
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\ListField;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Folder;
/**
* List of supported Handler
*
* @since 2.0.0
*/
class JFormFieldJtaldefServiceToParse extends ListField
{
/**
* The form field type.
*
* @var string
* @since 2.0.0
*/
protected $type = 'JtaldefServiceToParse';
/**
* Name of the layout being used to render the field
*
* @var string
* @since 2.0.0
*/
protected $layout = 'joomla.form.field.list-fancy-select';
/**
* @var string[]
* @since 2.0.0
*/
protected $exclude = [
'parsecss',
];
/**
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
*
* @return string The field input markup.
*
* @since 2.0.0
*/
protected function getInput()
{
if (version_compare(JVERSION, '4', 'lt')) {
$this->layout = '';
return parent::getInput();
}
$data = $this->getLayoutData();
$data['options'] = (array) $this->getOptions();
return $this->getRenderer($this->layout)->render($data);
}
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 2.0.0
*/
protected function getOptions()
{
$options = [];
$app = Factory::getApplication();
$servicesPath = JPATH_PLUGINS . '/system/jtaldef/src/Service';
$services = Folder::files($servicesPath);
foreach ($services as $serviceFile) {
$error = false;
$serviceName = File::stripExt($serviceFile);
if (in_array(strtolower($serviceName), $this->exclude)) {
continue;
}
$service = 'JoomTools\\Plugin\\System\\Jtaldef\\Service\\' . ucfirst($serviceName);
try {
$serviceHandler = new $service;
$tmp = [
'value' => $serviceName,
'text' => $serviceHandler->getRealServiceName(),
'selected' => 'true',
'checked' => 'true',
];
// Add the option object to the result set.
$options[] = (object) $tmp;
} catch (\Exception $e) {
$app->enqueueMessage(
sprintf("The class '%s' to call for handle the download could not be found.", $service),
'error'
);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
}