NexusLeads Webshell
NexusLeads


Server : LiteSpeed
System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : alsaif ( 1057)
PHP Version : 7.4.33
Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/alsaif/domains/alsaif.group/public_html/libraries/regularlabs/fields/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/alsaif/domains/alsaif.group/public_html/libraries/regularlabs/fields/menuitems.php
<?php
/**
 * @package         Regular Labs Library
 * @version         23.9.3039
 * 
 * @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
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;
use RegularLabs\Library\Field;
use RegularLabs\Library\Language as RL_Language;
use RegularLabs\Library\RegEx as RL_RegEx;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
    return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_MenuItems extends Field
{
    public $type = 'MenuItems';

    /**
     * Get a list of menu links for one or all menus.
     */
    public static function getMenuItems()
    {
        RL_Language::load('com_modules', JPATH_ADMINISTRATOR);
        JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
        $menuTypes = MenusHelper::getMenuLinks();

        foreach ($menuTypes as &$type)
        {
            $type->value      = 'type.' . $type->menutype;
            $type->text       = $type->title;
            $type->level      = 0;
            $type->class      = 'hidechildren';
            $type->labelclass = 'nav-header';

            $rlu[$type->menutype] = &$type;

            foreach ($type->links as &$link)
            {
                $check1 = RL_RegEx::replace('[^a-z0-9]', '', strtolower($link->text));
                $check2 = RL_RegEx::replace('[^a-z0-9]', '', $link->alias);

                $text   = [];
                $text[] = $link->text;

                if ($check1 !== $check2)
                {
                    $text[] = '<span class="small ghosted">[' . $link->alias . ']</span>';
                }

                if (in_array($link->type, ['separator', 'heading', 'alias', 'url']))
                {
                    $text[] = '<span class="label label-info">' . JText::_('COM_MODULES_MENU_ITEM_' . strtoupper($link->type)) . '</span>';
                    // Don't disable, as you need to be able to select the 'Also on Child Items' option
                    // $link->disable = 1;
                }

                if ($link->published == 0)
                {
                    $text[] = '<span class="label">' . JText::_('JUNPUBLISHED') . '</span>';
                }

                if (JLanguageMultilang::isEnabled() && $link->language != '' && $link->language != '*')
                {
                    $text[] = $link->language_image
                        ? JHtml::_('image', 'mod_languages/' . $link->language_image . '.gif', $link->language_title, ['title' => $link->language_title], true)
                        : '<span class="label" title="' . $link->language_title . '">' . $link->language_sef . '</span>';
                }

                $link->text = implode(' ', $text);
            }
        }

        return $menuTypes;
    }

    public function getAjaxRaw(Registry $attributes)
    {
        $name     = $attributes->get('name', $this->type);
        $id       = $attributes->get('id', strtolower($name));
        $value    = $attributes->get('value', []);
        $size     = $attributes->get('size');
        $multiple = $attributes->get('multiple');

        $options = $this->getMenuItems();

        return $this->selectList($options, $name, $value, $id, $size, $multiple);
    }

    protected function getInput()
    {
        $size     = (int) $this->get('size');
        $multiple = $this->get('multiple', 0);

        return $this->selectListAjax(
            $this->type, $this->name, $this->value, $this->id,
            compact('size', 'multiple')
        );
    }
}

NexusLeads