Skip to content

Commit

Permalink
Merge branch 'release/23.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
YoastBot committed Sep 3, 2024
2 parents 1465978 + 4a593e1 commit 60f4bf2
Show file tree
Hide file tree
Showing 128 changed files with 4,868 additions and 1,843 deletions.
7 changes: 4 additions & 3 deletions admin/class-admin-user-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class WPSEO_Admin_User_Profile {
* Class constructor.
*/
public function __construct() {
add_action( 'show_user_profile', [ $this, 'user_profile' ] );
add_action( 'edit_user_profile', [ $this, 'user_profile' ] );

add_action( 'update_user_meta', [ $this, 'clear_author_sitemap_cache' ], 10, 3 );
}

Expand Down Expand Up @@ -75,11 +72,15 @@ public function process_user_option_update( $user_id ) {
/**
* Add the inputs needed for SEO values to the User Profile page.
*
* @deprecated 23.4
* @codeCoverageIgnore
*
* @param WP_User $user User instance to output for.
*
* @return void
*/
public function user_profile( $user ) {
_deprecated_function( __METHOD__, 'Yoast SEO 23.4' );
wp_nonce_field( 'wpseo_user_profile_update', 'wpseo_nonce' );

require_once WPSEO_PATH . 'admin/views/user-profile.php';
Expand Down
197 changes: 108 additions & 89 deletions admin/class-plugin-availability.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,62 +124,12 @@ protected function register_yoast_plugins_status() {
}
}

/**
* Checks whether or not a plugin is known within the Yoast SEO collection.
*
* @param string $plugin The plugin to search for.
*
* @return bool Whether or not the plugin is exists.
*/
protected function plugin_exists( $plugin ) {
return isset( $this->plugins[ $plugin ] );
}

/**
* Gets all the possibly available plugins.
*
* @return array Array containing the information about the plugins.
*/
public function get_plugins() {
return $this->plugins;
}

/**
* Gets a specific plugin. Returns an empty array if it cannot be found.
*
* @param string $plugin The plugin to search for.
*
* @return array The plugin properties.
*/
public function get_plugin( $plugin ) {
if ( ! $this->plugin_exists( $plugin ) ) {
return [];
}

return $this->plugins[ $plugin ];
}

/**
* Gets the version of the plugin.
*
* @param array $plugin The information available about the plugin.
*
* @return string The version associated with the plugin.
*/
public function get_version( $plugin ) {
if ( ! isset( $plugin['version'] ) ) {
return '';
}

return $plugin['version'];
}

/**
* Checks if there are dependencies available for the plugin.
*
* @param array $plugin The information available about the plugin.
*
* @return bool Whether or not there is a dependency present.
* @return bool Whether there is a dependency present.
*/
public function has_dependencies( $plugin ) {
return ( isset( $plugin['_dependencies'] ) && ! empty( $plugin['_dependencies'] ) );
Expand Down Expand Up @@ -233,23 +183,6 @@ public function is_installed( $plugin ) {
return $this->is_available( $plugin );
}

/**
* Gets all installed plugins.
*
* @return array The installed plugins.
*/
public function get_installed_plugins() {
$installed = [];

foreach ( $this->plugins as $plugin_key => $plugin ) {
if ( $this->is_installed( $plugin ) ) {
$installed[ $plugin_key ] = $plugin;
}
}

return $installed;
}

/**
* Checks for the availability of the plugin.
*
Expand All @@ -273,14 +206,90 @@ public function is_dependency_active( $dependency ) {
}

/**
* Checks whether a dependency is available.
* Gets an array of plugins that have defined dependencies.
*
* @deprecated 22.4
* @return array Array of the plugins that have dependencies.
*/
public function get_plugins_with_dependencies() {
return array_filter( $this->plugins, [ $this, 'has_dependencies' ] );
}

/**
* Determines whether or not a plugin is active.
*
* @param string $plugin The plugin slug to check.
*
* @return bool Whether or not the plugin is active.
*
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function is_active( $plugin ) {
_deprecated_function( __METHOD__, 'Yoast SEO 23.4', 'is_plugin_active' );

return is_plugin_active( $plugin );
}

/**
* Gets all the possibly available plugins.
*
* @return array Array containing the information about the plugins.
*
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function get_plugins() {
_deprecated_function( __METHOD__, 'Yoast SEO 23.4', 'WPSEO_Addon_Manager::get_addon_filenames' );

return $this->plugins;
}

/**
* Gets a specific plugin. Returns an empty array if it cannot be found.
*
* @param string $plugin The plugin to search for.
*
* @return array The plugin properties.
*
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function get_plugin( $plugin ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- needed for BC reasons
_deprecated_function( __METHOD__, 'Yoast SEO 23.4', 'WPSEO_Addon_Manager::get_plugin_file' );
if ( ! isset( $this->plugins[ $plugin ] ) ) {
return [];
}

return $this->plugins[ $plugin ];
}

/**
* Gets the version of the plugin.
*
* @param array $plugin The information available about the plugin.
*
* @return string The version associated with the plugin.
*
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function get_version( $plugin ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- needed for BC reasons
_deprecated_function( __METHOD__, 'Yoast SEO 23.4', 'WPSEO_Addon_Manager::get_installed_addons_versions' );
if ( ! isset( $plugin['version'] ) ) {
return '';
}

return $plugin['version'];
}

/**
* Checks whether a dependency is available.
*
* @param array $dependency The information about the dependency to look for.
*
* @return bool Whether or not the dependency is available.
* @deprecated 22.4
* @codeCoverageIgnore
*/
public function is_dependency_available( $dependency ) {
_deprecated_function( __METHOD__, 'Yoast SEO 22.4' );
Expand All @@ -294,8 +303,11 @@ public function is_dependency_available( $dependency ) {
* @param array $plugin The plugin to get the dependency names from.
*
* @return array Array containing the names of the associated dependencies.
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function get_dependency_names( $plugin ) {
public function get_dependency_names( $plugin ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- needed for BC reasons
_deprecated_function( __METHOD__, 'Yoast SEO 23.4' );
if ( ! $this->has_dependencies( $plugin ) ) {
return [];
}
Expand All @@ -304,33 +316,40 @@ public function get_dependency_names( $plugin ) {
}

/**
* Gets an array of plugins that have defined dependencies.
* Determines whether or not a plugin is a Premium product.
*
* @return array Array of the plugins that have dependencies.
*/
public function get_plugins_with_dependencies() {
return array_filter( $this->plugins, [ $this, 'has_dependencies' ] );
}

/**
* Determines whether or not a plugin is active.
* @param array $plugin The plugin to check.
*
* @param string $plugin The plugin slug to check.
* @return bool Whether or not the plugin is a Premium product.
*
* @return bool Whether or not the plugin is active.
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function is_active( $plugin ) {
return is_plugin_active( $plugin );
public function is_premium( $plugin ) {
_deprecated_function( __METHOD__, 'Yoast SEO 23.4' );

return isset( $plugin['premium'] ) && $plugin['premium'] === true;
}

/**
* Determines whether or not a plugin is a Premium product.
* Gets all installed plugins.
*
* @param array $plugin The plugin to check.
* @return array The installed plugins.
*
* @return bool Whether or not the plugin is a Premium product.
* @deprecated 23.4
* @codeCoverageIgnore
*/
public function is_premium( $plugin ) {
return isset( $plugin['premium'] ) && $plugin['premium'] === true;
public function get_installed_plugins() {

_deprecated_function( __METHOD__, 'Yoast SEO 23.4', 'WPSEO_Addon_Manager::get_installed_addons_versions' );
$installed = [];

foreach ( $this->plugins as $plugin_key => $plugin ) {
if ( $this->is_installed( $plugin ) ) {
$installed[ $plugin_key ] = $plugin;
}
}

return $installed;
}
}
10 changes: 2 additions & 8 deletions admin/class-yoast-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ public function textinput( $variable, $label, $attr = [] ) {

$aria_attributes = Yoast_Input_Validation::get_the_aria_invalid_attribute( $variable );

Yoast_Input_Validation::set_error_descriptions();
$aria_attributes .= Yoast_Input_Validation::get_the_aria_describedby_attribute( $variable );

$disabled_attribute = $this->get_disabled_attribute( $variable, $attr );
Expand Down Expand Up @@ -467,9 +466,7 @@ public function number( $variable, $label, $attr = [] ) {
]
);

$aria_attributes = Yoast_Input_Validation::get_the_aria_invalid_attribute( $variable );

Yoast_Input_Validation::set_error_descriptions();
$aria_attributes = Yoast_Input_Validation::get_the_aria_invalid_attribute( $variable );
$aria_attributes .= Yoast_Input_Validation::get_the_aria_describedby_attribute( $variable );

$disabled_attribute = $this->get_disabled_attribute( $variable, $attr );
Expand Down Expand Up @@ -520,10 +517,7 @@ public function textinput_extra_content( $variable, $label, $attr = [] ) {
}
echo '</div>';

$has_input_error = Yoast_Input_Validation::yoast_form_control_has_error( $variable );
$aria_attributes = Yoast_Input_Validation::get_the_aria_invalid_attribute( $variable );

Yoast_Input_Validation::set_error_descriptions();
$aria_attributes = Yoast_Input_Validation::get_the_aria_invalid_attribute( $variable );
$aria_attributes .= Yoast_Input_Validation::get_the_aria_describedby_attribute( $variable );

// phpcs:disable WordPress.Security.EscapeOutput -- Reason: output is properly escaped or hardcoded.
Expand Down
Loading

0 comments on commit 60f4bf2

Please sign in to comment.