AnonSec Shell
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/dansnotreville-fr/nice/libraries/regularlabs/src/Form/Field/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/dansnotreville-fr/nice/libraries/regularlabs/src/Form/Field/SimpleCategoryField.php
<?php
/**
 * @package         Regular Labs Library
 * @version         23.10.17780
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            https://regularlabs.com
 * @copyright       Copyright © 2023 Regular Labs All Rights Reserved
 * @license         GNU General Public License version 2 or later
 */

namespace RegularLabs\Library\Form\Field;

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\CMS\Layout\FileLayout as JFileLayout;
use RegularLabs\Library\Form\FormField as RL_FormField;

class SimpleCategoryField extends RL_FormField
{
    protected function getInput()
    {
        $categories = $this->getOptions();
        $options    = parent::getOptions();

        $options = [...$options, ...$categories];

        if ($this->get('show_none', true))
        {
            $empty_option        = JHtml::_('select.option', $this->get('none_value', ''), '- ' . JText::_('JNONE') . ' -');
            $empty_option->class = 'hidden';
            array_unshift($options, $empty_option);
        }

        if ($this->get('show_keep_original'))
        {
            $keep_original_option = JHtml::_('select.option', ' ', '- ' . JText::_('RL_KEEP_ORIGINAL_CATEGORY') . ' -');

            array_unshift($options, $keep_original_option);
        }

        $data                = $this->getLayoutData();
        $data['options']     = $options;
        $data['placeholder'] = JText::_($this->get('hint', 'RL_SELECT_OR_CREATE_A_CATEGORY'));
        $data['allowCustom'] = $this->get('allow_custom', true);

        return (new JFileLayout(
            'regularlabs.form.field.simplecategory',
            JPATH_SITE . '/libraries/regularlabs/layouts'
        ))->render($data);
    }

    protected function getOptions()
    {
        $table = $this->get('table');

        if ( ! $table)
        {
            return [];
        }

        // Get the user groups from the database.
        $query = $this->db->getQuery(true)
            ->select([
                $this->db->quoteName('category', 'value'),
                $this->db->quoteName('category', 'text'),
            ])
            ->from($this->db->quoteName('#__' . $table))
            ->where($this->db->quoteName('category') . ' != ' . $this->db->quote(''))
            ->group($this->db->quoteName('category'))
            ->order($this->db->quoteName('category') . ' ASC');
        $this->db->setQuery($query);

        $categories = $this->db->loadObjectList();

        foreach ($categories as &$category)
        {
            if ( ! str_contains($category->text, '::'))
            {
                continue;
            }

            [$text, $icon] = explode('::', $category->text, 2);

            $category->text = $text;
        }

        return $categories;
    }
}

Anon7 - 2022
AnonSec Team