Changeset 10776
- Timestamp:
- 03/05/2021 12:42:40 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/admin-notices.php
r10771 r10776 15 15 public static function init() { 16 16 add_action( 'admin_notices', [ __CLASS__, 'show_new_handbook_message' ] ); 17 add_action( 'admin_notices', [ __CLASS__, 'show_imported_handbook_notice' ] ); 17 18 } 18 19 … … 61 62 } 62 63 64 /** 65 * Outputs admin notice indicating the handbook is an imported handbook, if applicable. 66 * 67 * @access public 68 */ 69 public static function show_imported_handbook_notice() { 70 global $wp_query; 71 72 // Bail if handbook importer is not available. 73 if ( ! class_exists( 'WPorg_Handbook_Importer' ) ) { 74 return; 75 } 76 77 $current_screen = get_current_screen(); 78 79 // Only show message in listing of handbook posts when no posts are present yet. 80 if ( 81 $current_screen 82 && 83 'edit' === $current_screen->base 84 && 85 in_array( $current_screen->post_type, wporg_get_handbook_post_types() ) 86 && 87 WPorg_Handbook_Importer::is_handbook_imported( $current_screen->post_type ) 88 ) { 89 $handbook_config = WPorg_Handbook_Init::get_handbooks_config( $current_screen->post_type ); 90 91 $handbook = WPorg_Handbook_Init::get_handbook( $current_screen->post_type ); 92 if ( ! $handbook ) { 93 return; 94 } 95 96 $importer = $handbook->get_importer(); 97 $interval = $importer ? $importer->get_cron_interval() : false; 98 $interval_display = ! empty( $interval['display'] ) ? strtolower( $interval['display'] ) : __( 'DISABLED', 'wporg' ); 99 100 echo '<div class="notice notice-info"><p>'; 101 printf( 102 /* translators: 1: URL to remote manifest. 2: cron interval. */ 103 __( '<strong>This is an imported handbook!</strong> This handbook is imported according to a <a href="%1$s">remote manifest</a>. Any local changes will be overwritten during the next import, so make any changes at the remote location. Import interval: <strong>%2$s</strong>.', 'wporg' ), 104 $handbook_config['manifest'], 105 $interval_display 106 ); 107 echo "</p></div>\n"; 108 } 109 } 110 63 111 } 64 112
Note: See TracChangeset
for help on using the changeset viewer.