From 87bb8cd69cc593fe6bed330fb1791eac9df87167 Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 23 Oct 2007 18:28:40 +0000 Subject: Merge with WordPress, rev 6285 and untested git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/includes/template.php | 152 +++++++++++++++++++++++++---------------- 1 file changed, 92 insertions(+), 60 deletions(-) (limited to 'wp-admin/includes/template.php') diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 1cf9284..c604d4c 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -14,10 +14,6 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) { if ( $categories ) { ob_start(); foreach ( $categories as $category ) { - if ( $category->term_id == 0 ) { - $wpdb->query("DELETE FROM $wpdb->terms WHERE term_id = 0"); - continue; - } if ( $category->parent == $parent) { echo "\t" . _cat_row( $category, $level ); if ( isset($children[$category->term_id]) ) @@ -42,9 +38,10 @@ function _cat_row( $category, $level, $name_override = false ) { if ( current_user_can( 'manage_categories' ) ) { $edit = "".__( 'Edit' ).""; $default_cat_id = (int) get_option( 'default_category' ); + $default_link_cat_id = (int) get_option( 'default_link_category' ); if ( $category->term_id != $default_cat_id ) - $edit .= "term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' ).""; + $edit .= "term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' ).""; else $edit .= "".__( "Default" ); } else @@ -111,10 +108,6 @@ function get_nested_categories( $default = 0, $parent = 0 ) { $result = array (); if ( is_array( $cats ) ) { foreach ( $cats as $cat) { - if ( $cat == 0 ) { - $wpdb->query("DELETE FROM $wpdb->terms WHERE term_id = 0"); - continue; - } $result[$cat]['children'] = get_nested_categories( $default, $cat); $result[$cat]['cat_ID'] = $cat; $result[$cat]['checked'] = in_array( $cat, $checked_categories ); @@ -171,6 +164,31 @@ function dropdown_link_categories( $default = 0 ) { } } +// define the columns to display, the syntax is 'internal name' => 'display name' +function wp_manage_posts_columns() { + $posts_columns = array(); + $posts_columns['id'] = '
' . __('ID') . '
'; + if ( 'draft' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Modified'); + elseif ( 'pending' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Submitted'); + else + $posts_columns['date'] = __('When'); + $posts_columns['title'] = __('Title'); + $posts_columns['categories'] = __('Categories'); + if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) + $posts_columns['comments'] = '
' . __('Comments') . '
'; + $posts_columns['author'] = __('Author'); + $posts_columns = apply_filters('manage_posts_columns', $posts_columns); + + // you can not edit these at the moment + $posts_columns['control_view'] = ''; + $posts_columns['control_edit'] = ''; + $posts_columns['control_delete'] = ''; + + return $posts_columns; +} + function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { global $wpdb, $class, $post; @@ -197,9 +215,9 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?> - + " . __( 'Edit' ) . ""; } ?> - " . __( 'Delete' ) . ""; } ?> + " . __( 'Delete' ) . ""; } ?> comment_ID; $class = ''; $post = get_post($comment->comment_post_ID); $authordata = get_userdata($post->post_author); - $comment_status = wp_get_comment_status($comment->comment_ID); + $comment_status = wp_get_comment_status($id); if ( 'unapproved' == $comment_status ) $class .= ' unapproved'; if ( $alt % 2 ) $class .= ' alternate'; - echo "
  • "; + echo "
  • "; ?> -

    comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

    +

    comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

    — [ comment_post_ID) ) { - echo " " . __('Edit') . ''; - echo ' | comment_author)) . "', theCommentList );\">" . __('Delete') . ' '; + echo " " . __('Edit') . ''; + $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); + echo " | " . __('Delete') . ' '; if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { - echo ' | ' . __('Unapprove') . ' '; - echo ' | ' . __('Approve') . ' '; + $url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) ); + echo " | " . __('Unapprove') . ' '; + $url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) ); + echo " | " . __('Approve') . ' '; } - echo " | comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . " "; + $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); + echo " | " . __('Spam') . ' '; } -$post = get_post($comment->comment_post_ID, OBJECT, 'display'); -$post_title = wp_specialchars( $post->post_title, 'double' ); -$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; +if ( !is_single() ) { + $post = get_post($comment->comment_post_ID, OBJECT, 'display'); + $post_title = wp_specialchars( $post->post_title, 'double' ); + $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; ?> - ] —

    + ] — + +

  •  '; //TBODY needed for list-manipulation JS + echo ' '; //TBODY needed for list-manipulation JS return; } $count = 0; @@ -345,43 +370,47 @@ function list_meta( $meta ) { + "; - foreach ( $meta as $entry ) { - ++ $count; - if ( $count % 2 ) - $style = 'alternate'; - else - $style = ''; - if ('_' == $entry['meta_key'] { 0 } ) - $style .= ' hidden'; - - if ( is_serialized( $entry['meta_value'] ) ) { - if ( is_serialized_string( $entry['meta_value'] ) ) { - // this is a serialized string, so we should display it - $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); - } else { - // this is a serialized array/object so we should NOT display it - --$count; - continue; - } - } + foreach ( $meta as $entry ) + echo _list_meta_row( $entry, $count ); + echo "\n\t"; +} - $key_js = js_escape( $entry['meta_key'] ); - $entry['meta_key'] = attribute_escape($entry['meta_key']); - $entry['meta_value'] = attribute_escape($entry['meta_value']); - $entry['meta_id'] = (int) $entry['meta_id']; - $r .= "\n\t"; - $r .= "\n\t\t"; - $r .= "\n\t\t"; - $r .= "\n\t\t
    "; - $r .= "\n\t\t"; - $r .= "\n\t"; +function _list_meta_row( $entry, &$count ) { + $r = ''; + ++ $count; + if ( $count % 2 ) + $style = 'alternate'; + else + $style = ''; + if ('_' == $entry['meta_key'] { 0 } ) + $style .= ' hidden'; + + if ( is_serialized( $entry['meta_value'] ) ) { + if ( is_serialized_string( $entry['meta_value'] ) ) { + // this is a serialized string, so we should display it + $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); + } else { + // this is a serialized array/object so we should NOT display it + --$count; + return; + } } - echo $r; - echo "\n\t"; + + $key_js = js_escape( $entry['meta_key'] ); + $entry['meta_key'] = attribute_escape($entry['meta_key']); + $entry['meta_value'] = attribute_escape($entry['meta_value']); + $entry['meta_id'] = (int) $entry['meta_id']; + $r .= "\n\t"; + $r .= "\n\t\t"; + $r .= "\n\t\t"; + $r .= "\n\t\t
    "; + $r .= "\n\t\t"; + $r .= ""; + $r .= "\n\t"; + return $r; } function meta_form() { @@ -422,8 +451,11 @@ function meta_form() { + + + + -