54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
|
|
|
|
namespace Venom\SEO;
|
|
|
|
|
|
use Venom\ArgumentHandler;
|
|
use Venom\Config;
|
|
use Venom\Database\DatabaseHandler;
|
|
|
|
class SeoController
|
|
{
|
|
|
|
private bool $shouldUse;
|
|
private $data = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->shouldUse = Config::getInstance()->getSeoEnabled();
|
|
}
|
|
|
|
public function loadSite()
|
|
{
|
|
if (!$this->shouldUse) {
|
|
return;
|
|
}
|
|
$url = htmlspecialchars(parse_url($_SERVER['REQUEST_URI'])['path']);
|
|
$data = DatabaseHandler::get()->getOne("SELECT * FROM seoData WHERE seo = :url", [
|
|
':url' => $url,
|
|
]);
|
|
$this->data = $data;
|
|
if($this->data != null) {
|
|
parse_str(parse_url($this->data->raw)['query'], $queryItems);
|
|
foreach($queryItems as $key => $item) {
|
|
ArgumentHandler::get()->setItem($key, $item);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function addSite()
|
|
{
|
|
|
|
}
|
|
|
|
public function deleteSite()
|
|
{
|
|
|
|
}
|
|
|
|
public function getData()
|
|
{
|
|
return $this->data;
|
|
}
|
|
} |