| Server IP : 46.105.57.169 / Your IP : 216.73.217.8 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.22 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/saint-martin-lg/libraries/regularlabs/src/ |
Upload File : |
<?php
/**
* @package Regular Labs Library
* @version 26.7.20176
*
* @author Peter van Westen <info@regularlabs.com>
* @link https://regularlabs.com
* @copyright Copyright © 2026 Regular Labs All Rights Reserved
* @license GNU General Public License version 2 or later
*/
namespace RegularLabs\Library;
defined('_JEXEC') or die;
use Joomla\CMS\Application\CMSApplicationInterface as JCMSApplicationInterface;
use Joomla\CMS\Factory as JFactory;
class Application
{
public static function get(): JCMSApplicationInterface
{
if (\RegularLabs\Library\Indexer::isActive()) {
return self::getForFinder();
}
return self::getCurrent();
}
public static function getClientId(int $default = 0): int
{
$application = self::get();
if (!method_exists($application, 'getClientId')) {
return $default;
}
return (int) $application->getClientId();
}
public static function getCurrent(): JCMSApplicationInterface
{
return JFactory::getApplication();
}
public static function getSite(): JCMSApplicationInterface
{
return JFactory::getContainer()->get('Joomla\CMS\Application\SiteApplication');
}
public static function isAdministrator(): bool
{
return self::getCurrent()->isClient('administrator');
}
public static function isCli(): bool
{
return self::getCurrent()->isClient('cli');
}
public static function isClient(string $identifier): bool
{
$identifier = $identifier == 'admin' ? 'administrator' : $identifier;
return self::getCurrent()->isClient($identifier);
}
public static function isSite(): bool
{
return self::getCurrent()->isClient('site');
}
private static function getForFinder(): JCMSApplicationInterface
{
$application = self::getSite();
$language = $application->getLanguage();
if (is_null($language) && method_exists($application, 'setLanguage')) {
$application->setLanguage(self::getCurrent()->getLanguage() ?? JFactory::getLanguage());
}
if (method_exists($application, 'getDocument') && method_exists($application, 'loadDocument') && is_null($application->getDocument())) {
$application->loadDocument();
}
return $application;
}
}