Sync: check schema is available or not#8143
Sync: check schema is available or not#8143kraftbj merged 3 commits intoAutomattic:masterfrom Umangvaghela:issue_8137
Conversation
jeherve
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
Some remarks about the changes you've introduced in this PR.
| // 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.
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' ) )
) {| // 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 ) |
| 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 |
zinigor
left a comment
There was a problem hiding this comment.
Thanks for contributing! I have added several comments, please address them.
|
|
||
| $parsed_url = wp_parse_url( $new_value ); | ||
| if ( ! $parsed_url ) { | ||
| if ( empty ( $parsed_url['scheme'] ) ) { |
There was a problem hiding this comment.
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.
|
|
||
| $scheme = $parsed_url['scheme']; | ||
| $scheme_history = get_option( $option_key, array() ); | ||
| $scheme = $parsed_url['scheme']; |
There was a problem hiding this comment.
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.
@zinigor
If I use
if ( array_key_exists ( 'scheme' , $parsed_url) ) {
$scheme = $parsed_url['scheme'];
} else {
$scheme = '';
}
This is fine .
|
|
||
| public static function get_raw_url( $option_name ) { | ||
| $value = null; | ||
| $value = null; |
There was a problem hiding this comment.
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!
zinigor
left a comment
There was a problem hiding this comment.
One minor thing, and this will be good to go, thank you.
| } | ||
|
|
||
| $scheme = $parsed_url['scheme']; | ||
| if( array_key_exists ( 'scheme' , $parsed_url) ) { |
There was a problem hiding this comment.
Missing space after if and after $parsed_url, please fix.
|
@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.