Making WordPress.org

Changeset 10181

Timestamp:
08/19/2020 04:16:47 AM (4 years ago)
Author:
tellyworth
Message:

Plugin dir: add test button for plugin reviewers.

See #5303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php

    r10180 r10181  
    8484            } elseif ( $_POST && ! empty( $_POST['block-directory-edit'] ) ) {
    8585                self::handle_edit_form();
     86
     87
    8688            }
    8789            ?>
     
    142144    }
    143145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
    144165    protected static function plugin_is_in_block_directory( $slug ) {
    145166        $plugin = Plugin_Directory::get_plugin_post( $slug );
     
    162183        echo '<input type="hidden" name="plugin-id" value="' . esc_attr( $plugin->ID ) . '" />';
    163184
     185
    164186        if ( self::plugin_is_in_block_directory( $plugin->post_name ) ) {
    165187            echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
    166188            // translators: %s plugin title.
    167             echo '<p><button class="button button-secondary button-large" type="submit" name="block-directory-edit" value="remove">' . sprintf( __( 'Remove %s from Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button></p>';
     189            echo '<>';
    168190        } else if ( ! $has_errors ) {
    169191            echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
    170192            // translators: %s plugin title.
    171             echo '<p><button class="button button-primary button-large" type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button></p>';
    172         }
    173 
     193            echo '<button class="button button-primary button-large" type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
     194        }
     195
     196        if ( current_user_can( 'edit_post', $post->ID ) ) {
     197            echo wp_nonce_field( 'block-directory-test-' . $plugin->ID, 'block-directory-nonce' );
     198            // translators: %s plugin title.
     199            $disabled = ( wp_cache_get( "plugin-e2e-test-{$plugin->ID}", 'plugin-test' ) ? ' disabled="disabled"' : '' );
     200            echo '<button class="button button-secondary button-large" type="submit" name="block-directory-test" value="test"' . $disabled . '>' . sprintf( __( 'Test %s', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
     201        }
     202
     203        echo '</p>';
    174204        echo '</form>';
    175205    }
     
    271301                // Plugin reviewers etc
    272302                echo '<h3>' . __( 'Plugin Review Tools', 'wporg-plugins' ) . '</h3>';
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
    273325                echo '<ul>';
    274326                echo '<li><a href="' . get_edit_post_link( $plugin->ID ) . '">' . __( 'Edit plugin', 'wporg-plugins' ) . '</a></li>';
     
    277329
    278330                self::render_plugin_actions( $plugin, $has_errors );
     331
    279332            } elseif ( current_user_can( 'plugin_admin_edit', $plugin->ID ) ) {
    280333                // Plugin committers
Note: See TracChangeset for help on using the changeset viewer.