| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Admin\Pages; |
| 4 |
|
| 5 |
use SyncBasalam\Admin\Settings\SettingsConfig; |
| 6 |
|
| 7 |
defined('ABSPATH') || exit; |
| 8 |
|
| 9 |
abstract class AdminPageAbstract |
| 10 |
{ |
| 11 |
public $checkToken; |
| 12 |
|
| 13 |
public function render() |
| 14 |
{ |
| 15 |
if ($this->checkToken == true && !$this->checkBasalamAccess()) { |
| 16 |
require_once(syncBasalamPlugin()->templatePath() . "/admin/main/NotConnected.php"); |
| 17 |
return; |
| 18 |
} |
| 19 |
|
| 20 |
$instance = new static(); |
| 21 |
$instance->renderContent(); |
| 22 |
} |
| 23 |
|
| 24 |
public function checkBasalamAccess() |
| 25 |
{ |
| 26 |
$token = syncBasalamSettings()->getSettings(SettingsConfig::TOKEN); |
| 27 |
$refreshToken = syncBasalamSettings()->getSettings(SettingsConfig::REFRESH_TOKEN); |
| 28 |
if ($token && $refreshToken) return true; |
| 29 |
else return false; |
| 30 |
} |
| 31 |
|
| 32 |
abstract protected function renderContent(); |
| 33 |
} |
| 34 |
|