plugin installs

This commit is contained in:
Tony Volpe
2024-09-25 09:25:31 -04:00
parent 65a07c8d4d
commit cc870f301f
2953 changed files with 514886 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,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';
}
}

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