Making WordPress.org

Changeset 2435


Ignore:
Timestamp:
01/30/2016 09:37:19 PM (8 years ago)
Author:
drewapicture
Message:

DevHub: Like with private access messages, use callout box styles for the deprecated message container (if available).

If the Handbook plugin is unavailable, fall back to basic theme-support styles.

See #1551.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r2431 r2435  
    834834        $type           = array_pop( $types );
    835835        $tags           = get_post_meta( $post_id, '_wp-parser_tags', true );
    836         $all_deprecated = wp_filter_object_list( $tags, array( 'name' => 'deprecated' ) );
    837 
    838         if ( empty( $all_deprecated ) ) {
     836        $deprecated = wp_filter_object_list( $tags, array( 'name' => 'deprecated' ) );
     837
     838        if ( empty( $deprecated ) ) {
    839839            return '';
    840840        }
    841841
    842         $deprecated  = array_shift( $all_deprecated );
    843         // Multi-@deprecated may have been defined, with the second actually having the deprecation text.
    844         if ( empty( $deprecated['content'] ) ) {
    845             $deprecated  = array_shift( $all_deprecated );
    846         }
    847         $description = empty( $deprecated['content'] ) ? '' : esc_html( $deprecated['content'] );
    848 
    849         return "<div class='deprecated'>"
    850             . wp_kses_post( sprintf( __( 'Warning: This %s has been deprecated. %s', 'wporg' ), $type, $description ) )
    851             . '</div>';
     842        $referral = array_shift( wp_filter_object_list( $tags, array( 'name' => 'see' ) ) );
     843
     844        if ( ! empty( $referral['refers'] ) ) {
     845            $refers = sanitize_text_field( $referral['refers'] );
     846
     847            if ( ! empty( $refers ) ) {
     848                /* translators: 1: Linked internal element name */
     849                $alternative_string = sprintf( __( ' Use %s instead.', 'wporg' ), \DevHub_Formatting::link_internal_element( $refers ) );
     850            }
     851        } else {
     852            $alternative_string = '';
     853        }
     854
     855        /* translators: 1: String for alternative function (if one exists) */
     856        $contents = sprintf( __( 'This %1$s has been deprecated.%2$s', 'wporg' ),
     857            $type,
     858            $alternative_string
     859        );
     860
     861        // Use the 'warning' callout box if it's available. Otherwise, fall back to a theme-supported div class.
     862        if ( class_exists( 'WPorg_Handbook_Callout_Boxes' ) ) {
     863            $callout = new \WPorg_Handbook_Callout_Boxes();
     864            $message = $callout->warning_shortcode( array(), $contents );
     865        } else {
     866            $message  = '<div class="deprecated">';
     867            /** This filter is documented in wp-includes/post-template.php */
     868            $message .= apply_filters( 'the_content', $contents );
     869            $message .= '</div>';
     870        }
     871
     872        return $message;
    852873    }
    853874
     
    13931414        /* translators: 1: String for alternative function (if one exists) */
    13941415        $contents = sprintf( __( 'This function&#8217;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' ),
    1395                 $alternative_string
     1416            $alternative_string
    13961417        );
    13971418
     
    14021423        } else {
    14031424            $message  = '<div class="private-access">';
     1425            /** This filter is documented in wp-includes/post-template.php */
    14041426            $message .= apply_filters( 'the_content', $contents );
    14051427            $message .= '</div>';
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

    r2431 r2435  
    10111011        }
    10121012        .deprecated {
    1013             background-color: #be2423;
    1014             border: 1px solid #a4322f;
     1013            background-color: #fbeaea;
     1014            border: 1px solid #dc3232;
    10151015            padding: 20px;
    1016             color: #ffffff;
    10171016        }
    10181017        .deprecated-method {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

    r2431 r2435  
    12141214}
    12151215.devhub-wrap .wp-parser-class .deprecated, .devhub-wrap .wp-parser-function .deprecated, .devhub-wrap .wp-parser-hook .deprecated, .devhub-wrap .wp-parser-method .deprecated {
    1216   background-color: #be2423;
    1217   border: 1px solid #a4322f;
     1216  background-color: #fbeaea;
     1217  border: 1px solid #dc3232;
    12181218  padding: 20px;
    1219   color: #ffffff;
    12201219}
    12211220.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 {
Note: See TracChangeset for help on using the changeset viewer.