wp/wp-admin/includes/class-wp-links-list-table.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
--- a/wp/wp-admin/includes/class-wp-links-list-table.php	Mon Jun 08 16:11:51 2015 +0000
+++ b/wp/wp-admin/includes/class-wp-links-list-table.php	Tue Jun 09 03:35:32 2015 +0200
@@ -9,18 +9,28 @@
  */
 class WP_Links_List_Table extends WP_List_Table {
 
-	function __construct( $args = array() ) {
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
 		parent::__construct( array(
 			'plural' => 'bookmarks',
 			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
 		) );
 	}
 
-	function ajax_user_can() {
+	public function ajax_user_can() {
 		return current_user_can( 'manage_links' );
 	}
 
-	function prepare_items() {
+	public function prepare_items() {
 		global $cat_id, $s, $orderby, $order;
 
 		wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) );
@@ -39,18 +49,18 @@
 		$this->items = get_bookmarks( $args );
 	}
 
-	function no_items() {
+	public function no_items() {
 		_e( 'No links found.' );
 	}
 
-	function get_bulk_actions() {
+	protected function get_bulk_actions() {
 		$actions = array();
 		$actions['delete'] = __( 'Delete' );
 
 		return $actions;
 	}
 
-	function extra_tablenav( $which ) {
+	protected function extra_tablenav( $which ) {
 		global $cat_id;
 
 		if ( 'top' != $which )
@@ -62,20 +72,22 @@
 				'selected' => $cat_id,
 				'name' => 'cat_id',
 				'taxonomy' => 'link_category',
-				'show_option_all' => __( 'View all categories' ),
+				'show_option_all' => __( 'All categories' ),
 				'hide_empty' => true,
 				'hierarchical' => 1,
 				'show_count' => 0,
 				'orderby' => 'name',
 			);
+
+			echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>';
 			wp_dropdown_categories( $dropdown_options );
-			submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
+			submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
 ?>
 		</div>
 <?php
 	}
 
-	function get_columns() {
+	public function get_columns() {
 		return array(
 			'cb'         => '<input type="checkbox" />',
 			'name'       => _x( 'Name', 'link name' ),
@@ -87,7 +99,7 @@
 		);
 	}
 
-	function get_sortable_columns() {
+	protected function get_sortable_columns() {
 		return array(
 			'name'    => 'name',
 			'url'     => 'url',
@@ -96,11 +108,9 @@
 		);
 	}
 
-	function display_rows() {
+	public function display_rows() {
 		global $cat_id;
 
-		$alt = 0;
-
 		foreach ( $this->items as $link ) {
 			$link = sanitize_bookmark( $link );
 			$link->link_name = esc_attr( $link->link_name );
@@ -110,11 +120,10 @@
 
 			$visible = ( $link->link_visible == 'Y' ) ? __( 'Yes' ) : __( 'No' );
 			$rating  = $link->link_rating;
-			$style = ( $alt++ % 2 ) ? '' : ' class="alternate"';
 
 			$edit_link = get_edit_bookmark_link( $link );
 ?>
-		<tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
+		<tr id="link-<?php echo $link->link_id; ?>">
 <?php
 
 			list( $columns, $hidden ) = $this->get_column_info();
@@ -176,7 +185,17 @@
 						break;
 					default:
 						?>
-						<td <?php echo $attributes ?>><?php do_action( 'manage_link_custom_column', $column_name, $link->link_id ); ?></td>
+						<td <?php echo $attributes ?>><?php
+							/**
+							 * Fires for each registered custom link column.
+							 *
+							 * @since 2.1.0
+							 *
+							 * @param string $column_name Name of the custom column.
+							 * @param int    $link_id     Link ID.
+							 */
+							do_action( 'manage_link_custom_column', $column_name, $link->link_id );
+						?></td>
 						<?php
 						break;
 				}