Making WordPress.org


Ignore:
Timestamp:
07/26/2024 04:56:43 AM (8 months ago)
Author:
dd32
Message:

Plugin Directory: Release Confirmation: Move the front-end notice logic from the theme to the Shortcode.

See https://github.com/WordPress/wordpress.org/pull/344.
See #7704.

File:
1 edited

Legend:

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

    r13728 r13931  
    1414use WordPressdotorg\Plugin_Directory\Template;
    1515use WordPressdotorg\Plugin_Directory\Tools;
     16use WordPressdotorg\Plugin_Directory\Shortcodes\Release_Confirmation;
    1617
    1718/**
     
    258259
    259260function the_unconfirmed_releases_notice() {
    260     $plugin = get_post();
    261 
    262     if ( ! $plugin->release_confirmation || ! current_user_can( 'plugin_admin_edit', $plugin ) ) {
    263         return;
    264     }
    265 
    266     $releases = Plugin_Directory::get_releases( $plugin ) ?: [];
    267     $warning  = false;
    268 
    269     foreach ( $releases as $release ) {
    270         if ( ! $release['confirmed'] && $release['confirmations_required'] && empty( $release['discarded'] ) ) {
    271             $warning = true;
    272             break;
    273         }
    274     }
    275 
    276     if ( ! $warning ) {
    277         return;
    278     }
    279 
    280     printf(
    281         '<div class="plugin-notice notice notice-info notice-alt"><p>%s</p></div>',
    282         sprintf(
    283             __( 'This plugin has <a href="%s">a pending release that requires confirmation</a>.', 'wporg-plugins' ),
    284             home_url( '/developers/releases/' ) // TODO: Hardcoded URL.
    285         )
    286     );
     261    return Release_Confirmation::frontend_unconfirmed_releases_notice();
    287262}
    288263
Note: See TracChangeset for help on using the changeset viewer.