Changeset 13718
- Timestamp:
- 05/16/2024 07:08:56 AM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r13717 r13718 406 406 delete_post_meta( $plugin->ID, 'block_name' ); 407 407 delete_post_meta( $plugin->ID, 'block_title' ); 408 408 409 foreach ( $blocks as $block ) { 409 410 add_post_meta( $plugin->ID, 'block_name', $block->name, false ); 410 add_post_meta( $plugin->ID, 'block_title', ( $block->title ?: $plugin->post_title ), false );411 add_post_meta( $plugin->ID, 'block_title', $block->title, false ); 411 412 } 412 413 } … … 843 844 } 844 845 845 foreach ( $blocks as $block_name => $block ) { 846 // Set the fallback name for the blocks. 847 foreach ( $blocks as $block_name => &$block ) { 846 848 if ( empty( $block->title ) ) { 847 $blocks[ $block_name ]->title = $readme->name; 849 $block->title = $block_name; 850 // If the block duplicates the namespace, remove it. 'plugin-slug/plugin-slug-block-name' 851 $block->title = preg_replace( '#^([^/]+)/\\1-?#i', '$1/', $block->title ); 852 // Treat any non-wordy characters as spaces. 853 $block->title = preg_replace( '/[^a-z]+/', ' ', $block_name ); 854 // Capitalise all words. 855 $block->title = ucwords( $block->title ); 848 856 } 849 857 }
Note: See TracChangeset
for help on using the changeset viewer.