Changeset 4276 for trunk/wp-admin/upload.php
- Timestamp:
- 10/03/2006 03:40:26 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upload.php
r4274 r4276 25 25 $all_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'"); 26 26 $post_atts = 0; 27 27 28 if ( $pid ) { 28 $wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload'); 29 // 0 => tab display name, 1 => required cap, 2 => function that produces tab content, 3 => total number objects OR array(total, objects per page), 4 => add_query_args 30 $wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0); 29 31 if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") ) 30 $wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse" );32 $wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse", $action ? 0 : $post_atts); 31 33 if ( $post_atts < $all_atts ) 32 $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse' );34 $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts); 33 35 } else 34 $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse' );36 $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts); 35 37 36 38 $wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() )); … … 55 57 foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check 56 58 $class = 'upload-tab'; 57 $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '' ) );58 if ( isset($tab_array[ 3]) && is_array($tab_array[3]) )59 add_query_arg( $tab_array[ 3], $href );59 $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') ); 60 if ( isset($tab_array[4]) && is_array($tab_array[4]) ) 61 add_query_arg( $tab_array[4], $href ); 60 62 $_href = wp_specialchars( $href, 1 ); 61 if ( $tab == $t ) 63 $page_links = ''; 64 if ( $tab == $t ) { 62 65 $class .= ' current'; 63 echo "\t<li class='$class left'><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a></li>\n"; 66 if ( $tab_array[3] ) { 67 if ( is_array($tab_array[3]) ) { 68 $total = $tab_array[3][0]; 69 $per = $tab_array[3][1]; 70 } else { 71 $total = $tab_array[3]; 72 $per = 10; 73 } 74 $page_links = paginate_links( array( 75 'base' => add_query_arg( 'paged', '%#%' ), 76 'format' => '', 77 'total' => ceil($total / $per), 78 'current' => $paged ? $paged : 1, 79 'prev_text' => '«', 80 'next_text' => '»' 81 )); 82 if ( $page_links ) 83 $page_links = "<span id='current-tab-nav'>: $page_links</span>"; 84 } 85 } 86 87 echo "\t<li class='$class left'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n"; 64 88 } 89 unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class); 65 90 echo "</ul>\n\n"; 66 91
Note: See TracChangeset
for help on using the changeset viewer.