Making WordPress.org

Changeset 13643


Ignore:
Timestamp:
05/01/2024 04:22:16 AM (13 months ago)
Author:
dd32
Message:

Plugin Directory: Switch the Close form to require additional confirmation before closing.

Merges https://github.com/WordPress/wordpress.org/pull/143.
Fixes #5667.

File:
1 edited

Legend:

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

    r13620 r13643  
    543543    echo '</p></div>';
    544544
    545     if ( $close_link ) {
    546         echo '<form method="POST" action="' . esc_url( $close_link ) . '" onsubmit="return confirm( jQuery(this).prev(\'.notice\').text() );">';
    547         // Translators: %s is the plugin name, as defined by the plugin itself.
    548         echo '<p class="wp-block-button is-small"><button class="wp-block-button__link" type="submit">' . esc_attr( sprintf( __( 'I understand, please close %s.', 'wporg-plugins' ), get_the_title() ) ) . '</button></p>';
    549         echo '</form>';
    550     }
     545    if ( ! $close_link ) {
     546        return;
     547    }
     548
     549    // Translators: %s is the plugin name, as defined by the plugin itself.
     550    $close_button_text = sprintf( __( 'I understand, please close %s.', 'wporg-plugins' ), get_the_title() );
     551    ?>
     552    <button class="show-dialog button" onclick="this.nextElementSibling.showModal()"><?php echo $close_button_text; ?></button>
     553    <dialog>
     554        <a onclick="this.parentNode.close()" class="close dashicons dashicons-no-alt"></a>
     555        <strong><?php _e( 'Close your plugin?', 'wporg-plugins' ); ?></strong>
     556        <div class="notice notice-warning notice-alt"><p>
     557            <?php _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' ); ?>
     558        </p></div>
     559
     560        <form method="POST" action="<?php echo esc_url( $close_link ); ?>">
     561            <p>
     562                <label>
     563                    <input type="checkbox" name="confirm" required />
     564                    <?php printf(
     565                        /* translators: %s: The plugin name. */
     566                        __( 'Yes, I wish to close %s.', 'wporg-plugins' ),
     567                        '<code>' . get_the_title() . '</code>'
     568                    ); ?>
     569                </label>
     570            </p>
     571            <p>
     572                <label>
     573                    <input type="checkbox" name="confirm" required />
     574                    <?php _e( 'Yes, I understand that this is permanent.', 'wporg-plugins' ); ?>
     575                </label>
     576            </p>
     577            <p>
     578                <label>
     579                    <input type="checkbox" name="confirm" required />
     580                    <?php _e( 'I am not working on a newer version to submit to the plugin directory.', 'wporg-plugins' ); ?>
     581                </label>
     582            </p>
     583            <p>
     584                <label>
     585                    <?php printf(
     586                        /* translators: %s: The plugin slug. */
     587                        __( 'Please enter the plugin slug %s below.', 'wporg-plugins' ),
     588                        '<code>' . esc_html( $post->post_name ) . '</code>'
     589                    ); ?><br>
     590                    <input type="text" name="confirm" pattern="<?php echo esc_attr( $post->post_name ); ?>" required class="has-large-font-size" />
     591                </label>
     592            </p>
     593            <p>
     594                <?php printf( __( 'If you have any questions, please contact <a href="mailto:%1$s">%1$s</a> before proceeding with a link to your plugin and your questions.', 'wporg-plugins' ), 'plugins@wordpress.org' ); ?>
     595            <p>
     596                <input class="button" type="submit" value="<?php echo esc_attr( $close_button_text ); ?>" />
     597            </p>
     598        </form>
     599    </dialog>
     600    <?php
    551601}
    552602
Note: See TracChangeset for help on using the changeset viewer.