X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..4f9d63e13cd8c6e275797c75b401b074b82937bc:/wp-admin/includes/template.php diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index db80bf80..e3981f22 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1,127 +1,186 @@ 0); - if ( !empty($_GET['s']) ) - $args['search'] = $_GET['s']; - $categories = get_categories( $args ); - } +/** + * {@internal Missing Short Description}} + * + * @since 2.7 + * + * Outputs the HTML for the hidden table rows used in Categories, Link Categories and Tags quick edit. + * + * @param string $type "edit-tags", "categoried" or "edit-link-categories" + * @param string $taxonomy The taxonomy of the row. + * @return + */ +function inline_edit_term_row($type, $taxonomy) { - $children = _get_term_hierarchy('category'); + $tax = get_taxonomy($taxonomy); + if ( ! current_user_can( $tax->cap->edit_terms ) ) + return; - if ( $categories ) { - ob_start(); - foreach ( $categories as $category ) { - if ( $category->parent == $parent) { - echo "\t" . _cat_row( $category, $level ); - if ( isset($children[$category->term_id]) ) - cat_rows( $category->term_id, $level +1, $categories ); - } - } - $output = ob_get_contents(); - ob_end_clean(); + $columns = get_column_headers($type); + $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) ); + $col_count = count($columns) - count($hidden); + ?> - $output = apply_filters('cat_rows', $output); +
+ - - - - \n\t\n"; - return apply_filters('cat_row', $output); +?> + +

+ + labels->update_item; ?> + + + + + +
+

+ +
"; - if ( absint(get_option( 'default_category' ) ) != $category->term_id ) { - $output .= ""; - } else { - $output .= " "; + foreach ( $columns as $column_name => $column_display_name ) { + if ( isset( $core_columns[$column_name] ) ) + continue; + do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy ); } - $output .= "$edit$category->description$posts_count
+name ); + $edit_link = "link-category.php?action=edit&cat_ID=$category->term_id"; if ( current_user_can( 'manage_categories' ) ) { - $edit = "name)) . "' class='edit'>$name"; - $default_cat_id = (int) get_option( 'default_link_category' ); + $edit = "name)) . "'>$name
"; + $actions = array(); + $actions['edit'] = '' . __('Edit') . ''; + $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; + if ( $default_cat_id != $category->term_id ) + $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; + $actions = apply_filters('link_cat_row_actions', $actions, $category); + $action_count = count($actions); + $i = 0; + $edit .= '
'; + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + $edit .= "$link$sep"; + } + $edit .= '
'; } else { $edit = $name; } - $class = " class='alternate'" == $class ? '' : " class='alternate'"; + $row_class = 'alternate' == $row_class ? '' : 'alternate'; + $qe_data = get_term_to_edit($category->term_id, 'link_category'); $category->count = number_format_i18n( $category->count ); $count = ( $category->count > 0 ) ? "$category->count" : $category->count; - $output = " - "; - if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { - $output .= ""; - } else { - $output .= " "; - } - $output .= " - $edit - $category->description - $count"; - - return apply_filters( 'link_cat_row', $output ); -} + $output = ""; + $columns = get_column_headers('edit-link-categories'); + $hidden = get_hidden_columns('edit-link-categories'); + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class=\"$column_name column-$column_name\""; -function checked( $checked, $current) { - if ( $checked == $current) - echo ' checked="checked"'; -} + $style = ''; + if ( in_array($column_name, $hidden) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + switch ($column_name) { + case 'cb': + $output .= ""; + if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) { + $output .= ""; + } else { + $output .= " "; + } + $output .= ""; + break; + case 'name': + $output .= "$edit"; + $output .= ''; + break; + case 'description': + $output .= "$category->description"; + break; + case 'slug': + $output .= "" . apply_filters('editable_slug', $category->slug) . ""; + break; + case 'links': + $attributes = 'class="links column-links num"' . $style; + $output .= "$count"; + break; + default: + $output .= ""; + $output .= apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id); + $output .= ""; + } + } + $output .= ''; -function selected( $selected, $current) { - if ( $selected == $current) - echo ' selected="selected"'; + return $output; } // // Category Checklists // -// Deprecated. Use wp_link_category_checklist -function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) { - global $post_ID; - wp_category_checklist($post_ID); -} - +/** + * {@internal Missing Short Description}} + * + * @since unknown + */ class Walker_Category_Checklist extends Walker { var $tree_type = 'category'; var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this @@ -138,9 +197,16 @@ class Walker_Category_Checklist extends Walker { function start_el(&$output, $category, $depth, $args) { extract($args); + if ( empty($taxonomy) ) + $taxonomy = 'category'; + + if ( $taxonomy == 'category' ) + $name = 'post_category'; + else + $name = 'tax_input['.$taxonomy.']'; $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : ''; - $output .= "\n
  • " . ''; + $output .= "\n
  • " . ''; } function end_el(&$output, $category, $depth, $args) { @@ -148,51 +214,134 @@ class Walker_Category_Checklist extends Walker { } } -function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false ) { - $walker = new Walker_Category_Checklist; +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $post_id + * @param unknown_type $descendants_and_self + * @param unknown_type $selected_cats + * @param unknown_type $popular_cats + */ +function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) { + wp_terms_checklist($post_id, + array( + 'taxonomy' => 'category', + 'descendants_and_self' => $descendants_and_self, + 'selected_cats' => $selected_cats, + 'popular_cats' => $popular_cats, + 'walker' => $walker, + 'checked_ontop' => $checked_ontop + )); +} + +/** + * Taxonomy independent version of wp_category_checklist + * + * @param int $post_id + * @param array $args + */ +function wp_terms_checklist($post_id = 0, $args = array()) { + $defaults = array( + 'descendants_and_self' => 0, + 'selected_cats' => false, + 'popular_cats' => false, + 'walker' => null, + 'taxonomy' => 'category', + 'checked_ontop' => true + ); + extract( wp_parse_args($args, $defaults), EXTR_SKIP ); + + if ( empty($walker) || !is_a($walker, 'Walker') ) + $walker = new Walker_Category_Checklist; + $descendants_and_self = (int) $descendants_and_self; - $args = array(); - - if ( $post_id ) - $args['selected_cats'] = wp_get_post_categories($post_id); - else - $args['selected_cats'] = array(); + $args = array('taxonomy' => $taxonomy); + + $tax = get_taxonomy($taxonomy); + $args['disabled'] = !current_user_can($tax->cap->assign_terms); + if ( is_array( $selected_cats ) ) $args['selected_cats'] = $selected_cats; - $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); + elseif ( $post_id ) + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); + else + $args['selected_cats'] = array(); + + if ( is_array( $popular_cats ) ) + $args['popular_cats'] = $popular_cats; + else + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); + if ( $descendants_and_self ) { - $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" ); - $self = get_category( $descendants_and_self ); + $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); + $self = get_term( $descendants_and_self, $taxonomy ); array_unshift( $categories, $self ); } else { - $categories = get_categories('get=all'); + $categories = (array) get_terms($taxonomy, array('get' => 'all')); } - $args = array($categories, 0, $args); - $output = call_user_func_array(array(&$walker, 'walk'), $args); + if ( $checked_ontop ) { + // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) + $checked_categories = array(); + $keys = array_keys( $categories ); - echo $output; + foreach( $keys as $k ) { + if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { + $checked_categories[] = $categories[$k]; + unset( $categories[$k] ); + } + } + + // Put checked cats on top + echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args)); + } + // Then the rest of them + echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args)); } -function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) { +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $taxonomy + * @param unknown_type $default + * @param unknown_type $number + * @param unknown_type $echo + * @return unknown + */ +function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { global $post_ID; + if ( $post_ID ) - $checked_categories = wp_get_post_categories($post_ID); + $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids')); else - $checked_categories = array(); - $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); + $checked_terms = array(); + + $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); + + $tax = get_taxonomy($taxonomy); + if ( ! current_user_can($tax->cap->assign_terms) ) + $disabled = 'disabled="disabled"'; + else + $disabled = ''; $popular_ids = array(); - foreach ( (array) $categories as $category ) { - $popular_ids[] = $category->term_id; - $id = "popular-category-$category->term_id"; + foreach ( (array) $terms as $term ) { + $popular_ids[] = $term->term_id; + if ( !$echo ) // hack for AJAX use + continue; + $id = "popular-$taxonomy-$term->term_id"; + $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : ''; ?>
  • @@ -201,35 +350,35 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) { return $popular_ids; } -// Deprecated. Use wp_link_category_checklist -function dropdown_link_categories( $default = 0 ) { - global $link_id; - - wp_link_category_checklist($link_id); -} - +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $link_id + */ function wp_link_category_checklist( $link_id = 0 ) { - if ( $link_id ) { - $checked_categories = wp_get_link_cats($link_id); + $default = 1; - if ( count( $checked_categories ) == 0 ) { - // No selected categories, strange + if ( $link_id ) { + $checked_categories = wp_get_link_cats( $link_id ); + // No selected categories, strange + if ( ! count( $checked_categories ) ) $checked_categories[] = $default; - } } else { $checked_categories[] = $default; } - $categories = get_terms('link_category', 'orderby=count&hide_empty=0'); + $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) ); - if ( empty($categories) ) + if ( empty( $categories ) ) return; foreach ( $categories as $category ) { $cat_id = $category->term_id; - $name = wp_specialchars( apply_filters('the_category', $category->name)); - $checked = in_array( $cat_id, $checked_categories ); - echo '"; + $name = esc_html( apply_filters( 'the_category', $category->name ) ); + $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : ''; + echo '"; } } @@ -237,19 +386,106 @@ function wp_link_category_checklist( $link_id = 0 ) { // Returns a single tag row (see tag_rows below) // Note: this is also used in admin-ajax.php! -function _tag_row( $tag, $class = '' ) { +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $tag + * @param unknown_type $class + * @return unknown + */ +function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) { + global $post_type, $current_screen; + static $row_class = ''; + $row_class = ($row_class == '' ? ' class="alternate"' : ''); + $count = number_format_i18n( $tag->count ); - $count = ( $count > 0 ) ? "$count" : $count; + $tax = get_taxonomy($taxonomy); + + if ( 'post_tag' == $taxonomy ) { + $tagsel = 'tag'; + } elseif ( 'category' == $taxonomy ) { + $tagsel = 'category_name'; + } elseif ( ! empty($tax->query_var) ) { + $tagsel = $tax->query_var; + } else { + $tagsel = $taxonomy; + } + + $pad = str_repeat( '— ', max(0, $level) ); + $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); + $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit'); + $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&post_type=$post_type&tag_ID=$tag->term_id"; - $name = apply_filters( 'term_name', $tag->name ); $out = ''; - $out .= ''; - $out .= ' '; - $out .= '' . - $name . ''; + $out .= ''; + + + $columns = get_column_headers($current_screen); + $hidden = get_hidden_columns($current_screen); + $default_term = get_option('default_' . $taxonomy); + foreach ( $columns as $column_name => $column_display_name ) { + $class = "class=\"$column_name column-$column_name\""; + + $style = ''; + if ( in_array($column_name, $hidden) ) + $style = ' style="display:none;"'; + + $attributes = "$class$style"; + + switch ($column_name) { + case 'cb': + if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term ) + $out .= ' '; + else + $out .= ' '; + break; + case 'name': + $out .= '' . $name . '
    '; + $actions = array(); + if ( current_user_can($tax->cap->edit_terms) ) { + $actions['edit'] = '' . __('Edit') . ''; + $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; + } + if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term ) + $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; + + $actions = apply_filters('tag_row_actions', $actions, $tag); + $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag); + + $action_count = count($actions); + $i = 0; + $out .= '
    '; + foreach ( $actions as $action => $link ) { + ++$i; + ( $i == $action_count ) ? $sep = '' : $sep = ' | '; + $out .= "$link$sep"; + } + $out .= '
    '; + $out .= ''; + break; + case 'description': + $out .= "$tag->description"; + break; + case 'slug': + $out .= "" . apply_filters('editable_slug', $tag->slug) . ""; + break; + case 'posts': + $attributes = 'class="posts column-posts num"' . $style; + $out .= "$count"; + break; + default: + $out .= ""; + $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id); + $out .= ""; + } + } - $out .= "$count"; - $out .= ''; + $out .= "\n"; return $out; } @@ -257,685 +493,2134 @@ function _tag_row( $tag, $class = '' ) { // Outputs appropriate rows for the Nth page of the Tag Management screen, // assuming M tags displayed at a time on the page // Returns the number of tags displayed -function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) { +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $page + * @param unknown_type $pagesize + * @param unknown_type $searchterms + * @return unknown + */ +function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) { // Get a page worth of tags $start = ($page - 1) * $pagesize; $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0); - if ( !empty( $searchterms ) ) { + if ( !empty( $searchterms ) ) $args['search'] = $searchterms; - } - - $tags = get_terms( 'post_tag', $args ); // convert it to table rows $out = ''; - $class = ''; $count = 0; - foreach( $tags as $tag ) - $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '' ); + if ( is_taxonomy_hierarchical($taxonomy) ) { + // We'll need the full set of terms then. + $args['number'] = $args['offset'] = 0; + + $terms = get_terms( $taxonomy, $args ); + if ( !empty( $searchterms ) ) // Ignore children on searches. + $children = array(); + else + $children = _get_term_hierarchy($taxonomy); + + // Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake + $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count); + } else { + $terms = get_terms( $taxonomy, $args ); + foreach( $terms as $term ) + $out .= _tag_row( $term, 0, $taxonomy ); + $count = $pagesize; // Only displaying a single page. + } - // filter and send to screen - $out = apply_filters('tag_rows', $out); echo $out; return $count; } +function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) { + + $start = ($page - 1) * $per_page; + $end = $start + $per_page; + + $output = ''; + foreach ( $terms as $key => $term ) { + + if ( $count >= $end ) + break; + + if ( $term->parent != $parent && empty($_GET['s']) ) + continue; + + // If the page starts in a subtree, print the parents. + if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) { + $my_parents = $parent_ids = array(); + $p = $term->parent; + while ( $p ) { + $my_parent = get_term( $p, $taxonomy ); + $my_parents[] = $my_parent; + $p = $my_parent->parent; + if ( in_array($p, $parent_ids) ) // Prevent parent loops. + break; + $parent_ids[] = $p; + } + unset($parent_ids); + + $num_parents = count($my_parents); + while ( $my_parent = array_pop($my_parents) ) { + $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy ); + $num_parents--; + } + } + + if ( $count >= $start ) + $output .= "\t" . _tag_row( $term, $level, $taxonomy ); + + ++$count; + + unset($terms[$key]); + + if ( isset($children[$term->term_id]) && empty($_GET['s']) ) + $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 ); + } + + return $output; +} + // define the columns to display, the syntax is 'internal name' => 'display name' -function wp_manage_posts_columns() { - $posts_columns = array(); - $posts_columns['cb'] = ''; - if ( 'draft' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Modified'); - elseif ( 'pending' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Submitted'); +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @return unknown + */ +function wp_manage_posts_columns( $screen = '') { + if ( empty($screen) ) + $post_type = 'post'; else - $posts_columns['date'] = __('Date'); - $posts_columns['title'] = __('Title'); + $post_type = $screen->post_type; + + $posts_columns = array(); + $posts_columns['cb'] = ''; + /* translators: manage posts column name */ + $posts_columns['title'] = _x('Title', 'column name'); $posts_columns['author'] = __('Author'); - $posts_columns['categories'] = __('Categories'); - $posts_columns['tags'] = __('Tags'); - if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) - $posts_columns['comments'] = '
    Comments
    '; - $posts_columns['status'] = __('Status'); - $posts_columns = apply_filters('manage_posts_columns', $posts_columns); + if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') ) + $posts_columns['categories'] = __('Categories'); + if ( empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag') ) + $posts_columns['tags'] = __('Tags'); + $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; + if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) ) + $posts_columns['comments'] = '
    Comments
    '; + $posts_columns['date'] = __('Date'); + + if ( 'page' == $post_type ) + $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); + else + $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); + $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); return $posts_columns; } // define the columns to display, the syntax is 'internal name' => 'display name' +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @return unknown + */ function wp_manage_media_columns() { $posts_columns = array(); - $posts_columns['cb'] = ''; + $posts_columns['cb'] = ''; $posts_columns['icon'] = ''; - $posts_columns['media'] = _c('Media|media column header'); - $posts_columns['desc'] = _c('Description|media column header'); - $posts_columns['date'] = _c('Date Added|media column header'); - $posts_columns['parent'] = _c('Appears with|media column header'); - $posts_columns['comments'] = '
    Comments
    '; - $posts_columns['location'] = _c('Location|media column header'); + /* translators: column name */ + $posts_columns['media'] = _x('File', 'column name'); + $posts_columns['author'] = __('Author'); + //$posts_columns['tags'] = _x('Tags', 'column name'); + /* translators: column name */ + $posts_columns['parent'] = _x('Attached to', 'column name'); + $posts_columns['comments'] = '
    Comments
    '; + //$posts_columns['comments'] = __('Comments'); + /* translators: column name */ + $posts_columns['date'] = _x('Date', 'column name'); $posts_columns = apply_filters('manage_media_columns', $posts_columns); return $posts_columns; } +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @return unknown + */ function wp_manage_pages_columns() { - $posts_columns = array(); - $posts_columns['cb'] = ''; - if ( 'draft' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Modified'); - elseif ( 'pending' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Submitted'); - else - $posts_columns['date'] = __('Date'); - $posts_columns['title'] = __('Title'); - $posts_columns['author'] = __('Author'); - if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) - $posts_columns['comments'] = '
    '; - $posts_columns['status'] = __('Status'); - $posts_columns = apply_filters('manage_pages_columns', $posts_columns); - - return $posts_columns; + return wp_manage_posts_columns(); } -/* - * display one row if the page doesn't have any children - * otherwise, display the row and its children in subsequent rows +/** + * Get the column headers for a screen + * + * @since unknown + * + * @param string|object $screen The screen you want the headers for + * @return array Containing the headers in the format id => UI String */ -function display_page_row( $page, &$children_pages, $level = 0 ) { - global $post; - static $class; - - $post = $page; - setup_postdata($page); - - $page->post_title = wp_specialchars( $page->post_title ); - $pad = str_repeat( '— ', $level ); - $id = (int) $page->ID; - $class = ('alternate' == $class ) ? '' : 'alternate'; - $posts_columns = wp_manage_pages_columns(); - $title = get_the_title(); - if ( empty($title) ) - $title = __('(no title)'); -?> - +function get_column_headers($screen) { + global $_wp_column_headers; + + if ( !isset($_wp_column_headers) ) + $_wp_column_headers = array(); + + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + // Store in static to avoid running filters on each call + if ( isset($_wp_column_headers[$screen->id]) ) + return $_wp_column_headers[$screen->id]; + + switch ($screen->base) { + case 'edit': + $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen ); + break; + case 'edit-comments': + $_wp_column_headers[$screen->id] = array( + 'cb' => '', + 'author' => __('Author'), + /* translators: column name */ + 'comment' => _x('Comment', 'column name'), + //'date' => __('Submitted'), + 'response' => __('In Response To') + ); + + break; + case 'link-manager': + $_wp_column_headers[$screen->id] = array( + 'cb' => '', + 'name' => __('Name'), + 'url' => __('URL'), + 'categories' => __('Categories'), + 'rel' => __('Relationship'), + 'visible' => __('Visible'), + 'rating' => __('Rating') + ); + + break; + case 'upload': + $_wp_column_headers[$screen->id] = wp_manage_media_columns(); + break; + case 'categories': + $_wp_column_headers[$screen->id] = array( + 'cb' => '', + 'name' => __('Name'), + 'description' => __('Description'), + 'slug' => __('Slug'), + 'posts' => __('Posts') + ); + + break; + case 'edit-link-categories': + $_wp_column_headers[$screen->id] = array( + 'cb' => '', + 'name' => __('Name'), + 'description' => __('Description'), + 'slug' => __('Slug'), + 'links' => __('Links') + ); + + break; + case 'edit-tags': + $_wp_column_headers[$screen->id] = array( + 'cb' => '', + 'name' => __('Name'), + 'description' => __('Description'), + 'slug' => __('Slug'), + 'posts' => __('Posts') + ); + + break; + case 'users': + $_wp_column_headers[$screen->id] = array( + 'cb' => '', + 'username' => __('Username'), + 'name' => __('Name'), + 'email' => __('E-mail'), + 'role' => __('Role'), + 'posts' => __('Posts') + ); + break; + default : + $_wp_column_headers[$screen->id] = array(); + } + $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]); + return $_wp_column_headers[$screen->id]; +} - $column_display_name) { + $columns = get_column_headers( $screen ); + $hidden = get_hidden_columns($screen); + $styles = array(); - switch ($column_name) { + foreach ( $columns as $column_key => $column_display_name ) { + $class = ' class="manage-column'; - 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("" . __('0') . '', "" . __('1') . '', "" . __('%') . ''); - 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; - } - ?> - - - - - id]) && isset($styles[$screen->id][$column_key]) ) + $style .= ' ' . $styles[$screen>id][$column_key]; + $style = ' style="' . $style . '"'; +?> + > + - - -id] = $columns; +} - if ( $child->post_parent == $id ) { - array_splice($children_pages, $i, 1); - display_page_row($child, $children_pages, $level+1); - $i = -1; //as numeric keys in $children_pages are not preserved after splice - } - } +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $screen + */ +function get_hidden_columns($screen) { + if ( is_string($screen) ) + $screen = convert_to_screen($screen); + + return (array) get_user_option( 'manage' . $screen->id. 'columnshidden' ); } -/* - * displays pages in hierarchical order +/** + * {@internal Missing Short Description}} + * + * Outputs the quick edit and bulk edit table rows for posts and pages + * + * @since 2.7 + * + * @param string $screen */ -function page_rows( $pages ) { - if ( ! $pages ) - $pages = get_pages( 'sort_column=menu_order' ); +function inline_edit_row( $screen ) { + global $current_user, $mode; - if ( ! $pages ) - return false; - - // splice pages into two parts: those without parent and those with parent + if ( is_string($screen) ) { + $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen ); + $screen = (object) $screen; + } - $top_level_pages = array(); - $children_pages = array(); + $post = get_default_post_to_edit( $screen->post_type ); + $post_type_object = get_post_type_object( $screen->post_type ); - foreach ( $pages as $page ) { + $taxonomy_names = get_object_taxonomies( $screen->post_type ); + $hierarchical_taxonomies = array(); + $flat_taxonomies = array(); + foreach ( $taxonomy_names as $taxonomy_name ) { + $taxonomy = get_taxonomy( $taxonomy_name); - // 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 ( !$taxonomy->show_ui ) + continue; - if ( 0 == $page->post_parent ) - $top_level_pages[] = $page; + if ( $taxonomy->hierarchical ) + $hierarchical_taxonomies[] = $taxonomy; else - $children_pages[] = $page; + $flat_taxonomies[] = $taxonomy; } - foreach ( $top_level_pages as $page ) - display_page_row($page, $children_pages, 0); + $columns = wp_manage_posts_columns($screen); + $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) ); + $col_count = count($columns) - count($hidden); + $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; + $can_publish = current_user_can($post_type_object->cap->publish_posts); + $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); - /* - * display the remaining children_pages which are orphans - * having orphan requires parental attention - */ - if ( count($children_pages) > 0 ) { - $empty_array = array(); - foreach ( $children_pages as $orphan_page ) { - clean_page_cache( $orphan_page->ID); - display_page_row( $orphan_page, $empty_array, 0 ); - } - } -} +?> -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 = "$user_object->user_login"; - } else { - $edit = $user_object->user_login; - } - $role_name = translate_with_context($wp_roles->role_names[$role]); - $r = " - - - - - "; - $r .= "\n\t\t\n\t"; - return $r; -} + post_type "; + echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type"; + ?>" style="display: none"> - - - - - - - - -function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) { - if (!$categories ) - $categories = get_categories( 'hide_empty=0' ); - - if ( $categories ) { - foreach ( $categories as $category ) { - if ( $currentcat != $category->term_id && $parent == $category->parent) { - $pad = str_repeat( '– ', $level ); - $category->name = wp_specialchars( $category->name ); - echo "\n\t"; - wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories ); - } - } - } else { - return false; - } -} +
    -function list_meta( $meta ) { - // Exit if no meta - if (!$meta ) { - echo '
    '; //TBODY needed for list-manipulation JS - return; - } - $count = 0; -?> - - - - - - - - "; -} + if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) + echo $authors_dropdown; +?> -function _list_meta_row( $entry, &$count ) { - static $update_nonce = false; - if ( !$update_nonce ) - $update_nonce = wp_create_nonce( 'add-meta' ); +hierarchical ) : ?> - $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; - } - } +post_type, 'page-attributes' ) ) : + if ( !$bulk ) : ?> - $entry['meta_key'] = attribute_escape($entry['meta_key']); - $entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a "; - $r .= "\n\t\t\n\t"; - return $r; -} + -function meta_form() { - global $wpdb; - $limit = (int) apply_filters( 'postmeta_form_limit', 30 ); - $keys = $wpdb->get_col( " - SELECT meta_key - FROM $wpdb->postmeta - WHERE meta_key NOT LIKE '\_%' - GROUP BY meta_key - ORDER BY meta_id DESC - LIMIT $limit" ); - if ( $keys ) - natcasesort($keys); -?> -

    -
    $edit$user_object->first_name $user_object->last_name$email$role_name"; - if ( $numposts > 0 ) { - $r .= ""; - $r .= $numposts; - $r .= ''; - } else { - $r .= 0; - } - $r .= "
    -function _wp_get_comment_list( $status = '', $s = false, $start, $num ) { - global $wpdb; +
    +

    - $start = abs( (int) $start ); - $num = (int) $num; - if ( 'moderated' == $status ) - $approved = "comment_approved = '0'"; - elseif ( 'approved' == $status ) - $approved = "comment_approved = '1'"; - elseif ( 'spam' == $status ) - $approved = "comment_approved = 'spam'"; - else - $approved = "( comment_approved = '0' OR comment_approved = '1' )"; +escape($s); - $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE - (comment_author LIKE '%$s%' OR - comment_author_email LIKE '%$s%' OR - comment_author_url LIKE ('%$s%') OR - comment_author_IP LIKE ('%$s%') OR - comment_content LIKE ('%$s%') ) AND - $approved - ORDER BY comment_date_gmt DESC LIMIT $start, $num"); - } else { - $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments USE INDEX (comment_date_gmt) WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" ); - } +if ( post_type_supports( $screen->post_type, 'title' ) ) : + if ( $bulk ) : ?> +
    +
    +
    + + + + + + + + + + + +
    + +
    +
    + +post_type, 'author' ) ) : + $authors = get_editable_user_ids( $current_user->id, true, $screen->post_type ); // TODO: ROLE SYSTEM + $authors_dropdown = ''; + if ( $authors && count( $authors ) > 1 ) : + $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0); + if ( $bulk ) + $users_opt['show_option_none'] = __('— No Change —'); + $authors_dropdown = ''; + + endif; // authors +?> - update_comment_cache($comments); +get_var( "SELECT FOUND_ROWS()" ); +if ( !$bulk ) : +?> - return array($comments, $total); -} +
    + -function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true ) { - global $comment, $post; - $comment = get_comment( $comment_id ); - $post = get_post($comment->comment_post_ID); - $authordata = get_userdata($post->post_author); - $the_comment_status = wp_get_comment_status($comment->comment_ID); - $class = ('unapproved' == $the_comment_status) ? 'unapproved' : ''; + + + + +
    - if ( current_user_can( 'edit_post', $post->ID ) ) { - $post_link = ""; + - $post_link .= get_the_title($comment->comment_post_ID) . ''; - - $edit_link_start = ""; - $edit_link_end = ''; - } else { - $post_link = get_the_title($comment->comment_post_ID); - $edit_link_start = $edit_link_end =''; - } - - $author_url = get_comment_author_url(); - if ( 'http://' == $author_url ) - $author_url = ''; - $author_url_display = $author_url; - if ( strlen($author_url_display) > 50 ) - $author_url_display = substr($author_url_display, 0, 49) . '...'; +
    - $ptime = date('G', strtotime( $comment->comment_date ) ); - if ( ( abs(time() - $ptime) ) < 86400 ) - $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); - else - $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date ); + - $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); - $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) ); - $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) ); - $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); +
    -?> -
    comment_post_ID) ) { ?> -


    - - | - - ID ) ) : ?> - comment_author_email) ): ?> - | - - - -

    - -

    -
     

    "; - $r .= "\n\t\t"; - $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); - $r .= "
    - - - - - - - - - - -
    - - + + + + + + +post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : + if ( $bulk ) : ?> + +
    + post_type, 'comments' ) ) : ?> + + post_type, 'trackbacks' ) ) : ?> + + +
    + + + +
    + post_type, 'comments' ) ) : ?> + + post_type, 'trackbacks' ) ) : ?> + + +
    + + + +
    + - foreach ( $keys as $key ) { - $key = attribute_escape( $key ); - echo "\n\t"; - } -?> - - -
    - - -
    -post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> -} + -function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) { - global $wp_locale, $post, $comment; + - if ( $for_post ) - $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true; + - $tab_index_attribute = ''; - if ( (int) $tab_index > 0 ) - $tab_index_attribute = " tabindex=\"$tab_index\""; + - // echo '
    '; + - $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 ); - $post_date = ($for_post) ? $post->post_date : $comment->comment_date; - $jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj ); - $mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj ); - $aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj ); - $hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj ); - $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj ); - $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); - - $month = "'; + - $day = ''; - $year = ''; - $hour = ''; - $minute = ''; - printf(_c('%1$s%2$s, %3$s
    @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute); - echo "\n\n"; - foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) - echo '' . "\n"; -?> + + + - + $column_display_name ) { + if ( isset( $core_columns[$column_name] ) ) + continue; + do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type ); + } +?> +

    + + + + + + + + + +
    +

    + + +
    $template"; - endforeach; +// adds hidden fields with the data for use in the inline editor for posts and pages +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $post + */ +function get_inline_data($post) { + $post_type_object = get_post_type_object($post->post_type); + if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) ) + return; + + $title = esc_attr( get_the_title( $post->ID ) ); + + echo ' +'; } -function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { - global $wpdb, $post_ID; - $items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" ); +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $posts + */ +function post_rows( $posts = array() ) { + global $wp_query, $post, $mode; - if ( $items ) { - foreach ( $items as $item ) { - // A page cannot be its own parent. - if (!empty ( $post_ID ) ) { - if ( $item->ID == $post_ID ) { - continue; - } - } - $pad = str_repeat( ' ', $level * 3 ); - if ( $item->ID == $default) - $current = ' selected="selected"'; - else - $current = ''; + add_filter('the_title','esc_html'); - echo "\n\t"; - parent_dropdown( $default, $item->ID, $level +1 ); - } - } else { - return false; + // Create array of post IDs. + $post_ids = array(); + + if ( empty($posts) ) + $posts = &$wp_query->posts; + + foreach ( $posts as $a_post ) + $post_ids[] = $a_post->ID; + + $comment_pending_count = get_pending_comments_num($post_ids); + + foreach ( $posts as $post ) { + if ( empty($comment_pending_count[$post->ID]) ) + $comment_pending_count[$post->ID] = 0; + + _post_row($post, $comment_pending_count[$post->ID], $mode); } } -function browse_happy() { - $getit = __( 'WordPress recommends a better browser' ); - echo ' - Browse Happy - '; -} +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $a_post + * @param unknown_type $pending_comments + * @param unknown_type $mode + */ +function _post_row($a_post, $pending_comments, $mode) { + global $post, $current_user, $current_screen; + static $rowclass; + + $global_post = $post; + $post = $a_post; + setup_postdata($post); + + $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; + $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); + $edit_link = get_edit_post_link( $post->ID ); + $title = _draft_or_post_title(); + $post_type_object = get_post_type_object($post->post_type); +?> + post_status ); ?> iedit' valign="top"> +$column_display_name ) { + $class = "class=\"$column_name column-$column_name\""; -if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) - add_action( 'in_admin_footer', 'browse_happy' ); + $style = ''; + if ( in_array($column_name, $hidden) ) + $style = ' style="display:none;"'; -function the_attachment_links( $id = false ) { - $id = (int) $id; - $post = & get_post( $id ); + $attributes = "$class$style"; - if ( $post->post_type != 'attachment' ) - return false; + switch ($column_name) { - $icon = get_attachment_icon( $post->ID ); - $attachment_data = wp_get_attachment_metadata( $id ); - $thumb = isset( $attachment_data['thumb'] ); -?> - + +
    + + + + + ' . __( 'Name' ) . ' + ' . __( 'Value' ) . ' + + + + + +'; //TBODY needed for list-manipulation JS + return; + } + $count = 0; +?> + + + + + + + + + + +
    + + $entry['meta_id'] = (int) $entry['meta_id']; + + $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] ); + + $r .= "\n\t"; + $r .= "\n\t\t"; + + $r .= "\n\t\t
    "; + $r .= "\n\t\t
    "; + $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); + $r .= ""; + + $r .= "\n\t\t\n\t"; + return $r; +} + +/** + * {@internal Missing Short Description}} + * + * @since unknown + */ +function meta_form() { + global $wpdb; + $limit = (int) apply_filters( 'postmeta_form_limit', 30 ); + $keys = $wpdb->get_col( " + SELECT meta_key + FROM $wpdb->postmeta + GROUP BY meta_key + HAVING meta_key NOT LIKE '\_%' + ORDER BY meta_key + LIMIT $limit" ); + if ( $keys ) + natcasesort($keys); +?> +

    + + + + + + + + + + + + + + + + +
    + + + + + + + + + +
    + + +
    +post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); + + $tab_index_attribute = ''; + if ( (int) $tab_index > 0 ) + $tab_index_attribute = " tabindex=\"$tab_index\""; + + // echo '
    '; + + $time_adj = current_time('timestamp'); + $post_date = ($for_post) ? $post->post_date : $comment->comment_date; + $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj ); + $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj ); + $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj ); + $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj ); + $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj ); + $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj ); + + $cur_jj = gmdate( 'd', $time_adj ); + $cur_mm = gmdate( 'm', $time_adj ); + $cur_aa = gmdate( 'Y', $time_adj ); + $cur_hh = gmdate( 'H', $time_adj ); + $cur_mn = gmdate( 'i', $time_adj ); + + $month = "'; + + $day = ''; + $year = ''; + $hour = ''; + $minute = ''; + + echo '
    '; + /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */ + printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute); + + echo '
    '; + + if ( $multi ) return; + + echo "\n\n"; + foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) { + echo '' . "\n"; + $cur_timeunit = 'cur_' . $timeunit; + echo '' . "\n"; + } +?> + +

    + + +

    +$template"; + endforeach; +} + +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $default + * @param unknown_type $parent + * @param unknown_type $level + * @return unknown + */ +function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { + global $wpdb, $post_ID; + $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) ); + + if ( $items ) { + foreach ( $items as $item ) { + // A page cannot be its own parent. + if (!empty ( $post_ID ) ) { + if ( $item->ID == $post_ID ) { + continue; + } + } + $pad = str_repeat( ' ', $level * 3 ); + if ( $item->ID == $default) + $current = ' selected="selected"'; + else + $current = ''; + + echo "\n\t"; + parent_dropdown( $default, $item->ID, $level +1 ); + } + } else { + return false; + } +} + +/** + * {@internal Missing Short Description}} + * + * @since unknown + * + * @param unknown_type $id + * @return unknown + */ +function the_attachment_links( $id = false ) { + $id = (int) $id; + $post = & get_post( $id ); + + if ( $post->post_type != 'attachment' ) + return false; + + $icon = wp_get_attachment_image( $post->ID, 'thumbnail', true ); + $attachment_data = wp_get_attachment_metadata( $id ); + $thumb = isset( $attachment_data['thumb'] ); +?> +