WordPress.org

Make WordPress Core

Ticket #4529: delete-post.3.diff

File delete-post.3.diff, 38.3 KB (added by caesarsgrunt, 5 years ago)

Hides comments on posts which are in the trash.

  • wp-includes/post.php

     
    998998 
    999999        $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); 
    10001000 
    1001         $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0 ); 
     1001        $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0, 'deleted' => 0 ); 
    10021002        foreach( (array) $count as $row_num => $row ) { 
    10031003                $stats[$row['post_status']] = $row['num_posts']; 
    10041004        } 
     
    11401140        if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) 
    11411141                return $post; 
    11421142 
    1143         if ( 'attachment' == $post->post_type ) 
     1143        if (($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'deleted') { 
     1144                wp_update_post(array('ID'=>$postid, 'post_status'=>'deleted')); 
     1145                wp_schedule_post_delete($postid); 
     1146                return true; 
     1147        } 
     1148        else if ($post->post_type == 'attachment') 
    11441149                return wp_delete_attachment($postid); 
    11451150 
    11461151        do_action('delete_post', $postid); 
     1152         
     1153        wp_unschedule_post_delete($postid); 
    11471154 
    11481155        /** @todo delete for pluggable post taxonomies too */ 
    11491156        wp_delete_object_term_relationships($postid, array('category', 'post_tag')); 
     
    12051212} 
    12061213 
    12071214/** 
     1215 * Removes a post or page from the Trash 
     1216 * 
     1217 * @since 2.9.0 
     1218 * @uses do_action() on 'undelete_post' before deletion 
     1219 * @uses do_action() on 'undeleted_post' after deletion 
     1220 * 
     1221 * @param int $postid Post ID. 
     1222 * @return mixed False on failure 
     1223 */ 
     1224function wp_undelete_post($postid = 0) { 
     1225        global $wpdb, $wp_rewrite; 
     1226 
     1227        if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) 
     1228                return $post; 
     1229 
     1230        do_action('undelete_post', $postid); 
     1231         
     1232        wp_update_post(array('ID'=>$postid, 'post_status'=>'draft')); 
     1233         
     1234        wp_unschedule_post_delete($postid); 
     1235 
     1236        do_action('undeleted_post', $postid); 
     1237 
     1238        return $post; 
     1239} 
     1240 
     1241/** 
     1242 * Schedules a post for permanent deletion. 
     1243 *  
     1244 * @since 2.9.0 
     1245 *  
     1246 * @param int $post_id Post ID. 
     1247 * @return void 
     1248 */ 
     1249function wp_schedule_post_delete($post_id) { 
     1250        $to_delete = get_option('wp_scheduled_delete'); 
     1251        if (!is_array($to_delete)) 
     1252                $to_delete = array(); 
     1253         
     1254        $to_delete['posts'][$post_id] = time(); 
     1255         
     1256        update_option('wp_scheduled_delete', $to_delete); 
     1257} 
     1258 
     1259/** 
     1260 * Unschedules a post for permanent deletion. 
     1261 *  
     1262 * @since 2.9.0 
     1263 *  
     1264 * @param int $post_id Post ID. 
     1265 * @return void 
     1266 */ 
     1267function wp_unschedule_post_delete($post_id) { 
     1268        $to_delete = get_option('wp_scheduled_delete'); 
     1269        if (!is_array($to_delete)) 
     1270                return; 
     1271         
     1272        unset($to_delete['posts'][$post_id]); 
     1273         
     1274        update_option('wp_scheduled_delete', $to_delete); 
     1275} 
     1276 
     1277/** 
    12081278 * Retrieve the list of categories for a post. 
    12091279 * 
    12101280 * Compatibility layer for themes and plugins. Also an easy layer of abstraction 
  • wp-includes/comment.php

     
    694694        if ( false !== $count ) 
    695695                return $count; 
    696696 
    697         $where = ''; 
     697        $where = 'WHERE '; 
    698698        if( $post_id > 0 ) 
    699                 $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id ); 
     699                $where .= $wpdb->prepare( "c.comment_post_ID = %d AND ", $post_id ); 
     700        $where .= "p.post_status <> 'deleted'"; 
    700701 
    701         $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); 
     702        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID {$where} GROUP BY comment_approved", ARRAY_A ); 
    702703 
    703704        $total = 0; 
    704705        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'deleted' => 'deleted'); 
     
    10841085} 
    10851086 
    10861087/** 
    1087  * Schedules a comment for destruction in 30 days. 
     1088 * Schedules a comment for permanent deletion. 
    10881089 *  
    10891090 * @since 2.9.0 
    10901091 *  
     
    11021103} 
    11031104 
    11041105/** 
    1105  * Unschedules a comment for destruction. 
     1106 * Unschedules a comment for permanent deletion. 
    11061107 *  
    11071108 * @since 2.9.0 
    11081109 *  
  • wp-includes/functions.php

     
    33393339} 
    33403340 
    33413341/** 
    3342  * Permanently deletes comments that have been scheduled for deleting. 
    3343  * Will do the same for posts, pages, etc in the future. 
     3342 * Permanently deletes posts, pages, and comments that have been scheduled for deleting. 
    33443343 *  
    3345  * @access private 
    33463344 * @since 2.9.0 
    33473345 * 
    33483346 * @return void 
     
    33553353        if ( !isset($to_delete['comments']) || !is_array($to_delete['comments']) ) 
    33563354                $to_delete['comments'] = array(); 
    33573355 
    3358         $delete_delay = defined('EMPTY_TRASH_TIMEOUT') ? (int) EMPTY_TRASH_TIMEOUT : (60*60*24*30); 
    3359         $deletetimestamp = time() - $delete_delay; 
     3356        $delete_days = defined('EMPTY_TRASH_DAYS') ? (int) EMPTY_TRASH_DAYS : 30; 
     3357        $deletetimestamp = time() - (60*60*24*$delete_days); 
    33603358        foreach ($to_delete['comments'] as $comment_id => $timestamp) { 
    33613359                if ($timestamp < $deletetimestamp) { 
    33623360                        wp_delete_comment($comment_id); 
    33633361                        unset($to_delete['comments'][$comment_id]); 
    33643362                } 
    33653363        } 
     3364        foreach ($to_delete['posts'] as $post_id => $timestamp) { 
     3365                if ($timestamp < $deletetimestamp) { 
     3366                        wp_delete_post($post_id); 
     3367                        unset($to_delete['posts'][$post_id]); 
     3368                } 
     3369        } 
    33663370 
    33673371        update_option('wp_scheduled_delete', $to_delete); 
    33683372} 
  • wp-includes/query.php

     
    20992099                                $p_status[] = "$wpdb->posts.post_status = 'private'"; 
    21002100                        if ( in_array( 'publish', $q_status ) ) 
    21012101                                $r_status[] = "$wpdb->posts.post_status = 'publish'"; 
     2102                        if ( in_array( 'deleted', $q_status ) ) 
     2103                                $r_status[] = "$wpdb->posts.post_status = 'deleted'"; 
    21022104 
    21032105                        if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) { 
    21042106                                $r_status = array_merge($r_status, $p_status); 
  • wp-admin/edit-comments.php

     
    292292if ( ( 'spam' == $comment_status || 'deleted' == $comment_status) && current_user_can ('moderate_comments') ) { 
    293293        wp_nonce_field('bulk-destroy', '_destroy_nonce'); 
    294294    if ( 'spam' == $comment_status ) { ?> 
    295                 <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" /> 
     295                <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Empty Quarantine'); ?>" class="button-secondary apply" /> 
    296296<?php } elseif ( 'deleted' == $comment_status ) { ?> 
    297                 <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-primary apply" /> 
     297                <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 
    298298<?php } 
    299299} ?> 
    300300<?php do_action('manage_comments_nav', $comment_status); ?> 
  • wp-admin/includes/post.php

     
    795795                                'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')), 
    796796                                'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')), 
    797797                                'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')), 
     798                                'deleted' => array(_x('Trash', 'post'), __('Trash posts'), _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')), 
    798799                        ); 
    799800 
    800801        $post_stati = apply_filters('post_stati', $post_stati); 
  • wp-admin/includes/dashboard.php

     
    480480        $comments = array(); 
    481481        $start = 0; 
    482482 
    483         while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) { 
     483        while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'deleted' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) { 
    484484 
    485485                foreach ( $possible as $comment ) { 
    486486                        if ( count( $comments ) >= 5 ) 
  • wp-admin/includes/template.php

     
    14351435                case 'title': 
    14361436                        $attributes = 'class="post-title column-title"' . $style; 
    14371437                ?> 
    1438                 <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 &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> 
     1438                <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_post', $post->ID) && $post->post_status != 'deleted' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> 
    14391439                <?php 
    14401440                        if ( 'excerpt' == $mode ) 
    14411441                                the_excerpt(); 
    14421442 
    14431443                        $actions = array(); 
    1444                         if ( current_user_can('edit_post', $post->ID) ) { 
    1445                                 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 
    1446                                 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>'; 
    1447                         } 
    1448                         if ( current_user_can('delete_post', $post->ID) ) { 
    1449                                 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;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>"; 
    1450                         } 
    1451                         if ( in_array($post->post_status, array('pending', 'draft')) ) { 
    1452                                 if ( current_user_can('edit_post', $post->ID) ) 
    1453                                         $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 
     1444                        if ( 'deleted' == $post->post_status ) { 
     1445                                $actions['undelete'] = "<a title='" . esc_attr(__('Remove this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=undelete&amp;post=$post->ID", 'undelete-post_' . $post->ID) . "'>" . __('Return to Drafts') . "</a>"; 
     1446                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to permanently delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete Permanently') . "</a>"; 
    14541447                        } else { 
    1455                                 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
     1448                                if ( current_user_can('edit_post', $post->ID) ) { 
     1449                                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 
     1450                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>'; 
     1451                                } 
     1452                                if ( current_user_can('delete_post', $post->ID) ) { 
     1453                                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Move to Trash') . "</a>"; 
     1454                                } 
     1455                                if ( in_array($post->post_status, array('pending', 'draft')) ) { 
     1456                                        if ( current_user_can('edit_post', $post->ID) ) 
     1457                                                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 
     1458                                } else { 
     1459                                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
     1460                                } 
    14561461                        } 
    14571462                        $actions = apply_filters('post_row_actions', $actions, $post); 
    14581463                        $action_count = count($actions); 
     
    16531658                $attributes = 'class="post-title page-title column-title"' . $style; 
    16541659                $edit_link = get_edit_post_link( $page->ID ); 
    16551660                ?> 
    1656                 <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 &#8220;%s&#8221;'), $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> 
     1661                <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'deleted' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $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> 
    16571662                <?php 
    16581663                $actions = array(); 
    1659                 if ( current_user_can('edit_page', $page->ID) ) { 
    1660                         $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 
    1661                         $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>'; 
    1662                 } 
    1663                 if ( current_user_can('delete_page', $page->ID) ) { 
    1664                         $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;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>"; 
    1665                 } 
    1666                 if ( in_array($post->post_status, array('pending', 'draft')) ) { 
    1667                         if ( current_user_can('edit_page', $page->ID) ) 
    1668                                 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 
     1664                if ($post->post_status == 'deleted') { 
     1665                        if ( current_user_can('delete_page', $page->ID) ) { 
     1666                                $actions['undelete'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=undelete&amp;post=$page->ID", 'undelete-page_' . $page->ID) . "'>" . __('Return to Drafts') . "</a>"; 
     1667                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to permanently delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete Permanently') . "</a>"; 
     1668                        } 
    16691669                } else { 
    1670                         $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
     1670                        if ( current_user_can('edit_page', $page->ID) ) { 
     1671                                $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 
     1672                                $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>'; 
     1673                        } 
     1674                        if ( current_user_can('delete_page', $page->ID) ) { 
     1675                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Move to Trash') . "</a>"; 
     1676                        } 
     1677                        if ( in_array($post->post_status, array('pending', 'draft')) ) { 
     1678                                if ( current_user_can('edit_page', $page->ID) ) 
     1679                                        $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 
     1680                        } else { 
     1681                                $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
     1682                        } 
    16711683                } 
    16721684                $actions = apply_filters('page_row_actions', $actions, $page); 
    16731685                $action_count = count($actions); 
     
    20012013        $index = ''; 
    20022014 
    20032015        if ( 'moderated' == $status ) { 
    2004                 $approved = "comment_approved = '0'"; 
     2016                $approved = "c.comment_approved = '0'"; 
    20052017                $total = $count->moderated; 
    20062018        } elseif ( 'approved' == $status ) { 
    2007                 $approved = "comment_approved = '1'"; 
     2019                $approved = "c.comment_approved = '1'"; 
    20082020                $total = $count->approved; 
    20092021        } elseif ( 'spam' == $status ) { 
    2010                 $approved = "comment_approved = 'spam'"; 
     2022                $approved = "c.comment_approved = 'spam'"; 
    20112023                $total = $count->spam; 
    20122024        } elseif ( 'deleted' == $status ) { 
    2013                 $approved = "comment_approved = 'deleted'"; 
     2025                $approved = "c.comment_approved = 'deleted'"; 
    20142026                $total = $count->deleted; 
    20152027        } else { 
    2016                 $approved = "( comment_approved = '0' OR comment_approved = '1' )"; 
     2028                $approved = "( c.comment_approved = '0' OR c.comment_approved = '1' )"; 
    20172029                $total = $count->moderated + $count->approved; 
    2018                 $index = 'USE INDEX (comment_date_gmt)'; 
     2030                $index = 'USE INDEX (c.comment_date_gmt)'; 
    20192031        } 
    20202032 
    20212033        if ( $post ) { 
    20222034                $total = ''; 
    2023                 $post = " AND comment_post_ID = '$post'"; 
    2024                 $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num"; 
     2035                $post = " AND c.comment_post_ID = '$post'"; 
     2036                $orderby = "ORDER BY c.comment_date_gmt ASC LIMIT $start, $num"; 
    20252037        } else { 
    20262038                $post = ''; 
    2027                 $orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num"; 
     2039                $orderby = "ORDER BY c.comment_date_gmt DESC LIMIT $start, $num"; 
    20282040        } 
    20292041 
    20302042        if ( 'comment' == $type ) 
    2031                 $typesql = "AND comment_type = ''"; 
     2043                $typesql = "AND c.comment_type = ''"; 
    20322044        elseif ( 'pingback' == $type ) 
    2033                 $typesql = "AND comment_type = 'pingback'"; 
     2045                $typesql = "AND c.comment_type = 'pingback'"; 
    20342046        elseif ( 'trackback' == $type ) 
    2035                 $typesql = "AND comment_type = 'trackback'"; 
     2047                $typesql = "AND c.comment_type = 'trackback'"; 
    20362048        elseif ( 'pings' == $type ) 
    2037                 $typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )"; 
     2049                $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )"; 
    20382050        else 
    20392051                $typesql = ''; 
    20402052 
    20412053        if ( !empty($type) ) 
    20422054                $total = ''; 
    20432055 
     2056        $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'deleted' "; 
    20442057        if ( $s ) { 
    20452058                $total = ''; 
    20462059                $s = $wpdb->escape($s); 
    2047                 $query = "FROM $wpdb->comments WHERE 
    2048                         (comment_author LIKE '%$s%' OR 
    2049                         comment_author_email LIKE '%$s%' OR 
    2050                         comment_author_url LIKE ('%$s%') OR 
    2051                         comment_author_IP LIKE ('%$s%') OR 
    2052                         comment_content LIKE ('%$s%') ) AND 
     2060                $query .= "AND 
     2061                        (c.comment_author LIKE '%$s%' OR 
     2062                        c.comment_author_email LIKE '%$s%' OR 
     2063                        c.comment_author_url LIKE ('%$s%') OR 
     2064                        c.comment_author_IP LIKE ('%$s%') OR 
     2065                        c.comment_content LIKE ('%$s%') ) AND 
    20532066                        $approved 
    20542067                        $typesql"; 
    20552068        } else { 
    2056                 $query = "FROM $wpdb->comments $index WHERE $approved $post $typesql"; 
     2069                $query .= "AND $approved $post $typesql"; 
    20572070        } 
    2058  
     2071         
    20592072        $comments = $wpdb->get_results("SELECT * $query $orderby"); 
    20602073        if ( '' === $total ) 
    2061                 $total = $wpdb->get_var("SELECT COUNT(comment_ID) $query"); 
     2074                $total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query"); 
    20622075 
    20632076        update_comment_cache($comments); 
    20642077 
  • wp-admin/post.php

     
    116116        $post = get_post($post_ID); 
    117117 
    118118        if ( empty($post->ID) ) wp_die( __('You attempted to edit a post that doesn&#8217;t exist. Perhaps it was deleted?') ); 
     119        if ( $post->post_status == 'deleted' ) wp_die( __('You can&#8217;t edit this post because it is in the Trash. Please move it out of the Trash and try again.') ); 
    119120 
    120121        if ( 'post' != $post->post_type ) { 
    121122                wp_redirect( get_edit_post_link( $post->ID, 'url' ) ); 
     
    206207        exit(); 
    207208        break; 
    208209 
     210case 'undelete': 
     211        $post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']); 
     212        check_admin_referer('undelete-post_' . $post_id); 
     213 
     214        $post = & get_post($post_id); 
     215 
     216        if ( !wp_undelete_post($post_id) ) 
     217                wp_die( __('Error in undeleting...') ); 
     218 
     219        $sendback = wp_get_referer(); 
     220        if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?undeleted=1'); 
     221        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 
     222        else $sendback = add_query_arg('undeleted', 1, $sendback); 
     223        wp_redirect($sendback); 
     224        exit(); 
     225        break; 
     226 
    209227case 'preview': 
    210228        check_admin_referer( 'autosave', 'autosavenonce' ); 
    211229 
  • wp-admin/edit-page-form.php

     
    216216<div id="delete-action"> 
    217217<?php 
    218218if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?> 
    219 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo 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 page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> 
     219<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a> 
    220220<?php } ?> 
    221221</div> 
    222222 
  • wp-admin/edit-form-advanced.php

     
    229229<div id="delete-action"> 
    230230<?php 
    231231if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?> 
    232 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo 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;"><?php _e('Delete'); ?></a> 
     232<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a> 
    233233<?php } ?> 
    234234</div> 
    235235 
  • wp-admin/edit.php

     
    1818} 
    1919 
    2020// Handle bulk actions 
    21 if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) { 
    22         $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2']; 
    23  
     21if ( isset($_GET['doaction']) ||  isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) { 
     22        check_admin_referer('bulk-posts'); 
     23         
     24        if (isset($_GET['delete_all']) || isset($_GET['delete_all2'])) { 
     25                $post_status = $wpdb->escape($_GET['post_status']); 
     26                $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='post' AND post_status = '$post_status'" ); 
     27                $doaction = 'delete'; 
     28        } elseif (($_GET['action'] != -1 || $_GET['action2'] != -1) && isset($_GET['post'])) { 
     29                $post_ids = $_GET['post']; 
     30                $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2']; 
     31        } else wp_redirect($_SERVER['HTTP_REFERER']); 
     32         
    2433        switch ( $doaction ) { 
    2534                case 'delete': 
    26                         if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) { 
    27                                 check_admin_referer('bulk-posts'); 
    28                                 $deleted = 0; 
    29                                 foreach( (array) $_GET['post'] as $post_id_del ) { 
    30                                         $post_del = & get_post($post_id_del); 
     35                        $deleted = 0; 
     36                        foreach( (array) $post_ids as $post_id_del ) { 
     37                                $post_del = & get_post($post_id_del); 
    3138 
    32                                         if ( !current_user_can('delete_post', $post_id_del) ) 
    33                                                 wp_die( __('You are not allowed to delete this post.') ); 
     39                                if ( !current_user_can('delete_post', $post_id_del) ) 
     40                                        wp_die( __('You are not allowed to delete this post.') ); 
    3441 
    35                                         if ( $post_del->post_type == 'attachment' ) { 
    36                                                 if ( ! wp_delete_attachment($post_id_del) ) 
    37                                                         wp_die( __('Error in deleting...') ); 
    38                                         } else { 
    39                                                 if ( !wp_delete_post($post_id_del) ) 
    40                                                         wp_die( __('Error in deleting...') ); 
    41                                         } 
    42                                         $deleted++; 
     42                                if ( $post_del->post_type == 'attachment' ) { 
     43                                        if ( ! wp_delete_attachment($post_id_del) ) 
     44                                                wp_die( __('Error in deleting...') ); 
     45                                } else { 
     46                                        if ( !wp_delete_post($post_id_del) ) 
     47                                                wp_die( __('Error in deleting...') ); 
    4348                                } 
     49                                $deleted++; 
    4450                        } 
    4551                        break; 
    46                 case 'edit': 
    47                         if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) { 
    48                                 check_admin_referer('bulk-posts'); 
     52                case 'undelete': 
     53                        $undeleted = 0; 
     54                        foreach( (array) $post_ids as $post_id ) { 
     55                                $post_del = & get_post($post_id); 
    4956 
    50                                 if ( -1 == $_GET['_status'] ) { 
    51                                         $_GET['post_status'] = null; 
    52                                         unset($_GET['_status'], $_GET['post_status']); 
    53                                 } else { 
    54                                         $_GET['post_status'] = $_GET['_status']; 
    55                                 } 
    56  
    57                                 $done = bulk_edit_posts($_GET); 
     57                                if ( !wp_undelete_post($post_id) ) 
     58                                        wp_die( __('Error in undeleting...') ); 
     59                                 
     60                                $undeleted++; 
    5861                        } 
    5962                        break; 
     63                case 'edit': 
     64                        if ( -1 == $_GET['_status'] ) { 
     65                                $_GET['post_status'] = null; 
     66                                unset($_GET['_status'], $_GET['post_status']); 
     67                        } else { 
     68                                $_GET['post_status'] = $_GET['_status']; 
     69                        } 
     70 
     71                        $done = bulk_edit_posts($_GET); 
     72                        break; 
    6073        } 
    6174 
    6275        $sendback = wp_get_referer(); 
     
    7083        } 
    7184        if ( isset($deleted) ) 
    7285                $sendback = add_query_arg('deleted', $deleted, $sendback); 
     86        if ( isset($undeleted) ) 
     87                $sendback = add_query_arg('undeleted', $undeleted, $sendback); 
    7388        wp_redirect($sendback); 
    7489        exit(); 
    7590} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { 
     
    127142        unset($_GET['deleted']); 
    128143} 
    129144 
     145if ( isset($_GET['undeleted']) && (int) $_GET['undeleted'] ) { 
     146        printf( _n( 'Post returned to Pending.', '%s posts returned to Pending.', $_GET['undeleted'] ), number_format_i18n( $_GET['undeleted'] ) ); 
     147        unset($_GET['undeleted']); 
     148} 
     149 
    130150$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] ); 
    131151?> 
    132152</p></div> 
     
    139159if ( empty($locked_post_status) ) : 
    140160$status_links = array(); 
    141161$num_posts = wp_count_posts( 'post', 'readable' ); 
    142 $total_posts = array_sum( (array) $num_posts ); 
     162$total_posts = array_sum( (array) $num_posts ) - $num_posts->deleted; 
    143163$class = empty( $_GET['post_status'] ) ? ' class="current"' : ''; 
    144164$status_links[] = "<li><a href='edit.php' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>'; 
    145165 
     
    192212<div class="alignleft actions"> 
    193213<select name="action"> 
    194214<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option> 
     215<?php if ($_GET['post_status'] == 'deleted') { ?> 
     216<option value="undelete"><?php _e('Return to Pending'); ?></option> 
     217<option value="delete"><?php _e('Delete Permanently'); ?></option> 
     218<?php } else { ?> 
    195219<option value="edit"><?php _e('Edit'); ?></option> 
    196 <option value="delete"><?php _e('Delete'); ?></option> 
     220<option value="delete"><?php _e('Move to Trash'); ?></option> 
     221<?php } ?> 
    197222</select> 
    198223<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 
    199224<?php wp_nonce_field('bulk-posts'); ?> 
     
    237262do_action('restrict_manage_posts'); 
    238263?> 
    239264<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" /> 
    240  
     265<?php } if ($_GET['post_status'] == 'deleted') { ?> 
     266<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 
    241267<?php } ?> 
    242268</div> 
    243269 
     
    272298<div class="alignleft actions"> 
    273299<select name="action2"> 
    274300<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option> 
     301<?php if ($_GET['post_status'] == 'deleted') { ?> 
     302<option value="undelete"><?php _e('Return to Pending'); ?></option> 
     303<option value="delete"><?php _e('Delete Permanently'); ?></option> 
     304<?php } else { ?> 
    275305<option value="edit"><?php _e('Edit'); ?></option> 
    276 <option value="delete"><?php _e('Delete'); ?></option> 
     306<option value="delete"><?php _e('Move to Trash'); ?></option> 
     307<?php } ?> 
    277308</select> 
    278309<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 
     310<?php if ($_GET['post_status'] == 'deleted') { ?> 
     311<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 
     312<?php } ?> 
    279313<br class="clear" /> 
    280314</div> 
    281315<br class="clear" /> 
  • wp-admin/page.php

     
    8383        $post = get_post_to_edit($page_ID); 
    8484 
    8585        if ( empty($post->ID) ) wp_die( __('You attempted to edit a page that doesn&#8217;t exist. Perhaps it was deleted?') ); 
     86        if ( $post->post_status == 'deleted' ) wp_die( __('You can&#8217;t edit this page because it is in the Trash. Please move it out of the Trash and try again.') ); 
    8687 
    8788        if ( 'page' != $post->post_type ) { 
    8889                wp_redirect( get_edit_post_link( $post_ID, 'url' ) ); 
     
    165166        exit(); 
    166167        break; 
    167168 
     169case 'undelete': 
     170        $post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']); 
     171        check_admin_referer('undelete-page_' . $post_id); 
     172 
     173        $post = & get_post($post_id); 
     174 
     175        if ( !wp_undelete_post($post_id) ) 
     176                wp_die( __('Error in undeleting...') ); 
     177 
     178        $sendback = wp_get_referer(); 
     179        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit.php?undeleted=1'); 
     180        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 
     181        else $sendback = add_query_arg('undeleted', 1, $sendback); 
     182        wp_redirect($sendback); 
     183        exit(); 
     184        break; 
     185 
    168186case 'preview': 
    169187        check_admin_referer( 'autosave', 'autosavenonce' ); 
    170188 
  • wp-admin/edit-pages.php

     
    1010require_once('admin.php'); 
    1111 
    1212// Handle bulk actions 
    13 if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) { 
    14         $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2']; 
     13if ( isset($_GET['doaction']) ||  isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) { 
     14        check_admin_referer('bulk-pages'); 
     15         
     16        if (isset($_GET['delete_all']) || isset($_GET['delete_all2'])) { 
     17                $post_status = $wpdb->escape($_GET['post_status']); 
     18                $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = '$post_status'" ); 
     19                $doaction = 'delete'; 
     20        } elseif (($_GET['action'] != -1 || $_GET['action2'] != -1) && isset($_GET['post'])) { 
     21                $post_ids = $_GET['post']; 
     22                $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2']; 
     23        } else wp_redirect($_SERVER['HTTP_REFERER']); 
    1524 
    1625        switch ( $doaction ) { 
    1726                case 'delete': 
    18                         if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) { 
    19                                 check_admin_referer('bulk-pages'); 
    20                                 $deleted = 0; 
    21                                 foreach( (array) $_GET['post'] as $post_id_del ) { 
    22                                         $post_del = & get_post($post_id_del); 
     27                        $deleted = 0; 
     28                        foreach( (array) $post_ids as $post_id_del ) { 
     29                                $post_del = & get_post($post_id_del); 
    2330 
    24                                         if ( !current_user_can('delete_page', $post_id_del) ) 
    25                                                 wp_die( __('You are not allowed to delete this page.') ); 
     31                                if ( !current_user_can('delete_page', $post_id_del) ) 
     32                                        wp_die( __('You are not allowed to delete this page.') ); 
    2633 
    27                                         if ( $post_del->post_type == 'attachment' ) { 
    28                                                 if ( ! wp_delete_attachment($post_id_del) ) 
    29                                                         wp_die( __('Error in deleting...') ); 
    30                                         } else { 
    31                                                 if ( !wp_delete_post($post_id_del) ) 
    32                                                         wp_die( __('Error in deleting...') ); 
    33                                         } 
    34                                         $deleted++; 
     34                                if ( $post_del->post_type == 'attachment' ) { 
     35                                        if ( ! wp_delete_attachment($post_id_del) ) 
     36                                                wp_die( __('Error in deleting...') ); 
     37                                } else { 
     38                                        if ( !wp_delete_post($post_id_del) ) 
     39                                                wp_die( __('Error in deleting...') ); 
    3540                                } 
     41                                $deleted++; 
    3642                        } 
    3743                        break; 
    38                 case 'edit': 
    39                         if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) { 
    40                                 check_admin_referer('bulk-pages'); 
     44                case 'undelete': 
     45                        $undeleted = 0; 
     46                        foreach( (array) $post_ids as $post_id ) { 
     47                                $post_del = & get_post($post_id); 
    4148 
    42                                 if ( -1 == $_GET['_status'] ) { 
    43                                         $_GET['post_status'] = null; 
    44                                         unset($_GET['_status'], $_GET['post_status']); 
    45                                 } else { 
    46                                         $_GET['post_status'] = $_GET['_status']; 
    47                                 } 
    48  
    49                                 $done = bulk_edit_posts($_GET); 
     49                                if ( !wp_undelete_post($post_id) ) 
     50                                        wp_die( __('Error in undeleting...') ); 
     51                                 
     52                                $undeleted++; 
    5053                        } 
    5154                        break; 
     55                case 'edit': 
     56                        if ( -1 == $_GET['_status'] ) { 
     57                                $_GET['post_status'] = null; 
     58                                unset($_GET['_status'], $_GET['post_status']); 
     59                        } else { 
     60                                $_GET['post_status'] = $_GET['_status']; 
     61                        } 
     62 
     63                        $done = bulk_edit_posts($_GET); 
     64                        break; 
    5265        } 
    5366 
    5467        $sendback = wp_get_referer(); 
     
    7992                'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')), 
    8093                'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')), 
    8194                'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')), 
    82                 'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')) 
     95                'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')), 
     96                'deleted' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page')) 
    8397        ); 
    8498 
    8599$post_stati = apply_filters('page_stati', $post_stati); 
     
    150164if ( empty($locked_post_status) ) : 
    151165$status_links = array(); 
    152166$num_posts = wp_count_posts('page', 'readable'); 
    153 $total_posts = array_sum( (array) $num_posts ); 
     167$total_posts = array_sum( (array) $num_posts ) - $num_posts->deleted; 
    154168$class = empty($_GET['post_status']) ? ' class="current"' : ''; 
    155169$status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'pages' ), number_format_i18n( $total_posts ) ) . '</a>'; 
    156170foreach ( $post_stati as $status => $label ) { 
     
    214228<div class="alignleft actions"> 
    215229<select name="action"> 
    216230<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option> 
     231<?php if ($_GET['post_status'] == 'deleted') { ?> 
     232<option value="undelete"><?php _e('Return to Pending'); ?></option> 
     233<option value="delete"><?php _e('Delete Permanently'); ?></option> 
     234<?php } else { ?> 
    217235<option value="edit"><?php _e('Edit'); ?></option> 
    218 <option value="delete"><?php _e('Delete'); ?></option> 
     236<option value="delete"><?php _e('Move to Trash'); ?></option> 
     237<?php } ?> 
    219238</select> 
    220239<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 
    221240<?php wp_nonce_field('bulk-pages'); ?> 
     241<?php if ($_GET['post_status'] == 'deleted') { ?> 
     242<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 
     243<?php } ?> 
    222244</div> 
    223245 
    224246<br class="clear" /> 
     
    253275<div class="alignleft actions"> 
    254276<select name="action2"> 
    255277<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option> 
     278<?php if ($_GET['post_status'] == 'deleted') { ?> 
     279<option value="undelete"><?php _e('Return to Pending'); ?></option> 
     280<option value="delete"><?php _e('Delete Permanently'); ?></option> 
     281<?php } else { ?> 
    256282<option value="edit"><?php _e('Edit'); ?></option> 
    257 <option value="delete"><?php _e('Delete'); ?></option> 
     283<option value="delete"><?php _e('Move to Trash'); ?></option> 
     284<?php } ?> 
    258285</select> 
    259286<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 
     287<?php if ($_GET['post_status'] == 'deleted') { ?> 
     288<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 
     289<?php } ?> 
    260290</div> 
    261291 
    262292<br class="clear" />