This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -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__' );
}
}

View File

@ -0,0 +1,39 @@
<?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;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['action'] ) && \is_string( $_GET['action'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only strictly comparing.
$get_action = \wp_unslash( $_GET['action'] );
if ( $pagenow === 'post.php' && $get_action === 'elementor' ) {
return true;
}
}
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: We are not processing form information.
if ( isset( $_POST['action'] ) && \is_string( $_POST['action'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only strictly comparing.
$post_action = \wp_unslash( $_POST['action'] );
return \wp_doing_ajax() && $post_action === 'wpseo_elementor_save';
}
return false;
}
}

View 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 Jetpack_Boost exists.
*/
class Jetpack_Boost_Active_Conditional implements Conditional {
/**
* Returns `true` when the Jetpack_Boost class exists within this WordPress installation.
*
* @return bool `true` when the Jetpack_Boost class exists within this WordPress installation.
*/
public function is_met() {
return \class_exists( '\Automattic\Jetpack_Boost\Jetpack_Boost', false );
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Automattic\Jetpack_Boost\Lib\Premium_Features;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when Jetpack Boost is not installed, activated or premium.
*/
class Jetpack_Boost_Not_Premium_Conditional implements Conditional {
/**
* Whether Jetpack Boost is not premium.
*
* @return bool Whether Jetpack Boost is not premium.
*/
public function is_met() {
return ! $this->is_premium();
}
/**
* Retrieves, if available, if Jetpack Boost has priority feature available.
*
* @return bool Whether Jetpack Boost is premium.
*/
private function is_premium() {
if ( \class_exists( '\Automattic\Jetpack_Boost\Lib\Premium_Features', false ) ) {
return Premium_Features::has_feature(
Premium_Features::PRIORITY_SUPPORT
);
}
return false;
}
}

View 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 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' );
}
}

View 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 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' );
}
}

View File

@ -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' );
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
use Yoast\WP\SEO\Helpers\Wordproof_Helper;
/**
* Conditional that is met when the WordProof integration is toggled on.
*/
class Wordproof_Integration_Active_Conditional implements Conditional {
/**
* The WordProof helper.
*
* @var Wordproof_Helper
*/
private $wordproof;
/**
* WordProof integration active constructor.
*
* @param Wordproof_Helper $wordproof The options helper.
*/
public function __construct( Wordproof_Helper $wordproof ) {
$this->wordproof = $wordproof;
}
/**
* Returns whether or not the WordProof Timestamp plugin is active.
*
* @return bool Whether or not the WordProof Timestamp plugin is active.
*/
public function is_met() {
return $this->wordproof->integration_is_active();
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals\Third_Party;
use Yoast\WP\SEO\Conditionals\Conditional;
/**
* Conditional that is met when the WordProof Timestamp plugin is inactive.
*/
class Wordproof_Plugin_Inactive_Conditional implements Conditional {
/**
* Returns whether or not the WordProof Timestamp plugin is active.
*
* @return bool Whether or not the WordProof Timestamp plugin is active.
*/
public function is_met() {
return ! \defined( 'WORDPROOF_VERSION' );
}
}

View 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 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' );
}
}

View 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
*/
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 );
}
}