Changeset 10036
- Timestamp:
- 07/08/2020 05:06:56 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php
r10033 r10036 89 89 } 90 90 91 $results_by_type = array(); 92 foreach ( $results as $item ) { 93 $results_by_type[ $item->type ][] = $item; 94 } 95 91 96 if ( $checker->slug ) { 92 97 $plugin = Plugin_Directory::get_plugin_post( $checker->slug ); 93 98 if ( current_user_can( 'edit_post', $plugin->ID ) ) { 94 99 echo '<form method="post">'; 95 echo '<fieldset>'; 96 echo '<legend>' . __( 'Plugin Review Tools', 'wporg-plugins' ) . '</legend>'; 100 echo '<h3>' . __( 'Plugin Review Tools', 'wporg-plugins' ) . '</h3>'; 97 101 echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' ); 98 102 echo '<input type="hidden" name="plugin-id" value="' . esc_attr( $plugin->ID ) . '" />'; 99 if ( self::plugin_is_in_block_directory( $checker->slug ) ) { 100 echo '<button type="submit" name="block-directory-edit" value="remove">' . __( 'Remove from Block Directory', 'wporg-plugins' ) . '</button>'; 103 echo '<p>'; 104 if ( ! empty( $results_by_type['error'] ) ) { 105 printf( __( "%s can't be added to the block directory, due to errors in validation.", 'wporg-plugins' ), $plugin->post_title ); 106 } else if ( self::plugin_is_in_block_directory( $checker->slug ) ) { 107 echo '<button type="submit" name="block-directory-edit" value="remove">' . sprintf( __( 'Remove %s from Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>'; 101 108 } else { 102 echo '<button type="submit" name="block-directory-edit" value="add">' . __( 'Add to Block Directory', 'wporg-plugins') . '</button>';109 echo '<button type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>'; 103 110 } 111 echo '</p>'; 104 112 105 113 echo '<ul><li><a href="' . get_edit_post_link( $plugin->ID ) . '">' . __( 'Edit plugin', 'wporg-plugins' ) . '</a></li>'; 106 114 echo '<li><a href="' . esc_url( 'https://plugins.trac.wordpress.org/browser/' . $checker->slug . '/trunk' ) .'">' . __( 'Trac browser', 'wporg-plugins' ) . '</a></li></ul>'; 107 echo '</fieldset>';108 115 echo '</form>'; 109 116 } 110 }111 112 $results_by_type = array();113 foreach ( $results as $item ) {114 $results_by_type[ $item->type ][] = $item;115 117 } 116 118
Note: See TracChangeset
for help on using the changeset viewer.