Changeset 16227
- Timestamp:
- 11/06/2010 10:47:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-media-list-table.php
r16205 r16227 10 10 11 11 function WP_Media_List_Table() { 12 global $detached; 13 14 $detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); 12 $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); 15 13 16 14 parent::WP_List_Table( array( 17 'screen' => $detached ? 'upload-detached' : 'upload',18 15 'plural' => 'media' 19 16 ) ); … … 45 42 46 43 function get_views() { 47 global $wpdb, $post_mime_types, $ detached, $avail_post_mime_types;44 global $wpdb, $post_mime_types, $avail_post_mime_types; 48 45 49 46 $type_links = array(); … … 57 54 $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; 58 55 59 $class = ( empty($_GET['post_mime_type']) && !$ detached && !isset($_GET['status']) ) ? ' class="current"' : '';56 $class = ( empty($_GET['post_mime_type']) && !$this->detached && !isset($_GET['status']) ) ? ' class="current"' : ''; 60 57 $type_links['all'] = "<a href='upload.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</a>'; 61 58 foreach ( $post_mime_types as $mime_type => $label ) { … … 70 67 $type_links[$mime_type] = "<a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>'; 71 68 } 72 $type_links['detached'] = '<a href="upload.php?detached=1"' . ( $ detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</a>';69 $type_links['detached'] = '<a href="upload.php?detached=1"' . ( $this->detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</a>'; 73 70 74 71 if ( !empty($_num_posts['trash']) ) … … 79 76 80 77 function get_bulk_actions() { 81 global $detached;82 83 78 $actions = array(); 84 79 $actions['delete'] = __( 'Delete Permanently' ); 85 if ( $ detached )80 if ( $this->detached ) 86 81 $actions['attach'] = __( 'Attach to a post' ); 87 82 … … 90 85 91 86 function extra_tablenav( $which ) { 92 global $post_type , $detached;87 global $post_type; 93 88 $post_type_obj = get_post_type_object( $post_type ); 94 89 ?> 95 90 <div class="alignleft actions"> 96 91 <?php 97 if ( 'top' == $which && !is_singular() && !$ detached && !$this->is_trash ) {92 if ( 'top' == $which && !is_singular() && !$this->detached && !$this->is_trash ) { 98 93 $this->months_dropdown( $post_type ); 99 94 … … 102 97 } 103 98 104 if ( $ detached ) {99 if ( $this->detached ) { 105 100 submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); 106 101 } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { … … 129 124 130 125 function no_items() { 131 global $detached; 132 133 if ( $detached ) { 126 if ( $this->detached ) { 134 127 ?> 135 128 <div class="tablenav"> … … 152 145 //$posts_columns['tags'] = _x( 'Tags', 'column name' ); 153 146 /* translators: column name */ 154 if ( 'upload' == $this->screen->id ) {147 if ( !$this->detached ) { 155 148 $posts_columns['parent'] = _x( 'Attached to', 'column name' ); 156 149 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>'; … … 158 151 /* translators: column name */ 159 152 $posts_columns['date'] = _x( 'Date', 'column name' ); 160 $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, 'upload' != $this->screen->id );153 $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); 161 154 162 155 return $posts_columns; … … 174 167 175 168 function display_rows() { 176 global $ detached, $post, $id;177 178 if ( $ detached ) {169 global $post, $id; 170 171 if ( $this->detached ) { 179 172 $this->display_orphans(); 180 173 return;
Note: See TracChangeset
for help on using the changeset viewer.