13.6.00 siteMap v5
This commit is contained in:
parent
08d48bf5d9
commit
41e82aec22
@ -8,6 +8,7 @@ class autoload {
|
||||
require_once 'core/class/template.class.php';
|
||||
require_once 'core/class/layout.class.php';
|
||||
require_once 'core/class/sitemap/IConfig.class.php';
|
||||
require_once 'core/class/sitemap/Config.class.php';
|
||||
require_once 'core/class/sitemap/IRuntime.class.php';
|
||||
require_once 'core/class/sitemap/Runtime.class.php';
|
||||
require_once 'core/class/sitemap/IFileSystem.class.php';
|
||||
|
115
core/class/sitemap/Config.php
Normal file
115
core/class/sitemap/Config.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace Icamys\SitemapGenerator;
|
||||
|
||||
class Config implements IConfig
|
||||
{
|
||||
/**
|
||||
* @var string URL of the website.
|
||||
* It is used as a prefix to the paths added to sitemap using addURL() method.
|
||||
*/
|
||||
private string $baseURL = "";
|
||||
|
||||
/**
|
||||
* @var string URL of the sitemap file.
|
||||
*/
|
||||
private string $sitemapIndexURL = "";
|
||||
|
||||
/**
|
||||
* @var string Path to the directory where the sitemap and robots files will be saved.
|
||||
*/
|
||||
private string $saveDirectory = "";
|
||||
|
||||
private IFileSystem|null $fs;
|
||||
|
||||
private IRuntime|null $runtime;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->fs = null;
|
||||
$this->runtime = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseURL(): string
|
||||
{
|
||||
return $this->baseURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseURL
|
||||
* @return Config
|
||||
*/
|
||||
public function setBaseURL(string $baseURL): Config
|
||||
{
|
||||
$this->baseURL = $baseURL;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSaveDirectory(): string
|
||||
{
|
||||
return $this->saveDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $saveDirectory
|
||||
* @return Config
|
||||
*/
|
||||
public function setSaveDirectory(string $saveDirectory): Config
|
||||
{
|
||||
$this->saveDirectory = $saveDirectory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IFileSystem|null
|
||||
*/
|
||||
public function getFS(): IFileSystem|null
|
||||
{
|
||||
return $this->fs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IFileSystem|null $fs
|
||||
* @return Config
|
||||
*/
|
||||
public function setFS(IFileSystem|null $fs): Config
|
||||
{
|
||||
$this->fs = $fs;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IRuntime|null
|
||||
*/
|
||||
public function getRuntime(): IRuntime|null
|
||||
{
|
||||
return $this->runtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IRuntime|null $runtime
|
||||
* @return Config
|
||||
*/
|
||||
public function setRuntime(IRuntime|null $runtime): Config
|
||||
{
|
||||
$this->runtime = $runtime;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSitemapIndexURL(): string
|
||||
{
|
||||
return $this->sitemapIndexURL;
|
||||
}
|
||||
|
||||
public function setSitemapIndexURL(string $sitemapIndexURL): Config
|
||||
{
|
||||
$this->sitemapIndexURL = $sitemapIndexURL;
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -61,7 +61,7 @@ class common
|
||||
* Pour les versions supérieures à 13.4 et inférieure à 14, la branche reste sur v134
|
||||
* La branche v13 est maintenue afin de télécharger un correctif permettant d'installer
|
||||
* les version supérieures.
|
||||
*/
|
||||
*/
|
||||
const ZWII_UPDATE_CHANNEL = 'v13';
|
||||
|
||||
// Valeurs possibles multiple de 10, 10 autorise 9 profils, 100 autorise 99 profils
|
||||
@ -239,20 +239,7 @@ class common
|
||||
|
||||
// Descripteur de données Entrées / Sorties
|
||||
// Liste ici tous les fichiers de données
|
||||
private $dataFiles = [
|
||||
'admin' => '',
|
||||
'blacklist' => '',
|
||||
'config' => '',
|
||||
'core' => '',
|
||||
'font' => '',
|
||||
'module' => '',
|
||||
'locale' => '',
|
||||
'page' => '',
|
||||
'theme' => '',
|
||||
'user' => '',
|
||||
'language' => '',
|
||||
'profil' => '',
|
||||
];
|
||||
private $dataFiles = [];
|
||||
|
||||
public static $fontsWebSafe = [
|
||||
'arial' => [
|
||||
@ -409,11 +396,11 @@ class common
|
||||
: 'fr_FR';
|
||||
} else {
|
||||
// Par défaut la langue définie par défaut à l'installation
|
||||
if ($this->getData(['config','defaultLanguageUI'])) {
|
||||
self::$i18nUI = $this->getData(['config','defaultLanguageUI']);
|
||||
if ($this->getData(['config', 'defaultLanguageUI'])) {
|
||||
self::$i18nUI = $this->getData(['config', 'defaultLanguageUI']);
|
||||
} else {
|
||||
self::$i18nUI = 'fr_FR';
|
||||
$this->setData(['config','defaultLanguageUI', 'fr_FR']);
|
||||
$this->setData(['config', 'defaultLanguageUI', 'fr_FR']);
|
||||
}
|
||||
}
|
||||
// Stocker le cookie de langue pour l'éditeur de texte
|
||||
@ -493,7 +480,6 @@ class common
|
||||
|
||||
// Mise à jour des données core
|
||||
include('core/include/update.inc.php');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -756,7 +742,6 @@ class common
|
||||
$pageId = init::$defaultDataI18n[$langDefault]['locale']['homePageId'];
|
||||
$content = init::$defaultDataI18n[$langDefault]['html'];
|
||||
$this->setPage($pageId, $content, $lang);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -764,7 +749,6 @@ class common
|
||||
$this->setData([$module, init::$defaultData[$module]]);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1077,7 +1061,6 @@ class common
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1132,7 +1115,7 @@ class common
|
||||
*/
|
||||
|
||||
public function updateSitemap()
|
||||
{
|
||||
{
|
||||
// Le drapeau prend true quand au moins une page est trouvée
|
||||
$flag = false;
|
||||
|
||||
@ -1145,8 +1128,20 @@ class common
|
||||
//require_once 'core/vendor/sitemap/SitemapGenerator.php';
|
||||
|
||||
$timezone = $this->getData(['config', 'timezone']);
|
||||
$outputDir = getcwd();
|
||||
$sitemap = new \Icamys\SitemapGenerator\SitemapGenerator(helper::baseurl(false), $outputDir);
|
||||
|
||||
$config = new \Icamys\SitemapGenerator\Config();
|
||||
|
||||
|
||||
// Your site URL.
|
||||
$config->setBaseURL(helper::baseurl(false));
|
||||
// // OPTIONAL. Setting the current working directory to be output directory
|
||||
$config->setSaveDirectory(sys_get_temp_dir());
|
||||
|
||||
|
||||
$sitemap = new \Icamys\SitemapGenerator\SitemapGenerator($config);
|
||||
|
||||
// Create a compressed sitemap
|
||||
$sitemap->enableCompression();
|
||||
|
||||
// will create also compressed (gzipped) sitemap : option buguée
|
||||
// $sitemap->enableCompression();
|
||||
@ -1245,7 +1240,6 @@ class common
|
||||
}
|
||||
|
||||
return (file_exists('sitemap.xml') && file_exists('robots.txt'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1534,4 +1528,4 @@ class common
|
||||
return $this->getData(['user', $userId, 'firstname']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user