🚚 Make sitemap a module

This commit is contained in:
Kazhnuz 2025-07-03 11:01:37 +02:00
parent 4d207bcdd8
commit 944638fa85
18 changed files with 43 additions and 62 deletions

View file

@ -334,6 +334,19 @@ echo Bootstrap::formInputHidden(array(
'disabled' => Text::isEmpty($site->uriFilters('blog'))
));
echo Bootstrap::cardEnd();
echo Bootstrap::cardBegin($L->g('Ping Search Engine'));
echo Bootstrap::formSelect(array(
'name' => 'pingSearchEngine',
'label' => $L->g('Ping Search Engine'),
'options' => array('true' => $L->g('Enabled'), 'false' => $L->g('Disabled')),
'selected' => ($site->pingSearchEngine() ? 'true' : 'false'),
'class' => '',
'tip' => $L->g('notifies-google-when-you-created')
));
echo Bootstrap::cardEnd();
?>
</div>

View file

@ -27,6 +27,7 @@ class Site extends dbJSON
'dateFormat' => 'F j, Y',
'timeFormat' => 'g:i a',
'currentBuild' => 0,
'pingSearchEngine' => false,
'twitter' => '',
'facebook' => '',
'codepen' => '',
@ -181,6 +182,11 @@ class Site extends dbJSON
return $this->getField('markdownParser');
}
public function pingSearchEngine()
{
return $this->getField('pingSearchEngine');
}
public function twitter()
{
return $this->getField('twitter');

View file

@ -0,0 +1,11 @@
{
"plugin-data":
{
"name": "Sitemap",
"description": "This plugin generates a sitemap.xml file, which provides the list of pages on your website, this helps search engines organize and filter content from their website."
},
"sitemap-url": "Sitemap URL",
"notifies-google-when-you-created": "Notifies Google/Bing when you created, modified or deleted content from your site.",
"notifies-bing-when-you-created": "Notifies Google/Bing when you created, modified or deleted content from your site.",
"ping-search-engine": "Ping Search Engines"
}

View file

@ -5,6 +5,7 @@
"description": "Ce plugin génère un fichier sitemap.xml, qui fournit la liste des pages de votre site, ce qui aide les moteurs de recherche à organiser et filtrer le contenu de votre site."
},
"sitemap-url": "URL de votre sitemap.",
"notifies-google-when-you-created": "Notifie à Google lorsque vous avez créé, modifié ou supprimé du contenu sur votre site.",
"notifies-bing-when-you-created": "Notifie Bing lorsque vous avez créé, modifié ou supprimé du contenu sur votre site."
"notifies-google-when-you-created": "Notifie à Google/Bing lorsque vous avez créé, modifié ou supprimé du contenu sur votre site.",
"notifies-bing-when-you-created": "Notifie Google/Bing lorsque vous avez créé, modifié ou supprimé du contenu sur votre site.",
"ping-search-engine": "Ping moteurs de recherche"
}

View file

@ -5,6 +5,6 @@
"description": "This plugin generates a sitemap.xml file, which provides the list of pages on your website, this helps search engines organize and filter content from their website."
},
"sitemap-url": "Sitemap URL",
"notifies-google-when-you-created": "Notifies Google when you created, modified or deleted content from your site.",
"notifies-bing-when-you-created": "Notifies Bing when you created, modified or deleted content from your site."
"notifies-google-when-you-created": "Notifies Google/Bing when you created, modified or deleted content from your site.",
"notifies-bing-when-you-created": "Notifies Google/Bing when you created, modified or deleted content from your site."
}

View file

@ -5,6 +5,6 @@
"description": "Deze plugin genereert het bestand sitemap.xml met daarin de structuur van deze website. Zoekmachines kunnen hiervan gebruikmaken bij het organiseren en filteren van de inhoud."
},
"sitemap-url": "URL sitemap",
"notifies-google-when-you-created": "Stel Google op de hoogte bij het aanmaken, bewerken of verwijderen van inhoud op de website.",
"notifies-bing-when-you-created": "Stel Bing op de hoogte bij het aanmaken, bewerken of verwijderen van inhoud op de website."
"notifies-google-when-you-created": "Stel Google/Bing op de hoogte bij het aanmaken, bewerken of verwijderen van inhoud op de website.",
"notifies-bing-when-you-created": "Stel Google/Bing op de hoogte bij het aanmaken, bewerken of verwijderen van inhoud op de website."
}

View file

@ -2,45 +2,6 @@
class pluginSitemap extends Plugin {
public function init()
{
$this->dbFields = array(
'pingGoogle'=>false,
'pingBing'=>false
);
}
// Method called on the settings of the plugin on the admin area
public function form()
{
global $L;
$html = '<div>';
$html .= '<label>'.$L->get('Sitemap URL').'</label>';
$html .= '<a href="'.Theme::sitemapUrl().'">'.Theme::sitemapUrl().'</a>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>Ping Google</label>';
$html .= '<select name="pingGoogle">';
$html .= '<option value="true" '.($this->getValue('pingGoogle')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('pingGoogle')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '</select>';
$html .= '<span class="tip">'.$L->get('notifies-google-when-you-created').'</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>Ping Bing</label>';
$html .= '<select name="pingBing">';
$html .= '<option value="true" '.($this->getValue('pingBing')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('pingBing')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '</select>';
$html .= '<span class="tip">'.$L->get('notifies-bing-when-you-created').'</span>';
$html .= '</div>';
return $html;
}
private function createXML()
{
global $site;
@ -80,14 +41,13 @@ class pluginSitemap extends Plugin {
private function ping()
{
if ($this->getValue('pingGoogle')) {
$url = 'https://www.google.com/ping?sitemap='.Theme::sitemapUrl();
TCP::http($url, 'GET', true, 3);
}
global $site;
if ($site->pingSearchEngine()) {
$urlGoogle = 'https://www.google.com/ping?sitemap='.Theme::sitemapUrl();
$urlBing = 'https://www.bing.com/ping?sitemap='.Theme::sitemapUrl();
if ($this->getValue('pingBing')) {
$url = 'https://www.bing.com/ping?sitemap='.Theme::sitemapUrl();
TCP::http($url, 'GET', true, 3);
TCP::http($urlGoogle, 'GET', true, 3);
TCP::http($urlBing, 'GET', true, 3);
}
}

View file

@ -1,10 +0,0 @@
{
"plugin-data":
{
"name": "Sitemap",
"description": "This plugin generates a sitemap.xml file, which provides the list of pages on your website, this helps search engines organize and filter content from their website."
},
"sitemap-url": "Sitemap URL",
"notifies-google-when-you-created": "Notifies Google when you created, modified or deleted content from your site.",
"notifies-bing-when-you-created": "Notifies Bing when you created, modified or deleted content from your site."
}