@return void|never
*/
public function setContext( $type, $fileName = 'sitemap', $indexName = 'root', $pageNumber = 0 ) {
$indexesEnabled = aioseo()->options->sitemap->{$type}->indexes;
aioseo()->sitemap->type = $type;
aioseo()->sitemap->filename = $fileName;
aioseo()->sitemap->indexes = $indexesEnabled;
aioseo()->sitemap->indexName = $indexName;
aioseo()->sitemap->linksPerIndex = aioseo()->options->sitemap->{$type}->linksPerIndex <= 50000 ? aioseo()->options->sitemap->{$type}->linksPerIndex : 50000;
aioseo()->sitemap->pageNumber = $pageNumber >= 1 ? $pageNumber - 1 : 0;
aioseo()->sitemap->offset = aioseo()->sitemap->linksPerIndex * aioseo()->sitemap->pageNumber;
aioseo()->sitemap->isStatic = false;
}
/**
* Redirects or alters the current request if:
* 1. The request includes our deprecated "aiosp_sitemap_path" URL param.
* 2. The request is for one of our sitemaps, but has a trailing slash.
* 3. The request is for the first index of a type, but has a page number.
* 4. The request is for a sitemap from WordPress Core/other plugin.
*
* @since 4.2.1
*/
protected function maybeRedirect() {
if ( $this->checkedForRedirects ) {
return;
}
$this->checkedForRedirects = true;
// The request includes our deprecated "aiosp_sitemap_path" URL param.
if ( preg_match( '/^\/\?aiosp_sitemap_path=root/i', $_SERVER['REQUEST_URI'] ) ) {
wp_safe_redirect( home_url( 'sitemap.xml' ) );
exit;
}
// The request is for one of our sitemaps, but has a trailing slash.
if ( preg_match( '/\/(.*sitemap[0-9]*?\.xml(\.gz)?|.*sitemap(\.latest)?\.rss)\/$/i', $_SERVER['REQUEST_URI'] ) ) {
wp_safe_redirect( home_url() . untrailingslashit( $_SERVER['REQUEST_URI'] ) );
exit;
}
// The request is for the first index of a type, but has a page number.
if ( preg_match( '/.*sitemap(0|1){1}?\.xml(\.gz)?$/i', $_SERVER['REQUEST_URI'] ) ) {
$pathWithoutNumber = preg_replace( '/(.*sitemap)(0|1){1}?(\.xml(\.gz)?)$/i', '$1$3', $_SERVER['REQUEST_URI'] );
wp_safe_redirect( home_url() . $pathWithoutNumber );
exit;
}
// The request is for a sitemap from WordPress Core/other plugin, but the general sitemap is enabled.
if ( ! aioseo()->options->sitemap->general->enable ) {
return;
}
$sitemapPatterns = [
'general' => [
'sitemap\.txt',
'sitemaps\.xml',
'sitemap-xml\.xml',
'sitemap[0-9]+\.xml',
'sitemap(|[-_\/])?index[0-9]*\.xml',
'wp-sitemap\.xml',
],
'rss' => [
'rss[0-9]*\.xml',
]
];
$addonSitemapPatterns = aioseo()->addons->doAddonFunction( 'helpers', 'getOtherSitemapPatterns' );
if ( ! empty( $addonSitemapPatterns ) ) {
$sitemapPatterns = array_merge( $sitemapPatterns, $addonSitemapPatterns );
}
foreach ( $sitemapPatterns as $type => $patterns ) {
foreach ( $patterns as $pattern ) {
if ( preg_match( "/^$pattern$/i", $this->slug ) ) {
wp_safe_redirect( aioseo()->sitemap->helpers->getUrl( $type ) );
exit;
}
}
}
}
}
Fatal error: Uncaught Error: Class "AIOSEO\Plugin\Common\Sitemap\RequestParser" not found in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Pro/Sitemap/RequestParser.php:16
Stack trace:
#0 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/vendor/composer/ClassLoader.php(576): include()
#1 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/home/valigeria...')
#2 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Pro/Sitemap/Sitemap.php(36): Composer\Autoload\ClassLoader->loadClass('AIOSEO\\Plugin\\P...')
#3 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(311): AIOSEO\Plugin\Pro\Sitemap\Sitemap->__construct()
#4 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(97): AIOSEO\Plugin\AIOSEO->load()
#5 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(76): AIOSEO\Plugin\AIOSEO->init()
#6 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/AIOSEO.php(414): AIOSEO\Plugin\AIOSEO::instance()
#7 /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/all_in_one_seo_pack.php(96): aioseo()
#8 /home/valigeria/public_html/wp-settings.php(517): include_once('/home/valigeria...')
#9 /home/valigeria/public_html/wp-config.php(111): require_once('/home/valigeria...')
#10 /home/valigeria/public_html/wp-load.php(50): require_once('/home/valigeria...')
#11 /home/valigeria/public_html/wp-blog-header.php(13): require_once('/home/valigeria...')
#12 /home/valigeria/public_html/index.php(17): require('/home/valigeria...')
#13 {main}
thrown in /home/valigeria/public_html/wp-content/plugins/all-in-one-seo-pack-pro/app/Pro/Sitemap/RequestParser.php on line 16