rebase on oct-10-2023
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php // phpcs:ignore Yoast.Files.FileName.InvalidClassFileName -- Reason: this explicitly concerns the Yoast admin.
|
||||
|
||||
namespace Yoast\WP\SEO\Conditionals\Admin;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
|
||||
|
||||
/**
|
||||
* Conditional that is only met when on a Yoast SEO admin page.
|
||||
*/
|
||||
class Yoast_Admin_Conditional implements Conditional {
|
||||
|
||||
/**
|
||||
* Holds the Current_Page_Helper.
|
||||
*
|
||||
* @var Current_Page_Helper
|
||||
*/
|
||||
private $current_page_helper;
|
||||
|
||||
/**
|
||||
* Constructs the conditional.
|
||||
*
|
||||
* @param \Yoast\WP\SEO\Helpers\Current_Page_Helper $current_page_helper The current page helper.
|
||||
*/
|
||||
public function __construct( Current_Page_Helper $current_page_helper ) {
|
||||
$this->current_page_helper = $current_page_helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` when on the admin dashboard, update or Yoast SEO pages.
|
||||
*
|
||||
* @return bool `true` when on the admin dashboard, update or Yoast SEO pages.
|
||||
*/
|
||||
public function is_met() {
|
||||
if ( ! \is_admin() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->current_page_helper->is_yoast_seo_page();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Conditionals;
|
||||
|
||||
/**
|
||||
* Conditional that is only met when on deactivating Yoast SEO.
|
||||
*/
|
||||
class Deactivating_Yoast_Seo_Conditional implements Conditional {
|
||||
|
||||
/**
|
||||
* Returns whether this conditional is met.
|
||||
*
|
||||
* @return bool Whether the conditional is met.
|
||||
*/
|
||||
public function is_met() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification -- We can't verify nonce since this might run from any user.
|
||||
if ( isset( $_GET['action'] ) && \sanitize_text_field( \wp_unslash( $_GET['action'] ) ) === 'deactivate' && isset( $_GET['plugin'] ) && \sanitize_text_field( \wp_unslash( $_GET['plugin'] === 'wordpress-seo/wp-seo.php' ) ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ class Primary_Category_Conditional implements Conditional {
|
||||
if ( ! \is_admin() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter: Adds the possibility to use primary category at additional admin pages.
|
||||
*
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Yoast\WP\SEO\Conditionals\Third_Party;
|
||||
|
||||
use Automattic\Jetpack_Boost\Lib\Premium_Features;
|
||||
use Yoast\WP\SEO\Conditionals\Conditional;
|
||||
|
||||
/**
|
||||
@@ -25,8 +26,8 @@ class Jetpack_Boost_Not_Premium_Conditional implements Conditional {
|
||||
*/
|
||||
private function is_premium() {
|
||||
if ( \class_exists( '\Automattic\Jetpack_Boost\Lib\Premium_Features', false ) ) {
|
||||
return \Automattic\Jetpack_Boost\Lib\Premium_Features::has_feature(
|
||||
\Automattic\Jetpack_Boost\Lib\Premium_Features::PRIORITY_SUPPORT
|
||||
return Premium_Features::has_feature(
|
||||
Premium_Features::PRIORITY_SUPPORT
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php // phpcs:ignore Yoast.Files.FileName.InvalidClassFileName -- Reason: this explicitly concerns the Yoast tools page.
|
||||
|
||||
namespace Yoast\WP\SEO\Conditionals;
|
||||
|
||||
/**
|
||||
* Conditional that is only met when current page is the tools page.
|
||||
*/
|
||||
class User_Profile_Conditional implements Conditional {
|
||||
|
||||
/**
|
||||
* Returns whether or not this conditional is met.
|
||||
*
|
||||
* @return bool Whether or not the conditional is met.
|
||||
*/
|
||||
public function is_met() {
|
||||
global $pagenow;
|
||||
|
||||
if ( $pagenow !== 'profile.php' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Conditionals;
|
||||
|
||||
/**
|
||||
* Class that checks if WP_CRON is enabled.
|
||||
*/
|
||||
class WP_CRON_Enabled_Conditional implements Conditional {
|
||||
|
||||
/**
|
||||
* Checks if WP_CRON is enabled.
|
||||
*
|
||||
* @return bool True when WP_CRON is enabled.
|
||||
*/
|
||||
public function is_met() {
|
||||
return ! ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON );
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,3 @@ class XMLRPC_Conditional implements Conditional {
|
||||
return ( \defined( 'XMLRPC_REQUEST' ) && \XMLRPC_REQUEST );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user