WordPress.org

Making WordPress.org

Ticket #3010: 3010.2.patch

File 3010.2.patch, 3.0 KB (added by SergeyBiryukov, 2 years ago)
  • wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

     
    259259} );
    260260
    261261/**
     262 * Get current major WP version to check against "Tested up to" value.
     263 *
     264 * @return string Current major WP version.
     265 */
     266function get_current_major_wp_version() {
     267        global $wp_version;
     268
     269        $current_version = '';
     270
     271        // Assume the value stored in a constant (which is set on WP.org), if defined.
     272        if ( defined( 'WP_CORE_LATEST_RELEASE' ) && WP_CORE_LATEST_RELEASE ) {
     273                $current_version = substr( WP_CORE_LATEST_RELEASE, 0, 3 );
     274        }
     275
     276        // Otherwise, use the version of the running WP instance.
     277        if ( empty( $current_version ) ) {
     278                $current_version = substr( $wp_version, 0, 3 );
     279
     280                // However, if the running WP instance appears to not be a release
     281                // version, assume the latest stable version.
     282                if ( false !== strpos( $wp_version, '-' ) ) {
     283                        $current_version = (string) ( (float) $current_version - 0.1 );
     284                }
     285        }
     286
     287        return $current_version;
     288}
     289
     290/**
    262291 * Custom template tags for this theme.
    263292 */
    264293require get_template_directory() . '/inc/template-tags.php';
  • wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

     
    1515
    1616$content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
    1717
     18$tested_up_to             = (string) get_post_meta( $post->ID, 'tested', true );
     19$version_to_check_against = (string) ( (float) get_current_major_wp_version() - 0.2 );
    1820?><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1921        <?php echo Template::get_plugin_banner( get_post(), 'html' ); ?>
    2022
    2123        <header class="plugin-header">
    22                 <?php if ( time() - get_post_modified_time() > 2 * YEAR_IN_SECONDS ) : ?>
     24                <?php if ( version_compare( $version_to_check_against, $tested_up_to, '>' ) ) : ?>
    2325                        <div class="plugin-notice notice notice-warning notice-alt">
    24                                 <p><?php _e( 'This plugin <strong>hasn&#146;t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-plugins' ); ?></p>
     26                                <p><?php _e( '<strong>This plugin hasn&#146;t been tested with the latest 3 major releases of WordPress</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-plugins' ); ?></p>
    2527                        </div><!-- .plugin-notice -->
    2628                <?php endif; ?>
    2729                <?php if ( 'publish' != get_post()->post_status ) :