Changeset 10003
- Timestamp:
- 07/03/2020 04:10:55 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-block-plugin-checker.php
r10000 r10003 68 68 __FUNCTION__, 69 69 'error', 70 sprintf( __( 'Invalid url %s', 'wporg-plugins' ), $url ),70 sprintf( __( 'Invalid url: %s', 'wporg-plugins' ), $url ), 71 71 $url 72 72 ); … … 78 78 __FUNCTION__, 79 79 'error', 80 sprintf( __( 'URL must be GitHub or plugins.svn.wordpress.org %s', 'wporg-plugins' ), $url ),80 sprintf( __( 'URL must be GitHub or plugins.svn.wordpress.org: %s', 'wporg-plugins' ), $url ), 81 81 $url 82 82 ); … … 90 90 __FUNCTION__, 91 91 'error', 92 sprintf( __( 'URL must be a plugin repository %s', 'wporg-plugins' ), $url ),92 sprintf( __( 'URL must be a plugin repository: %s', 'wporg-plugins' ), $url ), 93 93 $url 94 94 ); … … 116 116 __FUNCTION__, 117 117 'error', 118 sprintf( __( 'URL must be a plugin repository %s', 'wporg-plugins' ), $url ),118 sprintf( __( 'URL must be a plugin repository: %s', 'wporg-plugins' ), $url ), 119 119 $url 120 120 ); … … 213 213 214 214 public function find_blocks( $base_dir ) { 215 $blocks = array(); 215 216 $this->block_json_files = Filesystem::list_files( $base_dir, true, '!(?:^|/)block\.json$!i' ); 216 217 if ( false && ! empty( $this->block_json_files ) ) { … … 282 283 $this->record_result( __FUNCTION__, 283 284 'error', 284 __( 'Missing readme.txt file ', 'wporg-plugins' ),285 __( 'Missing readme.txt file.', 'wporg-plugins' ), 285 286 $this->relative_filename( $this->readme_path ) 286 287 ); … … 333 334 $this->record_result( __FUNCTION__, 334 335 'info', 335 sprintf( __( 'Block name already exists in plugin %s', 'wporg-plugins' ), $query->posts[0]->post_name ),336 sprintf( __( 'Block name %s already exists in plugin %s.', 'wporg-plugins' ), $block->name, $query->posts[0]->post_name ), 336 337 [ 'block_name' => $block->name, 'slug' => $post->post_name ] 337 338 ); … … 354 355 $this->record_result( __FUNCTION__, 355 356 'info', 356 sprintf( _n( 'Found %d block ', 'Found %d blocks', count( $this->blocks ), 'wporg-plugins' ), count( $this->blocks ) ),357 sprintf( _n( 'Found %d block.', 'Found %d blocks.', count( $this->blocks ), 'wporg-plugins' ), count( $this->blocks ) ), 357 358 array_keys( $this->blocks ) 358 359 ); … … 368 369 $this->record_result( __FUNCTION__, 369 370 'info', 370 sprintf( __( 'block.json file exists for block %s ', 'wporg-plugins' ), $block_name ),371 sprintf( __( 'block.json file exists for block %s.', 'wporg-plugins' ), $block_name ), 371 372 $this->block_json_files[ $block_name ] 372 373 ); … … 377 378 $this->record_result( __FUNCTION__, 378 379 'warning', 379 __( 'No block.json files were found ', 'wporg-plugins' )380 __( 'No block.json files were found.', 'wporg-plugins' ) 380 381 ); 381 382 } … … 392 393 $this->record_result( __FUNCTION__, 393 394 'info', 394 sprintf( __( 'Scripts found for block %s ', 'wporg-plugins' ), $block_name ),395 sprintf( __( 'Scripts found for block %s.', 'wporg-plugins' ), $block_name ), 395 396 $block_scripts[ $block_name ] 396 397 ); … … 398 399 $this->record_result( __FUNCTION__, 399 400 'warning', 400 sprintf( __( 'No scripts found for block %s ', 'wporg-plugins' ), $block_name ),401 sprintf( __( 'No scripts found for block %s.', 'wporg-plugins' ), $block_name ), 401 402 $block_name 402 403 ); … … 414 415 $this->record_result( __FUNCTION__, 415 416 'info', 416 sprintf( __( 'Script file exists for block %s ', 'wporg-plugins' ), $block_name ),417 sprintf( __( 'Script file exists for block %s.', 'wporg-plugins' ), $block_name ), 417 418 $script 418 419 ); … … 420 421 $this->record_result( __FUNCTION__, 421 422 'warning', 422 sprintf( __( 'Missing script file for block %s ', 'wporg-plugins' ), $block_name ),423 sprintf( __( 'Missing script file for block %s.', 'wporg-plugins' ), $block_name ), 423 424 $script 424 425 ); … … 445 446 $this->record_result( __FUNCTION__, 446 447 'error', 447 sprintf( __( ' registerBlockType() must be called in a JavaScript file', 'wporg-plugins' ) )448 sprintf( __( '<code>registerBlockType()</code> must be called in a JavaScript file.', 'wporg-plugins' ) ) 448 449 ); 449 450 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php
r9993 r10003 7 7 8 8 /** 9 * Displays a form to validate block plugins. 9 * Displays a form to validate block plugins. 10 10 */ 11 11 public static function display() { 12 $plugin_url = $_REQUEST['plugin_url'] ?? ''; 12 13 ?> 13 14 <div class="wrap"> 14 <?php15 if ( $_POST && wp_verify_nonce( $_POST['block-nonce'], 'validate-block-plugin' ) ) {16 17 self::validate_block( $_POST['plugin_url'] );18 }19 20 $plugin_url = $_REQUEST['plugin_url'] ?? '';21 ?>22 23 15 <form method="post" action=""> 24 16 <p> 25 <input type="text" name="plugin_url" size="70" placeholder="https://plugins.svn.wordpress.org/" value="<?php echo esc_url( $plugin_url ); ?>" /> 17 <label for="plugin_url"><?php _e( 'Plugin repo URL', 'wporg-plugins' ); ?></label> 18 </p> 19 <p> 20 <input type="text" id="plugin_url" name="plugin_url" size="70" placeholder="https://plugins.svn.wordpress.org/" value="<?php echo esc_url( $plugin_url ); ?>" /> 26 21 <input type="submit" class="button button-secondary" value="<?php esc_attr_e( 'Validate!', 'wporg-plugins' ); ?>" /> 27 22 <?php wp_nonce_field( 'validate-block-plugin', 'block-nonce' ); ?> … … 29 24 </form> 30 25 26 <?php 27 if ( $_POST && wp_verify_nonce( $_POST['block-nonce'], 'validate-block-plugin' ) ) { 28 self::validate_block( $_POST['plugin_url'] ); 29 } 30 ?> 31 31 </div> 32 32 <?php … … 35 35 /** 36 36 * Validates readme.txt contents and adds feedback. 37 * 38 * @param string $plugin_url The URL of a Subversion or GitHub repository. 37 39 */ 38 40 protected static function validate_block( $plugin_url ) { … … 41 43 $results = $checker->run_check_plugin_repo( $plugin_url ); 42 44 45 echo '<h2>' . __( 'Results', 'wporg-plugins' ) . '</h2>'; 46 43 47 if ( $checker->repo_url && $checker->repo_revision ) { 44 echo '<h2>Validating..</h2>'; 45 echo '<p>Results for ' . esc_url( $checker->repo_url ) . ' revision ' . esc_html( $checker->repo_revision ) . '</p>'; 48 echo '<p>'; 49 printf( 50 'Results for %1$s revision %2$s', 51 '<code>' . esc_url( $checker->repo_url ) . '</code>', 52 esc_html( $checker->repo_revision ) 53 ); 54 echo '</p>'; 46 55 } 47 56 … … 50 59 $results_by_type[ $item->type ][] = $item; 51 60 } 52 53 61 54 62 $output = ''; … … 60 68 ); 61 69 foreach ( $error_types as $type => $warning_label ) { 70 if ( empty( $results_by_type[ $type ] ) ) { 71 continue; 72 } 62 73 63 if ( empty( $results_by_type[ $type ] ) ) 64 continue; 65 66 $output .= "<h3>{$warning_label}</h3>\n"; 67 $output .= "<div class='notice notice-{$type} notice-alt'>\n"; 68 $output .= "<ul class='{$type}'>\n"; 69 foreach ( $results_by_type[ $type ] as $item ) { 70 $output .= "<li title='{$item->check_name}'><a href='/hypothetical/doc/page#{$item->check_name}'><span class='dashicons dashicons-info'></span></a> {$item->message}</li>\n"; 74 $output .= "<h3>{$warning_label}</h3>\n"; 75 $output .= "<div class='notice notice-{$type} notice-alt'>\n"; 76 $output .= "<ul class='{$type}'>\n"; 77 foreach ( $results_by_type[ $type ] as $item ) { 78 $docs_link = ''; 79 if ( 'check' === substr( $item->check_name, 0, 5 ) ) { 80 $docs_link = "<a href='/hypothetical/doc/page#{$item->check_name}'>" . __( 'More about this.', 'wporg-plugins' ) . '</a>'; 71 81 } 72 $output .= "</ul>\n"; 73 $output .= "</div>\n"; 82 $output .= "<li class='{$item->check_name}'>{$item->message} {$docs_link}</li>\n"; 83 } 84 $output .= "</ul>\n"; 85 $output .= "</div>\n"; 74 86 } 75 87
Note: See TracChangeset
for help on using the changeset viewer.