This commit is contained in:
2026-03-11 15:57:27 +01:00
parent 481271c972
commit b4b460fd21
10775 changed files with 2071579 additions and 26409 deletions

View File

@@ -0,0 +1,125 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use GRIM_SG\Settings;
use GRIM_SG\Sitemap;
use GRIM_SG\GoogleNews;
use GRIM_SG\ImageSitemap;
use GRIM_SG\VideoSitemap;
$template = $args['template'] ?? 'sitemap';
$title = Sitemap::get_sitemap_title( $template );
$settings_obj = new Settings();
$settings = get_option( Sitemap::$slug, $settings_obj );
$hide_branding = $settings->hide_branding ?? true;
$sitemap_colors = apply_filters( 'sgg_sitemap_colors', $settings_obj->colors );
if ( sgg_pro_enabled() && ! empty( $settings->colors ) ) {
$sitemap_colors = $settings->colors;
}
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<xsl:stylesheet version="1.1"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo esc_html( $title ); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="robots" content="index,follow"/>
<style type="text/css">
body { font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 14px; margin: 0; text-align: center; }
a { text-decoration: none; color: <?php echo esc_attr( $sitemap_colors['sitemap_link_color'] ?? '#2d89c7' ); ?>; }
a:hover { border-bottom: 1px solid; }
.header { background-color: <?php echo esc_attr( $sitemap_colors['header_background_color'] ?? '#82a745' ); ?>; color: <?php echo esc_attr( $sitemap_colors['header_text_color'] ?? '#fff' ); ?>; padding: 30px 30px 20px; }
.header h1 { margin: 0; }
.header a, .footer a { border-bottom: 1px solid; color: inherit; }
.header a:hover, .footer a:hover { border-bottom: none; }
.footer { color: <?php echo esc_attr( $sitemap_colors['footer_text_color'] ?? '#666' ); ?>; font-size: 12px; margin-bottom: 30px; }
.top-content { margin: 10px auto -12px; }
.top-content a:hover { border-bottom: none; }
table { max-width: 1024px; margin: 20px auto; font-size: 12px; color: <?php echo esc_attr( $sitemap_colors['sitemap_text_color'] ?? '#444' ); ?>; }
table tr:first-child { background-color: #fff !important; }
table tr:nth-child(odd) { background-color: <?php echo esc_attr( $sitemap_colors['sitemap_background_color'] ?? '#ecf4db' ); ?>; }
table tr th, table tr td { padding: 10px 15px; text-align: left; }
table tr th { border-bottom: 1px solid #ccc; }
img { max-height: 100px; max-width: 100px; }
.image + .image { margin-top: 5px; }
.loc-item + .loc-item { margin-top: 5px; }
</style>
</head>
<body>
<div class="header">
<h1><?php echo esc_html( $title ); ?></h1>
<?php if ( ! sgg_pro_enabled() || ! $hide_branding ) : ?>
<?php if ( $template === GoogleNews::$template ) : ?>
<p>
<a href="https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap" target="_blank">Google News Sitemap</a> is generated by
<a href="https://wordpress.org/plugins/xml-sitemap-generator-for-google/">Google XML Sitemaps Generator Plugin</a>
</p>
<p>Note that <strong>only posts from the last 48 hours</strong> will be processed by <a href="https://news.google.com" target="_blank">Google News</a>.</p>
<?php elseif ( $template === ImageSitemap::$template ) : ?>
<p>
<a href="https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps" target="_blank">Image Sitemap</a> is generated by
<a href="https://wordpress.org/plugins/xml-sitemap-generator-for-google/">Google XML Sitemaps Generator Plugin</a>
</p>
<?php elseif ( $template === VideoSitemap::$template ) : ?>
<p>
<a href="https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps" target="_blank">Video Sitemap</a> is generated by
<a href="https://wordpress.org/plugins/xml-sitemap-generator-for-google/">Google XML Sitemaps Generator Plugin</a>
</p>
<?php else : ?>
<p>XML Sitemap is generated by <a href="https://wordpress.org/plugins/xml-sitemap-generator-for-google/">Google XML Sitemaps Generator Plugin</a></p>
<p>You can get more information on <a href="https://wordpress.org/plugins/xml-sitemap-generator-for-google/">Plugin page</a>.</p>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="top-content">
<?php
$is_media_sitemap = in_array( $template, array( ImageSitemap::$template, VideoSitemap::$template ), true );
if ( ( ! empty( $settings->sitemap_view ) && $is_media_sitemap ) || 'inner-sitemap' === $template ) {
$sitemap_type = isset( $args['is_xml'] ) && ! $args['is_xml'] ? 'html' : 'xml';
$sitemap_url = 'xml' === $sitemap_type ? $settings->sitemap_url : $settings->html_sitemap_url;
if ( $is_media_sitemap ) {
$sitemap_structure = get_option( "sgg_{$template}_structure" );
if ( 'multiple' === $sitemap_structure ) {
$sitemap_url = $template === ImageSitemap::$template ? $settings->image_sitemap_url : $settings->video_sitemap_url;
}
}
printf(
/* translators: Sitemap Index URL */
wp_kses_post( __( '<a href="%s">&#8592; Sitemap Index</a>', 'xml-sitemap-generator-for-google' ) ),
esc_url( sgg_get_sitemap_url( $sitemap_url, "sitemap_{$sitemap_type}" ) )
);
}
?>
</div>
<?php
Sitemap::get_sitemap_table(
$template,
array(
'settings' => $settings,
)
);
?>
<?php if ( ! sgg_pro_enabled() || ! $hide_branding ) : ?>
<div class="footer">Generated by <a href="https://wpgrim.com/">WP Grim</a> -
<a href="https://wordpress.org/plugins/xml-sitemap-generator-for-google/">Google XML Sitemaps Generator Plugin</a>
</div>
<?php endif; ?>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,52 @@
<table>
<tr>
<th>#</th>
<th>Title</th>
<th>Language</th>
<th>Keywords</th>
<th>Stocks</th>
<th>Publication Date</th>
</tr>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:for-each select="./sitemap:urlset/sitemap:url">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<td>
<xsl:value-of select="position()"/>
</td>
<td>
<xsl:variable name="url">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$url}">
<xsl:if test="news:news">
<xsl:value-of select="news:news/news:title"/>
</xsl:if>
<xsl:if test="not(news:news)">
<xsl:value-of select="sitemap:loc"/>
</xsl:if>
</a>
</td>
<td>
<xsl:value-of select="news:news/news:publication/news:language"/>
</td>
<td>
<xsl:value-of select="news:news/news:keywords"/>
</td>
<td>
<xsl:value-of select="news:news/news:stock_tickers"/>
</td>
<td>
<xsl:if test="news:news">
<xsl:value-of select="concat(substring(news:news/news:publication_date, 0, 11), concat(' ', substring(news:news/news:publication_date, 12, 5)))"/>
</xsl:if>
<xsl:if test="sitemap:lastmod">
<xsl:value-of select="concat(substring(sitemap:lastmod, 0, 11), concat(' ', substring(sitemap:lastmod, 12, 5)))"/>
</xsl:if>
</td>
</tr>
</xsl:for-each>
</table>

View File

@@ -0,0 +1,61 @@
<?php
/**
* @var $args array
*/
$settings = $args['settings'] ?? new stdClass();
?>
<table>
<tr>
<th>#</th>
<th>Page, Post, Custom Post URL</th>
<th>Image URLs</th>
<?php if ( ! ( $settings->hide_image_previews ?? false ) ) : ?>
<th>Images</th>
<?php endif; ?>
</tr>
<xsl:for-each select="./sitemap:urlset/sitemap:url">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<td>
<xsl:value-of select="position()"/>
</td>
<td>
<xsl:variable name="url">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$url}" target="_blank">
<xsl:value-of select="sitemap:loc"/>
</a>
</td>
<td>
<xsl:for-each select="image:image">
<xsl:variable name='imageURL'>
<xsl:value-of select='image:loc'/>
</xsl:variable>
<div>
<a href='{$imageURL}'>
<xsl:value-of select='image:loc'/>
</a>
</div>
</xsl:for-each>
</td>
<?php if ( ! ( $settings->hide_image_previews ?? false ) ) : ?>
<td>
<xsl:for-each select="image:image">
<xsl:variable name='imageURL'>
<xsl:value-of select='image:loc'/>
</xsl:variable>
<div class="image">
<a href='{$imageURL}' class="thumbnail">
<img src='{$imageURL}'/>
</a>
</div>
</xsl:for-each>
</td>
<?php endif; ?>
</tr>
</xsl:for-each>
</table>

View File

@@ -0,0 +1,26 @@
<table>
<tr>
<th>Sitemap</th>
<th>Last Modified</th>
</tr>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:for-each select="./sitemap:sitemapindex/sitemap:sitemap">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<td>
<xsl:variable name="page">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$page}">
<xsl:value-of select="sitemap:loc"/>
</a>
</td>
<td>
<xsl:value-of select="concat(substring(sitemap:lastmod, 0, 11), concat(' ', substring(sitemap:lastmod, 12, 5)))"/>
</td>
</tr>
</xsl:for-each>
</table>

View File

@@ -0,0 +1,34 @@
<table>
<tr>
<th>Page URL</th>
<th>Priority</th>
<th>Frequency</th>
<th>Last Modified</th>
</tr>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:for-each select="./sitemap:urlset/sitemap:url">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<td>
<xsl:variable name="page">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a target="_blank" href="{$page}">
<xsl:value-of select="sitemap:loc"/>
</a>
</td>
<td>
<xsl:value-of select="sitemap:priority"/>
</td>
<td>
<xsl:value-of select="sitemap:changefreq"/>
</td>
<td>
<xsl:value-of select="concat(substring(sitemap:lastmod, 0, 11), concat(' ', substring(sitemap:lastmod, 12, 5)))"/>
</td>
</tr>
</xsl:for-each>
</table>

View File

@@ -0,0 +1,66 @@
<table>
<tr>
<th>#</th>
<th>Page, Post, Custom Post URL</th>
<th>Thumbnail</th>
<th>Video</th>
<th>Description</th>
<th>Duration</th>
</tr>
<xsl:for-each select="./sitemap:urlset/sitemap:url">
<tr>
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">high</xsl:attribute>
</xsl:if>
<td>
<xsl:value-of select="position()"/>
</td>
<td>
<xsl:variable name="url">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$url}" target="_blank">
<xsl:value-of select="sitemap:loc"/>
</a>
</td>
<td>
<xsl:for-each select="video:video">
<xsl:variable name='thumbURL'>
<xsl:value-of select='video:thumbnail_loc'/>
</xsl:variable>
<div class="loc-item">
<a href='{$thumbURL}' class="thumbnail">
<img src='{$thumbURL}'/>
</a>
</div>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="video:video">
<xsl:variable name='videoURL'>
<xsl:value-of select='video:player_loc'/>
</xsl:variable>
<div class="loc-item">
<a href='{$videoURL}'>
<xsl:value-of select='video:title'/>
</a>
</div>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="video:video">
<div class="loc-item">
<xsl:value-of select='video:description'/>
</div>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="video:video">
<div class="loc-item">
<xsl:value-of select='video:duration'/>
</div>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>