-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync: check schema is available or not #8143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution.
Some remarks about the changes you've introduced in this PR.
@@ -47,19 +49,23 @@ public static function sanitize_taxonomy( $taxonomy ) { | |||
} | |||
// Remove any meta_box_cb if they are not the default wp ones. | |||
if ( isset( $cloned_taxonomy->meta_box_cb ) && | |||
! in_array( $cloned_taxonomy->meta_box_cb, array( 'post_tags_meta_box', 'post_categories_meta_box' ) ) ) { | |||
! in_array( $cloned_taxonomy->meta_box_cb, array( 'post_tags_meta_box', 'post_categories_meta_box' ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you meant to clarify the if
statement here, it might be best to move the first check on its own line as well:
if (
isset( $cloned_taxonomy->meta_box_cb )
&& ! in_array( $cloned_taxonomy->meta_box_cb, array( 'post_tags_meta_box', 'post_categories_meta_box' ) )
) {
$cloned_taxonomy->meta_box_cb = null; | ||
} | ||
// Remove update call back | ||
if ( isset( $cloned_taxonomy->update_count_callback ) && | ||
! is_null( $cloned_taxonomy->update_count_callback ) ) { | ||
! is_null( $cloned_taxonomy->update_count_callback ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
if ( isset( $cloned_taxonomy->rest_controller_class ) && | ||
'WP_REST_Terms_Controller' !== $cloned_taxonomy->rest_controller_class ) { | ||
if ( isset( $cloned_taxonomy->rest_controller_class ) && | ||
'WP_REST_Terms_Controller' !== $cloned_taxonomy->rest_controller_class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! I have added several comments, please address them.
@@ -203,26 +210,26 @@ public static function get_protocol_normalized_url( $callable, $new_value ) { | |||
$option_key = self::HTTPS_CHECK_OPTION_PREFIX . $callable; | |||
|
|||
$parsed_url = wp_parse_url( $new_value ); | |||
if ( ! $parsed_url ) { | |||
if ( empty ( $parsed_url['scheme'] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't just return
here if there's no schema set for the URL. To avoid warnings let's instead check against empty down there where we first try to access the scheme
key.
return $new_value; | ||
} | ||
|
||
$scheme = $parsed_url['scheme']; | ||
$scheme_history = get_option( $option_key, array() ); | ||
$scheme = $parsed_url['scheme']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we need to see if the key exists, and I'd prefer to use array_key_exists
here instead of empty
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zinigor
If I use
if ( array_key_exists ( 'scheme' , $parsed_url) ) {
$scheme = $parsed_url['scheme'];
} else {
$scheme = '';
}
This is fine .
|
||
return set_url_scheme( $new_value, $forced_scheme ); | ||
} | ||
|
||
public static function get_raw_url( $option_name ) { | ||
$value = null; | ||
$value = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid unnecessary changes like this. It's OK to remove spaces that shouldn't be there in related code, but these edits make the PR harder to review. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing, and this will be good to go, thank you.
@@ -206,8 +206,11 @@ public static function get_protocol_normalized_url( $callable, $new_value ) { | |||
if ( ! $parsed_url ) { | |||
return $new_value; | |||
} | |||
|
|||
$scheme = $parsed_url['scheme']; | |||
if( array_key_exists ( 'scheme' , $parsed_url) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after if
and after $parsed_url
, please fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, Sir
@zinigor |
This is ready to go! Thank you. |
* Changelog 5.6: create base for changelog. * Update changelog with 5.5.1 info. * Changelog: add #7930 and #8238 * Changelog: add #8076 * Changelog: add #8100 * Changelog: add #8117 * Changelog: add #8141 * Changelog: add #8143 * Changelog: add #8147 * Changelog: add #8149 * Changelog: add #8153 * Changelog: add #8173 * Changelog: add #8184 * Changelog: add #8196 * Changelog: add #8199 * Changelog: add #8093 * Changelog: add #8171 * Changelog: add #8182 * Changelog: add #8202, #8222 * Changelog: add #8228 * Changelog: add #8240 * Changelog: add #8251 * remove AL card change
Fixes #8137
Use empty() to check if it is available.