Changeset 3095 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
- Timestamp:
- 05/06/2016 10:17:09 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r3093 r3095 25 25 */ 26 26 private function __construct() { 27 add_filter( 'dashboard_glance_items', array( $this, 'plugin_glance_items' ) ); 28 29 add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); 30 add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ) ); 31 32 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); 33 add_filter( 'admin_head-edit.php', array( $this, 'plugin_posts_list_table' ) ); 34 add_action( 'admin_notices', array( $this, 'add_post_status_notice' ) ); 35 add_action( 'all_admin_notices', array( $this, 'admin_notices' ) ); 36 add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 ); 37 38 add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 ); 39 add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 ); 40 27 41 // Admin Metaboxes 28 42 add_action( 'add_meta_boxes', array( $this, 'register_admin_metaboxes' ), 10, 2 ); 29 43 add_action( 'do_meta_boxes', array( $this, 'replace_title_global' ) ); 30 add_filter( 'dashboard_glance_items', array( $this, 'plugin_glance_items' ) );31 32 add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );33 add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ) );34 35 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );36 add_filter( 'admin_head-edit.php', array( $this, 'plugin_posts_list_table' ) );37 add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 );38 39 add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 );40 add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 );41 44 42 45 add_filter( 'postbox_classes_plugin_internal-notes', array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'postbox_classes' ) ); … … 221 224 $wp_list_table->prepare_items(); 222 225 } 226 } 227 228 /** 229 * Adds banners to provide a clearer status for a plugin. 230 * 231 * This is being displayed in the edit screen for a particular plugin, 232 * providing more context about the current status of a plugin for both 233 * Committers and Reviewers/Admins. 234 */ 235 public function add_post_status_notice() { 236 if ( 'post.php' !== $GLOBALS['pagenow'] ) { 237 return; 238 } 239 240 $message = ''; 241 $post = get_post(); 242 $is_admin = current_user_can( 'plugin_approve' ); 243 244 switch ( $post->post_status ) { 245 case 'draft': 246 case 'pending': 247 $message = __( 'This plugin is requested and not visible to the public yet.', 'wporg-plugins' ); 248 if ( ! $is_admin ) { 249 $message .= ' ' . __( 'Please be patient as your plugin gets reviewed.', 'wporg-plugins' ); 250 } 251 break; 252 253 case 'rejected': 254 $message = __( 'This plugin is rejected and is not visible to the public.', 'wporg-plugins' ); 255 break; 256 257 case 'approved': 258 $message = __( 'This plugin is approved and awaiting data upload but not visible to the public yet.', 'wporg-plugins' ); 259 if ( ! $is_admin ) { 260 $message .= ' ' . __( 'Once you make your first commit, the plugin will become public.', 'wporg-plugins' ); 261 } 262 break; 263 264 case 'closed': 265 $message = __( 'This plugin is closed and is not visible to the public.', 'wporg-plugins' ); 266 break; 267 268 case 'disabled': 269 $message = __( 'This plugin is closed and is not visible to the public.', 'wporg-plugins' ); 270 if ( $is_admin ) { 271 $message = __( 'This plugin is disabled (closed, but actively serving updates) and is not visible to the public.', 'wporg-plugins' ); 272 } 273 break; 274 } 275 276 if ( $message ) { 277 add_settings_error( 'wporg-plugins', 'status-notice', $message, 'updated' ); 278 } 279 } 280 281 /** 282 * Displays all admin notices registered to `wporg-plugins`. 283 */ 284 public function admin_notices() { 285 settings_errors( 'wporg-plugins' ); 223 286 } 224 287
Note: See TracChangeset
for help on using the changeset viewer.