auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -0,0 +1,20 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when the current user has the `edit_users` capability.
*
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
*/
class User_Can_Edit_Users_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 \current_user_can( 'edit_users' );
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Yoast\WP\SEO\Conditionals;
/**
* Conditional that is only met when current page is the Edit User page or the User's profile page.
*/
class User_Edit_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' && $pagenow !== 'user-edit.php' ) {
return false;
}
return true;
}
}

View File

@@ -0,0 +1,55 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\Editors\Application\Analysis_Features;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Features_List;
/**
* The repository to get all enabled features.
*
* @makePublic
*/
class Enabled_Analysis_Features_Repository {
/**
* All plugin features.
*
* @var Analysis_Feature_Interface[]
*/
private $plugin_features;
/**
* The list of analysis features.
*
* @var Analysis_Features_List
*/
private $enabled_analysis_features;
/**
* The constructor.
*
* @param Analysis_Feature_Interface ...$plugin_features All analysis objects.
*/
public function __construct( Analysis_Feature_Interface ...$plugin_features ) {
$this->enabled_analysis_features = new Analysis_Features_List();
$this->plugin_features = $plugin_features;
}
/**
* Returns the analysis list.
*
* @return Analysis_Features_List The analysis list.
*/
public function get_enabled_features(): Analysis_Features_List {
if ( \count( $this->enabled_analysis_features->parse_to_legacy_array() ) === 0 ) {
foreach ( $this->plugin_features as $plugin_feature ) {
$analysis_feature = new Analysis_Feature( $plugin_feature->is_enabled(), $plugin_feature->get_name(), $plugin_feature->get_legacy_key() );
$this->enabled_analysis_features->add_feature( $analysis_feature );
}
}
return $this->enabled_analysis_features;
}
}

View File

@@ -0,0 +1,44 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\Editors\Application\Integrations;
use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
use Yoast\WP\SEO\Editors\Framework\Analysis_Feature_Interface;
/**
* The repository to get all enabled integrations.
*
* @makePublic
*/
class Integration_Information_Repository {
/**
* All plugin integrations.
*
* @var Analysis_Feature_Interface[] $plugin_integrations
*/
private $plugin_integrations;
/**
* The constructor.
*
* @param Integration_Data_Provider_Interface ...$plugin_integrations All integrations.
*/
public function __construct( Integration_Data_Provider_Interface ...$plugin_integrations ) {
$this->plugin_integrations = $plugin_integrations;
}
/**
* Returns the analysis list.
*
* @return array<array<string,bool>> The parsed list.
*/
public function get_integration_information(): array {
$array = [];
foreach ( $this->plugin_integrations as $feature ) {
$array = \array_merge( $array, $feature->to_legacy_array() );
}
return $array;
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Editors\Domain\Analysis_Features;
/**
* This interface describes an Analysis feature implementation.
*/
interface Analysis_Feature_Interface {
/**
* Returns If the analysis is enabled.
*
* @return bool
*/
public function is_enabled(): bool;
/**
* Returns the name of the object.
*
* @return string
*/
public function get_name(): string;
/**
* Returns the legacy key used in the front-end to determine if the feature is enabled.
*
* @return string
*/
public function get_legacy_key(): string;
}

View File

@@ -0,0 +1,79 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Editors\Domain\Analysis_Features;
/**
* This class describes a single Analysis feature and if it is enabled.
*/
class Analysis_Feature {
/**
* If the feature is enabled.
*
* @var bool
*/
private $is_enabled;
/**
* What the identifier of the feature is.
*
* @var string
*/
private $name;
/**
* What the identifier is for the old script data array.
*
* @var string
*/
private $legacy_key;
/**
* The constructor.
*
* @param bool $is_enabled If the feature is enabled.
* @param string $name What the identifier of the feature is.
* @param string $legacy_key What the identifier is for the old script data array.
*/
public function __construct( bool $is_enabled, string $name, string $legacy_key ) {
$this->is_enabled = $is_enabled;
$this->name = $name;
$this->legacy_key = $legacy_key;
}
/**
* If the feature is enabled.
*
* @return bool If the feature is enabled.
*/
public function is_enabled(): bool {
return $this->is_enabled;
}
/**
* Gets the identifier.
*
* @return string The feature identifier.
*/
public function get_name(): string {
return $this->name;
}
/**
* Return this object represented by a key value array.
*
* @return array<string,bool> Returns the name and if the feature is enabled.
*/
public function to_array(): array {
return [ $this->name => $this->is_enabled ];
}
/**
* Returns this object represented by a key value structure that is compliant with the script data array.
*
* @return array<string,bool> Returns the legacy key and if the feature is enabled.
*/
public function to_legacy_array(): array {
return [ $this->legacy_key => $this->is_enabled ];
}
}

View File

@@ -0,0 +1,40 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Editors\Domain\Analysis_Features;
/**
* This class describes a list of analysis features.
*/
class Analysis_Features_List {
/**
* The features.
*
* @var array<Analysis_Feature>
*/
private $features = [];
/**
* Adds an analysis feature to the list.
*
* @param Analysis_Feature $feature The analysis feature to add.
*
* @return void
*/
public function add_feature( Analysis_Feature $feature ): void {
$this->features[] = $feature;
}
/**
* Parses the feature list to a legacy ready array representation.
*
* @return array<string,bool> The list presented as a key value representation.
*/
public function parse_to_legacy_array(): array {
$array = [];
foreach ( $this->features as $feature ) {
$array = \array_merge( $array, $feature->to_legacy_array() );
}
return $array;
}
}

View File

@@ -0,0 +1,31 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
namespace Yoast\WP\SEO\Editors\Domain\Integrations;
/**
* Describes the interface for integration domain objects which can be enabled or not
*/
interface Integration_Data_Provider_Interface {
/**
* If the integration is activated.
*
* @return bool If the integration is activated.
*/
public function is_enabled(): bool;
/**
* Return this object represented by a key value array.
*
* @return array<string,bool> Returns the name and if the feature is enabled.
*/
public function to_array(): array;
/**
* Returns this object represented by a key value structure that is compliant with the script data array.
*
* @return array<string,bool> Returns the legacy key and if the feature is enabled.
*/
public function to_legacy_array(): array;
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Yoast\WP\SEO\Editors\Framework;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Describes if the Cornerstone content features is enabled.
*/
class Cornerstone_Content implements Analysis_Feature_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The constructor.
*
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Options_Helper $options_helper ) {
$this->options_helper = $options_helper;
}
/**
* If cornerstone is enabled.
*
* @return bool If cornerstone is enabled.
*/
public function is_enabled(): bool {
return (bool) $this->options_helper->get( 'enable_cornerstone_content', false );
}
/**
* Gets the name.
*
* @return string The name.
*/
public function get_name(): string {
return 'cornerstoneContent';
}
/**
* Gets the legacy key.
*
* @return string The legacy key.
*/
public function get_legacy_key(): string {
return 'cornerstoneActive';
}
}

View File

@@ -0,0 +1,116 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\Editors\Framework;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
use Yoast\WP\SEO\Helpers\Language_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Helpers\Product_Helper;
/**
* Describes the inclusive language analysis feature.
*/
class Inclusive_Language_Analysis implements Analysis_Feature_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The language helper.
*
* @var Language_Helper
*/
private $language_helper;
/**
* The product helper.
*
* @var Product_Helper
*/
private $product_helper;
/**
* The constructor.
*
* @param Options_Helper $options_helper The options helper.
* @param Language_Helper $language_helper The language helper.
* @param Product_Helper $product_helper The product helper.
*/
public function __construct(
Options_Helper $options_helper,
Language_Helper $language_helper,
Product_Helper $product_helper
) {
$this->options_helper = $options_helper;
$this->language_helper = $language_helper;
$this->product_helper = $product_helper;
}
/**
* If this analysis is enabled.
*
* @return bool If this analysis is enabled.
*/
public function is_enabled(): bool {
return $this->is_globally_enabled() && $this->is_user_enabled() && $this->is_current_version_supported()
&& $this->language_helper->has_inclusive_language_support( $this->language_helper->get_language() );
}
/**
* If this analysis is enabled by the user.
*
* @return bool If this analysis is enabled by the user.
*/
private function is_user_enabled(): bool {
return ! \get_user_meta( \get_current_user_id(), 'wpseo_inclusive_language_analysis_disable', true );
}
/**
* If this analysis is enabled globally.
*
* @return bool If this analysis is enabled globally.
*/
private function is_globally_enabled(): bool {
return (bool) $this->options_helper->get( 'inclusive_language_analysis_active', false );
}
/**
* If the inclusive language analysis should be loaded in Free.
*
* It should always be loaded when Premium is not active. If Premium is active, it depends on the version. Some
* Premium versions also have inclusive language code (when it was still a Premium only feature) which would result
* in rendering the analysis twice. In those cases, the analysis should be only loaded from the Premium side.
*
* @return bool If the inclusive language analysis should be loaded.
*/
private function is_current_version_supported(): bool {
$is_premium = $this->product_helper->is_premium();
$premium_version = $this->product_helper->get_premium_version();
return ! $is_premium
|| \version_compare( $premium_version, '19.6-RC0', '>=' )
|| \version_compare( $premium_version, '19.2', '==' );
}
/**
* Gets the name.
*
* @return string The name.
*/
public function get_name(): string {
return 'inclusiveLanguageAnalysis';
}
/**
* Gets the legacy key.
*
* @return string The legacy key.
*/
public function get_legacy_key(): string {
return 'inclusiveLanguageAnalysisActive';
}
}

View File

@@ -0,0 +1,70 @@
<?php
// @phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- This namespace should reflect the namespace of the original class.
namespace Yoast\WP\SEO\Editors\Framework\Integrations;
use Jetpack;
use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
/**
* Describes if the Jetpack markdown integration is enabled.
*/
class Jetpack_Markdown implements Integration_Data_Provider_Interface {
/**
* If the integration is activated.
*
* @return bool If the integration is activated.
*/
public function is_enabled(): bool {
return $this->is_markdown_enabled();
}
/**
* Return this object represented by a key value array.
*
* @return array<string,bool> Returns the name and if the feature is enabled.
*/
public function to_array(): array {
return [
'markdownEnabled' => $this->is_enabled(),
];
}
/**
* Returns this object represented by a key value structure that is compliant with the script data array.
*
* @return array<string,bool> Returns the legacy key and if the feature is enabled.
*/
public function to_legacy_array(): array {
return [
'markdownEnabled' => $this->is_enabled(),
];
}
/**
* Checks if Jetpack's markdown module is enabled.
* Can be extended to work with other plugins that parse markdown in the content.
*
* @return bool
*/
private function is_markdown_enabled() {
$is_markdown = false;
if ( \class_exists( 'Jetpack' ) && \method_exists( 'Jetpack', 'get_active_modules' ) ) {
$active_modules = Jetpack::get_active_modules();
// First at all, check if Jetpack's markdown module is active.
$is_markdown = \in_array( 'markdown', $active_modules, true );
}
/**
* Filters whether markdown support is active in the readability- and seo-analysis.
*
* @since 11.3
*
* @param array $is_markdown Is markdown support for Yoast SEO active.
*/
return \apply_filters( 'wpseo_is_markdown_enabled', $is_markdown );
}
}

View File

@@ -0,0 +1,89 @@
<?php
// @phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- This namespace should reflect the namespace of the original class.
namespace Yoast\WP\SEO\Editors\Framework\Integrations;
use Yoast\WP\SEO\Conditionals\Third_Party\Polylang_Conditional;
use Yoast\WP\SEO\Conditionals\Third_Party\TranslatePress_Conditional;
use Yoast\WP\SEO\Conditionals\Third_Party\WPML_Conditional;
use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
/**
* Describes if the Multilingual integration is enabled.
*/
class Multilingual implements Integration_Data_Provider_Interface {
/**
* The WPML conditional.
*
* @var WPML_Conditional $wpml_conditional
*/
private $wpml_conditional;
/**
* The Polylang conditional.
*
* @var Polylang_Conditional $polylang_conditional
*/
private $polylang_conditional;
/**
* The TranslatePress conditional.
*
* @var TranslatePress_Conditional $translate_press_conditional
*/
private $translate_press_conditional;
/**
* The constructor.
*
* @param WPML_Conditional $wpml_conditional The wpml conditional.
* @param Polylang_Conditional $polylang_conditional The polylang conditional.
* @param TranslatePress_Conditional $translate_press_conditional The translate press conditional.
*/
public function __construct( WPML_Conditional $wpml_conditional, Polylang_Conditional $polylang_conditional, TranslatePress_Conditional $translate_press_conditional ) {
$this->wpml_conditional = $wpml_conditional;
$this->polylang_conditional = $polylang_conditional;
$this->translate_press_conditional = $translate_press_conditional;
}
/**
* If the integration is activated.
*
* @return bool If the integration is activated.
*/
public function is_enabled(): bool {
return $this->multilingual_plugin_active();
}
/**
* Return this object represented by a key value array.
*
* @return array<string,bool> Returns the name and if the feature is enabled.
*/
public function to_array(): array {
return [ 'multilingualPluginActive' => $this->is_enabled() ];
}
/**
* Returns this object represented by a key value structure that is compliant with the script data array.
*
* @return array<string,bool> Returns the legacy key and if the feature is enabled.
*/
public function to_legacy_array(): array {
return [ 'multilingualPluginActive' => $this->is_enabled() ];
}
/**
* Checks whether a multilingual plugin is currently active. Currently, we only check the following plugins:
* WPML, Polylang, and TranslatePress.
*
* @return bool Whether a multilingual plugin is currently active.
*/
private function multilingual_plugin_active() {
$wpml_active = $this->wpml_conditional->is_met();
$polylang_active = $this->polylang_conditional->is_met();
$translatepress_active = $this->translate_press_conditional->is_met();
return ( $wpml_active || $polylang_active || $translatepress_active );
}
}

View File

@@ -0,0 +1,90 @@
<?php
// @phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- This namespace should reflect the namespace of the original class.
namespace Yoast\WP\SEO\Editors\Framework\Integrations;
use Yoast\WP\SEO\Config\SEMrush_Client;
use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
use Yoast\WP\SEO\Exceptions\OAuth\Authentication_Failed_Exception;
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Property_Exception;
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Token_Exception;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Describes if the Semrush integration is enabled.
*/
class Semrush implements Integration_Data_Provider_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The constructor.
*
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Options_Helper $options_helper ) {
$this->options_helper = $options_helper;
}
/**
* If the integration is activated.
*
* @return bool If the integration is activated.
*/
public function is_enabled(): bool {
return (bool) $this->options_helper->get( 'semrush_integration_active', true );
}
/**
* Return this object represented by a key value array.
*
* @return array<string,bool> Returns the name and if the feature is enabled.
*/
public function to_array(): array {
return [
'active' => $this->is_enabled(),
'countryCode' => $this->options_helper->get( 'semrush_country_code', false ),
'loginStatus' => $this->options_helper->get( 'semrush_integration_active', true ) && $this->get_semrush_login_status(),
];
}
/**
* Returns this object represented by a key value structure that is compliant with the script data array.
*
* @return array<string,bool> Returns the legacy key and if the feature is enabled.
*/
public function to_legacy_array(): array {
return [
'semrushIntegrationActive' => $this->is_enabled(),
'countryCode' => $this->options_helper->get( 'semrush_country_code', false ),
'SEMrushLoginStatus' => $this->options_helper->get( 'semrush_integration_active', true ) && $this->get_semrush_login_status(),
];
}
/**
* Checks if the user is logged in to SEMrush.
*
* @return bool The SEMrush login status.
*/
private function get_semrush_login_status() {
try {
// Do this just in time to handle constructor exception.
$semrush_client = \YoastSEO()->classes->get( SEMrush_Client::class );
} catch ( Empty_Property_Exception $e ) {
// Return false if token is malformed (empty property).
return false;
}
// Get token (and refresh it if it's expired).
try {
$semrush_client->get_tokens();
} catch ( Authentication_Failed_Exception | Empty_Token_Exception $e ) {
return false;
}
return $semrush_client->has_valid_tokens();
}
}

View File

@@ -0,0 +1,75 @@
<?php
// @phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- This namespace should reflect the namespace of the original class.
namespace Yoast\WP\SEO\Editors\Framework\Integrations;
use Yoast\WP\SEO\Editors\Domain\Integrations\Integration_Data_Provider_Interface;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Helpers\Wincher_Helper;
/**
* Describes if the Wincher integration is enabled.
*/
class Wincher implements Integration_Data_Provider_Interface {
/**
* The Wincher helper.
*
* @var Wincher_Helper
*/
private $wincher_helper;
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The constructor.
*
* @param Wincher_Helper $wincher_helper The Wincher helper.
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Wincher_Helper $wincher_helper, Options_Helper $options_helper ) {
$this->wincher_helper = $wincher_helper;
$this->options_helper = $options_helper;
}
/**
* If the integration is activated.
*
* @return bool If the integration is activated.
*/
public function is_enabled(): bool {
return $this->wincher_helper->is_active();
}
/**
* Return this object represented by a key value array.
*
* @return array<string,bool> Returns the name and if the feature is enabled.
*/
public function to_array(): array {
return [
'active' => $this->is_enabled(),
'loginStatus' => $this->is_enabled() && $this->wincher_helper->login_status(),
'websiteId' => $this->options_helper->get( 'wincher_website_id', '' ),
'autoAddKeyphrases' => $this->options_helper->get( 'wincher_automatically_add_keyphrases', false ),
];
}
/**
* Returns this object represented by a key value structure that is compliant with the script data array.
*
* @return array<string,bool> Returns the legacy key and if the feature is enabled.
*/
public function to_legacy_array(): array {
return [
'wincherIntegrationActive' => $this->is_enabled(),
'wincherLoginStatus' => $this->is_enabled() && $this->wincher_helper->login_status(),
'wincherWebsiteId' => $this->options_helper->get( 'wincher_website_id', '' ),
'wincherAutoAddKeyphrases' => $this->options_helper->get( 'wincher_automatically_add_keyphrases', false ),
];
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace Yoast\WP\SEO\Editors\Framework;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* Describes how it is determined if the Keyphrase analysis is turned on.
*/
class Keyphrase_Analysis implements Analysis_Feature_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The constructor.
*
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Options_Helper $options_helper ) {
$this->options_helper = $options_helper;
}
/**
* If this analysis is enabled.
*
* @return bool If this analysis is enabled.
*/
public function is_enabled(): bool {
return $this->is_globally_enabled() && $this->is_user_enabled();
}
/**
* If this analysis is enabled by the user.
*
* @return bool If this analysis is enabled by the user.
*/
public function is_user_enabled(): bool {
return ! \get_user_meta( \get_current_user_id(), 'wpseo_keyword_analysis_disable', true );
}
/**
* If this analysis is enabled globally.
*
* @return bool If this analysis is enabled globally.
*/
public function is_globally_enabled(): bool {
return (bool) $this->options_helper->get( 'keyword_analysis_active', true );
}
/**
* Gets the name.
*
* @return string The name.
*/
public function get_name(): string {
return 'keyphraseAnalysis';
}
/**
* Gets the legacy key.
*
* @return string The legacy key.
*/
public function get_legacy_key(): string {
return 'keywordAnalysisActive';
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace Yoast\WP\SEO\Editors\Framework;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
/**
* Describes if the previously used keyword feature should be enabled.
*/
class Previously_Used_Keyphrase implements Analysis_Feature_Interface {
/**
* If this analysis is enabled.
*
* @return bool If this analysis is enabled.
*/
public function is_enabled(): bool {
/**
* Filter to determine If the PreviouslyUsedKeyphrase assessment should run.
*
* @param bool $previouslyUsedKeyphraseActive If the PreviouslyUsedKeyphrase assessment should run.
*/
return (bool) \apply_filters( 'wpseo_previously_used_keyword_active', true );
}
/**
* Returns the name of the object.
*
* @return string
*/
public function get_name(): string {
return 'previouslyUsedKeyphrase';
}
/**
* Gets the legacy key.
*
* @return string The legacy key.
*/
public function get_legacy_key(): string {
return 'previouslyUsedKeywordActive';
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace Yoast\WP\SEO\Editors\Framework;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
use Yoast\WP\SEO\Helpers\Options_Helper;
/**
* This class describes the Readability analysis feature.
*/
class Readability_Analysis implements Analysis_Feature_Interface {
/**
* The options helper.
*
* @var Options_Helper
*/
private $options_helper;
/**
* The constructor.
*
* @param Options_Helper $options_helper The options helper.
*/
public function __construct( Options_Helper $options_helper ) {
$this->options_helper = $options_helper;
}
/**
* If this analysis is enabled.
*
* @return bool If this analysis is enabled.
*/
public function is_enabled(): bool {
return $this->is_globally_enabled() && $this->is_user_enabled();
}
/**
* If this analysis is enabled by the user.
*
* @return bool If this analysis is enabled by the user.
*/
private function is_user_enabled(): bool {
return ! \get_user_meta( \get_current_user_id(), 'wpseo_content_analysis_disable', true );
}
/**
* If this analysis is enabled globally.
*
* @return bool If this analysis is enabled globally.
*/
private function is_globally_enabled(): bool {
return (bool) $this->options_helper->get( 'content_analysis_active', true );
}
/**
* Gets the name.
*
* @return string The name.
*/
public function get_name(): string {
return 'readabilityAnalysis';
}
/**
* Gets the legacy key.
*
* @return string The legacy key.
*/
public function get_legacy_key(): string {
return 'contentAnalysisActive';
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Yoast\WP\SEO\Editors\Framework;
use Yoast\WP\SEO\Editors\Domain\Analysis_Features\Analysis_Feature_Interface;
use Yoast\WP\SEO\Helpers\Language_Helper;
/**
* Describes if the word for recognition analysis is enabled
*/
class Word_Form_Recognition implements Analysis_Feature_Interface {
/**
* The language helper.
*
* @var Language_Helper
*/
private $language_helper;
/**
* The constructor.
*
* @param Language_Helper $language_helper The language helper.
*/
public function __construct( Language_Helper $language_helper ) {
$this->language_helper = $language_helper;
}
/**
* If this analysis is enabled.
*
* @return bool If this analysis is enabled.
*/
public function is_enabled(): bool {
return $this->language_helper->is_word_form_recognition_active( $this->language_helper->get_language() );
}
/**
* Returns the name of the object.
*
* @return string
*/
public function get_name(): string {
return 'wordFormRecognition';
}
/**
* Gets the legacy key.
*
* @return string The legacy key.
*/
public function get_legacy_key(): string {
return 'wordFormRecognitionActive';
}
}

View File

@@ -1 +1 @@
<?php return array('reduxJsToolkit.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-redux-package'), 'version' => 'ef72d909c73f8a3f7fa5'), 'analysisReport.js' => array('dependencies' => array('lodash', 'react', 'wp-i18n', 'wp-polyfill', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => 'f4095bb34618cc5f80db'), 'componentsNew.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-i18n', 'wp-polyfill', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-react-select', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => '524df14230a70ab3143c'), 'featureFlag.js' => array('dependencies' => array('wp-polyfill'), 'version' => '2edab8ebb3cafb5fbb2a'), 'helpers.js' => array('dependencies' => array('lodash', 'react', 'wp-i18n', 'wp-polyfill', 'yoast-seo-prop-types-package', 'yoast-seo-styled-components-package'), 'version' => '6a486d8aa1671ac1f318'), 'replacementVariableEditor.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-components', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'yoast-seo-components-new-package', 'yoast-seo-draft-js-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => '3eec1206625288fa0881'), 'searchMetadataPreviews.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-i18n', 'wp-polyfill', 'yoast-seo-analysis-package', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-replacement-variable-editor-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => '4620aece3f6cd1e53fce'), 'socialMetadataForms.js' => array('dependencies' => array('lodash', 'react', 'wp-i18n', 'wp-polyfill', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-redux-package', 'yoast-seo-replacement-variable-editor-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => '76035b0e4ac0170e0d11'), 'styleGuide.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-helpers-package', 'yoast-seo-styled-components-package'), 'version' => '05f4cef63d920b5eb358'), 'uiLibrary.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-element', 'wp-polyfill', 'yoast-seo-prop-types-package', 'yoast-seo-redux-js-toolkit-package'), 'version' => '213d4771384b98e2e23a'), 'chart.js.js' => array('dependencies' => array('wp-polyfill'), 'version' => '159bddf20f5641835a87'), 'draftJs.js' => array('dependencies' => array('react', 'react-dom', 'wp-polyfill'), 'version' => '341685f1960d4b203c8a'), 'jed.js' => array('dependencies' => array('wp-polyfill'), 'version' => '508b30f9e592b1086988'), 'propTypes.js' => array('dependencies' => array('wp-polyfill'), 'version' => '79f9372cd192042f45c7'), 'reactHelmet.js' => array('dependencies' => array('react', 'wp-polyfill', 'yoast-seo-prop-types-package'), 'version' => '9366fe7e12f8417a5f4a'), 'redux.js' => array('dependencies' => array('lodash', 'wp-polyfill'), 'version' => '3fd1e012d6c18995c0c0'), 'styledComponents.js' => array('dependencies' => array('react', 'wp-polyfill'), 'version' => 'a2b71f5c7fdfdfe24575'), 'components.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-i18n', 'wp-polyfill', 'yoast-seo-analysis-report-package', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-jed-package', 'yoast-seo-prop-types-package', 'yoast-seo-redux-package', 'yoast-seo-replacement-variable-editor-package', 'yoast-seo-search-metadata-previews-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => 'a7b401608d2c19887ed4'), 'analysis.js' => array('dependencies' => array('lodash', 'wp-i18n', 'wp-polyfill', 'yoast-seo-feature-flag-package'), 'version' => '7b293df6725796aee3e5'));
<?php return array('reduxJsToolkit.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-redux-package'), 'version' => '425acbd30b98c737df6e'), 'analysisReport.js' => array('dependencies' => array('lodash', 'react', 'wp-i18n', 'wp-polyfill', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => 'f4095bb34618cc5f80db'), 'componentsNew.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-a11y', 'wp-i18n', 'wp-polyfill', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-react-select', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => '9a99c56342d24b8e8d5c'), 'featureFlag.js' => array('dependencies' => array('wp-polyfill'), 'version' => '91e54e3dd01f59a724ae'), 'helpers.js' => array('dependencies' => array('lodash', 'react', 'wp-i18n', 'wp-polyfill', 'yoast-seo-prop-types-package', 'yoast-seo-styled-components-package'), 'version' => 'f38a5f8b9a9ba801e722'), 'replacementVariableEditor.js' => array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-components', 'wp-hooks', 'wp-i18n', 'wp-polyfill', 'yoast-seo-components-new-package', 'yoast-seo-draft-js-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => 'e4ccddb70f4b704e5c16'), 'searchMetadataPreviews.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-i18n', 'wp-polyfill', 'yoast-seo-analysis-package', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-replacement-variable-editor-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => 'd6c26496fda7df191128'), 'socialMetadataForms.js' => array('dependencies' => array('lodash', 'react', 'wp-i18n', 'wp-polyfill', 'yoast-seo-components-new-package', 'yoast-seo-helpers-package', 'yoast-seo-prop-types-package', 'yoast-seo-redux-package', 'yoast-seo-replacement-variable-editor-package', 'yoast-seo-style-guide-package', 'yoast-seo-styled-components-package'), 'version' => '6c538797b828b87a5419'), 'styleGuide.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-helpers-package', 'yoast-seo-styled-components-package'), 'version' => 'a65ddb8de826da5fea4d'), 'uiLibrary.js' => array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-polyfill', 'yoast-seo-prop-types-package', 'yoast-seo-redux-js-toolkit-package'), 'version' => 'f86dff9aecec48a0e53f'), 'chart.js.js' => array('dependencies' => array('wp-polyfill'), 'version' => '196fb6740f0ef8ce192a'), 'draftJs.js' => array('dependencies' => array('react', 'react-dom', 'wp-polyfill'), 'version' => 'f03ff0ae2ee1cf6bbc54'), 'jed.js' => array('dependencies' => array('wp-polyfill'), 'version' => '28697086e82ae1cd0e88'), 'propTypes.js' => array('dependencies' => array('wp-polyfill'), 'version' => '4c546a0c9e97b70d3fe0'), 'reactHelmet.js' => array('dependencies' => array('react', 'wp-polyfill', 'yoast-seo-prop-types-package'), 'version' => 'b7d9f84f1dc499388f58'), 'redux.js' => array('dependencies' => array('wp-polyfill'), 'version' => 'e83451c8529be91b4af7'), 'styledComponents.js' => array('dependencies' => array('react', 'wp-polyfill'), 'version' => 'f030a78c47ee9be46c07'), 'analysis.js' => array('dependencies' => array('lodash', 'wp-i18n', 'wp-polyfill', 'yoast-seo-feature-flag-package'), 'version' => '8b27425b3e181dd8905d'));

View File

@@ -1 +1 @@
<?php return array('default.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'dcd5887e134799f6ade3'), 'ar.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'e3ea4db44fd2d2e88d79'), 'ca.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '469209f8725d57e2dd13'), 'cs.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '8e4aac0747a3c7dddf8a'), 'de.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '98d3917d5bd467213b06'), 'el.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'd72edcab364d544c2469'), 'en.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '8f2a235aba4e9602cf7a'), 'es.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'ff82c0b2cbb874d38d66'), 'fa.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '5afc40a75db2d68cacf2'), 'fr.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'a23c2630b045abc90aec'), 'he.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '8fc43156b5d47a4f8176'), 'hu.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'd173d9d977c5b068443b'), 'id.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '0d5dd486f955d8a407f0'), 'it.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'fb28921dba0da6614c80'), 'ja.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '399d0e938b91bde27f04'), 'nb.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '04746196da02bb736987'), 'nl.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'c324d67321be4de5dba8'), 'pl.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '5908ab61bfa52f1abf82'), 'pt.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '1b29b34cd8ec54326129'), 'ru.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '74de056aa417f584ada3'), 'sk.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'be3d5afc018c7be19ca5'), 'sv.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'aa3c53ba0e8c760d56ec'), 'tr.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'f48abbda9bf8076db264'));
<?php return array('default.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'dcd5887e134799f6ade3'), 'ar.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '4e1ef31d3c8242244a2f'), 'ca.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '469209f8725d57e2dd13'), 'cs.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '8e4aac0747a3c7dddf8a'), 'de.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'a6f42ad6f8355317a56c'), 'el.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'd72edcab364d544c2469'), 'en.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '51437f36b264d43a22db'), 'es.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'ff82c0b2cbb874d38d66'), 'fa.js' => array('dependencies' => array('wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '5afc40a75db2d68cacf2'), 'fr.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'a23c2630b045abc90aec'), 'he.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '081c52437d052c9cad74'), 'hu.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'd173d9d977c5b068443b'), 'id.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'ca63950fdd7d6938e7f0'), 'it.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'fb28921dba0da6614c80'), 'ja.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'f08d46a7f98fa0b3d579'), 'nb.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '04746196da02bb736987'), 'nl.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'c324d67321be4de5dba8'), 'pl.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '5908ab61bfa52f1abf82'), 'pt.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '1b29b34cd8ec54326129'), 'ru.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => '803adf58cc662014a305'), 'sk.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'be3d5afc018c7be19ca5'), 'sv.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'aa3c53ba0e8c760d56ec'), 'tr.js' => array('dependencies' => array('lodash', 'wp-polyfill', 'yoast-seo-analysis-package'), 'version' => 'f48abbda9bf8076db264'));

File diff suppressed because one or more lines are too long

View File

@@ -126,8 +126,10 @@ class Cached_Container extends Container
'yoast\\wp\\seo\\conditionals\\third_party\\wpml_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\Third_Party\\WPML_Conditional',
'yoast\\wp\\seo\\conditionals\\third_party\\wpml_wpseo_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\Third_Party\\WPML_WPSEO_Conditional',
'yoast\\wp\\seo\\conditionals\\updated_importer_framework_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\Updated_Importer_Framework_Conditional',
'yoast\\wp\\seo\\conditionals\\user_can_edit_users_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\User_Can_Edit_Users_Conditional',
'yoast\\wp\\seo\\conditionals\\user_can_manage_wpseo_options_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\User_Can_Manage_Wpseo_Options_Conditional',
'yoast\\wp\\seo\\conditionals\\user_can_publish_posts_and_pages_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\User_Can_Publish_Posts_And_Pages_Conditional',
'yoast\\wp\\seo\\conditionals\\user_edit_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\User_Edit_Conditional',
'yoast\\wp\\seo\\conditionals\\user_profile_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\User_Profile_Conditional',
'yoast\\wp\\seo\\conditionals\\web_stories_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\Web_Stories_Conditional',
'yoast\\wp\\seo\\conditionals\\wincher_automatically_track_conditional' => 'Yoast\\WP\\SEO\\Conditionals\\Wincher_Automatically_Track_Conditional',
@@ -179,6 +181,8 @@ class Cached_Container extends Container
'yoast\\wp\\seo\\content_type_visibility\\application\\content_type_visibility_watcher_actions' => 'Yoast\\WP\\SEO\\Content_Type_Visibility\\Application\\Content_Type_Visibility_Watcher_Actions',
'yoast\\wp\\seo\\content_type_visibility\\user_interface\\content_type_visibility_dismiss_new_route' => 'Yoast\\WP\\SEO\\Content_Type_Visibility\\User_Interface\\Content_Type_Visibility_Dismiss_New_Route',
'yoast\\wp\\seo\\context\\meta_tags_context' => 'Yoast\\WP\\SEO\\Context\\Meta_Tags_Context',
'yoast\\wp\\seo\\editors\\application\\analysis_features\\enabled_analysis_features_repository' => 'Yoast\\WP\\SEO\\Editors\\Application\\Analysis_Features\\Enabled_Analysis_Features_Repository',
'yoast\\wp\\seo\\editors\\application\\integrations\\integration_information_repository' => 'Yoast\\WP\\SEO\\Editors\\Application\\Integrations\\Integration_Information_Repository',
'yoast\\wp\\seo\\generators\\breadcrumbs_generator' => 'Yoast\\WP\\SEO\\Generators\\Breadcrumbs_Generator',
'yoast\\wp\\seo\\generators\\open_graph_image_generator' => 'Yoast\\WP\\SEO\\Generators\\Open_Graph_Image_Generator',
'yoast\\wp\\seo\\generators\\open_graph_locale_generator' => 'Yoast\\WP\\SEO\\Generators\\Open_Graph_Locale_Generator',
@@ -286,6 +290,7 @@ class Cached_Container extends Container
'yoast\\wp\\seo\\integrations\\admin\\redirect_integration' => 'Yoast\\WP\\SEO\\Integrations\\Admin\\Redirect_Integration',
'yoast\\wp\\seo\\integrations\\admin\\redirects_page_integration' => 'Yoast\\WP\\SEO\\Integrations\\Admin\\Redirects_Page_Integration',
'yoast\\wp\\seo\\integrations\\admin\\social_templates_integration' => 'Yoast\\WP\\SEO\\Integrations\\Admin\\Social_Templates_Integration',
'yoast\\wp\\seo\\integrations\\admin\\unsupported_php_version_notice' => 'Yoast\\WP\\SEO\\Integrations\\Admin\\Unsupported_PHP_Version_Notice',
'yoast\\wp\\seo\\integrations\\admin\\workouts_integration' => 'Yoast\\WP\\SEO\\Integrations\\Admin\\Workouts_Integration',
'yoast\\wp\\seo\\integrations\\alerts\\black_friday_product_editor_checklist_notification' => 'Yoast\\WP\\SEO\\Integrations\\Alerts\\Black_Friday_Product_Editor_Checklist_Notification',
'yoast\\wp\\seo\\integrations\\alerts\\black_friday_promotion_notification' => 'Yoast\\WP\\SEO\\Integrations\\Alerts\\Black_Friday_Promotion_Notification',
@@ -438,10 +443,16 @@ class Cached_Container extends Container
'yoast\\wp\\seo\\surfaces\\open_graph_helpers_surface' => 'Yoast\\WP\\SEO\\Surfaces\\Open_Graph_Helpers_Surface',
'yoast\\wp\\seo\\surfaces\\schema_helpers_surface' => 'Yoast\\WP\\SEO\\Surfaces\\Schema_Helpers_Surface',
'yoast\\wp\\seo\\surfaces\\twitter_helpers_surface' => 'Yoast\\WP\\SEO\\Surfaces\\Twitter_Helpers_Surface',
'yoast\\wp\\seo\\user_meta\\application\\additional_contactmethods_collector' => 'Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector',
'yoast\\wp\\seo\\user_meta\\application\\custom_meta_collector' => 'Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector',
'yoast\\wp\\seo\\user_meta\\user_interface\\additional_contactmethods_integration' => 'Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Additional_Contactmethods_Integration',
'yoast\\wp\\seo\\user_meta\\user_interface\\cleanup_integration' => 'Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Cleanup_Integration',
'yoast\\wp\\seo\\user_meta\\user_interface\\custom_meta_integration' => 'Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Custom_Meta_Integration',
'yoast\\wp\\seo\\user_profiles_additions\\user_interface\\user_profiles_additions_ui' => 'Yoast\\WP\\SEO\\User_Profiles_Additions\\User_Interface\\User_Profiles_Additions_Ui',
'yoast\\wp\\seo\\values\\images' => 'Yoast\\WP\\SEO\\Values\\Images',
'yoast\\wp\\seo\\values\\indexables\\indexable_builder_versions' => 'Yoast\\WP\\SEO\\Values\\Indexables\\Indexable_Builder_Versions',
'yoast\\wp\\seo\\values\\open_graph\\images' => 'Yoast\\WP\\SEO\\Values\\Open_Graph\\Images',
'yoast\\wp\\seo\\values\\twitter\\images' => 'Yoast\\WP\\SEO\\Values\\Twitter\\Images',
'yoast\\wp\\seo\\wrappers\\wp_query_wrapper' => 'Yoast\\WP\\SEO\\Wrappers\\WP_Query_Wrapper',
'yoast\\wp\\seo\\wrappers\\wp_remote_handler' => 'Yoast\\WP\\SEO\\Wrappers\\WP_Remote_Handler',
'yoast\\wp\\seo\\wrappers\\wp_rewrite_wrapper' => 'Yoast\\WP\\SEO\\Wrappers\\WP_Rewrite_Wrapper',
@@ -550,8 +561,10 @@ class Cached_Container extends Container
'Yoast\\WP\\SEO\\Conditionals\\Third_Party\\Wordproof_Integration_Active_Conditional' => 'getWordproofIntegrationActiveConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\Third_Party\\Wordproof_Plugin_Inactive_Conditional' => 'getWordproofPluginInactiveConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\Updated_Importer_Framework_Conditional' => 'getUpdatedImporterFrameworkConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\User_Can_Edit_Users_Conditional' => 'getUserCanEditUsersConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\User_Can_Manage_Wpseo_Options_Conditional' => 'getUserCanManageWpseoOptionsConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\User_Can_Publish_Posts_And_Pages_Conditional' => 'getUserCanPublishPostsAndPagesConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\User_Edit_Conditional' => 'getUserEditConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\User_Profile_Conditional' => 'getUserProfileConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\WP_CRON_Enabled_Conditional' => 'getWPCRONEnabledConditionalService',
'Yoast\\WP\\SEO\\Conditionals\\WP_Robots_Conditional' => 'getWPRobotsConditionalService',
@@ -603,6 +616,8 @@ class Cached_Container extends Container
'Yoast\\WP\\SEO\\Content_Type_Visibility\\Application\\Content_Type_Visibility_Watcher_Actions' => 'getContentTypeVisibilityWatcherActionsService',
'Yoast\\WP\\SEO\\Content_Type_Visibility\\User_Interface\\Content_Type_Visibility_Dismiss_New_Route' => 'getContentTypeVisibilityDismissNewRouteService',
'Yoast\\WP\\SEO\\Context\\Meta_Tags_Context' => 'getMetaTagsContextService',
'Yoast\\WP\\SEO\\Editors\\Application\\Analysis_Features\\Enabled_Analysis_Features_Repository' => 'getEnabledAnalysisFeaturesRepositoryService',
'Yoast\\WP\\SEO\\Editors\\Application\\Integrations\\Integration_Information_Repository' => 'getIntegrationInformationRepositoryService',
'Yoast\\WP\\SEO\\Generators\\Breadcrumbs_Generator' => 'getBreadcrumbsGeneratorService',
'Yoast\\WP\\SEO\\Generators\\Open_Graph_Image_Generator' => 'getOpenGraphImageGeneratorService',
'Yoast\\WP\\SEO\\Generators\\Open_Graph_Locale_Generator' => 'getOpenGraphLocaleGeneratorService',
@@ -710,6 +725,7 @@ class Cached_Container extends Container
'Yoast\\WP\\SEO\\Integrations\\Admin\\Redirect_Integration' => 'getRedirectIntegrationService',
'Yoast\\WP\\SEO\\Integrations\\Admin\\Redirects_Page_Integration' => 'getRedirectsPageIntegrationService',
'Yoast\\WP\\SEO\\Integrations\\Admin\\Social_Templates_Integration' => 'getSocialTemplatesIntegrationService',
'Yoast\\WP\\SEO\\Integrations\\Admin\\Unsupported_PHP_Version_Notice' => 'getUnsupportedPHPVersionNoticeService',
'Yoast\\WP\\SEO\\Integrations\\Admin\\Workouts_Integration' => 'getWorkoutsIntegrationService',
'Yoast\\WP\\SEO\\Integrations\\Alerts\\Black_Friday_Product_Editor_Checklist_Notification' => 'getBlackFridayProductEditorChecklistNotificationService',
'Yoast\\WP\\SEO\\Integrations\\Alerts\\Black_Friday_Promotion_Notification' => 'getBlackFridayPromotionNotificationService',
@@ -862,10 +878,16 @@ class Cached_Container extends Container
'Yoast\\WP\\SEO\\Surfaces\\Open_Graph_Helpers_Surface' => 'getOpenGraphHelpersSurfaceService',
'Yoast\\WP\\SEO\\Surfaces\\Schema_Helpers_Surface' => 'getSchemaHelpersSurfaceService',
'Yoast\\WP\\SEO\\Surfaces\\Twitter_Helpers_Surface' => 'getTwitterHelpersSurfaceService',
'Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector' => 'getAdditionalContactmethodsCollectorService',
'Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector' => 'getCustomMetaCollectorService',
'Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Additional_Contactmethods_Integration' => 'getAdditionalContactmethodsIntegrationService',
'Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Cleanup_Integration' => 'getCleanupIntegration2Service',
'Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Custom_Meta_Integration' => 'getCustomMetaIntegrationService',
'Yoast\\WP\\SEO\\User_Profiles_Additions\\User_Interface\\User_Profiles_Additions_Ui' => 'getUserProfilesAdditionsUiService',
'Yoast\\WP\\SEO\\Values\\Images' => 'getImagesService',
'Yoast\\WP\\SEO\\Values\\Indexables\\Indexable_Builder_Versions' => 'getIndexableBuilderVersionsService',
'Yoast\\WP\\SEO\\Values\\Open_Graph\\Images' => 'getImages2Service',
'Yoast\\WP\\SEO\\Values\\Twitter\\Images' => 'getImages3Service',
'Yoast\\WP\\SEO\\Wrappers\\WP_Query_Wrapper' => 'getWPQueryWrapperService',
'Yoast\\WP\\SEO\\Wrappers\\WP_Remote_Handler' => 'getWPRemoteHandlerService',
'Yoast\\WP\\SEO\\Wrappers\\WP_Rewrite_Wrapper' => 'getWPRewriteWrapperService',
@@ -893,6 +915,18 @@ class Cached_Container extends Container
'Yoast\\WP\\SEO\\Analytics\\Domain\\To_Be_Cleaned_Indexable_Bucket' => true,
'Yoast\\WP\\SEO\\Analytics\\Domain\\To_Be_Cleaned_Indexable_Count' => true,
'Yoast\\WP\\SEO\\Content_Type_Visibility\\Application\\Content_Type_Visibility_Dismiss_Notifications' => true,
'Yoast\\WP\\SEO\\Editors\\Domain\\Analysis_Features\\Analysis_Feature' => true,
'Yoast\\WP\\SEO\\Editors\\Domain\\Analysis_Features\\Analysis_Features_List' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Cornerstone_Content' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Inclusive_Language_Analysis' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Integrations\\Jetpack_Markdown' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Integrations\\Multilingual' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Integrations\\Semrush' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Integrations\\Wincher' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Keyphrase_Analysis' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Previously_Used_Keyphrase' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Readability_Analysis' => true,
'Yoast\\WP\\SEO\\Editors\\Framework\\Word_Form_Recognition' => true,
'Yoast\\WP\\SEO\\Introductions\\Application\\Ai_Generate_Titles_And_Descriptions_Introduction_Upsell' => true,
'Yoast\\WP\\SEO\\Introductions\\Application\\Introductions_Collector' => true,
'Yoast\\WP\\SEO\\Introductions\\Domain\\Introduction_Interface' => true,
@@ -905,6 +939,24 @@ class Cached_Container extends Container
'Yoast\\WP\\SEO\\Promotions\\Domain\\Black_Friday_Checklist_Promotion' => true,
'Yoast\\WP\\SEO\\Promotions\\Domain\\Black_Friday_Promotion' => true,
'Yoast\\WP\\SEO\\Promotions\\Domain\\Time_Interval' => true,
'Yoast\\WP\\SEO\\User_Meta\\Application\\Cleanup_Service' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Facebook' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Instagram' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Linkedin' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Myspace' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Pinterest' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Soundcloud' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Tumblr' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Wikipedia' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\X' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Additional_Contactmethods\\Youtube' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Custom_Meta\\Author_Metadesc' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Custom_Meta\\Author_Title' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Custom_Meta\\Content_Analysis_Disable' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Custom_Meta\\Inclusive_Language_Analysis_Disable' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Custom_Meta\\Keyword_Analysis_Disable' => true,
'Yoast\\WP\\SEO\\User_Meta\\Framework\\Custom_Meta\\Noindex_Author' => true,
'Yoast\\WP\\SEO\\User_Meta\\Infrastructure\\Cleanup_Repository' => true,
];
}
@@ -2169,6 +2221,16 @@ class Cached_Container extends Container
return $this->services['Yoast\\WP\\SEO\\Conditionals\\Updated_Importer_Framework_Conditional'] = new \Yoast\WP\SEO\Conditionals\Updated_Importer_Framework_Conditional();
}
/**
* Gets the public 'Yoast\WP\SEO\Conditionals\User_Can_Edit_Users_Conditional' shared autowired service.
*
* @return \Yoast\WP\SEO\Conditionals\User_Can_Edit_Users_Conditional
*/
protected function getUserCanEditUsersConditionalService()
{
return $this->services['Yoast\\WP\\SEO\\Conditionals\\User_Can_Edit_Users_Conditional'] = new \Yoast\WP\SEO\Conditionals\User_Can_Edit_Users_Conditional();
}
/**
* Gets the public 'Yoast\WP\SEO\Conditionals\User_Can_Manage_Wpseo_Options_Conditional' shared autowired service.
*
@@ -2189,6 +2251,16 @@ class Cached_Container extends Container
return $this->services['Yoast\\WP\\SEO\\Conditionals\\User_Can_Publish_Posts_And_Pages_Conditional'] = new \Yoast\WP\SEO\Conditionals\User_Can_Publish_Posts_And_Pages_Conditional();
}
/**
* Gets the public 'Yoast\WP\SEO\Conditionals\User_Edit_Conditional' shared autowired service.
*
* @return \Yoast\WP\SEO\Conditionals\User_Edit_Conditional
*/
protected function getUserEditConditionalService()
{
return $this->services['Yoast\\WP\\SEO\\Conditionals\\User_Edit_Conditional'] = new \Yoast\WP\SEO\Conditionals\User_Edit_Conditional();
}
/**
* Gets the public 'Yoast\WP\SEO\Conditionals\User_Profile_Conditional' shared autowired service.
*
@@ -2689,6 +2761,31 @@ class Cached_Container extends Container
return $this->services['Yoast\\WP\\SEO\\Context\\Meta_Tags_Context'] = new \Yoast\WP\SEO\Context\Meta_Tags_Context(${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper'] = new \Yoast\WP\SEO\Helpers\Options_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Url_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Url_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Url_Helper'] = new \Yoast\WP\SEO\Helpers\Url_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Image_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Image_Helper'] : $this->getImageHelperService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Schema\\ID_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Schema\\ID_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Schema\\ID_Helper'] = new \Yoast\WP\SEO\Helpers\Schema\ID_Helper())) && false ?: '_'}, ${($_ = isset($this->services['WPSEO_Replace_Vars']) ? $this->services['WPSEO_Replace_Vars'] : $this->getWPSEOReplaceVarsService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Site_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Site_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Site_Helper'] = new \Yoast\WP\SEO\Helpers\Site_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\User_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\User_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\User_Helper'] = new \Yoast\WP\SEO\Helpers\User_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Permalink_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Permalink_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Permalink_Helper'] = new \Yoast\WP\SEO\Helpers\Permalink_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Indexable_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Indexable_Helper'] : $this->getIndexableHelperService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Repositories\\Indexable_Repository']) ? $this->services['Yoast\\WP\\SEO\\Repositories\\Indexable_Repository'] : $this->getIndexableRepositoryService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Request_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Request_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Request_Helper'] = new \Yoast\WP\SEO\Helpers\Request_Helper())) && false ?: '_'});
}
/**
* Gets the public 'Yoast\WP\SEO\Editors\Application\Analysis_Features\Enabled_Analysis_Features_Repository' shared autowired service.
*
* @return \Yoast\WP\SEO\Editors\Application\Analysis_Features\Enabled_Analysis_Features_Repository
*/
protected function getEnabledAnalysisFeaturesRepositoryService()
{
$a = ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper'] = new \Yoast\WP\SEO\Helpers\Options_Helper())) && false ?: '_'};
$b = ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Language_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Language_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Language_Helper'] = new \Yoast\WP\SEO\Helpers\Language_Helper())) && false ?: '_'};
return $this->services['Yoast\\WP\\SEO\\Editors\\Application\\Analysis_Features\\Enabled_Analysis_Features_Repository'] = new \Yoast\WP\SEO\Editors\Application\Analysis_Features\Enabled_Analysis_Features_Repository(new \Yoast\WP\SEO\Editors\Framework\Cornerstone_Content($a), new \Yoast\WP\SEO\Editors\Framework\Inclusive_Language_Analysis($a, $b, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Product_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Product_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Product_Helper'] = new \Yoast\WP\SEO\Helpers\Product_Helper())) && false ?: '_'}), new \Yoast\WP\SEO\Editors\Framework\Keyphrase_Analysis($a), new \Yoast\WP\SEO\Editors\Framework\Previously_Used_Keyphrase(), new \Yoast\WP\SEO\Editors\Framework\Readability_Analysis($a), new \Yoast\WP\SEO\Editors\Framework\Word_Form_Recognition($b));
}
/**
* Gets the public 'Yoast\WP\SEO\Editors\Application\Integrations\Integration_Information_Repository' shared autowired service.
*
* @return \Yoast\WP\SEO\Editors\Application\Integrations\Integration_Information_Repository
*/
protected function getIntegrationInformationRepositoryService()
{
$a = ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Options_Helper'] = new \Yoast\WP\SEO\Helpers\Options_Helper())) && false ?: '_'};
return $this->services['Yoast\\WP\\SEO\\Editors\\Application\\Integrations\\Integration_Information_Repository'] = new \Yoast\WP\SEO\Editors\Application\Integrations\Integration_Information_Repository(new \Yoast\WP\SEO\Editors\Framework\Integrations\Jetpack_Markdown(), new \Yoast\WP\SEO\Editors\Framework\Integrations\Multilingual(${($_ = isset($this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\WPML_Conditional']) ? $this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\WPML_Conditional'] : ($this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\WPML_Conditional'] = new \Yoast\WP\SEO\Conditionals\Third_Party\WPML_Conditional())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\Polylang_Conditional']) ? $this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\Polylang_Conditional'] : ($this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\Polylang_Conditional'] = new \Yoast\WP\SEO\Conditionals\Third_Party\Polylang_Conditional())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\TranslatePress_Conditional']) ? $this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\TranslatePress_Conditional'] : ($this->services['Yoast\\WP\\SEO\\Conditionals\\Third_Party\\TranslatePress_Conditional'] = new \Yoast\WP\SEO\Conditionals\Third_Party\TranslatePress_Conditional())) && false ?: '_'}), new \Yoast\WP\SEO\Editors\Framework\Integrations\Semrush($a), new \Yoast\WP\SEO\Editors\Framework\Integrations\Wincher(${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Wincher_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Wincher_Helper'] : $this->getWincherHelperService()) && false ?: '_'}, $a));
}
/**
* Gets the public 'Yoast\WP\SEO\Generators\Breadcrumbs_Generator' shared autowired service.
*
@@ -3812,6 +3909,16 @@ class Cached_Container extends Container
return $this->services['Yoast\\WP\\SEO\\Integrations\\Admin\\Social_Templates_Integration'] = new \Yoast\WP\SEO\Integrations\Admin\Social_Templates_Integration();
}
/**
* Gets the public 'Yoast\WP\SEO\Integrations\Admin\Unsupported_PHP_Version_Notice' shared autowired service.
*
* @return \Yoast\WP\SEO\Integrations\Admin\Unsupported_PHP_Version_Notice
*/
protected function getUnsupportedPHPVersionNoticeService()
{
return $this->services['Yoast\\WP\\SEO\\Integrations\\Admin\\Unsupported_PHP_Version_Notice'] = new \Yoast\WP\SEO\Integrations\Admin\Unsupported_PHP_Version_Notice();
}
/**
* Gets the public 'Yoast\WP\SEO\Integrations\Admin\Workouts_Integration' shared autowired service.
*
@@ -4643,7 +4750,7 @@ class Cached_Container extends Container
*/
protected function getWoocommerceBetaEditorWatcherService()
{
return $this->services['Yoast\\WP\\SEO\\Integrations\\Watchers\\Woocommerce_Beta_Editor_Watcher'] = new \Yoast\WP\SEO\Integrations\Watchers\Woocommerce_Beta_Editor_Watcher(${($_ = isset($this->services['Yoast_Notification_Center']) ? $this->services['Yoast_Notification_Center'] : $this->getYoastNotificationCenterService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Notification_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Notification_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Notification_Helper'] = new \Yoast\WP\SEO\Helpers\Notification_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Short_Link_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Short_Link_Helper'] : $this->getShortLinkHelperService()) && false ?: '_'});
return $this->services['Yoast\\WP\\SEO\\Integrations\\Watchers\\Woocommerce_Beta_Editor_Watcher'] = new \Yoast\WP\SEO\Integrations\Watchers\Woocommerce_Beta_Editor_Watcher(${($_ = isset($this->services['Yoast_Notification_Center']) ? $this->services['Yoast_Notification_Center'] : $this->getYoastNotificationCenterService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Notification_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Notification_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Notification_Helper'] = new \Yoast\WP\SEO\Helpers\Notification_Helper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Short_Link_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Short_Link_Helper'] : $this->getShortLinkHelperService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Conditionals\\WooCommerce_Conditional']) ? $this->services['Yoast\\WP\\SEO\\Conditionals\\WooCommerce_Conditional'] : ($this->services['Yoast\\WP\\SEO\\Conditionals\\WooCommerce_Conditional'] = new \Yoast\WP\SEO\Conditionals\WooCommerce_Conditional())) && false ?: '_'});
}
/**
@@ -4767,6 +4874,7 @@ class Cached_Container extends Container
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Admin\\Old_Configuration_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Admin\\Redirect_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Admin\\Redirects_Page_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Admin\\Unsupported_PHP_Version_Notice');
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Admin\\Workouts_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Alerts\\Black_Friday_Product_Editor_Checklist_Notification');
$instance->register_integration('Yoast\\WP\\SEO\\Integrations\\Alerts\\Black_Friday_Promotion_Notification');
@@ -4862,6 +4970,9 @@ class Cached_Container extends Container
$instance->register_route('Yoast\\WP\\SEO\\Routes\\Wincher_Route');
$instance->register_route('Yoast\\WP\\SEO\\Routes\\Workouts_Route');
$instance->register_route('Yoast\\WP\\SEO\\Routes\\Yoast_Head_REST_Field');
$instance->register_integration('Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Additional_Contactmethods_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Cleanup_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Custom_Meta_Integration');
$instance->register_integration('Yoast\\WP\\SEO\\User_Profiles_Additions\\User_Interface\\User_Profiles_Additions_Ui');
return $instance;
@@ -5582,6 +5693,56 @@ class Cached_Container extends Container
return $this->services['Yoast\\WP\\SEO\\Surfaces\\Twitter_Helpers_Surface'] = new \Yoast\WP\SEO\Surfaces\Twitter_Helpers_Surface($this);
}
/**
* Gets the public 'Yoast\WP\SEO\User_Meta\Application\Additional_Contactmethods_Collector' shared autowired service.
*
* @return \Yoast\WP\SEO\User_Meta\Application\Additional_Contactmethods_Collector
*/
protected function getAdditionalContactmethodsCollectorService()
{
return $this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector'] = new \Yoast\WP\SEO\User_Meta\Application\Additional_Contactmethods_Collector(new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Facebook(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Instagram(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Linkedin(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Myspace(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Pinterest(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Soundcloud(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Tumblr(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Wikipedia(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\X(), new \Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods\Youtube());
}
/**
* Gets the public 'Yoast\WP\SEO\User_Meta\Application\Custom_Meta_Collector' shared autowired service.
*
* @return \Yoast\WP\SEO\User_Meta\Application\Custom_Meta_Collector
*/
protected function getCustomMetaCollectorService()
{
return $this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector'] = new \Yoast\WP\SEO\User_Meta\Application\Custom_Meta_Collector(new \Yoast\WP\SEO\User_Meta\Framework\Custom_Meta\Author_Metadesc(), new \Yoast\WP\SEO\User_Meta\Framework\Custom_Meta\Author_Title(), new \Yoast\WP\SEO\User_Meta\Framework\Custom_Meta\Content_Analysis_Disable(), new \Yoast\WP\SEO\User_Meta\Framework\Custom_Meta\Inclusive_Language_Analysis_Disable(), new \Yoast\WP\SEO\User_Meta\Framework\Custom_Meta\Keyword_Analysis_Disable(), new \Yoast\WP\SEO\User_Meta\Framework\Custom_Meta\Noindex_Author());
}
/**
* Gets the public 'Yoast\WP\SEO\User_Meta\User_Interface\Additional_Contactmethods_Integration' shared autowired service.
*
* @return \Yoast\WP\SEO\User_Meta\User_Interface\Additional_Contactmethods_Integration
*/
protected function getAdditionalContactmethodsIntegrationService()
{
return $this->services['Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Additional_Contactmethods_Integration'] = new \Yoast\WP\SEO\User_Meta\User_Interface\Additional_Contactmethods_Integration(${($_ = isset($this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector']) ? $this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector'] : $this->getAdditionalContactmethodsCollectorService()) && false ?: '_'});
}
/**
* Gets the public 'Yoast\WP\SEO\User_Meta\User_Interface\Cleanup_Integration' shared autowired service.
*
* @return \Yoast\WP\SEO\User_Meta\User_Interface\Cleanup_Integration
*/
protected function getCleanupIntegration2Service()
{
return $this->services['Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Cleanup_Integration'] = new \Yoast\WP\SEO\User_Meta\User_Interface\Cleanup_Integration(new \Yoast\WP\SEO\User_Meta\Application\Cleanup_Service(${($_ = isset($this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector']) ? $this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Additional_Contactmethods_Collector'] : $this->getAdditionalContactmethodsCollectorService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector']) ? $this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector'] : $this->getCustomMetaCollectorService()) && false ?: '_'}, new \Yoast\WP\SEO\User_Meta\Infrastructure\Cleanup_Repository()));
}
/**
* Gets the public 'Yoast\WP\SEO\User_Meta\User_Interface\Custom_Meta_Integration' shared autowired service.
*
* @return \Yoast\WP\SEO\User_Meta\User_Interface\Custom_Meta_Integration
*/
protected function getCustomMetaIntegrationService()
{
return $this->services['Yoast\\WP\\SEO\\User_Meta\\User_Interface\\Custom_Meta_Integration'] = new \Yoast\WP\SEO\User_Meta\User_Interface\Custom_Meta_Integration(${($_ = isset($this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector']) ? $this->services['Yoast\\WP\\SEO\\User_Meta\\Application\\Custom_Meta_Collector'] : $this->getCustomMetaCollectorService()) && false ?: '_'});
}
/**
* Gets the public 'Yoast\WP\SEO\User_Profiles_Additions\User_Interface\User_Profiles_Additions_Ui' shared autowired service.
*
@@ -5626,6 +5787,20 @@ class Cached_Container extends Container
return $instance;
}
/**
* Gets the public 'Yoast\WP\SEO\Values\Twitter\Images' shared autowired service.
*
* @return \Yoast\WP\SEO\Values\Twitter\Images
*/
protected function getImages3Service()
{
$this->services['Yoast\\WP\\SEO\\Values\\Twitter\\Images'] = $instance = new \Yoast\WP\SEO\Values\Twitter\Images(${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Image_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Image_Helper'] : $this->getImageHelperService()) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Url_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Url_Helper'] : ($this->services['Yoast\\WP\\SEO\\Helpers\\Url_Helper'] = new \Yoast\WP\SEO\Helpers\Url_Helper())) && false ?: '_'});
$instance->set_helpers(${($_ = isset($this->services['Yoast\\WP\\SEO\\Helpers\\Twitter\\Image_Helper']) ? $this->services['Yoast\\WP\\SEO\\Helpers\\Twitter\\Image_Helper'] : $this->getImageHelper4Service()) && false ?: '_'});
return $instance;
}
/**
* Gets the public 'Yoast\WP\SEO\Wrappers\WP_Query_Wrapper' shared autowired service.
*

View File

@@ -156,7 +156,7 @@ class Breadcrumbs_Generator implements Generator_Interface {
}
);
$crumbs = \array_map( [ $this,'get_post_type_crumb' ], $indexables );
$crumbs = \array_map( [ $this, 'get_post_type_crumb' ], $indexables );
if ( $breadcrumbs_home !== '' ) {
$crumbs[0]['text'] = $breadcrumbs_home;

View File

@@ -252,7 +252,7 @@ class Person extends Abstract_Schema_Piece {
$url = \get_the_author_meta( $social_site, $user_id );
if ( ! empty( $url ) && $social_site === 'twitter' ) {
$url = 'https://twitter.com/' . $url;
$url = 'https://x.com/' . $url;
}
return $url;

View File

@@ -7,13 +7,20 @@ use Yoast\WP\SEO\Helpers\Image_Helper;
use Yoast\WP\SEO\Helpers\Twitter\Image_Helper as Twitter_Image_Helper;
use Yoast\WP\SEO\Helpers\Url_Helper;
use Yoast\WP\SEO\Models\Indexable;
use Yoast\WP\SEO\Values\Images;
use Yoast\WP\SEO\Values\Twitter\Images;
/**
* Represents the generator class for the Twitter images.
*/
class Twitter_Image_Generator implements Generator_Interface {
/**
* The Twitter image helper.
*
* @var Twitter_Image_Helper
*/
protected $twitter_image;
/**
* The image helper.
*
@@ -28,13 +35,6 @@ class Twitter_Image_Generator implements Generator_Interface {
*/
protected $url;
/**
* The Twitter image helper.
*
* @var Twitter_Image_Helper
*/
protected $twitter_image;
/**
* Twitter_Image_Generator constructor.
*
@@ -55,7 +55,7 @@ class Twitter_Image_Generator implements Generator_Interface {
*
* @param Meta_Tags_Context $context The context.
*
* @return array The images.
* @return array<array<string,string|int>> The images.
*/
public function generate( Meta_Tags_Context $context ) {
$image_container = $this->get_image_container();
@@ -95,6 +95,8 @@ class Twitter_Image_Generator implements Generator_Interface {
$image_container = new Images( $this->image, $this->url );
$image_container->image_size = $this->twitter_image->get_image_size();
$image_container->set_helpers( $this->twitter_image );
return $image_container;
}
}

View File

@@ -129,13 +129,7 @@ class Current_Page_Helper {
public function get_term_id() {
$wp_query = $this->wp_query_wrapper->get_main_query();
if ( $wp_query->is_category() ) {
return $wp_query->get( 'cat' );
}
if ( $wp_query->is_tag() ) {
return $wp_query->get( 'tag_id' );
}
if ( $wp_query->is_tax() ) {
if ( $wp_query->is_tax() || $wp_query->is_tag() || $wp_query->is_category() ) {
$queried_object = $wp_query->get_queried_object();
if ( $queried_object && ! \is_wp_error( $queried_object ) ) {
return $queried_object->term_id;

View File

@@ -304,7 +304,8 @@ class Image_Helper {
*/
public function get_attachment_by_url( $url, $use_link_table = true ) {
// Don't try to do this for external URLs.
if ( $this->url_helper->get_link_type( $url ) === SEO_Links::TYPE_EXTERNAL ) {
$parsed_url = \wp_parse_url( $url );
if ( $this->url_helper->get_link_type( $parsed_url ) === SEO_Links::TYPE_EXTERNAL ) {
return 0;
}
@@ -332,8 +333,15 @@ class Image_Helper {
if ( ! $use_link_table ) {
return WPSEO_Image_Utils::get_attachment_by_url( $url );
}
$cache_key = 'attachment_seo_link_object_' . \md5( $url );
$link = $this->seo_links_repository->find_one_by_url( $url );
$found = false;
$link = \wp_cache_get( $cache_key, 'yoast-seo-attachment-link', false, $found );
if ( $found === false ) {
$link = $this->seo_links_repository->find_one_by_url( $url );
\wp_cache_set( $cache_key, $link, 'yoast-seo-attachment-link', \MINUTE_IN_SECONDS );
}
if ( ! \is_a( $link, SEO_Links::class ) ) {
return WPSEO_Image_Utils::get_attachment_by_url( $url );
}

View File

@@ -40,11 +40,16 @@ class Image_Helper {
/**
* Determines whether the passed URL is considered valid.
*
* @param array $image The image array.
* @deprecated 22.4
* @codeCoverageIgnore
*
* @param array<array<string,string|int>> $image The image array.
*
* @return bool Whether or not the URL is a valid image.
*/
public function is_image_url_valid( array $image ) {
\_deprecated_function( __METHOD__, 'Yoast SEO 22.4' );
if ( empty( $image['url'] ) || ! \is_string( $image['url'] ) ) {
return false;
}
@@ -89,7 +94,7 @@ class Image_Helper {
*
* @param int $attachment_id The attachment id.
*
* @return array|false The image data when found, `false` when not.
* @return array<string,string|int>|false The image data when found, `false` when not.
*/
public function get_image_by_id( $attachment_id ) {
if ( ! $this->image->is_valid_attachment( $attachment_id ) ) {

View File

@@ -71,6 +71,6 @@ class HTML_Helper {
* @return bool
*/
private function is_non_empty_string_or_stringable( $html ) {
return ( \is_string( $html ) || \is_object( $html ) && \method_exists( $html, '__toString' ) ) && ! empty( $html );
return ( \is_string( $html ) || ( \is_object( $html ) && \method_exists( $html, '__toString' ) ) ) && ! empty( $html );
}
}

View File

@@ -112,7 +112,7 @@ class Social_Profiles_Helper {
/**
* Gets the organization social profiles stored in the database.
*
* @return array The social profiles for the organization.
* @return array<string, string> The social profiles for the organization.
*/
public function get_organization_social_profiles() {
$organization_social_profiles_fields = \array_keys( $this->get_organization_social_profile_fields() );
@@ -132,7 +132,7 @@ class Social_Profiles_Helper {
}
if ( $field_name === 'twitter_site' && $social_profile_value !== '' ) {
$organization_social_profiles[ $field_name ] = 'https://twitter.com/' . $social_profile_value;
$organization_social_profiles[ $field_name ] = 'https://x.com/' . $social_profile_value;
continue;
}

View File

@@ -44,13 +44,15 @@ class Image_Helper {
/**
* Retrieves an image url by its id.
*
* @codeCoverageIgnore It is a wrapper method.
*
* @param int $image_id The image id.
*
* @return string The image url.
* @return string The image url. Empty string if the attachment is not valid.
*/
public function get_by_id( $image_id ) {
if ( ! $this->image->is_valid_attachment( $image_id ) ) {
return '';
}
return $this->image->get_attachment_image_source( $image_id, $this->get_image_size() );
}
}

View File

@@ -106,8 +106,7 @@ class Url_Helper {
*/
public function get_url_path( $url ) {
if ( \is_string( $url ) === false
&& \is_object( $url ) === false
|| ( \is_object( $url ) === true && \method_exists( $url, '__toString' ) === false )
&& ( \is_object( $url ) === false || \method_exists( $url, '__toString' ) === false )
) {
return '';
}
@@ -124,8 +123,7 @@ class Url_Helper {
*/
public function get_url_host( $url ) {
if ( \is_string( $url ) === false
&& \is_object( $url ) === false
|| ( \is_object( $url ) === true && \method_exists( $url, '__toString' ) === false )
&& ( \is_object( $url ) === false || \method_exists( $url, '__toString' ) === false )
) {
return '';
}

View File

@@ -0,0 +1,167 @@
<?php
namespace Yoast\WP\SEO\Integrations\Admin;
use WPSEO_Shortlinker;
use Yoast\WHIPv2\Exceptions\InvalidType;
use Yoast\WHIPv2\Exceptions\InvalidVersionComparisonString;
use Yoast\WHIPv2\Interfaces\Message;
use Yoast\WHIPv2\MessageDismisser;
use Yoast\WHIPv2\MessageFormatter;
use Yoast\WHIPv2\Presenters\WPMessagePresenter;
use Yoast\WHIPv2\RequirementsChecker;
use Yoast\WHIPv2\VersionRequirement;
use Yoast\WHIPv2\WPDismissOption;
use Yoast\WP\SEO\Conditionals\Yoast_Admin_And_Dashboard_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
/**
* Class Unsupported_PHP_Version_Notice.
*
* @package Yoast\WP\SEO\Integrations\Admin
*/
class Unsupported_PHP_Version_Notice implements Integration_Interface, Message {
/**
* Returns the conditionals based on which this integration should be active.
*
* @return array<string> The array of conditionals.
*/
public static function get_conditionals() {
return [
Yoast_Admin_And_Dashboard_Conditional::class,
];
}
/**
* Register hooks.
*
* @return void
*/
public function register_hooks() {
\add_action( 'admin_init', [ $this, 'check_php_version' ] );
}
/**
* Checks the current PHP version.
*
* @return void
*/
public function check_php_version() {
// If the user isn't an admin, don't display anything.
if ( ! $this->has_right_capabilities() ) {
return;
}
if ( ! $this->on_dashboard_page( $GLOBALS['pagenow'] ) ) {
return;
}
// Checks if the user is running at least PHP 7.2.
if ( $this->is_supported_php_version_installed() === false ) {
$this->show_unsupported_php_message();
}
}
/**
* Composes the body of the message to display.
*
* @return string The message to display.
*/
public function body() {
$message = [];
$message[] = MessageFormatter::strongParagraph( \__( 'Upgrade your PHP version', 'wordpress-seo' ) ) . '<br />';
$message[] = MessageFormatter::paragraph(
\sprintf(
/* translators: 1: Yoast SEO, 2: Yoast SEO Premium */
\__(
'By November 1st, 2024, well update the minimum PHP requirement for %1$s, %2$s and all our add-ons to PHP 7.4. This, to ensure we can keep delivering state of the art features.',
'wordpress-seo'
),
'Yoast SEO',
'Yoast SEO Premium'
)
) . '<br />';
$message[] = MessageFormatter::strongParagraph( \__( 'Cant upgrade yourself? Ask your host!', 'wordpress-seo' ) ) . '<br />';
$message[] = MessageFormatter::paragraph(
\sprintf(
/* translators: 1: Link tag to WordPress Hosts page on Yoast.com; 2: Link closing tag */
\__(
'Upgrading your PHP version is something your hosting provider can help you out with. If they cant upgrade your PHP version, we advise you to consider %1$sswitching to a hosting provider%2$s that can provide the security and features a modern host should provide.',
'wordpress-seo'
),
'<a href="' . WPSEO_Shortlinker::get( 'https://yoast.com/wordpress-hosting/' ) . '">',
'</a>'
)
) . '<br />';
return \implode( \PHP_EOL, $message );
}
/**
* Checks if the current user has the right capabilities.
*
* @return bool True when user has right capabilities.
*/
protected function has_right_capabilities() {
return \current_user_can( 'wpseo_manage_options' );
}
/**
* Whether we are on the admin dashboard page or in the Yoast dashboard page.
*
* We need to have the notice in the main admin otherwise the dismissal mechanism won't work.
*
* @param string $current_page The current page.
*
* @return bool True if current page is the index.php.
*/
protected function on_dashboard_page( $current_page ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
if ( $current_page === 'admin.php' && isset( $_GET['page'] ) && \sanitize_text_field( \wp_unslash( $_GET['page'] ) ) === 'wpseo_dashboard' ) {
return true;
}
return ( $current_page === 'index.php' );
}
/**
* Checks if the installed php version is supported.
*
* @codeCoverageIgnore
*
* @return bool True when the php version is support.
*/
protected function is_supported_php_version_installed() {
try {
$checker = new RequirementsChecker( [ 'php' => \PHP_VERSION ] );
$checker->addRequirement( VersionRequirement::fromCompareString( 'php', '>=7.4' ) );
$checker->check();
return $checker->hasMessages() === false;
}
catch ( InvalidVersionComparisonString $e ) {
return true;
}
catch ( InvalidType $e ) {
return true;
}
}
/**
* Creates a new message to display regarding the usage of PHP 7.3 (or lower).
*
* @codeCoverageIgnore
*
* @return void
*/
protected function show_unsupported_php_message() {
$presenter = new WPMessagePresenter(
$this,
new MessageDismisser( \time(), ( \WEEK_IN_SECONDS * 4 ), new WPDismissOption() ),
\__( 'Remind me again in 4 weeks.', 'wordpress-seo' )
);
$presenter->registerHooks();
}
}

View File

@@ -69,7 +69,6 @@ class Structured_Data_Blocks implements Integration_Interface {
* @return void
*/
public function register_hooks() {
\add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_assets' ] );
$this->register_blocks();
}
@@ -79,75 +78,6 @@ class Structured_Data_Blocks implements Integration_Interface {
* @return void
*/
public function register_blocks() {
\register_block_type(
'yoast/faq-block',
[
'render_callback' => [ $this, 'optimize_faq_images' ],
'attributes' => [
'className' => [
'default' => '',
'type' => 'string',
],
'questions' => [
'type' => 'array',
],
'additionalListCssClasses' => [
'type' => 'string',
],
],
]
);
\register_block_type(
'yoast/how-to-block',
[
'render_callback' => [ $this, 'optimize_how_to_images' ],
'attributes' => [
'hasDuration' => [
'type' => 'boolean',
],
'days' => [
'type' => 'string',
],
'hours' => [
'type' => 'string',
],
'minutes' => [
'type' => 'string',
],
'description' => [
'type' => 'array',
'source' => 'children',
'selector' => '.schema-how-to-description',
],
'jsonDescription' => [
'type' => 'string',
],
'steps' => [
'type' => 'array',
],
'additionalListCssClasses' => [
'type' => 'string',
],
'unorderedList' => [
'type' => 'boolean',
],
'durationText' => [
'type' => 'string',
],
'defaultDurationText' => [
'type' => 'string',
],
],
]
);
}
/**
* Enqueue Gutenberg block assets for backend editor.
*
* @return void
*/
public function enqueue_block_editor_assets() {
/**
* Filter: 'wpseo_enable_structured_data_blocks' - Allows disabling Yoast's schema blocks entirely.
*
@@ -157,8 +87,18 @@ class Structured_Data_Blocks implements Integration_Interface {
return;
}
$this->asset_manager->enqueue_script( 'structured-data-blocks' );
$this->asset_manager->enqueue_style( 'structured-data-blocks' );
\register_block_type(
\WPSEO_PATH . 'blocks/structured-data-blocks/faq/block.json',
[
'render_callback' => [ $this, 'optimize_faq_images' ],
]
);
\register_block_type(
\WPSEO_PATH . 'blocks/structured-data-blocks/how-to/block.json',
[
'render_callback' => [ $this, 'optimize_how_to_images' ],
]
);
}
/**
@@ -468,4 +408,18 @@ class Structured_Data_Blocks implements Integration_Interface {
$this->used_caches[ $post_id ] = $images;
}
}
/* DEPRECATED METHODS */
/**
* Enqueue Gutenberg block assets for backend editor.
*
* @deprecated 22.7
* @codeCoverageIgnore
*
* @return void
*/
public function enqueue_block_editor_assets() {
\_deprecated_function( __METHOD__, 'Yoast SEO 22.7' );
}
}

View File

@@ -134,7 +134,7 @@ class Cleanup_Integration implements Integration_Interface {
return $this->cleanup_repository->clean_indexables_for_object_type_and_source_table( 'terms', 'term_id', 'term', $limit );
},
],
$this->get_additional_tasks(),
$this->get_additional_indexable_cleanups(),
[
/* These should always be the last ones to be called. */
'clean_orphaned_content_indexable_hierarchy' => function ( $limit ) {
@@ -147,24 +147,53 @@ class Cleanup_Integration implements Integration_Interface {
return $this->cleanup_repository->cleanup_orphaned_from_table( 'SEO_Links', 'target_indexable_id', $limit );
},
]
],
$this->get_additional_misc_cleanups()
);
}
/**
* Gets additional tasks from the 'wpseo_cleanup_tasks' filter.
*
* @return Closure[] Associative array of cleanup functions.
* @return Closure[] Associative array of indexable cleanup functions.
*/
private function get_additional_tasks() {
private function get_additional_indexable_cleanups() {
/**
* Filter: Adds the possibility to add addition cleanup functions.
* Filter: Adds the possibility to add additional indexable cleanup functions.
*
* @param array $additional_tasks Associative array with unique keys. Value should be a cleanup function that receives a limit.
*/
$additional_tasks = \apply_filters( 'wpseo_cleanup_tasks', [] );
return $this->validate_additional_tasks( $additional_tasks );
}
/**
* Gets additional tasks from the 'wpseo_misc_cleanup_tasks' filter.
*
* @return Closure[] Associative array of indexable cleanup functions.
*/
private function get_additional_misc_cleanups() {
/**
* Filter: Adds the possibility to add additional non-indexable cleanup functions.
*
* @param array $additional_tasks Associative array with unique keys. Value should be a cleanup function that receives a limit.
*/
$additional_tasks = \apply_filters( 'wpseo_misc_cleanup_tasks', [] );
return $this->validate_additional_tasks( $additional_tasks );
}
/**
* Validates the additional tasks.
*
* @param Closure[] $additional_tasks The additional tasks to validate.
*
* @return Closure[] The validated additional tasks.
*/
private function validate_additional_tasks( $additional_tasks ) {
if ( ! \is_array( $additional_tasks ) ) {
return [];
}
@@ -214,14 +243,15 @@ class Cleanup_Integration implements Integration_Interface {
/**
* Starts the cleanup cron job.
*
* @param string $task_name The task name of the next cleanup task to run.
* @param string $task_name The task name of the next cleanup task to run.
* @param int $schedule_time The time in seconds to wait before running the first cron job. Default is 1 hour.
*
* @return void
*/
private function start_cron_job( $task_name ) {
public function start_cron_job( $task_name, $schedule_time = 3600 ) {
\update_option( self::CURRENT_TASK_OPTION, $task_name );
\wp_schedule_event(
( \time() + \HOUR_IN_SECONDS ),
( \time() + $schedule_time ),
'hourly',
self::CRON_HOOK
);

View File

@@ -108,7 +108,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* The Open Graph specific presenters that should be output on error pages.
*
* @var array
* @var array<string>
*/
protected $open_graph_error_presenters = [
'Open_Graph\Locale',
@@ -119,7 +119,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* The Twitter card specific presenters.
*
* @var string[]
* @var array<string>
*/
protected $twitter_card_presenters = [
'Twitter\Card',
@@ -133,7 +133,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* The Slack specific presenters.
*
* @var string[]
* @var array<string>
*/
protected $slack_presenters = [
'Slack\Enhanced_Data',
@@ -142,7 +142,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* The Webmaster verification specific presenters.
*
* @var string[]
* @var array<string>
*/
protected $webmaster_verification_presenters = [
'Webmaster\Baidu',
@@ -155,7 +155,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* Presenters that are only needed on singular pages.
*
* @var string[]
* @var array<string>
*/
protected $singular_presenters = [
'Meta_Author',
@@ -170,7 +170,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* The presenters we want to be last in our output.
*
* @var string[]
* @var array<string>
*/
protected $closing_presenters = [
'Schema',
@@ -193,7 +193,7 @@ class Front_End_Integration implements Integration_Interface {
/**
* Returns the conditionals based on which this loadable should be active.
*
* @return array The conditionals.
* @return array<string> The conditionals.
*/
public static function get_conditionals() {
return [ Front_End_Conditional::class ];
@@ -284,8 +284,8 @@ class Front_End_Integration implements Integration_Interface {
/**
* Filters the next and prev links in the query loop block.
*
* @param string $html The HTML output.
* @param array $block The block.
* @param string $html The HTML output.
* @param array<string|array|null> $block The block.
* @return string The filtered HTML output.
*/
public function query_loop_next_prev( $html, $block ) {
@@ -321,7 +321,7 @@ class Front_End_Integration implements Integration_Interface {
return $link;
}
if ( $rel === 'next' || $rel === 'prev' ) {
if ( ( $rel === 'next' || $rel === 'prev' ) && ( ! \is_null( $this->$rel ) ) ) {
// Reconstruct url if it's relative.
if ( \class_exists( WP_HTML_Tag_Processor::class ) ) {
$processor = new WP_HTML_Tag_Processor( $this->$rel );
@@ -340,9 +340,9 @@ class Front_End_Integration implements Integration_Interface {
/**
* Filters our robots presenter, but only when wp_robots is attached to the wp_head action.
*
* @param array $presenters The presenters for current page.
* @param array<string> $presenters The presenters for current page.
*
* @return array The filtered presenters.
* @return array<string> The filtered presenters.
*/
public function filter_robots_presenter( $presenters ) {
if ( ! \function_exists( 'wp_robots' ) ) {

View File

@@ -60,13 +60,14 @@ class Crawl_Cleanup_Rss implements Integration_Interface {
* @return void
*/
public function maybe_disable_feeds() {
if ( \is_singular() && $this->is_true( 'remove_feed_post_comments' )
if ( ( \is_singular() && $this->is_true( 'remove_feed_post_comments' ) )
|| ( \is_author() && $this->is_true( 'remove_feed_authors' ) )
|| ( \is_category() && $this->is_true( 'remove_feed_categories' ) )
|| ( \is_tag() && $this->is_true( 'remove_feed_tags' ) )
|| ( \is_tax() && $this->is_true( 'remove_feed_custom_taxonomies' ) )
|| ( \is_post_type_archive() && $this->is_true( 'remove_feed_post_types' ) )
|| ( \is_search() && $this->is_true( 'remove_feed_search' ) ) ) {
|| ( \is_search() && $this->is_true( 'remove_feed_search' ) )
) {
\remove_action( 'wp_head', 'feed_links_extra', 3 );
}
}

View File

@@ -21,14 +21,14 @@ class Indexable_Post_Meta_Watcher implements Integration_Interface {
/**
* An array of post IDs that need to be updated.
*
* @var array
* @var array<int>
*/
protected $post_ids_to_update = [];
/**
* Returns the conditionals based on which this loadable should be active.
*
* @return array
* @return string[]
*/
public static function get_conditionals() {
return [ Migrations_Conditional::class ];
@@ -78,7 +78,7 @@ class Indexable_Post_Meta_Watcher implements Integration_Interface {
*/
public function add_post_id( $meta_id, $post_id, $meta_key ) {
// Only register changes to our own meta.
if ( \strpos( $meta_key, WPSEO_Meta::$meta_prefix ) !== 0 ) {
if ( \is_string( $meta_key ) && \strpos( $meta_key, WPSEO_Meta::$meta_prefix ) !== 0 ) {
return;
}

View File

@@ -4,6 +4,7 @@ namespace Yoast\WP\SEO\Integrations\Watchers;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Conditionals\Not_Admin_Ajax_Conditional;
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
use Yoast\WP\SEO\Helpers\Notification_Helper;
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
@@ -42,6 +43,13 @@ class Woocommerce_Beta_Editor_Watcher implements Integration_Interface {
*/
protected $notification_helper;
/**
* The WooCommerce conditional.
*
* @var WooCommerce_Conditional
*/
protected $woocommerce_conditional;
/**
* The Woocommerce beta editor presenter.
*
@@ -52,19 +60,22 @@ class Woocommerce_Beta_Editor_Watcher implements Integration_Interface {
/**
* Woocommerce_Beta_Editor_Watcher constructor.
*
* @param Yoast_Notification_Center $notification_center The notification center.
* @param Notification_Helper $notification_helper The notification helper.
* @param Short_Link_Helper $short_link_helper The short link helper.
* @param Yoast_Notification_Center $notification_center The notification center.
* @param Notification_Helper $notification_helper The notification helper.
* @param Short_Link_Helper $short_link_helper The short link helper.
* @param WooCommerce_Conditional $woocommerce_conditional The WooCommerce conditional.
*/
public function __construct(
Yoast_Notification_Center $notification_center,
Notification_Helper $notification_helper,
Short_Link_Helper $short_link_helper
Short_Link_Helper $short_link_helper,
WooCommerce_Conditional $woocommerce_conditional
) {
$this->notification_center = $notification_center;
$this->notification_helper = $notification_helper;
$this->short_link_helper = $short_link_helper;
$this->presenter = new Woocommerce_Beta_Editor_Presenter( $this->short_link_helper );
$this->notification_center = $notification_center;
$this->notification_helper = $notification_helper;
$this->short_link_helper = $short_link_helper;
$this->woocommerce_conditional = $woocommerce_conditional;
$this->presenter = new Woocommerce_Beta_Editor_Presenter( $this->short_link_helper );
}
/**
@@ -95,7 +106,7 @@ class Woocommerce_Beta_Editor_Watcher implements Integration_Interface {
* @return void
*/
public function manage_woocommerce_beta_editor_notification() {
if ( \get_option( 'woocommerce_feature_product_block_editor_enabled' ) === 'yes' ) {
if ( \get_option( 'woocommerce_feature_product_block_editor_enabled' ) === 'yes' && $this->woocommerce_conditional->is_met() ) {
$this->maybe_add_woocommerce_beta_editor_notification();
}
else {

View File

@@ -385,7 +385,7 @@ class Indexable_Post_Type_Presentation extends Indexable_Presentation {
$twitter_creator = \ltrim( \trim( \get_the_author_meta( 'twitter', $this->source->post_author ) ), '@' );
/**
* Filter: 'wpseo_twitter_creator_account' - Allow changing the Twitter account as output in the Twitter card by Yoast SEO.
* Filter: 'wpseo_twitter_creator_account' - Allow changing the X account as output in the X card by Yoast SEO.
*
* @param string $twitter The twitter account name string.
*/

View File

@@ -28,8 +28,8 @@ class Enhanced_Data_Presenter extends Abstract_Indexable_Presenter {
$i = 1;
$class = \is_admin_bar_showing() ? ' class="yoast-seo-meta-tag"' : '';
foreach ( $enhanced_data as $label => $value ) {
$twitter_tags .= \sprintf( "\t" . '<meta name="twitter:label%1$d" content="%2$s"' . $class . ' />' . "\n", $i, $label );
$twitter_tags .= \sprintf( "\t" . '<meta name="twitter:data%1$d" content="%2$s"' . $class . ' />' . "\n", $i, $value );
$twitter_tags .= \sprintf( "\t" . '<meta name="twitter:label%1$d" content="%2$s"' . $class . ' />' . "\n", $i, \esc_attr( $label ) );
$twitter_tags .= \sprintf( "\t" . '<meta name="twitter:data%1$d" content="%2$s"' . $class . ' />' . "\n", $i, \esc_attr( $value ) );
++$i;
}

View File

@@ -0,0 +1,77 @@
<?php
namespace Yoast\WP\SEO\User_Meta\Application;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The collector to get additional contactmethods.
*
* @makePublic
*/
class Additional_Contactmethods_Collector {
/**
* All additional contactmethods.
*
* @var array<Additional_Contactmethod_Interface> $additional_contactmethods
*/
private $additional_contactmethods;
/**
* The constructor.
*
* @param Additional_Contactmethod_Interface ...$additional_contactmethods All additional contactmethods.
*/
public function __construct( Additional_Contactmethod_Interface ...$additional_contactmethods ) {
$this->additional_contactmethods = $additional_contactmethods;
}
/**
* Returns all the additional contactmethods.
*
* @return array<Additional_Contactmethod_Interface> All the additional contactmethods.
*/
public function get_additional_contactmethods(): array {
$additional_contactmethods = $this->additional_contactmethods;
/**
* Filter: Adds the possibility to add more additional contactmethods in the user profile.
*
* @param array<Additional_Contactmethod_Interface> $additional_contactmethods Array with additional contact method classes.
*/
return \apply_filters( 'wpseo_additional_contactmethods', $additional_contactmethods );
}
/**
* Returns the additional contactmethods key/value pairs.
*
* @return array<string, string> The additional contactmethods key/value pairs.
*/
public function get_additional_contactmethods_objects(): array {
$additional_contactmethods_objects = [];
$additional_contactmethods = $this->get_additional_contactmethods();
foreach ( $additional_contactmethods as $additional_contactmethod ) {
$additional_contactmethods_objects[ $additional_contactmethod->get_key() ] = $additional_contactmethod->get_label();
}
return $additional_contactmethods_objects;
}
/**
* Returns the additional contactmethods keys.
*
* @return array<string> The additional contactmethods keys.
*/
public function get_additional_contactmethods_keys(): array {
$additional_contactmethods_keys = [];
$additional_contactmethods = $this->get_additional_contactmethods();
foreach ( $additional_contactmethods as $additional_contactmethod ) {
$additional_contactmethods_keys[] = $additional_contactmethod->get_key();
}
return $additional_contactmethods_keys;
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace Yoast\WP\SEO\User_Meta\Application;
use Yoast\WP\SEO\User_Meta\Infrastructure\Cleanup_Repository;
/**
* Service with all usermeta cleanup queries.
*/
class Cleanup_Service {
/**
* The additional contactmethods collector.
*
* @var Additional_Contactmethods_Collector $additional_contactmethods_collector The additional contactmethods collector.
*/
private $additional_contactmethods_collector;
/**
* The custom meta collector.
*
* @var Custom_Meta_Collector $custom_meta_collector The custom meta collector.
*/
private $custom_meta_collector;
/**
* The cleanup repository.
*
* @var Cleanup_Repository $custom_meta_collector The custom meta repository.
*/
private $cleanup_repository;
/**
* The constructor.
*
* @param Additional_Contactmethods_Collector $additional_contactmethods_collector The additional contactmethods collector.
* @param Custom_Meta_Collector $custom_meta_collector The custom meta collector.
* @param Cleanup_Repository $cleanup_repository The cleanup repository.
*/
public function __construct(
Additional_Contactmethods_Collector $additional_contactmethods_collector,
Custom_Meta_Collector $custom_meta_collector,
Cleanup_Repository $cleanup_repository
) {
$this->additional_contactmethods_collector = $additional_contactmethods_collector;
$this->custom_meta_collector = $custom_meta_collector;
$this->cleanup_repository = $cleanup_repository;
}
/**
* Deletes selected empty usermeta.
*
* @param int $limit The limit we'll apply to the cleanups.
*
* @return int|bool The number of rows that was deleted or false if the query failed.
*/
public function cleanup_selected_empty_usermeta( int $limit ) {
$meta_to_check = $this->get_meta_to_check();
return $this->cleanup_repository->delete_empty_usermeta_query( $meta_to_check, $limit );
}
/**
* Gets which meta are going to be checked for emptiness.
*
* @return array<string> The meta to be checked for emptiness.
*/
private function get_meta_to_check() {
$additional_contactmethods = $this->additional_contactmethods_collector->get_additional_contactmethods_keys();
$custom_meta = $this->custom_meta_collector->get_non_empty_custom_meta();
return \array_merge( $additional_contactmethods, $custom_meta );
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Yoast\WP\SEO\User_Meta\Application;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The collector to get custom user meta.
*
* @makePublic
*/
class Custom_Meta_Collector {
/**
* All custom meta.
*
* @var array<Custom_Meta_Interface> $custom_meta
*/
private $custom_meta;
/**
* The constructor.
*
* @param Custom_Meta_Interface ...$custom_meta All custom meta.
*/
public function __construct( Custom_Meta_Interface ...$custom_meta ) {
$this->custom_meta = $custom_meta;
}
/**
* Returns all the custom meta.
*
* @return array<Custom_Meta_Interface> All the custom meta.
*/
public function get_custom_meta(): array {
return $this->custom_meta;
}
/**
* Returns the custom meta that can't be empty.
*
* @return array<string> The custom meta that can't be empty.
*/
public function get_non_empty_custom_meta(): array {
$non_empty_custom_meta = [];
foreach ( $this->custom_meta as $custom_meta ) {
if ( ! $custom_meta->is_empty_allowed() ) {
$non_empty_custom_meta[] = $custom_meta->get_key();
}
}
return $non_empty_custom_meta;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Yoast\WP\SEO\User_Meta\Domain;
/**
* This interface describes an additional contactmethod.
*/
interface Additional_Contactmethod_Interface {
/**
* Returns the key of the contactmethod.
*
* @return string
*/
public function get_key(): string;
/**
* Returns the label of the contactmethod field.
*
* @return string
*/
public function get_label(): string;
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Yoast\WP\SEO\User_Meta\Domain;
/**
* This interface describes a custom meta.
*/
interface Custom_Meta_Interface {
/**
* Returns the db key of the custom meta.
*
* @return string
*/
public function get_key(): string;
/**
* Returns the id of the custom meta's form field.
*
* @return string
*/
public function get_field_id(): string;
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool
*/
public function is_empty_allowed(): bool;
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Facebook contactmethod.
*/
class Facebook implements Additional_Contactmethod_Interface {
/**
* Returns the key of the Facebook contactmethod.
*
* @return string The key of the Facebook contactmethod.
*/
public function get_key(): string {
return 'facebook';
}
/**
* Returns the label of the Facebook field.
*
* @return string The label of the Facebook field.
*/
public function get_label(): string {
return \__( 'Facebook profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Instagram contactmethod.
*/
class Instagram implements Additional_Contactmethod_Interface {
/**
* Returns the key of the Instagram contactmethod.
*
* @return string The key of the Instagram contactmethod.
*/
public function get_key(): string {
return 'instagram';
}
/**
* Returns the label of the Instagram field.
*
* @return string The label of the Instagram field.
*/
public function get_label(): string {
return \__( 'Instagram profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Linkedin contactmethod.
*/
class Linkedin implements Additional_Contactmethod_Interface {
/**
* Returns the key of the Linkedin contactmethod.
*
* @return string The key of the Linkedin contactmethod.
*/
public function get_key(): string {
return 'linkedin';
}
/**
* Returns the label of the Linkedin field.
*
* @return string The label of the Linkedin field.
*/
public function get_label(): string {
return \__( 'LinkedIn profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Myspace contactmethod.
*/
class Myspace implements Additional_Contactmethod_Interface {
/**
* Returns the key of the MySpace contactmethod.
*
* @return string The key of the MySpace contactmethod.
*/
public function get_key(): string {
return 'myspace';
}
/**
* Returns the label of the MySpace field.
*
* @return string The label of the MySpace field.
*/
public function get_label(): string {
return \__( 'MySpace profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Pinterest contactmethod.
*/
class Pinterest implements Additional_Contactmethod_Interface {
/**
* Returns the key of the Pinterest contactmethod.
*
* @return string The key of the Pinterest contactmethod.
*/
public function get_key(): string {
return 'pinterest';
}
/**
* Returns the label of the Pinterest field.
*
* @return string The label of the Pinterest field.
*/
public function get_label(): string {
return \__( 'Pinterest profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Soundcloud contactmethod.
*/
class Soundcloud implements Additional_Contactmethod_Interface {
/**
* Returns the key of the SoundCloud contactmethod.
*
* @return string The key of the SoundCloud contactmethod.
*/
public function get_key(): string {
return 'soundcloud';
}
/**
* Returns the label of the SoundCloud field.
*
* @return string The label of the SoundCloud field.
*/
public function get_label(): string {
return \__( 'SoundCloud profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Tumblr contactmethod.
*/
class Tumblr implements Additional_Contactmethod_Interface {
/**
* Returns the key of the Tumblr contactmethod.
*
* @return string The key of the Tumblr contactmethod.
*/
public function get_key(): string {
return 'tumblr';
}
/**
* Returns the label of the Tumblr field.
*
* @return string The label of the Tumblr field.
*/
public function get_label(): string {
return \__( 'Tumblr profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Wikipedia contactmethod.
*/
class Wikipedia implements Additional_Contactmethod_Interface {
/**
* Returns the key of the Wikipedia contactmethod.
*
* @return string The key of the Wikipedia contactmethod.
*/
public function get_key(): string {
return 'wikipedia';
}
/**
* Returns the label of the Wikipedia field.
*
* @return string The label of the Wikipedia field.
*/
public function get_label(): string {
return \__( 'Wikipedia page about you', 'wordpress-seo' ) . '<br/><small>' . \__( '(if one exists)', 'wordpress-seo' ) . '</small>';
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The X contactmethod.
*/
class X implements Additional_Contactmethod_Interface {
/**
* Returns the key of the X contactmethod.
*
* @return string The key of the X contactmethod.
*/
public function get_key(): string {
return 'twitter';
}
/**
* Returns the label of the X field.
*
* @return string The label of the X field.
*/
public function get_label(): string {
return \__( 'X username (without @)', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,30 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Additional_Contactmethods;
use Yoast\WP\SEO\User_Meta\Domain\Additional_Contactmethod_Interface;
/**
* The Youtube contactmethod.
*/
class Youtube implements Additional_Contactmethod_Interface {
/**
* Returns the key of the YouTube contactmethod.
*
* @return string The key of the YouTube contactmethod.
*/
public function get_key(): string {
return 'youtube';
}
/**
* Returns the label of the YouTube field.
*
* @return string The label of the YouTube field.
*/
public function get_label(): string {
return \__( 'YouTube profile URL', 'wordpress-seo' );
}
}

View File

@@ -0,0 +1,39 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Custom_Meta;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The Author_Metadesc custom meta.
*/
class Author_Metadesc implements Custom_Meta_Interface {
/**
* Returns the db key of the Author_Metadesc custom meta.
*
* @return string The db key of the Author_Metadesc custom meta.
*/
public function get_key(): string {
return 'wpseo_metadesc';
}
/**
* Returns the id of the custom meta's form field.
*
* @return string The id of the custom meta's form field.
*/
public function get_field_id(): string {
return 'wpseo_author_metadesc';
}
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool Whether the custom meta is allowed to be empty.
*/
public function is_empty_allowed(): bool {
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Custom_Meta;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The Author_Title custom meta.
*/
class Author_Title implements Custom_Meta_Interface {
/**
* Returns the db key of the Author_Title custom meta.
*
* @return string The db key of the Author_Title custom meta.
*/
public function get_key(): string {
return 'wpseo_title';
}
/**
* Returns the id of the custom meta's form field.
*
* @return string The id of the custom meta's form field.
*/
public function get_field_id(): string {
return 'wpseo_author_title';
}
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool Whether the custom meta is allowed to be empty.
*/
public function is_empty_allowed(): bool {
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Custom_Meta;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The Content_Analysis_Disable custom meta.
*/
class Content_Analysis_Disable implements Custom_Meta_Interface {
/**
* Returns the db key of the Content_Analysis_Disable custom meta.
*
* @return string The db key of the Content_Analysis_Disable custom meta.
*/
public function get_key(): string {
return 'wpseo_content_analysis_disable';
}
/**
* Returns the id of the custom meta's form field.
*
* @return string The id of the custom meta's form field.
*/
public function get_field_id(): string {
return 'wpseo_content_analysis_disable';
}
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool Whether the custom meta is allowed to be empty.
*/
public function is_empty_allowed(): bool {
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Custom_Meta;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The Inclusive_Language_Analysis_Disable custom meta.
*/
class Inclusive_Language_Analysis_Disable implements Custom_Meta_Interface {
/**
* Returns the db key of the Inclusive_Language_Analysis_Disable custom meta.
*
* @return string The db key of the Inclusive_Language_Analysis_Disable custom meta.
*/
public function get_key(): string {
return 'wpseo_inclusive_language_analysis_disable';
}
/**
* Returns the id of the custom meta's form field.
*
* @return string The id of the custom meta's form field.
*/
public function get_field_id(): string {
return 'wpseo_inclusive_language_analysis_disable';
}
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool Whether the custom meta is allowed to be empty.
*/
public function is_empty_allowed(): bool {
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Custom_Meta;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The Keyword_Analysis_Disable custom meta.
*/
class Keyword_Analysis_Disable implements Custom_Meta_Interface {
/**
* Returns the db key of the Keyword_Analysis_Disable custom meta.
*
* @return string The db key of the Keyword_Analysis_Disable custom meta.
*/
public function get_key(): string {
return 'wpseo_keyword_analysis_disable';
}
/**
* Returns the id of the custom meta's form field.
*
* @return string The id of the custom meta's form field.
*/
public function get_field_id(): string {
return 'wpseo_keyword_analysis_disable';
}
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool Whether the custom meta is allowed to be empty.
*/
public function is_empty_allowed(): bool {
return true;
}
}

View File

@@ -0,0 +1,39 @@
<?php
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
namespace Yoast\WP\SEO\User_Meta\Framework\Custom_Meta;
use Yoast\WP\SEO\User_Meta\Domain\Custom_Meta_Interface;
/**
* The Noindex_Author custom meta.
*/
class Noindex_Author implements Custom_Meta_Interface {
/**
* Returns the db key of the Noindex_Author custom meta.
*
* @return string The db key of the Noindex_Author custom meta.
*/
public function get_key(): string {
return 'wpseo_noindex_author';
}
/**
* Returns the id of the custom meta's form field.
*
* @return string The id of the custom meta's form field.
*/
public function get_field_id(): string {
return 'wpseo_noindex_author';
}
/**
* Returns whether the custom meta is allowed to be empty.
*
* @return bool Whether the custom meta is allowed to be empty.
*/
public function is_empty_allowed(): bool {
return false;
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Yoast\WP\SEO\User_Meta\Infrastructure;
/**
* Repository going into the database to clean up.
*/
class Cleanup_Repository {
/**
* Deletes empty usermeta based on their meta_keys and returns the number of the deleted meta.
*
* @param array<string> $meta_keys The meta to be potentially deleted.
* @param int $limit The number of maximum deletions.
*
* @return int|false The number of rows that was deleted or false if the query failed.
*/
public function delete_empty_usermeta_query( $meta_keys, $limit ) {
global $wpdb;
// phpcs:disable WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- Reason: we're passing an array instead.
$delete_query = $wpdb->prepare(
'DELETE FROM %i
WHERE meta_key IN ( ' . \implode( ', ', \array_fill( 0, \count( $meta_keys ), '%s' ) ) . ' )
AND meta_value = ""
ORDER BY user_id
LIMIT %d',
\array_merge( [ $wpdb->usermeta ], $meta_keys, [ $limit ] )
);
// phpcs:enable
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
return $wpdb->query( $delete_query );
// phpcs:enable
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace Yoast\WP\SEO\User_Meta\User_Interface;
use Yoast\WP\SEO\Conditionals\No_Conditionals;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\User_Meta\Application\Additional_Contactmethods_Collector;
/**
* Handles registering and saving additional contactmethods for users.
*/
class Additional_Contactmethods_Integration implements Integration_Interface {
use No_Conditionals;
/**
* The additional contactmethods collector.
*
* @var Additional_Contactmethods_Collector $additional_contactmethods_collector The additional contactmethods collector.
*/
private $additional_contactmethods_collector;
/**
* The constructor.
*
* @param Additional_Contactmethods_Collector $additional_contactmethods_collector The additional contactmethods collector.
*/
public function __construct( Additional_Contactmethods_Collector $additional_contactmethods_collector ) {
$this->additional_contactmethods_collector = $additional_contactmethods_collector;
}
/**
* Registers action hook.
*
* @return void
*/
public function register_hooks(): void {
\add_filter( 'user_contactmethods', [ $this, 'update_contactmethods' ] );
\add_filter( 'update_user_metadata', [ $this, 'stop_storing_empty_metadata' ], 10, 4 );
}
/**
* Updates the contactmethods with an additional set of social profiles.
*
* These are used with the Facebook author, rel="author", Twitter cards implementation, but also in the `sameAs` schema attributes.
*
* @param array<string, string> $contactmethods Currently set contactmethods.
*
* @return array<string, string> Contactmethods with added contactmethods.
*/
public function update_contactmethods( $contactmethods ) {
$additional_contactmethods = $this->additional_contactmethods_collector->get_additional_contactmethods_objects();
return \array_merge( $contactmethods, $additional_contactmethods );
}
/**
* Returns a check value, which will stop empty contactmethods from going into the database.
*
* @param bool|null $check Whether to allow updating metadata for the given type.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
*
* @return false|null False for when we are to filter out empty metadata, null for no filtering.
*/
public function stop_storing_empty_metadata( $check, $object_id, $meta_key, $meta_value ) {
$additional_contactmethods = $this->additional_contactmethods_collector->get_additional_contactmethods_keys();
if ( \in_array( $meta_key, $additional_contactmethods, true ) && $meta_value === '' ) {
\delete_user_meta( $object_id, $meta_key );
return false;
}
return $check;
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace Yoast\WP\SEO\User_Meta\User_Interface;
use Yoast\WP\SEO\Conditionals\No_Conditionals;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\User_Meta\Application\Cleanup_Service;
/**
* Handles the cleanup for user meta.
*/
class Cleanup_Integration implements Integration_Interface {
use No_Conditionals;
/**
* The cleanup service.
*
* @var Cleanup_Service $cleanup_service The cleanup service.
*/
private $cleanup_service;
/**
* The constructor.
*
* @param Cleanup_Service $cleanup_service The cleanup service.
*/
public function __construct( Cleanup_Service $cleanup_service ) {
$this->cleanup_service = $cleanup_service;
}
/**
* Registers action hook.
*
* @return void
*/
public function register_hooks(): void {
\add_filter( 'wpseo_misc_cleanup_tasks', [ $this, 'add_user_meta_cleanup_tasks' ] );
}
/**
* Adds cleanup tasks for the cleanup integration.
*
* @param Closure[] $tasks Array of tasks to be added.
*
* @return Closure[] An associative array of tasks to be added to the cleanup integration.
*/
public function add_user_meta_cleanup_tasks( $tasks ) {
return \array_merge(
$tasks,
[
'clean_selected_empty_usermeta' => function ( $limit ) {
return $this->cleanup_service->cleanup_selected_empty_usermeta( $limit );
},
]
);
}
}

View File

@@ -0,0 +1,81 @@
<?php
namespace Yoast\WP\SEO\User_Meta\User_Interface;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Conditionals\User_Can_Edit_Users_Conditional;
use Yoast\WP\SEO\Conditionals\User_Edit_Conditional;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\User_Meta\Application\Custom_Meta_Collector;
/**
* Handles custom meta for users.
*/
class Custom_Meta_Integration implements Integration_Interface {
/**
* The custom meta collector.
*
* @var Custom_Meta_Collector $custom_meta_collector The custom meta collector.
*/
private $custom_meta_collector;
/**
* The constructor.
*
* @param Custom_Meta_Collector $custom_meta_collector The custom meta collector.
*/
public function __construct( Custom_Meta_Collector $custom_meta_collector ) {
$this->custom_meta_collector = $custom_meta_collector;
}
/**
* Retrieves the conditionals for the integration.
*
* @return array<Yoast\WP\SEO\Conditionals> The conditionals.
*/
public static function get_conditionals() {
return [
Admin_Conditional::class,
User_Can_Edit_Users_Conditional::class,
User_Edit_Conditional::class,
];
}
/**
* Registers action hook.
*
* @return void
*/
public function register_hooks(): void {
\add_action( 'personal_options_update', [ $this, 'process_user_option_update' ] );
\add_action( 'edit_user_profile_update', [ $this, 'process_user_option_update' ] );
}
/**
* Updates the user metas that (might) have been set on the user profile page.
*
* @param int $user_id User ID of the updated user.
*
* @return void
*/
public function process_user_option_update( $user_id ) {
\update_user_meta( $user_id, '_yoast_wpseo_profile_updated', \time() );
if ( ! \check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' ) ) {
return;
}
foreach ( $this->custom_meta_collector->get_custom_meta() as $meta ) {
$meta_field_id = $meta->get_field_id();
$user_input_to_store = isset( $_POST[ $meta_field_id ] ) ? \sanitize_text_field( \wp_unslash( $_POST[ $meta_field_id ] ) ) : '';
if ( $meta->is_empty_allowed() || $user_input_to_store !== '' ) {
\update_user_meta( $user_id, $meta->get_key(), $user_input_to_store );
continue;
}
\delete_user_meta( $user_id, $meta->get_key() );
}
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Yoast\WP\SEO\Values\Twitter;
use Yoast\WP\SEO\Helpers\Twitter\Image_Helper as Twitter_Image_Helper;
use Yoast\WP\SEO\Values\Images as Base_Images;
/**
* Value object for the twitter Images.
*/
class Images extends Base_Images {
/**
* The twitter image helper.
*
* @var Twitter_Image_Helper
*/
protected $twitter_image;
/**
* Sets the helpers.
*
* @required
*
* @codeCoverageIgnore - Is handled by DI-container.
*
* @param Twitter_Image_Helper $twitter_image Image helper for twitter.
*
* @return void
*/
public function set_helpers( Twitter_Image_Helper $twitter_image ) {
$this->twitter_image = $twitter_image;
}
/**
* Adds an image to the list by image ID.
*
* @param int $image_id The image ID to add.
*
* @return void
*/
public function add_image_by_id( $image_id ) {
$attachment = $this->twitter_image->get_by_id( $image_id );
if ( $attachment ) {
$this->add_image( $attachment );
}
}
}