X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/76aea3697c6043c1613370f172395b4f65ee71f0..a6f44f0edcda2471c5a33e4156c1c9488c7f3210:/wp-admin/includes/template.php
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index e132733e..18349644 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1,252 +1,195 @@
0);
- if ( !empty($_GET['s']) )
- $args['search'] = $_GET['s'];
- $categories = get_categories( $args );
- }
-
- if ( !$categories )
- return false;
-
- $children = _get_term_hierarchy('category');
-
- $start = ($page - 1) * $per_page;
- $end = $start + $per_page;
- $i = -1;
- ob_start();
- foreach ( $categories as $category ) {
- if ( $count >= $end )
- break;
-
- $i++;
-
- if ( $category->parent != $parent )
- continue;
-
- // If the page starts in a subtree, print the parents.
- if ( $count == $start && $category->parent > 0 ) {
- $my_parents = array();
- $my_parent = $category->parent;
- while ( $my_parent) {
- $my_parent = get_category($my_parent);
- $my_parents[] = $my_parent;
- if ( !$my_parent->parent )
- break;
- $my_parent = $my_parent->parent;
- }
- $num_parents = count($my_parents);
- while( $my_parent = array_pop($my_parents) ) {
- echo "\t" . _cat_row( $my_parent, $level - $num_parents );
- $num_parents--;
- }
- }
-
- if ( $count >= $start )
- echo "\t" . _cat_row( $category, $level );
-
- unset($categories[$i]); // Prune the working set
- $count++;
-
- if ( isset($children[$category->term_id]) )
- _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
-
- }
-
- $output = ob_get_contents();
- ob_end_clean();
-
- $output = apply_filters('cat_rows', $output);
-
- echo $output;
-}
-
-function _cat_row( $category, $level, $name_override = false ) {
- global $class;
-
- $category = get_category( $category );
-
- $pad = str_repeat( '— ', $level );
- $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
- if ( current_user_can( 'manage_categories' ) ) {
- $edit = "name)) . "'>$name ";
- } else {
- $edit = $name;
- }
-
- $class = " class='alternate'" == $class ? '' : " class='alternate'";
-
- $category->count = number_format_i18n( $category->count );
- $posts_count = ( $category->count > 0 ) ? "$category->count " : $category->count;
- $output = "
-
-
- $column_display_name) {
-
- switch ($column_name) {
-
- case 'cb':
- ?>
-
- post_date && 'date' == $column_name ) {
- $t_time = $h_time = __('Unpublished');
- } else {
- if ( 'modified' == $column_name ) {
- $t_time = get_the_modified_time(__('Y/m/d g:i:s A'));
- $m_time = $page->post_modified;
- $time = get_post_modified_time('G', true);
- } else {
- $t_time = get_the_time(__('Y/m/d g:i:s A'));
- $m_time = $page->post_date;
- $time = get_post_time('G', true);
- }
- if ( ( abs(time() - $time) ) < 86400 ) {
- if ( ( 'future' == $page->post_status) )
- $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
- else
- $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
- } else {
- $h_time = mysql2date(__('Y/m/d'), $m_time);
- }
- }
- ?>
-
-
- ">
- post_status) _e(' — Private '); ?>
-
-
- ID );
- $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
- if ( $left )
- echo '
';
- comments_number(" ', " ', " ');
- if ( $left )
- echo ' ';
- ?>
-
-
-
-
-
- " rel="permalink">
- post_status ) {
- case 'publish' :
- case 'private' :
- _e('Published');
- break;
- case 'future' :
- _e('Scheduled');
- break;
- case 'pending' :
- _e('Pending Review');
- break;
- case 'draft' :
- _e('Unpublished');
- break;
- }
- ?>
-
-
-
-
- name ) );
+ $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
+ echo ' ', $name, " ";
}
-}
- ?>
-
-
-
- 'menu_order') );
+function get_inline_data($post) {
+ $post_type_object = get_post_type_object($post->post_type);
+ if ( ! current_user_can( 'edit_post', $post->ID ) )
+ return;
- if ( ! $pages )
- return false;
- }
+ $title = esc_textarea( trim( $post->post_title ) );
- /*
- * arrange pages into two parts: top level pages and children_pages
- * children_pages is two dimensional array, eg.
- * children_pages[10][] contains all sub-pages whose parent is 10.
- * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
- * If searching, ignore hierarchy and treat everything as top level
- */
- if ( empty($_GET['s']) ) {
-
- $top_level_pages = array();
- $children_pages = array();
-
- foreach ( $pages as $page ) {
-
- // catch and repair bad pages
- if ( $page->post_parent == $page->ID ) {
- $page->post_parent = 0;
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
- clean_page_cache( $page->ID );
- }
-
- if ( 0 == $page->post_parent )
- $top_level_pages[] = $page;
- else
- $children_pages[ $page->post_parent ][] = $page;
+ echo '
+
+
' . $title . '
+
' . apply_filters('editable_slug', $post->post_name) . '
+
' . $post->post_author . '
+
+
' . esc_html( $post->ping_status ) . '
+
' . esc_html( $post->post_status ) . '
+
' . mysql2date( 'd', $post->post_date, false ) . '
+
' . mysql2date( 'm', $post->post_date, false ) . '
+
' . mysql2date( 'Y', $post->post_date, false ) . '
+
' . mysql2date( 'H', $post->post_date, false ) . '
+
' . mysql2date( 'i', $post->post_date, false ) . '
+
' . mysql2date( 's', $post->post_date, false ) . '
+
' . esc_html( $post->post_password ) . '
';
+
+ if ( $post_type_object->hierarchical )
+ echo '
' . $post->post_parent . '
';
+
+ if ( $post->post_type == 'page' )
+ echo '
' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '
';
+
+ if ( post_type_supports( $post->post_type, 'page-attributes' ) )
+ echo '';
+
+ $taxonomy_names = get_object_taxonomies( $post->post_type );
+ foreach ( $taxonomy_names as $taxonomy_name) {
+ $taxonomy = get_taxonomy( $taxonomy_name );
+
+ if ( $taxonomy->hierarchical && $taxonomy->show_ui ) {
+ echo '
'
+ . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array( 'fields' => 'ids' ) ) ) . '
';
+ } elseif ( $taxonomy->show_ui ) {
+ echo '
'
+ . esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '
';
}
-
- $pages = &$top_level_pages;
}
- $count = 0;
- $start = ($pagenum - 1) * $per_page;
- $end = $start + $per_page;
-
- foreach ( $pages as $page ) {
- if ( $count >= $end )
- break;
-
- if ( $count >= $start )
- echo "\t" . display_page_row( $page, $level );
+ if ( !$post_type_object->hierarchical )
+ echo '
' . (is_sticky($post->ID) ? 'sticky' : '') . '
';
- $count++;
+ if ( post_type_supports( $post->post_type, 'post-formats' ) )
+ echo '
' . esc_html( get_post_format( $post->ID ) ) . '
';
- if ( isset($children_pages) )
- _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
- }
-
- // if it is the last pagenum and there are orphaned pages, display them with paging as well
- if ( isset($children_pages) && $count < $end ){
- foreach( $children_pages as $orphans ){
- foreach ( $orphans as $op ) {
- if ( $count >= $end )
- break;
- if ( $count >= $start )
- echo "\t" . display_page_row( $op, 0 );
- $count++;
- }
- }
- }
+ echo '
';
}
-/*
- * Given a top level page ID, display the nested hierarchy of sub-pages
- * together with paging support
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.7.0
+ *
+ * @param unknown_type $position
+ * @param unknown_type $checkbox
+ * @param unknown_type $mode
*/
-function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
-
- if ( ! isset( $children_pages[$parent] ) )
- return;
-
- $start = ($pagenum - 1) * $per_page;
- $end = $start + $per_page;
-
- foreach ( $children_pages[$parent] as $page ) {
-
- if ( $count >= $end )
- break;
-
- // If the page starts in a subtree, print the parents.
- if ( $count == $start && $page->post_parent > 0 ) {
- $my_parents = array();
- $my_parent = $page->post_parent;
- while ( $my_parent) {
- $my_parent = get_post($my_parent);
- $my_parents[] = $my_parent;
- if ( !$my_parent->post_parent )
- break;
- $my_parent = $my_parent->post_parent;
- }
- $num_parents = count($my_parents);
- while( $my_parent = array_pop($my_parents) ) {
- echo "\t" . display_page_row( $my_parent, $level - $num_parents );
- $num_parents--;
- }
- }
-
- if ( $count >= $start )
- echo "\t" . display_page_row( $page, $level );
-
- $count++;
-
- _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
- }
-
- unset( $children_pages[$parent] ); //required in order to keep track of orphans
-}
-
-function user_row( $user_object, $style = '', $role = '' ) {
- global $wp_roles;
-
- $current_user = wp_get_current_user();
-
- if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
- $user_object = new WP_User( (int) $user_object );
- $email = $user_object->user_email;
- $url = $user_object->user_url;
- $short_url = str_replace( 'http://', '', $url );
- $short_url = str_replace( 'www.', '', $short_url );
- if ('/' == substr( $short_url, -1 ))
- $short_url = substr( $short_url, 0, -1 );
- if ( strlen( $short_url ) > 35 )
- $short_url = substr( $short_url, 0, 32 ).'...';
- $numposts = get_usernumposts( $user_object->ID );
- if ( current_user_can( 'edit_user', $user_object->ID ) ) {
- if ($current_user->ID == $user_object->ID) {
- $edit = 'profile.php';
- } else {
- $edit = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
- }
- $edit = "";
- $r .= "\n\t\t" . __( 'Key' ) . " ";
- $r .= "\n\t\t" . __( 'Value' ) . " ";
- $r .= "\n\t\t ";
- $r .= "\n\t\t ";
+ $r .= "\n\t\t" . __( 'Key' ) . " ";
+
+ $r .= "\n\t\t";
+ $r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) );
+ $r .= "\n\t\t";
+ $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
+ $r .= "
";
$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
- $r .= " \n\t ";
+ $r .= "";
+
+ $r .= "\n\t\t