Merged in feature/314-dev-dev01 (pull request #24)

auto-patch  314-dev-dev01-2024-01-25T04_09_02

* auto-patch  314-dev-dev01-2024-01-25T04_09_02
This commit is contained in:
Tony Volpe
2024-01-25 04:11:47 +00:00
parent 6b67473553
commit 68dbe860e9
540 changed files with 3445 additions and 2131 deletions

View File

@@ -9,7 +9,7 @@ use Yoast\WP\SEO\Helpers\User_Helper;
*/
class Alert_Dismissal_Action {
const USER_META_KEY = '_yoast_alerts_dismissed';
public const USER_META_KEY = '_yoast_alerts_dismissed';
/**
* Holds the user helper instance.
@@ -196,7 +196,7 @@ class Alert_Dismissal_Action {
/**
* Filter: 'wpseo_allowed_dismissable_alerts' - List of allowed dismissable alerts.
*
* @api string[] $allowed_dismissable_alerts Allowed dismissable alerts list.
* @param string[] $allowed_dismissable_alerts Allowed dismissable alerts list.
*/
$allowed_dismissable_alerts = \apply_filters( 'wpseo_allowed_dismissable_alerts', [] );

View File

@@ -13,7 +13,7 @@ class First_Time_Configuration_Action {
/**
* The fields for the site representation payload.
*/
const SITE_REPRESENTATION_FIELDS = [
public const SITE_REPRESENTATION_FIELDS = [
'company_or_person',
'company_name',
'website_name',
@@ -78,9 +78,9 @@ class First_Time_Configuration_Action {
/**
* Action: 'wpseo_post_update_site_representation' - Allows for Hiive event tracking.
*
* @param array The new values of the options.
* @param array The old values of the options.
* @param array The options that failed to be saved.
* @param array $params The new values of the options.
* @param array $old_values The old values of the options.
* @param array $failures The options that failed to be saved.
*
* @internal
*/
@@ -115,9 +115,9 @@ class First_Time_Configuration_Action {
/**
* Action: 'wpseo_post_update_social_profiles' - Allows for Hiive event tracking.
*
* @param array The new values of the options.
* @param array The old values of the options.
* @param array The options that failed to be saved.
* @param array $params The new values of the options.
* @param array $old_values The old values of the options.
* @param array $failures The options that failed to be saved.
*
* @internal
*/
@@ -206,9 +206,9 @@ class First_Time_Configuration_Action {
/**
* Action: 'wpseo_post_update_enable_tracking' - Allows for Hiive event tracking.
*
* @param array The new value.
* @param array The old value.
* @param bool Whether the option failed to be stored.
* @param array $new_value The new value.
* @param array $old_value The old value.
* @param bool $failure Whether the option failed to be stored.
*
* @internal
*/
@@ -332,7 +332,7 @@ class First_Time_Configuration_Action {
*
* @return array The old values.
*/
private function get_old_values( array $fields_names ) : array {
private function get_old_values( array $fields_names ): array {
$old_values = [];
foreach ( $fields_names as $field_name ) {

View File

@@ -21,14 +21,14 @@ abstract class Abstract_Aioseo_Importing_Action implements Importing_Action_Inte
*
* @var string
*/
const PLUGIN = null;
public const PLUGIN = null;
/**
* The type the class deals with.
*
* @var string
*/
const TYPE = null;
public const TYPE = null;
/**
* The AIOSEO helper.
@@ -111,6 +111,8 @@ abstract class Abstract_Aioseo_Importing_Action implements Importing_Action_Inte
* @required
*
* @param Aioseo_Helper $aioseo_helper The AIOSEO helper.
*
* @return void
*/
public function set_aioseo_helper( Aioseo_Helper $aioseo_helper ) {
$this->aioseo_helper = $aioseo_helper;
@@ -124,7 +126,7 @@ abstract class Abstract_Aioseo_Importing_Action implements Importing_Action_Inte
* @throws Exception If the PLUGIN constant is not set in the child class.
*/
public function get_plugin() {
$class = \get_class( $this );
$class = static::class;
$plugin = $class::PLUGIN;
if ( $plugin === null ) {
@@ -142,7 +144,7 @@ abstract class Abstract_Aioseo_Importing_Action implements Importing_Action_Inte
* @throws Exception If the TYPE constant is not set in the child class.
*/
public function get_type() {
$class = \get_class( $this );
$class = static::class;
$type = $class::TYPE;
if ( $type === null ) {

View File

@@ -17,19 +17,19 @@ abstract class Abstract_Aioseo_Settings_Importing_Action extends Abstract_Aioseo
*
* @var string
*/
const PLUGIN = null;
public const PLUGIN = null;
/**
* The type the class deals with.
*
* @var string
*/
const TYPE = null;
public const TYPE = null;
/**
* The option_name of the AIOSEO option that contains the settings.
*/
const SOURCE_OPTION_NAME = null;
public const SOURCE_OPTION_NAME = null;
/**
* The map of aioseo_options to yoast settings.
@@ -74,6 +74,8 @@ abstract class Abstract_Aioseo_Settings_Importing_Action extends Abstract_Aioseo
* @required
*
* @param Import_Helper $import_helper The import helper.
*
* @return void
*/
public function set_import_helper( Import_Helper $import_helper ) {
$this->import_helper = $import_helper;
@@ -232,7 +234,7 @@ abstract class Abstract_Aioseo_Settings_Importing_Action extends Abstract_Aioseo
/**
* Filter 'wpseo_aioseo_<identifier>_import_cursor' - Allow filtering the value of the aioseo settings import cursor.
*
* @api int The value of the aioseo posttype default settings import cursor.
* @param int $import_cursor The value of the aioseo posttype default settings import cursor.
*/
$cursor = \apply_filters( 'wpseo_aioseo_' . $this->get_type() . '_import_cursor', $cursor );
@@ -257,7 +259,7 @@ abstract class Abstract_Aioseo_Settings_Importing_Action extends Abstract_Aioseo
/**
* Filter 'wpseo_aioseo_<identifier>_indexation_limit' - Allow filtering the number of settings imported during each importing pass.
*
* @api int The maximum number of posts indexed.
* @param int $max_posts The maximum number of posts indexed.
*/
$limit = \apply_filters( 'wpseo_aioseo_' . $this->get_type() . '_indexation_limit', 25 );

View File

@@ -15,12 +15,12 @@ class Aioseo_Cleanup_Action extends Abstract_Aioseo_Importing_Action {
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'cleanup';
public const TYPE = 'cleanup';
/**
* The AIOSEO meta_keys to be cleaned up.
@@ -163,7 +163,7 @@ class Aioseo_Cleanup_Action extends Abstract_Aioseo_Importing_Action {
/**
* Filter 'wpseo_aioseo_cleanup_limit' - Allow filtering the number of posts indexed during each indexing pass.
*
* @api int The maximum number of posts cleaned up.
* @param int $max_posts The maximum number of posts cleaned up.
*/
$limit = \apply_filters( 'wpseo_aioseo_cleanup_limit', 25 );

View File

@@ -21,17 +21,17 @@ class Aioseo_Custom_Archive_Settings_Importing_Action extends Abstract_Aioseo_Se
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'custom_archive_settings';
public const TYPE = 'custom_archive_settings';
/**
* The option_name of the AIOSEO option that contains the settings.
*/
const SOURCE_OPTION_NAME = 'aioseo_options_dynamic';
public const SOURCE_OPTION_NAME = 'aioseo_options_dynamic';
/**
* The map of aioseo_options to yoast settings.

View File

@@ -13,17 +13,17 @@ class Aioseo_Default_Archive_Settings_Importing_Action extends Abstract_Aioseo_S
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'default_archive_settings';
public const TYPE = 'default_archive_settings';
/**
* The option_name of the AIOSEO option that contains the settings.
*/
const SOURCE_OPTION_NAME = 'aioseo_options';
public const SOURCE_OPTION_NAME = 'aioseo_options';
/**
* The map of aioseo_options to yoast settings.

View File

@@ -19,17 +19,17 @@ class Aioseo_General_Settings_Importing_Action extends Abstract_Aioseo_Settings_
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'general_settings';
public const TYPE = 'general_settings';
/**
* The option_name of the AIOSEO option that contains the settings.
*/
const SOURCE_OPTION_NAME = 'aioseo_options';
public const SOURCE_OPTION_NAME = 'aioseo_options';
/**
* The map of aioseo_options to yoast settings.

View File

@@ -26,12 +26,12 @@ class Aioseo_Posts_Importing_Action extends Abstract_Aioseo_Importing_Action {
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'posts';
public const TYPE = 'posts';
/**
* The map of aioseo to yoast meta.
@@ -188,7 +188,8 @@ class Aioseo_Posts_Importing_Action extends Abstract_Aioseo_Importing_Action {
Aioseo_Replacevar_Service $replacevar_handler,
Aioseo_Robots_Provider_Service $robots_provider,
Aioseo_Robots_Transformer_Service $robots_transformer,
Aioseo_Social_Images_Provider_Service $social_images_provider ) {
Aioseo_Social_Images_Provider_Service $social_images_provider
) {
parent::__construct( $import_cursor, $options, $sanitization, $replacevar_handler, $robots_provider, $robots_transformer );
$this->indexable_repository = $indexable_repository;
@@ -379,7 +380,7 @@ class Aioseo_Posts_Importing_Action extends Abstract_Aioseo_Importing_Action {
/**
* Filter 'wpseo_aioseo_post_indexation_limit' - Allow filtering the number of posts indexed during each indexing pass.
*
* @api int The maximum number of posts indexed.
* @param int $max_posts The maximum number of posts indexed.
*/
$limit = \apply_filters( 'wpseo_aioseo_post_indexation_limit', 25 );
@@ -444,7 +445,7 @@ class Aioseo_Posts_Importing_Action extends Abstract_Aioseo_Importing_Action {
/**
* Filter 'wpseo_aioseo_post_cursor' - Allow filtering the value of the aioseo post import cursor.
*
* @api int The value of the aioseo post import cursor.
* @param int $import_cursor The value of the aioseo post import cursor.
*/
$cursor = \apply_filters( 'wpseo_aioseo_post_import_cursor', $cursor );

View File

@@ -13,17 +13,17 @@ class Aioseo_Posttype_Defaults_Settings_Importing_Action extends Abstract_Aioseo
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'posttype_default_settings';
public const TYPE = 'posttype_default_settings';
/**
* The option_name of the AIOSEO option that contains the settings.
*/
const SOURCE_OPTION_NAME = 'aioseo_options_dynamic';
public const SOURCE_OPTION_NAME = 'aioseo_options_dynamic';
/**
* The map of aioseo_options to yoast settings.

View File

@@ -11,17 +11,17 @@ class Aioseo_Taxonomy_Settings_Importing_Action extends Abstract_Aioseo_Settings
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'taxonomy_settings';
public const TYPE = 'taxonomy_settings';
/**
* The option_name of the AIOSEO option that contains the settings.
*/
const SOURCE_OPTION_NAME = 'aioseo_options_dynamic';
public const SOURCE_OPTION_NAME = 'aioseo_options_dynamic';
/**
* The map of aioseo_options to yoast settings.

View File

@@ -16,12 +16,12 @@ class Aioseo_Validate_Data_Action extends Abstract_Aioseo_Importing_Action {
/**
* The plugin of the action.
*/
const PLUGIN = 'aioseo';
public const PLUGIN = 'aioseo';
/**
* The type of the action.
*/
const TYPE = 'validate_data';
public const TYPE = 'validate_data';
/**
* The WordPress database instance.
@@ -242,7 +242,7 @@ class Aioseo_Validate_Data_Action extends Abstract_Aioseo_Importing_Action {
/**
* Filter 'wpseo_aioseo_cleanup_limit' - Allow filtering the number of validations during each action pass.
*
* @api int The maximum number of validations.
* @param int $limit The maximum number of validations.
*/
$limit = \apply_filters( 'wpseo_aioseo_validation_limit', 25 );

View File

@@ -22,14 +22,14 @@ class Deactivate_Conflicting_Plugins_Action extends Abstract_Aioseo_Importing_Ac
*
* @var string
*/
const PLUGIN = 'conflicting-plugins';
public const PLUGIN = 'conflicting-plugins';
/**
* The type the class deals with.
*
* @var string
*/
const TYPE = 'deactivation';
public const TYPE = 'deactivation';
/**
* The replacevar handler.
@@ -80,6 +80,8 @@ class Deactivate_Conflicting_Plugins_Action extends Abstract_Aioseo_Importing_Ac
/**
* Get the total number of conflicting plugins.
*
* @return int
*/
public function get_total_unindexed() {
return \count( $this->get_detected_plugins() );
@@ -98,6 +100,8 @@ class Deactivate_Conflicting_Plugins_Action extends Abstract_Aioseo_Importing_Ac
/**
* Deactivate conflicting plugins.
*
* @return array
*/
public function index() {
$detected_plugins = $this->get_detected_plugins();

View File

@@ -14,14 +14,14 @@ abstract class Abstract_Indexing_Action implements Indexation_Action_Interface,
*
* @var string
*/
const UNINDEXED_COUNT_TRANSIENT = null;
public const UNINDEXED_COUNT_TRANSIENT = null;
/**
* The transient cache key for limited counts.
*
* @var string
*/
const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
public const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
/**
* Builds a query for selecting the ID's of unindexed posts.

View File

@@ -98,7 +98,7 @@ abstract class Abstract_Link_Indexing_Action extends Abstract_Indexing_Action {
/**
* Filter 'wpseo_link_indexing_limit' - Allow filtering the number of texts indexed during each link indexing pass.
*
* @api int The maximum number of texts indexed.
* @param int $limit The maximum number of texts indexed.
*/
return \apply_filters( 'wpseo_link_indexing_limit', 5 );
}

View File

@@ -13,7 +13,7 @@ class Indexable_General_Indexation_Action implements Indexation_Action_Interface
/**
* The transient cache key.
*/
const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_general_items';
public const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_general_items';
/**
* Represents the indexables repository.

View File

@@ -20,14 +20,14 @@ class Indexable_Post_Indexation_Action extends Abstract_Indexing_Action {
*
* @var string
*/
const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_posts';
public const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_posts';
/**
* The transient cache key for limited counts.
*
* @var string
*/
const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
public const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
/**
* The post type helper.
@@ -120,7 +120,7 @@ class Indexable_Post_Indexation_Action extends Abstract_Indexing_Action {
/**
* Filter 'wpseo_post_indexation_limit' - Allow filtering the amount of posts indexed during each indexing pass.
*
* @api int The maximum number of posts indexed.
* @param int $limit The maximum number of posts indexed.
*/
$limit = \apply_filters( 'wpseo_post_indexation_limit', 25 );

View File

@@ -19,7 +19,7 @@ class Indexable_Post_Type_Archive_Indexation_Action implements Indexation_Action
/**
* The transient cache key.
*/
const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_post_type_archives';
public const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_post_type_archives';
/**
* The post type helper.
@@ -127,7 +127,7 @@ class Indexable_Post_Type_Archive_Indexation_Action implements Indexation_Action
/**
* Filter 'wpseo_post_type_archive_indexation_limit' - Allow filtering the number of posts indexed during each indexing pass.
*
* @api int The maximum number of posts indexed.
* @param int $limit The maximum number of posts indexed.
*/
$limit = \apply_filters( 'wpseo_post_type_archive_indexation_limit', 25 );
@@ -192,7 +192,7 @@ class Indexable_Post_Type_Archive_Indexation_Action implements Indexation_Action
return [];
}
$callback = static function( $result ) {
$callback = static function ( $result ) {
return $result['object_sub_type'];
};

View File

@@ -17,14 +17,14 @@ class Indexable_Term_Indexation_Action extends Abstract_Indexing_Action {
/**
* The transient cache key.
*/
const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_terms';
public const UNINDEXED_COUNT_TRANSIENT = 'wpseo_total_unindexed_terms';
/**
* The transient cache key for limited counts.
*
* @var string
*/
const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
public const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
/**
* The post type helper.
@@ -107,7 +107,7 @@ class Indexable_Term_Indexation_Action extends Abstract_Indexing_Action {
/**
* Filter 'wpseo_term_indexation_limit' - Allow filtering the number of terms indexed during each indexing pass.
*
* @api int The maximum number of terms indexed.
* @param int $limit The maximum number of terms indexed.
*/
$limit = \apply_filters( 'wpseo_term_indexation_limit', 25 );

View File

@@ -15,14 +15,14 @@ class Post_Link_Indexing_Action extends Abstract_Link_Indexing_Action {
*
* @var string
*/
const UNINDEXED_COUNT_TRANSIENT = 'wpseo_unindexed_post_link_count';
public const UNINDEXED_COUNT_TRANSIENT = 'wpseo_unindexed_post_link_count';
/**
* The transient cache key for limited counts.
*
* @var string
*/
const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
public const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
/**
* The post type helper.

View File

@@ -15,14 +15,14 @@ class Term_Link_Indexing_Action extends Abstract_Link_Indexing_Action {
*
* @var string
*/
const UNINDEXED_COUNT_TRANSIENT = 'wpseo_unindexed_term_link_count';
public const UNINDEXED_COUNT_TRANSIENT = 'wpseo_unindexed_term_link_count';
/**
* The transient cache key for limited counts.
*
* @var string
*/
const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
public const UNINDEXED_LIMITED_COUNT_TRANSIENT = self::UNINDEXED_COUNT_TRANSIENT . '_limited';
/**
* The post type helper.

View File

@@ -49,6 +49,8 @@ class SEMrush_Login_Action {
/**
* Performs the login request, if necessary.
*
* @return void
*/
public function login() {
if ( $this->client->has_valid_tokens() ) {

View File

@@ -13,14 +13,14 @@ class SEMrush_Phrases_Action {
/**
* The transient cache key.
*/
const TRANSIENT_CACHE_KEY = 'wpseo_semrush_related_keyphrases_%s_%s';
public const TRANSIENT_CACHE_KEY = 'wpseo_semrush_related_keyphrases_%s_%s';
/**
* The SEMrush keyphrase URL.
*
* @var string
*/
const KEYPHRASES_URL = 'https://oauth.semrush.com/api/v1/keywords/phrase_fullsearch';
public const KEYPHRASES_URL = 'https://oauth.semrush.com/api/v1/keywords/phrase_fullsearch';
/**
* The SEMrush_Client instance.

View File

@@ -2,6 +2,7 @@
namespace Yoast\WP\SEO\Actions\Wincher;
use Exception;
use Yoast\WP\SEO\Config\Wincher_Client;
use Yoast\WP\SEO\Helpers\Options_Helper;
@@ -10,8 +11,8 @@ use Yoast\WP\SEO\Helpers\Options_Helper;
*/
class Wincher_Account_Action {
const ACCOUNT_URL = 'https://api.wincher.com/beta/account';
const UPGRADE_CAMPAIGN_URL = 'https://api.wincher.com/v1/yoast/upgrade-campaign';
public const ACCOUNT_URL = 'https://api.wincher.com/beta/account';
public const UPGRADE_CAMPAIGN_URL = 'https://api.wincher.com/v1/yoast/upgrade-campaign';
/**
* The Wincher_Client instance.
@@ -59,7 +60,7 @@ class Wincher_Account_Action {
'historyDays' => $history,
'status' => 200,
];
} catch ( \Exception $e ) {
} catch ( Exception $e ) {
return (object) [
'status' => $e->getCode(),
'error' => $e->getMessage(),
@@ -75,9 +76,9 @@ class Wincher_Account_Action {
public function get_upgrade_campaign() {
try {
$result = $this->client->get( self::UPGRADE_CAMPAIGN_URL );
$type = isset( $result['type'] ) ? $result['type'] : null;
$months = isset( $result['months'] ) ? $result['months'] : null;
$discount = isset( $result['value'] ) ? $result['value'] : null;
$type = ( $result['type'] ?? null );
$months = ( $result['months'] ?? null );
$discount = ( $result['value'] ?? null );
// We display upgrade discount only if it's a rate discount and positive months/discount.
if ( $type === 'RATE' && $months && $discount ) {
@@ -94,7 +95,7 @@ class Wincher_Account_Action {
'months' => null,
'status' => 200,
];
} catch ( \Exception $e ) {
} catch ( Exception $e ) {
return (object) [
'status' => $e->getCode(),
'error' => $e->getMessage(),

View File

@@ -19,21 +19,21 @@ class Wincher_Keyphrases_Action {
*
* @var string
*/
const KEYPHRASES_ADD_URL = 'https://api.wincher.com/beta/websites/%s/keywords/bulk';
public const KEYPHRASES_ADD_URL = 'https://api.wincher.com/beta/websites/%s/keywords/bulk';
/**
* The Wincher tracked keyphrase retrieval URL.
*
* @var string
*/
const KEYPHRASES_URL = 'https://api.wincher.com/beta/yoast/%s';
public const KEYPHRASES_URL = 'https://api.wincher.com/beta/yoast/%s';
/**
* The Wincher delete tracked keyphrase URL.
*
* @var string
*/
const KEYPHRASE_DELETE_URL = 'https://api.wincher.com/beta/websites/%s/keywords/%s';
public const KEYPHRASE_DELETE_URL = 'https://api.wincher.com/beta/websites/%s/keywords/%s';
/**
* The Wincher_Client instance.
@@ -125,7 +125,7 @@ class Wincher_Keyphrases_Action {
// The endpoint returns a lot of stuff that we don't want/need.
$results['data'] = \array_map(
static function( $keyphrase ) {
static function ( $keyphrase ) {
return [
'id' => $keyphrase['id'],
'keyword' => $keyphrase['keyword'],
@@ -312,7 +312,7 @@ class Wincher_Keyphrases_Action {
protected function filter_results_by_used_keyphrases( $results, $used_keyphrases ) {
return \array_filter(
$results,
static function( $result ) use ( $used_keyphrases ) {
static function ( $result ) use ( $used_keyphrases ) {
return \in_array( $result['keyword'], \array_map( 'strtolower', $used_keyphrases ), true );
}
);