Making WordPress.org


Ignore:
Timestamp:
04/06/2020 01:26:02 AM (7 years ago)
Author:
dd32
Message:

Plugin Directory: Make the Advanced view a bit more friendly.

This adds more descriptive text to the "Close this plugin" button and makes it clearer that these operations aren't available to everyone (and are potentially destructive).

Props Ipstenu.
Fixes #1560.

File:
1 edited

Legend:

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

    r9677 r9698  
    284284        $tags = array_reverse( $tags );
    285285
    286         echo '<h5>' . esc_html__( 'Previous Versions', 'wporg-plugins' ) . '</h5>';
    287         echo '<div class="plugin-notice notice notice-info notice-alt"><p>' . esc_html__( 'Previous versions of this plugin may not be secure or stable and are available for testing purposes only.', 'wporg-plugins' ) . '</p></div>';
     286        echo '<h4>' . esc_html__( 'Previous Versions', 'wporg-plugins' ) . '</h4>';
     287
     288        echo '<div class="plugin-notice notice notice-info notice-alt"><p>' . esc_html__( 'Previous versions of plugins may not be secure or stable. They are not recommended for use on production websites.', 'wporg-plugins' ) . '</p></div>';
     289
     290        echo '<p>' . esc_html__( 'Please select a specific version to download.', 'wporg-plugins' ) . '</p>';
    288291
    289292        echo '<select class="previous-versions" onchange="getElementById(\'download-previous-link\').href=this.value;">';
    290293        foreach ( $tags as $version ) {
    291                 $text = ( 'trunk' === $version ? esc_html__( 'Development Version', 'wporg-plugins' ) : $version );
     294                $text = ( 'trunk' === $version ? __( 'Development Version', 'wporg-plugins' ) : $version );
    292295                printf( '<option value="%s">%s</option>', esc_attr( Template::download_link( $post, $version ) ), esc_html( $text ) );
    293296        }
    … …  
    303306/**
    304307 * Displays a form for plugin committers to self-close a plugin. Permanently.
     308 * It is disabled for plugins with 20,000+ users.
    305309 */
    306310function the_plugin_self_close_button() {
    307         $post = get_post();
     311        $post            = get_post();
     312        $active_installs = (int) get_post_meta( $post->ID, 'active_installs', true );
     313        $close_link      = false;
    308314
    309315        if ( ! current_user_can( 'plugin_admin_edit', $post ) || 'publish' != $post->post_status ) {
    … …  
    311317        }
    312318
    313         $close_link = Template::get_self_close_link( $post );
    314 
    315         ?>
    316         <h5><?php esc_html_e( 'Close This Plugin', 'wporg-plugins' ); ?></h5>
    317         <div class="plugin-notice notice notice-warning notice-alt"><p><?php _e( '<strong>Warning:</strong> Closing your plugin is intended to be a permanent action. You will not be able to reopen it without contacting the plugins team.', 'wporg-plugins' ); ?></p></div>
    318 
    319         <form method="POST" action="<?php echo esc_url( $close_link ); ?>">
    320         <p>
    321                 <input class="button" type="submit" value="<?php echo esc_attr( sprintf( __( 'I understand, please close %s.', 'wporg-plugins' ), get_the_title() ) ); ?>" />
    322         </p>
    323         </form>
    324 <?php
    325 }
     319        echo '<h4>' . esc_html__( 'Close This Plugin', 'wporg-plugins' ) . '</h4>';
     320        echo '<p>' . esc_html__( 'This plugin is currently open. All developers have the ability to close their own plugins at any time.', 'wporg-plugins' ) . '</p>';
     321
     322        echo '<div class="plugin-notice notice notice-warning notice-alt"><p>';
     323        if ( $active_installs >= 20000 ) {
     324                // Translators: %s is the plugin team email address.
     325                printf( __( '<strong>Notice:</strong> Due to the high volume of users for this plugin it cannot be closed without speaking directly to the plugins team. Please contact <a href="mailto:%1$s">%1$s</a> with a link to the plugin and explanation as to why it should be closed.', 'wporg-plugins' ), 'plugins@wordpress.org' );
     326        } else {
     327                $close_link = Template::get_self_close_link( $post );
     328                _e( '<strong>Warning:</strong> Closing a plugin is intended to be a <em>permanent</em> action. There is no way to reopen a plugin without contacting the plugins team.', 'wporg-plugins' );
     329        }
     330        echo '</p></div>';
     331
     332        if ( $close_link ) {
     333                echo '<form method="POST" action="' . esc_url( $close_link ) . '">';
     334                // Translators: %s is the plugin name, as defined by the plugin itself.
     335                echo '<p><input class="button" type="submit" value="' . esc_attr( sprintf( __( 'I understand, please close %s.', 'wporg-plugins' ), get_the_title() ) ) . '" /></p>';
     336                echo '</form>';
     337        }
     338}
     339
Note: See TracChangeset for help on using the changeset viewer.