get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'"); $post_atts = 0; if ( $pid ) { // 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 $wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0); if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") ) $wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse", $action ? 0 : $post_atts); if ( $post_atts < $all_atts ) $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts); } else $wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts); $wp_upload_tabs = array_merge($wp_upload_tabs, apply_filters( 'wp_upload_tabs', array() )); if ( !is_callable($wp_upload_tabs[$tab][2]) ) { $to_tab = isset($wp_upload_tabs['upload']) ? 'upload' : 'browse-all'; wp_redirect( add_query_arg( 'tab', $to_tab ) ); exit; } foreach ( $wp_upload_tabs as $t => $tab_array ) { if ( !current_user_can( $tab_array[1] ) ) { unset($wp_upload_tabs[$t]); if ( $tab == $t ) wp_die(__("You are not allowed to be here")); } } if ( 'inline' == $style ) : ?> > <?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — WordPress text_direction) ) : ?>

\n"; foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check $href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') ); if ( isset($tab_array[4]) && is_array($tab_array[4]) ) $href = add_query_arg( $tab_array[4], $href ); $_href = clean_url( $href); $page_links = ''; $class = 'upload-tab alignleft'; if ( $tab == $t ) { $class .= ' current'; if ( $tab_array[3] ) { if ( is_array($tab_array[3]) ) { $total = $tab_array[3][0]; $per = $tab_array[3][1]; } else { $total = $tab_array[3]; $per = 10; } $page_links = paginate_links( array( 'base' => 'upload.php?%_%', 'format' => 'paged=%#%', 'total' => ceil($total / $per), 'current' => $paged ? $paged : 1, 'prev_text' => '«', 'next_text' => '»' )); if ( $page_links ) $page_links = ": $page_links"; } } echo "\t
  • {$tab_array[0]}$page_links
  • \n"; } unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class); echo "\n\n"; echo "
    \n"; call_user_func( $wp_upload_tabs[$tab][2] ); echo "
    \n"; if ( 'inline' != $style ) : echo "
    "; include_once('admin-footer.php'); else : ?>