Skip to content

Commit

Permalink
Updated for Jaxon-PHP 4
Browse files Browse the repository at this point in the history
  • Loading branch information
idmarinas committed Mar 14, 2024
1 parent 532090a commit 83132d1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/ajax/core/Bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
use LotgdTranslator;
use Throwable;
use Tracy\Debugger;
use function Jaxon\jaxon;

class Bans extends AjaxAbstract
{
public function showAffected($ip, $id)
{
global $session;

$response = new Response();
$response = jaxon()->getResponse();

try
{
Expand Down
3 changes: 2 additions & 1 deletion src/ajax/core/Mounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use LotgdTranslator;
use Throwable;
use Tracy\Debugger;
use function Jaxon\jaxon;

class Mounts extends AjaxAbstract
{
Expand All @@ -32,7 +33,7 @@ public function getListOfOwners(int $mountId)
return $check;
}

$response = new Response();
$response = jaxon()->getResponse();

try
{
Expand Down
10 changes: 5 additions & 5 deletions src/core/AjaxAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Lotgd\Core;

use Jaxon\Response\Response;
use function Jaxon\jaxon;

/**
* Use this class to add a basic function to your Jaxon request.
Expand All @@ -24,7 +24,7 @@ abstract class AjaxAbstract
/**
* Return true or empty Jaxon\Response\Response.
*
* @return true|Response
* @return \Jaxon\Response\ResponseInterface|true
*/
protected function checkLoggedIn()
{
Expand All @@ -33,7 +33,7 @@ protected function checkLoggedIn()
//-- Do nothing if there is no active session
if ( ! ($session['user']['loggedin'] ?? false))
{
return new Response();
return jaxon()->getResponse();
}

return true;
Expand All @@ -42,7 +42,7 @@ protected function checkLoggedIn()
/**
* Return true or redirect to home.php page.
*
* @return true|Redirect
* @return \Jaxon\Response\ResponseInterface|true
*/
protected function checkLoggedInRedirect()
{
Expand All @@ -51,7 +51,7 @@ protected function checkLoggedInRedirect()
//-- Do nothing if there is no active session
if ( ! ($session['user']['loggedin'] ?? false))
{
$response = new Response();
$response = jaxon()->getResponse();

return $response->redirect('home.php');
}
Expand Down
10 changes: 4 additions & 6 deletions src/core/Service/Jaxon.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@

namespace Lotgd\Core\Service;

use Jaxon\App\Ajax;
use Jaxon\Jaxon as JaxonCore;
use function Jaxon\jaxon;

class Jaxon extends JaxonCore
class Jaxon extends Ajax
{
public function __construct(array $config)
{
parent::__construct();

$this->di()->getConfig()->setOptions($config);
$this->config()->setOptions($config);

//-- Register all class of Lotgd in dir "src/ajax/core"
$this->register(JaxonCore::CALLABLE_DIR, './src/ajax/core', ['namespace' => 'Lotgd\\Ajax\\Core\\']);

//-- Register all custom class (Available globally) in dir "src/ajax/local"
$this->register(JaxonCore::CALLABLE_DIR, './src/ajax/local', ['namespace' => 'Lotgd\\Ajax\\Local\\']);

$this->plugin('dialog')->registerClasses();
}
}

0 comments on commit 83132d1

Please sign in to comment.