mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-23 22:34:50 +03:00
code style
This commit is contained in:
parent
5995bc1a53
commit
0d9b10ef8b
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage com_oauthserver
|
||||
*
|
||||
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||
* @license MIT; see LICENSE.txt
|
||||
**/
|
||||
|
||||
namespace Webmasterskaya\Plugin\System\OauthServer\Extension;
|
||||
|
||||
@ -8,6 +15,11 @@ use Joomla\CMS\Router\SiteRouter;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
class Plugin extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents(): array
|
||||
@ -15,12 +27,17 @@ class Plugin extends CMSPlugin implements SubscriberInterface
|
||||
return ['onAfterInitialise' => 'attachOauthRouter'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @since version
|
||||
*/
|
||||
public function attachOauthRouter(): void
|
||||
{
|
||||
/** @var \Joomla\CMS\Application\SiteApplication $app */
|
||||
$app = $this->getApplication();
|
||||
|
||||
if (!$app->isClient('site')) {
|
||||
if (!$app->isClient('site'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -32,6 +49,7 @@ class Plugin extends CMSPlugin implements SubscriberInterface
|
||||
/**
|
||||
* @param \Joomla\CMS\Router\SiteRouter $router
|
||||
* @param \Joomla\CMS\Uri\Uri $uri
|
||||
*
|
||||
* @return void
|
||||
* @since version
|
||||
*/
|
||||
@ -39,14 +57,13 @@ class Plugin extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
$route = trim($uri->getPath(), '/');
|
||||
|
||||
if (empty($route)) {
|
||||
if (empty($route))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Переделать на ComponentRouter (пример в Joomla\CMS\Router\SiteRouter::parseSefRoute())
|
||||
// 1. Зарегистрировать роутер компонента $router->setComponentRouter()
|
||||
// 2. Вызвать $router->getComponentRouter($component)
|
||||
if (!str_starts_with($route, 'login/oauth')) {
|
||||
if (!str_starts_with($route, 'login/oauth'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user