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

@@ -14,28 +14,28 @@ use Yoast\WP\SEO\Introductions\Domain\Introduction_Interface;
class Ai_Generate_Titles_And_Descriptions_Introduction_Upsell implements Introduction_Interface {
use Current_Page_Trait;
use Version_Trait;
use User_Allowed_Trait;
use Version_Trait;
/**
* Holds the product helper.
*
* @var \Yoast\WP\SEO\Helpers\Product_Helper
* @var Product_Helper
*/
private $product_helper;
/**
* Holds the options' helper.
*
* @var \Yoast\WP\SEO\Helpers\Options_Helper
* @var Options_Helper
*/
private $options_helper;
/**
* Constructs the introduction.
*
* @param \Yoast\WP\SEO\Helpers\Product_Helper $product_helper The product helper.
* @param \Yoast\WP\SEO\Helpers\Options_Helper $options_helper The options' helper.
* @param Product_Helper $product_helper The product helper.
* @param Options_Helper $options_helper The options' helper.
*/
public function __construct(
Product_Helper $product_helper,
@@ -63,7 +63,7 @@ class Ai_Generate_Titles_And_Descriptions_Introduction_Upsell implements Introdu
* @return string
*/
public function get_name() {
_deprecated_function( __METHOD__, 'Yoast SEO 21.6', 'Please use get_id() instead' );
\_deprecated_function( __METHOD__, 'Yoast SEO 21.6', 'Please use get_id() instead' );
return $this->get_id();
}

View File

@@ -34,7 +34,7 @@ trait Current_Page_Trait {
private function get_page() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['page'] ) && \is_string( $_GET['page'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, only using it in strict comparison.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, only using it in strict comparison.
return \wp_unslash( $_GET['page'] );
}

View File

@@ -66,7 +66,9 @@ class Introductions_Collector {
* Filter: Adds the possibility to add additional introductions to be included.
*
* @internal
* @api Introduction_Interface This filter expects a list of Introduction_Interface instances and expects only Introduction_Interface implementations to be added to the list.
*
* @param Introduction_Interface $introductions This filter expects a list of Introduction_Interface instances and
* expects only Introduction_Interface implementations to be added to the list.
*/
$filtered_introductions = (array) \apply_filters( 'wpseo_introductions', $introductions );

View File

@@ -14,9 +14,8 @@ trait Version_Trait {
* @return bool Whether the version is between a min and max.
*/
private function is_version_between( $version, $min_version, $max_version ) {
return (
\version_compare( $version, $min_version, '>=' ) &&
\version_compare( $version, $max_version, '<' )
return ( \version_compare( $version, $min_version, '>=' )
&& \version_compare( $version, $max_version, '<' )
);
}
}

View File

@@ -15,9 +15,9 @@ class Invalid_User_Id_Exception extends InvalidArgumentException {
*
* @link https://php.net/manual/en/exception.construct.php
*
* @param string $message [optional] The Exception message to throw.
* @param int $code [optional] The Exception code.
* @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
* @param string $message Optional. The Exception message to throw.
* @param int $code Optional. The Exception code.
* @param Throwable|null $previous Optional. The previous throwable used for the exception chaining.
*/
public function __construct( // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Reason: A default message is used.
$message = 'Invalid User ID',

View File

@@ -10,9 +10,9 @@ use Yoast\WP\SEO\Introductions\Domain\Invalid_User_Id_Exception;
*/
class Introductions_Seen_Repository {
const USER_META_KEY = '_yoast_wpseo_introductions';
public const USER_META_KEY = '_yoast_wpseo_introductions';
const DEFAULT_VALUE = [];
public const DEFAULT_VALUE = [];
/**
* Holds the User_Helper instance.
@@ -35,9 +35,9 @@ class Introductions_Seen_Repository {
*
* @param int $user_id User ID.
*
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
*
* @return array The introductions.
*
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
*/
public function get_all_introductions( $user_id ): array {
$seen_introductions = $this->user_helper->get_meta( $user_id, self::USER_META_KEY, true );
@@ -76,9 +76,9 @@ class Introductions_Seen_Repository {
* @param int $user_id User ID.
* @param string $introduction_id The introduction ID.
*
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
*
* @return bool Whether the introduction is seen.
*
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
*/
public function is_introduction_seen( $user_id, string $introduction_id ): bool {
$introductions = $this->get_all_introductions( $user_id );
@@ -97,9 +97,9 @@ class Introductions_Seen_Repository {
* @param string $introduction_id The introduction ID.
* @param bool $is_seen Whether the introduction is seen. Defaults to true.
*
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
*
* @return bool False on failure. Not having to update is a success.
*
* @throws Invalid_User_Id_Exception If an invalid user ID is supplied.
*/
public function set_introduction( $user_id, string $introduction_id, bool $is_seen = true ): bool {
$introductions = $this->get_all_introductions( $user_id );

View File

@@ -12,9 +12,9 @@ use Yoast\WP\SEO\Helpers\User_Helper;
*/
class Wistia_Embed_Permission_Repository {
const USER_META_KEY = '_yoast_wpseo_wistia_embed_permission';
public const USER_META_KEY = '_yoast_wpseo_wistia_embed_permission';
const DEFAULT_VALUE = false;
public const DEFAULT_VALUE = false;
/**
* Holds the User_Helper instance.
@@ -37,9 +37,9 @@ class Wistia_Embed_Permission_Repository {
*
* @param int $user_id User ID.
*
* @throws Exception If an invalid user ID is supplied.
*
* @return bool The current value.
*
* @throws Exception If an invalid user ID is supplied.
*/
public function get_value_for_user( $user_id ) {
$value = $this->user_helper->get_meta( $user_id, self::USER_META_KEY, true );
@@ -66,9 +66,9 @@ class Wistia_Embed_Permission_Repository {
* @param int $user_id The user ID.
* @param bool $value The value.
*
* @throws Exception If an invalid user ID is supplied.
*
* @return bool Whether the update was successful.
*
* @throws Exception If an invalid user ID is supplied.
*/
public function set_value_for_user( $user_id, $value ) {
// The value is stored as a string because otherwise we can not see the difference between false and an invalid user ID.

View File

@@ -19,7 +19,7 @@ class Introductions_Integration implements Integration_Interface {
use Current_Page_Trait;
const SCRIPT_HANDLE = 'introductions';
public const SCRIPT_HANDLE = 'introductions';
/**
* Holds the admin asset manager.
@@ -67,6 +67,8 @@ class Introductions_Integration implements Integration_Interface {
* Returns the conditionals based in which this loadable should be active.
*
* In this case: when on an admin page.
*
* @return array<string>
*/
public static function get_conditionals() {
return [ Yoast_Admin_Conditional::class ];
@@ -112,6 +114,8 @@ class Introductions_Integration implements Integration_Interface {
/**
* Enqueue the new features assets.
*
* @return void
*/
public function enqueue_assets() {
$user_id = $this->user_helper->get_current_user_id();

View File

@@ -27,7 +27,7 @@ class Introductions_Seen_Route implements Route_Interface {
*
* @var string
*/
const ROUTE_PREFIX = '/introductions/(?P<introduction_id>[\w-]+)/seen';
public const ROUTE_PREFIX = '/introductions/(?P<introduction_id>[\w-]+)/seen';
/**
* Holds the introductions collector instance.

View File

@@ -24,7 +24,7 @@ class Wistia_Embed_Permission_Route implements Route_Interface {
*
* @var string
*/
const ROUTE_PREFIX = '/wistia_embed_permission';
public const ROUTE_PREFIX = '/wistia_embed_permission';
/**
* Holds the repository.