513 array_unshift( $categories, $self ); |
513 array_unshift( $categories, $self ); |
514 } else { |
514 } else { |
515 $categories = get_categories('get=all'); |
515 $categories = get_categories('get=all'); |
516 } |
516 } |
517 |
517 |
518 // 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) |
518 if ( $checked_ontop ) { |
519 $checked_categories = array(); |
519 // 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) |
520 $keys = array_keys( $categories ); |
520 $checked_categories = array(); |
521 |
521 $keys = array_keys( $categories ); |
522 foreach( $keys as $k ) { |
522 |
523 if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
523 foreach( $keys as $k ) { |
524 $checked_categories[] = $categories[$k]; |
524 if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
525 unset( $categories[$k] ); |
525 $checked_categories[] = $categories[$k]; |
|
526 unset( $categories[$k] ); |
|
527 } |
526 } |
528 } |
527 } |
529 |
528 |
530 // Put checked cats on top |
529 // Put checked cats on top |
531 echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args)); |
530 echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args)); |
532 } |
531 // Then the rest of them |
533 // Then the rest of them |
532 echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args)); |
534 echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args)); |
533 } |
535 } |
534 |
536 |
535 /** |
537 /** |
543 * @param unknown_type $echo |
545 * @param unknown_type $echo |
544 * @return unknown |
546 * @return unknown |
545 */ |
547 */ |
546 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { |
548 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { |
547 global $post_ID; |
549 global $post_ID; |
|
550 |
548 if ( $post_ID ) |
551 if ( $post_ID ) |
549 $checked_categories = wp_get_post_categories($post_ID); |
552 $checked_categories = wp_get_post_categories($post_ID); |
550 else |
553 else |
551 $checked_categories = array(); |
554 $checked_categories = array(); |
|
555 |
552 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); |
556 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); |
553 |
557 |
554 $popular_ids = array(); |
558 $popular_ids = array(); |
555 foreach ( (array) $categories as $category ) { |
559 foreach ( (array) $categories as $category ) { |
556 $popular_ids[] = $category->term_id; |
560 $popular_ids[] = $category->term_id; |
557 if ( !$echo ) // hack for AJAX use |
561 if ( !$echo ) // hack for AJAX use |
558 continue; |
562 continue; |
559 $id = "popular-category-$category->term_id"; |
563 $id = "popular-category-$category->term_id"; |
|
564 $checked = in_array( $category->term_id, $checked_categories ) ? 'checked="checked"' : ''; |
560 ?> |
565 ?> |
561 |
566 |
562 <li id="<?php echo $id; ?>" class="popular-category"> |
567 <li id="<?php echo $id; ?>" class="popular-category"> |
563 <label class="selectit"> |
568 <label class="selectit"> |
564 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" /> |
569 <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $category->term_id; ?>" /> |
565 <?php echo esc_html( apply_filters( 'the_category', $category->name ) ); ?> |
570 <?php echo esc_html( apply_filters( 'the_category', $category->name ) ); ?> |
566 </label> |
571 </label> |
567 </li> |
572 </li> |
568 |
573 |
569 <?php |
574 <?php |
661 case 'name': |
666 case 'name': |
662 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />'; |
667 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />'; |
663 $actions = array(); |
668 $actions = array(); |
664 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; |
669 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; |
665 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; |
670 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; |
666 $actions['delete'] = "<a class='delete:the-list:tag-$tag->term_id submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>"; |
671 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>"; |
667 $actions = apply_filters('tag_row_actions', $actions, $tag); |
672 $actions = apply_filters('tag_row_actions', $actions, $tag); |
668 $action_count = count($actions); |
673 $action_count = count($actions); |
669 $i = 0; |
674 $i = 0; |
670 $out .= '<div class="row-actions">'; |
675 $out .= '<div class="row-actions">'; |
671 foreach ( $actions as $action => $link ) { |
676 foreach ( $actions as $action => $link ) { |
751 /* translators: manage posts column name */ |
756 /* translators: manage posts column name */ |
752 $posts_columns['title'] = _x('Post', 'column name'); |
757 $posts_columns['title'] = _x('Post', 'column name'); |
753 $posts_columns['author'] = __('Author'); |
758 $posts_columns['author'] = __('Author'); |
754 $posts_columns['categories'] = __('Categories'); |
759 $posts_columns['categories'] = __('Categories'); |
755 $posts_columns['tags'] = __('Tags'); |
760 $posts_columns['tags'] = __('Tags'); |
756 if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) |
761 $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; |
|
762 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) ) |
757 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>'; |
763 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>'; |
758 $posts_columns['date'] = __('Date'); |
764 $posts_columns['date'] = __('Date'); |
759 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); |
765 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); |
760 |
766 |
761 return $posts_columns; |
767 return $posts_columns; |
798 function wp_manage_pages_columns() { |
804 function wp_manage_pages_columns() { |
799 $posts_columns = array(); |
805 $posts_columns = array(); |
800 $posts_columns['cb'] = '<input type="checkbox" />'; |
806 $posts_columns['cb'] = '<input type="checkbox" />'; |
801 $posts_columns['title'] = __('Title'); |
807 $posts_columns['title'] = __('Title'); |
802 $posts_columns['author'] = __('Author'); |
808 $posts_columns['author'] = __('Author'); |
803 $post_status = 'all'; |
809 $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all'; |
804 if ( !empty($_GET['post_status']) ) |
810 if ( !in_array( $post_status, array('pending', 'draft', 'future') ) ) |
805 $post_status = $_GET['post_status']; |
|
806 if ( !in_array($post_status, array('pending', 'draft', 'future')) ) |
|
807 $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>'; |
811 $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>'; |
808 $posts_columns['date'] = __('Date'); |
812 $posts_columns['date'] = __('Date'); |
809 $posts_columns = apply_filters('manage_pages_columns', $posts_columns); |
813 $posts_columns = apply_filters('manage_pages_columns', $posts_columns); |
810 |
814 |
811 return $posts_columns; |
815 return $posts_columns; |
1053 </div> |
1057 </div> |
1054 <br class="clear" /> |
1058 <br class="clear" /> |
1055 |
1059 |
1056 <?php endif; // $bulk |
1060 <?php endif; // $bulk |
1057 |
1061 |
1058 ob_start(); |
|
1059 $authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM |
1062 $authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM |
|
1063 $authors_dropdown = ''; |
1060 if ( $authors && count( $authors ) > 1 ) : |
1064 if ( $authors && count( $authors ) > 1 ) : |
1061 $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1); |
1065 $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0); |
1062 if ( $bulk ) |
1066 if ( $bulk ) |
1063 $users_opt['show_option_none'] = __('- No Change -'); |
1067 $users_opt['show_option_none'] = __('- No Change -'); |
1064 ?> |
1068 $authors_dropdown = '<label>'; |
1065 <label> |
1069 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; |
1066 <span class="title"><?php _e( 'Author' ); ?></span> |
1070 $authors_dropdown .= wp_dropdown_users( $users_opt ); |
1067 <?php wp_dropdown_users( $users_opt ); ?> |
1071 $authors_dropdown .= '</label>'; |
1068 </label> |
1072 |
1069 |
|
1070 <?php |
|
1071 endif; // authors |
1073 endif; // authors |
1072 $authors_dropdown = ob_get_clean(); |
|
1073 ?> |
1074 ?> |
1074 |
1075 |
1075 <?php if ( !$bulk ) : echo $authors_dropdown; ?> |
1076 <?php if ( !$bulk ) : echo $authors_dropdown; ?> |
1076 |
1077 |
1077 <div class="inline-edit-group"> |
1078 <div class="inline-edit-group"> |
1363 * @param unknown_type $a_post |
1364 * @param unknown_type $a_post |
1364 * @param unknown_type $pending_comments |
1365 * @param unknown_type $pending_comments |
1365 * @param unknown_type $mode |
1366 * @param unknown_type $mode |
1366 */ |
1367 */ |
1367 function _post_row($a_post, $pending_comments, $mode) { |
1368 function _post_row($a_post, $pending_comments, $mode) { |
1368 global $post; |
1369 global $post, $current_user; |
1369 static $rowclass; |
1370 static $rowclass; |
1370 |
1371 |
1371 $global_post = $post; |
1372 $global_post = $post; |
1372 $post = $a_post; |
1373 $post = $a_post; |
1373 setup_postdata($post); |
1374 setup_postdata($post); |
1374 |
1375 |
1375 $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; |
1376 $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; |
1376 global $current_user; |
|
1377 $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); |
1377 $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); |
1378 $edit_link = get_edit_post_link( $post->ID ); |
1378 $edit_link = get_edit_post_link( $post->ID ); |
1379 $title = _draft_or_post_title(); |
1379 $title = _draft_or_post_title(); |
1380 ?> |
1380 ?> |
1381 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top"> |
1381 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top"> |
1436 break; |
1436 break; |
1437 |
1437 |
1438 case 'title': |
1438 case 'title': |
1439 $attributes = 'class="post-title column-title"' . $style; |
1439 $attributes = 'class="post-title column-title"' . $style; |
1440 ?> |
1440 ?> |
1441 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> |
1441 <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_post', $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> |
1442 <?php |
1442 <?php |
1443 if ( 'excerpt' == $mode ) |
1443 if ( 'excerpt' == $mode ) |
1444 the_excerpt(); |
1444 the_excerpt(); |
1445 |
1445 |
1446 $actions = array(); |
1446 $actions = array(); |
1447 if ( current_user_can('edit_post', $post->ID) ) { |
1447 if ( current_user_can('edit_post', $post->ID) && 'trash' != $post->post_status ) { |
1448 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; |
1448 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; |
1449 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; |
1449 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; |
1450 } |
1450 } |
1451 if ( current_user_can('delete_post', $post->ID) ) { |
1451 if ( current_user_can('delete_post', $post->ID) ) { |
1452 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; |
1452 if ( 'trash' == $post->post_status ) |
|
1453 $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; |
|
1454 elseif ( EMPTY_TRASH_DAYS ) |
|
1455 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; |
|
1456 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) |
|
1457 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>"; |
1453 } |
1458 } |
1454 if ( in_array($post->post_status, array('pending', 'draft')) ) { |
1459 if ( in_array($post->post_status, array('pending', 'draft')) ) { |
1455 if ( current_user_can('edit_post', $post->ID) ) |
1460 if ( current_user_can('edit_post', $post->ID) ) |
1456 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; |
1461 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; |
1457 } else { |
1462 } elseif ( 'trash' != $post->post_status ) { |
1458 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; |
1463 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; |
1459 } |
1464 } |
1460 $actions = apply_filters('post_row_actions', $actions, $post); |
1465 $actions = apply_filters('post_row_actions', $actions, $post); |
1461 $action_count = count($actions); |
1466 $action_count = count($actions); |
1462 $i = 0; |
1467 $i = 0; |
1654 break; |
1659 break; |
1655 case 'title': |
1660 case 'title': |
1656 $attributes = 'class="post-title page-title column-title"' . $style; |
1661 $attributes = 'class="post-title page-title column-title"' . $style; |
1657 $edit_link = get_edit_post_link( $page->ID ); |
1662 $edit_link = get_edit_post_link( $page->ID ); |
1658 ?> |
1663 ?> |
1659 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_page', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong> |
1664 <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong> |
1660 <?php |
1665 <?php |
1661 $actions = array(); |
1666 $actions = array(); |
1662 if ( current_user_can('edit_page', $page->ID) ) { |
1667 if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'trash' ) { |
1663 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; |
1668 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; |
1664 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; |
1669 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; |
1665 } |
1670 } |
1666 if ( current_user_can('delete_page', $page->ID) ) { |
1671 if ( current_user_can('delete_page', $page->ID) ) { |
1667 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; |
1672 if ( $post->post_status == 'trash' ) |
|
1673 $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>"; |
|
1674 elseif ( EMPTY_TRASH_DAYS ) |
|
1675 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . get_delete_post_link($page->ID) . "'>" . __('Trash') . "</a>"; |
|
1676 if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS ) |
|
1677 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>"; |
1668 } |
1678 } |
1669 if ( in_array($post->post_status, array('pending', 'draft')) ) { |
1679 if ( in_array($post->post_status, array('pending', 'draft')) ) { |
1670 if ( current_user_can('edit_page', $page->ID) ) |
1680 if ( current_user_can('edit_page', $page->ID) ) |
1671 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; |
1681 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; |
1672 } else { |
1682 } elseif ( $post->post_status != 'trash' ) { |
1673 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; |
1683 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; |
1674 } |
1684 } |
1675 $actions = apply_filters('page_row_actions', $actions, $page); |
1685 $actions = apply_filters('page_row_actions', $actions, $page); |
1676 $action_count = count($actions); |
1686 $action_count = count($actions); |
1677 |
1687 |
1984 /** |
1995 /** |
1985 * {@internal Missing Short Description}} |
1996 * {@internal Missing Short Description}} |
1986 * |
1997 * |
1987 * @since unknown |
1998 * @since unknown |
1988 * |
1999 * |
1989 * @param unknown_type $status |
2000 * @param string $status Comment status (approved, spam, trash, etc) |
1990 * @param unknown_type $s |
2001 * @param string $s Term to search for |
1991 * @param unknown_type $start |
2002 * @param int $start Offset to start at for pagination |
1992 * @param unknown_type $num |
2003 * @param int $num Maximum number of comments to return |
1993 * @param unknown_type $post |
2004 * @param int $post Post ID or 0 to return all comments |
1994 * @param unknown_type $type |
2005 * @param string $type Comment type (comment, trackback, pingback, etc) |
1995 * @return unknown |
2006 * @return array [0] contains the comments and [1] contains the total number of comments that match (ignoring $start and $num) |
1996 */ |
2007 */ |
1997 function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) { |
2008 function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) { |
1998 global $wpdb; |
2009 global $wpdb; |
1999 |
2010 |
2000 $start = abs( (int) $start ); |
2011 $start = abs( (int) $start ); |
2002 $post = (int) $post; |
2013 $post = (int) $post; |
2003 $count = wp_count_comments(); |
2014 $count = wp_count_comments(); |
2004 $index = ''; |
2015 $index = ''; |
2005 |
2016 |
2006 if ( 'moderated' == $status ) { |
2017 if ( 'moderated' == $status ) { |
2007 $approved = "comment_approved = '0'"; |
2018 $approved = "c.comment_approved = '0'"; |
2008 $total = $count->moderated; |
2019 $total = $count->moderated; |
2009 } elseif ( 'approved' == $status ) { |
2020 } elseif ( 'approved' == $status ) { |
2010 $approved = "comment_approved = '1'"; |
2021 $approved = "c.comment_approved = '1'"; |
2011 $total = $count->approved; |
2022 $total = $count->approved; |
2012 } elseif ( 'spam' == $status ) { |
2023 } elseif ( 'spam' == $status ) { |
2013 $approved = "comment_approved = 'spam'"; |
2024 $approved = "c.comment_approved = 'spam'"; |
2014 $total = $count->spam; |
2025 $total = $count->spam; |
|
2026 } elseif ( 'trash' == $status ) { |
|
2027 $approved = "c.comment_approved = 'trash'"; |
|
2028 $total = $count->trash; |
2015 } else { |
2029 } else { |
2016 $approved = "( comment_approved = '0' OR comment_approved = '1' )"; |
2030 $approved = "( c.comment_approved = '0' OR c.comment_approved = '1' )"; |
2017 $total = $count->moderated + $count->approved; |
2031 $total = $count->moderated + $count->approved; |
2018 $index = 'USE INDEX (comment_date_gmt)'; |
2032 $index = 'USE INDEX (c.comment_date_gmt)'; |
2019 } |
2033 } |
2020 |
2034 |
2021 if ( $post ) { |
2035 if ( $post ) { |
2022 $total = ''; |
2036 $total = ''; |
2023 $post = " AND comment_post_ID = '$post'"; |
2037 $post = " AND c.comment_post_ID = '$post'"; |
2024 $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num"; |
|
2025 } else { |
2038 } else { |
2026 $post = ''; |
2039 $post = ''; |
2027 $orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num"; |
2040 } |
2028 } |
2041 |
|
2042 $orderby = "ORDER BY c.comment_date_gmt DESC LIMIT $start, $num"; |
2029 |
2043 |
2030 if ( 'comment' == $type ) |
2044 if ( 'comment' == $type ) |
2031 $typesql = "AND comment_type = ''"; |
2045 $typesql = "AND c.comment_type = ''"; |
2032 elseif ( 'pingback' == $type ) |
|
2033 $typesql = "AND comment_type = 'pingback'"; |
|
2034 elseif ( 'trackback' == $type ) |
|
2035 $typesql = "AND comment_type = 'trackback'"; |
|
2036 elseif ( 'pings' == $type ) |
2046 elseif ( 'pings' == $type ) |
2037 $typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )"; |
2047 $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )"; |
|
2048 elseif ( 'all' == $type ) |
|
2049 $typesql = ''; |
|
2050 elseif ( !empty($type) ) |
|
2051 $typesql = $wpdb->prepare("AND c.comment_type = %s", $type); |
2038 else |
2052 else |
2039 $typesql = ''; |
2053 $typesql = ''; |
2040 |
2054 |
2041 if ( !empty($type) ) |
2055 if ( !empty($type) ) |
2042 $total = ''; |
2056 $total = ''; |
2043 |
2057 |
|
2058 $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' "; |
2044 if ( $s ) { |
2059 if ( $s ) { |
2045 $total = ''; |
2060 $total = ''; |
2046 $s = $wpdb->escape($s); |
2061 $s = $wpdb->escape($s); |
2047 $query = "FROM $wpdb->comments WHERE |
2062 $query .= "AND |
2048 (comment_author LIKE '%$s%' OR |
2063 (c.comment_author LIKE '%$s%' OR |
2049 comment_author_email LIKE '%$s%' OR |
2064 c.comment_author_email LIKE '%$s%' OR |
2050 comment_author_url LIKE ('%$s%') OR |
2065 c.comment_author_url LIKE ('%$s%') OR |
2051 comment_author_IP LIKE ('%$s%') OR |
2066 c.comment_author_IP LIKE ('%$s%') OR |
2052 comment_content LIKE ('%$s%') ) AND |
2067 c.comment_content LIKE ('%$s%') ) AND |
2053 $approved |
2068 $approved |
2054 $typesql"; |
2069 $typesql"; |
2055 } else { |
2070 } else { |
2056 $query = "FROM $wpdb->comments $index WHERE $approved $post $typesql"; |
2071 $query .= "AND $approved $post $typesql"; |
2057 } |
2072 } |
2058 |
2073 |
2059 $comments = $wpdb->get_results("SELECT * $query $orderby"); |
2074 $comments = $wpdb->get_results("SELECT * $query $orderby"); |
2060 if ( '' === $total ) |
2075 if ( '' === $total ) |
2061 $total = $wpdb->get_var("SELECT COUNT(comment_ID) $query"); |
2076 $total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query"); |
2062 |
2077 |
2063 update_comment_cache($comments); |
2078 update_comment_cache($comments); |
2064 |
2079 |
2065 return array($comments, $total); |
2080 return array($comments, $total); |
2066 } |
2081 } |
2093 if ( ( abs(time() - $ptime) ) < 86400 ) |
2108 if ( ( abs(time() - $ptime) ) < 86400 ) |
2094 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); |
2109 $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) ); |
2095 else |
2110 else |
2096 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date ); |
2111 $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date ); |
2097 |
2112 |
2098 $delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); |
2113 if ( $user_can ) { |
2099 $approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) ); |
2114 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
2100 $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) ); |
2115 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
2101 $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) ); |
2116 |
|
2117 $comment_url = esc_url(get_comment_link($comment->comment_ID)); |
|
2118 $approve_url = esc_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" ); |
|
2119 $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" ); |
|
2120 $spam_url = esc_url( "comment.php?action=spamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); |
|
2121 $unspam_url = esc_url( "comment.php?action=unspamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); |
|
2122 $trash_url = esc_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); |
|
2123 $untrash_url = esc_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); |
|
2124 $delete_url = esc_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); |
|
2125 } |
2102 |
2126 |
2103 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>"; |
2127 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>"; |
2104 $columns = get_column_headers('edit-comments'); |
2128 $columns = get_column_headers('edit-comments'); |
2105 $hidden = get_hidden_columns('edit-comments'); |
2129 $hidden = get_hidden_columns('edit-comments'); |
2106 foreach ( $columns as $column_name => $column_display_name ) { |
2130 foreach ( $columns as $column_name => $column_display_name ) { |
2120 echo '</th>'; |
2144 echo '</th>'; |
2121 break; |
2145 break; |
2122 case 'comment': |
2146 case 'comment': |
2123 echo "<td $attributes>"; |
2147 echo "<td $attributes>"; |
2124 echo '<div id="submitted-on">'; |
2148 echo '<div id="submitted-on">'; |
2125 printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), get_comment_link($comment->comment_ID), get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia'))); |
2149 printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), $comment_url, get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia'))); |
2126 echo '</div>'; |
2150 echo '</div>'; |
2127 comment_text(); ?> |
2151 comment_text(); |
|
2152 if ( $user_can ) { ?> |
2128 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
2153 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
2129 <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea> |
2154 <textarea class="comment" rows="1" cols="1"><?php echo htmlspecialchars( apply_filters('comment_edit_pre', $comment->comment_content), ENT_QUOTES ); ?></textarea> |
2130 <div class="author-email"><?php if ( $user_can ) echo esc_attr( $comment->comment_author_email ); ?></div> |
2155 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> |
2131 <div class="author"><?php if ( $user_can ) echo esc_attr( $comment->comment_author ); ?></div> |
2156 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> |
2132 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> |
2157 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> |
2133 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
2158 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
2134 </div> |
2159 </div> |
2135 <?php |
2160 <?php |
2136 $actions = array(); |
2161 } |
2137 |
2162 |
2138 if ( $user_can ) { |
2163 if ( $user_can ) { |
2139 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
2164 // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash |
2140 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
2165 $actions = array( |
|
2166 'approve' => '', 'unapprove' => '', |
|
2167 'reply' => '', |
|
2168 'quickedit' => '', |
|
2169 'edit' => '', |
|
2170 'spam' => '', 'unspam' => '', |
|
2171 'trash' => '', 'untrash' => '', 'delete' => '' |
|
2172 ); |
|
2173 |
2141 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments |
2174 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments |
2142 if ( 'approved' == $the_comment_status ) { |
2175 if ( 'approved' == $the_comment_status ) |
2143 $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
2176 $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
2144 unset($actions['approve']); |
2177 else if ( 'unapproved' == $the_comment_status ) |
2145 } else { |
2178 $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
2146 $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
2179 } else { |
2147 unset($actions['unapprove']); |
2180 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
2148 } |
2181 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
2149 } |
2182 } |
2150 if ( 'spam' != $the_comment_status ) |
2183 |
2151 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
2184 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { |
2152 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>'; |
2185 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
2153 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>'; |
2186 } elseif ( 'spam' == $the_comment_status ) { |
2154 $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>'; |
2187 $actions['unspam'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . __( 'Not Spam' ) . '</a>'; |
2155 if ( 'spam' != $the_comment_status ) |
2188 } elseif ( 'trash' == $the_comment_status ) { |
2156 $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'; |
2189 $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; |
2157 |
2190 } |
2158 $actions = apply_filters( 'comment_row_actions', $actions, $comment ); |
2191 |
|
2192 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { |
|
2193 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; |
|
2194 } else { |
|
2195 $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>'; |
|
2196 } |
|
2197 |
|
2198 if ( 'trash' != $the_comment_status ) { |
|
2199 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>'; |
|
2200 $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.esc_attr__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>'; |
|
2201 if ( 'spam' != $the_comment_status ) |
|
2202 $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'; |
|
2203 } |
|
2204 |
|
2205 $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment ); |
2159 |
2206 |
2160 $i = 0; |
2207 $i = 0; |
2161 echo '<div class="row-actions">'; |
2208 echo '<div class="row-actions">'; |
2162 foreach ( $actions as $action => $link ) { |
2209 foreach ( $actions as $action => $link ) { |
2163 ++$i; |
2210 ++$i; |
2164 ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
2211 ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
2165 |
2212 |
2166 // Reply and quickedit need a hide-if-no-js span when not added with ajax |
2213 // Reply and quickedit need a hide-if-no-js span when not added with ajax |
2167 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax ) |
2214 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax ) |
2168 $action .= ' hide-if-no-js'; |
2215 $action .= ' hide-if-no-js'; |
|
2216 elseif ( ($action == 'untrash' && $the_comment_status == 'trash') || ($action == 'unspam' && $the_comment_status == 'spam') ) { |
|
2217 if ('1' == get_comment_meta($comment_id, '_wp_trash_meta_status', true)) |
|
2218 $action .= ' approve'; |
|
2219 else |
|
2220 $action .= ' unapprove'; |
|
2221 } |
2169 |
2222 |
2170 echo "<span class='$action'>$sep$link</span>"; |
2223 echo "<span class='$action'>$sep$link</span>"; |
2171 } |
2224 } |
2172 echo '</div>'; |
2225 echo '</div>'; |
2173 } |
2226 } |
2212 $post_link = get_the_title($post->ID); |
2265 $post_link = get_the_title($post->ID); |
2213 } |
2266 } |
2214 echo "<td $attributes>\n"; |
2267 echo "<td $attributes>\n"; |
2215 echo '<div class="response-links"><span class="post-com-count-wrapper">'; |
2268 echo '<div class="response-links"><span class="post-com-count-wrapper">'; |
2216 echo $post_link . '<br />'; |
2269 echo $post_link . '<br />'; |
2217 $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) ); |
2270 $pending_phrase = esc_attr(sprintf( __('%s pending'), number_format( $pending_comments ) )); |
2218 if ( $pending_comments ) |
2271 if ( $pending_comments ) |
2219 echo '<strong>'; |
2272 echo '<strong>'; |
2220 comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>'); |
2273 comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>'); |
2221 if ( $pending_comments ) |
2274 if ( $pending_comments ) |
2222 echo '</strong>'; |
2275 echo '</strong>'; |
2559 |
2628 |
2560 $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; |
2629 $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; |
2561 $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />'; |
2630 $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />'; |
2562 $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; |
2631 $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; |
2563 $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; |
2632 $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; |
|
2633 |
|
2634 echo '<div class="timestamp-wrap">'; |
2564 /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */ |
2635 /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */ |
2565 printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute); |
2636 printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute); |
2566 |
2637 |
2567 echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />'; |
2638 echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />'; |
2568 |
2639 |
2569 if ( $multi ) return; |
2640 if ( $multi ) return; |
2570 |
2641 |
2571 echo "\n\n"; |
2642 echo "\n\n"; |
2572 foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) { |
2643 foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) { |
2778 $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ); |
2849 $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ); |
2779 return $bytes; |
2850 return $bytes; |
2780 } |
2851 } |
2781 |
2852 |
2782 /** |
2853 /** |
2783 * {@internal Missing Short Description}} |
2854 * Outputs the form used by the importers to accept the data to be imported |
2784 * |
2855 * |
2785 * @since unknown |
2856 * @since 2.0 |
2786 * |
2857 * |
2787 * @param unknown_type $action |
2858 * @param string $action The action attribute for the form. |
2788 */ |
2859 */ |
2789 function wp_import_upload_form( $action ) { |
2860 function wp_import_upload_form( $action ) { |
2790 $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); |
2861 $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); |
2791 $size = wp_convert_bytes_to_hr( $bytes ); |
2862 $size = wp_convert_bytes_to_hr( $bytes ); |
2792 $upload_dir = wp_upload_dir(); |
2863 $upload_dir = wp_upload_dir(); |
2793 if ( ! empty( $upload_dir['error'] ) ) : |
2864 if ( ! empty( $upload_dir['error'] ) ) : |
2794 ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p> |
2865 ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p> |
2795 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php |
2866 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php |
2796 else : |
2867 else : |
2797 ?> |
2868 ?> |
2798 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr($action) ?>"> |
2869 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr(wp_nonce_url($action, 'import-upload')); ?>"> |
2799 <p> |
2870 <p> |
2800 <?php wp_nonce_field('import-upload'); ?> |
|
2801 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>) |
2871 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>) |
2802 <input type="file" id="upload" name="import" size="25" /> |
2872 <input type="file" id="upload" name="import" size="25" /> |
2803 <input type="hidden" name="action" value="save" /> |
2873 <input type="hidden" name="action" value="save" /> |
2804 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" /> |
2874 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" /> |
2805 </p> |
2875 </p> |
3648 break; |
3715 break; |
3649 default: |
3716 default: |
3650 return ''; |
3717 return ''; |
3651 } |
3718 } |
3652 |
3719 |
3653 $option = str_replace('-', '_', "${screen}_per_page"); |
3720 $option = str_replace( '-', '_', "${screen}_per_page" ); |
3654 $per_page = get_user_option($option); |
3721 $per_page = (int) get_user_option( $option, 0, false ); |
3655 if ( empty($per_page) ) { |
3722 if ( empty( $per_page ) || $per_page < 1 ) { |
3656 if ( 'plugins' == $screen ) |
3723 if ( 'plugins' == $screen ) |
3657 $per_page = 999; |
3724 $per_page = 999; |
3658 else |
3725 else |
3659 $per_page = 20; |
3726 $per_page = 20; |
3660 } |
3727 } |
|
3728 if ( 'edit_comments_per_page' == $option ) |
|
3729 $per_page = apply_filters( 'comments_per_page', $per_page, isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all' ); |
|
3730 elseif ( 'categories' == $option ) |
|
3731 $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
|
3732 else |
|
3733 $per_page = apply_filters( $option, $per_page ); |
3661 |
3734 |
3662 $return = '<h5>' . __('Options') . "</h5>\n"; |
3735 $return = '<h5>' . __('Options') . "</h5>\n"; |
3663 $return .= "<div class='screen-options'>\n"; |
3736 $return .= "<div class='screen-options'>\n"; |
3664 if ( !empty($per_page_label) ) |
3737 if ( !empty($per_page_label) ) |
3665 $return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n"; |
3738 $return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n"; |