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/amisdesseniors-fr/nimes/libraries/regularlabs/src/Form/Field/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/nimes/libraries/regularlabs/src/Form/Field/AgentsField.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 RegularLabs\Library\Form\FormField as RL_FormField;

class AgentsField extends RL_FormField
{
    public      $attributes     = [
        'group' => 'os',
    ];
    public bool $is_select_list = true;

    public function getNamesByIds($values, $attributes)
    {
        $agents = $this->getAgents($attributes);

        $names = [];

        foreach ($agents as $agent)
        {
            if ( ! in_array($agent[1], $values))
            {
                continue;
            }

            $names[] = $agent[0];
        }

        return $names;
    }

    protected function getListOptions($attributes)
    {
        $agents = $this->getAgents($attributes);

        $options = [];

        foreach ($agents as $agent)
        {
            $option    = JHtml::_('select.option', $agent[1], $agent[0]);
            $options[] = $option;
        }

        return $options;
    }

    private function getAgents($attributes)
    {
        $agents = [];

        switch ($attributes['group'])
        {
            /* OS */
            case 'os':
                $agents[] = ['Windows', 'Windows'];
                $agents[] = ['Mac OS', '#(Mac OS|Mac_PowerPC|Macintosh)#'];
                $agents[] = ['Linux', '#(Linux|X11)#'];
                $agents[] = ['Open BSD', 'OpenBSD'];
                $agents[] = ['Sun OS', 'SunOS'];
                $agents[] = ['QNX', 'QNX'];
                $agents[] = ['BeOS', 'BeOS'];
                $agents[] = ['OS/2', 'OS/2'];
                break;

            /* Browsers */
            case 'browser':
                $agents[] = ['Chrome', 'Chrome'];
                $agents[] = ['Firefox', 'Firefox'];
                $agents[] = [
                    'Microsoft Edge', 'MSIE Edge',
                ]; // missing MSIE is added to agent string in RegularLabs\Component\Conditions\Administrator\Condition\Agent\Agent
                $agents[] = [
                    'Internet Explorer', 'MSIE [0-9]',
                ]; // missing MSIE is added to agent string in RegularLabs\Component\Conditions\Administrator\Condition\Agent\Agent
                $agents[] = ['Opera', 'Opera'];
                $agents[] = ['Safari', 'Safari'];
                break;

            /* Mobile browsers */
            case 'mobile':
                $agents[] = [JText::_('JALL'), 'mobile'];
                $agents[] = ['Android', 'Android'];
                $agents[] = ['Android Chrome', '#Android.*Chrome#'];
                $agents[] = ['Blackberry', 'Blackberry'];
                $agents[] = ['IE Mobile', 'IEMobile'];
                $agents[] = ['iPad', 'iPad'];
                $agents[] = ['iPhone', 'iPhone'];
                $agents[] = ['iPod Touch', 'iPod'];
                $agents[] = ['NetFront', 'NetFront'];
                $agents[] = ['Nokia', 'NokiaBrowser'];
                $agents[] = ['Opera Mini', 'Opera Mini'];
                $agents[] = ['Opera Mobile', 'Opera Mobi'];
                $agents[] = ['UC Browser', 'UC Browser'];
                break;

            default:
                break;
        }

        return $agents;
    }
}

Anon7 - 2022
AnonSec Team