Initial commit xmarticaims

This commit is contained in:
2026-11-02 10:26:32 -06:00
commit e74236f5c1
9764 changed files with 2880647 additions and 0 deletions
@@ -0,0 +1,74 @@
<?php
namespace WP_Rocket\ThirdParty\Plugins\SEO;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Event_Management\Subscriber_Interface;
class AllInOneSEOPack implements Subscriber_Interface {
/**
* Option instance.
*
* @var Options_Data
*/
protected $option;
/**
* Instantiate class.
*
* @param Options_Data $option Option instance.
*/
public function __construct( Options_Data $option ) {
$this->option = $option;
}
/**
* Subscribed events.
*/
public static function get_subscribed_events() {
$aioseo_v3 = defined( 'AIOSEOP_VERSION' );
$aioseo_v4 = defined( 'AIOSEO_VERSION' ) && function_exists( 'aioseo' );
if ( ! $aioseo_v3 && ! $aioseo_v4 ) {
return [];
}
return [
'rocket_sitemap_preload_list' => [ 'add_all_in_one_seo_sitemap', 15 ],
];
}
/**
* Add All in One SEO Sitemap to the preload list
*
* @param Array $sitemaps Array of sitemaps to preload.
* @return Array Updated array of sitemaps to preload
*/
public function add_all_in_one_seo_sitemap( $sitemaps ) {
$aioseo_v3 = defined( 'AIOSEOP_VERSION' );
$aioseo_v4 = defined( 'AIOSEO_VERSION' ) && function_exists( 'aioseo' );
$sitemap_enabled = false;
if ( $aioseo_v3 && ! $aioseo_v4 ) {
$aioseop_options = get_option( 'aioseop_options' );
$sitemap_enabled = ( isset( $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) && 'on' === $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) || ( ! isset( $aioseop_options['modules']['aiosp_feature_manager_options'] ) && isset( $aioseop_options['modules']['aiosp_sitemap_options'] ) );
}
if (
( ! $aioseo_v4 && ! $sitemap_enabled ) ||
( $aioseo_v4 && ! aioseo()->options->sitemap->general->enable )
) {
return $sitemaps;
}
if ( $aioseo_v3 ) {
$sitemaps[] = trailingslashit( home_url() ) . apply_filters( 'aiosp_sitemap_filename', 'sitemap' ) . '.xml'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
} elseif ( $aioseo_v4 ) {
$sitemaps[] = trailingslashit( home_url() ) . apply_filters( 'aioseo_sitemap_filename', 'sitemap' ) . '.xml'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
}
return $sitemaps;
}
}
@@ -0,0 +1,54 @@
<?php
namespace WP_Rocket\ThirdParty\Plugins\SEO;
use RankMath\Helper;
use RankMath\Sitemap\Router;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Event_Management\Subscriber_Interface;
class RankMathSEO implements Subscriber_Interface {
/**
* Options instance.
*
* @var Options_Data
*/
protected $option;
/**
* Instantiate class.
*
* @param Options_Data $option Options instance.
*/
public function __construct( Options_Data $option ) {
$this->option = $option;
}
/**
* Subscribed events.
*/
public static function get_subscribed_events() {
if ( ! defined( 'RANK_MATH_FILE' ) || ! Helper::is_module_active( 'sitemap' ) ) {
return [];
}
return [
'rocket_sitemap_preload_list' => [ 'rocket_sitemap', 15 ],
];
}
/**
* Add SEO sitemap URL to the sitemaps to preload
*
* @param array $sitemaps Sitemaps to preload.
* @return array Updated Sitemaps to preload
*/
public function rocket_sitemap( $sitemaps ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
$sitemaps[] = Router::get_base_url( 'sitemap_index.xml' );
return $sitemaps;
}
}
@@ -0,0 +1,54 @@
<?php
namespace WP_Rocket\ThirdParty\Plugins\SEO;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Event_Management\Subscriber_Interface;
class SEOPress implements Subscriber_Interface {
/**
* Option instance.
*
* @var Options_Data
*/
protected $option;
/**
* Instantiate class.
*
* @param Options_Data $option Option instance.
*/
public function __construct( Options_Data $option ) {
$this->option = $option;
}
/**
* Subscribed events.
*/
public static function get_subscribed_events() {
if ( ! function_exists( 'seopress_get_toggle_option' ) || 1 !== (int) seopress_get_toggle_option( 'xml-sitemap' ) ) {
return [];
}
if ( ! method_exists( seopress_get_service( 'SitemapOption' ), 'isEnabled' ) || 1 !== (int) seopress_get_service( 'SitemapOption' )->isEnabled() ) {
return [];
}
return [
'rocket_sitemap_preload_list' => [ 'add_seopress_sitemap', 15 ],
];
}
/**
* Add SEOPress sitemap URL to the sitemaps to preload
*
* @param array $sitemaps Sitemaps to preload.
* @return array Updated Sitemaps to preload
*/
public function add_seopress_sitemap( $sitemaps ) {
$sitemaps[] = get_home_url() . '/sitemaps.xml';
return $sitemaps;
}
}
@@ -0,0 +1,86 @@
<?php
namespace WP_Rocket\ThirdParty\Plugins\SEO;
use The_SEO_Framework\Bridges\Sitemap;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Event_Management\Subscriber_Interface;
class TheSEOFramework implements Subscriber_Interface {
/**
* Option instance.
*
* @var Options_Data
*/
protected $option;
/**
* Instantiate the class.
*
* @param Options_Data $option Option instance.
*/
public function __construct( Options_Data $option ) {
$this->option = $option;
}
/**
* Subscribed events.
*/
public static function get_subscribed_events() {
if ( ! function_exists( 'the_seo_framework' ) ) {
return [];
}
$tsf = the_seo_framework();
// Either TSF < 3.1, or the plugin's silenced (soft-disabled) via a drop-in.
if ( empty( $tsf->loaded ) ) {
return [];
}
/**
* 1. Performs option & other checks.
* 2. Checks for conflicting sitemap plugins that might prevent loading.
*
* These methods cache their output at runtime.
*
* @link https://github.com/wp-media/wp-rocket/issues/899
*/
if ( ! $tsf->can_run_sitemap() ) {
return [];
}
return [
'rocket_sitemap_preload_list' => [ 'add_tsf_sitemap_to_preload', 15 ],
];
}
/**
* Adds TSF sitemap URLs to preload.
*
* @param array $sitemaps Sitemaps to preload.
* @return array Updated Sitemaps to preload
*/
public function add_tsf_sitemap_to_preload( $sitemaps ) {
// The autoloader in TSF doesn't check for file_exists(). So, use version compare instead to prevent fatal errors.
if ( version_compare( rocket_get_constant( 'THE_SEO_FRAMEWORK_VERSION', false ), '4.0', '>=' ) ) {
// TSF 4.0+. Expect the class to exist indefinitely.
$sitemap_bridge = Sitemap::get_instance();
foreach ( $sitemap_bridge->get_sitemap_endpoint_list() as $id => $data ) {
// When the sitemap is good enough for a robots display, we determine it as valid for precaching.
// Non-robots display types are among the stylesheet endpoint, or the Yoast SEO-compatible endpoint.
// In other words, this enables support for ALL current and future public sitemap endpoints.
if ( ! empty( $data['robots'] ) ) {
$sitemaps[] = $sitemap_bridge->get_expected_sitemap_endpoint_url( $id );
}
}
} else {
// Deprecated. TSF <4.0.
$sitemaps[] = the_seo_framework()->get_sitemap_xml_url();
}
return $sitemaps;
}
}
@@ -0,0 +1,95 @@
<?php
declare(strict_types=1);
namespace WP_Rocket\ThirdParty\Plugins\SEO;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Event_Management\Subscriber_Interface;
class Yoast implements Subscriber_Interface {
/**
* Options Data instance
*
* @var Options_Data
*/
private $options;
/**
* Constructor
*
* @param Options_Data $options Options_Data instance.
*/
public function __construct( Options_Data $options ) {
$this->options = $options;
}
/**
* Array of events this subscriber listens to
*
* @return array
*/
public static function get_subscribed_events() {
return [
'rocket_sitemap_preload_list' => [ 'add_sitemap', 15 ],
];
}
/**
* Add Yoast SEO sitemap URL to the sitemaps to preload
*
* @since 2.8
*
* @param array $sitemaps An array of sitemaps to preload.
*
* @return array
*/
public function add_sitemap( $sitemaps ): array {
if ( ! is_array( $sitemaps ) ) {
$sitemaps = (array) $sitemaps;
}
if ( ! $this->is_sitemap_enabled() ) {
return $sitemaps;
}
if ( ! class_exists( 'WPSEO_Sitemaps_Router' ) ) {
return $sitemaps;
}
$sitemaps[] = \WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' );
return $sitemaps;
}
/**
* Checks if sitemap is enabled in Yoast SEO
*
* @since 3.11.1
*
* @return bool
*/
private function is_sitemap_enabled(): bool {
static $enabled = null;
if ( ! is_null( $enabled ) ) {
return $enabled;
}
if ( ! rocket_has_constant( 'WPSEO_VERSION' ) ) {
$enabled = false;
return $enabled;
}
$yoast_seo_xml = get_option( 'wpseo_xml', [] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
if ( version_compare( rocket_get_constant( 'WPSEO_VERSION', '' ), '7.0' ) >= 0 ) {
$yoast_seo = get_option( 'wpseo', [] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
$yoast_seo_xml['enablexmlsitemap'] = isset( $yoast_seo['enable_xml_sitemap'] ) && $yoast_seo['enable_xml_sitemap']; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
}
$enabled = (bool) $yoast_seo_xml['enablexmlsitemap'];
return $enabled;
}
}