Making WordPress.org

Changeset 9784


Ignore:
Timestamp:
04/28/2020 03:54:17 PM (5 years ago)
Author:
Otto42
Message:

Plugins: Reorg danger zone to separate functions, hide bits from users that don't need to see them. Fixes #5177

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

Legend:

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

    r9707 r9784  
    258258
    259259/**
     260 * Display the ADVANCED Zone.
     261 */
     262function the_plugin_advanced_zone() {
     263    $post = get_post();
     264
     265    // If the post is closed, this all goes away.
     266    if ( 'publish' !== $post->post_status ) {
     267        return;
     268    }
     269
     270    echo '<hr>';
     271
     272    echo '<h2>' . esc_html__( 'Advanced Options', 'wporg-plugins' ) . '</h2>';
     273
     274    echo '<p>' . esc_html__( 'This section is intended for advanced users and developers only. They are presented here for testing and educational purposes.', 'wporg-plugins' ) . '</p>';
     275
     276    // Output previous version download.
     277    the_previous_version_download();
     278
     279}
     280
     281/**
    260282 * Displays a select element with links to previous plugin version to download.
    261283 *
     
    305327
    306328/**
     329 * Display the Danger Zone.
     330 */
     331function the_plugin_danger_zone() {
     332    $post = get_post();
     333
     334    if ( ! current_user_can( 'plugin_admin_edit', $post ) ) {
     335        return;
     336    }
     337
     338    echo '<hr>';
     339
     340    echo '<h2>' . esc_html__( 'The Danger Zone', 'wporg-plugins' ) . '</h2>';
     341
     342    echo '<p>' . esc_html__( 'The following features are restricted to plugin committers only. They exist to allow plugin developers more control over their work.', 'wporg-plugins' ) . '</p>';
     343
     344    echo '<div class="plugin-notice notice notice-error notice-alt"><p>' . esc_html__( 'These features often cannot be undone without intervention. Please do not attempt to use them unless you are absolutely certain. When in doubt, contact the plugins team for assistance.', 'wporg-plugins' ) . '</p></div>';
     345
     346    // Output the transfer form.
     347    the_plugin_self_transfer_form();
     348
     349    if ( 'publish' != $post->post_status ) {
     350        // A reminder of the closed status.
     351        the_active_plugin_notice();
     352    } else {
     353        // Output the self close button.
     354        the_plugin_self_close_button();
     355    }
     356
     357}
     358
     359/**
    307360 * Displays a form for plugin committers to self-close a plugin. Permanently.
    308361 * It is disabled for plugins with 20,000+ users.
     
    364417    }
    365418
    366     echo '<p>' . esc_html__( 'You are the current owner of this plugin, but you can transfer those rights to another person at any time. The new owner must be added as a committer first.', 'wporg-plugins' ) . '</p>';
    367 
    368     echo '<div class="plugin-notice notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> Transferring a plugin is intended to be <em>permanent</em>. There is no way to get plugin ownership back unless it has been done maliciously.', 'wporg-plugins' ) . '</p></div>';
     419    echo '<p>' . esc_html__( 'You are the current owner of this plugin. You may transfer those rights to another person at any time, provided they have commit access to this plugin.', 'wporg-plugins' ) . '</p>';
     420
     421    echo '<div class="plugin-notice notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> Transferring a plugin is intended to be <em>permanent</em>. There is no way to get plugin ownership back without contacting the plugin team.', 'wporg-plugins' ) . '</p></div>';
    369422
    370423    $users = [];
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/section-advanced.php

    r9723 r9784  
    3434    </table>
    3535
    36     <hr>
     36    <?php
     37        // Display the advanced controls (only seen if the plugin is open).
     38        the_plugin_advanced_zone();
    3739
    38     <h2><?php esc_html_e( 'Advanced Options', 'wporg-plugins' ); ?></h2>
     40        // Display the danger zone (only shown to committers of the plugin).
     41        the_plugin_danger_zone();
     42    ?>
    3943
    40     <p><?php esc_html_e( 'This section is intended for advanced users and developers only. They are presented here for testing and educational purposes.', 'wporg-plugins' ); ?></p>
    41 
    42     <?php the_previous_version_download(); ?>
    43 
    44     <?php if ( current_user_can( 'plugin_admin_edit', $post ) && 'publish' == $post->post_status ) : ?>
    45         <hr>
    46 
    47         <h2><?php esc_html_e( 'The Danger Zone', 'wporg-plugins' ); ?></h2>
    48 
    49         <p><?php esc_html_e( 'The following features are restricted to plugin committers only. They exist to allow plugin developers more control over their work.', 'wporg-plugins' ); ?></p>
    50 
    51         <div class="plugin-notice notice notice-error notice-alt"><p><?php esc_html_e( 'These features often cannot be undone without intervention. Please do not attempt to use them unless you are absolutely certain. When in doubt, contact the plugins team for assistance.', 'wporg-plugins' ); ?></p></div>
    52 
    53         <?php the_plugin_self_transfer_form(); ?>
    54 
    55         <?php the_plugin_self_close_button(); ?>
    56     <?php endif; // current_user_can ?>
    5744</div>
Note: See TracChangeset for help on using the changeset viewer.