Phase 5: Content and SEO - Yoast SEO, Schema.org markup, Open Graph, favicon support, XML sitemap

This commit is contained in:
Hanson.xyz Dev
2025-11-28 17:10:24 -06:00
parent c4f29a3152
commit 91de533da4
1552 changed files with 171432 additions and 7 deletions
@@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the Elementor plugin is installed and activated.
*/
class Elementor_Activated_Conditional implements Conditional {
/**
* Checks if the Elementor plugins is installed and activated.
*
* @return bool `true` when the Elementor plugin is installed and activated.
*/
public function is_met() {
return \defined( 'ELEMENTOR__FILE__' );
}
}
@@ -0,0 +1,69 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when on an Elementor edit page or when the current
* request is an ajax request for saving our post meta data.
*/
class Elementor_Edit_Conditional implements Conditional {
/**
* Returns whether this conditional is met.
*
* @return bool Whether the conditional is met.
*/
public function is_met() {
global $pagenow;
// Editing a post/page in Elementor.
if ( $pagenow === 'post.php' && $this->is_elementor_get_action() ) {
return true;
}
// Request for us saving a post/page in Elementor (submits our form via AJAX).
return \wp_doing_ajax() && $this->is_yoast_save_post_action();
}
/**
* Checks if the current request' GET action is 'elementor'.
*
* @return bool True when the GET action is 'elementor'.
*/
private function is_elementor_get_action(): bool {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( ! isset( $_GET['action'] ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( ! \is_string( $_GET['action'] ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, we are only strictly comparing.
return \wp_unslash( $_GET['action'] ) === 'elementor';
}
/**
* Checks if the current request' POST action is 'wpseo_elementor_save'.
*
* @return bool True when the POST action is 'wpseo_elementor_save'.
*/
private function is_yoast_save_post_action(): bool {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: We are not processing form information.
if ( ! isset( $_POST['action'] ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: We are not processing form information.
if ( ! \is_string( $_POST['action'] ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, we are only strictly comparing.
return \wp_unslash( $_POST['action'] ) === 'wpseo_elementor_save';
}
}
@@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when the Polylang plugin is active.
*/
class Polylang_Conditional implements Conditional {
/**
* Checks whether the Polylang plugin is installed and active.
*
* @return bool Whether Polylang is installed and active.
*/
public function is_met() {
return \defined( 'POLYLANG_FILE' );
}
}
@@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when the SiteKit plugin is active.
*/
class Site_Kit_Conditional implements Conditional {
/**
* Checks whether the SiteKit plugin is active.
*
* @return bool Whether the SiteKit plugin is active.
*/
public function is_met() {
return \defined( 'GOOGLESITEKIT_VERSION' );
}
}
@@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when the TranslatePress plugin is active.
*/
class TranslatePress_Conditional implements Conditional {
/**
* Checks whether the TranslatePress plugin is active.
*
* @return bool Whether the TranslatePress plugin is active.
*/
public function is_met() {
return \class_exists( 'TRP_Translate_Press' );
}
}
@@ -0,0 +1,24 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when in the admin.
*/
class W3_Total_Cache_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
if ( ! \defined( 'W3TC_DIR' ) ) {
return false;
}
return \function_exists( 'w3tc_objectcache_flush' );
}
}
@@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is only met when WPML is active.
*/
class WPML_Conditional implements Conditional {
/**
* Returns whether or not this conditional is met.
*
* @return bool Whether or not the conditional is met.
*/
public function is_met() {
return \defined( 'WPML_PLUGIN_FILE' );
}
}
@@ -0,0 +1,28 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the Yoast SEO Multilingual plugin,
* a glue plugin developed by and for WPML, is active.
*/
class WPML_WPSEO_Conditional implements Conditional {
/**
* Path to the Yoast SEO Multilingual plugin file.
*
* @internal
*/
public const PATH_TO_WPML_WPSEO_PLUGIN_FILE = 'wp-seo-multilingual/plugin.php';
/**
* Returns whether or not the Yoast SEO Multilingual plugin is active.
*
* @return bool Whether or not the Yoast SEO Multilingual plugin is active.
*/
public function is_met() {
return \is_plugin_active( self::PATH_TO_WPML_WPSEO_PLUGIN_FILE );
}
}