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
|
<?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;
|
namespace Webmasterskaya\Plugin\System\OauthServer\Extension;
|
||||||
|
|
||||||
@ -8,6 +15,11 @@ use Joomla\CMS\Router\SiteRouter;
|
|||||||
use Joomla\CMS\Uri\Uri;
|
use Joomla\CMS\Uri\Uri;
|
||||||
use Joomla\Event\SubscriberInterface;
|
use Joomla\Event\SubscriberInterface;
|
||||||
|
|
||||||
|
// phpcs:disable PSR1.Files.SideEffects
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
// phpcs:enable PSR1.Files.SideEffects
|
||||||
|
|
||||||
class Plugin extends CMSPlugin implements SubscriberInterface
|
class Plugin extends CMSPlugin implements SubscriberInterface
|
||||||
{
|
{
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
@ -15,12 +27,17 @@ class Plugin extends CMSPlugin implements SubscriberInterface
|
|||||||
return ['onAfterInitialise' => 'attachOauthRouter'];
|
return ['onAfterInitialise' => 'attachOauthRouter'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
* @since version
|
||||||
|
*/
|
||||||
public function attachOauthRouter(): void
|
public function attachOauthRouter(): void
|
||||||
{
|
{
|
||||||
/** @var \Joomla\CMS\Application\SiteApplication $app */
|
/** @var \Joomla\CMS\Application\SiteApplication $app */
|
||||||
$app = $this->getApplication();
|
$app = $this->getApplication();
|
||||||
|
|
||||||
if (!$app->isClient('site')) {
|
if (!$app->isClient('site'))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +49,7 @@ class Plugin extends CMSPlugin implements SubscriberInterface
|
|||||||
/**
|
/**
|
||||||
* @param \Joomla\CMS\Router\SiteRouter $router
|
* @param \Joomla\CMS\Router\SiteRouter $router
|
||||||
* @param \Joomla\CMS\Uri\Uri $uri
|
* @param \Joomla\CMS\Uri\Uri $uri
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @since version
|
* @since version
|
||||||
*/
|
*/
|
||||||
@ -39,14 +57,13 @@ class Plugin extends CMSPlugin implements SubscriberInterface
|
|||||||
{
|
{
|
||||||
$route = trim($uri->getPath(), '/');
|
$route = trim($uri->getPath(), '/');
|
||||||
|
|
||||||
if (empty($route)) {
|
if (empty($route))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Переделать на ComponentRouter (пример в Joomla\CMS\Router\SiteRouter::parseSefRoute())
|
if (!str_starts_with($route, 'login/oauth'))
|
||||||
// 1. Зарегистрировать роутер компонента $router->setComponentRouter()
|
{
|
||||||
// 2. Вызвать $router->getComponentRouter($component)
|
|
||||||
if (!str_starts_with($route, 'login/oauth')) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user