Changeset 2982
- Timestamp:
- 04/19/2016 08:08:25 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
r2929 r2982 28 28 add_action( 'add_meta_boxes', array( $this, 'register_admin_metaboxes' ), 10, 2 ); 29 29 add_action( 'do_meta_boxes', array( $this, 'replace_title_global' ) ); 30 add_filter( 'dashboard_glance_items', array( $this, 'plugin_glance_items' ) ); 30 31 31 32 add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) ); … … 64 65 $title = sprintf( $title, get_the_title() ); // esc_html() on output 65 66 } 67 } 68 69 /** 70 * Filters the array of extra elements to list in the 'At a Glance' 71 * dashboard widget. 72 * 73 * @param array $items Array of extra 'At a Glance' widget items. 74 * @return array 75 */ 76 public function plugin_glance_items( $items ) { 77 $post_type = 'plugin'; 78 $num_posts = wp_count_posts( $post_type ); 79 80 if ( $num_posts && $num_posts->publish ) { 81 $text = sprintf( _n( '%s Plugin', '%s Plugins', $num_posts->publish ), number_format_i18n( $num_posts->publish ) ); 82 $post_type_object = get_post_type_object( $post_type ); 83 84 if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { 85 $item = sprintf( '<a class="plugin-count" href="edit.php?post_type=%1$s">%2$s</a>', $post_type, $text ); 86 } else { 87 $item = sprintf( '<span class="plugin-count">%s</span>', $text ); 88 } 89 90 $items[] = $item . '<style>#dashboard_right_now .plugin-count:before { content: "\f106"; }</style>'; 91 } 92 93 return $items; 66 94 } 67 95
Note: See TracChangeset
for help on using the changeset viewer.