Changeset 12507
- Timestamp:
- 03/29/2023 08:31:18 AM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r12492 r12507 38 38 add_action( 'all_admin_notices', array( $this, 'admin_notices' ) ); 39 39 add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 ); 40 add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); 40 41 41 42 add_filter( 'wp_insert_post_data', array( $this, 'check_existing_plugin_slug_on_post_update' ), 10, 2 ); … … 141 142 } 142 143 } 144 } 145 146 /** 147 * Add the Repo Tools menu item to the admin menu. 148 */ 149 public function admin_menu() { 150 add_menu_page( 151 __( 'Plugin Tools', 'wporg-plugins' ), 152 __( 'Plugin Tools', 'wporg-plugins' ), 153 'plugin_review', 154 'plugin-tools', 155 array( $this, 'plugin_tools_page' ), 156 'dashicons-admin-tools', 157 30 158 ); 159 } 160 161 /** 162 * Render the Repo Tools dashboard page, just a basic list of the menu items. 163 */ 164 public function plugin_tools_page() { 165 global $submenu; 166 ?> 167 <div class="wrap"> 168 <h1><?php _e( 'Plugin Tools', 'wporg-plugins' ); ?></h1> 169 <ul> 170 <?php 171 foreach ( $submenu['plugin-tools'] ?? [] as $page ) { 172 if ( 'plugin-tools' === $page[2] ) { 173 continue; 174 } 175 176 printf( 177 '<li><a href="%s">%s</a></li>', 178 esc_url( admin_url( 'admin.php?page=' . $page[2] ) ), 179 esc_html( $page[0] ) 180 ); 181 } 182 ?> 183 </ul> 184 </div> 185 <?php 143 186 } 144 187 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-author-cards.php
r7310 r12507 4 4 use WordPressdotorg\Plugin_Directory; 5 5 use WordPressdotorg\Plugin_Directory\Admin\Metabox\Author_Card; 6 use const WordPressdotorg\Plugin_Directory\PLUGIN_FILE; 6 7 7 8 /** … … 26 27 private function __construct() { 27 28 add_action( 'admin_menu', array( $this, 'add_to_menu' ) ); 28 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );29 29 } 30 30 31 31 /** 32 * Enqueue JS and CSS assets needed for any wp-admin screens. 33 * 34 * @param string $hook_suffix The hook suffix of the current screen. 32 * Add the Author Cards tool to the Tools menu. 35 33 */ 36 public function enqueue_assets( $hook_suffix ) {37 switch ( $hook_suffix ) {38 case 'tools_page_authorcards':39 wp_enqueue_style( 'plugin-admin-post-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 5 );40 break;41 }42 }43 44 34 public function add_to_menu() { 45 add_submenu_page(46 ' tools.php',35 $hook = add_submenu_page( 36 'plugin-tools', 47 37 __( 'Author Cards', 'wporg-plugins' ), 48 38 __( 'Author Cards', 'wporg-plugins' ), … … 51 41 array( $this, 'show_form' ) 52 42 ); 43 44 add_action( "admin_print_styles-{$hook}", array( $this, 'enqueue_assets' ) ); 53 45 } 54 46 47 /** 48 * Enqueue JS and CSS assets needed for any wp-admin screens. 49 */ 50 public function enqueue_assets() { 51 wp_enqueue_style( 'plugin-admin-post-css', plugins_url( 'css/edit-form.css', PLUGIN_FILE ), array( 'edit' ), 5 ); 52 } 53 54 /** 55 * Display the Author Cards tool. 56 */ 55 57 public function show_form() { 56 58 if ( ! current_user_can( 'plugin_review' ) ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php
r11742 r12507 32 32 public function add_to_menu() { 33 33 add_submenu_page( 34 ' tools.php',34 'plugin-tools', 35 35 __( 'Stats Report', 'wporg-plugins' ), 36 36 __( 'Stats Report', 'wporg-plugins' ),
Note: See TracChangeset
for help on using the changeset viewer.