Index: inc/template-tags.php
===================================================================
--- inc/template-tags.php (revision 2431)
+++ inc/template-tags.php (working copy)
@@ -833,22 +833,42 @@
$types = explode( '-', get_post_type( $post_id ) );
$type = array_pop( $types );
$tags = get_post_meta( $post_id, '_wp-parser_tags', true );
- $all_deprecated = wp_filter_object_list( $tags, array( 'name' => 'deprecated' ) );
+ $deprecated = wp_filter_object_list( $tags, array( 'name' => 'deprecated' ) );
- if ( empty( $all_deprecated ) ) {
+ if ( empty( $deprecated ) ) {
return '';
}
- $deprecated = array_shift( $all_deprecated );
- // Multi-@deprecated may have been defined, with the second actually having the deprecation text.
- if ( empty( $deprecated['content'] ) ) {
- $deprecated = array_shift( $all_deprecated );
+ $referral = array_shift( wp_filter_object_list( $tags, array( 'name' => 'see' ) ) );
+
+ if ( ! empty( $referral['refers'] ) ) {
+ $refers = sanitize_text_field( $referral['refers'] );
+
+ if ( ! empty( $refers ) ) {
+ /* translators: 1: Linked internal element name */
+ $alternative_string = sprintf( __( ' Use %s instead.', 'wporg' ), \DevHub_Formatting::link_internal_element( $refers ) );
+ }
+ } else {
+ $alternative_string = '';
}
- $description = empty( $deprecated['content'] ) ? '' : esc_html( $deprecated['content'] );
- return "
"
- . wp_kses_post( sprintf( __( 'Warning: This %s has been deprecated. %s', 'wporg' ), $type, $description ) )
- . '
';
+ /* translators: 1: String for alternative function (if one exists) */
+ $contents = sprintf( __( 'This %1$s has been deprecated.%2$s', 'wporg' ),
+ $type,
+ $alternative_string
+ );
+
+ // Use the 'warning' callout box if it's available. Otherwise, fall back to a theme-supported div class.
+ if ( class_exists( 'WPorg_Handbook_Callout_Boxes' ) ) {
+ $callout = new \WPorg_Handbook_Callout_Boxes();
+ $message = $callout->warning_shortcode( array(), $contents );
+ } else {
+ $message = '';
+ $message .= '
' . $contents . '
';
+ $message .= '
';
+ }
+
+ return $message;
}
/**
@@ -1392,7 +1412,7 @@
/* translators: 1: String for alternative function (if one exists) */
$contents = sprintf( __( 'This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.%s', 'wporg' ),
- $alternative_string
+ $alternative_string
);
// Use the 'alert' callout box if it's available. Otherwise, fall back to a theme-supported div class.
Index: scss/main.scss
===================================================================
--- scss/main.scss (revision 2431)
+++ scss/main.scss (working copy)
@@ -1010,10 +1010,9 @@
padding: 20px;
}
.deprecated {
- background-color: #be2423;
- border: 1px solid #a4322f;
+ background-color: #fbeaea;
+ border: 1px solid #dc3232;
padding: 20px;
- color: #ffffff;
}
.deprecated-method {
color: #be2423;
Index: stylesheets/main.css
===================================================================
--- stylesheets/main.css (revision 2431)
+++ stylesheets/main.css (working copy)
@@ -1213,10 +1213,9 @@
padding: 20px;
}
.devhub-wrap .wp-parser-class .deprecated, .devhub-wrap .wp-parser-function .deprecated, .devhub-wrap .wp-parser-hook .deprecated, .devhub-wrap .wp-parser-method .deprecated {
- background-color: #be2423;
- border: 1px solid #a4322f;
+ background-color: #fbeaea;
+ border: 1px solid #dc3232;
padding: 20px;
- color: #ffffff;
}
.devhub-wrap .wp-parser-class .deprecated-method, .devhub-wrap .wp-parser-function .deprecated-method, .devhub-wrap .wp-parser-hook .deprecated-method, .devhub-wrap .wp-parser-method .deprecated-method {
color: #be2423;